@zhubangyun/lowcode-core 5.12.91 → 5.12.161
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.
- package/es/components/load-materials/index.js +12 -12
- package/es/demo/index.js +8 -8
- package/es/utils/api/file-api.js +21 -21
- package/es/utils/api/form-api.d.ts +1 -1
- package/es/utils/api/form-api.js +38 -36
- package/es/utils/api/form-api.utils.js +5 -4
- package/es/utils/api/index.d.ts +1 -1
- package/es/utils/api/rest-api.js +116 -116
- package/es/utils/api/schema-api.js +5 -5
- package/es/utils/api/script-api.js +12 -12
- package/es/utils/api/user-info.js +7 -7
- package/es/utils/cache/index.js +14 -14
- package/es/utils/common/LoadPlugins.js +33 -33
- package/es/utils/common/SingletonInstanceMap.js +21 -21
- package/es/utils/designer/assets/assets.parse.js +15 -15
- package/es/utils/designer/assets/assets.typing.js +6 -0
- package/es/utils/designer/engine/index.js +23 -23
- package/es/utils/designer/index.js +7 -7
- package/es/utils/page/index.js +18 -18
- package/es/utils/page/page-form-data-manager-group.js +7 -4
- package/es/utils/page/page-form-data-manager.js +7 -4
- package/es/utils/page/page-form-group.js +6 -5
- package/es/utils/page/page-form.js +12 -11
- package/es/utils/page/page-layout.d.ts +2 -0
- package/es/utils/page/page-layout.js +14 -7
- package/es/utils/page/page-render.js +4 -4
- package/es/utils/page/page-show.js +3 -3
- package/es/utils/page/print-form.js +36 -36
- package/lib/components/load-materials/index.js +13 -14
- package/lib/demo/index.js +9 -10
- package/lib/index.js +1 -2
- package/lib/utils/api/file-api.js +21 -21
- package/lib/utils/api/form-api.d.ts +1 -1
- package/lib/utils/api/form-api.js +38 -36
- package/lib/utils/api/form-api.utils.js +5 -4
- package/lib/utils/api/index.d.ts +1 -1
- package/lib/utils/api/index.js +1 -2
- package/lib/utils/api/rest-api.js +116 -116
- package/lib/utils/api/schema-api.js +5 -5
- package/lib/utils/api/script-api.js +12 -12
- package/lib/utils/api/user-info.js +7 -7
- package/lib/utils/cache/index.js +14 -14
- package/lib/utils/common/LoadPlugins.js +33 -33
- package/lib/utils/common/SingletonInstanceMap.js +21 -21
- package/lib/utils/designer/assets/assets.parse.js +16 -17
- package/lib/utils/designer/assets/assets.typing.js +6 -0
- package/lib/utils/designer/engine/index.js +23 -23
- package/lib/utils/designer/index.js +7 -7
- package/lib/utils/index.js +1 -2
- package/lib/utils/page/index.js +18 -18
- package/lib/utils/page/page-form-data-manager-group.js +8 -6
- package/lib/utils/page/page-form-data-manager.js +8 -6
- package/lib/utils/page/page-form-group.js +7 -7
- package/lib/utils/page/page-form.js +13 -13
- package/lib/utils/page/page-layout.d.ts +2 -0
- package/lib/utils/page/page-layout.js +15 -9
- package/lib/utils/page/page-render.js +4 -4
- package/lib/utils/page/page-show.js +4 -5
- package/lib/utils/page/print-form.js +36 -36
- package/package.json +1 -1
|
@@ -15,9 +15,9 @@ export function showFormGroup(_x) {
|
|
|
15
15
|
return _showFormGroup.apply(this, arguments);
|
|
16
16
|
}
|
|
17
17
|
function _showFormGroup() {
|
|
18
|
-
_showFormGroup = _asyncToGenerator(
|
|
18
|
+
_showFormGroup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
19
19
|
var container, onClose, props;
|
|
20
|
-
return _regeneratorRuntime.wrap(function
|
|
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
|
|
32
|
+
case 1:
|
|
33
33
|
case "end":
|
|
34
34
|
return _context.stop();
|
|
35
35
|
}
|
|
@@ -67,10 +67,11 @@ 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) {
|
|
@@ -15,14 +15,14 @@ export function showForm(_x) {
|
|
|
15
15
|
return _showForm.apply(this, arguments);
|
|
16
16
|
}
|
|
17
17
|
function _showForm() {
|
|
18
|
-
_showForm = _asyncToGenerator(
|
|
19
|
-
var container, onClose, props, _options$form, paths, mode, dataId, params, url,
|
|
20
|
-
return _regeneratorRuntime.wrap(function
|
|
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 (_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 =
|
|
25
|
+
_context.next = 2;
|
|
26
26
|
break;
|
|
27
27
|
}
|
|
28
28
|
paths = window.location.pathname.split("/");
|
|
@@ -32,13 +32,13 @@ function _showForm() {
|
|
|
32
32
|
params.set("dataId", dataId);
|
|
33
33
|
}
|
|
34
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 =
|
|
35
|
+
_context.next = 1;
|
|
36
36
|
return openPage(url, url);
|
|
37
|
-
case
|
|
38
|
-
|
|
39
|
-
console.debug("openPage",
|
|
37
|
+
case 1:
|
|
38
|
+
page = _context.sent;
|
|
39
|
+
console.debug("openPage", page);
|
|
40
40
|
return _context.abrupt("return");
|
|
41
|
-
case
|
|
41
|
+
case 2:
|
|
42
42
|
return _context.abrupt("return", renderElement({
|
|
43
43
|
container: container,
|
|
44
44
|
onClose: onClose,
|
|
@@ -47,7 +47,7 @@ function _showForm() {
|
|
|
47
47
|
props: props
|
|
48
48
|
}
|
|
49
49
|
}));
|
|
50
|
-
case
|
|
50
|
+
case 3:
|
|
51
51
|
case "end":
|
|
52
52
|
return _context.stop();
|
|
53
53
|
}
|
|
@@ -87,7 +87,8 @@ var FormRender = /*#__PURE__*/function (_Component) {
|
|
|
87
87
|
layout: layout,
|
|
88
88
|
ref: function ref(layout) {
|
|
89
89
|
return _this2.layoutRef = layout;
|
|
90
|
-
}
|
|
90
|
+
},
|
|
91
|
+
onClose: onClose
|
|
91
92
|
}, /*#__PURE__*/React.createElement(PageLoadSchema, {
|
|
92
93
|
pageId: form === null || form === void 0 ? void 0 : form.id
|
|
93
94
|
}, function (schema) {
|
|
@@ -1,6 +1,9 @@
|
|
|
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";
|
|
3
5
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
6
|
+
var _excluded = ["layout", "children"];
|
|
4
7
|
import React, { Component } from "react";
|
|
5
8
|
import { LoadMaterials } from "../../components/load-materials";
|
|
6
9
|
export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
@@ -37,10 +40,13 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
37
40
|
window.removeEventListener("resize", this.handleResize);
|
|
38
41
|
};
|
|
39
42
|
_proto.render = function render() {
|
|
40
|
-
var
|
|
43
|
+
var _this$props = this.props,
|
|
44
|
+
layout = _this$props.layout,
|
|
45
|
+
children = _this$props.children,
|
|
46
|
+
extraProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
41
47
|
var state = this.state;
|
|
42
|
-
var
|
|
43
|
-
|
|
48
|
+
var restProps = _extends({}, extraProps, {
|
|
49
|
+
children: undefined,
|
|
44
50
|
open: state.open,
|
|
45
51
|
width: state.width,
|
|
46
52
|
onClose: this.close,
|
|
@@ -59,15 +65,16 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
59
65
|
}
|
|
60
66
|
},
|
|
61
67
|
maskClosable: false
|
|
62
|
-
};
|
|
68
|
+
});
|
|
69
|
+
var loadChildren = /*#__PURE__*/React.createElement(LoadMaterialChildren, null, children);
|
|
63
70
|
if (layout == "modal") {
|
|
64
71
|
restProps.style.top = 64;
|
|
65
72
|
restProps.styles.body.height = "calc(100vh - 120px)";
|
|
66
|
-
return /*#__PURE__*/React.createElement(_Modal, restProps,
|
|
73
|
+
return /*#__PURE__*/React.createElement(_Modal, restProps, loadChildren);
|
|
67
74
|
} else if (layout == "drawer") {
|
|
68
|
-
return /*#__PURE__*/React.createElement(_Drawer, restProps,
|
|
75
|
+
return /*#__PURE__*/React.createElement(_Drawer, restProps, loadChildren);
|
|
69
76
|
}
|
|
70
|
-
return
|
|
77
|
+
return loadChildren;
|
|
71
78
|
};
|
|
72
79
|
return PageLayout;
|
|
73
80
|
}(Component);
|
|
@@ -4,10 +4,10 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import { createElement } from "react";
|
|
5
5
|
import { createRoot } from "react-dom/client";
|
|
6
6
|
export function renderElement(options) {
|
|
7
|
-
return new Promise(
|
|
8
|
-
var _ref = _asyncToGenerator(
|
|
7
|
+
return new Promise(/*#__PURE__*/function () {
|
|
8
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve, reject) {
|
|
9
9
|
var container, _onClose, _options$element, component, props, unmount, root, element;
|
|
10
|
-
return _regeneratorRuntime.wrap(function
|
|
10
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
11
11
|
while (1) switch (_context.prev = _context.next) {
|
|
12
12
|
case 0:
|
|
13
13
|
container = options.container, _onClose = options.onClose;
|
|
@@ -37,7 +37,7 @@ export function renderElement(options) {
|
|
|
37
37
|
}
|
|
38
38
|
}));
|
|
39
39
|
root.render(element);
|
|
40
|
-
case
|
|
40
|
+
case 1:
|
|
41
41
|
case "end":
|
|
42
42
|
return _context.stop();
|
|
43
43
|
}
|
|
@@ -14,9 +14,9 @@ export function show(_x) {
|
|
|
14
14
|
return _show.apply(this, arguments);
|
|
15
15
|
}
|
|
16
16
|
function _show() {
|
|
17
|
-
_show = _asyncToGenerator(
|
|
17
|
+
_show = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
18
18
|
var container, onClose, props;
|
|
19
|
-
return _regeneratorRuntime.wrap(function
|
|
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 _show() {
|
|
|
28
28
|
props: props
|
|
29
29
|
}
|
|
30
30
|
}));
|
|
31
|
-
case
|
|
31
|
+
case 1:
|
|
32
32
|
case "end":
|
|
33
33
|
return _context.stop();
|
|
34
34
|
}
|
|
@@ -8,12 +8,12 @@ export function getFormPrintTemplates(_x) {
|
|
|
8
8
|
return _getFormPrintTemplates.apply(this, arguments);
|
|
9
9
|
}
|
|
10
10
|
function _getFormPrintTemplates() {
|
|
11
|
-
_getFormPrintTemplates = _asyncToGenerator(
|
|
11
|
+
_getFormPrintTemplates = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(formId) {
|
|
12
12
|
var res;
|
|
13
|
-
return _regeneratorRuntime.wrap(function
|
|
13
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
14
14
|
while (1) switch (_context.prev = _context.next) {
|
|
15
15
|
case 0:
|
|
16
|
-
_context.next =
|
|
16
|
+
_context.next = 1;
|
|
17
17
|
return apiRequest.get("forms/search", {
|
|
18
18
|
params: {
|
|
19
19
|
formId: FormIds.printTemplate,
|
|
@@ -25,16 +25,16 @@ function _getFormPrintTemplates() {
|
|
|
25
25
|
pageSize: 1000
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
case
|
|
28
|
+
case 1:
|
|
29
29
|
res = _context.sent;
|
|
30
30
|
if (!res.success) {
|
|
31
|
-
_context.next =
|
|
31
|
+
_context.next = 2;
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
return _context.abrupt("return", res.data);
|
|
35
|
-
case
|
|
35
|
+
case 2:
|
|
36
36
|
return _context.abrupt("return", []);
|
|
37
|
-
case
|
|
37
|
+
case 3:
|
|
38
38
|
case "end":
|
|
39
39
|
return _context.stop();
|
|
40
40
|
}
|
|
@@ -46,50 +46,50 @@ export function print(_x2) {
|
|
|
46
46
|
return _print.apply(this, arguments);
|
|
47
47
|
}
|
|
48
48
|
function _print() {
|
|
49
|
-
_print = _asyncToGenerator(
|
|
50
|
-
var templateId, iw;
|
|
51
|
-
return _regeneratorRuntime.wrap(function
|
|
49
|
+
_print = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(options) {
|
|
50
|
+
var templateId, iw, _t;
|
|
51
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
52
52
|
while (1) switch (_context2.prev = _context2.next) {
|
|
53
53
|
case 0:
|
|
54
54
|
_context2.prev = 0;
|
|
55
|
-
_context2.next =
|
|
55
|
+
_context2.next = 1;
|
|
56
56
|
return showLoading();
|
|
57
|
-
case
|
|
57
|
+
case 1:
|
|
58
58
|
templateId = options === null || options === void 0 ? void 0 : options.templateId;
|
|
59
59
|
if (templateId) {
|
|
60
|
-
_context2.next =
|
|
60
|
+
_context2.next = 2;
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
63
|
_message.error("\u6253\u5370\u5931\u8D25!\u6A21\u677Fid\u4E0D\u53EF\u4E3A\u7A7A!");
|
|
64
64
|
return _context2.abrupt("return");
|
|
65
|
-
case
|
|
66
|
-
_context2.next =
|
|
65
|
+
case 2:
|
|
66
|
+
_context2.next = 3;
|
|
67
67
|
return openPrint(templateId);
|
|
68
|
-
case
|
|
68
|
+
case 3:
|
|
69
69
|
iw = _context2.sent;
|
|
70
70
|
if (iw) {
|
|
71
|
-
_context2.next =
|
|
71
|
+
_context2.next = 4;
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
_message.error("\u6253\u5370\u5931\u8D25!\u6253\u5370\u7A97\u53E3\u4E0D\u53EF\u4E3A\u7A7A!");
|
|
75
75
|
return _context2.abrupt("return");
|
|
76
|
-
case
|
|
76
|
+
case 4:
|
|
77
77
|
// @ts-ignore
|
|
78
78
|
iw.printOptions = options;
|
|
79
|
-
_context2.next =
|
|
79
|
+
_context2.next = 6;
|
|
80
80
|
break;
|
|
81
|
-
case
|
|
82
|
-
_context2.prev =
|
|
83
|
-
|
|
84
|
-
console.log("打印失败",
|
|
85
|
-
case
|
|
86
|
-
_context2.prev =
|
|
87
|
-
return _context2.finish(
|
|
88
|
-
case
|
|
81
|
+
case 5:
|
|
82
|
+
_context2.prev = 5;
|
|
83
|
+
_t = _context2["catch"](0);
|
|
84
|
+
console.log("打印失败", _t);
|
|
85
|
+
case 6:
|
|
86
|
+
_context2.prev = 6;
|
|
87
|
+
return _context2.finish(6);
|
|
88
|
+
case 7:
|
|
89
89
|
case "end":
|
|
90
90
|
return _context2.stop();
|
|
91
91
|
}
|
|
92
|
-
}, _callee2, null, [[0,
|
|
92
|
+
}, _callee2, null, [[0, 5, 6, 7]]);
|
|
93
93
|
}));
|
|
94
94
|
return _print.apply(this, arguments);
|
|
95
95
|
}
|
|
@@ -97,14 +97,14 @@ function openPrint(_x3) {
|
|
|
97
97
|
return _openPrint.apply(this, arguments);
|
|
98
98
|
}
|
|
99
99
|
function _openPrint() {
|
|
100
|
-
_openPrint = _asyncToGenerator(
|
|
101
|
-
return _regeneratorRuntime.wrap(function
|
|
100
|
+
_openPrint = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(templateId) {
|
|
101
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
102
102
|
while (1) switch (_context4.prev = _context4.next) {
|
|
103
103
|
case 0:
|
|
104
|
-
return _context4.abrupt("return", new Promise(
|
|
105
|
-
var _ref = _asyncToGenerator(
|
|
104
|
+
return _context4.abrupt("return", new Promise(/*#__PURE__*/function () {
|
|
105
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(resolve, reject) {
|
|
106
106
|
var iframe, iframeWindow;
|
|
107
|
-
return _regeneratorRuntime.wrap(function
|
|
107
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
108
108
|
while (1) switch (_context3.prev = _context3.next) {
|
|
109
109
|
case 0:
|
|
110
110
|
iframe = document.createElement("iframe");
|
|
@@ -113,12 +113,12 @@ function _openPrint() {
|
|
|
113
113
|
document.body.appendChild(iframe);
|
|
114
114
|
iframeWindow = iframe.contentWindow;
|
|
115
115
|
if (iframeWindow) {
|
|
116
|
-
_context3.next =
|
|
116
|
+
_context3.next = 1;
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
119
119
|
reject("创建Iframe失败!");
|
|
120
120
|
return _context3.abrupt("return");
|
|
121
|
-
case
|
|
121
|
+
case 1:
|
|
122
122
|
iframeWindow.onload = function () {
|
|
123
123
|
resolve(iframeWindow);
|
|
124
124
|
};
|
|
@@ -127,7 +127,7 @@ function _openPrint() {
|
|
|
127
127
|
hideLoading();
|
|
128
128
|
iframe.remove();
|
|
129
129
|
});
|
|
130
|
-
case
|
|
130
|
+
case 2:
|
|
131
131
|
case "end":
|
|
132
132
|
return _context3.stop();
|
|
133
133
|
}
|
|
@@ -8,8 +8,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _pageLoading = require("../page-loading");
|
|
10
10
|
var _common = require("../../utils/common");
|
|
11
|
-
function
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
11
|
+
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); }
|
|
13
12
|
function LoadMaterials(props) {
|
|
14
13
|
var _useState = (0, _react.useState)(false),
|
|
15
14
|
init = _useState[0],
|
|
@@ -24,15 +23,15 @@ function LoadMaterials(props) {
|
|
|
24
23
|
return _initialize.apply(this, arguments);
|
|
25
24
|
}
|
|
26
25
|
function _initialize() {
|
|
27
|
-
_initialize = (0, _asyncToGenerator2["default"])(
|
|
28
|
-
return _regenerator["default"].wrap(function
|
|
26
|
+
_initialize = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
27
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
29
28
|
while (1) switch (_context.prev = _context.next) {
|
|
30
29
|
case 0:
|
|
31
|
-
_context.next =
|
|
30
|
+
_context.next = 1;
|
|
32
31
|
return loadMaterials();
|
|
33
|
-
case
|
|
32
|
+
case 1:
|
|
34
33
|
setInit(true);
|
|
35
|
-
case
|
|
34
|
+
case 2:
|
|
36
35
|
case "end":
|
|
37
36
|
return _context.stop();
|
|
38
37
|
}
|
|
@@ -52,24 +51,24 @@ function loadMaterials() {
|
|
|
52
51
|
return _loadMaterials.apply(this, arguments);
|
|
53
52
|
}
|
|
54
53
|
function _loadMaterials() {
|
|
55
|
-
_loadMaterials = (0, _asyncToGenerator2["default"])(
|
|
54
|
+
_loadMaterials = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
56
55
|
var components, urls;
|
|
57
|
-
return _regenerator["default"].wrap(function
|
|
56
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
58
57
|
while (1) switch (_context2.prev = _context2.next) {
|
|
59
58
|
case 0:
|
|
60
59
|
components = {};
|
|
61
60
|
if (!window._components) {
|
|
62
|
-
_context2.next =
|
|
61
|
+
_context2.next = 1;
|
|
63
62
|
break;
|
|
64
63
|
}
|
|
65
64
|
return _context2.abrupt("return");
|
|
66
|
-
case
|
|
65
|
+
case 1:
|
|
67
66
|
urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.17.15/lodash.min.js", "dayjs/dayjs.min.js", "antd/latest/reset.css", "antd/latest/antd.min.js", "antdIcon/1.0.0/antdIcon.min.js", "lowcode/core/index.js", "lowcode/core/index.css", "lowcode/materials/root/view.js", "lowcode/materials/root/view.css", "lowcode/materials/antd/view.js", "lowcode/materials/antd/view.css", "lowcode/materials/antd-pro/view.js", "lowcode/materials/antd-pro/view.css", "lowcode/icon-font/app/iconfont.js"];
|
|
68
|
-
_context2.next =
|
|
67
|
+
_context2.next = 2;
|
|
69
68
|
return (0, _common.loadPlugins)(urls.map(function (url) {
|
|
70
69
|
return "https://cdn.zhiyunhe.com/plugin/" + url;
|
|
71
70
|
}));
|
|
72
|
-
case
|
|
71
|
+
case 2:
|
|
73
72
|
["RootMaterial", "AntdMaterial", "AntdProMaterial"].forEach(function (lib) {
|
|
74
73
|
var data = window[lib];
|
|
75
74
|
if (data) {
|
|
@@ -82,7 +81,7 @@ function _loadMaterials() {
|
|
|
82
81
|
}
|
|
83
82
|
});
|
|
84
83
|
window._components = components;
|
|
85
|
-
case
|
|
84
|
+
case 3:
|
|
86
85
|
case "end":
|
|
87
86
|
return _context2.stop();
|
|
88
87
|
}
|
package/lib/demo/index.js
CHANGED
|
@@ -7,23 +7,22 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
8
8
|
var _utils = _interopRequireDefault(require("../utils"));
|
|
9
9
|
var _schema = _interopRequireDefault(require("./data/schema"));
|
|
10
|
-
function
|
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
10
|
+
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); }
|
|
12
11
|
console.log(_utils["default"]);
|
|
13
12
|
function App() {
|
|
14
13
|
var ref = (0, _react.useRef)();
|
|
15
14
|
(0, _react.useEffect)(function () {
|
|
16
|
-
_utils["default"].designer.initEngine().then(
|
|
17
|
-
var _ref = (0, _asyncToGenerator2["default"])(
|
|
18
|
-
return _regenerator["default"].wrap(function
|
|
15
|
+
_utils["default"].designer.initEngine().then(/*#__PURE__*/function () {
|
|
16
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(engine) {
|
|
17
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
19
18
|
while (1) switch (_context.prev = _context.next) {
|
|
20
19
|
case 0:
|
|
21
|
-
_context.next =
|
|
20
|
+
_context.next = 1;
|
|
22
21
|
return engine.injectAssets([]);
|
|
23
|
-
case
|
|
24
|
-
_context.next =
|
|
22
|
+
case 1:
|
|
23
|
+
_context.next = 2;
|
|
25
24
|
return engine.init(ref.current, _schema["default"]);
|
|
26
|
-
case
|
|
25
|
+
case 2:
|
|
27
26
|
case "end":
|
|
28
27
|
return _context.stop();
|
|
29
28
|
}
|
|
@@ -42,4 +41,4 @@ function App() {
|
|
|
42
41
|
}
|
|
43
42
|
}));
|
|
44
43
|
}
|
|
45
|
-
_reactDom["default"].render(
|
|
44
|
+
_reactDom["default"].render(/*#__PURE__*/_react["default"].createElement(App, null), document.getElementById('root'));
|
package/lib/index.js
CHANGED
|
@@ -20,8 +20,7 @@ exports.RestFormApi = _api.RestFormApi;
|
|
|
20
20
|
exports.apiRequest = _api.apiRequest;
|
|
21
21
|
var _layout = require("./components/layout");
|
|
22
22
|
exports.Layout = _layout.Layout;
|
|
23
|
-
function
|
|
24
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
|
+
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); }
|
|
25
24
|
// @ts-ignore
|
|
26
25
|
window.__ReactRender = _reactRender.ReactRender;
|
|
27
26
|
// @ts-ignore
|
|
@@ -11,18 +11,18 @@ function upload(_x, _x2) {
|
|
|
11
11
|
return _upload.apply(this, arguments);
|
|
12
12
|
}
|
|
13
13
|
function _upload() {
|
|
14
|
-
_upload = (0, _asyncToGenerator2["default"])(
|
|
15
|
-
var res, ossFile, _options$onFinished, _options$onError;
|
|
16
|
-
return _regenerator["default"].wrap(function
|
|
14
|
+
_upload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(file, options) {
|
|
15
|
+
var res, ossFile, _options$onFinished, _options$onError, _t;
|
|
16
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
18
|
case 0:
|
|
19
19
|
if (file) {
|
|
20
|
-
_context.next =
|
|
20
|
+
_context.next = 1;
|
|
21
21
|
break;
|
|
22
22
|
}
|
|
23
23
|
return _context.abrupt("return", file);
|
|
24
|
-
case
|
|
25
|
-
_context.next =
|
|
24
|
+
case 1:
|
|
25
|
+
_context.next = 2;
|
|
26
26
|
return _index.apiRequest.post("files/signature", {
|
|
27
27
|
id: file.id,
|
|
28
28
|
size: file.size,
|
|
@@ -33,15 +33,15 @@ function _upload() {
|
|
|
33
33
|
type: "oss"
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
case
|
|
36
|
+
case 2:
|
|
37
37
|
res = _context.sent;
|
|
38
38
|
ossFile = res.data;
|
|
39
39
|
file.id = ossFile.id;
|
|
40
40
|
file.url = ossFile.url;
|
|
41
41
|
file.percent = 0;
|
|
42
42
|
file.status = "uploading";
|
|
43
|
-
_context.prev =
|
|
44
|
-
_context.next =
|
|
43
|
+
_context.prev = 3;
|
|
44
|
+
_context.next = 4;
|
|
45
45
|
return _index.apiRequest.put(ossFile.uploadUrl, (file === null || file === void 0 ? void 0 : file.buffer) || file, {
|
|
46
46
|
headers: {
|
|
47
47
|
'Content-Type': file.type
|
|
@@ -54,21 +54,21 @@ function _upload() {
|
|
|
54
54
|
options === null || options === void 0 ? void 0 : (_options$onProgress = options.onProgress) === null || _options$onProgress === void 0 ? void 0 : _options$onProgress.call(options, evt);
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
-
case
|
|
57
|
+
case 4:
|
|
58
58
|
file.status = "done";
|
|
59
59
|
options === null || options === void 0 ? void 0 : (_options$onFinished = options.onFinished) === null || _options$onFinished === void 0 ? void 0 : _options$onFinished.call(options);
|
|
60
|
-
_context.next =
|
|
60
|
+
_context.next = 6;
|
|
61
61
|
break;
|
|
62
|
-
case
|
|
63
|
-
_context.prev =
|
|
64
|
-
|
|
62
|
+
case 5:
|
|
63
|
+
_context.prev = 5;
|
|
64
|
+
_t = _context["catch"](3);
|
|
65
65
|
file.status = "error";
|
|
66
|
-
options === null || options === void 0 ? void 0 : (_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options,
|
|
67
|
-
case
|
|
66
|
+
options === null || options === void 0 ? void 0 : (_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options, _t);
|
|
67
|
+
case 6:
|
|
68
68
|
case "end":
|
|
69
69
|
return _context.stop();
|
|
70
70
|
}
|
|
71
|
-
}, _callee, null, [[
|
|
71
|
+
}, _callee, null, [[3, 5]]);
|
|
72
72
|
}));
|
|
73
73
|
return _upload.apply(this, arguments);
|
|
74
74
|
}
|
|
@@ -76,16 +76,16 @@ function update(_x3) {
|
|
|
76
76
|
return _update.apply(this, arguments);
|
|
77
77
|
}
|
|
78
78
|
function _update() {
|
|
79
|
-
_update = (0, _asyncToGenerator2["default"])(
|
|
80
|
-
return _regenerator["default"].wrap(function
|
|
79
|
+
_update = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(file) {
|
|
80
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
81
81
|
while (1) switch (_context2.prev = _context2.next) {
|
|
82
82
|
case 0:
|
|
83
|
-
_context2.next =
|
|
83
|
+
_context2.next = 1;
|
|
84
84
|
return _index.apiRequest.post("files/update", {
|
|
85
85
|
id: file.id,
|
|
86
86
|
fileName: file.fileName
|
|
87
87
|
});
|
|
88
|
-
case
|
|
88
|
+
case 1:
|
|
89
89
|
case "end":
|
|
90
90
|
return _context2.stop();
|
|
91
91
|
}
|
|
@@ -15,5 +15,5 @@ export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
|
15
15
|
save(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
16
16
|
create(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
17
17
|
update(id: string, data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
18
|
-
serviceUpdate(data: DataType, options?: BaseRequestOptions<DataType>): Promise<import("axios").AxiosResponse<any, any>>;
|
|
18
|
+
serviceUpdate(data: DataType, options?: BaseRequestOptions<DataType>): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
19
19
|
}
|