@zhubangyun/lowcode-core 5.12.92 → 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 (98) hide show
  1. package/es/components/load-materials/index.js +44 -28
  2. package/es/components/page-loading/index.js +4 -1
  3. package/es/demo/index.js +8 -8
  4. package/es/index.d.ts +1 -1
  5. package/es/index.js +41 -2
  6. package/es/index.less +10 -0
  7. package/es/style.js +2 -2
  8. package/es/utils/api/file-api.js +21 -21
  9. package/es/utils/api/form-api.d.ts +2 -1
  10. package/es/utils/api/form-api.js +90 -51
  11. package/es/utils/api/form-api.utils.js +5 -4
  12. package/es/utils/api/index.d.ts +2 -2
  13. package/es/utils/api/index.js +1 -0
  14. package/es/utils/api/rest-api.d.ts +3 -1
  15. package/es/utils/api/rest-api.js +207 -125
  16. package/es/utils/api/schema-api.js +5 -5
  17. package/es/utils/api/schema.util.d.ts +3 -3
  18. package/es/utils/api/schema.util.js +17 -12
  19. package/es/utils/api/script-api.js +12 -12
  20. package/es/utils/api/user-info.js +7 -7
  21. package/es/utils/cache/index.js +66 -26
  22. package/es/utils/common/LoadPlugins.js +33 -33
  23. package/es/utils/common/SingletonInstanceMap.js +21 -21
  24. package/es/utils/common/index.d.ts +3 -0
  25. package/es/utils/common/index.js +13 -3
  26. package/es/utils/designer/assets/assets.parse.js +15 -15
  27. package/es/utils/designer/assets/assets.typing.js +6 -0
  28. package/es/utils/designer/engine/index.js +23 -23
  29. package/es/utils/designer/index.js +7 -7
  30. package/es/utils/page/index.js +18 -18
  31. package/es/utils/page/page-form-data-manager-group.js +9 -6
  32. package/es/utils/page/page-form-data-manager.d.ts +1 -0
  33. package/es/utils/page/page-form-data-manager.js +9 -6
  34. package/es/utils/page/page-form-group.d.ts +1 -0
  35. package/es/utils/page/page-form-group.js +8 -7
  36. package/es/utils/page/page-form.d.ts +1 -0
  37. package/es/utils/page/page-form.js +23 -12
  38. package/es/utils/page/page-layout.d.ts +3 -0
  39. package/es/utils/page/page-layout.js +33 -9
  40. package/es/utils/page/page-load-schema.js +20 -28
  41. package/es/utils/page/page-render.js +4 -4
  42. package/es/utils/page/page-show.d.ts +2 -0
  43. package/es/utils/page/page-show.js +8 -3
  44. package/es/utils/page/print-form.js +60 -51
  45. package/es/utils/uni-bridge.d.ts +18 -0
  46. package/es/utils/uni-bridge.js +130 -0
  47. package/es/utils/util.common.d.ts +1 -0
  48. package/es/utils/util.common.js +4 -0
  49. package/lib/components/load-materials/index.js +45 -30
  50. package/lib/components/page-loading/index.js +4 -1
  51. package/lib/demo/index.js +9 -10
  52. package/lib/index.d.ts +1 -1
  53. package/lib/index.js +45 -6
  54. package/lib/index.less +10 -0
  55. package/lib/style.js +2 -2
  56. package/lib/utils/api/file-api.js +21 -21
  57. package/lib/utils/api/form-api.d.ts +2 -1
  58. package/lib/utils/api/form-api.js +90 -51
  59. package/lib/utils/api/form-api.utils.js +5 -4
  60. package/lib/utils/api/index.d.ts +2 -2
  61. package/lib/utils/api/index.js +2 -2
  62. package/lib/utils/api/rest-api.d.ts +3 -1
  63. package/lib/utils/api/rest-api.js +207 -125
  64. package/lib/utils/api/schema-api.js +5 -5
  65. package/lib/utils/api/schema.util.d.ts +3 -3
  66. package/lib/utils/api/schema.util.js +19 -13
  67. package/lib/utils/api/script-api.js +12 -12
  68. package/lib/utils/api/user-info.js +7 -7
  69. package/lib/utils/cache/index.js +65 -25
  70. package/lib/utils/common/LoadPlugins.js +33 -33
  71. package/lib/utils/common/SingletonInstanceMap.js +21 -21
  72. package/lib/utils/common/index.d.ts +3 -0
  73. package/lib/utils/common/index.js +15 -2
  74. package/lib/utils/designer/assets/assets.parse.js +16 -17
  75. package/lib/utils/designer/assets/assets.typing.js +6 -0
  76. package/lib/utils/designer/engine/index.js +23 -23
  77. package/lib/utils/designer/index.js +7 -7
  78. package/lib/utils/index.js +1 -2
  79. package/lib/utils/page/index.js +18 -18
  80. package/lib/utils/page/page-form-data-manager-group.js +10 -8
  81. package/lib/utils/page/page-form-data-manager.d.ts +1 -0
  82. package/lib/utils/page/page-form-data-manager.js +10 -8
  83. package/lib/utils/page/page-form-group.d.ts +1 -0
  84. package/lib/utils/page/page-form-group.js +9 -9
  85. package/lib/utils/page/page-form.d.ts +1 -0
  86. package/lib/utils/page/page-form.js +24 -14
  87. package/lib/utils/page/page-layout.d.ts +3 -0
  88. package/lib/utils/page/page-layout.js +34 -11
  89. package/lib/utils/page/page-load-schema.js +19 -27
  90. package/lib/utils/page/page-render.js +4 -4
  91. package/lib/utils/page/page-show.d.ts +2 -0
  92. package/lib/utils/page/page-show.js +9 -5
  93. package/lib/utils/page/print-form.js +60 -51
  94. package/lib/utils/uni-bridge.d.ts +18 -0
  95. package/lib/utils/uni-bridge.js +135 -0
  96. package/lib/utils/util.common.d.ts +1 -0
  97. package/lib/utils/util.common.js +8 -0
  98. package/package.json +2 -2
