@zhubangyun/lowcode-core 5.12.161 → 6.1.90
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 +38 -22
- package/es/components/page-loading/index.js +4 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +41 -2
- package/es/index.less +10 -0
- package/es/style.js +2 -2
- package/es/utils/api/form-api.d.ts +1 -0
- package/es/utils/api/form-api.js +68 -29
- package/es/utils/api/index.d.ts +1 -1
- package/es/utils/api/index.js +1 -0
- package/es/utils/api/rest-api.d.ts +3 -1
- package/es/utils/api/rest-api.js +105 -23
- package/es/utils/api/schema.util.d.ts +3 -3
- package/es/utils/api/schema.util.js +17 -12
- package/es/utils/cache/index.js +57 -17
- package/es/utils/common/index.d.ts +3 -0
- package/es/utils/common/index.js +13 -3
- package/es/utils/page/page-form-data-manager-group.js +2 -2
- package/es/utils/page/page-form-data-manager.d.ts +1 -0
- package/es/utils/page/page-form-data-manager.js +2 -2
- package/es/utils/page/page-form-group.d.ts +1 -0
- package/es/utils/page/page-form-group.js +2 -2
- package/es/utils/page/page-form.d.ts +1 -0
- package/es/utils/page/page-form.js +12 -2
- package/es/utils/page/page-layout.d.ts +1 -0
- package/es/utils/page/page-layout.js +22 -5
- package/es/utils/page/page-load-schema.js +20 -28
- package/es/utils/page/page-show.d.ts +2 -0
- package/es/utils/page/page-show.js +5 -0
- package/es/utils/page/print-form.js +25 -16
- package/es/utils/uni-bridge.d.ts +18 -0
- package/es/utils/uni-bridge.js +130 -0
- package/es/utils/util.common.d.ts +1 -0
- package/es/utils/util.common.js +4 -0
- package/lib/components/load-materials/index.js +38 -22
- package/lib/components/page-loading/index.js +4 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +44 -4
- package/lib/index.less +10 -0
- package/lib/style.js +2 -2
- package/lib/utils/api/form-api.d.ts +1 -0
- package/lib/utils/api/form-api.js +68 -29
- package/lib/utils/api/index.d.ts +1 -1
- package/lib/utils/api/index.js +1 -0
- package/lib/utils/api/rest-api.d.ts +3 -1
- package/lib/utils/api/rest-api.js +105 -23
- package/lib/utils/api/schema.util.d.ts +3 -3
- package/lib/utils/api/schema.util.js +19 -13
- package/lib/utils/cache/index.js +56 -16
- package/lib/utils/common/index.d.ts +3 -0
- package/lib/utils/common/index.js +15 -2
- package/lib/utils/page/page-form-data-manager-group.js +2 -2
- package/lib/utils/page/page-form-data-manager.d.ts +1 -0
- package/lib/utils/page/page-form-data-manager.js +2 -2
- package/lib/utils/page/page-form-group.d.ts +1 -0
- package/lib/utils/page/page-form-group.js +2 -2
- package/lib/utils/page/page-form.d.ts +1 -0
- package/lib/utils/page/page-form.js +12 -2
- package/lib/utils/page/page-layout.d.ts +1 -0
- package/lib/utils/page/page-layout.js +22 -5
- package/lib/utils/page/page-load-schema.js +19 -27
- package/lib/utils/page/page-show.d.ts +2 -0
- package/lib/utils/page/page-show.js +5 -0
- package/lib/utils/page/print-form.js +25 -16
- package/lib/utils/uni-bridge.d.ts +18 -0
- package/lib/utils/uni-bridge.js +135 -0
- package/lib/utils/util.common.d.ts +1 -0
- package/lib/utils/util.common.js +8 -0
- package/package.json +2 -2
|
@@ -3,16 +3,23 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
3
3
|
import React, { useEffect, useState } from "react";
|
|
4
4
|
import { PageLoading } from "../page-loading";
|
|
5
5
|
import { loadPlugins } from "../../utils/common";
|
|
6
|
+
function getInit() {
|
|
7
|
+
if (window._components) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
if (window.AntdProMaterial) {
|
|
11
|
+
setComponents();
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
6
16
|
export function LoadMaterials(props) {
|
|
7
|
-
var _useState = useState(
|
|
17
|
+
var _useState = useState(getInit()),
|
|
8
18
|
init = _useState[0],
|
|
9
19
|
setInit = _useState[1];
|
|
10
20
|
useEffect(function () {
|
|
11
21
|
initialize().then();
|
|
12
22
|
}, []);
|
|
13
|
-
if (window._components) {
|
|
14
|
-
return props.children;
|
|
15
|
-
}
|
|
16
23
|
function initialize() {
|
|
17
24
|
return _initialize.apply(this, arguments);
|
|
18
25
|
}
|
|
@@ -21,11 +28,17 @@ export function LoadMaterials(props) {
|
|
|
21
28
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
22
29
|
while (1) switch (_context.prev = _context.next) {
|
|
23
30
|
case 0:
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
if (!init) {
|
|
32
|
+
_context.next = 1;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
return _context.abrupt("return");
|
|
26
36
|
case 1:
|
|
27
|
-
|
|
37
|
+
_context.next = 2;
|
|
38
|
+
return loadMaterials();
|
|
28
39
|
case 2:
|
|
40
|
+
setInit(true);
|
|
41
|
+
case 3:
|
|
29
42
|
case "end":
|
|
30
43
|
return _context.stop();
|
|
31
44
|
}
|
|
@@ -46,35 +59,23 @@ function loadMaterials() {
|
|
|
46
59
|
}
|
|
47
60
|
function _loadMaterials() {
|
|
48
61
|
_loadMaterials = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
49
|
-
var
|
|
62
|
+
var urls;
|
|
50
63
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
51
64
|
while (1) switch (_context2.prev = _context2.next) {
|
|
52
65
|
case 0:
|
|
53
|
-
components = {};
|
|
54
66
|
if (!window._components) {
|
|
55
67
|
_context2.next = 1;
|
|
56
68
|
break;
|
|
57
69
|
}
|
|
58
70
|
return _context2.abrupt("return");
|
|
59
71
|
case 1:
|
|
60
|
-
urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.17.15/lodash.min.js", "dayjs/dayjs.min.js", "
|
|
72
|
+
urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.17.15/lodash.min.js", "dayjs/dayjs.min.js", "antdIcon/1.0.0/antdIcon.min.js", "lowcode/core/index.js", "lowcode/core/index.css", "lowcode/materials/root/view.js", "lowcode/materials/root/view.css", "lowcode/materials/antd/view.js", "lowcode/materials/antd/view.css", "lowcode/materials/antd-pro/view.js", "lowcode/materials/antd-pro/view.css", "lowcode/icon-font/app/iconfont.js"];
|
|
61
73
|
_context2.next = 2;
|
|
62
74
|
return loadPlugins(urls.map(function (url) {
|
|
63
75
|
return "https://cdn.zhiyunhe.com/plugin/" + url;
|
|
64
76
|
}));
|
|
65
77
|
case 2:
|
|
66
|
-
|
|
67
|
-
var data = window[lib];
|
|
68
|
-
if (data) {
|
|
69
|
-
Object.entries(data).forEach(function (_ref) {
|
|
70
|
-
var key = _ref[0],
|
|
71
|
-
value = _ref[1];
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
components[key] = value;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
window._components = components;
|
|
78
|
+
setComponents();
|
|
78
79
|
case 3:
|
|
79
80
|
case "end":
|
|
80
81
|
return _context2.stop();
|
|
@@ -82,4 +83,19 @@ function _loadMaterials() {
|
|
|
82
83
|
}, _callee2);
|
|
83
84
|
}));
|
|
84
85
|
return _loadMaterials.apply(this, arguments);
|
|
86
|
+
}
|
|
87
|
+
function setComponents() {
|
|
88
|
+
var components = {};
|
|
89
|
+
["RootMaterial", "AntdMaterial", "AntdProMaterial"].forEach(function (lib) {
|
|
90
|
+
var data = window[lib];
|
|
91
|
+
if (data) {
|
|
92
|
+
Object.entries(data).forEach(function (_ref) {
|
|
93
|
+
var key = _ref[0],
|
|
94
|
+
value = _ref[1];
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
components[key] = value;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
window._components = components;
|
|
85
101
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import "./index.less";
|
|
2
|
+
import { useEffect } from "react";
|
|
2
3
|
export function PageLoading(props) {
|
|
3
4
|
var loading = props.loading,
|
|
4
5
|
_props$background = props.background,
|
|
5
6
|
background = _props$background === void 0 ? "#f1f1f1" : _props$background,
|
|
6
7
|
children = props.children;
|
|
8
|
+
useEffect(function () {}, [loading]);
|
|
7
9
|
return /*#__PURE__*/React.createElement("div", {
|
|
8
10
|
className: "page-loading-wrapper",
|
|
9
11
|
style: {
|
|
10
12
|
width: "100%",
|
|
11
|
-
height: "100%"
|
|
13
|
+
height: "100%",
|
|
14
|
+
background: "rgba(0,0,0,0)"
|
|
12
15
|
}
|
|
13
16
|
}, children, loading && /*#__PURE__*/React.createElement("div", {
|
|
14
17
|
className: "page-loading",
|
package/es/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./index.less";
|
|
2
|
-
import utils from "./utils";
|
|
3
2
|
import * as lodash from "lodash";
|
|
4
3
|
export { LoadMaterials } from "./components/load-materials";
|
|
5
4
|
export { PageLoading } from "./components/page-loading";
|
|
6
5
|
export { RestApi, RestFormApi, apiRequest } from "./utils/api";
|
|
7
6
|
export { Layout } from "./components/layout";
|
|
8
7
|
export { ReactRender } from "./components/react-render";
|
|
8
|
+
import utils from "./utils/index";
|
|
9
9
|
export { utils, lodash };
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
1
3
|
import "./index.less";
|
|
2
|
-
import utils from "./utils";
|
|
3
4
|
import { ReactRender } from "./components/react-render";
|
|
4
5
|
import * as lodash from "lodash";
|
|
5
6
|
export { LoadMaterials } from "./components/load-materials";
|
|
@@ -7,7 +8,8 @@ export { PageLoading } from "./components/page-loading";
|
|
|
7
8
|
export { RestApi, RestFormApi, apiRequest } from "./utils/api";
|
|
8
9
|
export { Layout } from "./components/layout";
|
|
9
10
|
export { ReactRender } from "./components/react-render";
|
|
10
|
-
|
|
11
|
+
import utils from "./utils/index";
|
|
12
|
+
import { uniBridge } from "./utils/uni-bridge";
|
|
11
13
|
// @ts-ignore
|
|
12
14
|
window.__ReactRender = ReactRender;
|
|
13
15
|
// @ts-ignore
|
|
@@ -20,4 +22,41 @@ if (!window.utils) {
|
|
|
20
22
|
// @ts-ignore
|
|
21
23
|
window.utils = utils;
|
|
22
24
|
}
|
|
25
|
+
window.isMobile = utils.common.isMobile();
|
|
26
|
+
if (window.isMobile) {
|
|
27
|
+
var classList = window.document.body.classList;
|
|
28
|
+
if (!classList.contains("mobile")) {
|
|
29
|
+
classList.add("mobile");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
var bar_height_key = "bar_height";
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
utils.uniBridge = uniBridge;
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
window.uniBridge = uniBridge;
|
|
37
|
+
window.addEventListener("load", function () {
|
|
38
|
+
setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
39
|
+
var height;
|
|
40
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
41
|
+
while (1) switch (_context.prev = _context.next) {
|
|
42
|
+
case 0:
|
|
43
|
+
_context.next = 1;
|
|
44
|
+
return uniBridge.getBarHeight();
|
|
45
|
+
case 1:
|
|
46
|
+
height = _context.sent;
|
|
47
|
+
localStorage.setItem(bar_height_key, height);
|
|
48
|
+
updateBarHeight();
|
|
49
|
+
case 2:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}, _callee);
|
|
54
|
+
})), 100);
|
|
55
|
+
});
|
|
56
|
+
function updateBarHeight() {
|
|
57
|
+
if (localStorage.getItem(bar_height_key)) {
|
|
58
|
+
document.documentElement.style.setProperty('--bar-height', localStorage.getItem(bar_height_key));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
updateBarHeight();
|
|
23
62
|
export { utils, lodash };
|
package/es/index.less
CHANGED
package/es/style.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import 'antd/es/config-provider/style';
|
|
2
|
+
|
|
1
3
|
import 'antd/es/notification/style';
|
|
2
4
|
import 'antd/es/modal/style';
|
|
3
5
|
import 'antd/es/message/style';
|
|
4
6
|
import 'antd/es/typography/style';
|
|
5
7
|
import 'antd/es/drawer/style';
|
|
6
8
|
import 'antd/es/result/style';
|
|
7
|
-
import 'antd/es/config-provider/style';
|
|
8
|
-
|
|
9
9
|
import './index.less';
|
|
@@ -12,6 +12,7 @@ export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
|
12
12
|
handleRequestConfig(config: AxiosRequestConfig): Promise<void>;
|
|
13
13
|
search(searchParams?: RestSearchParams): Promise<ManyResult<DataType>>;
|
|
14
14
|
getById(id: string, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
15
|
+
labelToValue(data: any[], options?: any): Promise<ManyResult<DataType>>;
|
|
15
16
|
save(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
16
17
|
create(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
17
18
|
update(id: string, data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
package/es/utils/api/form-api.js
CHANGED
|
@@ -6,14 +6,15 @@ import { RestApi } from "./rest-api";
|
|
|
6
6
|
import { assembleAssociationField, convertSaveData, handleFilterRules } from "./form-api.utils";
|
|
7
7
|
import { formApi } from "../cache";
|
|
8
8
|
import { getSchemaFromCache } from "./schema-api";
|
|
9
|
+
import { uuid } from "../common";
|
|
9
10
|
export function getFormApi(_x, _x2, _x3) {
|
|
10
11
|
return _getFormApi.apply(this, arguments);
|
|
11
12
|
}
|
|
12
13
|
function _getFormApi() {
|
|
13
|
-
_getFormApi = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
14
|
+
_getFormApi = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(formId, fieldId, mock) {
|
|
14
15
|
var key;
|
|
15
|
-
return _regeneratorRuntime.wrap(function (
|
|
16
|
-
while (1) switch (
|
|
16
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
17
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
17
18
|
case 0:
|
|
18
19
|
if (typeof mock != "boolean") {
|
|
19
20
|
if (typeof window.__mock == "boolean") {
|
|
@@ -23,16 +24,16 @@ function _getFormApi() {
|
|
|
23
24
|
key = [formId, fieldId, mock ? "mock" : ""].filter(function (key) {
|
|
24
25
|
return !!key;
|
|
25
26
|
}).join("_");
|
|
26
|
-
return
|
|
27
|
+
return _context0.abrupt("return", formApi.getInstance(key, {
|
|
27
28
|
mock: mock,
|
|
28
29
|
fieldId: fieldId,
|
|
29
30
|
formId: formId
|
|
30
31
|
}));
|
|
31
32
|
case 1:
|
|
32
33
|
case "end":
|
|
33
|
-
return
|
|
34
|
+
return _context0.stop();
|
|
34
35
|
}
|
|
35
|
-
},
|
|
36
|
+
}, _callee0);
|
|
36
37
|
}));
|
|
37
38
|
return _getFormApi.apply(this, arguments);
|
|
38
39
|
}
|
|
@@ -205,62 +206,100 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
205
206
|
}
|
|
206
207
|
return getById;
|
|
207
208
|
}();
|
|
208
|
-
_proto.
|
|
209
|
-
var
|
|
209
|
+
_proto.labelToValue = /*#__PURE__*/function () {
|
|
210
|
+
var _labelToValue = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data, options) {
|
|
211
|
+
var _this3 = this;
|
|
212
|
+
var config, res;
|
|
210
213
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
211
214
|
while (1) switch (_context5.prev = _context5.next) {
|
|
212
215
|
case 0:
|
|
213
|
-
|
|
216
|
+
config = {};
|
|
217
|
+
_context5.next = 1;
|
|
218
|
+
return this.handleRequestConfig(config);
|
|
214
219
|
case 1:
|
|
220
|
+
_context5.next = 2;
|
|
221
|
+
return this.request.post("labelToValue", data, config);
|
|
222
|
+
case 2:
|
|
223
|
+
res = _context5.sent;
|
|
224
|
+
if (Array.isArray(res.data)) {
|
|
225
|
+
res.data.forEach(function (item) {
|
|
226
|
+
item.id = uuid();
|
|
227
|
+
item.form = {
|
|
228
|
+
id: _this3.formId,
|
|
229
|
+
fieldId: _this3.fieldId
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
assembleAssociationField(res.data, res.refs);
|
|
234
|
+
console.debug("formApi.labelToValue", res);
|
|
235
|
+
return _context5.abrupt("return", res);
|
|
236
|
+
case 3:
|
|
215
237
|
case "end":
|
|
216
238
|
return _context5.stop();
|
|
217
239
|
}
|
|
218
240
|
}, _callee5, this);
|
|
219
241
|
}));
|
|
220
|
-
function
|
|
221
|
-
return
|
|
242
|
+
function labelToValue(_x8, _x9) {
|
|
243
|
+
return _labelToValue.apply(this, arguments);
|
|
222
244
|
}
|
|
223
|
-
return
|
|
245
|
+
return labelToValue;
|
|
224
246
|
}();
|
|
225
|
-
_proto.
|
|
226
|
-
var
|
|
247
|
+
_proto.save = /*#__PURE__*/function () {
|
|
248
|
+
var _save = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data, options) {
|
|
227
249
|
return _regeneratorRuntime.wrap(function (_context6) {
|
|
228
250
|
while (1) switch (_context6.prev = _context6.next) {
|
|
229
251
|
case 0:
|
|
230
|
-
return _context6.abrupt("return", _RestApi.prototype.
|
|
252
|
+
return _context6.abrupt("return", _RestApi.prototype.save.call(this, convertSaveData(data), options));
|
|
231
253
|
case 1:
|
|
232
254
|
case "end":
|
|
233
255
|
return _context6.stop();
|
|
234
256
|
}
|
|
235
257
|
}, _callee6, this);
|
|
236
258
|
}));
|
|
237
|
-
function
|
|
238
|
-
return
|
|
259
|
+
function save(_x0, _x1) {
|
|
260
|
+
return _save.apply(this, arguments);
|
|
239
261
|
}
|
|
240
|
-
return
|
|
262
|
+
return save;
|
|
241
263
|
}();
|
|
242
|
-
_proto.
|
|
243
|
-
var
|
|
264
|
+
_proto.create = /*#__PURE__*/function () {
|
|
265
|
+
var _create = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data, options) {
|
|
244
266
|
return _regeneratorRuntime.wrap(function (_context7) {
|
|
245
267
|
while (1) switch (_context7.prev = _context7.next) {
|
|
246
268
|
case 0:
|
|
247
|
-
return _context7.abrupt("return", _RestApi.prototype.
|
|
269
|
+
return _context7.abrupt("return", _RestApi.prototype.create.call(this, convertSaveData(data), options));
|
|
248
270
|
case 1:
|
|
249
271
|
case "end":
|
|
250
272
|
return _context7.stop();
|
|
251
273
|
}
|
|
252
274
|
}, _callee7, this);
|
|
253
275
|
}));
|
|
254
|
-
function
|
|
276
|
+
function create(_x10, _x11) {
|
|
277
|
+
return _create.apply(this, arguments);
|
|
278
|
+
}
|
|
279
|
+
return create;
|
|
280
|
+
}();
|
|
281
|
+
_proto.update = /*#__PURE__*/function () {
|
|
282
|
+
var _update = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(id, data, options) {
|
|
283
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
284
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
285
|
+
case 0:
|
|
286
|
+
return _context8.abrupt("return", _RestApi.prototype.update.call(this, id, convertSaveData(data), options));
|
|
287
|
+
case 1:
|
|
288
|
+
case "end":
|
|
289
|
+
return _context8.stop();
|
|
290
|
+
}
|
|
291
|
+
}, _callee8, this);
|
|
292
|
+
}));
|
|
293
|
+
function update(_x12, _x13, _x14) {
|
|
255
294
|
return _update.apply(this, arguments);
|
|
256
295
|
}
|
|
257
296
|
return update;
|
|
258
297
|
}();
|
|
259
298
|
_proto.serviceUpdate = /*#__PURE__*/function () {
|
|
260
|
-
var _serviceUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
299
|
+
var _serviceUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data, options) {
|
|
261
300
|
var params;
|
|
262
|
-
return _regeneratorRuntime.wrap(function (
|
|
263
|
-
while (1) switch (
|
|
301
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
302
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
264
303
|
case 0:
|
|
265
304
|
params = {
|
|
266
305
|
formId: this.formId,
|
|
@@ -270,16 +309,16 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
270
309
|
params.mock = true;
|
|
271
310
|
params.description = (this.title || "表单") + ".\u67E5\u8BE2";
|
|
272
311
|
}
|
|
273
|
-
return
|
|
312
|
+
return _context9.abrupt("return", this.request.post("serviceUpdate", data, {
|
|
274
313
|
params: params
|
|
275
314
|
}));
|
|
276
315
|
case 1:
|
|
277
316
|
case "end":
|
|
278
|
-
return
|
|
317
|
+
return _context9.stop();
|
|
279
318
|
}
|
|
280
|
-
},
|
|
319
|
+
}, _callee9, this);
|
|
281
320
|
}));
|
|
282
|
-
function serviceUpdate(
|
|
321
|
+
function serviceUpdate(_x15, _x16) {
|
|
283
322
|
return _serviceUpdate.apply(this, arguments);
|
|
284
323
|
}
|
|
285
324
|
return serviceUpdate;
|
package/es/utils/api/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { AxiosResponse } from "axios";
|
|
1
2
|
export { RestApi } from "./rest-api";
|
|
2
3
|
export { getFormApi, RestFormApi } from "./form-api";
|
|
3
|
-
import { AxiosResponse } from "axios/index";
|
|
4
4
|
export { getSchema } from "./schema-api";
|
|
5
5
|
export { getUserinfo } from "./user-info";
|
|
6
6
|
export * as files from "./file-api";
|
package/es/utils/api/index.js
CHANGED
|
@@ -36,7 +36,7 @@ export declare abstract class BaseRestApi<DataType> {
|
|
|
36
36
|
title: string;
|
|
37
37
|
request: AxiosInstance;
|
|
38
38
|
protected constructor(uri: string, options?: RestApiOptions);
|
|
39
|
-
abstract handleRequestConfig(config: AxiosRequestConfig): void
|
|
39
|
+
abstract handleRequestConfig(config: AxiosRequestConfig): Promise<void>;
|
|
40
40
|
search(params?: RestSearchParams): Promise<ManyResult<DataType>>;
|
|
41
41
|
/**
|
|
42
42
|
* 通过id获取
|
|
@@ -58,6 +58,8 @@ export declare abstract class BaseRestApi<DataType> {
|
|
|
58
58
|
*/
|
|
59
59
|
deleteById(id: string, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
60
60
|
delete(data: any | any[], options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
61
|
+
export(data: any, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
62
|
+
import(data: any, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
61
63
|
showError(type: string, res: BaseResult<any>): Promise<void>;
|
|
62
64
|
}
|
|
63
65
|
export declare class RestApi<DataType> extends BaseRestApi<DataType> {
|
package/es/utils/api/rest-api.js
CHANGED
|
@@ -345,16 +345,98 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
345
345
|
}
|
|
346
346
|
return _delete;
|
|
347
347
|
}();
|
|
348
|
-
_proto
|
|
349
|
-
var
|
|
350
|
-
var
|
|
348
|
+
_proto["export"] = /*#__PURE__*/function () {
|
|
349
|
+
var _export2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data, options) {
|
|
350
|
+
var _this$handleRequestCo8;
|
|
351
|
+
var config, res, _options$onError7, _options$onSuccess7;
|
|
351
352
|
return _regeneratorRuntime.wrap(function (_context8) {
|
|
352
353
|
while (1) switch (_context8.prev = _context8.next) {
|
|
354
|
+
case 0:
|
|
355
|
+
config = {};
|
|
356
|
+
_context8.next = 1;
|
|
357
|
+
return (_this$handleRequestCo8 = this.handleRequestConfig) === null || _this$handleRequestCo8 === void 0 ? void 0 : _this$handleRequestCo8.call(this, config);
|
|
358
|
+
case 1:
|
|
359
|
+
_context8.next = 2;
|
|
360
|
+
return this.request.post("/export", data, config);
|
|
361
|
+
case 2:
|
|
362
|
+
res = _context8.sent;
|
|
363
|
+
if (res.success) {
|
|
364
|
+
_context8.next = 4;
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
this.showError("\u5BFC\u51FA\u5931\u8D25!", res).then();
|
|
368
|
+
_context8.next = 3;
|
|
369
|
+
return options === null || options === void 0 ? void 0 : (_options$onError7 = options.onError) === null || _options$onError7 === void 0 ? void 0 : _options$onError7.call(options, res);
|
|
370
|
+
case 3:
|
|
371
|
+
_context8.next = 5;
|
|
372
|
+
break;
|
|
373
|
+
case 4:
|
|
374
|
+
_context8.next = 5;
|
|
375
|
+
return options === null || options === void 0 ? void 0 : (_options$onSuccess7 = options.onSuccess) === null || _options$onSuccess7 === void 0 ? void 0 : _options$onSuccess7.call(options, res);
|
|
376
|
+
case 5:
|
|
377
|
+
return _context8.abrupt("return", res);
|
|
378
|
+
case 6:
|
|
379
|
+
case "end":
|
|
380
|
+
return _context8.stop();
|
|
381
|
+
}
|
|
382
|
+
}, _callee8, this);
|
|
383
|
+
}));
|
|
384
|
+
function _export(_x13, _x14) {
|
|
385
|
+
return _export2.apply(this, arguments);
|
|
386
|
+
}
|
|
387
|
+
return _export;
|
|
388
|
+
}();
|
|
389
|
+
_proto["import"] = /*#__PURE__*/function () {
|
|
390
|
+
var _import2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data, options) {
|
|
391
|
+
var _this$handleRequestCo9;
|
|
392
|
+
var config, res, _options$onError8, _options$onSuccess8;
|
|
393
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
394
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
395
|
+
case 0:
|
|
396
|
+
config = {};
|
|
397
|
+
_context9.next = 1;
|
|
398
|
+
return (_this$handleRequestCo9 = this.handleRequestConfig) === null || _this$handleRequestCo9 === void 0 ? void 0 : _this$handleRequestCo9.call(this, config);
|
|
399
|
+
case 1:
|
|
400
|
+
_context9.next = 2;
|
|
401
|
+
return this.request.post("import", data, config);
|
|
402
|
+
case 2:
|
|
403
|
+
res = _context9.sent;
|
|
404
|
+
if (res.success) {
|
|
405
|
+
_context9.next = 4;
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
this.showError("\u5BFC\u5165\u5931\u8D25!", res).then();
|
|
409
|
+
_context9.next = 3;
|
|
410
|
+
return options === null || options === void 0 ? void 0 : (_options$onError8 = options.onError) === null || _options$onError8 === void 0 ? void 0 : _options$onError8.call(options, res);
|
|
411
|
+
case 3:
|
|
412
|
+
_context9.next = 5;
|
|
413
|
+
break;
|
|
414
|
+
case 4:
|
|
415
|
+
_context9.next = 5;
|
|
416
|
+
return options === null || options === void 0 ? void 0 : (_options$onSuccess8 = options.onSuccess) === null || _options$onSuccess8 === void 0 ? void 0 : _options$onSuccess8.call(options, res);
|
|
417
|
+
case 5:
|
|
418
|
+
return _context9.abrupt("return", res);
|
|
419
|
+
case 6:
|
|
420
|
+
case "end":
|
|
421
|
+
return _context9.stop();
|
|
422
|
+
}
|
|
423
|
+
}, _callee9, this);
|
|
424
|
+
}));
|
|
425
|
+
function _import(_x15, _x16) {
|
|
426
|
+
return _import2.apply(this, arguments);
|
|
427
|
+
}
|
|
428
|
+
return _import;
|
|
429
|
+
}();
|
|
430
|
+
_proto.showError = /*#__PURE__*/function () {
|
|
431
|
+
var _showError = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(type, res) {
|
|
432
|
+
var msg, props, _t;
|
|
433
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
434
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
353
435
|
case 0:
|
|
354
436
|
msg = res.message;
|
|
355
|
-
|
|
437
|
+
_context0.prev = 1;
|
|
356
438
|
if (!msg) {
|
|
357
|
-
|
|
439
|
+
_context0.next = 4;
|
|
358
440
|
break;
|
|
359
441
|
}
|
|
360
442
|
props = JSON.parse(msg);
|
|
@@ -363,31 +445,31 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
363
445
|
props.title = "" + this.title + type;
|
|
364
446
|
}
|
|
365
447
|
if (!(props.type == "message")) {
|
|
366
|
-
|
|
448
|
+
_context0.next = 2;
|
|
367
449
|
break;
|
|
368
450
|
}
|
|
369
451
|
_message.error(props);
|
|
370
|
-
return
|
|
452
|
+
return _context0.abrupt("return");
|
|
371
453
|
case 2:
|
|
372
454
|
if (!(props.type == "modal")) {
|
|
373
|
-
|
|
455
|
+
_context0.next = 3;
|
|
374
456
|
break;
|
|
375
457
|
}
|
|
376
458
|
_Modal.error(props);
|
|
377
|
-
return
|
|
459
|
+
return _context0.abrupt("return");
|
|
378
460
|
case 3:
|
|
379
461
|
if (!(props.type == "notification")) {
|
|
380
|
-
|
|
462
|
+
_context0.next = 4;
|
|
381
463
|
break;
|
|
382
464
|
}
|
|
383
465
|
_notification.error(props);
|
|
384
|
-
return
|
|
466
|
+
return _context0.abrupt("return");
|
|
385
467
|
case 4:
|
|
386
|
-
|
|
468
|
+
_context0.next = 6;
|
|
387
469
|
break;
|
|
388
470
|
case 5:
|
|
389
|
-
|
|
390
|
-
_t =
|
|
471
|
+
_context0.prev = 5;
|
|
472
|
+
_t = _context0["catch"](1);
|
|
391
473
|
console.error("" + this.title + type + (msg || ""));
|
|
392
474
|
_Modal.error({
|
|
393
475
|
title: "" + this.title + type,
|
|
@@ -399,11 +481,11 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
399
481
|
});
|
|
400
482
|
case 6:
|
|
401
483
|
case "end":
|
|
402
|
-
return
|
|
484
|
+
return _context0.stop();
|
|
403
485
|
}
|
|
404
|
-
},
|
|
486
|
+
}, _callee0, this, [[1, 5]]);
|
|
405
487
|
}));
|
|
406
|
-
function showError(
|
|
488
|
+
function showError(_x17, _x18) {
|
|
407
489
|
return _showError.apply(this, arguments);
|
|
408
490
|
}
|
|
409
491
|
return showError;
|
|
@@ -425,16 +507,16 @@ export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
|
|
|
425
507
|
_inheritsLoose(RestApi, _BaseRestApi2);
|
|
426
508
|
var _proto2 = RestApi.prototype;
|
|
427
509
|
_proto2.handleRequestConfig = /*#__PURE__*/function () {
|
|
428
|
-
var _handleRequestConfig = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
429
|
-
return _regeneratorRuntime.wrap(function (
|
|
430
|
-
while (1) switch (
|
|
510
|
+
var _handleRequestConfig = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(config) {
|
|
511
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
512
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
431
513
|
case 0:
|
|
432
514
|
case "end":
|
|
433
|
-
return
|
|
515
|
+
return _context1.stop();
|
|
434
516
|
}
|
|
435
|
-
},
|
|
517
|
+
}, _callee1);
|
|
436
518
|
}));
|
|
437
|
-
function handleRequestConfig(
|
|
519
|
+
function handleRequestConfig(_x19) {
|
|
438
520
|
return _handleRequestConfig.apply(this, arguments);
|
|
439
521
|
}
|
|
440
522
|
return handleRequestConfig;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @param callback 返回true 继续往下遍历
|
|
5
5
|
*/
|
|
6
6
|
export declare function forEachSchema(schema: Schema, callback: (child: Schema, index: number, children: any[]) => boolean): void;
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
7
|
+
export declare function findFormSchemas(schema: Schema): Schema[];
|
|
8
|
+
export declare function findFdmSchemas(schema?: Schema): Schema[];
|
|
9
|
+
export interface Schema {
|
|
9
10
|
componentName: string;
|
|
10
11
|
props: any;
|
|
11
12
|
children?: Schema[];
|
|
12
13
|
fdmSchema?: Schema;
|
|
13
14
|
}
|
|
14
|
-
export {};
|