@zhubangyun/lowcode-core 5.12.161 → 6.2.30

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 (89) hide show
  1. package/es/components/load-materials/index.js +38 -22
  2. package/es/components/page-loading/index.js +4 -1
  3. package/es/index.d.ts +1 -1
  4. package/es/index.js +19 -2
  5. package/es/index.less +21 -0
  6. package/es/init/init.bar-height.d.ts +1 -0
  7. package/es/init/init.bar-height.js +37 -0
  8. package/es/init/init.mobile-class.d.ts +1 -0
  9. package/es/init/init.mobile-class.js +10 -0
  10. package/es/init/init.scroll-size.d.ts +5 -0
  11. package/es/init/init.scroll-size.js +26 -0
  12. package/es/style.js +3 -3
  13. package/es/utils/api/form-api.d.ts +2 -0
  14. package/es/utils/api/form-api.js +155 -34
  15. package/es/utils/api/index.d.ts +1 -1
  16. package/es/utils/api/index.js +4 -2
  17. package/es/utils/api/rest-api.d.ts +3 -1
  18. package/es/utils/api/rest-api.js +105 -23
  19. package/es/utils/api/schema.util.d.ts +3 -3
  20. package/es/utils/api/schema.util.js +17 -12
  21. package/es/utils/cache/index.js +57 -17
  22. package/es/utils/common/index.d.ts +3 -0
  23. package/es/utils/common/index.js +17 -3
  24. package/es/utils/page/index.js +10 -6
  25. package/es/utils/page/page-form-data-manager-group.js +10 -10
  26. package/es/utils/page/page-form-data-manager.d.ts +1 -0
  27. package/es/utils/page/page-form-data-manager.js +10 -10
  28. package/es/utils/page/page-form-group.d.ts +1 -0
  29. package/es/utils/page/page-form-group.js +2 -2
  30. package/es/utils/page/page-form.d.ts +1 -0
  31. package/es/utils/page/page-form.js +12 -4
  32. package/es/utils/page/page-layout.d.ts +3 -1
  33. package/es/utils/page/page-layout.js +44 -7
  34. package/es/utils/page/page-load-schema.js +20 -28
  35. package/es/utils/page/page-render.js +4 -5
  36. package/es/utils/page/page-show.d.ts +2 -0
  37. package/es/utils/page/page-show.js +9 -4
  38. package/es/utils/page/print-form.d.ts +3 -2
  39. package/es/utils/page/print-form.js +200 -61
  40. package/es/utils/uni-bridge.d.ts +20 -0
  41. package/es/utils/uni-bridge.js +172 -0
  42. package/es/utils/util.common.d.ts +1 -0
  43. package/es/utils/util.common.js +4 -0
  44. package/es/utils/utils.scrollbar-size.js +0 -0
  45. package/lib/components/load-materials/index.js +38 -22
  46. package/lib/components/page-loading/index.js +4 -1
  47. package/lib/index.d.ts +1 -1
  48. package/lib/index.js +22 -4
  49. package/lib/index.less +21 -0
  50. package/lib/init/init.bar-height.d.ts +1 -0
  51. package/lib/init/init.bar-height.js +42 -0
  52. package/lib/init/init.mobile-class.d.ts +1 -0
  53. package/lib/init/init.mobile-class.js +14 -0
  54. package/lib/init/init.scroll-size.d.ts +5 -0
  55. package/lib/init/init.scroll-size.js +31 -0
  56. package/lib/style.js +3 -3
  57. package/lib/utils/api/form-api.d.ts +2 -0
  58. package/lib/utils/api/form-api.js +155 -34
  59. package/lib/utils/api/index.d.ts +1 -1
  60. package/lib/utils/api/index.js +4 -2
  61. package/lib/utils/api/rest-api.d.ts +3 -1
  62. package/lib/utils/api/rest-api.js +105 -23
  63. package/lib/utils/api/schema.util.d.ts +3 -3
  64. package/lib/utils/api/schema.util.js +19 -13
  65. package/lib/utils/cache/index.js +56 -16
  66. package/lib/utils/common/index.d.ts +3 -0
  67. package/lib/utils/common/index.js +19 -2
  68. package/lib/utils/page/index.js +10 -6
  69. package/lib/utils/page/page-form-data-manager-group.js +10 -10
  70. package/lib/utils/page/page-form-data-manager.d.ts +1 -0
  71. package/lib/utils/page/page-form-data-manager.js +10 -10
  72. package/lib/utils/page/page-form-group.d.ts +1 -0
  73. package/lib/utils/page/page-form-group.js +2 -2
  74. package/lib/utils/page/page-form.d.ts +1 -0
  75. package/lib/utils/page/page-form.js +12 -4
  76. package/lib/utils/page/page-layout.d.ts +3 -1
  77. package/lib/utils/page/page-layout.js +44 -7
  78. package/lib/utils/page/page-load-schema.js +19 -27
  79. package/lib/utils/page/page-render.js +4 -5
  80. package/lib/utils/page/page-show.d.ts +2 -0
  81. package/lib/utils/page/page-show.js +9 -4
  82. package/lib/utils/page/print-form.d.ts +3 -2
  83. package/lib/utils/page/print-form.js +200 -61
  84. package/lib/utils/uni-bridge.d.ts +20 -0
  85. package/lib/utils/uni-bridge.js +177 -0
  86. package/lib/utils/util.common.d.ts +1 -0
  87. package/lib/utils/util.common.js +8 -0
  88. package/lib/utils/utils.scrollbar-size.js +1 -0
  89. package/package.json +2 -2
