@zhubangyun/lowcode-core 5.12.161 → 6.1.90

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/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 +41 -2
  5. package/es/index.less +10 -0
  6. package/es/style.js +2 -2
  7. package/es/utils/api/form-api.d.ts +1 -0
  8. package/es/utils/api/form-api.js +68 -29
  9. package/es/utils/api/index.d.ts +1 -1
  10. package/es/utils/api/index.js +1 -0
  11. package/es/utils/api/rest-api.d.ts +3 -1
  12. package/es/utils/api/rest-api.js +105 -23
  13. package/es/utils/api/schema.util.d.ts +3 -3
  14. package/es/utils/api/schema.util.js +17 -12
  15. package/es/utils/cache/index.js +57 -17
  16. package/es/utils/common/index.d.ts +3 -0
  17. package/es/utils/common/index.js +13 -3
  18. package/es/utils/page/page-form-data-manager-group.js +2 -2
  19. package/es/utils/page/page-form-data-manager.d.ts +1 -0
  20. package/es/utils/page/page-form-data-manager.js +2 -2
  21. package/es/utils/page/page-form-group.d.ts +1 -0
  22. package/es/utils/page/page-form-group.js +2 -2
  23. package/es/utils/page/page-form.d.ts +1 -0
  24. package/es/utils/page/page-form.js +12 -2
  25. package/es/utils/page/page-layout.d.ts +1 -0
  26. package/es/utils/page/page-layout.js +22 -5
  27. package/es/utils/page/page-load-schema.js +20 -28
  28. package/es/utils/page/page-show.d.ts +2 -0
  29. package/es/utils/page/page-show.js +5 -0
  30. package/es/utils/page/print-form.js +25 -16
  31. package/es/utils/uni-bridge.d.ts +18 -0
  32. package/es/utils/uni-bridge.js +130 -0
  33. package/es/utils/util.common.d.ts +1 -0
  34. package/es/utils/util.common.js +4 -0
  35. package/lib/components/load-materials/index.js +38 -22
  36. package/lib/components/page-loading/index.js +4 -1
  37. package/lib/index.d.ts +1 -1
  38. package/lib/index.js +44 -4
  39. package/lib/index.less +10 -0
  40. package/lib/style.js +2 -2
  41. package/lib/utils/api/form-api.d.ts +1 -0
  42. package/lib/utils/api/form-api.js +68 -29
  43. package/lib/utils/api/index.d.ts +1 -1
  44. package/lib/utils/api/index.js +1 -0
  45. package/lib/utils/api/rest-api.d.ts +3 -1
  46. package/lib/utils/api/rest-api.js +105 -23
  47. package/lib/utils/api/schema.util.d.ts +3 -3
  48. package/lib/utils/api/schema.util.js +19 -13
  49. package/lib/utils/cache/index.js +56 -16
  50. package/lib/utils/common/index.d.ts +3 -0
  51. package/lib/utils/common/index.js +15 -2
  52. package/lib/utils/page/page-form-data-manager-group.js +2 -2
  53. package/lib/utils/page/page-form-data-manager.d.ts +1 -0
  54. package/lib/utils/page/page-form-data-manager.js +2 -2
  55. package/lib/utils/page/page-form-group.d.ts +1 -0
  56. package/lib/utils/page/page-form-group.js +2 -2
  57. package/lib/utils/page/page-form.d.ts +1 -0
  58. package/lib/utils/page/page-form.js +12 -2
  59. package/lib/utils/page/page-layout.d.ts +1 -0
  60. package/lib/utils/page/page-layout.js +22 -5
  61. package/lib/utils/page/page-load-schema.js +19 -27
  62. package/lib/utils/page/page-show.d.ts +2 -0
  63. package/lib/utils/page/page-show.js +5 -0
  64. package/lib/utils/page/print-form.js +25 -16
  65. package/lib/utils/uni-bridge.d.ts +18 -0
  66. package/lib/utils/uni-bridge.js +135 -0
  67. package/lib/utils/util.common.d.ts +1 -0
  68. package/lib/utils/util.common.js +8 -0
  69. package/package.json +2 -2
@@ -350,16 +350,98 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
350
350
  }
351
351
  return _delete;
352
352
  }();
