@zhubangyun/lowcode-core 5.10.83 → 5.10.211
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 +3 -4
- package/es/components/log-error-content.d.ts +5 -0
- package/es/components/log-error-content.js +32 -0
- package/es/components/react-render/index.d.ts +1 -1
- package/es/components/react-render/index.js +4 -2
- package/es/components/typing.d.ts +1 -1
- package/es/index.js +0 -1
- package/es/style.js +1 -1
- package/es/utils/api/form-api.js +8 -5
- package/es/utils/api/form-api.utils.d.ts +5 -0
- package/es/utils/api/form-api.utils.js +43 -26
- package/es/utils/api/rest-api.d.ts +6 -6
- package/es/utils/api/rest-api.js +24 -52
- package/es/utils/api/schema-api.d.ts +1 -0
- package/es/utils/api/schema-api.js +16 -6
- package/es/utils/common/LoadPlugins.js +16 -9
- package/es/utils/common/SingletonInstanceMap.d.ts +1 -0
- package/es/utils/common/SingletonInstanceMap.js +3 -0
- package/es/utils/designer/assets/assets.typing.d.ts +3 -3
- package/es/utils/designer/assets/index.d.ts +1 -1
- package/es/utils/page/page-form-data-manager-group.d.ts +1 -1
- package/es/utils/page/page-form-data-manager.d.ts +1 -1
- package/es/utils/page/page-form.d.ts +2 -1
- package/es/utils/page/page-layout.d.ts +2 -2
- package/es/utils/page/page-layout.js +7 -4
- package/es/utils/page/page-load-schema.js +10 -2
- package/es/utils/page/page-render.js +11 -11
- package/lib/components/load-materials/index.js +3 -4
- package/lib/components/log-error-content.d.ts +5 -0
- package/lib/components/log-error-content.js +37 -0
- package/lib/components/react-render/index.d.ts +1 -1
- package/lib/components/react-render/index.js +5 -3
- package/lib/components/typing.d.ts +1 -1
- package/lib/index.js +0 -2
- package/lib/style.js +1 -1
- package/lib/utils/api/form-api.js +8 -5
- package/lib/utils/api/form-api.utils.d.ts +5 -0
- package/lib/utils/api/form-api.utils.js +43 -26
- package/lib/utils/api/rest-api.d.ts +6 -6
- package/lib/utils/api/rest-api.js +24 -52
- package/lib/utils/api/schema-api.d.ts +1 -0
- package/lib/utils/api/schema-api.js +17 -6
- package/lib/utils/common/LoadPlugins.js +16 -9
- package/lib/utils/common/SingletonInstanceMap.d.ts +1 -0
- package/lib/utils/common/SingletonInstanceMap.js +3 -0
- package/lib/utils/designer/assets/assets.typing.d.ts +3 -3
- package/lib/utils/designer/assets/index.d.ts +1 -1
- package/lib/utils/page/page-form-data-manager-group.d.ts +1 -1
- package/lib/utils/page/page-form-data-manager.d.ts +1 -1
- package/lib/utils/page/page-form.d.ts +2 -1
- package/lib/utils/page/page-layout.d.ts +2 -2
- package/lib/utils/page/page-layout.js +7 -4
- package/lib/utils/page/page-load-schema.js +10 -2
- package/lib/utils/page/page-render.js +11 -11
- package/package.json +7 -7
- package/es/utils/common/LoadMaterials.d.ts +0 -1
- package/es/utils/common/LoadMaterials.js +0 -37
- package/es/utils/common/ProcessHandler.d.ts +0 -30
- package/es/utils/common/ProcessHandler.js +0 -303
- package/lib/utils/common/LoadMaterials.d.ts +0 -1
- package/lib/utils/common/LoadMaterials.js +0 -42
- package/lib/utils/common/ProcessHandler.d.ts +0 -30
- package/lib/utils/common/ProcessHandler.js +0 -308
|
@@ -5,7 +5,6 @@ exports.__esModule = true;
|
|
|
5
5
|
exports.RestApi = exports.BaseRestApi = void 0;
|
|
6
6
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
7
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
8
|
-
var _typography = _interopRequireDefault(require("antd/lib/typography"));
|
|
9
8
|
var _notification2 = _interopRequireDefault(require("antd/lib/notification"));
|
|
10
9
|
var _modal = _interopRequireDefault(require("antd/lib/modal"));
|
|
11
10
|
var _message2 = _interopRequireDefault(require("antd/lib/message"));
|
|
@@ -13,7 +12,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
13
12
|
var _axios = _interopRequireDefault(require("axios"));
|
|
14
13
|
var _index = require("./index");
|
|
15
14
|
var _data = require("../data");
|
|
16
|
-
var
|
|
15
|
+
var _logErrorContent = require("../../components/log-error-content");
|
|
17
16
|
var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
18
17
|
function BaseRestApi(uri, options) {
|
|
19
18
|
this.uri = void 0;
|
|
@@ -350,72 +349,64 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
350
349
|
return _delete2.apply(this, arguments);
|
|
351
350
|
}
|
|
352
351
|
return _delete;
|
|
353
|
-
}()
|
|
354
|
-
|
|
355
|
-
_proto.showError =
|
|
356
|
-
/*#__PURE__*/
|
|
357
|
-
function () {
|
|
352
|
+
}();
|
|
353
|
+
_proto.showError = /*#__PURE__*/function () {
|
|
358
354
|
var _showError = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(type, res) {
|
|
359
|
-
var msg, props
|
|
355
|
+
var msg, props;
|
|
360
356
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
361
357
|
while (1) switch (_context8.prev = _context8.next) {
|
|
362
358
|
case 0:
|
|
363
359
|
msg = res.message;
|
|
364
360
|
_context8.prev = 1;
|
|
365
361
|
if (!msg) {
|
|
366
|
-
_context8.next =
|
|
362
|
+
_context8.next = 19;
|
|
367
363
|
break;
|
|
368
364
|
}
|
|
369
365
|
props = JSON.parse(msg);
|
|
370
|
-
content =
|
|
371
|
-
requestId: res.requestId,
|
|
372
|
-
message: props.message
|
|
373
|
-
});
|
|
374
|
-
props.content = content;
|
|
375
|
-
props.message = content;
|
|
366
|
+
props.content = props.message;
|
|
376
367
|
if (!props.title) {
|
|
377
368
|
props.title = "" + this.title + type;
|
|
378
369
|
}
|
|
379
370
|
if (!(props.type == "message")) {
|
|
380
|
-
_context8.next =
|
|
371
|
+
_context8.next = 11;
|
|
381
372
|
break;
|
|
382
373
|
}
|
|
383
374
|
_message2["default"].error(props);
|
|
384
375
|
return _context8.abrupt("return");
|
|
385
|
-
case
|
|
376
|
+
case 11:
|
|
386
377
|
if (!(props.type == "modal")) {
|
|
387
|
-
_context8.next =
|
|
378
|
+
_context8.next = 16;
|
|
388
379
|
break;
|
|
389
380
|
}
|
|
390
381
|
_modal["default"].error(props);
|
|
391
382
|
return _context8.abrupt("return");
|
|
392
|
-
case
|
|
383
|
+
case 16:
|
|
393
384
|
if (!(props.type == "notification")) {
|
|
394
|
-
_context8.next =
|
|
385
|
+
_context8.next = 19;
|
|
395
386
|
break;
|
|
396
387
|
}
|
|
397
388
|
_notification2["default"].error(props);
|
|
398
389
|
return _context8.abrupt("return");
|
|
399
|
-
case
|
|
400
|
-
_context8.next =
|
|
390
|
+
case 19:
|
|
391
|
+
_context8.next = 25;
|
|
401
392
|
break;
|
|
402
|
-
case
|
|
403
|
-
_context8.prev =
|
|
393
|
+
case 21:
|
|
394
|
+
_context8.prev = 21;
|
|
404
395
|
_context8.t0 = _context8["catch"](1);
|
|
405
396
|
console.error("" + this.title + type + (msg || ""));
|
|
406
397
|
_modal["default"].error({
|
|
407
398
|
title: "" + this.title + type,
|
|
408
399
|
centered: true,
|
|
409
|
-
content: /*#__PURE__*/React.createElement(
|
|
400
|
+
content: /*#__PURE__*/React.createElement(_logErrorContent.LogErrorContent, {
|
|
410
401
|
requestId: res.requestId,
|
|
411
402
|
message: res.message
|
|
412
403
|
})
|
|
413
404
|
});
|
|
414
|
-
case
|
|
405
|
+
case 25:
|
|
415
406
|
case "end":
|
|
416
407
|
return _context8.stop();
|
|
417
408
|
}
|
|
418
|
-
}, _callee8, this, [[1,
|
|
409
|
+
}, _callee8, this, [[1, 21]]);
|
|
419
410
|
}));
|
|
420
411
|
function showError(_x15, _x16) {
|
|
421
412
|
return _showError.apply(this, arguments);
|
|
@@ -424,32 +415,13 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
424
415
|
}();
|
|
425
416
|
return BaseRestApi;
|
|
426
417
|
}();
|
|
427
|
-
function
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
}, props.message || "");
|
|
434
|
-
if (props.requestId) {
|
|
435
|
-
return /*#__PURE__*/React.createElement("div", null, content, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
|
|
436
|
-
onClick: function onClick() {
|
|
437
|
-
_modal["default"].destroyAll();
|
|
438
|
-
_message2["default"].destroy();
|
|
439
|
-
_notification2["default"].destroy();
|
|
440
|
-
(0, _page.showForm)({
|
|
441
|
-
layout: "modal",
|
|
442
|
-
form: {
|
|
443
|
-
id: "form_e3dbb9076a544f86a3bb6ec113e22494"
|
|
444
|
-
},
|
|
445
|
-
mode: "detail",
|
|
446
|
-
dataId: props.requestId
|
|
447
|
-
}).then();
|
|
448
|
-
}
|
|
449
|
-
}, "\u67E5\u770B\u65E5\u5FD7")));
|
|
450
|
-
} else {
|
|
451
|
-
return content;
|
|
418
|
+
function getStringId(item) {
|
|
419
|
+
if (typeof (item === null || item === void 0 ? void 0 : item.id) === "string") {
|
|
420
|
+
return item.id;
|
|
421
|
+
} else if (typeof item === "string") {
|
|
422
|
+
return item;
|
|
452
423
|
}
|
|
424
|
+
return null;
|
|
453
425
|
}
|
|
454
426
|
var RestApi = exports.RestApi = /*#__PURE__*/function (_BaseRestApi2) {
|
|
455
427
|
function RestApi(uri, options) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.getSchema = getSchema;
|
|
6
|
+
exports.getSchemaFromCache = getSchemaFromCache;
|
|
6
7
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
8
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
9
|
var _cache = require("../cache");
|
|
@@ -15,12 +16,8 @@ function _getSchema() {
|
|
|
15
16
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
16
17
|
while (1) switch (_context.prev = _context.next) {
|
|
17
18
|
case 0:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
mock = window.__mock;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
key = mock ? pageId + "_mock" : pageId;
|
|
19
|
+
mock = getMock(mock);
|
|
20
|
+
key = mock ? pageId + ":mock" : pageId;
|
|
24
21
|
_context.next = 4;
|
|
25
22
|
return _cache.schema.getInstance(key, {
|
|
26
23
|
mock: mock,
|
|
@@ -35,4 +32,18 @@ function _getSchema() {
|
|
|
35
32
|
}, _callee);
|
|
36
33
|
}));
|
|
37
34
|
return _getSchema.apply(this, arguments);
|
|
35
|
+
}
|
|
36
|
+
function getSchemaFromCache(pageId, mock) {
|
|
37
|
+
if (!pageId) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
mock = getMock(mock);
|
|
41
|
+
var key = mock ? pageId + "_mock" : pageId;
|
|
42
|
+
return _cache.schema.get(key);
|
|
43
|
+
}
|
|
44
|
+
function getMock(mock) {
|
|
45
|
+
if (typeof mock !== "boolean") {
|
|
46
|
+
mock = !!window.__mock;
|
|
47
|
+
}
|
|
48
|
+
return mock;
|
|
38
49
|
}
|
|
@@ -67,10 +67,15 @@ function _loadStyle() {
|
|
|
67
67
|
case 2:
|
|
68
68
|
return _context3.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
69
69
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(resolve) {
|
|
70
|
-
var target;
|
|
70
|
+
var callback, target;
|
|
71
71
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
72
72
|
while (1) switch (_context2.prev = _context2.next) {
|
|
73
73
|
case 0:
|
|
74
|
+
callback = function _callback(status) {
|
|
75
|
+
setTimeout(function () {
|
|
76
|
+
resolve(status);
|
|
77
|
+
}, 10);
|
|
78
|
+
};
|
|
74
79
|
//加载式样
|
|
75
80
|
target = doc.querySelector("link[href='" + src + "']");
|
|
76
81
|
if (!target) {
|
|
@@ -78,16 +83,16 @@ function _loadStyle() {
|
|
|
78
83
|
target.href = src;
|
|
79
84
|
target.rel = "stylesheet";
|
|
80
85
|
target.onload = function () {
|
|
81
|
-
|
|
86
|
+
return callback(true);
|
|
82
87
|
};
|
|
83
88
|
target.onerror = function () {
|
|
84
|
-
|
|
89
|
+
return callback(false);
|
|
85
90
|
};
|
|
86
91
|
doc.head.appendChild(target);
|
|
87
92
|
} else {
|
|
88
|
-
|
|
93
|
+
callback(true);
|
|
89
94
|
}
|
|
90
|
-
case
|
|
95
|
+
case 3:
|
|
91
96
|
case "end":
|
|
92
97
|
return _context2.stop();
|
|
93
98
|
}
|
|
@@ -125,8 +130,10 @@ function _loadScript() {
|
|
|
125
130
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
126
131
|
while (1) switch (_context4.prev = _context4.next) {
|
|
127
132
|
case 0:
|
|
128
|
-
callback = function
|
|
129
|
-
|
|
133
|
+
callback = function _callback2(status) {
|
|
134
|
+
setTimeout(function () {
|
|
135
|
+
resolve(status);
|
|
136
|
+
}, 10);
|
|
130
137
|
};
|
|
131
138
|
//加载脚本
|
|
132
139
|
target = doc.querySelector("script[src='" + src + "']");
|
|
@@ -137,10 +144,10 @@ function _loadScript() {
|
|
|
137
144
|
}
|
|
138
145
|
target.src = src;
|
|
139
146
|
target.onload = function () {
|
|
140
|
-
callback(true);
|
|
147
|
+
return callback(true);
|
|
141
148
|
};
|
|
142
149
|
target.onerror = function () {
|
|
143
|
-
callback(false);
|
|
150
|
+
return callback(false);
|
|
144
151
|
};
|
|
145
152
|
doc.body.appendChild(target);
|
|
146
153
|
} else {
|
|
@@ -2,6 +2,7 @@ export declare abstract class SingletonInstanceMap<Value, Options> {
|
|
|
2
2
|
private readonly valueMap;
|
|
3
3
|
private readonly lockMap;
|
|
4
4
|
getInstance(key: string, options: Options): Promise<Value>;
|
|
5
|
+
get(key: string): Value;
|
|
5
6
|
clear(): void;
|
|
6
7
|
abstract createInstance(key: string, options: Options): Promise<Value>;
|
|
7
8
|
}
|
|
@@ -70,6 +70,9 @@ var SingletonInstanceMap = exports.SingletonInstanceMap = /*#__PURE__*/function
|
|
|
70
70
|
}
|
|
71
71
|
return getInstance;
|
|
72
72
|
}();
|
|
73
|
+
_proto.get = function get(key) {
|
|
74
|
+
return this.valueMap.get(key);
|
|
75
|
+
};
|
|
73
76
|
_proto.clear = function clear() {
|
|
74
77
|
this.lockMap.clear();
|
|
75
78
|
this.valueMap.clear();
|
|
@@ -133,7 +133,7 @@ export interface Package {
|
|
|
133
133
|
/**
|
|
134
134
|
* 复杂 urls 结构,同时兼容简单结构和多模态结构
|
|
135
135
|
*/
|
|
136
|
-
export
|
|
136
|
+
export type ComplexUrls = string[] | MultiModeUrls;
|
|
137
137
|
/**
|
|
138
138
|
* 多模态资源
|
|
139
139
|
*/
|
|
@@ -163,7 +163,7 @@ export declare enum LoadEnv {
|
|
|
163
163
|
/**
|
|
164
164
|
* 低代码设置器描述
|
|
165
165
|
*/
|
|
166
|
-
export
|
|
166
|
+
export type SetterDescription = PluginDescription;
|
|
167
167
|
/**
|
|
168
168
|
* 低代码插件器描述
|
|
169
169
|
*/
|
|
@@ -296,7 +296,7 @@ export interface RemoteComponentDescription {
|
|
|
296
296
|
npm?: string;
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
export
|
|
299
|
+
export type ComplexUrl = string | MultiModeUrl;
|
|
300
300
|
export interface MultiModeUrl {
|
|
301
301
|
default: string;
|
|
302
302
|
[index: string]: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PageLayoutType } from "./page-layout";
|
|
2
|
-
export
|
|
2
|
+
export type PageFormDataManagerModeType = "page" | "selectOne" | "selectMore";
|
|
3
3
|
export interface ShowFormDataManagerGroupProps {
|
|
4
4
|
container?: HTMLDivElement;
|
|
5
5
|
layout?: PageLayoutType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PageLayoutType } from "./page-layout";
|
|
2
2
|
import { FilterRule } from "../api/rest-api";
|
|
3
|
-
export
|
|
3
|
+
export type PageFormDataManagerModeType = "associationField" | "dataManager" | "selectOne" | "selectMore";
|
|
4
4
|
export interface ShowPageFormDataManagerProps {
|
|
5
5
|
container?: HTMLDivElement;
|
|
6
6
|
layout?: PageLayoutType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PageLayoutType } from "./page-layout";
|
|
2
|
-
export
|
|
2
|
+
export type PageFormModeType = "add" | "edit" | "detail";
|
|
3
3
|
export interface ShowFormProps {
|
|
4
4
|
container?: HTMLDivElement;
|
|
5
5
|
layout?: PageLayoutType;
|
|
@@ -8,6 +8,7 @@ export interface ShowFormProps {
|
|
|
8
8
|
fieldId?: string;
|
|
9
9
|
};
|
|
10
10
|
mode?: PageFormModeType;
|
|
11
|
+
lockMode?: boolean;
|
|
11
12
|
dataId?: string;
|
|
12
13
|
onSubmitOk?: () => void;
|
|
13
14
|
onRemoveOk?: () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from "react";
|
|
2
|
-
export
|
|
2
|
+
export type PageLayoutType = "page" | "modal" | "drawer";
|
|
3
3
|
interface PageLayoutProps {
|
|
4
4
|
layout?: PageLayoutType;
|
|
5
5
|
children: any;
|
|
@@ -16,6 +16,6 @@ export declare class PageLayout extends Component<PageLayoutProps, PageLayoutSta
|
|
|
16
16
|
componentWillUnmount(): void;
|
|
17
17
|
getWith: () => number;
|
|
18
18
|
handleResize: () => void;
|
|
19
|
-
render():
|
|
19
|
+
render(): JSX.Element;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -7,6 +7,7 @@ var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
|
|
|
7
7
|
var _modal = _interopRequireDefault(require("antd/lib/modal"));
|
|
8
8
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _loadMaterials = require("../../components/load-materials");
|
|
10
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
11
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; }
|
|
12
13
|
var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
@@ -43,10 +44,9 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
43
44
|
window.removeEventListener("resize", this.handleResize);
|
|
44
45
|
};
|
|
45
46
|
_proto.render = function render() {
|
|
46
|
-
var
|
|
47
|
-
layout = _this$props.layout,
|
|
48
|
-
children = _this$props.children;
|
|
47
|
+
var layout = this.props.layout;
|
|
49
48
|
var state = this.state;
|
|
49
|
+
var children = /*#__PURE__*/_react["default"].createElement(LoadMaterialChildren, null, this.props.children);
|
|
50
50
|
var restProps = {
|
|
51
51
|
open: state.open,
|
|
52
52
|
width: state.width,
|
|
@@ -77,4 +77,7 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
77
77
|
return children;
|
|
78
78
|
};
|
|
79
79
|
return PageLayout;
|
|
80
|
-
}(_react.Component);
|
|
80
|
+
}(_react.Component);
|
|
81
|
+
function LoadMaterialChildren(props) {
|
|
82
|
+
return /*#__PURE__*/_react["default"].createElement(_loadMaterials.LoadMaterials, null, props.children);
|
|
83
|
+
}
|
|
@@ -8,19 +8,24 @@ var _message2 = _interopRequireDefault(require("antd/lib/message"));
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _api = require("../api");
|
|
10
10
|
var _pageLoading = require("../../components/page-loading");
|
|
11
|
+
var _schemaApi = require("../api/schema-api");
|
|
11
12
|
function PageLoadSchema(props) {
|
|
12
13
|
var pageId = props.pageId,
|
|
13
14
|
children = props.children;
|
|
14
|
-
var
|
|
15
|
+
var cache = (0, _schemaApi.getSchemaFromCache)(pageId);
|
|
16
|
+
var _useState = (0, _react.useState)(!cache),
|
|
15
17
|
loading = _useState[0],
|
|
16
18
|
setLoading = _useState[1];
|
|
17
|
-
var _useState2 = (0, _react.useState)(),
|
|
19
|
+
var _useState2 = (0, _react.useState)(cache === null || cache === void 0 ? void 0 : cache.data),
|
|
18
20
|
schema = _useState2[0],
|
|
19
21
|
setSchema = _useState2[1];
|
|
20
22
|
var _useState3 = (0, _react.useState)(),
|
|
21
23
|
errorMsg = _useState3[0],
|
|
22
24
|
setErrorMsg = _useState3[1];
|
|
23
25
|
(0, _react.useEffect)(function () {
|
|
26
|
+
if (cache) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
24
29
|
if (pageId) {
|
|
25
30
|
(0, _api.getSchema)(pageId).then(function (res) {
|
|
26
31
|
if (res.success) {
|
|
@@ -37,6 +42,9 @@ function PageLoadSchema(props) {
|
|
|
37
42
|
_message2["default"].error("页面id不可为空!").then();
|
|
38
43
|
}
|
|
39
44
|
}, []);
|
|
45
|
+
if (cache) {
|
|
46
|
+
return children(cache.data);
|
|
47
|
+
}
|
|
40
48
|
if (loading) {
|
|
41
49
|
return /*#__PURE__*/React.createElement(_pageLoading.PageLoading, {
|
|
42
50
|
loading: true,
|
|
@@ -6,12 +6,12 @@ exports.renderElement = renderElement;
|
|
|
6
6
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
7
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
8
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
10
9
|
var _react = require("react");
|
|
10
|
+
var _client = require("react-dom/client");
|
|
11
11
|
function renderElement(options) {
|
|
12
12
|
return new Promise( /*#__PURE__*/function () {
|
|
13
13
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(resolve, reject) {
|
|
14
|
-
var container, _onClose, _options$element, component, props, unmount, element;
|
|
14
|
+
var container, _onClose, _options$element, component, props, unmount, root, element;
|
|
15
15
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
16
16
|
while (1) switch (_context.prev = _context.next) {
|
|
17
17
|
case 0:
|
|
@@ -22,28 +22,28 @@ function renderElement(options) {
|
|
|
22
22
|
container = document.createElement("div");
|
|
23
23
|
document.body.append(container);
|
|
24
24
|
}
|
|
25
|
+
root = (0, _client.createRoot)(container);
|
|
25
26
|
element = /*#__PURE__*/(0, _react.createElement)(component, (0, _extends2["default"])({}, props, {
|
|
26
27
|
onSelectOk: function onSelectOk(data) {
|
|
27
28
|
resolve(data || null);
|
|
28
29
|
},
|
|
29
30
|
onClose: function onClose() {
|
|
30
31
|
resolve(false);
|
|
32
|
+
//等待动画结束
|
|
31
33
|
setTimeout(function () {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (unmount) {
|
|
35
|
-
//等待动画结束
|
|
36
|
-
setTimeout(function () {
|
|
34
|
+
root.unmount();
|
|
35
|
+
if (unmount) {
|
|
37
36
|
var _container;
|
|
38
37
|
//移除
|
|
39
38
|
(_container = container) === null || _container === void 0 ? void 0 : _container.remove();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
39
|
+
}
|
|
40
|
+
}, 200);
|
|
42
41
|
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
43
42
|
}
|
|
44
43
|
}));
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
console.log("渲染", container, root, element);
|
|
45
|
+
root.render(element);
|
|
46
|
+
case 8:
|
|
47
47
|
case "end":
|
|
48
48
|
return _context.stop();
|
|
49
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhubangyun/lowcode-core",
|
|
3
|
-
"version": "5.10.
|
|
3
|
+
"version": "5.10.211",
|
|
4
4
|
"description": "低代码核心",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"bundle:types": "node bundle-dts.js",
|
|
13
13
|
"dev": "build-scripts start --config build.dev.json",
|
|
14
14
|
"build:npm": "build-scripts build",
|
|
15
|
+
"publish:npm": "build-scripts build && npm publish",
|
|
15
16
|
"build:umd": "build-scripts build --config build.umd.json",
|
|
16
|
-
"publish:npm": "npm run build:npm && npm publish",
|
|
17
17
|
"publish:oss": "npm run build:umd && node scripts/publishToCdn.ts"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@testing-library/react": "^11.2.7",
|
|
37
37
|
"@types/lodash": "^4.17.13",
|
|
38
38
|
"@types/node": "^13.7.1",
|
|
39
|
-
"@types/react": "^
|
|
40
|
-
"@types/react-dom": "^
|
|
39
|
+
"@types/react": "^18",
|
|
40
|
+
"@types/react-dom": "^18",
|
|
41
41
|
"@types/react-router": "5.1.18",
|
|
42
42
|
"@types/uuid": "^10.0.0",
|
|
43
43
|
"ali-oss": "^6.20.0",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"husky": "^7.0.4",
|
|
53
53
|
"lerna": "^4.0.0",
|
|
54
54
|
"prop-types": "^15.8.1",
|
|
55
|
-
"react": "^
|
|
56
|
-
"react-dom": "^
|
|
55
|
+
"react": "^18",
|
|
56
|
+
"react-dom": "^18",
|
|
57
57
|
"rimraf": "^3.0.2",
|
|
58
|
-
"typescript": "
|
|
58
|
+
"typescript": "5.9",
|
|
59
59
|
"yarn": "^1.22.17"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function loadMaterials(): Promise<Record<string, React.FC>>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import { loadPlugins } from "./LoadPlugins";
|
|
4
|
-
export function loadMaterials() {
|
|
5
|
-
return _loadMaterials.apply(this, arguments);
|
|
6
|
-
}
|
|
7
|
-
function _loadMaterials() {
|
|
8
|
-
_loadMaterials = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
9
|
-
var urls, components;
|
|
10
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
-
while (1) switch (_context.prev = _context.next) {
|
|
12
|
-
case 0:
|
|
13
|
-
urls = ["https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/view.css", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd/view.css", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.css"];
|
|
14
|
-
_context.next = 3;
|
|
15
|
-
return loadPlugins(urls);
|
|
16
|
-
case 3:
|
|
17
|
-
components = {};
|
|
18
|
-
["RootMaterial", "AntdMaterial", "AntdProMaterial"].forEach(function (lib) {
|
|
19
|
-
var data = window[lib];
|
|
20
|
-
if (data) {
|
|
21
|
-
Object.entries(data).forEach(function (_ref) {
|
|
22
|
-
var key = _ref[0],
|
|
23
|
-
value = _ref[1];
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
components[key] = value;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return _context.abrupt("return", components);
|
|
30
|
-
case 6:
|
|
31
|
-
case "end":
|
|
32
|
-
return _context.stop();
|
|
33
|
-
}
|
|
34
|
-
}, _callee);
|
|
35
|
-
}));
|
|
36
|
-
return _loadMaterials.apply(this, arguments);
|
|
37
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { FormInstance } from "antd/lib";
|
|
2
|
-
export declare type ProcessScriptOptions = {
|
|
3
|
-
depth: number;
|
|
4
|
-
form: FormInstance;
|
|
5
|
-
changeValues: any;
|
|
6
|
-
};
|
|
7
|
-
export declare type ProcessScriptType = {
|
|
8
|
-
timing: "change" | "submit";
|
|
9
|
-
script: string;
|
|
10
|
-
nodeTitle: string;
|
|
11
|
-
};
|
|
12
|
-
export declare function exeProcessScript(options: ProcessScriptOptions, scriptType: ProcessScriptType): Promise<void>;
|
|
13
|
-
export declare type ProcessNodeProps = {
|
|
14
|
-
type: any;
|
|
15
|
-
branchType: "condition" | "parallel";
|
|
16
|
-
nodeTitle: string;
|
|
17
|
-
message: string;
|
|
18
|
-
notFoundDataAction: "ctn" | "ins";
|
|
19
|
-
actionType?: "direct" | "business";
|
|
20
|
-
breakType: "continue" | "break" | "return" | "exception";
|
|
21
|
-
nodeId?: string;
|
|
22
|
-
formId: string;
|
|
23
|
-
events?: ("ins" | "upd" | "del")[];
|
|
24
|
-
timing?: "bef" | "aft";
|
|
25
|
-
conditions: any[];
|
|
26
|
-
assignments: any[];
|
|
27
|
-
filters: any[];
|
|
28
|
-
sorts: any[];
|
|
29
|
-
pageSize: number;
|
|
30
|
-
};
|