@zhubangyun/lowcode-core 5.12.91 → 5.12.161
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 +12 -12
- package/es/demo/index.js +8 -8
- package/es/utils/api/file-api.js +21 -21
- package/es/utils/api/form-api.d.ts +1 -1
- package/es/utils/api/form-api.js +38 -36
- package/es/utils/api/form-api.utils.js +5 -4
- package/es/utils/api/index.d.ts +1 -1
- package/es/utils/api/rest-api.js +116 -116
- package/es/utils/api/schema-api.js +5 -5
- package/es/utils/api/script-api.js +12 -12
- package/es/utils/api/user-info.js +7 -7
- package/es/utils/cache/index.js +14 -14
- package/es/utils/common/LoadPlugins.js +33 -33
- package/es/utils/common/SingletonInstanceMap.js +21 -21
- package/es/utils/designer/assets/assets.parse.js +15 -15
- package/es/utils/designer/assets/assets.typing.js +6 -0
- package/es/utils/designer/engine/index.js +23 -23
- package/es/utils/designer/index.js +7 -7
- package/es/utils/page/index.js +18 -18
- package/es/utils/page/page-form-data-manager-group.js +7 -4
- package/es/utils/page/page-form-data-manager.js +7 -4
- package/es/utils/page/page-form-group.js +6 -5
- package/es/utils/page/page-form.js +12 -11
- package/es/utils/page/page-layout.d.ts +2 -0
- package/es/utils/page/page-layout.js +14 -7
- package/es/utils/page/page-render.js +4 -4
- package/es/utils/page/page-show.js +3 -3
- package/es/utils/page/print-form.js +36 -36
- package/lib/components/load-materials/index.js +13 -14
- package/lib/demo/index.js +9 -10
- package/lib/index.js +1 -2
- package/lib/utils/api/file-api.js +21 -21
- package/lib/utils/api/form-api.d.ts +1 -1
- package/lib/utils/api/form-api.js +38 -36
- package/lib/utils/api/form-api.utils.js +5 -4
- package/lib/utils/api/index.d.ts +1 -1
- package/lib/utils/api/index.js +1 -2
- package/lib/utils/api/rest-api.js +116 -116
- package/lib/utils/api/schema-api.js +5 -5
- package/lib/utils/api/script-api.js +12 -12
- package/lib/utils/api/user-info.js +7 -7
- package/lib/utils/cache/index.js +14 -14
- package/lib/utils/common/LoadPlugins.js +33 -33
- package/lib/utils/common/SingletonInstanceMap.js +21 -21
- package/lib/utils/designer/assets/assets.parse.js +16 -17
- package/lib/utils/designer/assets/assets.typing.js +6 -0
- package/lib/utils/designer/engine/index.js +23 -23
- package/lib/utils/designer/index.js +7 -7
- package/lib/utils/index.js +1 -2
- package/lib/utils/page/index.js +18 -18
- package/lib/utils/page/page-form-data-manager-group.js +8 -6
- package/lib/utils/page/page-form-data-manager.js +8 -6
- package/lib/utils/page/page-form-group.js +7 -7
- package/lib/utils/page/page-form.js +13 -13
- package/lib/utils/page/page-layout.d.ts +2 -0
- package/lib/utils/page/page-layout.js +15 -9
- package/lib/utils/page/page-render.js +4 -4
- package/lib/utils/page/page-show.js +4 -5
- package/lib/utils/page/print-form.js +36 -36
- package/package.json +1 -1
|
@@ -17,15 +17,15 @@ export function LoadMaterials(props) {
|
|
|
17
17
|
return _initialize.apply(this, arguments);
|
|
18
18
|
}
|
|
19
19
|
function _initialize() {
|
|
20
|
-
_initialize = _asyncToGenerator(
|
|
21
|
-
return _regeneratorRuntime.wrap(function
|
|
20
|
+
_initialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
22
22
|
while (1) switch (_context.prev = _context.next) {
|
|
23
23
|
case 0:
|
|
24
|
-
_context.next =
|
|
24
|
+
_context.next = 1;
|
|
25
25
|
return loadMaterials();
|
|
26
|
-
case
|
|
26
|
+
case 1:
|
|
27
27
|
setInit(true);
|
|
28
|
-
case
|
|
28
|
+
case 2:
|
|
29
29
|
case "end":
|
|
30
30
|
return _context.stop();
|
|
31
31
|
}
|
|
@@ -45,24 +45,24 @@ function loadMaterials() {
|
|
|
45
45
|
return _loadMaterials.apply(this, arguments);
|
|
46
46
|
}
|
|
47
47
|
function _loadMaterials() {
|
|
48
|
-
_loadMaterials = _asyncToGenerator(
|
|
48
|
+
_loadMaterials = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
49
49
|
var components, urls;
|
|
50
|
-
return _regeneratorRuntime.wrap(function
|
|
50
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
51
51
|
while (1) switch (_context2.prev = _context2.next) {
|
|
52
52
|
case 0:
|
|
53
53
|
components = {};
|
|
54
54
|
if (!window._components) {
|
|
55
|
-
_context2.next =
|
|
55
|
+
_context2.next = 1;
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
58
|
return _context2.abrupt("return");
|
|
59
|
-
case
|
|
59
|
+
case 1:
|
|
60
60
|
urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.17.15/lodash.min.js", "dayjs/dayjs.min.js", "antd/latest/reset.css", "antd/latest/antd.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
|
-
_context2.next =
|
|
61
|
+
_context2.next = 2;
|
|
62
62
|
return loadPlugins(urls.map(function (url) {
|
|
63
63
|
return "https://cdn.zhiyunhe.com/plugin/" + url;
|
|
64
64
|
}));
|
|
65
|
-
case
|
|
65
|
+
case 2:
|
|
66
66
|
["RootMaterial", "AntdMaterial", "AntdProMaterial"].forEach(function (lib) {
|
|
67
67
|
var data = window[lib];
|
|
68
68
|
if (data) {
|
|
@@ -75,7 +75,7 @@ function _loadMaterials() {
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
window._components = components;
|
|
78
|
-
case
|
|
78
|
+
case 3:
|
|
79
79
|
case "end":
|
|
80
80
|
return _context2.stop();
|
|
81
81
|
}
|
package/es/demo/index.js
CHANGED
|
@@ -8,17 +8,17 @@ console.log(utils);
|
|
|
8
8
|
function App() {
|
|
9
9
|
var ref = useRef();
|
|
10
10
|
useEffect(function () {
|
|
11
|
-
utils.designer.initEngine().then(
|
|
12
|
-
var _ref = _asyncToGenerator(
|
|
13
|
-
return _regeneratorRuntime.wrap(function
|
|
11
|
+
utils.designer.initEngine().then(/*#__PURE__*/function () {
|
|
12
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(engine) {
|
|
13
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
14
14
|
while (1) switch (_context.prev = _context.next) {
|
|
15
15
|
case 0:
|
|
16
|
-
_context.next =
|
|
16
|
+
_context.next = 1;
|
|
17
17
|
return engine.injectAssets([]);
|
|
18
|
-
case
|
|
19
|
-
_context.next =
|
|
18
|
+
case 1:
|
|
19
|
+
_context.next = 2;
|
|
20
20
|
return engine.init(ref.current, Schema);
|
|
21
|
-
case
|
|
21
|
+
case 2:
|
|
22
22
|
case "end":
|
|
23
23
|
return _context.stop();
|
|
24
24
|
}
|
|
@@ -37,4 +37,4 @@ function App() {
|
|
|
37
37
|
}
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
40
|
-
ReactDOM.render(
|
|
40
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(App, null), document.getElementById('root'));
|
package/es/utils/api/file-api.js
CHANGED
|
@@ -5,18 +5,18 @@ export function upload(_x, _x2) {
|
|
|
5
5
|
return _upload.apply(this, arguments);
|
|
6
6
|
}
|
|
7
7
|
function _upload() {
|
|
8
|
-
_upload = _asyncToGenerator(
|
|
9
|
-
var res, ossFile, _options$onFinished, _options$onError;
|
|
10
|
-
return _regeneratorRuntime.wrap(function
|
|
8
|
+
_upload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(file, options) {
|
|
9
|
+
var res, ossFile, _options$onFinished, _options$onError, _t;
|
|
10
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
11
11
|
while (1) switch (_context.prev = _context.next) {
|
|
12
12
|
case 0:
|
|
13
13
|
if (file) {
|
|
14
|
-
_context.next =
|
|
14
|
+
_context.next = 1;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
17
17
|
return _context.abrupt("return", file);
|
|
18
|
-
case
|
|
19
|
-
_context.next =
|
|
18
|
+
case 1:
|
|
19
|
+
_context.next = 2;
|
|
20
20
|
return apiRequest.post("files/signature", {
|
|
21
21
|
id: file.id,
|
|
22
22
|
size: file.size,
|
|
@@ -27,15 +27,15 @@ function _upload() {
|
|
|
27
27
|
type: "oss"
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
case
|
|
30
|
+
case 2:
|
|
31
31
|
res = _context.sent;
|
|
32
32
|
ossFile = res.data;
|
|
33
33
|
file.id = ossFile.id;
|
|
34
34
|
file.url = ossFile.url;
|
|
35
35
|
file.percent = 0;
|
|
36
36
|
file.status = "uploading";
|
|
37
|
-
_context.prev =
|
|
38
|
-
_context.next =
|
|
37
|
+
_context.prev = 3;
|
|
38
|
+
_context.next = 4;
|
|
39
39
|
return apiRequest.put(ossFile.uploadUrl, (file === null || file === void 0 ? void 0 : file.buffer) || file, {
|
|
40
40
|
headers: {
|
|
41
41
|
'Content-Type': file.type
|
|
@@ -48,21 +48,21 @@ function _upload() {
|
|
|
48
48
|
options === null || options === void 0 ? void 0 : (_options$onProgress = options.onProgress) === null || _options$onProgress === void 0 ? void 0 : _options$onProgress.call(options, evt);
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
case
|
|
51
|
+
case 4:
|
|
52
52
|
file.status = "done";
|
|
53
53
|
options === null || options === void 0 ? void 0 : (_options$onFinished = options.onFinished) === null || _options$onFinished === void 0 ? void 0 : _options$onFinished.call(options);
|
|
54
|
-
_context.next =
|
|
54
|
+
_context.next = 6;
|
|
55
55
|
break;
|
|
56
|
-
case
|
|
57
|
-
_context.prev =
|
|
58
|
-
|
|
56
|
+
case 5:
|
|
57
|
+
_context.prev = 5;
|
|
58
|
+
_t = _context["catch"](3);
|
|
59
59
|
file.status = "error";
|
|
60
|
-
options === null || options === void 0 ? void 0 : (_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options,
|
|
61
|
-
case
|
|
60
|
+
options === null || options === void 0 ? void 0 : (_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options, _t);
|
|
61
|
+
case 6:
|
|
62
62
|
case "end":
|
|
63
63
|
return _context.stop();
|
|
64
64
|
}
|
|
65
|
-
}, _callee, null, [[
|
|
65
|
+
}, _callee, null, [[3, 5]]);
|
|
66
66
|
}));
|
|
67
67
|
return _upload.apply(this, arguments);
|
|
68
68
|
}
|
|
@@ -70,16 +70,16 @@ export function update(_x3) {
|
|
|
70
70
|
return _update.apply(this, arguments);
|
|
71
71
|
}
|
|
72
72
|
function _update() {
|
|
73
|
-
_update = _asyncToGenerator(
|
|
74
|
-
return _regeneratorRuntime.wrap(function
|
|
73
|
+
_update = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(file) {
|
|
74
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
75
75
|
while (1) switch (_context2.prev = _context2.next) {
|
|
76
76
|
case 0:
|
|
77
|
-
_context2.next =
|
|
77
|
+
_context2.next = 1;
|
|
78
78
|
return apiRequest.post("files/update", {
|
|
79
79
|
id: file.id,
|
|
80
80
|
fileName: file.fileName
|
|
81
81
|
});
|
|
82
|
-
case
|
|
82
|
+
case 1:
|
|
83
83
|
case "end":
|
|
84
84
|
return _context2.stop();
|
|
85
85
|
}
|
|
@@ -15,5 +15,5 @@ export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
|
15
15
|
save(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
16
16
|
create(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
17
17
|
update(id: string, data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
18
|
-
serviceUpdate(data: DataType, options?: BaseRequestOptions<DataType>): Promise<import("axios").AxiosResponse<any, any>>;
|
|
18
|
+
serviceUpdate(data: DataType, options?: BaseRequestOptions<DataType>): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
19
19
|
}
|
package/es/utils/api/form-api.js
CHANGED
|
@@ -10,9 +10,9 @@ export function getFormApi(_x, _x2, _x3) {
|
|
|
10
10
|
return _getFormApi.apply(this, arguments);
|
|
11
11
|
}
|
|
12
12
|
function _getFormApi() {
|
|
13
|
-
_getFormApi = _asyncToGenerator(
|
|
13
|
+
_getFormApi = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(formId, fieldId, mock) {
|
|
14
14
|
var key;
|
|
15
|
-
return _regeneratorRuntime.wrap(function
|
|
15
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
16
16
|
while (1) switch (_context9.prev = _context9.next) {
|
|
17
17
|
case 0:
|
|
18
18
|
if (typeof mock != "boolean") {
|
|
@@ -28,7 +28,7 @@ function _getFormApi() {
|
|
|
28
28
|
fieldId: fieldId,
|
|
29
29
|
formId: formId
|
|
30
30
|
}));
|
|
31
|
-
case
|
|
31
|
+
case 1:
|
|
32
32
|
case "end":
|
|
33
33
|
return _context9.stop();
|
|
34
34
|
}
|
|
@@ -39,7 +39,9 @@ function _getFormApi() {
|
|
|
39
39
|
export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
40
40
|
function RestFormApi(formId, fieldId, mock) {
|
|
41
41
|
var _this;
|
|
42
|
-
_this = _RestApi.call(this, "
|
|
42
|
+
_this = _RestApi.call(this, "forms", {
|
|
43
|
+
title: "表单"
|
|
44
|
+
}) || this;
|
|
43
45
|
_this.formId = void 0;
|
|
44
46
|
_this.fieldId = void 0;
|
|
45
47
|
_this.mock = void 0;
|
|
@@ -53,10 +55,10 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
53
55
|
_inheritsLoose(RestFormApi, _RestApi);
|
|
54
56
|
var _proto = RestFormApi.prototype;
|
|
55
57
|
_proto.initialize = /*#__PURE__*/function () {
|
|
56
|
-
var _initialize = _asyncToGenerator(
|
|
58
|
+
var _initialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
57
59
|
var _this2 = this;
|
|
58
60
|
var res, _this$schema, _this$schema$children, _this$schema$children2;
|
|
59
|
-
return _regeneratorRuntime.wrap(function
|
|
61
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
60
62
|
while (1) switch (_context.prev = _context.next) {
|
|
61
63
|
case 0:
|
|
62
64
|
if (!this.initialized) {
|
|
@@ -90,7 +92,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
return _context.abrupt("return", this.initialized);
|
|
93
|
-
case
|
|
95
|
+
case 1:
|
|
94
96
|
case "end":
|
|
95
97
|
return _context.stop();
|
|
96
98
|
}
|
|
@@ -102,13 +104,13 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
102
104
|
return initialize;
|
|
103
105
|
}();
|
|
104
106
|
_proto.handleRequestConfig = /*#__PURE__*/function () {
|
|
105
|
-
var _handleRequestConfig = _asyncToGenerator(
|
|
106
|
-
return _regeneratorRuntime.wrap(function
|
|
107
|
+
var _handleRequestConfig = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
|
|
108
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
107
109
|
while (1) switch (_context2.prev = _context2.next) {
|
|
108
110
|
case 0:
|
|
109
|
-
_context2.next =
|
|
111
|
+
_context2.next = 1;
|
|
110
112
|
return this.initialize();
|
|
111
|
-
case
|
|
113
|
+
case 1:
|
|
112
114
|
config.params = config.params || {};
|
|
113
115
|
if (__mock) {
|
|
114
116
|
config.params.description = "" + this.title;
|
|
@@ -120,7 +122,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
120
122
|
if (this.mock) {
|
|
121
123
|
config.params.mock = this.mock;
|
|
122
124
|
}
|
|
123
|
-
case
|
|
125
|
+
case 2:
|
|
124
126
|
case "end":
|
|
125
127
|
return _context2.stop();
|
|
126
128
|
}
|
|
@@ -132,10 +134,10 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
132
134
|
return handleRequestConfig;
|
|
133
135
|
}();
|
|
134
136
|
_proto.search = /*#__PURE__*/function () {
|
|
135
|
-
var _search = _asyncToGenerator(
|
|
137
|
+
var _search = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(searchParams) {
|
|
136
138
|
var _searchParams, _searchParams2;
|
|
137
139
|
var params, config, res, start;
|
|
138
|
-
return _regeneratorRuntime.wrap(function
|
|
140
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
139
141
|
while (1) switch (_context3.prev = _context3.next) {
|
|
140
142
|
case 0:
|
|
141
143
|
searchParams = searchParams || {};
|
|
@@ -149,9 +151,9 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
149
151
|
config = {
|
|
150
152
|
params: params
|
|
151
153
|
};
|
|
152
|
-
_context3.next =
|
|
154
|
+
_context3.next = 1;
|
|
153
155
|
return this.handleRequestConfig(config);
|
|
154
|
-
case
|
|
156
|
+
case 1:
|
|
155
157
|
searchParams.filterRules = handleFilterRules(((_searchParams = searchParams) === null || _searchParams === void 0 ? void 0 : _searchParams.filterRules) || [], {
|
|
156
158
|
filterNullValue: false
|
|
157
159
|
});
|
|
@@ -159,16 +161,16 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
159
161
|
filterNullValue: true
|
|
160
162
|
});
|
|
161
163
|
config.params = _extends({}, params, searchParams);
|
|
162
|
-
_context3.next =
|
|
164
|
+
_context3.next = 2;
|
|
163
165
|
return this.request.get("search", config);
|
|
164
|
-
case
|
|
166
|
+
case 2:
|
|
165
167
|
res = _context3.sent;
|
|
166
168
|
//const res = await this.request.post<any, ManyResult<DataType>>("search", searchParams, config);
|
|
167
169
|
start = Date.now();
|
|
168
170
|
assembleAssociationField(res.data, res.refs);
|
|
169
171
|
console.debug("form.search:", res);
|
|
170
172
|
return _context3.abrupt("return", res);
|
|
171
|
-
case
|
|
173
|
+
case 3:
|
|
172
174
|
case "end":
|
|
173
175
|
return _context3.stop();
|
|
174
176
|
}
|
|
@@ -180,19 +182,19 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
180
182
|
return search;
|
|
181
183
|
}();
|
|
182
184
|
_proto.getById = /*#__PURE__*/function () {
|
|
183
|
-
var _getById = _asyncToGenerator(
|
|
185
|
+
var _getById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id, options) {
|
|
184
186
|
var res;
|
|
185
|
-
return _regeneratorRuntime.wrap(function
|
|
187
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
186
188
|
while (1) switch (_context4.prev = _context4.next) {
|
|
187
189
|
case 0:
|
|
188
|
-
_context4.next =
|
|
190
|
+
_context4.next = 1;
|
|
189
191
|
return _RestApi.prototype.getById.call(this, id, options);
|
|
190
|
-
case
|
|
192
|
+
case 1:
|
|
191
193
|
res = _context4.sent;
|
|
192
194
|
assembleAssociationField(res.data, res.refs);
|
|
193
195
|
console.debug("formApi.getById", res);
|
|
194
196
|
return _context4.abrupt("return", res);
|
|
195
|
-
case
|
|
197
|
+
case 2:
|
|
196
198
|
case "end":
|
|
197
199
|
return _context4.stop();
|
|
198
200
|
}
|
|
@@ -204,8 +206,8 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
204
206
|
return getById;
|
|
205
207
|
}();
|
|
206
208
|
_proto.save = /*#__PURE__*/function () {
|
|
207
|
-
var _save = _asyncToGenerator(
|
|
208
|
-
return _regeneratorRuntime.wrap(function
|
|
209
|
+
var _save = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data, options) {
|
|
210
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
209
211
|
while (1) switch (_context5.prev = _context5.next) {
|
|
210
212
|
case 0:
|
|
211
213
|
return _context5.abrupt("return", _RestApi.prototype.save.call(this, convertSaveData(data), options));
|
|
@@ -221,8 +223,8 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
221
223
|
return save;
|
|
222
224
|
}();
|
|
223
225
|
_proto.create = /*#__PURE__*/function () {
|
|
224
|
-
var _create = _asyncToGenerator(
|
|
225
|
-
return _regeneratorRuntime.wrap(function
|
|
226
|
+
var _create = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data, options) {
|
|
227
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
226
228
|
while (1) switch (_context6.prev = _context6.next) {
|
|
227
229
|
case 0:
|
|
228
230
|
return _context6.abrupt("return", _RestApi.prototype.create.call(this, convertSaveData(data), options));
|
|
@@ -232,14 +234,14 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
232
234
|
}
|
|
233
235
|
}, _callee6, this);
|
|
234
236
|
}));
|
|
235
|
-
function create(
|
|
237
|
+
function create(_x0, _x1) {
|
|
236
238
|
return _create.apply(this, arguments);
|
|
237
239
|
}
|
|
238
240
|
return create;
|
|
239
241
|
}();
|
|
240
242
|
_proto.update = /*#__PURE__*/function () {
|
|
241
|
-
var _update = _asyncToGenerator(
|
|
242
|
-
return _regeneratorRuntime.wrap(function
|
|
243
|
+
var _update = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, data, options) {
|
|
244
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
243
245
|
while (1) switch (_context7.prev = _context7.next) {
|
|
244
246
|
case 0:
|
|
245
247
|
return _context7.abrupt("return", _RestApi.prototype.update.call(this, id, convertSaveData(data), options));
|
|
@@ -249,15 +251,15 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
249
251
|
}
|
|
250
252
|
}, _callee7, this);
|
|
251
253
|
}));
|
|
252
|
-
function update(
|
|
254
|
+
function update(_x10, _x11, _x12) {
|
|
253
255
|
return _update.apply(this, arguments);
|
|
254
256
|
}
|
|
255
257
|
return update;
|
|
256
258
|
}();
|
|
257
259
|
_proto.serviceUpdate = /*#__PURE__*/function () {
|
|
258
|
-
var _serviceUpdate = _asyncToGenerator(
|
|
260
|
+
var _serviceUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data, options) {
|
|
259
261
|
var params;
|
|
260
|
-
return _regeneratorRuntime.wrap(function
|
|
262
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
261
263
|
while (1) switch (_context8.prev = _context8.next) {
|
|
262
264
|
case 0:
|
|
263
265
|
params = {
|
|
@@ -271,13 +273,13 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
271
273
|
return _context8.abrupt("return", this.request.post("serviceUpdate", data, {
|
|
272
274
|
params: params
|
|
273
275
|
}));
|
|
274
|
-
case
|
|
276
|
+
case 1:
|
|
275
277
|
case "end":
|
|
276
278
|
return _context8.stop();
|
|
277
279
|
}
|
|
278
280
|
}, _callee8, this);
|
|
279
281
|
}));
|
|
280
|
-
function serviceUpdate(
|
|
282
|
+
function serviceUpdate(_x13, _x14) {
|
|
281
283
|
return _serviceUpdate.apply(this, arguments);
|
|
282
284
|
}
|
|
283
285
|
return serviceUpdate;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
function _createForOfIteratorHelperLoose(
|
|
3
|
-
function _unsupportedIterableToArray(
|
|
4
|
-
function _arrayLikeToArray(
|
|
2
|
+
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
5
|
import { transformerId } from "../data";
|
|
6
|
+
var SimpleSerialFieldNames = ["parent", "instance"];
|
|
6
7
|
export function convertSaveData(data) {
|
|
7
8
|
if (!data) return data;
|
|
8
9
|
return JSON.parse(JSON.stringify(data, function (key, value) {
|
|
9
|
-
if (key
|
|
10
|
+
if (SimpleSerialFieldNames.includes(key)) {
|
|
10
11
|
var id = value === null || value === void 0 ? void 0 : value.id;
|
|
11
12
|
return id ? {
|
|
12
13
|
id: id
|
package/es/utils/api/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export { getUserinfo } from "./user-info";
|
|
|
6
6
|
export * as files from "./file-api";
|
|
7
7
|
export * as scrips from "./script-api";
|
|
8
8
|
export declare const apiRequest: import("axios").AxiosInstance;
|
|
9
|
-
export declare const request: <T = any, R = AxiosResponse<T, any>, D = any>(config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
|
|
9
|
+
export declare const request: <T = any, R = AxiosResponse<T, any, {}>, D = any>(config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
|
|
10
10
|
export declare function onFulfilled(res: AxiosResponse): any;
|
|
11
11
|
export declare function onRejected(error: any): any;
|