@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.
- package/es/components/load-materials/index.js +38 -22
- package/es/components/page-loading/index.js +4 -1
- 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/form-api.d.ts +1 -0
- package/es/utils/api/form-api.js +68 -29
- package/es/utils/api/index.d.ts +1 -1
- 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 +105 -23
- package/es/utils/api/schema.util.d.ts +3 -3
- package/es/utils/api/schema.util.js +17 -12
- package/es/utils/cache/index.js +57 -17
- package/es/utils/common/index.d.ts +3 -0
- package/es/utils/common/index.js +13 -3
- package/es/utils/page/page-form-data-manager-group.js +2 -2
- package/es/utils/page/page-form-data-manager.d.ts +1 -0
- package/es/utils/page/page-form-data-manager.js +2 -2
- package/es/utils/page/page-form-group.d.ts +1 -0
- package/es/utils/page/page-form-group.js +2 -2
- package/es/utils/page/page-form.d.ts +1 -0
- package/es/utils/page/page-form.js +12 -2
- package/es/utils/page/page-layout.d.ts +1 -0
- package/es/utils/page/page-layout.js +22 -5
- package/es/utils/page/page-load-schema.js +20 -28
- package/es/utils/page/page-show.d.ts +2 -0
- package/es/utils/page/page-show.js +5 -0
- package/es/utils/page/print-form.js +25 -16
- 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 +38 -22
- package/lib/components/page-loading/index.js +4 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +44 -4
- package/lib/index.less +10 -0
- package/lib/style.js +2 -2
- package/lib/utils/api/form-api.d.ts +1 -0
- package/lib/utils/api/form-api.js +68 -29
- package/lib/utils/api/index.d.ts +1 -1
- package/lib/utils/api/index.js +1 -0
- package/lib/utils/api/rest-api.d.ts +3 -1
- package/lib/utils/api/rest-api.js +105 -23
- package/lib/utils/api/schema.util.d.ts +3 -3
- package/lib/utils/api/schema.util.js +19 -13
- package/lib/utils/cache/index.js +56 -16
- package/lib/utils/common/index.d.ts +3 -0
- package/lib/utils/common/index.js +15 -2
- package/lib/utils/page/page-form-data-manager-group.js +2 -2
- package/lib/utils/page/page-form-data-manager.d.ts +1 -0
- package/lib/utils/page/page-form-data-manager.js +2 -2
- package/lib/utils/page/page-form-group.d.ts +1 -0
- package/lib/utils/page/page-form-group.js +2 -2
- package/lib/utils/page/page-form.d.ts +1 -0
- package/lib/utils/page/page-form.js +12 -2
- package/lib/utils/page/page-layout.d.ts +1 -0
- package/lib/utils/page/page-layout.js +22 -5
- package/lib/utils/page/page-load-schema.js +19 -27
- package/lib/utils/page/page-show.d.ts +2 -0
- package/lib/utils/page/page-show.js +5 -0
- package/lib/utils/page/print-form.js +25 -16
- 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
|
@@ -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[]>;
|
|
@@ -50,6 +50,7 @@ var PageRender = /*#__PURE__*/function (_Component) {
|
|
|
50
50
|
}
|
|
51
51
|
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
52
52
|
_this.layoutRef = void 0;
|
|
53
|
+
_this.schema = void 0;
|
|
53
54
|
return _this;
|
|
54
55
|
}
|
|
55
56
|
(0, _inheritsLoose2["default"])(PageRender, _Component);
|
|
@@ -78,6 +79,10 @@ var PageRender = /*#__PURE__*/function (_Component) {
|
|
|
78
79
|
}, /*#__PURE__*/_react["default"].createElement(_pageLoadSchema.PageLoadSchema, {
|
|
79
80
|
pageId: pageId
|
|
80
81
|
}, function (schema) {
|
|
82
|
+
_this2.schema = schema;
|
|
83
|
+
if (_this2.props.pageRef) {
|
|
84
|
+
_this2.props.pageRef(_this2);
|
|
85
|
+
}
|
|
81
86
|
return /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({
|
|
82
87
|
schema: schema,
|
|
83
88
|
components: window._components || window.components || window.__components
|
|
@@ -70,7 +70,7 @@ function _print() {
|
|
|
70
70
|
return _context2.abrupt("return");
|
|
71
71
|
case 2:
|
|
72
72
|
_context2.next = 3;
|
|
73
|
-
return openPrint(templateId);
|
|
73
|
+
return openPrint(templateId, options);
|
|
74
74
|
case 3:
|
|
75
75
|
iw = _context2.sent;
|
|
76
76
|
if (iw) {
|
|
@@ -80,8 +80,6 @@ function _print() {
|
|
|
80
80
|
_message2["default"].error("\u6253\u5370\u5931\u8D25!\u6253\u5370\u7A97\u53E3\u4E0D\u53EF\u4E3A\u7A7A!");
|
|
81
81
|
return _context2.abrupt("return");
|
|
82
82
|
case 4:
|
|
83
|
-
// @ts-ignore
|
|
84
|
-
iw.printOptions = options;
|
|
85
83
|
_context2.next = 6;
|
|
86
84
|
break;
|
|
87
85
|
case 5:
|
|
@@ -99,39 +97,50 @@ function _print() {
|
|
|
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"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(templateId) {
|
|
104
|
+
_openPrint = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(templateId, options) {
|
|
105
|
+
var url;
|
|
107
106
|
return _regenerator["default"].wrap(function (_context4) {
|
|
108
107
|
while (1) switch (_context4.prev = _context4.next) {
|
|
109
108
|
case 0:
|
|
109
|
+
url = "/print/" + templateId;
|
|
110
110
|
return _context4.abrupt("return", new Promise(/*#__PURE__*/function () {
|
|
111
111
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(resolve, reject) {
|
|
112
|
-
var
|
|
112
|
+
var printWindow, iframe;
|
|
113
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 (
|
|
120
|
+
printWindow = iframe.contentWindow;
|
|
121
|
+
if (printWindow) {
|
|
122
122
|
_context3.next = 1;
|
|
123
123
|
break;
|
|
124
124
|
}
|
|
125
125
|
reject("创建Iframe失败!");
|
|
126
126
|
return _context3.abrupt("return");
|
|
127
127
|
case 1:
|
|
128
|
-
|
|
129
|
-
|
|
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
145
|
case 2:
|
|
137
146
|
case "end":
|
|
@@ -139,7 +148,7 @@ function _openPrint() {
|
|
|
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",
|