@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.
- package/es/components/load-materials/index.js +44 -28
- package/es/components/page-loading/index.js +4 -1
- package/es/demo/index.js +8 -8
- package/es/index.d.ts +1 -1
- package/es/index.js +41 -2
- package/es/index.less +10 -0
- package/es/style.js +2 -2
- package/es/utils/api/file-api.js +21 -21
- package/es/utils/api/form-api.d.ts +2 -1
- package/es/utils/api/form-api.js +90 -51
- package/es/utils/api/form-api.utils.js +5 -4
- package/es/utils/api/index.d.ts +2 -2
- package/es/utils/api/index.js +1 -0
- package/es/utils/api/rest-api.d.ts +3 -1
- package/es/utils/api/rest-api.js +207 -125
- package/es/utils/api/schema-api.js +5 -5
- package/es/utils/api/schema.util.d.ts +3 -3
- package/es/utils/api/schema.util.js +17 -12
- package/es/utils/api/script-api.js +12 -12
- package/es/utils/api/user-info.js +7 -7
- package/es/utils/cache/index.js +66 -26
- package/es/utils/common/LoadPlugins.js +33 -33
- package/es/utils/common/SingletonInstanceMap.js +21 -21
- package/es/utils/common/index.d.ts +3 -0
- package/es/utils/common/index.js +13 -3
- 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 +9 -6
- package/es/utils/page/page-form-data-manager.d.ts +1 -0
- package/es/utils/page/page-form-data-manager.js +9 -6
- package/es/utils/page/page-form-group.d.ts +1 -0
- package/es/utils/page/page-form-group.js +8 -7
- package/es/utils/page/page-form.d.ts +1 -0
- package/es/utils/page/page-form.js +23 -12
- package/es/utils/page/page-layout.d.ts +3 -0
- package/es/utils/page/page-layout.js +33 -9
- package/es/utils/page/page-load-schema.js +20 -28
- package/es/utils/page/page-render.js +4 -4
- package/es/utils/page/page-show.d.ts +2 -0
- package/es/utils/page/page-show.js +8 -3
- package/es/utils/page/print-form.js +60 -51
- package/es/utils/uni-bridge.d.ts +18 -0
- package/es/utils/uni-bridge.js +130 -0
- package/es/utils/util.common.d.ts +1 -0
- package/es/utils/util.common.js +4 -0
- package/lib/components/load-materials/index.js +45 -30
- package/lib/components/page-loading/index.js +4 -1
- package/lib/demo/index.js +9 -10
- package/lib/index.d.ts +1 -1
- package/lib/index.js +45 -6
- package/lib/index.less +10 -0
- package/lib/style.js +2 -2
- package/lib/utils/api/file-api.js +21 -21
- package/lib/utils/api/form-api.d.ts +2 -1
- package/lib/utils/api/form-api.js +90 -51
- package/lib/utils/api/form-api.utils.js +5 -4
- package/lib/utils/api/index.d.ts +2 -2
- package/lib/utils/api/index.js +2 -2
- package/lib/utils/api/rest-api.d.ts +3 -1
- package/lib/utils/api/rest-api.js +207 -125
- package/lib/utils/api/schema-api.js +5 -5
- package/lib/utils/api/schema.util.d.ts +3 -3
- package/lib/utils/api/schema.util.js +19 -13
- package/lib/utils/api/script-api.js +12 -12
- package/lib/utils/api/user-info.js +7 -7
- package/lib/utils/cache/index.js +65 -25
- package/lib/utils/common/LoadPlugins.js +33 -33
- package/lib/utils/common/SingletonInstanceMap.js +21 -21
- package/lib/utils/common/index.d.ts +3 -0
- package/lib/utils/common/index.js +15 -2
- 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 +10 -8
- package/lib/utils/page/page-form-data-manager.d.ts +1 -0
- package/lib/utils/page/page-form-data-manager.js +10 -8
- package/lib/utils/page/page-form-group.d.ts +1 -0
- package/lib/utils/page/page-form-group.js +9 -9
- package/lib/utils/page/page-form.d.ts +1 -0
- package/lib/utils/page/page-form.js +24 -14
- package/lib/utils/page/page-layout.d.ts +3 -0
- package/lib/utils/page/page-layout.js +34 -11
- package/lib/utils/page/page-load-schema.js +19 -27
- package/lib/utils/page/page-render.js +4 -4
- package/lib/utils/page/page-show.d.ts +2 -0
- package/lib/utils/page/page-show.js +9 -5
- package/lib/utils/page/print-form.js +60 -51
- package/lib/utils/uni-bridge.d.ts +18 -0
- package/lib/utils/uni-bridge.js +135 -0
- package/lib/utils/util.common.d.ts +1 -0
- package/lib/utils/util.common.js +8 -0
- package/package.json +2 -2
|
@@ -5,11 +5,14 @@ exports.__esModule = true;
|
|
|
5
5
|
exports.PageLayout = void 0;
|
|
6
6
|
var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
|
|
7
7
|
var _modal = _interopRequireDefault(require("antd/lib/modal"));
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
11
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
9
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
13
|
var _loadMaterials = require("../../components/load-materials");
|
|
11
|
-
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
14
|
+
var _excluded = ["children"];
|
|
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); }
|
|
13
16
|
var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
14
17
|
function PageLayout(props) {
|
|
15
18
|
var _this;
|
|
@@ -26,7 +29,7 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
26
29
|
return Math.min(window.innerWidth, 1600);
|
|
27
30
|
};
|
|
28
31
|
_this.handleResize = function () {
|
|
29
|
-
if (_this.
|
|
32
|
+
if (_this.layout == "drawer") {
|
|
30
33
|
_this.setState({
|
|
31
34
|
width: _this.getWith()
|
|
32
35
|
});
|
|
@@ -44,10 +47,13 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
44
47
|
window.removeEventListener("resize", this.handleResize);
|
|
45
48
|
};
|
|
46
49
|
_proto.render = function render() {
|
|
47
|
-
var
|
|
50
|
+
var _this$props = this.props,
|
|
51
|
+
children = _this$props.children,
|
|
52
|
+
extraProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
53
|
+
var layout = this.layout;
|
|
48
54
|
var state = this.state;
|
|
49
|
-
var
|
|
50
|
-
|
|
55
|
+
var restProps = (0, _extends2["default"])({}, extraProps, {
|
|
56
|
+
children: undefined,
|
|
51
57
|
open: state.open,
|
|
52
58
|
width: state.width,
|
|
53
59
|
onClose: this.close,
|
|
@@ -66,17 +72,34 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
66
72
|
}
|
|
67
73
|
},
|
|
68
74
|
maskClosable: false
|
|
69
|
-
};
|
|
75
|
+
});
|
|
76
|
+
var loadChildren = /*#__PURE__*/_react["default"].createElement(LoadMaterialChildren, null, children);
|
|
70
77
|
if (layout == "modal") {
|
|
71
78
|
restProps.style.top = 64;
|
|
72
79
|
restProps.styles.body.height = "calc(100vh - 120px)";
|
|
73
|
-
return /*#__PURE__*/_react["default"].createElement(_modal["default"], restProps,
|
|
80
|
+
return /*#__PURE__*/_react["default"].createElement(_modal["default"], restProps, loadChildren);
|
|
74
81
|
} else if (layout == "drawer") {
|
|
75
|
-
|
|
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);
|
|
76
88
|
}
|
|
77
|
-
return
|
|
89
|
+
return loadChildren;
|
|
78
90
|
};
|
|
79
|
-
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
|
+
}]);
|
|
80
103
|
}(_react.Component);
|
|
81
104
|
function LoadMaterialChildren(props) {
|
|
82
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)(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _useState2 = (0, _react.useState)(
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
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
|
-
|
|
40
|
-
setErrorMsg("
|
|
41
|
-
|
|
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 (
|
|
43
|
+
if (schema) {
|
|
46
44
|
return children(schema);
|
|
47
45
|
}
|
|
48
|
-
if (
|
|
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
|
|
52
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null);
|
|
61
53
|
}
|
|
@@ -9,10 +9,10 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _client = require("react-dom/client");
|
|
11
11
|
function renderElement(options) {
|
|
12
|
-
return new Promise(
|
|
13
|
-
var _ref = (0, _asyncToGenerator2["default"])(
|
|
12
|
+
return new Promise(/*#__PURE__*/function () {
|
|
13
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(resolve, reject) {
|
|
14
14
|
var container, _onClose, _options$element, component, props, unmount, root, element;
|
|
15
|
-
return _regenerator["default"].wrap(function
|
|
15
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
16
16
|
while (1) switch (_context.prev = _context.next) {
|
|
17
17
|
case 0:
|
|
18
18
|
container = options.container, _onClose = options.onClose;
|
|
@@ -42,7 +42,7 @@ function renderElement(options) {
|
|
|
42
42
|
}
|
|
43
43
|
}));
|
|
44
44
|
root.render(element);
|
|
45
|
-
case
|
|
45
|
+
case 1:
|
|
46
46
|
case "end":
|
|
47
47
|
return _context.stop();
|
|
48
48
|
}
|
|
@@ -4,6 +4,8 @@ export interface ShowPageProps {
|
|
|
4
4
|
pageId: string;
|
|
5
5
|
layout?: PageLayoutType;
|
|
6
6
|
onClose?: () => void | Promise<void>;
|
|
7
|
+
extraProps?: any;
|
|
8
|
+
afterLoadSchema?: (schema: any) => void;
|
|
7
9
|
pageRef?: (page: any) => void;
|
|
8
10
|
}
|
|
9
11
|
export declare function show(options: ShowPageProps): Promise<any | any[]>;
|
|
@@ -15,15 +15,14 @@ var _pageLoadSchema = require("./page-load-schema");
|
|
|
15
15
|
var _reactRender = require("../../components/react-render");
|
|
16
16
|
var _excluded = ["layout", "pageId", "onClose"],
|
|
17
17
|
_excluded2 = ["container", "onClose"];
|
|
18
|
-
function
|
|
19
|
-
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; }
|
|
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); }
|
|
20
19
|
function show(_x) {
|
|
21
20
|
return _show.apply(this, arguments);
|
|
22
21
|
}
|
|
23
22
|
function _show() {
|
|
24
|
-
_show = (0, _asyncToGenerator2["default"])(
|
|
23
|
+
_show = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
25
24
|
var container, onClose, props;
|
|
26
|
-
return _regenerator["default"].wrap(function
|
|
25
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
27
26
|
while (1) switch (_context.prev = _context.next) {
|
|
28
27
|
case 0:
|
|
29
28
|
container = options.container, onClose = options.onClose, props = (0, _objectWithoutPropertiesLoose2["default"])(options, _excluded2);
|
|
@@ -35,7 +34,7 @@ function _show() {
|
|
|
35
34
|
props: props
|
|
36
35
|
}
|
|
37
36
|
}));
|
|
38
|
-
case
|
|
37
|
+
case 1:
|
|
39
38
|
case "end":
|
|
40
39
|
return _context.stop();
|
|
41
40
|
}
|
|
@@ -51,6 +50,7 @@ var PageRender = /*#__PURE__*/function (_Component) {
|
|
|
51
50
|
}
|
|
52
51
|
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
53
52
|
_this.layoutRef = void 0;
|
|
53
|
+
_this.schema = void 0;
|
|
54
54
|
return _this;
|
|
55
55
|
}
|
|
56
56
|
(0, _inheritsLoose2["default"])(PageRender, _Component);
|
|
@@ -79,6 +79,10 @@ var PageRender = /*#__PURE__*/function (_Component) {
|
|
|
79
79
|
}, /*#__PURE__*/_react["default"].createElement(_pageLoadSchema.PageLoadSchema, {
|
|
80
80
|
pageId: pageId
|
|
81
81
|
}, function (schema) {
|
|
82
|
+
_this2.schema = schema;
|
|
83
|
+
if (_this2.props.pageRef) {
|
|
84
|
+
_this2.props.pageRef(_this2);
|
|
85
|
+
}
|
|
82
86
|
return /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({
|
|
83
87
|
schema: schema,
|
|
84
88
|
components: window._components || window.components || window.__components
|
|
@@ -14,12 +14,12 @@ function getFormPrintTemplates(_x) {
|
|
|
14
14
|
return _getFormPrintTemplates.apply(this, arguments);
|
|
15
15
|
}
|
|
16
16
|
function _getFormPrintTemplates() {
|
|
17
|
-
_getFormPrintTemplates = (0, _asyncToGenerator2["default"])(
|
|
17
|
+
_getFormPrintTemplates = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(formId) {
|
|
18
18
|
var res;
|
|
19
|
-
return _regenerator["default"].wrap(function
|
|
19
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
22
|
-
_context.next =
|
|
22
|
+
_context.next = 1;
|
|
23
23
|
return _api.apiRequest.get("forms/search", {
|
|
24
24
|
params: {
|
|
25
25
|
formId: _formIds.FormIds.printTemplate,
|
|
@@ -31,16 +31,16 @@ function _getFormPrintTemplates() {
|
|
|
31
31
|
pageSize: 1000
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
case
|
|
34
|
+
case 1:
|
|
35
35
|
res = _context.sent;
|
|
36
36
|
if (!res.success) {
|
|
37
|
-
_context.next =
|
|
37
|
+
_context.next = 2;
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
40
40
|
return _context.abrupt("return", res.data);
|
|
41
|
-
case
|
|
41
|
+
case 2:
|
|
42
42
|
return _context.abrupt("return", []);
|
|
43
|
-
case
|
|
43
|
+
case 3:
|
|
44
44
|
case "end":
|
|
45
45
|
return _context.stop();
|
|
46
46
|
}
|
|
@@ -52,94 +52,103 @@ function print(_x2) {
|
|
|
52
52
|
return _print.apply(this, arguments);
|
|
53
53
|
}
|
|
54
54
|
function _print() {
|
|
55
|
-
_print = (0, _asyncToGenerator2["default"])(
|
|
56
|
-
var templateId, iw;
|
|
57
|
-
return _regenerator["default"].wrap(function
|
|
55
|
+
_print = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(options) {
|
|
56
|
+
var templateId, iw, _t;
|
|
57
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
58
58
|
while (1) switch (_context2.prev = _context2.next) {
|
|
59
59
|
case 0:
|
|
60
60
|
_context2.prev = 0;
|
|
61
|
-
_context2.next =
|
|
61
|
+
_context2.next = 1;
|
|
62
62
|
return (0, _index.showLoading)();
|
|
63
|
-
case
|
|
63
|
+
case 1:
|
|
64
64
|
templateId = options === null || options === void 0 ? void 0 : options.templateId;
|
|
65
65
|
if (templateId) {
|
|
66
|
-
_context2.next =
|
|
66
|
+
_context2.next = 2;
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
69
|
_message2["default"].error("\u6253\u5370\u5931\u8D25!\u6A21\u677Fid\u4E0D\u53EF\u4E3A\u7A7A!");
|
|
70
70
|
return _context2.abrupt("return");
|
|
71
|
-
case
|
|
72
|
-
_context2.next =
|
|
73
|
-
return openPrint(templateId);
|
|
74
|
-
case
|
|
71
|
+
case 2:
|
|
72
|
+
_context2.next = 3;
|
|
73
|
+
return openPrint(templateId, options);
|
|
74
|
+
case 3:
|
|
75
75
|
iw = _context2.sent;
|
|
76
76
|
if (iw) {
|
|
77
|
-
_context2.next =
|
|
77
|
+
_context2.next = 4;
|
|
78
78
|
break;
|
|
79
79
|
}
|
|
80
80
|
_message2["default"].error("\u6253\u5370\u5931\u8D25!\u6253\u5370\u7A97\u53E3\u4E0D\u53EF\u4E3A\u7A7A!");
|
|
81
81
|
return _context2.abrupt("return");
|
|
82
|
-
case
|
|
83
|
-
|
|
84
|
-
iw.printOptions = options;
|
|
85
|
-
_context2.next = 19;
|
|
82
|
+
case 4:
|
|
83
|
+
_context2.next = 6;
|
|
86
84
|
break;
|
|
87
|
-
case
|
|
88
|
-
_context2.prev =
|
|
89
|
-
|
|
90
|
-
console.log("打印失败",
|
|
91
|
-
case
|
|
92
|
-
_context2.prev =
|
|
93
|
-
return _context2.finish(
|
|
94
|
-
case
|
|
85
|
+
case 5:
|
|
86
|
+
_context2.prev = 5;
|
|
87
|
+
_t = _context2["catch"](0);
|
|
88
|
+
console.log("打印失败", _t);
|
|
89
|
+
case 6:
|
|
90
|
+
_context2.prev = 6;
|
|
91
|
+
return _context2.finish(6);
|
|
92
|
+
case 7:
|
|
95
93
|
case "end":
|
|
96
94
|
return _context2.stop();
|
|
97
95
|
}
|
|
98
|
-
}, _callee2, null, [[0,
|
|
96
|
+
}, _callee2, null, [[0, 5, 6, 7]]);
|
|
99
97
|
}));
|
|
100
98
|
return _print.apply(this, arguments);
|
|
101
99
|
}
|
|
102
|
-
function openPrint(_x3) {
|
|
100
|
+
function openPrint(_x3, _x4) {
|
|
103
101
|
return _openPrint.apply(this, arguments);
|
|
104
102
|
}
|
|
105
103
|
function _openPrint() {
|
|
106
|
-
_openPrint = (0, _asyncToGenerator2["default"])(
|
|
107
|
-
|
|
104
|
+
_openPrint = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(templateId, options) {
|
|
105
|
+
var url;
|
|
106
|
+
return _regenerator["default"].wrap(function (_context4) {
|
|
108
107
|
while (1) switch (_context4.prev = _context4.next) {
|
|
109
108
|
case 0:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
url = "/print/" + templateId;
|
|
110
|
+
return _context4.abrupt("return", new Promise(/*#__PURE__*/function () {
|
|
111
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(resolve, reject) {
|
|
112
|
+
var printWindow, iframe;
|
|
113
|
+
return _regenerator["default"].wrap(function (_context3) {
|
|
114
114
|
while (1) switch (_context3.prev = _context3.next) {
|
|
115
115
|
case 0:
|
|
116
116
|
iframe = document.createElement("iframe");
|
|
117
|
-
iframe.src =
|
|
118
|
-
iframe.
|
|
117
|
+
iframe.src = url;
|
|
118
|
+
iframe.className = "print-iframe";
|
|
119
119
|
document.body.appendChild(iframe);
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
_context3.next =
|
|
120
|
+
printWindow = iframe.contentWindow;
|
|
121
|
+
if (printWindow) {
|
|
122
|
+
_context3.next = 1;
|
|
123
123
|
break;
|
|
124
124
|
}
|
|
125
125
|
reject("创建Iframe失败!");
|
|
126
126
|
return _context3.abrupt("return");
|
|
127
|
-
case
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
case 1:
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
window.printWindow = printWindow;
|
|
130
|
+
printWindow.onload = function () {
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
printWindow.printOptions = options;
|
|
130
133
|
};
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
printWindow.addEventListener("beforeprint", function () {});
|
|
135
|
+
printWindow.addEventListener("afterprint", function () {
|
|
133
136
|
(0, _index.hideLoading)();
|
|
134
|
-
|
|
137
|
+
setTimeout(function () {
|
|
138
|
+
resolve(printWindow);
|
|
139
|
+
if (window.__debug) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
iframe.remove();
|
|
143
|
+
}, 100);
|
|
135
144
|
});
|
|
136
|
-
case
|
|
145
|
+
case 2:
|
|
137
146
|
case "end":
|
|
138
147
|
return _context3.stop();
|
|
139
148
|
}
|
|
140
149
|
}, _callee3);
|
|
141
150
|
}));
|
|
142
|
-
return function (
|
|
151
|
+
return function (_x5, _x6) {
|
|
143
152
|
return _ref.apply(this, arguments);
|
|
144
153
|
};
|
|
145
154
|
}()));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface ScanCodeOptions {
|
|
2
|
+
onlyFromCamera?: boolean;
|
|
3
|
+
openUrl?: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface ScanCodeResult {
|
|
6
|
+
result: string;
|
|
7
|
+
}
|
|
8
|
+
declare class UniBridge {
|
|
9
|
+
private callbacks;
|
|
10
|
+
navigateTo(src: string): void;
|
|
11
|
+
scanCode(options: ScanCodeOptions): Promise<ScanCodeResult>;
|
|
12
|
+
getBarHeight(): Promise<unknown>;
|
|
13
|
+
getLocation(options: {}): Promise<unknown>;
|
|
14
|
+
private doAction;
|
|
15
|
+
private receiveMessage;
|
|
16
|
+
}
|
|
17
|
+
export declare const uniBridge: UniBridge;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.uniBridge = void 0;
|
|
6
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _message2 = _interopRequireDefault(require("antd/lib/message"));
|
|
8
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
|
+
var uniqueId = 0;
|
|
10
|
+
var UniBridge = /*#__PURE__*/function () {
|
|
11
|
+
function UniBridge() {
|
|
12
|
+
this.callbacks = {};
|
|
13
|
+
}
|
|
14
|
+
var _proto = UniBridge.prototype;
|
|
15
|
+
_proto.navigateTo = function navigateTo(src) {
|
|
16
|
+
var url = src;
|
|
17
|
+
if (!src.startsWith("http")) {
|
|
18
|
+
url = new URL(url, window.location.href).href;
|
|
19
|
+
}
|
|
20
|
+
uni.navigateTo({
|
|
21
|
+
url: "/pages/web-page/index?url=" + url
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
_proto.scanCode = /*#__PURE__*/function () {
|
|
25
|
+
var _scanCode = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
26
|
+
var _t;
|
|
27
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
_context.prev = 0;
|
|
31
|
+
_context.next = 1;
|
|
32
|
+
return this.doAction("scanCode", options);
|
|
33
|
+
case 1:
|
|
34
|
+
return _context.abrupt("return", _context.sent);
|
|
35
|
+
case 2:
|
|
36
|
+
_context.prev = 2;
|
|
37
|
+
_t = _context["catch"](0);
|
|
38
|
+
_message2["default"].error("");
|
|
39
|
+
throw _t;
|
|
40
|
+
case 3:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
43
|
+
}
|
|
44
|
+
}, _callee, this, [[0, 2]]);
|
|
45
|
+
}));
|
|
46
|
+
function scanCode(_x) {
|
|
47
|
+
return _scanCode.apply(this, arguments);
|
|
48
|
+
}
|
|
49
|
+
return scanCode;
|
|
50
|
+
}();
|
|
51
|
+
_proto.getBarHeight = /*#__PURE__*/function () {
|
|
52
|
+
var _getBarHeight = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
53
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
54
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
return _context2.abrupt("return", this.doAction("getBarHeight", {}));
|
|
57
|
+
case 1:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context2.stop();
|
|
60
|
+
}
|
|
61
|
+
}, _callee2, this);
|
|
62
|
+
}));
|
|
63
|
+
function getBarHeight() {
|
|
64
|
+
return _getBarHeight.apply(this, arguments);
|
|
65
|
+
}
|
|
66
|
+
return getBarHeight;
|
|
67
|
+
}();
|
|
68
|
+
_proto.getLocation = /*#__PURE__*/function () {
|
|
69
|
+
var _getLocation = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(options) {
|
|
70
|
+
return _regenerator["default"].wrap(function (_context3) {
|
|
71
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
return _context3.abrupt("return", this.doAction("getLocation", {
|
|
74
|
+
type: 'wgs84'
|
|
75
|
+
}));
|
|
76
|
+
case 1:
|
|
77
|
+
case "end":
|
|
78
|
+
return _context3.stop();
|
|
79
|
+
}
|
|
80
|
+
}, _callee3, this);
|
|
81
|
+
}));
|
|
82
|
+
function getLocation(_x2) {
|
|
83
|
+
return _getLocation.apply(this, arguments);
|
|
84
|
+
}
|
|
85
|
+
return getLocation;
|
|
86
|
+
}();
|
|
87
|
+
_proto.doAction = /*#__PURE__*/function () {
|
|
88
|
+
var _doAction = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(action, options) {
|
|
89
|
+
var _this = this;
|
|
90
|
+
var messageId;
|
|
91
|
+
return _regenerator["default"].wrap(function (_context4) {
|
|
92
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
uniqueId++;
|
|
95
|
+
messageId = "msg_" + uniqueId + Date.now().toString(36);
|
|
96
|
+
return _context4.abrupt("return", new Promise(function (resolve, reject) {
|
|
97
|
+
_this.callbacks[messageId] = {
|
|
98
|
+
resolve: resolve,
|
|
99
|
+
reject: reject
|
|
100
|
+
};
|
|
101
|
+
console.log("postMessage", action, options);
|
|
102
|
+
uni.postMessage({
|
|
103
|
+
data: {
|
|
104
|
+
action: action,
|
|
105
|
+
messageId: messageId,
|
|
106
|
+
options: options
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}));
|
|
110
|
+
case 1:
|
|
111
|
+
case "end":
|
|
112
|
+
return _context4.stop();
|
|
113
|
+
}
|
|
114
|
+
}, _callee4);
|
|
115
|
+
}));
|
|
116
|
+
function doAction(_x3, _x4) {
|
|
117
|
+
return _doAction.apply(this, arguments);
|
|
118
|
+
}
|
|
119
|
+
return doAction;
|
|
120
|
+
}();
|
|
121
|
+
_proto.receiveMessage = function receiveMessage(message) {
|
|
122
|
+
console.log('收到 UniApp 消息:', message);
|
|
123
|
+
var callback = this.callbacks[message.messageId];
|
|
124
|
+
if (callback) {
|
|
125
|
+
if (message.success) {
|
|
126
|
+
callback.resolve(message.data);
|
|
127
|
+
} else {
|
|
128
|
+
callback.reject(message.error || new Error('操作失败'));
|
|
129
|
+
}
|
|
130
|
+
delete this.callbacks[message.messageId];
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
return UniBridge;
|
|
134
|
+
}();
|
|
135
|
+
var uniBridge = exports.uniBridge = new UniBridge();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isTemplate(): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhubangyun/lowcode-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.90",
|
|
4
4
|
"description": "低代码核心",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@alifd/next": "^1.24.18",
|
|
25
25
|
"axios": "^1.7.9",
|
|
26
26
|
"case": "^1.6.3",
|
|
27
|
-
"uuid": "^
|
|
27
|
+
"uuid": "^10.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@alib/build-scripts": "^0.1.18",
|