@zhubangyun/lowcode-core 5.12.92 → 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 +35 -35
- 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 +35 -35
- 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
|
}
|
|
@@ -55,10 +55,10 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
55
55
|
_inheritsLoose(RestFormApi, _RestApi);
|
|
56
56
|
var _proto = RestFormApi.prototype;
|
|
57
57
|
_proto.initialize = /*#__PURE__*/function () {
|
|
58
|
-
var _initialize = _asyncToGenerator(
|
|
58
|
+
var _initialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
59
59
|
var _this2 = this;
|
|
60
60
|
var res, _this$schema, _this$schema$children, _this$schema$children2;
|
|
61
|
-
return _regeneratorRuntime.wrap(function
|
|
61
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
62
62
|
while (1) switch (_context.prev = _context.next) {
|
|
63
63
|
case 0:
|
|
64
64
|
if (!this.initialized) {
|
|
@@ -92,7 +92,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
return _context.abrupt("return", this.initialized);
|
|
95
|
-
case
|
|
95
|
+
case 1:
|
|
96
96
|
case "end":
|
|
97
97
|
return _context.stop();
|
|
98
98
|
}
|
|
@@ -104,13 +104,13 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
104
104
|
return initialize;
|
|
105
105
|
}();
|
|
106
106
|
_proto.handleRequestConfig = /*#__PURE__*/function () {
|
|
107
|
-
var _handleRequestConfig = _asyncToGenerator(
|
|
108
|
-
return _regeneratorRuntime.wrap(function
|
|
107
|
+
var _handleRequestConfig = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
|
|
108
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
109
109
|
while (1) switch (_context2.prev = _context2.next) {
|
|
110
110
|
case 0:
|
|
111
|
-
_context2.next =
|
|
111
|
+
_context2.next = 1;
|
|
112
112
|
return this.initialize();
|
|
113
|
-
case
|
|
113
|
+
case 1:
|
|
114
114
|
config.params = config.params || {};
|
|
115
115
|
if (__mock) {
|
|
116
116
|
config.params.description = "" + this.title;
|
|
@@ -122,7 +122,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
122
122
|
if (this.mock) {
|
|
123
123
|
config.params.mock = this.mock;
|
|
124
124
|
}
|
|
125
|
-
case
|
|
125
|
+
case 2:
|
|
126
126
|
case "end":
|
|
127
127
|
return _context2.stop();
|
|
128
128
|
}
|
|
@@ -134,10 +134,10 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
134
134
|
return handleRequestConfig;
|
|
135
135
|
}();
|
|
136
136
|
_proto.search = /*#__PURE__*/function () {
|
|
137
|
-
var _search = _asyncToGenerator(
|
|
137
|
+
var _search = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(searchParams) {
|
|
138
138
|
var _searchParams, _searchParams2;
|
|
139
139
|
var params, config, res, start;
|
|
140
|
-
return _regeneratorRuntime.wrap(function
|
|
140
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
141
141
|
while (1) switch (_context3.prev = _context3.next) {
|
|
142
142
|
case 0:
|
|
143
143
|
searchParams = searchParams || {};
|
|
@@ -151,9 +151,9 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
151
151
|
config = {
|
|
152
152
|
params: params
|
|
153
153
|
};
|
|
154
|
-
_context3.next =
|
|
154
|
+
_context3.next = 1;
|
|
155
155
|
return this.handleRequestConfig(config);
|
|
156
|
-
case
|
|
156
|
+
case 1:
|
|
157
157
|
searchParams.filterRules = handleFilterRules(((_searchParams = searchParams) === null || _searchParams === void 0 ? void 0 : _searchParams.filterRules) || [], {
|
|
158
158
|
filterNullValue: false
|
|
159
159
|
});
|
|
@@ -161,16 +161,16 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
161
161
|
filterNullValue: true
|
|
162
162
|
});
|
|
163
163
|
config.params = _extends({}, params, searchParams);
|
|
164
|
-
_context3.next =
|
|
164
|
+
_context3.next = 2;
|
|
165
165
|
return this.request.get("search", config);
|
|
166
|
-
case
|
|
166
|
+
case 2:
|
|
167
167
|
res = _context3.sent;
|
|
168
168
|
//const res = await this.request.post<any, ManyResult<DataType>>("search", searchParams, config);
|
|
169
169
|
start = Date.now();
|
|
170
170
|
assembleAssociationField(res.data, res.refs);
|
|
171
171
|
console.debug("form.search:", res);
|
|
172
172
|
return _context3.abrupt("return", res);
|
|
173
|
-
case
|
|
173
|
+
case 3:
|
|
174
174
|
case "end":
|
|
175
175
|
return _context3.stop();
|
|
176
176
|
}
|
|
@@ -182,19 +182,19 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
182
182
|
return search;
|
|
183
183
|
}();
|
|
184
184
|
_proto.getById = /*#__PURE__*/function () {
|
|
185
|
-
var _getById = _asyncToGenerator(
|
|
185
|
+
var _getById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id, options) {
|
|
186
186
|
var res;
|
|
187
|
-
return _regeneratorRuntime.wrap(function
|
|
187
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
188
188
|
while (1) switch (_context4.prev = _context4.next) {
|
|
189
189
|
case 0:
|
|
190
|
-
_context4.next =
|
|
190
|
+
_context4.next = 1;
|
|
191
191
|
return _RestApi.prototype.getById.call(this, id, options);
|
|
192
|
-
case
|
|
192
|
+
case 1:
|
|
193
193
|
res = _context4.sent;
|
|
194
194
|
assembleAssociationField(res.data, res.refs);
|
|
195
195
|
console.debug("formApi.getById", res);
|
|
196
196
|
return _context4.abrupt("return", res);
|
|
197
|
-
case
|
|
197
|
+
case 2:
|
|
198
198
|
case "end":
|
|
199
199
|
return _context4.stop();
|
|
200
200
|
}
|
|
@@ -206,8 +206,8 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
206
206
|
return getById;
|
|
207
207
|
}();
|
|
208
208
|
_proto.save = /*#__PURE__*/function () {
|
|
209
|
-
var _save = _asyncToGenerator(
|
|
210
|
-
return _regeneratorRuntime.wrap(function
|
|
209
|
+
var _save = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data, options) {
|
|
210
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
211
211
|
while (1) switch (_context5.prev = _context5.next) {
|
|
212
212
|
case 0:
|
|
213
213
|
return _context5.abrupt("return", _RestApi.prototype.save.call(this, convertSaveData(data), options));
|
|
@@ -223,8 +223,8 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
223
223
|
return save;
|
|
224
224
|
}();
|
|
225
225
|
_proto.create = /*#__PURE__*/function () {
|
|
226
|
-
var _create = _asyncToGenerator(
|
|
227
|
-
return _regeneratorRuntime.wrap(function
|
|
226
|
+
var _create = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data, options) {
|
|
227
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
228
228
|
while (1) switch (_context6.prev = _context6.next) {
|
|
229
229
|
case 0:
|
|
230
230
|
return _context6.abrupt("return", _RestApi.prototype.create.call(this, convertSaveData(data), options));
|
|
@@ -234,14 +234,14 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
234
234
|
}
|
|
235
235
|
}, _callee6, this);
|
|
236
236
|
}));
|
|
237
|
-
function create(
|
|
237
|
+
function create(_x0, _x1) {
|
|
238
238
|
return _create.apply(this, arguments);
|
|
239
239
|
}
|
|
240
240
|
return create;
|
|
241
241
|
}();
|
|
242
242
|
_proto.update = /*#__PURE__*/function () {
|
|
243
|
-
var _update = _asyncToGenerator(
|
|
244
|
-
return _regeneratorRuntime.wrap(function
|
|
243
|
+
var _update = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, data, options) {
|
|
244
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
245
245
|
while (1) switch (_context7.prev = _context7.next) {
|
|
246
246
|
case 0:
|
|
247
247
|
return _context7.abrupt("return", _RestApi.prototype.update.call(this, id, convertSaveData(data), options));
|
|
@@ -251,15 +251,15 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
251
251
|
}
|
|
252
252
|
}, _callee7, this);
|
|
253
253
|
}));
|
|
254
|
-
function update(
|
|
254
|
+
function update(_x10, _x11, _x12) {
|
|
255
255
|
return _update.apply(this, arguments);
|
|
256
256
|
}
|
|
257
257
|
return update;
|
|
258
258
|
}();
|
|
259
259
|
_proto.serviceUpdate = /*#__PURE__*/function () {
|
|
260
|
-
var _serviceUpdate = _asyncToGenerator(
|
|
260
|
+
var _serviceUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data, options) {
|
|
261
261
|
var params;
|
|
262
|
-
return _regeneratorRuntime.wrap(function
|
|
262
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
263
263
|
while (1) switch (_context8.prev = _context8.next) {
|
|
264
264
|
case 0:
|
|
265
265
|
params = {
|
|
@@ -273,13 +273,13 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
273
273
|
return _context8.abrupt("return", this.request.post("serviceUpdate", data, {
|
|
274
274
|
params: params
|
|
275
275
|
}));
|
|
276
|
-
case
|
|
276
|
+
case 1:
|
|
277
277
|
case "end":
|
|
278
278
|
return _context8.stop();
|
|
279
279
|
}
|
|
280
280
|
}, _callee8, this);
|
|
281
281
|
}));
|
|
282
|
-
function serviceUpdate(
|
|
282
|
+
function serviceUpdate(_x13, _x14) {
|
|
283
283
|
return _serviceUpdate.apply(this, arguments);
|
|
284
284
|
}
|
|
285
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;
|