@@ -15,28 +15,28 @@ export var Engine = function Engine() {
15
15
  * 注入资产
16
16
  */
17
17
  this.injectAssets = /*#__PURE__*/function () {
18
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(types) {
18
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(types) {
19
19
  var assetsData, asserts, _yield$assetsParse, components;
20
- return _regeneratorRuntime.wrap(function _callee$(_context) {
20
+ return _regeneratorRuntime.wrap(function (_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
23
23
  _this.assets.addDefaultAssets(types);
24
24
  assetsData = _this.assets.data; // @ts-ignore
25
- _context.next = 4;
25
+ _context.next = 1;
26
26
  return _this._engine.injectAssets(assetsData);
27
- case 4:
27
+ case 1:
28
28
  asserts = _context.sent;
29
- _context.next = 7;
29
+ _context.next = 2;
30
30
  return _this._engine.material.setAssets(asserts);
31
- case 7:
32
- _context.next = 9;
31
+ case 2:
32
+ _context.next = 3;
33
33
  return assetsParse(assetsData);
34
- case 9:
34
+ case 3:
35
35
  _yield$assetsParse = _context.sent;
36
36
  components = _yield$assetsParse.components;
37
37
  // @ts-ignore
38
38
  window.components = components;
39
- case 12:
39
+ case 4:
40
40
  case "end":
41
41
  return _context.stop();
42
42
  }
@@ -47,8 +47,8 @@ export var Engine = function Engine() {
47
47
  };
48
48
  }();
49
49
  this.loadIncrementalAssets = /*#__PURE__*/function () {
50
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(incrementalAssets) {
51
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
50
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(incrementalAssets) {
51
+ return _regeneratorRuntime.wrap(function (_context2) {
52
52
  while (1) switch (_context2.prev = _context2.next) {
53
53
  case 0:
54
54
  return _context2.abrupt("return", _this.material.loadIncrementalAssets(incrementalAssets));
@@ -63,8 +63,8 @@ export var Engine = function Engine() {
63
63
  };
64
64
  }();
65
65
  this.registerPlugin = /*#__PURE__*/function () {
66
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(pluginModel, options, registerOptions) {
67
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
66
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(pluginModel, options, registerOptions) {
67
+ return _regeneratorRuntime.wrap(function (_context3) {
68
68
  while (1) switch (_context3.prev = _context3.next) {
69
69
  case 0:
70
70
  return _context3.abrupt("return", _this.plugins.register(pluginModel, options, registerOptions));
@@ -84,11 +84,11 @@ export var Engine = function Engine() {
84
84
  * @param schema
85
85
  */
86
86
  this.init = /*#__PURE__*/function () {
87
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(container, schema) {
88
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
87
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(container, schema) {
88
+ return _regeneratorRuntime.wrap(function (_context4) {
89
89
  while (1) switch (_context4.prev = _context4.next) {
90
90
  case 0:
91
- _context4.next = 2;
91
+ _context4.next = 1;
92
92
  return _this._engine.init(container, {
93
93
  designMode: "design",
94
94
  enableCondition: true,
@@ -98,14 +98,14 @@ export var Engine = function Engine() {
98
98
  fetch: createFetchHandler()
99
99
  }
100
100
  });
101
- case 2:
101
+ case 1:
102
102
  if (!schema) {
103
- _context4.next = 5;
103
+ _context4.next = 2;
104
104
  break;
105
105
  }
106
- _context4.next = 5;
106
+ _context4.next = 2;
107
107
  return _this.openDocument(schema);
108
- case 5:
108
+ case 2:
109
109
  case "end":
110
110
  return _context4.stop();
111
111
  }
@@ -116,15 +116,15 @@ export var Engine = function Engine() {
116
116
  };
117
117
  }();
118
118
  this.openDocument = /*#__PURE__*/function () {
119
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(schema) {
120
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
119
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(schema) {
120
+ return _regeneratorRuntime.wrap(function (_context5) {
121
121
  while (1) switch (_context5.prev = _context5.next) {
122
122
  case 0:
123
123
  if (schema === void 0) {
124
124
  schema = {};
125
125
  }
126
126
  _this._engine.project.openDocument(schema);
127
- case 2:
127
+ case 1:
128
128
  case "end":
129
129
  return _context5.stop();
130
130
  }
@@ -7,26 +7,26 @@ export function initEngine() {
7
7
  return _initEngine.apply(this, arguments);
8
8
  }
9
9
  function _initEngine() {
10
- _initEngine = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
10
+ _initEngine = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
11
11
  var _window$AntdProMateri, _window$AntdProMateri2;
12
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
+ return _regeneratorRuntime.wrap(function (_context) {
13
13
  while (1) switch (_context.prev = _context.next) {
14
14
  case 0:
15
- _context.next = 2;
15
+ _context.next = 1;
16
16
  return loadPlugins(["next.min.js", "variables.css", "next.var.min.css",
17
17
  /* "react.production.min.js",
18
18
  "react-dom.production.min.js",*/
19
19
  "prop-types.js", "react15-polyfill.js", "lodash.min.js", "moment.min.js", "engine-core.css", "engine-core.js", "engine-ext.js", "engine-ext.css", "index.css", "index.js"].map(function (uri) {
20
20
  return "https://cdn.zhiyunhe.com/lowcode/designer/" + uri;
21
21
  }));
22
- case 2:
23
- _context.next = 4;
22
+ case 1:
23
+ _context.next = 2;
24
24
  return loadPlugins(["https://cdn.zhiyunhe.com/plugin/dayjs/dayjs.min.js", "https://cdn.zhiyunhe.com/plugin/antd/latest/reset.css", "https://cdn.zhiyunhe.com/plugin/antd/latest/antd.min.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.css", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.js"]);
25
- case 4:
25
+ case 2:
26
26
  //注册setter
27
27
  (_window$AntdProMateri = window.AntdProMaterial) === null || _window$AntdProMateri === void 0 ? void 0 : (_window$AntdProMateri2 = _window$AntdProMateri.registerSetters) === null || _window$AntdProMateri2 === void 0 ? void 0 : _window$AntdProMateri2.call(_window$AntdProMateri);
28
28
  return _context.abrupt("return", new Engine());
29
- case 6:
29
+ case 3:
30
30
  case "end":
31
31
  return _context.stop();
32
32
  }
@@ -22,9 +22,9 @@ export function showLoading() {
22
22
  return _showLoading.apply(this, arguments);
23
23
  }
24
24
  function _showLoading() {
25
- _showLoading = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
25
+ _showLoading = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
26
26
  var loading, div;
27
- return _regeneratorRuntime.wrap(function _callee$(_context) {
27
+ return _regeneratorRuntime.wrap(function (_context) {
28
28
  while (1) switch (_context.prev = _context.next) {
29
29
  case 0:
30
30
  loading = document.getElementById("fullscreen-loading");
@@ -36,7 +36,7 @@ function _showLoading() {
36
36
  div.innerHTML = "\n <div class=\"atom-spinner\">\n <div class=\"spinner-inner\">\n <div class=\"spinner-line\"></div>\n <div class=\"spinner-line\"></div>\n <div class=\"spinner-line\"></div>\n <div class=\"spinner-circle\"></div>\n </div>\n </div>\n ";
37
37
  document.body.appendChild(div);
38
38
  }
39
- case 2:
39
+ case 1:
40
40
  case "end":
41
41
  return _context.stop();
42
42
  }
@@ -48,16 +48,16 @@ export function hideLoading() {
48
48
  return _hideLoading.apply(this, arguments);
49
49
  }
50
50
  function _hideLoading() {
51
- _hideLoading = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
51
+ _hideLoading = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
52
52
  var loading;
53
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
53
+ return _regeneratorRuntime.wrap(function (_context2) {
54
54
  while (1) switch (_context2.prev = _context2.next) {
55
55
  case 0:
56
56
  loading = document.getElementById("fullscreen-loading");
57
57
  if (loading) {
58
58
  loading.style.display = "none";
59
59
  }
60
- case 2:
60
+ case 1:
61
61
  case "end":
62
62
  return _context2.stop();
63
63
  }
@@ -69,33 +69,33 @@ export function openPage(_x, _x2) {
69
69
  return _openPage.apply(this, arguments);
70
70
  }
71
71
  function _openPage() {
72
- _openPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(url, target) {
72
+ _openPage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(url, target) {
73
73
  var _window$parent;
74
74
  var page, func;
75
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
75
+ return _regeneratorRuntime.wrap(function (_context3) {
76
76
  while (1) switch (_context3.prev = _context3.next) {
77
77
  case 0:
78
78
  // @ts-ignore
79
79
  func = (_window$parent = window.parent) === null || _window$parent === void 0 ? void 0 : _window$parent.openWorkPlatformTab;
80
80
  if (!func) {
81
- _context3.next = 7;
81
+ _context3.next = 2;
82
82
  break;
83
83
  }
84
- _context3.next = 4;
84
+ _context3.next = 1;
85
85
  return func({
86
86
  value: target,
87
87
  url: url
88
88
  });
89
- case 4:
89
+ case 1:
90
90
  page = _context3.sent;
91
- _context3.next = 8;
91
+ _context3.next = 3;
92
92
  break;
93
- case 7:
93
+ case 2:
94
94
  page = window.open(url, target);
95
- case 8:
95
+ case 3:
96
96
  console.debug("openPage", page, target);
97
97
  return _context3.abrupt("return", page);
98
- case 10:
98
+ case 4:
99
99
  case "end":
100
100
  return _context3.stop();
101
101
  }
@@ -107,10 +107,10 @@ export function closePage(_x3, _x4) {
107
107
  return _closePage.apply(this, arguments);
108
108
  }
109
109
  function _closePage() {
110
- _closePage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(url, target) {
110
+ _closePage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(url, target) {
111
111
  var _window$parent2;
112
112
  var func;
113
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
113
+ return _regeneratorRuntime.wrap(function (_context4) {
114
114
  while (1) switch (_context4.prev = _context4.next) {
115
115
  case 0:
116
116
  // @ts-ignore
@@ -123,7 +123,7 @@ function _closePage() {
123
123
  } else {
124
124
  window.close();
125
125
  }
126
- case 2:
126
+ case 1:
127
127
  case "end":
128
128
  return _context4.stop();
129
129
  }
@@ -9,14 +9,14 @@ 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
- _showFormDataManagerGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
17
+ _showFormDataManagerGroup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
18
18
  var container, onClose, props;
19
- return _regeneratorRuntime.wrap(function _callee$(_context) {
19
+ return _regeneratorRuntime.wrap(function (_context) {
20
20
  while (1) switch (_context.prev = _context.next) {
21
21
  case 0:
22
22
  container = options.container, onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
@@ -28,7 +28,7 @@ function _showFormDataManagerGroup() {
28
28
  props: props
29
29
  }
30
30
  }));
31
- case 2:
31
+ case 1:
32
32
  case "end":
33
33
  return _context.stop();
34
34
  }
@@ -72,14 +72,17 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
72
72
  onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
73
73
  };
74
74
  return /*#__PURE__*/React.createElement(PageLayout, {
75
- layout: layout,
76
75
  ref: function ref(layout) {
77
76
  return _this2.layoutRef = layout;
77
+ },
78
+ layout: layout,
79
+ onClose: function onClose() {
80
+ onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
78
81
  }
79
82
  }, /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
80
83
  components: window._components || window.components || window.__components,
81
84
  schema: {
82
- id: v4(),
85
+ id: uuid(),
83
86
  componentName: "Page",
84
87
  props: {},
85
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>;
@@ -9,16 +9,16 @@ 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
- _showFormDataManager = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
19
+ _showFormDataManager = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
20
20
  var container, onClose, props;
21
- return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ return _regeneratorRuntime.wrap(function (_context) {
22
22
  while (1) switch (_context.prev = _context.next) {
23
23
  case 0:
24
24
  container = options.container, onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
@@ -30,7 +30,7 @@ function _showFormDataManager() {
30
30
  props: props
31
31
  }
32
32
  }));
33
- case 2:
33
+ case 1:
34
34
  case "end":
35
35
  return _context.stop();
36
36
  }
@@ -75,16 +75,19 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
75
75
  };
76
76
  var dataView = cloneDataView(this.props.dataView, this.props.extraProps);
77
77
  return /*#__PURE__*/React.createElement(PageLayout, {
78
- layout: layout,
79
78
  ref: function ref(layout) {
80
79
  return _this2.layoutRef = layout;
80
+ },
81
+ layout: layout,
82
+ onClose: function onClose() {
83
+ onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
81
84
  }
82
85
  }, /*#__PURE__*/React.createElement(PageLoadSchema, {
83
86
  pageId: form === null || form === void 0 ? void 0 : form.id
84
87
  }, function (schema) {
85
88
  var fdmSchema = schema.children[0].fdmSchema;
86
89
  if (form !== null && form !== void 0 && form.fieldId) {
87
- forEachFormSchema(schema, function (field) {
90
+ forEachSchema(schema, function (field) {
88
91
  if (form.fieldId == field.props.fieldId) {
89
92
  fdmSchema = field.fdmSchema;
90
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,15 +9,15 @@ 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
  }
17
17
  function _showFormGroup() {
18
- _showFormGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
18
+ _showFormGroup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
19
19
  var container, onClose, props;
20
- return _regeneratorRuntime.wrap(function _callee$(_context) {
20
+ return _regeneratorRuntime.wrap(function (_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
23
23
  container = options.container, onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
@@ -29,7 +29,7 @@ function _showFormGroup() {
29
29
  props: props
30
30
  }
31
31
  }));
32
- case 2:
32
+ case 1:
33
33
  case "end":
34
34
  return _context.stop();
35
35
  }
@@ -67,17 +67,18 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
67
67
  onClose === null || onClose === void 0 ? void 0 : onClose();
68
68
  };
69
69
  return /*#__PURE__*/React.createElement(PageLayout, {
70
- layout: layout,
71
70
  ref: function ref(layout) {
72
71
  return _this2.layoutRef = layout;
73
- }
72
+ },
73
+ layout: layout,
74
+ keyboard: false
74
75
  }, /*#__PURE__*/React.createElement(PageLoadSchema, {
75
76
  pageId: form === null || form === void 0 ? void 0 : form.id
76
77
  }, function (schema) {
77
78
  return /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
78
79
  components: window._components || window.components || window.__components,
79
80
  schema: {
80
- id: v4(),
81
+ id: uuid(),
81
82
  componentName: "Page",
82
83
  props: {},
83
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;
@@ -15,30 +15,40 @@ export function showForm(_x) {
15
15
  return _showForm.apply(this, arguments);
16
16
  }
17
17
  function _showForm() {
18
- _showForm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
19
- var container, onClose, props, _options$form, paths, mode, dataId, params, url, _page;
20
- return _regeneratorRuntime.wrap(function _callee$(_context) {
18
+ _showForm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
19
+ var container, onClose, props, _options$form, paths, mode, dataId, params, _options$form2, url, page;
20
+ return _regeneratorRuntime.wrap(function (_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
23
23
  container = options.container, onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2); //容器不存在需要手动取消挂载
24
24
  if (!(options.layout == "page" && !container)) {
25
- _context.next = 12;
25
+ _context.next = 2;
26
26
  break;
27
27
  }
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();
35
- _context.next = 9;
40
+ url = "/" + paths[1] + "/pages?" + params.toString();
41
+ if (paths[1] == "workPlatform") {
42
+ url = "/pages?" + params.toString();
43
+ }
44
+ //const url = `/${paths[1]}/${paths[2]}/${options.form?.id}/${mode}?${params.toString()}`;
45
+ _context.next = 1;
36
46
  return openPage(url, url);
37
- case 9:
38
- _page = _context.sent;
39
- console.debug("openPage", _page);
47
+ case 1:
48
+ page = _context.sent;
49
+ console.debug("openPage", page);
40
50
  return _context.abrupt("return");
41
- case 12:
51
+ case 2:
42
52
  return _context.abrupt("return", renderElement({
43
53
  container: container,
44
54
  onClose: onClose,
@@ -47,7 +57,7 @@ function _showForm() {
47
57
  props: props
48
58
  }
49
59
  }));
50
- case 13:
60
+ case 3:
51
61
  case "end":
52
62
  return _context.stop();
53
63
  }
@@ -87,7 +97,8 @@ var FormRender = /*#__PURE__*/function (_Component) {
87
97
  layout: layout,
88
98
  ref: function ref(layout) {
89
99
  return _this2.layoutRef = layout;
90
- }
100
+ },
101
+ onClose: onClose
91
102
  }, /*#__PURE__*/React.createElement(PageLoadSchema, {
92
103
  pageId: form === null || form === void 0 ? void 0 : form.id
93
104
  }, function (schema) {
@@ -2,6 +2,8 @@ import { Component } from "react";
2
2
  export type PageLayoutType = "page" | "modal" | "drawer";
3
3
  interface PageLayoutProps {
4
4
  layout?: PageLayoutType;
5
+ onClose?: (evt: any) => void;
6
+ keyboard?: boolean;
5
7
  children: any;
6
8
  }
7
9
  interface PageLayoutState {
@@ -10,6 +12,7 @@ interface PageLayoutState {
10
12
  }
11
13
  export declare class PageLayout extends Component<PageLayoutProps, PageLayoutState> {
12
14
  state: PageLayoutState;
15
+ get layout(): PageLayoutType;
13
16
  close: () => void;
14
17
  constructor(props: any);
15
18
  componentDidMount(): void;
@@ -1,6 +1,10 @@
1
1
  import _Drawer from "antd/es/drawer";
2
2
  import _Modal from "antd/es/modal";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
5
+ import _createClass from "@babel/runtime/helpers/createClass";
3
6
  import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
7
+ var _excluded = ["children"];
4
8
  import React, { Component } from "react";
5
9
  import { LoadMaterials } from "../../components/load-materials";
6
10
  export var PageLayout = /*#__PURE__*/function (_Component) {
@@ -19,7 +23,7 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
19
23
  return Math.min(window.innerWidth, 1600);
20
24
  };
21
25
  _this.handleResize = function () {
22
- if (_this.props.layout == "drawer") {
26
+ if (_this.layout == "drawer") {
23
27
  _this.setState({
24
28
  width: _this.getWith()
25
29
  });
@@ -37,10 +41,13 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
37
41
  window.removeEventListener("resize", this.handleResize);
38
42
  };
39
43
  _proto.render = function render() {
40
- var layout = this.props.layout;
44
+ var _this$props = this.props,
45
+ children = _this$props.children,
46
+ extraProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
47
+ var layout = this.layout;
41
48
  var state = this.state;
42
- var children = /*#__PURE__*/React.createElement(LoadMaterialChildren, null, this.props.children);
43
- var restProps = {
49
+ var restProps = _extends({}, extraProps, {
50
+ children: undefined,
44
51
  open: state.open,
45
52
  width: state.width,
46
53
  onClose: this.close,
@@ -59,17 +66,34 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
59
66
  }
60
67
  },
61
68
  maskClosable: false
62
- };
69
+ });
70
+ var loadChildren = /*#__PURE__*/React.createElement(LoadMaterialChildren, null, children);
63
71
  if (layout == "modal") {
64
72
  restProps.style.top = 64;
65
73
  restProps.styles.body.height = "calc(100vh - 120px)";
66
- return /*#__PURE__*/React.createElement(_Modal, restProps, children);
74
+ return /*#__PURE__*/React.createElement(_Modal, restProps, loadChildren);
67
75
  } else if (layout == "drawer") {
68
- return /*#__PURE__*/React.createElement(_Drawer, restProps, children);
76
+ if (window.isMobile) {
77
+ restProps.placement = "bottom";
78
+ }
79
+ return /*#__PURE__*/React.createElement(_Drawer, _extends({}, restProps, {
80
+ height: "85vh"
81
+ }), loadChildren);
69
82
  }
70
- return children;
83
+ return loadChildren;
71
84
  };
72
- return PageLayout;
85
+ return _createClass(PageLayout, [{
86
+ key: "layout",
87
+ get: function get() {
88
+ var layout = this.props.layout;
89
+ if (window.isMobile) {
90
+ if (layout == "modal") {
91
+ return "drawer";
92
+ }
93
+ }
94
+ return layout;
95
+ }
96
+ }]);
73
97
  }(Component);
74
98
  function LoadMaterialChildren(props) {
75
99
  return /*#__PURE__*/React.createElement(LoadMaterials, null, props.children);