@zhubangyun/lowcode-core 5.10.83 → 5.10.91
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/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.js +19 -32
- 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 +10 -8
- 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 +8 -0
- package/es/utils/page/page-render.js +10 -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/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.js +19 -32
- 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 +11 -8
- 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 +8 -0
- package/lib/utils/page/page-render.js +10 -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
|
@@ -10,6 +10,9 @@ export function LoadMaterials(props) {
|
|
|
10
10
|
useEffect(function () {
|
|
11
11
|
initialize().then();
|
|
12
12
|
}, []);
|
|
13
|
+
if (window._components) {
|
|
14
|
+
return props.children;
|
|
15
|
+
}
|
|
13
16
|
function initialize() {
|
|
14
17
|
return _initialize.apply(this, arguments);
|
|
15
18
|
}
|
|
@@ -72,10 +75,6 @@ function _loadMaterials() {
|
|
|
72
75
|
}
|
|
73
76
|
});
|
|
74
77
|
window._components = components;
|
|
75
|
-
/* Object.defineProperty(window, "_components", {
|
|
76
|
-
writable: false,
|
|
77
|
-
value: components
|
|
78
|
-
})*/
|
|
79
78
|
case 8:
|
|
80
79
|
case "end":
|
|
81
80
|
return _context2.stop();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _notification from "antd/es/notification";
|
|
2
|
+
import _message from "antd/es/message";
|
|
3
|
+
import _Modal from "antd/es/modal";
|
|
4
|
+
import _Typography from "antd/es/typography";
|
|
5
|
+
export function LogErrorContent(props) {
|
|
6
|
+
var content = /*#__PURE__*/React.createElement(_Typography.Text, {
|
|
7
|
+
type: "danger",
|
|
8
|
+
style: {
|
|
9
|
+
whiteSpace: "pre-wrap"
|
|
10
|
+
}
|
|
11
|
+
}, props.message || "");
|
|
12
|
+
if (props.requestId) {
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", null, content, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
|
|
14
|
+
onClick: function onClick() {
|
|
15
|
+
var _window$utils;
|
|
16
|
+
_Modal.destroyAll();
|
|
17
|
+
_message.destroy();
|
|
18
|
+
_notification.destroy();
|
|
19
|
+
(_window$utils = window.utils) === null || _window$utils === void 0 ? void 0 : _window$utils.showForm({
|
|
20
|
+
layout: "modal",
|
|
21
|
+
form: {
|
|
22
|
+
id: "form_e3dbb9076a544f86a3bb6ec113e22494"
|
|
23
|
+
},
|
|
24
|
+
mode: "detail",
|
|
25
|
+
dataId: props.requestId
|
|
26
|
+
}).then();
|
|
27
|
+
}
|
|
28
|
+
}, "\u67E5\u770B\u65E5\u5FD7")));
|
|
29
|
+
} else {
|
|
30
|
+
return content;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type PageSize = "small" | "middle" | "larger" | "full";
|
|
2
2
|
export declare const PageSizeEnum: Record<PageSize, string | number>;
|
|
3
3
|
export declare function getPageSize(size?: PageSize): string | number;
|
package/es/index.js
CHANGED
package/es/style.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import 'antd/es/typography/style';
|
|
2
1
|
import 'antd/es/notification/style';
|
|
3
2
|
import 'antd/es/modal/style';
|
|
4
3
|
import 'antd/es/message/style';
|
|
4
|
+
import 'antd/es/typography/style';
|
|
5
5
|
import 'antd/es/drawer/style';
|
|
6
6
|
import 'antd/es/result/style';
|
|
7
7
|
import 'antd/es/config-provider/style';
|
package/es/utils/api/form-api.js
CHANGED
|
@@ -147,7 +147,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
147
147
|
_proto.search = /*#__PURE__*/function () {
|
|
148
148
|
var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(searchParams) {
|
|
149
149
|
var _searchParams, _searchParams2;
|
|
150
|
-
var params, config, res;
|
|
150
|
+
var params, config, res, start;
|
|
151
151
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
152
152
|
while (1) switch (_context3.prev = _context3.next) {
|
|
153
153
|
case 0:
|
|
@@ -176,10 +176,12 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
176
176
|
return this.request.get("search", config);
|
|
177
177
|
case 11:
|
|
178
178
|
res = _context3.sent;
|
|
179
|
+
//const res = await this.request.post<any, ManyResult<DataType>>("search", searchParams, config);
|
|
180
|
+
start = Date.now();
|
|
179
181
|
assembleAssociationField(res.data, res.refs);
|
|
180
182
|
console.debug("form.search:", res);
|
|
181
183
|
return _context3.abrupt("return", res);
|
|
182
|
-
case
|
|
184
|
+
case 16:
|
|
183
185
|
case "end":
|
|
184
186
|
return _context3.stop();
|
|
185
187
|
}
|
|
@@ -192,7 +194,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
192
194
|
}();
|
|
193
195
|
_proto.getById = /*#__PURE__*/function () {
|
|
194
196
|
var _getById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id, options) {
|
|
195
|
-
var res;
|
|
197
|
+
var res, start;
|
|
196
198
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
197
199
|
while (1) switch (_context4.prev = _context4.next) {
|
|
198
200
|
case 0:
|
|
@@ -200,10 +202,11 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
200
202
|
return _RestApi.prototype.getById.call(this, id, options);
|
|
201
203
|
case 2:
|
|
202
204
|
res = _context4.sent;
|
|
205
|
+
start = Date.now();
|
|
203
206
|
assembleAssociationField(res.data, res.refs);
|
|
204
|
-
console.debug("
|
|
207
|
+
console.debug("formApi.getById", res);
|
|
205
208
|
return _context4.abrupt("return", res);
|
|
206
|
-
case
|
|
209
|
+
case 7:
|
|
207
210
|
case "end":
|
|
208
211
|
return _context4.stop();
|
|
209
212
|
}
|
|
@@ -17,9 +17,6 @@ export function convertSaveData(data) {
|
|
|
17
17
|
}
|
|
18
18
|
function getDataKey(data) {
|
|
19
19
|
var _data$form, _data$form2;
|
|
20
|
-
if (!data) {
|
|
21
|
-
return "undefined";
|
|
22
|
-
}
|
|
23
20
|
var key = (_data$form = data.form) === null || _data$form === void 0 ? void 0 : _data$form.id;
|
|
24
21
|
if ((_data$form2 = data.form) !== null && _data$form2 !== void 0 && _data$form2.fieldId) {
|
|
25
22
|
key += "." + data.form.fieldId;
|
|
@@ -68,18 +65,16 @@ export function assembleAssociationFieldV2(data, refs) {
|
|
|
68
65
|
var ref = _step2.value;
|
|
69
66
|
for (var _iterator4 = _createForOfIteratorHelperLoose(ref.data), _step4; !(_step4 = _iterator4()).done;) {
|
|
70
67
|
var datum = _step4.value;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
dataMap.set(key, datum);
|
|
74
|
-
}
|
|
68
|
+
var key = getDataKey(datum);
|
|
69
|
+
dataMap.set(key, datum);
|
|
75
70
|
}
|
|
76
71
|
}
|
|
77
72
|
|
|
78
73
|
//组装refs的关联属性
|
|
79
74
|
for (var _iterator3 = _createForOfIteratorHelperLoose(dataMap.values()), _step3; !(_step3 = _iterator3()).done;) {
|
|
80
75
|
var item = _step3.value;
|
|
81
|
-
for (var _i2 = 0, _Object$
|
|
82
|
-
var _key = _Object$
|
|
76
|
+
for (var _i2 = 0, _Object$keys = Object.keys(item); _i2 < _Object$keys.length; _i2++) {
|
|
77
|
+
var _key = _Object$keys[_i2];
|
|
83
78
|
// @ts-ignore
|
|
84
79
|
var value = item[_key];
|
|
85
80
|
assembleAssociationFieldDataV2(value, dataMap);
|
|
@@ -93,14 +88,10 @@ export function assembleAssociationFieldV2(data, refs) {
|
|
|
93
88
|
});
|
|
94
89
|
} else if (value !== null && value !== void 0 && value.id) {
|
|
95
90
|
assembleAssociationFieldDataV2(value, dataMap);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var subValues = value[key];
|
|
91
|
+
//处理子表
|
|
92
|
+
for (var _i = 0, _Object$values = Object.values(value); _i < _Object$values.length; _i++) {
|
|
93
|
+
var subValues = _Object$values[_i];
|
|
100
94
|
if (typeof subValues == "object") {
|
|
101
|
-
if (key == "parent") {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
95
|
loopAssembleAssociation(subValues);
|
|
105
96
|
}
|
|
106
97
|
}
|
|
@@ -113,25 +104,21 @@ export function assembleAssociationFieldDataV2(data, dataMap) {
|
|
|
113
104
|
if (data == null) {
|
|
114
105
|
return;
|
|
115
106
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
if (Array.isArray(data)) {
|
|
108
|
+
data.forEach(function (item) {
|
|
109
|
+
return assembleAssociationFieldDataV2(item, dataMap);
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
var _data$form3;
|
|
113
|
+
if (data !== null && data !== void 0 && (_data$form3 = data.form) !== null && _data$form3 !== void 0 && _data$form3.id && data !== null && data !== void 0 && data.id) {
|
|
114
|
+
delete data._load;
|
|
115
|
+
var key = getDataKey(data);
|
|
116
|
+
var value = dataMap.get(key);
|
|
117
|
+
if (value) {
|
|
118
|
+
Object.assign(data, value);
|
|
124
119
|
delete data._load;
|
|
125
|
-
var key = getDataKey(data);
|
|
126
|
-
var value = dataMap.get(key);
|
|
127
|
-
if (value) {
|
|
128
|
-
Object.assign(data, value);
|
|
129
|
-
delete data._load;
|
|
130
|
-
}
|
|
131
120
|
}
|
|
132
121
|
}
|
|
133
|
-
} catch (e) {
|
|
134
|
-
console.log("装配对象失败", data, dataMap);
|
|
135
122
|
}
|
|
136
123
|
}
|
|
137
124
|
export function assembleAssociationField(data, refs) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
2
|
-
export
|
|
2
|
+
export type ValueType = "value" | "field" | "express";
|
|
3
3
|
export interface RestApiOptions {
|
|
4
4
|
/**
|
|
5
5
|
* 超时时间
|
|
@@ -13,13 +13,13 @@ export interface RestApiOptions {
|
|
|
13
13
|
}
|
|
14
14
|
export interface FilterRule {
|
|
15
15
|
connector?: "and" | "or";
|
|
16
|
-
key
|
|
16
|
+
key: string;
|
|
17
17
|
operator?: OperatorType;
|
|
18
18
|
valueType?: ValueType;
|
|
19
19
|
value?: any;
|
|
20
20
|
rules?: FilterRule[];
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type OperatorType = "eq" | "ne" | "gt" | "goe" | "lt" | "loe" | "like" | "notLike" | "in" | "notIn" | "isNull" | "isNotNull" | "between" | "notBetween";
|
|
23
23
|
export interface RestSearchParams {
|
|
24
24
|
page?: number;
|
|
25
25
|
pageSize?: number;
|
|
@@ -54,7 +54,7 @@ export declare abstract class BaseRestApi<DataType> {
|
|
|
54
54
|
*/
|
|
55
55
|
deleteById(id: string, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
56
56
|
delete(data: any | any[], options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
57
|
-
|
|
57
|
+
showError(type: string, res: BaseResult<any>): Promise<void>;
|
|
58
58
|
}
|
|
59
59
|
export declare class RestApi<DataType> extends BaseRestApi<DataType> {
|
|
60
60
|
constructor(uri: string, options?: RestApiOptions);
|
|
@@ -98,8 +98,8 @@ export interface BaseType {
|
|
|
98
98
|
*/
|
|
99
99
|
export interface BaseResult<DataType> {
|
|
100
100
|
success: boolean;
|
|
101
|
-
requestId?: string;
|
|
102
101
|
message?: string;
|
|
102
|
+
requestId: string;
|
|
103
103
|
refs?: Refs;
|
|
104
104
|
}
|
|
105
105
|
export interface Ref {
|
|
@@ -110,7 +110,7 @@ export interface Ref {
|
|
|
110
110
|
fieldIds: string[];
|
|
111
111
|
data: BaseType[];
|
|
112
112
|
}
|
|
113
|
-
export
|
|
113
|
+
export type Refs = Ref[];
|
|
114
114
|
export interface OneResult<DataType> extends BaseResult<DataType> {
|
|
115
115
|
data: DataType & BaseType;
|
|
116
116
|
}
|
package/es/utils/api/rest-api.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
|
-
import _Typography from "antd/es/typography";
|
|
3
2
|
import _notification from "antd/es/notification";
|
|
4
3
|
import _Modal from "antd/es/modal";
|
|
5
4
|
import _message from "antd/es/message";
|
|
@@ -8,7 +7,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
7
|
import axios from "axios";
|
|
9
8
|
import { onFulfilled, onRejected } from "./index";
|
|
10
9
|
import { transformerId } from "../data";
|
|
11
|
-
import {
|
|
10
|
+
import { LogErrorContent } from "../../components/log-error-content";
|
|
12
11
|
export var BaseRestApi = /*#__PURE__*/function () {
|
|
13
12
|
function BaseRestApi(uri, options) {
|
|
14
13
|
this.uri = void 0;
|
|
@@ -345,72 +344,64 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
345
344
|
return _delete2.apply(this, arguments);
|
|
346
345
|
}
|
|
347
346
|
return _delete;
|
|
348
|
-
}()
|
|
349
|
-
|
|
350
|
-
_proto.showError =
|
|
351
|
-
/*#__PURE__*/
|
|
352
|
-
function () {
|
|
347
|
+
}();
|
|
348
|
+
_proto.showError = /*#__PURE__*/function () {
|
|
353
349
|
var _showError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(type, res) {
|
|
354
|
-
var msg, props
|
|
350
|
+
var msg, props;
|
|
355
351
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
356
352
|
while (1) switch (_context8.prev = _context8.next) {
|
|
357
353
|
case 0:
|
|
358
354
|
msg = res.message;
|
|
359
355
|
_context8.prev = 1;
|
|
360
356
|
if (!msg) {
|
|
361
|
-
_context8.next =
|
|
357
|
+
_context8.next = 19;
|
|
362
358
|
break;
|
|
363
359
|
}
|
|
364
360
|
props = JSON.parse(msg);
|
|
365
|
-
content =
|
|
366
|
-
requestId: res.requestId,
|
|
367
|
-
message: props.message
|
|
368
|
-
});
|
|
369
|
-
props.content = content;
|
|
370
|
-
props.message = content;
|
|
361
|
+
props.content = props.message;
|
|
371
362
|
if (!props.title) {
|
|
372
363
|
props.title = "" + this.title + type;
|
|
373
364
|
}
|
|
374
365
|
if (!(props.type == "message")) {
|
|
375
|
-
_context8.next =
|
|
366
|
+
_context8.next = 11;
|
|
376
367
|
break;
|
|
377
368
|
}
|
|
378
369
|
_message.error(props);
|
|
379
370
|
return _context8.abrupt("return");
|
|
380
|
-
case
|
|
371
|
+
case 11:
|
|
381
372
|
if (!(props.type == "modal")) {
|
|
382
|
-
_context8.next =
|
|
373
|
+
_context8.next = 16;
|
|
383
374
|
break;
|
|
384
375
|
}
|
|
385
376
|
_Modal.error(props);
|
|
386
377
|
return _context8.abrupt("return");
|
|
387
|
-
case
|
|
378
|
+
case 16:
|
|
388
379
|
if (!(props.type == "notification")) {
|
|
389
|
-
_context8.next =
|
|
380
|
+
_context8.next = 19;
|
|
390
381
|
break;
|
|
391
382
|
}
|
|
392
383
|
_notification.error(props);
|
|
393
384
|
return _context8.abrupt("return");
|
|
394
|
-
case
|
|
395
|
-
_context8.next =
|
|
385
|
+
case 19:
|
|
386
|
+
_context8.next = 25;
|
|
396
387
|
break;
|
|
397
|
-
case
|
|
398
|
-
_context8.prev =
|
|
388
|
+
case 21:
|
|
389
|
+
_context8.prev = 21;
|
|
399
390
|
_context8.t0 = _context8["catch"](1);
|
|
400
391
|
console.error("" + this.title + type + (msg || ""));
|
|
401
392
|
_Modal.error({
|
|
402
393
|
title: "" + this.title + type,
|
|
403
394
|
centered: true,
|
|
404
|
-
content: /*#__PURE__*/React.createElement(
|
|
395
|
+
content: /*#__PURE__*/React.createElement(LogErrorContent, {
|
|
405
396
|
requestId: res.requestId,
|
|
406
397
|
message: res.message
|
|
407
398
|
})
|
|
408
399
|
});
|
|
409
|
-
case
|
|
400
|
+
case 25:
|
|
410
401
|
case "end":
|
|
411
402
|
return _context8.stop();
|
|
412
403
|
}
|
|
413
|
-
}, _callee8, this, [[1,
|
|
404
|
+
}, _callee8, this, [[1, 21]]);
|
|
414
405
|
}));
|
|
415
406
|
function showError(_x15, _x16) {
|
|
416
407
|
return _showError.apply(this, arguments);
|
|
@@ -419,32 +410,13 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
419
410
|
}();
|
|
420
411
|
return BaseRestApi;
|
|
421
412
|
}();
|
|
422
|
-
function
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}
|
|
428
|
-
}, props.message || "");
|
|
429
|
-
if (props.requestId) {
|
|
430
|
-
return /*#__PURE__*/React.createElement("div", null, content, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
|
|
431
|
-
onClick: function onClick() {
|
|
432
|
-
_Modal.destroyAll();
|
|
433
|
-
_message.destroy();
|
|
434
|
-
_notification.destroy();
|
|
435
|
-
showForm({
|
|
436
|
-
layout: "modal",
|
|
437
|
-
form: {
|
|
438
|
-
id: "form_e3dbb9076a544f86a3bb6ec113e22494"
|
|
439
|
-
},
|
|
440
|
-
mode: "detail",
|
|
441
|
-
dataId: props.requestId
|
|
442
|
-
}).then();
|
|
443
|
-
}
|
|
444
|
-
}, "\u67E5\u770B\u65E5\u5FD7")));
|
|
445
|
-
} else {
|
|
446
|
-
return content;
|
|
413
|
+
function getStringId(item) {
|
|
414
|
+
if (typeof (item === null || item === void 0 ? void 0 : item.id) === "string") {
|
|
415
|
+
return item.id;
|
|
416
|
+
} else if (typeof item === "string") {
|
|
417
|
+
return item;
|
|
447
418
|
}
|
|
419
|
+
return null;
|
|
448
420
|
}
|
|
449
421
|
export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
|
|
450
422
|
function RestApi(uri, options) {
|
|
@@ -10,24 +10,26 @@ function _getSchema() {
|
|
|
10
10
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
11
|
while (1) switch (_context.prev = _context.next) {
|
|
12
12
|
case 0:
|
|
13
|
-
if (typeof mock != "boolean") {
|
|
14
|
-
if (typeof window.__mock == "boolean") {
|
|
15
|
-
mock = window.__mock;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
13
|
key = mock ? pageId + "_mock" : pageId;
|
|
19
|
-
_context.next =
|
|
14
|
+
_context.next = 3;
|
|
20
15
|
return schema.getInstance(key, {
|
|
21
16
|
mock: mock,
|
|
22
17
|
pageId: pageId
|
|
23
18
|
});
|
|
24
|
-
case
|
|
19
|
+
case 3:
|
|
25
20
|
return _context.abrupt("return", _context.sent);
|
|
26
|
-
case
|
|
21
|
+
case 4:
|
|
27
22
|
case "end":
|
|
28
23
|
return _context.stop();
|
|
29
24
|
}
|
|
30
25
|
}, _callee);
|
|
31
26
|
}));
|
|
32
27
|
return _getSchema.apply(this, arguments);
|
|
28
|
+
}
|
|
29
|
+
export function getSchemaFromCache(pageId, mock) {
|
|
30
|
+
if (!pageId) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
var key = mock ? pageId + "_mock" : pageId;
|
|
34
|
+
return schema.get(key);
|
|
33
35
|
}
|
|
@@ -62,10 +62,15 @@ function _loadStyle() {
|
|
|
62
62
|
case 2:
|
|
63
63
|
return _context3.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
64
64
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
|
|
65
|
-
var target;
|
|
65
|
+
var callback, target;
|
|
66
66
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
67
67
|
while (1) switch (_context2.prev = _context2.next) {
|
|
68
68
|
case 0:
|
|
69
|
+
callback = function _callback(status) {
|
|
70
|
+
setTimeout(function () {
|
|
71
|
+
resolve(status);
|
|
72
|
+
}, 10);
|
|
73
|
+
};
|
|
69
74
|
//加载式样
|
|
70
75
|
target = doc.querySelector("link[href='" + src + "']");
|
|
71
76
|
if (!target) {
|
|
@@ -73,16 +78,16 @@ function _loadStyle() {
|
|
|
73
78
|
target.href = src;
|
|
74
79
|
target.rel = "stylesheet";
|
|
75
80
|
target.onload = function () {
|
|
76
|
-
|
|
81
|
+
return callback(true);
|
|
77
82
|
};
|
|
78
83
|
target.onerror = function () {
|
|
79
|
-
|
|
84
|
+
return callback(false);
|
|
80
85
|
};
|
|
81
86
|
doc.head.appendChild(target);
|
|
82
87
|
} else {
|
|
83
|
-
|
|
88
|
+
callback(true);
|
|
84
89
|
}
|
|
85
|
-
case
|
|
90
|
+
case 3:
|
|
86
91
|
case "end":
|
|
87
92
|
return _context2.stop();
|
|
88
93
|
}
|
|
@@ -120,8 +125,10 @@ function _loadScript() {
|
|
|
120
125
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
121
126
|
while (1) switch (_context4.prev = _context4.next) {
|
|
122
127
|
case 0:
|
|
123
|
-
callback = function
|
|
124
|
-
|
|
128
|
+
callback = function _callback2(status) {
|
|
129
|
+
setTimeout(function () {
|
|
130
|
+
resolve(status);
|
|
131
|
+
}, 10);
|
|
125
132
|
};
|
|
126
133
|
//加载脚本
|
|
127
134
|
target = doc.querySelector("script[src='" + src + "']");
|
|
@@ -132,10 +139,10 @@ function _loadScript() {
|
|
|
132
139
|
}
|
|
133
140
|
target.src = src;
|
|
134
141
|
target.onload = function () {
|
|
135
|
-
callback(true);
|
|
142
|
+
return callback(true);
|
|
136
143
|
};
|
|
137
144
|
target.onerror = function () {
|
|
138
|
-
callback(false);
|
|
145
|
+
return callback(false);
|
|
139
146
|
};
|
|
140
147
|
doc.body.appendChild(target);
|
|
141
148
|
} 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
|
}
|
|
@@ -65,6 +65,9 @@ export var SingletonInstanceMap = /*#__PURE__*/function () {
|
|
|
65
65
|
}
|
|
66
66
|
return getInstance;
|
|
67
67
|
}();
|
|
68
|
+
_proto.get = function get(key) {
|
|
69
|
+
return this.valueMap.get(key);
|
|
70
|
+
};
|
|
68
71
|
_proto.clear = function clear() {
|
|
69
72
|
this.lockMap.clear();
|
|
70
73
|
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 {};
|
|
@@ -2,6 +2,7 @@ import _Drawer from "antd/es/drawer";
|
|
|
2
2
|
import _Modal from "antd/es/modal";
|
|
3
3
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
4
4
|
import React, { Component } from "react";
|
|
5
|
+
import { LoadMaterials } from "../../components/load-materials";
|
|
5
6
|
export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
6
7
|
function PageLayout(props) {
|
|
7
8
|
var _this;
|
|
@@ -36,10 +37,9 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
36
37
|
window.removeEventListener("resize", this.handleResize);
|
|
37
38
|
};
|
|
38
39
|
_proto.render = function render() {
|
|
39
|
-
var
|
|
40
|
-
layout = _this$props.layout,
|
|
41
|
-
children = _this$props.children;
|
|
40
|
+
var layout = this.props.layout;
|
|
42
41
|
var state = this.state;
|
|
42
|
+
var children = /*#__PURE__*/React.createElement(LoadMaterialChildren, null, this.props.children);
|
|
43
43
|
var restProps = {
|
|
44
44
|
open: state.open,
|
|
45
45
|
width: state.width,
|
|
@@ -70,4 +70,7 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
70
70
|
return children;
|
|
71
71
|
};
|
|
72
72
|
return PageLayout;
|
|
73
|
-
}(Component);
|
|
73
|
+
}(Component);
|
|
74
|
+
function LoadMaterialChildren(props) {
|
|
75
|
+
return /*#__PURE__*/React.createElement(LoadMaterials, null, props.children);
|
|
76
|
+
}
|