@zhubangyun/lowcode-core 5.8.291 → 5.10.82
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/index.js +1 -0
- package/es/utils/api/file-api.d.ts +7 -0
- package/es/utils/api/file-api.js +86 -0
- package/es/utils/api/form-api.d.ts +1 -0
- package/es/utils/api/form-api.js +66 -27
- package/es/utils/api/form-api.utils.d.ts +2 -0
- package/es/utils/api/form-api.utils.js +82 -113
- package/es/utils/api/index.d.ts +5 -5
- package/es/utils/api/index.js +7 -67
- package/es/utils/api/rest-api.d.ts +6 -2
- package/es/utils/api/rest-api.js +64 -34
- package/es/utils/api/schema-api.d.ts +2 -0
- package/es/utils/api/schema-api.js +33 -0
- package/es/utils/api/script-api.d.ts +1 -0
- package/es/utils/api/script-api.js +41 -0
- package/es/utils/common/LoadPlugins.js +9 -16
- package/es/utils/common/index.d.ts +1 -0
- package/es/utils/common/index.js +12 -0
- package/es/utils/page/index.d.ts +2 -0
- package/es/utils/page/index.js +2 -0
- package/es/utils/page/page-form-data-manager-group.d.ts +17 -0
- package/es/utils/page/page-form-data-manager-group.js +104 -0
- package/es/utils/page/page-form-data-manager.d.ts +6 -0
- package/es/utils/page/page-form-data-manager.js +24 -79
- package/es/utils/page/page-form.d.ts +1 -1
- package/es/utils/page/page-form.js +24 -47
- package/es/utils/page/page-layout.js +1 -1
- package/es/utils/page/page-render.d.ts +10 -0
- package/es/utils/page/page-render.js +51 -0
- package/es/utils/page/page-schema-utils.d.ts +1 -0
- package/es/utils/page/page-schema-utils.js +74 -0
- package/es/utils/page/page-show.d.ts +11 -0
- package/es/utils/page/page-show.js +82 -0
- package/lib/index.js +2 -0
- package/lib/utils/api/file-api.d.ts +7 -0
- package/lib/utils/api/file-api.js +92 -0
- package/lib/utils/api/form-api.d.ts +1 -0
- package/lib/utils/api/form-api.js +67 -27
- package/lib/utils/api/form-api.utils.d.ts +2 -0
- package/lib/utils/api/form-api.utils.js +84 -113
- package/lib/utils/api/index.d.ts +5 -5
- package/lib/utils/api/index.js +14 -72
- package/lib/utils/api/rest-api.d.ts +6 -2
- package/lib/utils/api/rest-api.js +64 -34
- package/lib/utils/api/schema-api.d.ts +2 -0
- package/lib/utils/api/schema-api.js +38 -0
- package/lib/utils/api/script-api.d.ts +1 -0
- package/lib/utils/api/script-api.js +46 -0
- package/lib/utils/common/LoadPlugins.js +9 -16
- package/lib/utils/common/index.d.ts +1 -0
- package/lib/utils/common/index.js +13 -0
- package/lib/utils/page/index.d.ts +2 -0
- package/lib/utils/page/index.js +5 -1
- package/lib/utils/page/page-form-data-manager-group.d.ts +17 -0
- package/lib/utils/page/page-form-data-manager-group.js +111 -0
- package/lib/utils/page/page-form-data-manager.d.ts +6 -0
- package/lib/utils/page/page-form-data-manager.js +24 -79
- package/lib/utils/page/page-form.d.ts +1 -1
- package/lib/utils/page/page-form.js +24 -47
- package/lib/utils/page/page-layout.js +1 -1
- package/lib/utils/page/page-render.d.ts +10 -0
- package/lib/utils/page/page-render.js +56 -0
- package/lib/utils/page/page-schema-utils.d.ts +1 -0
- package/lib/utils/page/page-schema-utils.js +79 -0
- package/lib/utils/page/page-show.d.ts +11 -0
- package/lib/utils/page/page-show.js +89 -0
- package/package.json +1 -1
- package/es/utils/common/FormDataHandler.d.ts +0 -45
- package/es/utils/common/FormDataHandler.js +0 -410
- package/lib/utils/common/FormDataHandler.d.ts +0 -45
- package/lib/utils/common/FormDataHandler.js +0 -416
|
@@ -13,6 +13,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
13
13
|
var _axios = _interopRequireDefault(require("axios"));
|
|
14
14
|
var _index = require("./index");
|
|
15
15
|
var _data = require("../data");
|
|
16
|
+
var _page = require("../page");
|
|
16
17
|
var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
17
18
|
function BaseRestApi(uri, options) {
|
|
18
19
|
this.uri = void 0;
|
|
@@ -89,7 +90,7 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
89
90
|
_context2.next = 12;
|
|
90
91
|
break;
|
|
91
92
|
}
|
|
92
|
-
this.showError("\u83B7\u53D6{" + id + "}\u5931\u8D25!", res
|
|
93
|
+
this.showError("\u83B7\u53D6{" + id + "}\u5931\u8D25!", res).then();
|
|
93
94
|
_context2.next = 10;
|
|
94
95
|
return options === null || options === void 0 ? void 0 : (_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options, res);
|
|
95
96
|
case 10:
|
|
@@ -130,7 +131,7 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
130
131
|
_context3.next = 12;
|
|
131
132
|
break;
|
|
132
133
|
}
|
|
133
|
-
this.showError("\u63D0\u4EA4\u5931\u8D25!", res
|
|
134
|
+
this.showError("\u63D0\u4EA4\u5931\u8D25!", res).then();
|
|
134
135
|
_context3.next = 10;
|
|
135
136
|
return options === null || options === void 0 ? void 0 : (_options$onError2 = options.onError) === null || _options$onError2 === void 0 ? void 0 : _options$onError2.call(options, res);
|
|
136
137
|
case 10:
|
|
@@ -177,7 +178,7 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
177
178
|
_context4.next = 12;
|
|
178
179
|
break;
|
|
179
180
|
}
|
|
180
|
-
this.showError("\u65B0\u589E\u5931\u8D25!", res
|
|
181
|
+
this.showError("\u65B0\u589E\u5931\u8D25!", res).then();
|
|
181
182
|
_context4.next = 10;
|
|
182
183
|
return options === null || options === void 0 ? void 0 : (_options$onError3 = options.onError) === null || _options$onError3 === void 0 ? void 0 : _options$onError3.call(options, res);
|
|
183
184
|
case 10:
|
|
@@ -224,7 +225,7 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
224
225
|
_context5.next = 12;
|
|
225
226
|
break;
|
|
226
227
|
}
|
|
227
|
-
this.showError("\u66F4\u65B0\u5931\u8D25!", res
|
|
228
|
+
this.showError("\u66F4\u65B0\u5931\u8D25!", res).then();
|
|
228
229
|
_context5.next = 10;
|
|
229
230
|
return options === null || options === void 0 ? void 0 : (_options$onError4 = options.onError) === null || _options$onError4 === void 0 ? void 0 : _options$onError4.call(options, res);
|
|
230
231
|
case 10:
|
|
@@ -271,7 +272,7 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
271
272
|
_context6.next = 12;
|
|
272
273
|
break;
|
|
273
274
|
}
|
|
274
|
-
this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res
|
|
275
|
+
this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res).then();
|
|
275
276
|
_context6.next = 10;
|
|
276
277
|
return options === null || options === void 0 ? void 0 : (_options$onError5 = options.onError) === null || _options$onError5 === void 0 ? void 0 : _options$onError5.call(options, res);
|
|
277
278
|
case 10:
|
|
@@ -328,7 +329,7 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
328
329
|
_context7.next = 18;
|
|
329
330
|
break;
|
|
330
331
|
}
|
|
331
|
-
this.showError("\u5220\u9664\u5931\u8D25!", res
|
|
332
|
+
this.showError("\u5220\u9664\u5931\u8D25!", res).then();
|
|
332
333
|
_context7.next = 16;
|
|
333
334
|
return options === null || options === void 0 ? void 0 : (_options$onError6 = options.onError) === null || _options$onError6 === void 0 ? void 0 : _options$onError6.call(options, res);
|
|
334
335
|
case 16:
|
|
@@ -349,62 +350,72 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
349
350
|
return _delete2.apply(this, arguments);
|
|
350
351
|
}
|
|
351
352
|
return _delete;
|
|
352
|
-
}()
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
353
|
+
}() // @ts-ignore
|
|
354
|
+
;
|
|
355
|
+
_proto.showError =
|
|
356
|
+
/*#__PURE__*/
|
|
357
|
+
function () {
|
|
358
|
+
var _showError = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(type, res) {
|
|
359
|
+
var msg, props, content;
|
|
356
360
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
357
361
|
while (1) switch (_context8.prev = _context8.next) {
|
|
358
362
|
case 0:
|
|
359
|
-
|
|
363
|
+
msg = res.message;
|
|
364
|
+
_context8.prev = 1;
|
|
360
365
|
if (!msg) {
|
|
361
|
-
_context8.next =
|
|
366
|
+
_context8.next = 21;
|
|
362
367
|
break;
|
|
363
368
|
}
|
|
364
369
|
props = JSON.parse(msg);
|
|
365
|
-
|
|
370
|
+
content = /*#__PURE__*/React.createElement(ErrorContent, {
|
|
371
|
+
requestId: res.requestId,
|
|
372
|
+
message: props.message
|
|
373
|
+
});
|
|
374
|
+
props.content = content;
|
|
375
|
+
props.message = content;
|
|
366
376
|
if (!props.title) {
|
|
367
377
|
props.title = "" + this.title + type;
|
|
368
378
|
}
|
|
369
379
|
if (!(props.type == "message")) {
|
|
370
|
-
_context8.next =
|
|
380
|
+
_context8.next = 13;
|
|
371
381
|
break;
|
|
372
382
|
}
|
|
373
383
|
_message2["default"].error(props);
|
|
374
384
|
return _context8.abrupt("return");
|
|
375
|
-
case
|
|
385
|
+
case 13:
|
|
376
386
|
if (!(props.type == "modal")) {
|
|
377
|
-
_context8.next =
|
|
387
|
+
_context8.next = 18;
|
|
378
388
|
break;
|
|
379
389
|
}
|
|
380
390
|
_modal["default"].error(props);
|
|
381
391
|
return _context8.abrupt("return");
|
|
382
|
-
case
|
|
392
|
+
case 18:
|
|
383
393
|
if (!(props.type == "notification")) {
|
|
384
|
-
_context8.next =
|
|
394
|
+
_context8.next = 21;
|
|
385
395
|
break;
|
|
386
396
|
}
|
|
387
397
|
_notification2["default"].error(props);
|
|
388
398
|
return _context8.abrupt("return");
|
|
389
|
-
case
|
|
390
|
-
_context8.next =
|
|
399
|
+
case 21:
|
|
400
|
+
_context8.next = 27;
|
|
391
401
|
break;
|
|
392
|
-
case
|
|
393
|
-
_context8.prev =
|
|
394
|
-
_context8.t0 = _context8["catch"](
|
|
402
|
+
case 23:
|
|
403
|
+
_context8.prev = 23;
|
|
404
|
+
_context8.t0 = _context8["catch"](1);
|
|
395
405
|
console.error("" + this.title + type + (msg || ""));
|
|
396
406
|
_modal["default"].error({
|
|
397
407
|
title: "" + this.title + type,
|
|
398
408
|
centered: true,
|
|
399
|
-
content: /*#__PURE__*/React.createElement(
|
|
400
|
-
|
|
401
|
-
|
|
409
|
+
content: /*#__PURE__*/React.createElement(ErrorContent, {
|
|
410
|
+
requestId: res.requestId,
|
|
411
|
+
message: res.message
|
|
412
|
+
})
|
|
402
413
|
});
|
|
403
|
-
case
|
|
414
|
+
case 27:
|
|
404
415
|
case "end":
|
|
405
416
|
return _context8.stop();
|
|
406
417
|
}
|
|
407
|
-
}, _callee8, this, [[
|
|
418
|
+
}, _callee8, this, [[1, 23]]);
|
|
408
419
|
}));
|
|
409
420
|
function showError(_x15, _x16) {
|
|
410
421
|
return _showError.apply(this, arguments);
|
|
@@ -413,13 +424,32 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
413
424
|
}();
|
|
414
425
|
return BaseRestApi;
|
|
415
426
|
}();
|
|
416
|
-
function
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
427
|
+
function ErrorContent(props) {
|
|
428
|
+
var content = /*#__PURE__*/React.createElement(_typography["default"].Text, {
|
|
429
|
+
type: "danger",
|
|
430
|
+
style: {
|
|
431
|
+
whiteSpace: "pre-wrap"
|
|
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;
|
|
421
452
|
}
|
|
422
|
-
return null;
|
|
423
453
|
}
|
|
424
454
|
var RestApi = exports.RestApi = /*#__PURE__*/function (_BaseRestApi2) {
|
|
425
455
|
function RestApi(uri, options) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.getSchema = getSchema;
|
|
6
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
+
var _cache = require("../cache");
|
|
9
|
+
function getSchema(_x, _x2) {
|
|
10
|
+
return _getSchema.apply(this, arguments);
|
|
11
|
+
}
|
|
12
|
+
function _getSchema() {
|
|
13
|
+
_getSchema = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(pageId, mock) {
|
|
14
|
+
var key;
|
|
15
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
if (typeof mock != "boolean") {
|
|
19
|
+
if (typeof window.__mock == "boolean") {
|
|
20
|
+
mock = window.__mock;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
key = mock ? pageId + "_mock" : pageId;
|
|
24
|
+
_context.next = 4;
|
|
25
|
+
return _cache.schema.getInstance(key, {
|
|
26
|
+
mock: mock,
|
|
27
|
+
pageId: pageId
|
|
28
|
+
});
|
|
29
|
+
case 4:
|
|
30
|
+
return _context.abrupt("return", _context.sent);
|
|
31
|
+
case 5:
|
|
32
|
+
case "end":
|
|
33
|
+
return _context.stop();
|
|
34
|
+
}
|
|
35
|
+
}, _callee);
|
|
36
|
+
}));
|
|
37
|
+
return _getSchema.apply(this, arguments);
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadDts(): Promise<any[]>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.loadDts = loadDts;
|
|
6
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
+
var _index = require("./index");
|
|
9
|
+
function loadDts() {
|
|
10
|
+
return _loadDts.apply(this, arguments);
|
|
11
|
+
}
|
|
12
|
+
function _loadDts() {
|
|
13
|
+
_loadDts = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
14
|
+
var api, res;
|
|
15
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
_context.prev = 0;
|
|
19
|
+
_context.next = 3;
|
|
20
|
+
return (0, _index.getFormApi)("form_bea7fcc6376c4461965237056f970fb7");
|
|
21
|
+
case 3:
|
|
22
|
+
api = _context.sent;
|
|
23
|
+
_context.next = 6;
|
|
24
|
+
return api.search({
|
|
25
|
+
pageSize: 1000,
|
|
26
|
+
searchFields: [{
|
|
27
|
+
key: "type",
|
|
28
|
+
operator: "eq",
|
|
29
|
+
value: "dts"
|
|
30
|
+
}]
|
|
31
|
+
});
|
|
32
|
+
case 6:
|
|
33
|
+
res = _context.sent;
|
|
34
|
+
return _context.abrupt("return", res.data || []);
|
|
35
|
+
case 10:
|
|
36
|
+
_context.prev = 10;
|
|
37
|
+
_context.t0 = _context["catch"](0);
|
|
38
|
+
return _context.abrupt("return", []);
|
|
39
|
+
case 13:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
42
|
+
}
|
|
43
|
+
}, _callee, null, [[0, 10]]);
|
|
44
|
+
}));
|
|
45
|
+
return _loadDts.apply(this, arguments);
|
|
46
|
+
}
|
|
@@ -67,15 +67,10 @@ 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
|
|
70
|
+
var 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
|
-
};
|
|
79
74
|
//加载式样
|
|
80
75
|
target = doc.querySelector("link[href='" + src + "']");
|
|
81
76
|
if (!target) {
|
|
@@ -83,16 +78,16 @@ function _loadStyle() {
|
|
|
83
78
|
target.href = src;
|
|
84
79
|
target.rel = "stylesheet";
|
|
85
80
|
target.onload = function () {
|
|
86
|
-
|
|
81
|
+
resolve(true);
|
|
87
82
|
};
|
|
88
83
|
target.onerror = function () {
|
|
89
|
-
|
|
84
|
+
resolve(false);
|
|
90
85
|
};
|
|
91
86
|
doc.head.appendChild(target);
|
|
92
87
|
} else {
|
|
93
|
-
|
|
88
|
+
resolve(true);
|
|
94
89
|
}
|
|
95
|
-
case
|
|
90
|
+
case 2:
|
|
96
91
|
case "end":
|
|
97
92
|
return _context2.stop();
|
|
98
93
|
}
|
|
@@ -130,10 +125,8 @@ function _loadScript() {
|
|
|
130
125
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
131
126
|
while (1) switch (_context4.prev = _context4.next) {
|
|
132
127
|
case 0:
|
|
133
|
-
callback = function
|
|
134
|
-
|
|
135
|
-
resolve(status);
|
|
136
|
-
}, 10);
|
|
128
|
+
callback = function _callback(status) {
|
|
129
|
+
resolve(status);
|
|
137
130
|
};
|
|
138
131
|
//加载脚本
|
|
139
132
|
target = doc.querySelector("script[src='" + src + "']");
|
|
@@ -144,10 +137,10 @@ function _loadScript() {
|
|
|
144
137
|
}
|
|
145
138
|
target.src = src;
|
|
146
139
|
target.onload = function () {
|
|
147
|
-
|
|
140
|
+
callback(true);
|
|
148
141
|
};
|
|
149
142
|
target.onerror = function () {
|
|
150
|
-
|
|
143
|
+
callback(false);
|
|
151
144
|
};
|
|
152
145
|
doc.body.appendChild(target);
|
|
153
146
|
} else {
|
|
@@ -2,12 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.loadPlugins = void 0;
|
|
5
|
+
exports.toArray = toArray;
|
|
5
6
|
exports.uuid = uuid;
|
|
6
7
|
var _uuid = require("uuid");
|
|
7
8
|
var _LoadPlugins = require("./LoadPlugins");
|
|
8
9
|
exports.loadPlugins = _LoadPlugins.loadPlugins;
|
|
9
10
|
function uuid(prefix, separator) {
|
|
11
|
+
if (!prefix && !separator) {
|
|
12
|
+
return (0, _uuid.v4)();
|
|
13
|
+
}
|
|
10
14
|
return [prefix, separator, (0, _uuid.v4)()].filter(function (v) {
|
|
11
15
|
return !!v;
|
|
12
16
|
}).join("");
|
|
17
|
+
}
|
|
18
|
+
function toArray(data) {
|
|
19
|
+
if (!data) {
|
|
20
|
+
return [];
|
|
21
|
+
} else if (Array.isArray(data)) {
|
|
22
|
+
return data;
|
|
23
|
+
} else {
|
|
24
|
+
return [data];
|
|
25
|
+
}
|
|
13
26
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { showForm } from "./page-form";
|
|
2
2
|
export { showFormDataManager } from "./page-form-data-manager";
|
|
3
|
+
export { showFormDataManagerGroup } from "./page-form-data-manager-group";
|
|
4
|
+
export { show } from "./page-show";
|
|
3
5
|
export declare function showLoading(): Promise<void>;
|
|
4
6
|
export declare function hideLoading(): Promise<void>;
|
|
5
7
|
export declare function openPage(url: string, target?: string): Promise<any>;
|
package/lib/utils/page/index.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.__esModule = true;
|
|
|
5
5
|
exports.closePage = closePage;
|
|
6
6
|
exports.hideLoading = hideLoading;
|
|
7
7
|
exports.openPage = openPage;
|
|
8
|
-
exports.showFormDataManager = exports.showForm = void 0;
|
|
8
|
+
exports.showFormDataManagerGroup = exports.showFormDataManager = exports.showForm = exports.show = void 0;
|
|
9
9
|
exports.showLoading = showLoading;
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -13,6 +13,10 @@ var _pageForm = require("./page-form");
|
|
|
13
13
|
exports.showForm = _pageForm.showForm;
|
|
14
14
|
var _pageFormDataManager = require("./page-form-data-manager");
|
|
15
15
|
exports.showFormDataManager = _pageFormDataManager.showFormDataManager;
|
|
16
|
+
var _pageFormDataManagerGroup = require("./page-form-data-manager-group");
|
|
17
|
+
exports.showFormDataManagerGroup = _pageFormDataManagerGroup.showFormDataManagerGroup;
|
|
18
|
+
var _pageShow = require("./page-show");
|
|
19
|
+
exports.show = _pageShow.show;
|
|
16
20
|
var timerRef;
|
|
17
21
|
function debounceHide() {
|
|
18
22
|
if (timerRef) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PageLayoutType } from "./page-layout";
|
|
2
|
+
export declare type PageFormDataManagerModeType = "page" | "selectOne" | "selectMore";
|
|
3
|
+
export interface ShowFormDataManagerGroupProps {
|
|
4
|
+
container?: HTMLDivElement;
|
|
5
|
+
layout?: PageLayoutType;
|
|
6
|
+
mode?: PageFormDataManagerModeType;
|
|
7
|
+
items: any[];
|
|
8
|
+
extraProps?: any;
|
|
9
|
+
defaultSelectedRows?: any[];
|
|
10
|
+
onClose?: () => void | Promise<void>;
|
|
11
|
+
onSearch?: (params: any[]) => void | Promise<void>;
|
|
12
|
+
onLoadData?: (response: {
|
|
13
|
+
data: any[];
|
|
14
|
+
total: number;
|
|
15
|
+
}) => void | Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare function showFormDataManagerGroup(options: ShowFormDataManagerGroupProps): Promise<any | any[]>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.showFormDataManagerGroup = showFormDataManagerGroup;
|
|
6
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _pageLayout = require("./page-layout");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _reactRender = require("../../components/react-render");
|
|
14
|
+
var _pageSchemaUtils = require("./page-schema-utils");
|
|
15
|
+
var _pageRender = require("./page-render");
|
|
16
|
+
var _uuid = require("uuid");
|
|
17
|
+
var _excluded = ["layout", "items", "onSelectOk", "onClose"],
|
|
18
|
+
_excluded2 = ["container", "onClose"];
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
function showFormDataManagerGroup(_x) {
|
|
22
|
+
return _showFormDataManagerGroup.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
function _showFormDataManagerGroup() {
|
|
25
|
+
_showFormDataManagerGroup = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
26
|
+
var container, onClose, props;
|
|
27
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
container = options.container, onClose = options.onClose, props = (0, _objectWithoutPropertiesLoose2["default"])(options, _excluded2);
|
|
31
|
+
return _context.abrupt("return", (0, _pageRender.renderElement)({
|
|
32
|
+
container: container,
|
|
33
|
+
onClose: onClose,
|
|
34
|
+
element: {
|
|
35
|
+
component: FormDataManagerRender,
|
|
36
|
+
props: props
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
case 2:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
42
|
+
}
|
|
43
|
+
}, _callee);
|
|
44
|
+
}));
|
|
45
|
+
return _showFormDataManagerGroup.apply(this, arguments);
|
|
46
|
+
}
|
|
47
|
+
var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
48
|
+
function FormDataManagerRender() {
|
|
49
|
+
var _this;
|
|
50
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
|
+
args[_key] = arguments[_key];
|
|
52
|
+
}
|
|
53
|
+
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
54
|
+
_this.layoutRef = void 0;
|
|
55
|
+
return _this;
|
|
56
|
+
}
|
|
57
|
+
(0, _inheritsLoose2["default"])(FormDataManagerRender, _Component);
|
|
58
|
+
var _proto = FormDataManagerRender.prototype;
|
|
59
|
+
_proto.render = function render() {
|
|
60
|
+
var _this2 = this;
|
|
61
|
+
var self = this;
|
|
62
|
+
var _this$props = this.props,
|
|
63
|
+
layout = _this$props.layout,
|
|
64
|
+
items = _this$props.items,
|
|
65
|
+
onSelectOk = _this$props.onSelectOk,
|
|
66
|
+
onClose = _this$props.onClose,
|
|
67
|
+
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
restProps.layout = layout || "modal";
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
restProps.onClose = function () {
|
|
72
|
+
var _self$layoutRef;
|
|
73
|
+
(_self$layoutRef = self.layoutRef) === null || _self$layoutRef === void 0 ? void 0 : _self$layoutRef.close();
|
|
74
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
75
|
+
};
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
restProps.onSelectOk = function (data) {
|
|
78
|
+
var _self$layoutRef2;
|
|
79
|
+
(_self$layoutRef2 = self.layoutRef) === null || _self$layoutRef2 === void 0 ? void 0 : _self$layoutRef2.close();
|
|
80
|
+
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
|
|
81
|
+
};
|
|
82
|
+
var fdmItems = (items === null || items === void 0 ? void 0 : items.map(function (item) {
|
|
83
|
+
return (0, _extends2["default"])({}, item, {
|
|
84
|
+
dataView: (0, _pageSchemaUtils.cloneDataView)(_this2.props.extraProps, item.dataView)
|
|
85
|
+
});
|
|
86
|
+
})) || [];
|
|
87
|
+
return /*#__PURE__*/_react["default"].createElement(_pageLayout.PageLayout, {
|
|
88
|
+
layout: layout,
|
|
89
|
+
ref: function ref(layout) {
|
|
90
|
+
return _this2.layoutRef = layout;
|
|
91
|
+
}
|
|
92
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({}, restProps, {
|
|
93
|
+
components: window._components || window.components || window.__components,
|
|
94
|
+
schema: {
|
|
95
|
+
id: (0, _uuid.v4)(),
|
|
96
|
+
componentName: "Page",
|
|
97
|
+
props: {},
|
|
98
|
+
state: {},
|
|
99
|
+
children: [{
|
|
100
|
+
componentName: "PageFdmGroup",
|
|
101
|
+
props: {
|
|
102
|
+
mode: restProps.mode,
|
|
103
|
+
defaultSelectedRows: restProps.defaultSelectedRows,
|
|
104
|
+
items: fdmItems
|
|
105
|
+
}
|
|
106
|
+
}]
|
|
107
|
+
}
|
|
108
|
+
})));
|
|
109
|
+
};
|
|
110
|
+
return FormDataManagerRender;
|
|
111
|
+
}(_react.Component);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PageLayoutType } from "./page-layout";
|
|
2
|
+
import { FilterRule } from "../api/rest-api";
|
|
2
3
|
export declare type PageFormDataManagerModeType = "associationField" | "dataManager" | "selectOne" | "selectMore";
|
|
3
4
|
export interface ShowPageFormDataManagerProps {
|
|
4
5
|
container?: HTMLDivElement;
|
|
@@ -8,6 +9,11 @@ export interface ShowPageFormDataManagerProps {
|
|
|
8
9
|
fieldId?: string;
|
|
9
10
|
};
|
|
10
11
|
mode?: PageFormDataManagerModeType;
|
|
12
|
+
dataView?: {
|
|
13
|
+
filterRules?: FilterRule[];
|
|
14
|
+
searchFields?: FilterRule[];
|
|
15
|
+
orderRules?: any[];
|
|
16
|
+
};
|
|
11
17
|
extraProps?: any;
|
|
12
18
|
onClose?: () => void | Promise<void>;
|
|
13
19
|
onSearch?: (params: any[]) => void | Promise<void>;
|