@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
2
|
+
export declare type ValueType = "value" | "field" | "express";
|
|
2
3
|
export interface RestApiOptions {
|
|
3
4
|
/**
|
|
4
5
|
* 超时时间
|
|
@@ -12,9 +13,10 @@ export interface RestApiOptions {
|
|
|
12
13
|
}
|
|
13
14
|
export interface FilterRule {
|
|
14
15
|
connector?: "and" | "or";
|
|
15
|
-
key
|
|
16
|
+
key?: string;
|
|
16
17
|
operator?: OperatorType;
|
|
17
|
-
|
|
18
|
+
valueType?: ValueType;
|
|
19
|
+
value?: any;
|
|
18
20
|
rules?: FilterRule[];
|
|
19
21
|
}
|
|
20
22
|
export declare type OperatorType = "eq" | "ne" | "gt" | "goe" | "lt" | "loe" | "like" | "notLike" | "in" | "notIn" | "isNull" | "isNotNull" | "between" | "notBetween";
|
|
@@ -87,6 +89,7 @@ export interface BaseType {
|
|
|
87
89
|
id: string;
|
|
88
90
|
fieldId?: string;
|
|
89
91
|
label: string;
|
|
92
|
+
labelField: string;
|
|
90
93
|
};
|
|
91
94
|
_load?: boolean;
|
|
92
95
|
}
|
|
@@ -95,6 +98,7 @@ export interface BaseType {
|
|
|
95
98
|
*/
|
|
96
99
|
export interface BaseResult<DataType> {
|
|
97
100
|
success: boolean;
|
|
101
|
+
requestId?: string;
|
|
98
102
|
message?: string;
|
|
99
103
|
refs?: Refs;
|
|
100
104
|
}
|
package/es/utils/api/rest-api.js
CHANGED
|
@@ -8,6 +8,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
8
|
import axios from "axios";
|
|
9
9
|
import { onFulfilled, onRejected } from "./index";
|
|
10
10
|
import { transformerId } from "../data";
|
|
11
|
+
import { showForm } from "../page";
|
|
11
12
|
export var BaseRestApi = /*#__PURE__*/function () {
|
|
12
13
|
function BaseRestApi(uri, options) {
|
|
13
14
|
this.uri = void 0;
|
|
@@ -84,7 +85,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
84
85
|
_context2.next = 12;
|
|
85
86
|
break;
|
|
86
87
|
}
|
|
87
|
-
this.showError("\u83B7\u53D6{" + id + "}\u5931\u8D25!", res
|
|
88
|
+
this.showError("\u83B7\u53D6{" + id + "}\u5931\u8D25!", res).then();
|
|
88
89
|
_context2.next = 10;
|
|
89
90
|
return options === null || options === void 0 ? void 0 : (_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options, res);
|
|
90
91
|
case 10:
|
|
@@ -125,7 +126,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
125
126
|
_context3.next = 12;
|
|
126
127
|
break;
|
|
127
128
|
}
|
|
128
|
-
this.showError("\u63D0\u4EA4\u5931\u8D25!", res
|
|
129
|
+
this.showError("\u63D0\u4EA4\u5931\u8D25!", res).then();
|
|
129
130
|
_context3.next = 10;
|
|
130
131
|
return options === null || options === void 0 ? void 0 : (_options$onError2 = options.onError) === null || _options$onError2 === void 0 ? void 0 : _options$onError2.call(options, res);
|
|
131
132
|
case 10:
|
|
@@ -172,7 +173,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
172
173
|
_context4.next = 12;
|
|
173
174
|
break;
|
|
174
175
|
}
|
|
175
|
-
this.showError("\u65B0\u589E\u5931\u8D25!", res
|
|
176
|
+
this.showError("\u65B0\u589E\u5931\u8D25!", res).then();
|
|
176
177
|
_context4.next = 10;
|
|
177
178
|
return options === null || options === void 0 ? void 0 : (_options$onError3 = options.onError) === null || _options$onError3 === void 0 ? void 0 : _options$onError3.call(options, res);
|
|
178
179
|
case 10:
|
|
@@ -219,7 +220,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
219
220
|
_context5.next = 12;
|
|
220
221
|
break;
|
|
221
222
|
}
|
|
222
|
-
this.showError("\u66F4\u65B0\u5931\u8D25!", res
|
|
223
|
+
this.showError("\u66F4\u65B0\u5931\u8D25!", res).then();
|
|
223
224
|
_context5.next = 10;
|
|
224
225
|
return options === null || options === void 0 ? void 0 : (_options$onError4 = options.onError) === null || _options$onError4 === void 0 ? void 0 : _options$onError4.call(options, res);
|
|
225
226
|
case 10:
|
|
@@ -266,7 +267,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
266
267
|
_context6.next = 12;
|
|
267
268
|
break;
|
|
268
269
|
}
|
|
269
|
-
this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res
|
|
270
|
+
this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res).then();
|
|
270
271
|
_context6.next = 10;
|
|
271
272
|
return options === null || options === void 0 ? void 0 : (_options$onError5 = options.onError) === null || _options$onError5 === void 0 ? void 0 : _options$onError5.call(options, res);
|
|
272
273
|
case 10:
|
|
@@ -323,7 +324,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
323
324
|
_context7.next = 18;
|
|
324
325
|
break;
|
|
325
326
|
}
|
|
326
|
-
this.showError("\u5220\u9664\u5931\u8D25!", res
|
|
327
|
+
this.showError("\u5220\u9664\u5931\u8D25!", res).then();
|
|
327
328
|
_context7.next = 16;
|
|
328
329
|
return options === null || options === void 0 ? void 0 : (_options$onError6 = options.onError) === null || _options$onError6 === void 0 ? void 0 : _options$onError6.call(options, res);
|
|
329
330
|
case 16:
|
|
@@ -344,62 +345,72 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
344
345
|
return _delete2.apply(this, arguments);
|
|
345
346
|
}
|
|
346
347
|
return _delete;
|
|
347
|
-
}()
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
348
|
+
}() // @ts-ignore
|
|
349
|
+
;
|
|
350
|
+
_proto.showError =
|
|
351
|
+
/*#__PURE__*/
|
|
352
|
+
function () {
|
|
353
|
+
var _showError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(type, res) {
|
|
354
|
+
var msg, props, content;
|
|
351
355
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
352
356
|
while (1) switch (_context8.prev = _context8.next) {
|
|
353
357
|
case 0:
|
|
354
|
-
|
|
358
|
+
msg = res.message;
|
|
359
|
+
_context8.prev = 1;
|
|
355
360
|
if (!msg) {
|
|
356
|
-
_context8.next =
|
|
361
|
+
_context8.next = 21;
|
|
357
362
|
break;
|
|
358
363
|
}
|
|
359
364
|
props = JSON.parse(msg);
|
|
360
|
-
|
|
365
|
+
content = /*#__PURE__*/React.createElement(ErrorContent, {
|
|
366
|
+
requestId: res.requestId,
|
|
367
|
+
message: props.message
|
|
368
|
+
});
|
|
369
|
+
props.content = content;
|
|
370
|
+
props.message = content;
|
|
361
371
|
if (!props.title) {
|
|
362
372
|
props.title = "" + this.title + type;
|
|
363
373
|
}
|
|
364
374
|
if (!(props.type == "message")) {
|
|
365
|
-
_context8.next =
|
|
375
|
+
_context8.next = 13;
|
|
366
376
|
break;
|
|
367
377
|
}
|
|
368
378
|
_message.error(props);
|
|
369
379
|
return _context8.abrupt("return");
|
|
370
|
-
case
|
|
380
|
+
case 13:
|
|
371
381
|
if (!(props.type == "modal")) {
|
|
372
|
-
_context8.next =
|
|
382
|
+
_context8.next = 18;
|
|
373
383
|
break;
|
|
374
384
|
}
|
|
375
385
|
_Modal.error(props);
|
|
376
386
|
return _context8.abrupt("return");
|
|
377
|
-
case
|
|
387
|
+
case 18:
|
|
378
388
|
if (!(props.type == "notification")) {
|
|
379
|
-
_context8.next =
|
|
389
|
+
_context8.next = 21;
|
|
380
390
|
break;
|
|
381
391
|
}
|
|
382
392
|
_notification.error(props);
|
|
383
393
|
return _context8.abrupt("return");
|
|
384
|
-
case
|
|
385
|
-
_context8.next =
|
|
394
|
+
case 21:
|
|
395
|
+
_context8.next = 27;
|
|
386
396
|
break;
|
|
387
|
-
case
|
|
388
|
-
_context8.prev =
|
|
389
|
-
_context8.t0 = _context8["catch"](
|
|
397
|
+
case 23:
|
|
398
|
+
_context8.prev = 23;
|
|
399
|
+
_context8.t0 = _context8["catch"](1);
|
|
390
400
|
console.error("" + this.title + type + (msg || ""));
|
|
391
401
|
_Modal.error({
|
|
392
402
|
title: "" + this.title + type,
|
|
393
403
|
centered: true,
|
|
394
|
-
content: /*#__PURE__*/React.createElement(
|
|
395
|
-
|
|
396
|
-
|
|
404
|
+
content: /*#__PURE__*/React.createElement(ErrorContent, {
|
|
405
|
+
requestId: res.requestId,
|
|
406
|
+
message: res.message
|
|
407
|
+
})
|
|
397
408
|
});
|
|
398
|
-
case
|
|
409
|
+
case 27:
|
|
399
410
|
case "end":
|
|
400
411
|
return _context8.stop();
|
|
401
412
|
}
|
|
402
|
-
}, _callee8, this, [[
|
|
413
|
+
}, _callee8, this, [[1, 23]]);
|
|
403
414
|
}));
|
|
404
415
|
function showError(_x15, _x16) {
|
|
405
416
|
return _showError.apply(this, arguments);
|
|
@@ -408,13 +419,32 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
408
419
|
}();
|
|
409
420
|
return BaseRestApi;
|
|
410
421
|
}();
|
|
411
|
-
function
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
422
|
+
function ErrorContent(props) {
|
|
423
|
+
var content = /*#__PURE__*/React.createElement(_Typography.Text, {
|
|
424
|
+
type: "danger",
|
|
425
|
+
style: {
|
|
426
|
+
whiteSpace: "pre-wrap"
|
|
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;
|
|
416
447
|
}
|
|
417
|
-
return null;
|
|
418
448
|
}
|
|
419
449
|
export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
|
|
420
450
|
function RestApi(uri, options) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { schema } from "../cache";
|
|
4
|
+
export function getSchema(_x, _x2) {
|
|
5
|
+
return _getSchema.apply(this, arguments);
|
|
6
|
+
}
|
|
7
|
+
function _getSchema() {
|
|
8
|
+
_getSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageId, mock) {
|
|
9
|
+
var key;
|
|
10
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
+
while (1) switch (_context.prev = _context.next) {
|
|
12
|
+
case 0:
|
|
13
|
+
if (typeof mock != "boolean") {
|
|
14
|
+
if (typeof window.__mock == "boolean") {
|
|
15
|
+
mock = window.__mock;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
key = mock ? pageId + "_mock" : pageId;
|
|
19
|
+
_context.next = 4;
|
|
20
|
+
return schema.getInstance(key, {
|
|
21
|
+
mock: mock,
|
|
22
|
+
pageId: pageId
|
|
23
|
+
});
|
|
24
|
+
case 4:
|
|
25
|
+
return _context.abrupt("return", _context.sent);
|
|
26
|
+
case 5:
|
|
27
|
+
case "end":
|
|
28
|
+
return _context.stop();
|
|
29
|
+
}
|
|
30
|
+
}, _callee);
|
|
31
|
+
}));
|
|
32
|
+
return _getSchema.apply(this, arguments);
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadDts(): Promise<any[]>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { getFormApi } from "./index";
|
|
4
|
+
export function loadDts() {
|
|
5
|
+
return _loadDts.apply(this, arguments);
|
|
6
|
+
}
|
|
7
|
+
function _loadDts() {
|
|
8
|
+
_loadDts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
9
|
+
var api, res;
|
|
10
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
+
while (1) switch (_context.prev = _context.next) {
|
|
12
|
+
case 0:
|
|
13
|
+
_context.prev = 0;
|
|
14
|
+
_context.next = 3;
|
|
15
|
+
return getFormApi("form_bea7fcc6376c4461965237056f970fb7");
|
|
16
|
+
case 3:
|
|
17
|
+
api = _context.sent;
|
|
18
|
+
_context.next = 6;
|
|
19
|
+
return api.search({
|
|
20
|
+
pageSize: 1000,
|
|
21
|
+
searchFields: [{
|
|
22
|
+
key: "type",
|
|
23
|
+
operator: "eq",
|
|
24
|
+
value: "dts"
|
|
25
|
+
}]
|
|
26
|
+
});
|
|
27
|
+
case 6:
|
|
28
|
+
res = _context.sent;
|
|
29
|
+
return _context.abrupt("return", res.data || []);
|
|
30
|
+
case 10:
|
|
31
|
+
_context.prev = 10;
|
|
32
|
+
_context.t0 = _context["catch"](0);
|
|
33
|
+
return _context.abrupt("return", []);
|
|
34
|
+
case 13:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}, _callee, null, [[0, 10]]);
|
|
39
|
+
}));
|
|
40
|
+
return _loadDts.apply(this, arguments);
|
|
41
|
+
}
|
|
@@ -62,15 +62,10 @@ 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
|
|
65
|
+
var 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
|
-
};
|
|
74
69
|
//加载式样
|
|
75
70
|
target = doc.querySelector("link[href='" + src + "']");
|
|
76
71
|
if (!target) {
|
|
@@ -78,16 +73,16 @@ function _loadStyle() {
|
|
|
78
73
|
target.href = src;
|
|
79
74
|
target.rel = "stylesheet";
|
|
80
75
|
target.onload = function () {
|
|
81
|
-
|
|
76
|
+
resolve(true);
|
|
82
77
|
};
|
|
83
78
|
target.onerror = function () {
|
|
84
|
-
|
|
79
|
+
resolve(false);
|
|
85
80
|
};
|
|
86
81
|
doc.head.appendChild(target);
|
|
87
82
|
} else {
|
|
88
|
-
|
|
83
|
+
resolve(true);
|
|
89
84
|
}
|
|
90
|
-
case
|
|
85
|
+
case 2:
|
|
91
86
|
case "end":
|
|
92
87
|
return _context2.stop();
|
|
93
88
|
}
|
|
@@ -125,10 +120,8 @@ function _loadScript() {
|
|
|
125
120
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
126
121
|
while (1) switch (_context4.prev = _context4.next) {
|
|
127
122
|
case 0:
|
|
128
|
-
callback = function
|
|
129
|
-
|
|
130
|
-
resolve(status);
|
|
131
|
-
}, 10);
|
|
123
|
+
callback = function _callback(status) {
|
|
124
|
+
resolve(status);
|
|
132
125
|
};
|
|
133
126
|
//加载脚本
|
|
134
127
|
target = doc.querySelector("script[src='" + src + "']");
|
|
@@ -139,10 +132,10 @@ function _loadScript() {
|
|
|
139
132
|
}
|
|
140
133
|
target.src = src;
|
|
141
134
|
target.onload = function () {
|
|
142
|
-
|
|
135
|
+
callback(true);
|
|
143
136
|
};
|
|
144
137
|
target.onerror = function () {
|
|
145
|
-
|
|
138
|
+
callback(false);
|
|
146
139
|
};
|
|
147
140
|
doc.body.appendChild(target);
|
|
148
141
|
} else {
|
package/es/utils/common/index.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { v4 } from "uuid";
|
|
2
2
|
export { loadPlugins } from "./LoadPlugins";
|
|
3
3
|
export function uuid(prefix, separator) {
|
|
4
|
+
if (!prefix && !separator) {
|
|
5
|
+
return v4();
|
|
6
|
+
}
|
|
4
7
|
return [prefix, separator, v4()].filter(function (v) {
|
|
5
8
|
return !!v;
|
|
6
9
|
}).join("");
|
|
10
|
+
}
|
|
11
|
+
export function toArray(data) {
|
|
12
|
+
if (!data) {
|
|
13
|
+
return [];
|
|
14
|
+
} else if (Array.isArray(data)) {
|
|
15
|
+
return data;
|
|
16
|
+
} else {
|
|
17
|
+
return [data];
|
|
18
|
+
}
|
|
7
19
|
}
|
package/es/utils/page/index.d.ts
CHANGED
|
@@ -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/es/utils/page/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
export { showForm } from "./page-form";
|
|
4
4
|
export { showFormDataManager } from "./page-form-data-manager";
|
|
5
|
+
export { showFormDataManagerGroup } from "./page-form-data-manager-group";
|
|
6
|
+
export { show } from "./page-show";
|
|
5
7
|
var timerRef;
|
|
6
8
|
function debounceHide() {
|
|
7
9
|
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,104 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
4
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
+
var _excluded = ["layout", "items", "onSelectOk", "onClose"],
|
|
6
|
+
_excluded2 = ["container", "onClose"];
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
+
import { PageLayout } from "./page-layout";
|
|
9
|
+
import React, { Component } from "react";
|
|
10
|
+
import { ReactRender } from "../../components/react-render";
|
|
11
|
+
import { cloneDataView } from "./page-schema-utils";
|
|
12
|
+
import { renderElement } from "./page-render";
|
|
13
|
+
import { v4 } from "uuid";
|
|
14
|
+
export function showFormDataManagerGroup(_x) {
|
|
15
|
+
return _showFormDataManagerGroup.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
function _showFormDataManagerGroup() {
|
|
18
|
+
_showFormDataManagerGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
19
|
+
var container, onClose, props;
|
|
20
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
container = options.container, onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
|
|
24
|
+
return _context.abrupt("return", renderElement({
|
|
25
|
+
container: container,
|
|
26
|
+
onClose: onClose,
|
|
27
|
+
element: {
|
|
28
|
+
component: FormDataManagerRender,
|
|
29
|
+
props: props
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
case 2:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
35
|
+
}
|
|
36
|
+
}, _callee);
|
|
37
|
+
}));
|
|
38
|
+
return _showFormDataManagerGroup.apply(this, arguments);
|
|
39
|
+
}
|
|
40
|
+
var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
41
|
+
function FormDataManagerRender() {
|
|
42
|
+
var _this;
|
|
43
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
|
+
args[_key] = arguments[_key];
|
|
45
|
+
}
|
|
46
|
+
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
47
|
+
_this.layoutRef = void 0;
|
|
48
|
+
return _this;
|
|
49
|
+
}
|
|
50
|
+
_inheritsLoose(FormDataManagerRender, _Component);
|
|
51
|
+
var _proto = FormDataManagerRender.prototype;
|
|
52
|
+
_proto.render = function render() {
|
|
53
|
+
var _this2 = this;
|
|
54
|
+
var self = this;
|
|
55
|
+
var _this$props = this.props,
|
|
56
|
+
layout = _this$props.layout,
|
|
57
|
+
items = _this$props.items,
|
|
58
|
+
onSelectOk = _this$props.onSelectOk,
|
|
59
|
+
onClose = _this$props.onClose,
|
|
60
|
+
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
restProps.layout = layout || "modal";
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
restProps.onClose = function () {
|
|
65
|
+
var _self$layoutRef;
|
|
66
|
+
(_self$layoutRef = self.layoutRef) === null || _self$layoutRef === void 0 ? void 0 : _self$layoutRef.close();
|
|
67
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
68
|
+
};
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
restProps.onSelectOk = function (data) {
|
|
71
|
+
var _self$layoutRef2;
|
|
72
|
+
(_self$layoutRef2 = self.layoutRef) === null || _self$layoutRef2 === void 0 ? void 0 : _self$layoutRef2.close();
|
|
73
|
+
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
|
|
74
|
+
};
|
|
75
|
+
var fdmItems = (items === null || items === void 0 ? void 0 : items.map(function (item) {
|
|
76
|
+
return _extends({}, item, {
|
|
77
|
+
dataView: cloneDataView(_this2.props.extraProps, item.dataView)
|
|
78
|
+
});
|
|
79
|
+
})) || [];
|
|
80
|
+
return /*#__PURE__*/React.createElement(PageLayout, {
|
|
81
|
+
layout: layout,
|
|
82
|
+
ref: function ref(layout) {
|
|
83
|
+
return _this2.layoutRef = layout;
|
|
84
|
+
}
|
|
85
|
+
}, /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
|
|
86
|
+
components: window._components || window.components || window.__components,
|
|
87
|
+
schema: {
|
|
88
|
+
id: v4(),
|
|
89
|
+
componentName: "Page",
|
|
90
|
+
props: {},
|
|
91
|
+
state: {},
|
|
92
|
+
children: [{
|
|
93
|
+
componentName: "PageFdmGroup",
|
|
94
|
+
props: {
|
|
95
|
+
mode: restProps.mode,
|
|
96
|
+
defaultSelectedRows: restProps.defaultSelectedRows,
|
|
97
|
+
items: fdmItems
|
|
98
|
+
}
|
|
99
|
+
}]
|
|
100
|
+
}
|
|
101
|
+
})));
|
|
102
|
+
};
|
|
103
|
+
return FormDataManagerRender;
|
|
104
|
+
}(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>;
|