353
- _proto.showError = /*#__PURE__*/function () {
354
- var _showError = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(type, res) {
355
- var msg, props, _t;
353
+ _proto["export"] = /*#__PURE__*/function () {
354
+ var _export2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(data, options) {
355
+ var _this$handleRequestCo8;
356
+ var config, res, _options$onError7, _options$onSuccess7;
356
357
  return _regenerator["default"].wrap(function (_context8) {
357
358
  while (1) switch (_context8.prev = _context8.next) {
359
+ case 0:
360
+ config = {};
361
+ _context8.next = 1;
362
+ return (_this$handleRequestCo8 = this.handleRequestConfig) === null || _this$handleRequestCo8 === void 0 ? void 0 : _this$handleRequestCo8.call(this, config);
363
+ case 1:
364
+ _context8.next = 2;
365
+ return this.request.post("/export", data, config);
366
+ case 2:
367
+ res = _context8.sent;
368
+ if (res.success) {
369
+ _context8.next = 4;
370
+ break;
371
+ }
372
+ this.showError("\u5BFC\u51FA\u5931\u8D25!", res).then();
373
+ _context8.next = 3;
374
+ return options === null || options === void 0 ? void 0 : (_options$onError7 = options.onError) === null || _options$onError7 === void 0 ? void 0 : _options$onError7.call(options, res);
375
+ case 3:
376
+ _context8.next = 5;
377
+ break;
378
+ case 4:
379
+ _context8.next = 5;
380
+ return options === null || options === void 0 ? void 0 : (_options$onSuccess7 = options.onSuccess) === null || _options$onSuccess7 === void 0 ? void 0 : _options$onSuccess7.call(options, res);
381
+ case 5:
382
+ return _context8.abrupt("return", res);
383
+ case 6:
384
+ case "end":
385
+ return _context8.stop();
386
+ }
387
+ }, _callee8, this);
388
+ }));
389
+ function _export(_x13, _x14) {
390
+ return _export2.apply(this, arguments);
391
+ }
392
+ return _export;
393
+ }();
394
+ _proto["import"] = /*#__PURE__*/function () {
395
+ var _import2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(data, options) {
396
+ var _this$handleRequestCo9;
397
+ var config, res, _options$onError8, _options$onSuccess8;
398
+ return _regenerator["default"].wrap(function (_context9) {
399
+ while (1) switch (_context9.prev = _context9.next) {
400
+ case 0:
401
+ config = {};
402
+ _context9.next = 1;
403
+ return (_this$handleRequestCo9 = this.handleRequestConfig) === null || _this$handleRequestCo9 === void 0 ? void 0 : _this$handleRequestCo9.call(this, config);
404
+ case 1:
405
+ _context9.next = 2;
406
+ return this.request.post("import", data, config);
407
+ case 2:
408
+ res = _context9.sent;
409
+ if (res.success) {
410
+ _context9.next = 4;
411
+ break;
412
+ }
413
+ this.showError("\u5BFC\u5165\u5931\u8D25!", res).then();
414
+ _context9.next = 3;
415
+ return options === null || options === void 0 ? void 0 : (_options$onError8 = options.onError) === null || _options$onError8 === void 0 ? void 0 : _options$onError8.call(options, res);
416
+ case 3:
417
+ _context9.next = 5;
418
+ break;
419
+ case 4:
420
+ _context9.next = 5;
421
+ return options === null || options === void 0 ? void 0 : (_options$onSuccess8 = options.onSuccess) === null || _options$onSuccess8 === void 0 ? void 0 : _options$onSuccess8.call(options, res);
422
+ case 5:
423
+ return _context9.abrupt("return", res);
424
+ case 6:
425
+ case "end":
426
+ return _context9.stop();
427
+ }
428
+ }, _callee9, this);
429
+ }));
430
+ function _import(_x15, _x16) {
431
+ return _import2.apply(this, arguments);
432
+ }
433
+ return _import;
434
+ }();
435
+ _proto.showError = /*#__PURE__*/function () {
436
+ var _showError = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(type, res) {
437
+ var msg, props, _t;
438
+ return _regenerator["default"].wrap(function (_context0) {
439
+ while (1) switch (_context0.prev = _context0.next) {
358
440
  case 0:
359
441
  msg = res.message;
360
- _context8.prev = 1;
442
+ _context0.prev = 1;
361
443
  if (!msg) {
362
- _context8.next = 4;
444
+ _context0.next = 4;
363
445
  break;
364
446
  }
365
447
  props = JSON.parse(msg);
@@ -368,31 +450,31 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
368
450
  props.title = "" + this.title + type;
369
451
  }
370
452
  if (!(props.type == "message")) {
371
- _context8.next = 2;
453
+ _context0.next = 2;
372
454
  break;
373
455
  }
374
456
  _message2["default"].error(props);
375
- return _context8.abrupt("return");
457
+ return _context0.abrupt("return");
376
458
  case 2:
377
459
  if (!(props.type == "modal")) {
378
- _context8.next = 3;
460
+ _context0.next = 3;
379
461
  break;
380
462
  }
381
463
  _modal["default"].error(props);
382
- return _context8.abrupt("return");
464
+ return _context0.abrupt("return");
383
465
  case 3:
384
466
  if (!(props.type == "notification")) {
385
- _context8.next = 4;
467
+ _context0.next = 4;
386
468
  break;
387
469
  }
388
470
  _notification2["default"].error(props);
389
- return _context8.abrupt("return");
471
+ return _context0.abrupt("return");
390
472
  case 4:
391
- _context8.next = 6;
473
+ _context0.next = 6;
392
474
  break;
393
475
  case 5:
394
- _context8.prev = 5;
395
- _t = _context8["catch"](1);
476
+ _context0.prev = 5;
477
+ _t = _context0["catch"](1);
396
478
  console.error("" + this.title + type + (msg || ""));
397
479
  _modal["default"].error({
398
480
  title: "" + this.title + type,
@@ -404,11 +486,11 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
404
486
  });
405
487
  case 6:
406
488
  case "end":
407
- return _context8.stop();
489
+ return _context0.stop();
408
490
  }
409
- }, _callee8, this, [[1, 5]]);
491
+ }, _callee0, this, [[1, 5]]);
410
492
  }));