@@ -345,16 +345,98 @@ export var BaseRestApi = /*#__PURE__*/function () {
345
345
  }
346
346
  return _delete;
347
347
  }();
348
- _proto.showError = /*#__PURE__*/function () {
349
- var _showError = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(type, res) {
350
- var msg, props, _t;
348
+ _proto["export"] = /*#__PURE__*/function () {
349
+ var _export2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data, options) {
350
+ var _this$handleRequestCo8;
351
+ var config, res, _options$onError7, _options$onSuccess7;
351
352
  return _regeneratorRuntime.wrap(function (_context8) {
352
353
  while (1) switch (_context8.prev = _context8.next) {
354
+ case 0:
355
+ config = {};
356
+ _context8.next = 1;
357
+ return (_this$handleRequestCo8 = this.handleRequestConfig) === null || _this$handleRequestCo8 === void 0 ? void 0 : _this$handleRequestCo8.call(this, config);
358
+ case 1:
359
+ _context8.next = 2;
360
+ return this.request.post("/export", data, config);
361
+ case 2:
362
+ res = _context8.sent;
363
+ if (res.success) {
364
+ _context8.next = 4;
365
+ break;
366
+ }
367
+ this.showError("\u5BFC\u51FA\u5931\u8D25!", res).then();
368
+ _context8.next = 3;
369
+ return options === null || options === void 0 ? void 0 : (_options$onError7 = options.onError) === null || _options$onError7 === void 0 ? void 0 : _options$onError7.call(options, res);
370
+ case 3:
371
+ _context8.next = 5;
372
+ break;
373
+ case 4:
374
+ _context8.next = 5;
375
+ return options === null || options === void 0 ? void 0 : (_options$onSuccess7 = options.onSuccess) === null || _options$onSuccess7 === void 0 ? void 0 : _options$onSuccess7.call(options, res);
376
+ case 5:
377
+ return _context8.abrupt("return", res);
378
+ case 6:
379
+ case "end":
380
+ return _context8.stop();
381
+ }
382
+ }, _callee8, this);
383
+ }));
384
+ function _export(_x13, _x14) {
385
+ return _export2.apply(this, arguments);
386
+ }
387
+ return _export;
388
+ }();
389
+ _proto["import"] = /*#__PURE__*/function () {
390
+ var _import2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data, options) {
391
+ var _this$handleRequestCo9;
392
+ var config, res, _options$onError8, _options$onSuccess8;
393
+ return _regeneratorRuntime.wrap(function (_context9) {
394
+ while (1) switch (_context9.prev = _context9.next) {
395
+ case 0:
396
+ config = {};
397
+ _context9.next = 1;
398
+ return (_this$handleRequestCo9 = this.handleRequestConfig) === null || _this$handleRequestCo9 === void 0 ? void 0 : _this$handleRequestCo9.call(this, config);
399
+ case 1:
400
+ _context9.next = 2;
401
+ return this.request.post("import", data, config);
402
+ case 2:
403
+ res = _context9.sent;
404
+ if (res.success) {
405
+ _context9.next = 4;
406
+ break;
407
+ }
408
+ this.showError("\u5BFC\u5165\u5931\u8D25!", res).then();
409
+ _context9.next = 3;
410
+ return options === null || options === void 0 ? void 0 : (_options$onError8 = options.onError) === null || _options$onError8 === void 0 ? void 0 : _options$onError8.call(options, res);
411
+ case 3:
412
+ _context9.next = 5;
413
+ break;
414
+ case 4:
415
+ _context9.next = 5;
416
+ return options === null || options === void 0 ? void 0 : (_options$onSuccess8 = options.onSuccess) === null || _options$onSuccess8 === void 0 ? void 0 : _options$onSuccess8.call(options, res);
417
+ case 5:
418
+ return _context9.abrupt("return", res);
419
+ case 6:
420
+ case "end":
421
+ return _context9.stop();
422
+ }
423
+ }, _callee9, this);
424
+ }));
425
+ function _import(_x15, _x16) {
426
+ return _import2.apply(this, arguments);
427
+ }
428
+ return _import;
429
+ }();
430
+ _proto.showError = /*#__PURE__*/function () {
431
+ var _showError = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(type, res) {
432
+ var msg, props, _t;
433
+ return _regeneratorRuntime.wrap(function (_context0) {
434
+ while (1) switch (_context0.prev = _context0.next) {
353
435
  case 0:
354
436
  msg = res.message;
355
- _context8.prev = 1;
437
+ _context0.prev = 1;
356
438
  if (!msg) {
357
- _context8.next = 4;
439
+ _context0.next = 4;
358
440
  break;
359
441
  }
360
442
  props = JSON.parse(msg);
@@ -363,31 +445,31 @@ export var BaseRestApi = /*#__PURE__*/function () {
363
445
  props.title = "" + this.title + type;
364
446
  }
365
447
  if (!(props.type == "message")) {
366
- _context8.next = 2;
448
+ _context0.next = 2;
367
449
  break;
368
450
  }
369
451
  _message.error(props);
370
- return _context8.abrupt("return");
452
+ return _context0.abrupt("return");
371
453
  case 2:
372
454
  if (!(props.type == "modal")) {
373
- _context8.next = 3;
455
+ _context0.next = 3;
374
456
  break;
375
457
  }
376
458
  _Modal.error(props);
377
- return _context8.abrupt("return");
459
+ return _context0.abrupt("return");
378
460
  case 3:
379
461
  if (!(props.type == "notification")) {
380
- _context8.next = 4;
462
+ _context0.next = 4;
381
463
  break;
382
464
  }
383
465
  _notification.error(props);
384
- return _context8.abrupt("return");
466
+ return _context0.abrupt("return");
385
467
  case 4:
386
- _context8.next = 6;
468
+ _context0.next = 6;
387
469
  break;
388
470
  case 5:
389
- _context8.prev = 5;
390
- _t = _context8["catch"](1);
471
+ _context0.prev = 5;
472
+ _t = _context0["catch"](1);
391
473
  console.error("" + this.title + type + (msg || ""));
392
474
  _Modal.error({
393
475
  title: "" + this.title + type,
@@ -399,11 +481,11 @@ export var BaseRestApi = /*#__PURE__*/function () {
399
481
  });
400
482
  case 6:
401
483
  case "end":
402
- return _context8.stop();
484
+ return _context0.stop();
403
485
  }
404
- }, _callee8, this, [[1, 5]]);
486
+ }, _callee0, this, [[1, 5]]);
405
487
  }));
