@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
|
@@ -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.page.showForm({
|
|
20
|
+
layout: "modal",
|
|
21
|
+
form: {
|
|
22
|
+
id: "40120d0c-2b35-4ae7-8711-acae048f1a0"
|
|
23
|
+
},
|
|
24
|
+
mode: "detail",
|
|
25
|
+
dataId: props.requestId
|
|
26
|
+
}).then();
|
|
27
|
+
}
|
|
28
|
+
}, "\u67E5\u770B\u65E5\u5FD7")));
|
|
29
|
+
} else {
|
|
30
|
+
return content;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -3,5 +3,5 @@ import { IRendererProps } from "@zhubangyun/lowcode-render-core/lib/types";
|
|
|
3
3
|
export declare class ReactRender extends PureComponent<IRendererProps & {}> {
|
|
4
4
|
key: string;
|
|
5
5
|
node: any;
|
|
6
|
-
render(): import("react").JSX.Element;
|
|
6
|
+
render(utils?: any): import("react").JSX.Element;
|
|
7
7
|
}
|
|
@@ -3,7 +3,6 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
|
3
3
|
import { PureComponent } from 'react';
|
|
4
4
|
import { createFetchHandler } from "@alilc/lowcode-datasource-fetch-handler";
|
|
5
5
|
import ReactRenderFactory from "./react-render-factory";
|
|
6
|
-
import utils from "../../utils";
|
|
7
6
|
export var ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
8
7
|
function ReactRender() {
|
|
9
8
|
var _this;
|
|
@@ -17,8 +16,11 @@ export var ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
17
16
|
}
|
|
18
17
|
_inheritsLoose(ReactRender, _PureComponent);
|
|
19
18
|
var _proto = ReactRender.prototype;
|
|
20
|
-
_proto.render = function render() {
|
|
19
|
+
_proto.render = function render(utils) {
|
|
21
20
|
var _this2 = this;
|
|
21
|
+
if (utils === void 0) {
|
|
22
|
+
utils = window.utils;
|
|
23
|
+
}
|
|
22
24
|
var components = this.props.components || window._components;
|
|
23
25
|
return /*#__PURE__*/React.createElement(ReactRenderFactory, _extends({
|
|
24
26
|
key: this.key
|
|
@@ -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
|
}
|
|
@@ -3,6 +3,11 @@ export declare function convertSaveData(data: any): any;
|
|
|
3
3
|
export declare function handleEntityLabel(data: BaseType | BaseType[]): void;
|
|
4
4
|
export declare function dataToLabel(value: any): any;
|
|
5
5
|
export declare function assembleAssociationFieldV2(data: BaseType | BaseType[], refs?: Refs): void;
|
|
6
|
+
/**
|
|
7
|
+
* 加载字段
|
|
8
|
+
* @param data
|
|
9
|
+
* @param dataMap
|
|
10
|
+
*/
|
|
6
11
|
export declare function assembleAssociationFieldDataV2(data: BaseType | BaseType[], dataMap: Map<string, BaseType>): void;
|
|
7
12
|
export declare function assembleAssociationField(data: BaseType | BaseType[], refs?: Refs): void;
|
|
8
13
|
export declare function handleFilterRules(filters: FilterRule[], options: {
|
|
@@ -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;
|
|
@@ -36,7 +33,7 @@ export function handleEntityLabel(data) {
|
|
|
36
33
|
var labelField = (_item$form = item.form) === null || _item$form === void 0 ? void 0 : _item$form.labelField;
|
|
37
34
|
if (labelField) {
|
|
38
35
|
// @ts-ignore
|
|
39
|
-
var value = item
|
|
36
|
+
var value = safeGet(item, labelField);
|
|
40
37
|
item.label = dataToLabel(value);
|
|
41
38
|
}
|
|
42
39
|
}
|
|
@@ -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);
|
|
@@ -92,33 +87,35 @@ export function assembleAssociationFieldV2(data, refs) {
|
|
|
92
87
|
return loopAssembleAssociation(item);
|
|
93
88
|
});
|
|
94
89
|
} else if (value !== null && value !== void 0 && value.id) {
|
|
90
|
+
handleEntityLabel(value);
|
|
95
91
|
assembleAssociationFieldDataV2(value, dataMap);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var subValues = value[key];
|
|
92
|
+
//处理子表
|
|
93
|
+
for (var _i = 0, _Object$values = Object.values(value); _i < _Object$values.length; _i++) {
|
|
94
|
+
var subValues = _Object$values[_i];
|
|
100
95
|
if (typeof subValues == "object") {
|
|
101
|
-
if (key == "parent") {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
96
|
loopAssembleAssociation(subValues);
|
|
105
97
|
}
|
|
106
98
|
}
|
|
107
99
|
}
|
|
108
100
|
}
|
|
109
101
|
loopAssembleAssociation(data);
|
|
110
|
-
handleEntityLabel(data);
|
|
111
102
|
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 加载字段
|
|
106
|
+
* @param data
|
|
107
|
+
* @param dataMap
|
|
108
|
+
*/
|
|
112
109
|
export function assembleAssociationFieldDataV2(data, dataMap) {
|
|
113
110
|
if (data == null) {
|
|
114
111
|
return;
|
|
115
112
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
if (Array.isArray(data)) {
|
|
114
|
+
data.forEach(function (item) {
|
|
115
|
+
return assembleAssociationFieldDataV2(item, dataMap);
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
if (data._load == false) {
|
|
122
119
|
var _data$form3;
|
|
123
120
|
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) {
|
|
124
121
|
delete data._load;
|
|
@@ -130,8 +127,6 @@ export function assembleAssociationFieldDataV2(data, dataMap) {
|
|
|
130
127
|
}
|
|
131
128
|
}
|
|
132
129
|
}
|
|
133
|
-
} catch (e) {
|
|
134
|
-
console.log("装配对象失败", data, dataMap);
|
|
135
130
|
}
|
|
136
131
|
}
|
|
137
132
|
export function assembleAssociationField(data, refs) {
|
|
@@ -165,4 +160,26 @@ export function handleFilterRules(filters, options) {
|
|
|
165
160
|
} else {
|
|
166
161
|
return undefined;
|
|
167
162
|
}
|
|
163
|
+
}
|
|
164
|
+
function safeGet(value, key) {
|
|
165
|
+
if (typeof value !== "object") {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
if (typeof key !== "string") {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
if (!value || !key) return undefined;
|
|
172
|
+
var paths = key.split(".");
|
|
173
|
+
function safeGetValue(v) {
|
|
174
|
+
if (typeof v !== "object") {
|
|
175
|
+
return v;
|
|
176
|
+
}
|
|
177
|
+
if (paths.length) {
|
|
178
|
+
var k = paths.shift();
|
|
179
|
+
return safeGetValue(v === null || v === void 0 ? void 0 : v[k]);
|
|
180
|
+
} else {
|
|
181
|
+
return v;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return safeGetValue(value);
|
|
168
185
|
}
|
|
@@ -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,12 +10,8 @@ function _getSchema() {
|
|
|
10
10
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
11
|
while (1) switch (_context.prev = _context.next) {
|
|
12
12
|
case 0:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
mock = window.__mock;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
key = mock ? pageId + "_mock" : pageId;
|
|
13
|
+
mock = getMock(mock);
|
|
14
|
+
key = mock ? pageId + ":mock" : pageId;
|
|
19
15
|
_context.next = 4;
|
|
20
16
|
return schema.getInstance(key, {
|
|
21
17
|
mock: mock,
|
|
@@ -30,4 +26,18 @@ function _getSchema() {
|
|
|
30
26
|
}, _callee);
|
|
31
27
|
}));
|
|
32
28
|
return _getSchema.apply(this, arguments);
|
|
29
|
+
}
|
|
30
|
+
export function getSchemaFromCache(pageId, mock) {
|
|
31
|
+
if (!pageId) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
mock = getMock(mock);
|
|
35
|
+
var key = mock ? pageId + "_mock" : pageId;
|
|
36
|
+
return schema.get(key);
|
|
37
|
+
}
|
|
38
|
+
function getMock(mock) {
|
|
39
|
+
if (typeof mock !== "boolean") {
|
|
40
|
+
mock = !!window.__mock;
|
|
41
|
+
}
|
|
42
|
+
return mock;
|
|
33
43
|
}
|
|
@@ -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;
|