411
- function showError(_x13, _x14) {
493
+ function showError(_x17, _x18) {
412
494
  return _showError.apply(this, arguments);
413
495
  }
414
496
  return showError;
@@ -430,16 +512,16 @@ var RestApi = exports.RestApi = /*#__PURE__*/function (_BaseRestApi2) {
430
512
  (0, _inheritsLoose2["default"])(RestApi, _BaseRestApi2);
431
513
  var _proto2 = RestApi.prototype;
432
514
  _proto2.handleRequestConfig = /*#__PURE__*/function () {
433
- var _handleRequestConfig = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(config) {
434
- return _regenerator["default"].wrap(function (_context9) {
435
- while (1) switch (_context9.prev = _context9.next) {
515
+ var _handleRequestConfig = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee1(config) {
516
+ return _regenerator["default"].wrap(function (_context1) {
517
+ while (1) switch (_context1.prev = _context1.next) {
436
518
  case 0:
437
519
  case "end":
438
- return _context9.stop();
520
+ return _context1.stop();
439
521
  }
440
- }, _callee9);
522
+ }, _callee1);
441
523
  }));
442
- function handleRequestConfig(_x15) {
524
+ function handleRequestConfig(_x19) {
443
525
  return _handleRequestConfig.apply(this, arguments);
444
526
  }
445
527
  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 {};
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.forEachFormSchema = forEachFormSchema;
4
+ exports.findFdmSchemas = findFdmSchemas;
5
+ exports.findFormSchemas = findFormSchemas;
5
6
  exports.forEachSchema = forEachSchema;
6
7
  /**
7
8
  * 遍历schema
@@ -17,21 +18,26 @@ function forEachSchema(schema, callback) {
17
18
  }
18
19
  });
19
20
  }
20
- function forEachFormSchema(schema, fdm, callback) {
21
+ function findFormSchemas(schema) {
22
+ var schemas = [];
21
23
  forEachSchema(schema, function (child) {
22
24
  if (["PageForm", "SubFormField"].includes(child.componentName)) {
23
- callback(child);
24
- if (fdm) {
25
- if (child.fdmSchema) {
26
- forEachSchema(child.fdmSchema, function (fdmChild) {
27
- if (fdmChild.componentName == "PageFdm") {
28
- callback(child);
29
- }
30
- return true;
31
- });
32
- }
33
- }
25
+ schemas.push(child);
34
26
  }
35
27
  return true;
36
28
  });
29
+ return schemas;
30
+ }
31
+ function findFdmSchemas(schema) {
32
+ var schemas = [];
33
+ if (!schema) {
34
+ return schemas;
35
+ }
36
+ forEachSchema(schema, function (child) {
37
+ if (["PageFdm"].includes(child.componentName)) {
38
+ schemas.push(child);
39
+ }
40
+ return true;
41
+ });
42
+ return schemas;
37
43
  }
@@ -17,7 +17,7 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
17
17
  var _proto = SchemaCache.prototype;
18
18
  _proto.createInstance = /*#__PURE__*/function () {
19
19
  var _createInstance = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(key, options) {
20
- var mock, pageId, schemaRes, schema, permissionRes, permission;
20
+ var mock, pageId, schemaRes, schema, handleCommonSchema, permission, printTemplates, workflow, cloneSchema, _t;
21
21
  return _regenerator["default"].wrap(function (_context) {
22
22
  while (1) switch (_context.prev = _context.next) {
23
23
  case 0:
@@ -30,30 +30,70 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
30
30
  });
31
31
  case 1:
32
32
  schemaRes = _context.sent;
33
- schema = schemaRes.data;
34
- if (!(typeof schema == "object")) {
35
- _context.next = 3;
33
+ if (schemaRes.succss) {
34
+ _context.next = 2;
36
35
  break;
37
36
  }
38
- _context.next = 2;
39
- return _api.apiRequest.get("pages/" + pageId + "/permission");
37
+ return _context.abrupt("return", schemaRes);
40
38
  case 2:
41
- permissionRes = _context.sent;
42
- permission = permissionRes.data;
43
- if (typeof permission == "object") {
44
- (0, _schema.forEachFormSchema)(schema, true, function (child) {
45
- child.props = child.props || {};
46
- child.props.permission = permission;
47
- });
39
+ schema = schemaRes.data;
40
+ if (!(schema != null && typeof schema == "object")) {
41
+ _context.next = 8;
42
+ break;
43
+ }
44
+ handleCommonSchema = function handleCommonSchema(schema) {
45
+ schema.props = schema.props || {};
46
+ schema.props.permission = permission;
47
+ schema.props.printTemplates = printTemplates;
48
+ schema.props.workflow = workflow;
49
+ };
50
+ //处理权限
51
+ permission = null; //处理打印
52
+ workflow = null;
53
+ if (location.pathname.startsWith("/print")) {
54
+ _context.next = 7;
55
+ break;
48
56
  }
57
+ _context.next = 3;
58
+ return _api.apiRequest.get("pages/" + pageId + "/permission");
49
59
  case 3:
50
- console.log("schemaRes", schemaRes);
60
+ permission = _context.sent.data;
61
+ if (!((schema === null || schema === void 0 ? void 0 : schema.type) == "form")) {
62
+ _context.next = 7;
63
+ break;
64
+ }
65
+ _context.prev = 4;
66
+ _context.next = 5;
67
+ return _api.apiRequest.get("pages/" + pageId + "/printTemplates");
68
+ case 5:
69
+ printTemplates = _context.sent.data;
70
+ _context.next = 7;
71
+ break;
72
+ case 6:
73
+ _context.prev = 6;
74
+ _t = _context["catch"](4);
75
+ console.log(_t);
76
+ case 7:
77
+ (0, _schema.findFormSchemas)(schema).forEach(function (formSchema) {
78
+ handleCommonSchema(formSchema);
79
+ (0, _schema.findFdmSchemas)(formSchema.fdmSchema).forEach(function (fdmSchema) {
80
+ handleCommonSchema(fdmSchema);
81
+ fdmSchema.props.form.label = formSchema.props.label;
82
+ });
83
+ });
84
+ cloneSchema = JSON.parse(JSON.stringify(schema));
85
+ (0, _schema.findFormSchemas)(schema).forEach(function (formSchema) {
86
+ (0, _schema.findFdmSchemas)(formSchema.fdmSchema).forEach(function (fdmSchema) {
87
+ fdmSchema.props.formElement = cloneSchema;
88
+ });
89
+ });
90
+ case 8:
51
91
  return _context.abrupt("return", schemaRes);
52
- case 4:
92
+ case 9:
53
93
  case "end":
54
94
  return _context.stop();
55
95
  }
56
- }, _callee);
96
+ }, _callee, null, [[4, 6]]);
57
97
  }));
58
98
  function createInstance(_x, _x2) {
59
99
  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;
3
4
  export declare function toArray(data: any): any[];
5
+ export declare function isLocalhost(): boolean;
6
+ export declare function isMobile(): boolean;
@@ -1,20 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ exports.isLocalhost = isLocalhost;
5
+ exports.isMobile = isMobile;
4
6
  exports.loadPlugins = void 0;
5
7
  exports.toArray = toArray;
6
8
  exports.uuid = uuid;
9
+ exports.uuidVersion = uuidVersion;
7
10
  var _uuid = require("uuid");
8
11
  var _LoadPlugins = require("./LoadPlugins");
9
12
  exports.loadPlugins = _LoadPlugins.loadPlugins;
10
13
  function uuid(prefix, separator) {
11
14
  if (!prefix && !separator) {
12
- return (0, _uuid.v4)();
15
+ return (0, _uuid.v7)();
13
16
  }
14
- return [prefix, separator, (0, _uuid.v4)()].filter(function (v) {
17
+ return [prefix, separator, (0, _uuid.v7)()].filter(function (v) {
15
18
  return !!v;
16
19
  }).join("");
17
20
  }
21
+ function uuidVersion(id) {
22
+ return (0, _uuid.version)(id);
23
+ }
18
24
  function toArray(data) {
19
25
  if (!data) {
20
26
  return [];
@@ -23,4 +29,11 @@ function toArray(data) {
23
29
  } else {
24
30
  return [data];
25
31
  }
32
+ }
33
+ function isLocalhost() {
34
+ return window.location.hostname == "localhost";
35
+ }
36
+ function isMobile() {
37
+ var userAgent = navigator.userAgent;
38
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(userAgent);
26
39
  }
@@ -12,7 +12,7 @@ var _pageLayout = require("./page-layout");
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _reactRender = require("../../components/react-render");
14
14
  var _pageRender = require("./page-render");
15
- var _uuid = require("uuid");
15
+ var _common = require("../common");
16
16
  var _excluded = ["layout", "items", "onSelectOk", "onClose"],
17
17
  _excluded2 = ["container", "onClose"];
18
18
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -88,7 +88,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
88
88
  }, /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({}, restProps, {
89
89
  components: window._components || window.components || window.__components,
90
90
  schema: {
91
- id: (0, _uuid.v4)(),
91
+ id: (0, _common.uuid)(),
92
92
  componentName: "Page",
93
93
  props: {},
94
94
  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>;
@@ -12,9 +12,9 @@ var _pageLayout = require("./page-layout");
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _pageLoadSchema = require("./page-load-schema");
14
14
  var _reactRender = require("../../components/react-render");
15
- var _schema = require("../cache/schema");
16
15
  var _pageSchemaUtils = require("./page-schema-utils");
17
16
  var _pageRender = require("./page-render");
17
+ var _schema = require("../api/schema.util");
18
18
  var _excluded = ["layout", "form", "onSelectOk", "onClose"],
19
19
  _excluded2 = ["container", "onClose"];
20
20
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -93,7 +93,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
93
93
  }, function (schema) {
94
94
  var fdmSchema = schema.children[0].fdmSchema;
95
95
  if (form !== null && form !== void 0 && form.fieldId) {
96
- (0, _schema.forEachFormSchema)(schema, function (field) {
96
+ (0, _schema.forEachSchema)(schema, function (field) {
97
97
  if (form.fieldId == field.props.fieldId) {
98
98
  fdmSchema = field.fdmSchema;
99
99
  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;
@@ -12,8 +12,8 @@ var _pageLayout = require("./page-layout");
12
12
  var _pageRender = require("./page-render");
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _reactRender = require("../../components/react-render");
15
- var _uuid = require("uuid");
16
15
  var _pageLoadSchema = require("./page-load-schema");
16
+ var _common = require("../common");
17
17
  var _excluded = ["layout", "form", "items", "onClose"],
18
18
  _excluded2 = ["container", "onClose"];
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -84,7 +84,7 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
84
84
  return /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({}, restProps, {
85
85
  components: window._components || window.components || window.__components,
86
86
  schema: {
87
- id: (0, _uuid.v4)(),
87
+ id: (0, _common.uuid)(),
88
88
  componentName: "Page",
89
89
  props: {},
90
90
  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;
@@ -22,7 +22,7 @@ function showForm(_x) {
22
22
  }
23
23
  function _showForm() {
24
24
  _showForm = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
25
- var container, onClose, props, _options$form, paths, mode, dataId, params, url, page;
25
+ var container, onClose, props, _options$form, paths, mode, dataId, params, _options$form2, url, page;
26
26
  return _regenerator["default"].wrap(function (_context) {
27
27
  while (1) switch (_context.prev = _context.next) {
28
28
  case 0:
@@ -34,10 +34,20 @@ function _showForm() {
34
34
  paths = window.location.pathname.split("/");
35
35
  mode = options.mode, dataId = options.dataId;
36
36
  params = new URLSearchParams();
37
+ if ((_options$form = options.form) !== null && _options$form !== void 0 && _options$form.id) {
38
+ params.set("pageId", (_options$form2 = options.form) === null || _options$form2 === void 0 ? void 0 : _options$form2.id);
39
+ }
40
+ if (mode) {
41
+ params.set("mode", mode);
42
+ }
37
43
  if (dataId) {
38
44
  params.set("dataId", dataId);
39
45
  }
40
- url = "/" + paths[1] + "/" + paths[2] + "/" + ((_options$form = options.form) === null || _options$form === void 0 ? void 0 : _options$form.id) + "/" + mode + "?" + params.toString();
46
+ url = "/" + paths[1] + "/pages?" + params.toString();
47
+ if (paths[1] == "workPlatform") {
48
+ url = "/pages?" + params.toString();
49
+ }
50
+ //const url = `/${paths[1]}/${paths[2]}/${options.form?.id}/${mode}?${params.toString()}`;
41
51
  _context.next = 1;
42
52
  return (0, _index.openPage)(url, url);
43
53
  case 1:
@@ -12,6 +12,7 @@ interface PageLayoutState {
12
12
  }
13
13
  export declare class PageLayout extends Component<PageLayoutProps, PageLayoutState> {
14
14
  state: PageLayoutState;
15
+ get layout(): PageLayoutType;
15
16
  close: () => void;
16
17
  constructor(props: any);
17
18
  componentDidMount(): void;
@@ -7,10 +7,11 @@ var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
7
7
  var _modal = _interopRequireDefault(require("antd/lib/modal"));
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
11
  var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
11
12
  var _react = _interopRequireWildcard(require("react"));
12
13
  var _loadMaterials = require("../../components/load-materials");
13
- var _excluded = ["layout", "children"];
14
+ var _excluded = ["children"];
14
15
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
15
16
  var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
16
17
  function PageLayout(props) {
@@ -28,7 +29,7 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
28
29
  return Math.min(window.innerWidth, 1600);
29
30
  };
30
31
  _this.handleResize = function () {
31
- if (_this.props.layout == "drawer") {
32
+ if (_this.layout == "drawer") {
32
33
  _this.setState({
33
34
  width: _this.getWith()
34
35
  });
@@ -47,9 +48,9 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
47
48
  };
48
49
  _proto.render = function render() {
49
50
  var _this$props = this.props,
50
- layout = _this$props.layout,
51
51
  children = _this$props.children,
52
52
  extraProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
53
+ var layout = this.layout;
53
54
  var state = this.state;
54
55
  var restProps = (0, _extends2["default"])({}, extraProps, {
55
56
  children: undefined,
@@ -78,11 +79,27 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
78
79
  restProps.styles.body.height = "calc(100vh - 120px)";
79
80
  return /*#__PURE__*/_react["default"].createElement(_modal["default"], restProps, loadChildren);
80
81
  } else if (layout == "drawer") {
81
- return /*#__PURE__*/_react["default"].createElement(_drawer["default"], restProps, loadChildren);
82
+ if (window.isMobile) {
83
+ restProps.placement = "bottom";
84
+ }
85
+ return /*#__PURE__*/_react["default"].createElement(_drawer["default"], (0, _extends2["default"])({}, restProps, {
86
+ height: "85vh"
87
+ }), loadChildren);
82
88
  }
83
89
  return loadChildren;
84
90
  };
85
- return PageLayout;
91
+ return (0, _createClass2["default"])(PageLayout, [{
92
+ key: "layout",
93
+ get: function get() {
94
+ var layout = this.props.layout;
95
+ if (window.isMobile) {
96
+ if (layout == "modal") {
97
+ return "drawer";
98
+ }
99
+ }
100
+ return layout;
101
+ }
102
+ }]);
86
103
  }(_react.Component);
87
104
  function LoadMaterialChildren(props) {
88
105
  return /*#__PURE__*/_react["default"].createElement(_loadMaterials.LoadMaterials, null, props.children);
@@ -7,55 +7,47 @@ var _result = _interopRequireDefault(require("antd/lib/result"));
7
7
  var _message2 = _interopRequireDefault(require("antd/lib/message"));
8
8
  var _react = require("react");
9
9
  var _api = require("../api");
10
- var _pageLoading = require("../../components/page-loading");
11
10
  var _schemaApi = require("../api/schema-api");
11
+ var _index = require("./index");
12
12
  function PageLoadSchema(props) {
13
13
  var pageId = props.pageId,
14
14
  children = props.children;
15
15
  var cache = (0, _schemaApi.getSchemaFromCache)(pageId);
16
- var _useState = (0, _react.useState)(!cache),
17
- loading = _useState[0],
18
- setLoading = _useState[1];
19
- var _useState2 = (0, _react.useState)(cache === null || cache === void 0 ? void 0 : cache.data),
20
- schema = _useState2[0],
21
- setSchema = _useState2[1];
22
- var _useState3 = (0, _react.useState)(),
23
- errorMsg = _useState3[0],
24
- setErrorMsg = _useState3[1];
16
+ var _useState = (0, _react.useState)(cache === null || cache === void 0 ? void 0 : cache.data),
17
+ schema = _useState[0],
18
+ setSchema = _useState[1];
19
+ var _useState2 = (0, _react.useState)(),
20
+ errorMsg = _useState2[0],
21
+ setErrorMsg = _useState2[1];
25
22
  (0, _react.useEffect)(function () {
26
- if (cache) {
23
+ if (cache !== null && cache !== void 0 && cache.success) {
27
24
  return;
28
25
  }
29
26
  if (pageId) {
27
+ (0, _index.showLoading)().then();
30
28
  (0, _api.getSchema)(pageId).then(function (res) {
31
29
  if (res.success) {
32
- setLoading(false);
33
- setSchema(res.data);
30
+ setSchema(res === null || res === void 0 ? void 0 : res.data);
34
31
  } else {
35
- setErrorMsg(res.message);
32
+ setErrorMsg(res === null || res === void 0 ? void 0 : res.message);
36
33
  }
34
+ })["finally"](function () {
35
+ (0, _index.hideLoading)().then();
37
36
  });
38
37
  } else {
39
- setLoading(false);
40
- setErrorMsg("页面id不可为空!");
41
- console.error("页面id不可为空!");
42
- _message2["default"].error("页面id不可为空!").then();
38
+ (0, _index.hideLoading)().then();
39
+ setErrorMsg("参数错误:页面id不可为空!");
40
+ _message2["default"].error("参数错误:页面id不可为空!").then();
43
41
  }
44
42
  }, []);
45
- if (cache) {
43
+ if (schema) {
46
44
  return children(schema);
47
45
  }
48
- if (loading) {
49
- return /*#__PURE__*/React.createElement(_pageLoading.PageLoading, {
50
- loading: true,
51
- background: "rgba(255, 255, 255, 0)"
52
- });
53
- }
54
- if (!schema) {
46
+ if (errorMsg) {
55
47
  return /*#__PURE__*/React.createElement(_result["default"], {
56
48
  status: 500,
57
49
  title: errorMsg
58
50
  });
59
51
  }
60
- return children(schema);
52
+ return /*#__PURE__*/React.createElement(_react.Fragment, null);
61
53
  }