406
- function showError(_x13, _x14) {
488
+ function showError(_x17, _x18) {
407
489
  return _showError.apply(this, arguments);
408
490
  }
409
491
  return showError;
@@ -425,16 +507,16 @@ export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
425
507
  _inheritsLoose(RestApi, _BaseRestApi2);
426
508
  var _proto2 = RestApi.prototype;
427
509
  _proto2.handleRequestConfig = /*#__PURE__*/function () {
428
- var _handleRequestConfig = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(config) {
429
- return _regeneratorRuntime.wrap(function (_context9) {
430
- while (1) switch (_context9.prev = _context9.next) {
510
+ var _handleRequestConfig = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(config) {
511
+ return _regeneratorRuntime.wrap(function (_context1) {
512
+ while (1) switch (_context1.prev = _context1.next) {
431
513
  case 0:
432
514
  case "end":
433
- return _context9.stop();
515
+ return _context1.stop();
434
516
  }
435
- }, _callee9);
517
+ }, _callee1);
436
518
  }));
437
- function handleRequestConfig(_x15) {
519
+ function handleRequestConfig(_x19) {
438
520
  return _handleRequestConfig.apply(this, arguments);
439
521
  }
440
522
  return handleRequestConfig;
@@ -4,11 +4,11 @@
4
4
  * @param callback 返回true 继续往下遍历
5
5
  */
6
6
  export declare function forEachSchema(schema: Schema, callback: (child: Schema, index: number, children: any[]) => boolean): void;
7
- export declare function forEachFormSchema(schema: Schema, fdm: boolean, callback: (child: Schema) => void): void;
8
- interface Schema {
7
+ export declare function findFormSchemas(schema: Schema): Schema[];
8
+ export declare function findFdmSchemas(schema?: Schema): Schema[];
9
+ export interface Schema {
9
10
  componentName: string;
10
11
  props: any;
11
12
  children?: Schema[];
12
13
  fdmSchema?: Schema;
13
14
  }
14
- export {};
@@ -12,21 +12,26 @@ export function forEachSchema(schema, callback) {
12
12
  }
13
13
  });
14
14
  }
15
- export function forEachFormSchema(schema, fdm, callback) {
15
+ export function findFormSchemas(schema) {
16
+ var schemas = [];
16
17
  forEachSchema(schema, function (child) {
17
18
  if (["PageForm", "SubFormField"].includes(child.componentName)) {
18
- callback(child);
19
- if (fdm) {
20
- if (child.fdmSchema) {
21
- forEachSchema(child.fdmSchema, function (fdmChild) {
22
- if (fdmChild.componentName == "PageFdm") {
23
- callback(child);
24
- }
25
- return true;
26
- });
27
- }
28
- }
19
+ schemas.push(child);
29
20
  }
30
21
  return true;
31
22
  });
23
+ return schemas;
24
+ }
25
+ export function findFdmSchemas(schema) {
26
+ var schemas = [];
27
+ if (!schema) {
28
+ return schemas;
29
+ }
30
+ forEachSchema(schema, function (child) {
31
+ if (["PageFdm"].includes(child.componentName)) {
32
+ schemas.push(child);
33
+ }
34
+ return true;
35
+ });
36
+ return schemas;
32
37
  }
@@ -3,7 +3,7 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { SingletonInstanceMap } from "../common/SingletonInstanceMap";
5
5
  import { apiRequest, RestFormApi } from "../api";
6
- import { forEachFormSchema } from "../api/schema.util";
6
+ import { findFdmSchemas, findFormSchemas } from "../api/schema.util";
7
7
  export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
8
8
  function SchemaCache() {
9
9
  return _SingletonInstanceMap.apply(this, arguments) || this;
@@ -12,7 +12,7 @@ export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
12
12
  var _proto = SchemaCache.prototype;
13
13
  _proto.createInstance = /*#__PURE__*/function () {
14
14
  var _createInstance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(key, options) {
15
- var mock, pageId, schemaRes, schema, permissionRes, permission;
15
+ var mock, pageId, schemaRes, schema, handleCommonSchema, permission, printTemplates, workflow, cloneSchema, _t;
16
16
  return _regeneratorRuntime.wrap(function (_context) {
17
17
  while (1) switch (_context.prev = _context.next) {
18
18
  case 0:
@@ -25,30 +25,70 @@ export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
25
25
  });
26
26
  case 1:
27
27
  schemaRes = _context.sent;
28
- schema = schemaRes.data;
29
- if (!(typeof schema == "object")) {
30
- _context.next = 3;
28
+ if (schemaRes.succss) {
29
+ _context.next = 2;
31
30
  break;
32
31
  }
33
- _context.next = 2;
34
- return apiRequest.get("pages/" + pageId + "/permission");
32
+ return _context.abrupt("return", schemaRes);
35
33
  case 2:
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
- });
34
+ schema = schemaRes.data;
35
+ if (!(schema != null && typeof schema == "object")) {
36
+ _context.next = 8;
37
+ break;
38
+ }
39
+ handleCommonSchema = function handleCommonSchema(schema) {
40
+ schema.props = schema.props || {};
41
+ schema.props.permission = permission;
42
+ schema.props.printTemplates = printTemplates;
43
+ schema.props.workflow = workflow;
44
+ };
45
+ //处理权限
46
+ permission = null; //处理打印
47
+ workflow = null;
48
+ if (location.pathname.startsWith("/print")) {
49
+ _context.next = 7;
50
+ break;
43
51
  }
52
+ _context.next = 3;
53
+ return apiRequest.get("pages/" + pageId + "/permission");
44
54
  case 3:
45
- console.log("schemaRes", schemaRes);
55
+ permission = _context.sent.data;
56
+ if (!((schema === null || schema === void 0 ? void 0 : schema.type) == "form")) {
57
+ _context.next = 7;
58
+ break;
59
+ }
60
+ _context.prev = 4;
61
+ _context.next = 5;
62
+ return apiRequest.get("pages/" + pageId + "/printTemplates");
63
+ case 5:
64
+ printTemplates = _context.sent.data;
65
+ _context.next = 7;
66
+ break;
67
+ case 6:
68
+ _context.prev = 6;
69
+ _t = _context["catch"](4);
70
+ console.log(_t);
71
+ case 7:
72
+ findFormSchemas(schema).forEach(function (formSchema) {
73
+ handleCommonSchema(formSchema);
74
+ findFdmSchemas(formSchema.fdmSchema).forEach(function (fdmSchema) {
75
+ handleCommonSchema(fdmSchema);
76
+ fdmSchema.props.form.label = formSchema.props.label;
77
+ });
78
+ });
79
+ cloneSchema = JSON.parse(JSON.stringify(schema));
80
+ findFormSchemas(schema).forEach(function (formSchema) {
81
+ findFdmSchemas(formSchema.fdmSchema).forEach(function (fdmSchema) {
82
+ fdmSchema.props.formElement = cloneSchema;
83
+ });
84
+ });
85
+ case 8:
46
86
  return _context.abrupt("return", schemaRes);
47
- case 4:
87
+ case 9:
48
88
  case "end":
49
89
  return _context.stop();
50
90
  }
51
- }, _callee);
91
+ }, _callee, null, [[4, 6]]);
52
92
  }));
