@zhubangyun/lowcode-core 5.10.211 → 5.10.220
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/react-render/index.d.ts +1 -1
- package/es/components/react-render/index.js +2 -5
- package/es/utils/api/form-api.d.ts +1 -1
- package/es/utils/api/form-api.js +22 -40
- package/es/utils/cache/index.d.ts +7 -6
- package/es/utils/cache/index.js +13 -29
- package/es/utils/page/page-load-schema.js +1 -1
- package/es/utils/page/page-render.js +1 -2
- package/lib/components/react-render/index.d.ts +1 -1
- package/lib/components/react-render/index.js +2 -5
- package/lib/utils/api/form-api.d.ts +1 -1
- package/lib/utils/api/form-api.js +22 -40
- package/lib/utils/cache/index.d.ts +7 -6
- package/lib/utils/cache/index.js +15 -31
- package/lib/utils/page/page-load-schema.js +1 -1
- package/lib/utils/page/page-render.js +1 -2
- package/package.json +1 -1
|
@@ -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(
|
|
6
|
+
render(): import("react").JSX.Element;
|
|
7
7
|
}
|
|
@@ -16,11 +16,8 @@ export var ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
16
16
|
}
|
|
17
17
|
_inheritsLoose(ReactRender, _PureComponent);
|
|
18
18
|
var _proto = ReactRender.prototype;
|
|
19
|
-
_proto.render = function render(
|
|
19
|
+
_proto.render = function render() {
|
|
20
20
|
var _this2 = this;
|
|
21
|
-
if (utils === void 0) {
|
|
22
|
-
utils = window.utils;
|
|
23
|
-
}
|
|
24
21
|
var components = this.props.components || window._components;
|
|
25
22
|
return /*#__PURE__*/React.createElement(ReactRenderFactory, _extends({
|
|
26
23
|
key: this.key
|
|
@@ -31,7 +28,7 @@ export var ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
31
28
|
thisRequiredInJSE: true,
|
|
32
29
|
components: components,
|
|
33
30
|
appHelper: {
|
|
34
|
-
utils: utils,
|
|
31
|
+
utils: window.utils,
|
|
35
32
|
requestHandlersMap: {
|
|
36
33
|
fetch: createFetchHandler()
|
|
37
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRequestOptions, ManyResult, OneResult, RestApi, RestSearchParams } from "./rest-api";
|
|
2
2
|
import { AxiosRequestConfig } from "axios";
|
|
3
|
-
export declare function getFormApi(formId: string, fieldId?: string, mock?: boolean):
|
|
3
|
+
export declare function getFormApi(formId: string, fieldId?: string, mock?: boolean): RestFormApi<any>;
|
|
4
4
|
export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
5
5
|
private readonly formId;
|
|
6
6
|
private readonly fieldId?;
|
package/es/utils/api/form-api.js
CHANGED
|
@@ -1,43 +1,25 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
import { RestApi } from "./rest-api";
|
|
6
6
|
import { getSchema } from "./index";
|
|
7
7
|
import { assembleAssociationField, convertSaveData, handleFilterRules } from "./form-api.utils";
|
|
8
8
|
import { formApi } from "../cache";
|
|
9
|
-
export function getFormApi(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
key = [formId, fieldId, mock ? "mock" : ""].filter(function (key) {
|
|
24
|
-
return !!key;
|
|
25
|
-
}).join("_");
|
|
26
|
-
_context9.next = 4;
|
|
27
|
-
return formApi.getInstance(key, {
|
|
28
|
-
mock: mock,
|
|
29
|
-
fieldId: fieldId,
|
|
30
|
-
formId: formId
|
|
31
|
-
});
|
|
32
|
-
case 4:
|
|
33
|
-
return _context9.abrupt("return", _context9.sent);
|
|
34
|
-
case 5:
|
|
35
|
-
case "end":
|
|
36
|
-
return _context9.stop();
|
|
37
|
-
}
|
|
38
|
-
}, _callee9);
|
|
39
|
-
}));
|
|
40
|
-
return _getFormApi.apply(this, arguments);
|
|
9
|
+
export function getFormApi(formId, fieldId, mock) {
|
|
10
|
+
if (typeof mock != "boolean") {
|
|
11
|
+
if (typeof window.__mock == "boolean") {
|
|
12
|
+
mock = window.__mock;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
var key = [formId, fieldId, mock ? "mock" : ""].filter(function (key) {
|
|
16
|
+
return !!key;
|
|
17
|
+
}).join("_");
|
|
18
|
+
return formApi.getInstance(key, {
|
|
19
|
+
mock: mock,
|
|
20
|
+
fieldId: fieldId,
|
|
21
|
+
formId: formId
|
|
22
|
+
});
|
|
41
23
|
}
|
|
42
24
|
export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
43
25
|
function RestFormApi(formId, fieldId, mock) {
|
|
@@ -139,7 +121,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
139
121
|
}
|
|
140
122
|
}, _callee2, this);
|
|
141
123
|
}));
|
|
142
|
-
function handleRequestConfig(
|
|
124
|
+
function handleRequestConfig(_x) {
|
|
143
125
|
return _handleRequestConfig.apply(this, arguments);
|
|
144
126
|
}
|
|
145
127
|
return handleRequestConfig;
|
|
@@ -187,7 +169,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
187
169
|
}
|
|
188
170
|
}, _callee3, this);
|
|
189
171
|
}));
|
|
190
|
-
function search(
|
|
172
|
+
function search(_x2) {
|
|
191
173
|
return _search.apply(this, arguments);
|
|
192
174
|
}
|
|
193
175
|
return search;
|
|
@@ -212,7 +194,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
212
194
|
}
|
|
213
195
|
}, _callee4, this);
|
|
214
196
|
}));
|
|
215
|
-
function getById(
|
|
197
|
+
function getById(_x3, _x4) {
|
|
216
198
|
return _getById.apply(this, arguments);
|
|
217
199
|
}
|
|
218
200
|
return getById;
|
|
@@ -229,7 +211,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
229
211
|
}
|
|
230
212
|
}, _callee5, this);
|
|
231
213
|
}));
|
|
232
|
-
function save(
|
|
214
|
+
function save(_x5, _x6) {
|
|
233
215
|
return _save.apply(this, arguments);
|
|
234
216
|
}
|
|
235
217
|
return save;
|
|
@@ -246,7 +228,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
246
228
|
}
|
|
247
229
|
}, _callee6, this);
|
|
248
230
|
}));
|
|
249
|
-
function create(
|
|
231
|
+
function create(_x7, _x8) {
|
|
250
232
|
return _create.apply(this, arguments);
|
|
251
233
|
}
|
|
252
234
|
return create;
|
|
@@ -263,7 +245,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
263
245
|
}
|
|
264
246
|
}, _callee7, this);
|
|
265
247
|
}));
|
|
266
|
-
function update(
|
|
248
|
+
function update(_x9, _x10, _x11) {
|
|
267
249
|
return _update.apply(this, arguments);
|
|
268
250
|
}
|
|
269
251
|
return update;
|
|
@@ -280,7 +262,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
280
262
|
}
|
|
281
263
|
}, _callee8, this);
|
|
282
264
|
}));
|
|
283
|
-
function serviceUpdate(
|
|
265
|
+
function serviceUpdate(_x12, _x13) {
|
|
284
266
|
return _serviceUpdate.apply(this, arguments);
|
|
285
267
|
}
|
|
286
268
|
return serviceUpdate;
|
|
@@ -7,11 +7,12 @@ export declare class SchemaCache extends SingletonInstanceMap<any, {
|
|
|
7
7
|
createInstance(key: string, options: any): Promise<any>;
|
|
8
8
|
}
|
|
9
9
|
export declare const schema: SchemaCache;
|
|
10
|
-
export declare class FormApiCache
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
export declare class FormApiCache {
|
|
11
|
+
apiMap: Map<string, RestFormApi<any>>;
|
|
12
|
+
getInstance(key: string, options: {
|
|
13
|
+
formId: string;
|
|
14
|
+
fieldId?: string;
|
|
15
|
+
mock?: boolean;
|
|
16
|
+
}): RestFormApi<any>;
|
|
16
17
|
}
|
|
17
18
|
export declare const formApi: FormApiCache;
|
package/es/utils/cache/index.js
CHANGED
|
@@ -48,38 +48,22 @@ export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
|
|
|
48
48
|
return SchemaCache;
|
|
49
49
|
}(SingletonInstanceMap);
|
|
50
50
|
export var schema = new SchemaCache();
|
|
51
|
-
export var FormApiCache = /*#__PURE__*/function (
|
|
51
|
+
export var FormApiCache = /*#__PURE__*/function () {
|
|
52
52
|
function FormApiCache() {
|
|
53
|
-
|
|
53
|
+
this.apiMap = new Map();
|
|
54
54
|
}
|
|
55
|
-
_inheritsLoose(FormApiCache, _SingletonInstanceMap2);
|
|
56
55
|
var _proto2 = FormApiCache.prototype;
|
|
57
|
-
_proto2.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
61
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
62
|
-
case 0:
|
|
63
|
-
if (options === void 0) {
|
|
64
|
-
options = {};
|
|
65
|
-
}
|
|
66
|
-
_options = options, formId = _options.formId, fieldId = _options.fieldId, mock = _options.mock;
|
|
67
|
-
formApi = new RestFormApi(formId, fieldId, mock);
|
|
68
|
-
_context2.next = 5;
|
|
69
|
-
return formApi.initialize();
|
|
70
|
-
case 5:
|
|
71
|
-
return _context2.abrupt("return", formApi);
|
|
72
|
-
case 6:
|
|
73
|
-
case "end":
|
|
74
|
-
return _context2.stop();
|
|
75
|
-
}
|
|
76
|
-
}, _callee2);
|
|
77
|
-
}));
|
|
78
|
-
function createInstance(_x3, _x4) {
|
|
79
|
-
return _createInstance2.apply(this, arguments);
|
|
56
|
+
_proto2.getInstance = function getInstance(key, options) {
|
|
57
|
+
if (this.apiMap.has(key)) {
|
|
58
|
+
return this.apiMap.get(key);
|
|
80
59
|
}
|
|
81
|
-
|
|
82
|
-
|
|
60
|
+
var formId = options.formId,
|
|
61
|
+
fieldId = options.fieldId,
|
|
62
|
+
mock = options.mock;
|
|
63
|
+
var formApi = new RestFormApi(formId, fieldId, mock);
|
|
64
|
+
this.apiMap.set(key, formApi);
|
|
65
|
+
return formApi;
|
|
66
|
+
};
|
|
83
67
|
return FormApiCache;
|
|
84
|
-
}(
|
|
68
|
+
}();
|
|
85
69
|
export var formApi = new FormApiCache();
|
|
@@ -36,9 +36,8 @@ export function renderElement(options) {
|
|
|
36
36
|
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
37
37
|
}
|
|
38
38
|
}));
|
|
39
|
-
console.log("渲染", container, root, element);
|
|
40
39
|
root.render(element);
|
|
41
|
-
case
|
|
40
|
+
case 7:
|
|
42
41
|
case "end":
|
|
43
42
|
return _context.stop();
|
|
44
43
|
}
|
|
@@ -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(
|
|
6
|
+
render(): import("react").JSX.Element;
|
|
7
7
|
}
|
|
@@ -21,11 +21,8 @@ var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
21
21
|
}
|
|
22
22
|
(0, _inheritsLoose2["default"])(ReactRender, _PureComponent);
|
|
23
23
|
var _proto = ReactRender.prototype;
|
|
24
|
-
_proto.render = function render(
|
|
24
|
+
_proto.render = function render() {
|
|
25
25
|
var _this2 = this;
|
|
26
|
-
if (utils === void 0) {
|
|
27
|
-
utils = window.utils;
|
|
28
|
-
}
|
|
29
26
|
var components = this.props.components || window._components;
|
|
30
27
|
return /*#__PURE__*/React.createElement(_reactRenderFactory["default"], (0, _extends2["default"])({
|
|
31
28
|
key: this.key
|
|
@@ -36,7 +33,7 @@ var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
36
33
|
thisRequiredInJSE: true,
|
|
37
34
|
components: components,
|
|
38
35
|
appHelper: {
|
|
39
|
-
utils: utils,
|
|
36
|
+
utils: window.utils,
|
|
40
37
|
requestHandlersMap: {
|
|
41
38
|
fetch: (0, _lowcodeDatasourceFetchHandler.createFetchHandler)()
|
|
42
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRequestOptions, ManyResult, OneResult, RestApi, RestSearchParams } from "./rest-api";
|
|
2
2
|
import { AxiosRequestConfig } from "axios";
|
|
3
|
-
export declare function getFormApi(formId: string, fieldId?: string, mock?: boolean):
|
|
3
|
+
export declare function getFormApi(formId: string, fieldId?: string, mock?: boolean): RestFormApi<any>;
|
|
4
4
|
export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
5
5
|
private readonly formId;
|
|
6
6
|
private readonly fieldId?;
|
|
@@ -6,44 +6,26 @@ exports.RestFormApi = void 0;
|
|
|
6
6
|
exports.getFormApi = getFormApi;
|
|
7
7
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
10
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
11
11
|
var _restApi = require("./rest-api");
|
|
12
12
|
var _index = require("./index");
|
|
13
13
|
var _formApi = require("./form-api.utils");
|
|
14
14
|
var _cache = require("../cache");
|
|
15
|
-
function getFormApi(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
key = [formId, fieldId, mock ? "mock" : ""].filter(function (key) {
|
|
30
|
-
return !!key;
|
|
31
|
-
}).join("_");
|
|
32
|
-
_context9.next = 4;
|
|
33
|
-
return _cache.formApi.getInstance(key, {
|
|
34
|
-
mock: mock,
|
|
35
|
-
fieldId: fieldId,
|
|
36
|
-
formId: formId
|
|
37
|
-
});
|
|
38
|
-
case 4:
|
|
39
|
-
return _context9.abrupt("return", _context9.sent);
|
|
40
|
-
case 5:
|
|
41
|
-
case "end":
|
|
42
|
-
return _context9.stop();
|
|
43
|
-
}
|
|
44
|
-
}, _callee9);
|
|
45
|
-
}));
|
|
46
|
-
return _getFormApi.apply(this, arguments);
|
|
15
|
+
function getFormApi(formId, fieldId, mock) {
|
|
16
|
+
if (typeof mock != "boolean") {
|
|
17
|
+
if (typeof window.__mock == "boolean") {
|
|
18
|
+
mock = window.__mock;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
var key = [formId, fieldId, mock ? "mock" : ""].filter(function (key) {
|
|
22
|
+
return !!key;
|
|
23
|
+
}).join("_");
|
|
24
|
+
return _cache.formApi.getInstance(key, {
|
|
25
|
+
mock: mock,
|
|
26
|
+
fieldId: fieldId,
|
|
27
|
+
formId: formId
|
|
28
|
+
});
|
|
47
29
|
}
|
|
48
30
|
var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
49
31
|
function RestFormApi(formId, fieldId, mock) {
|
|
@@ -145,7 +127,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
145
127
|
}
|
|
146
128
|
}, _callee2, this);
|
|
147
129
|
}));
|
|
148
|
-
function handleRequestConfig(
|
|
130
|
+
function handleRequestConfig(_x) {
|
|
149
131
|
return _handleRequestConfig.apply(this, arguments);
|
|
150
132
|
}
|
|
151
133
|
return handleRequestConfig;
|
|
@@ -193,7 +175,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
193
175
|
}
|
|
194
176
|
}, _callee3, this);
|
|
195
177
|
}));
|
|
196
|
-
function search(
|
|
178
|
+
function search(_x2) {
|
|
197
179
|
return _search.apply(this, arguments);
|
|
198
180
|
}
|
|
199
181
|
return search;
|
|
@@ -218,7 +200,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
218
200
|
}
|
|
219
201
|
}, _callee4, this);
|
|
220
202
|
}));
|
|
221
|
-
function getById(
|
|
203
|
+
function getById(_x3, _x4) {
|
|
222
204
|
return _getById.apply(this, arguments);
|
|
223
205
|
}
|
|
224
206
|
return getById;
|
|
@@ -235,7 +217,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
235
217
|
}
|
|
236
218
|
}, _callee5, this);
|
|
237
219
|
}));
|
|
238
|
-
function save(
|
|
220
|
+
function save(_x5, _x6) {
|
|
239
221
|
return _save.apply(this, arguments);
|
|
240
222
|
}
|
|
241
223
|
return save;
|
|
@@ -252,7 +234,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
252
234
|
}
|
|
253
235
|
}, _callee6, this);
|
|
254
236
|
}));
|
|
255
|
-
function create(
|
|
237
|
+
function create(_x7, _x8) {
|
|
256
238
|
return _create.apply(this, arguments);
|
|
257
239
|
}
|
|
258
240
|
return create;
|
|
@@ -269,7 +251,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
269
251
|
}
|
|
270
252
|
}, _callee7, this);
|
|
271
253
|
}));
|
|
272
|
-
function update(
|
|
254
|
+
function update(_x9, _x10, _x11) {
|
|
273
255
|
return _update.apply(this, arguments);
|
|
274
256
|
}
|
|
275
257
|
return update;
|
|
@@ -286,7 +268,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
286
268
|
}
|
|
287
269
|
}, _callee8, this);
|
|
288
270
|
}));
|
|
289
|
-
function serviceUpdate(
|
|
271
|
+
function serviceUpdate(_x12, _x13) {
|
|
290
272
|
return _serviceUpdate.apply(this, arguments);
|
|
291
273
|
}
|
|
292
274
|
return serviceUpdate;
|
|
@@ -7,11 +7,12 @@ export declare class SchemaCache extends SingletonInstanceMap<any, {
|
|
|
7
7
|
createInstance(key: string, options: any): Promise<any>;
|
|
8
8
|
}
|
|
9
9
|
export declare const schema: SchemaCache;
|
|
10
|
-
export declare class FormApiCache
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
export declare class FormApiCache {
|
|
11
|
+
apiMap: Map<string, RestFormApi<any>>;
|
|
12
|
+
getInstance(key: string, options: {
|
|
13
|
+
formId: string;
|
|
14
|
+
fieldId?: string;
|
|
15
|
+
mock?: boolean;
|
|
16
|
+
}): RestFormApi<any>;
|
|
16
17
|
}
|
|
17
18
|
export declare const formApi: FormApiCache;
|
package/lib/utils/cache/index.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.schema = exports.formApi = exports.SchemaCache = exports.FormApiCache =
|
|
|
6
6
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
7
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
8
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
9
|
-
var
|
|
9
|
+
var _SingletonInstanceMap2 = require("../common/SingletonInstanceMap");
|
|
10
10
|
var _api = require("../api");
|
|
11
11
|
var _schema = require("./schema");
|
|
12
12
|
var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
|
|
@@ -50,40 +50,24 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
|
|
|
50
50
|
return createInstance;
|
|
51
51
|
}();
|
|
52
52
|
return SchemaCache;
|
|
53
|
-
}(
|
|
53
|
+
}(_SingletonInstanceMap2.SingletonInstanceMap);
|
|
54
54
|
var schema = exports.schema = new SchemaCache();
|
|
55
|
-
var FormApiCache = exports.FormApiCache = /*#__PURE__*/function (
|
|
55
|
+
var FormApiCache = exports.FormApiCache = /*#__PURE__*/function () {
|
|
56
56
|
function FormApiCache() {
|
|
57
|
-
|
|
57
|
+
this.apiMap = new Map();
|
|
58
58
|
}
|
|
59
|
-
(0, _inheritsLoose2["default"])(FormApiCache, _SingletonInstanceMap2);
|
|
60
59
|
var _proto2 = FormApiCache.prototype;
|
|
61
|
-
_proto2.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
65
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
66
|
-
case 0:
|
|
67
|
-
if (options === void 0) {
|
|
68
|
-
options = {};
|
|
69
|
-
}
|
|
70
|
-
_options = options, formId = _options.formId, fieldId = _options.fieldId, mock = _options.mock;
|
|
71
|
-
formApi = new _api.RestFormApi(formId, fieldId, mock);
|
|
72
|
-
_context2.next = 5;
|
|
73
|
-
return formApi.initialize();
|
|
74
|
-
case 5:
|
|
75
|
-
return _context2.abrupt("return", formApi);
|
|
76
|
-
case 6:
|
|
77
|
-
case "end":
|
|
78
|
-
return _context2.stop();
|
|
79
|
-
}
|
|
80
|
-
}, _callee2);
|
|
81
|
-
}));
|
|
82
|
-
function createInstance(_x3, _x4) {
|
|
83
|
-
return _createInstance2.apply(this, arguments);
|
|
60
|
+
_proto2.getInstance = function getInstance(key, options) {
|
|
61
|
+
if (this.apiMap.has(key)) {
|
|
62
|
+
return this.apiMap.get(key);
|
|
84
63
|
}
|
|
85
|
-
|
|
86
|
-
|
|
64
|
+
var formId = options.formId,
|
|
65
|
+
fieldId = options.fieldId,
|
|
66
|
+
mock = options.mock;
|
|
67
|
+
var formApi = new _api.RestFormApi(formId, fieldId, mock);
|
|
68
|
+
this.apiMap.set(key, formApi);
|
|
69
|
+
return formApi;
|
|
70
|
+
};
|
|
87
71
|
return FormApiCache;
|
|
88
|
-
}(
|
|
72
|
+
}();
|
|
89
73
|
var formApi = exports.formApi = new FormApiCache();
|
|
@@ -41,9 +41,8 @@ function renderElement(options) {
|
|
|
41
41
|
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
42
42
|
}
|
|
43
43
|
}));
|
|
44
|
-
console.log("渲染", container, root, element);
|
|
45
44
|
root.render(element);
|
|
46
|
-
case
|
|
45
|
+
case 7:
|
|
47
46
|
case "end":
|
|
48
47
|
return _context.stop();
|
|
49
48
|
}
|