53
93
  function createInstance(_x, _x2) {
54
94
  return _createInstance.apply(this, arguments);
@@ -1,3 +1,6 @@
1
1
  export { loadPlugins } from "./LoadPlugins";
2
2
  export declare function uuid(prefix?: string, separator?: string): string;
3
+ export declare function uuidVersion(id: string): number | false;
3
4
  export declare function toArray(data: any): any[];
5
+ export declare function isLocalhost(): boolean;
6
+ export declare function isMobile(): boolean;
@@ -1,13 +1,20 @@
1
- import { v4 } from "uuid";
1
+ import { v7, version } from "uuid";
2
2
  export { loadPlugins } from "./LoadPlugins";
3
3
  export function uuid(prefix, separator) {
4
4
  if (!prefix && !separator) {
5
- return v4();
5
+ return v7();
6
6
  }
7
- return [prefix, separator, v4()].filter(function (v) {
7
+ return [prefix, separator, v7()].filter(function (v) {
8
8
  return !!v;
9
9
  }).join("");
10
10
  }
11
+ export function uuidVersion(id) {
12
+ try {
13
+ return version(id);
14
+ } catch (e) {
15
+ return false;
16
+ }
17
+ }
11
18
  export function toArray(data) {
12
19
  if (!data) {
13
20
  return [];
@@ -16,4 +23,11 @@ export function toArray(data) {
16
23
  } else {
17
24
  return [data];
18
25
  }
26
+ }
27
+ export function isLocalhost() {
28
+ return window.location.hostname == "localhost";
29
+ }
30
+ export function isMobile() {
31
+ var userAgent = navigator.userAgent;
32
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(userAgent);
19
33
  }
@@ -1,5 +1,6 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { uniBridge } from "../uni-bridge";
3
4
  export { print, getFormPrintTemplates } from "./print-form";
4
5
  export { showForm } from "./page-form";
5
6
  export { showFormGroup } from "./page-form-group";
@@ -27,6 +28,7 @@ function _showLoading() {
27
28
  return _regeneratorRuntime.wrap(function (_context) {
28
29
  while (1) switch (_context.prev = _context.next) {
29
30
  case 0:
31
+ console.log("page.show.loading");
30
32
  loading = document.getElementById("fullscreen-loading");
31
33
  if (loading) {
32
34
  loading.style.display = "flex";
@@ -53,6 +55,7 @@ function _hideLoading() {
53
55
  return _regeneratorRuntime.wrap(function (_context2) {
54
56
  while (1) switch (_context2.prev = _context2.next) {
55
57
  case 0:
58
+ console.log("page.hide.loading");
56
59
  loading = document.getElementById("fullscreen-loading");
57
60
  if (loading) {
58
61
  loading.style.display = "none";
@@ -87,14 +90,15 @@ function _openPage() {
87
90
  url: url
88
91
  });
89
92
  case 1:
90
- page = _context3.sent;
91
- _context3.next = 3;
92
- break;
93
+ return _context3.abrupt("return", _context3.sent);
93
94
  case 2:
94
- page = window.open(url, target);
95
+ if (!isMobile) {
96
+ _context3.next = 3;
97
+ break;
98
+ }
99
+ return _context3.abrupt("return", uniBridge.navigateTo(url));
95
100
  case 3:
96
- console.debug("openPage", page, target);
97
- return _context3.abrupt("return", page);
101
+ return _context3.abrupt("return", window.open(url, target));
98
102
  case 4:
99
103
  case "end":
100
104
  return _context3.stop();
@@ -2,26 +2,26 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
4
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
- var _excluded = ["layout", "items", "onSelectOk", "onClose"],
6
- _excluded2 = ["container", "onClose"];
5
+ var _excluded = ["layout", "items", "onSelectOk", "container", "onClose"],
6
+ _excluded2 = ["onClose"];
7
7
  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
11
  import { renderElement } from "./page-render";
12
- import { v4 } from "uuid";
12
+ import { uuid } from "../common";
13
13
  export function showFormDataManagerGroup(_x) {
14
14
  return _showFormDataManagerGroup.apply(this, arguments);
15
15
  }
16
16
  function _showFormDataManagerGroup() {
17
17
  _showFormDataManagerGroup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
18
- var container, onClose, props;
18
+ var onClose, props;
19
19
  return _regeneratorRuntime.wrap(function (_context) {
20
20
  while (1) switch (_context.prev = _context.next) {
21
21
  case 0:
22
- container = options.container, onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
22
+ onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
23
23
  return _context.abrupt("return", renderElement({
24
- container: container,
24
+ container: props.container,
25
25
  onClose: onClose,
26
26
  element: {
27
27
  component: FormDataManagerRender,
@@ -55,6 +55,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
55
55
  layout = _this$props.layout,
56
56
  items = _this$props.items,
57
57
  onSelectOk = _this$props.onSelectOk,
58
+ container = _this$props.container,
58
59
  onClose = _this$props.onClose,
59
60
  restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
60
61
  // @ts-ignore
@@ -72,17 +73,16 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
72
73
  onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
73
74
  };
74
75
  return /*#__PURE__*/React.createElement(PageLayout, {
76
+ container: container,
75
77
  ref: function ref(layout) {
76
78
  return _this2.layoutRef = layout;
77
79
  },
78
80
  layout: layout,
79
- onClose: function onClose() {
80
- onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
81
- }
81
+ onClose: onClose
82
82
  }, /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
83
83
  components: window._components || window.components || window.__components,
84
84
  schema: {
85
- id: v4(),
85
+ id: uuid(),
86
86
  componentName: "Page",
87
87
  props: {},
88
88
  state: {},
@@ -11,6 +11,7 @@ export interface DataView {
11
11
  id?: string;
12
12
  fieldId?: string;
13
13
  };
14
+ extraProps?: any;
14
15
  labelField?: string;
15
16
  secondaryLabelFields?: string[];
16
17
  fieldWidth?: Record<string, number>;
@@ -2,28 +2,28 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
4
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
- var _excluded = ["layout", "form", "onSelectOk", "onClose"],
6
- _excluded2 = ["container", "onClose"];
5
+ var _excluded = ["layout", "form", "onSelectOk", "onClose", "container"],
6
+ _excluded2 = ["onClose"];
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import { PageLayout } from "./page-layout";
9
9
  import React, { Component } from "react";
10
10
  import { PageLoadSchema } from "./page-load-schema";
11
11
  import { ReactRender } from "../../components/react-render";
12
- import { forEachFormSchema } from "../cache/schema";
13
12
  import { cloneDataView } from "./page-schema-utils";
14
13
  import { renderElement } from "./page-render";
14
+ import { forEachSchema } from "../api/schema.util";
15
15
  export function showFormDataManager(_x) {
16
16
  return _showFormDataManager.apply(this, arguments);
17
17
  }
18
18
  function _showFormDataManager() {
19
19
  _showFormDataManager = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
20
- var container, onClose, props;
20
+ var onClose, props;
21
21
  return _regeneratorRuntime.wrap(function (_context) {
22
22
  while (1) switch (_context.prev = _context.next) {
23
23
  case 0:
24
- container = options.container, onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
24
+ onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
25
25
  return _context.abrupt("return", renderElement({
26
- container: container,
26
+ container: props.container,
27
27
  onClose: onClose,
28
28
  element: {
29
29
  component: FormDataManagerRender,
@@ -58,6 +58,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
58
58
  form = _this$props.form,
59
59
  onSelectOk = _this$props.onSelectOk,
60
60
  onClose = _this$props.onClose,
61
+ container = _this$props.container,
61
62
  restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
62
63
  // @ts-ignore
63
64
  restProps.layout = layout || "modal";
@@ -75,19 +76,18 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
75
76
  };
76
77
  var dataView = cloneDataView(this.props.dataView, this.props.extraProps);
77
78
  return /*#__PURE__*/React.createElement(PageLayout, {
79
+ container: container,
78
80
  ref: function ref(layout) {
79
81
  return _this2.layoutRef = layout;
80
82
  },
81
83
  layout: layout,
82
- onClose: function onClose() {
83
- onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
84
- }
84
+ onClose: onClose
85
85
  }, /*#__PURE__*/React.createElement(PageLoadSchema, {
86
86
  pageId: form === null || form === void 0 ? void 0 : form.id
87
87
  }, function (schema) {
88
88
  var fdmSchema = schema.children[0].fdmSchema;
89
89
  if (form !== null && form !== void 0 && form.fieldId) {
90
- forEachFormSchema(schema, function (field) {
90
+ forEachSchema(schema, function (field) {
91
91
  if (form.fieldId == field.props.fieldId) {
92
92
  fdmSchema = field.fdmSchema;
93
93
  return false;
@@ -7,6 +7,7 @@ export interface ShowFormGroupProps {
7
7
  id: string;
8
8
  fieldId?: string;
9
9
  };
10
+ extraProps?: any;
10
11
  items?: any[];
11
12
  mode?: PageFormModeType;
12
13
  onSubmitOk?: (data: any) => void;
@@ -9,8 +9,8 @@ import { PageLayout } from "./page-layout";
9
9
  import { renderElement } from "./page-render";
10
10
  import React, { Component } from "react";
11
11
  import { ReactRender } from "../../components/react-render";
12
- import { v4 } from "uuid";
13
12
  import { PageLoadSchema } from "./page-load-schema";
13
+ import { uuid } from "../common";
14
14
  export function showFormGroup(_x) {
15
15
  return _showFormGroup.apply(this, arguments);
16
16
  }
@@ -78,7 +78,7 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
78
78
  return /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
79
79
  components: window._components || window.components || window.__components,
80
80
  schema: {
81
- id: v4(),
81
+ id: uuid(),
82
82
  componentName: "Page",
83
83
  props: {},
84
84
  state: {},
@@ -7,6 +7,7 @@ export interface ShowFormProps {
7
7
  id: string;
8
8
  fieldId?: string;
9
9
  };
10
+ extraProps?: any;
10
11
  mode?: PageFormModeType;
11
12
  lockMode?: boolean;
12
13
  dataId?: string;
@@ -16,7 +16,7 @@ export function showForm(_x) {
16
16
  }
17
17
  function _showForm() {
18
18
  _showForm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
19
- var container, onClose, props, _options$form, paths, mode, dataId, params, url, page;
19
+ var container, onClose, props, _options$form, paths, mode, dataId, params, _options$form2, url;
20
20
  return _regeneratorRuntime.wrap(function (_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
@@ -28,15 +28,23 @@ function _showForm() {
28
28
  paths = window.location.pathname.split("/");
29
29
  mode = options.mode, dataId = options.dataId;
30
30
  params = new URLSearchParams();
31
+ if ((_options$form = options.form) !== null && _options$form !== void 0 && _options$form.id) {
32
+ params.set("pageId", (_options$form2 = options.form) === null || _options$form2 === void 0 ? void 0 : _options$form2.id);
33
+ }
34
+ if (mode) {
35
+ params.set("mode", mode);
36
+ }
31
37
  if (dataId) {
32
38
  params.set("dataId", dataId);
33
39
  }
34
- url = "/" + paths[1] + "/" + paths[2] + "/" + ((_options$form = options.form) === null || _options$form === void 0 ? void 0 : _options$form.id) + "/" + mode + "?" + params.toString();
40
+ url = "/pages?" + params.toString();
41
+ if (paths[1] == "admin") {
42
+ url = "/admin/pages?" + params.toString();
43
+ }
44
+ //const url = `/${paths[1]}/${paths[2]}/${options.form?.id}/${mode}?${params.toString()}`;
35
45
  _context.next = 1;
36
46
  return openPage(url, url);
37
47
  case 1:
38
- page = _context.sent;
39
- console.debug("openPage", page);
40
48
  return _context.abrupt("return");
41
49
  case 2:
42
50
  return _context.abrupt("return", renderElement({
@@ -1,8 +1,9 @@
1
1
  import { Component } from "react";
2
2
  export type PageLayoutType = "page" | "modal" | "drawer";
3
3
  interface PageLayoutProps {
4
+ container?: any;
4
5
  layout?: PageLayoutType;
5
- onClose?: (evt: any) => void;
6
+ onClose?: () => void;
6
7
  keyboard?: boolean;
7
8
  children: any;
8
9
  }
@@ -12,6 +13,7 @@ interface PageLayoutState {
12
13
  }
13
14
  export declare class PageLayout extends Component<PageLayoutProps, PageLayoutState> {
14
15
  state: PageLayoutState;
16
+ get layout(): PageLayoutType;
15
17
  close: () => void;
16
18
  constructor(props: any);
17
19
  componentDidMount(): void;