@zhubangyun/lowcode-core 5.12.92 → 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 +44 -28
- package/es/components/page-loading/index.js +4 -1
- package/es/demo/index.js +8 -8
- 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/file-api.js +21 -21
- package/es/utils/api/form-api.d.ts +2 -1
- package/es/utils/api/form-api.js +90 -51
- package/es/utils/api/form-api.utils.js +5 -4
- package/es/utils/api/index.d.ts +2 -2
- 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 +207 -125
- package/es/utils/api/schema-api.js +5 -5
- package/es/utils/api/schema.util.d.ts +3 -3
- package/es/utils/api/schema.util.js +17 -12
- package/es/utils/api/script-api.js +12 -12
- package/es/utils/api/user-info.js +7 -7
- package/es/utils/cache/index.js +66 -26
- package/es/utils/common/LoadPlugins.js +33 -33
- package/es/utils/common/SingletonInstanceMap.js +21 -21
- package/es/utils/common/index.d.ts +3 -0
- package/es/utils/common/index.js +13 -3
- 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 +9 -6
- package/es/utils/page/page-form-data-manager.d.ts +1 -0
- package/es/utils/page/page-form-data-manager.js +9 -6
- package/es/utils/page/page-form-group.d.ts +1 -0
- package/es/utils/page/page-form-group.js +8 -7
- package/es/utils/page/page-form.d.ts +1 -0
- package/es/utils/page/page-form.js +23 -12
- package/es/utils/page/page-layout.d.ts +3 -0
- package/es/utils/page/page-layout.js +33 -9
- package/es/utils/page/page-load-schema.js +20 -28
- package/es/utils/page/page-render.js +4 -4
- package/es/utils/page/page-show.d.ts +2 -0
- package/es/utils/page/page-show.js +8 -3
- package/es/utils/page/print-form.js +60 -51
- 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 +45 -30
- package/lib/components/page-loading/index.js +4 -1
- package/lib/demo/index.js +9 -10
- package/lib/index.d.ts +1 -1
- package/lib/index.js +45 -6
- package/lib/index.less +10 -0
- package/lib/style.js +2 -2
- package/lib/utils/api/file-api.js +21 -21
- package/lib/utils/api/form-api.d.ts +2 -1
- package/lib/utils/api/form-api.js +90 -51
- package/lib/utils/api/form-api.utils.js +5 -4
- package/lib/utils/api/index.d.ts +2 -2
- package/lib/utils/api/index.js +2 -2
- package/lib/utils/api/rest-api.d.ts +3 -1
- package/lib/utils/api/rest-api.js +207 -125
- package/lib/utils/api/schema-api.js +5 -5
- package/lib/utils/api/schema.util.d.ts +3 -3
- package/lib/utils/api/schema.util.js +19 -13
- package/lib/utils/api/script-api.js +12 -12
- package/lib/utils/api/user-info.js +7 -7
- package/lib/utils/cache/index.js +65 -25
- package/lib/utils/common/LoadPlugins.js +33 -33
- package/lib/utils/common/SingletonInstanceMap.js +21 -21
- package/lib/utils/common/index.d.ts +3 -0
- package/lib/utils/common/index.js +15 -2
- 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 +10 -8
- package/lib/utils/page/page-form-data-manager.d.ts +1 -0
- package/lib/utils/page/page-form-data-manager.js +10 -8
- package/lib/utils/page/page-form-group.d.ts +1 -0
- package/lib/utils/page/page-form-group.js +9 -9
- package/lib/utils/page/page-form.d.ts +1 -0
- package/lib/utils/page/page-form.js +24 -14
- package/lib/utils/page/page-layout.d.ts +3 -0
- package/lib/utils/page/page-layout.js +34 -11
- package/lib/utils/page/page-load-schema.js +19 -27
- package/lib/utils/page/page-render.js +4 -4
- package/lib/utils/page/page-show.d.ts +2 -0
- package/lib/utils/page/page-show.js +9 -5
- package/lib/utils/page/print-form.js +60 -51
- 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
|
@@ -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
|
@@ -1,11 +1,11 @@
|
|
|
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";
|
|
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;
|
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
|
@@ -28,25 +28,25 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
28
28
|
}
|
|
29
29
|
var _proto = BaseRestApi.prototype;
|
|
30
30
|
_proto.search = /*#__PURE__*/function () {
|
|
31
|
-
var _search = _asyncToGenerator(
|
|
31
|
+
var _search = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
|
|
32
32
|
var _this$handleRequestCo;
|
|
33
33
|
var config;
|
|
34
|
-
return _regeneratorRuntime.wrap(function
|
|
34
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
35
35
|
while (1) switch (_context.prev = _context.next) {
|
|
36
36
|
case 0:
|
|
37
37
|
config = {
|
|
38
38
|
params: params
|
|
39
39
|
};
|
|
40
|
-
_context.next =
|
|
40
|
+
_context.next = 1;
|
|
41
41
|
return (_this$handleRequestCo = this.handleRequestConfig) === null || _this$handleRequestCo === void 0 ? void 0 : _this$handleRequestCo.call(this, config);
|
|
42
|
-
case
|
|
43
|
-
_context.next =
|
|
42
|
+
case 1:
|
|
43
|
+
_context.next = 2;
|
|
44
44
|
return this.request.get("", {
|
|
45
45
|
params: params
|
|
46
46
|
});
|
|
47
|
-
case
|
|
47
|
+
case 2:
|
|
48
48
|
return _context.abrupt("return", _context.sent);
|
|
49
|
-
case
|
|
49
|
+
case 3:
|
|
50
50
|
case "end":
|
|
51
51
|
return _context.stop();
|
|
52
52
|
}
|
|
@@ -66,36 +66,36 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
66
66
|
_proto.getById =
|
|
67
67
|
/*#__PURE__*/
|
|
68
68
|
function () {
|
|
69
|
-
var _getById = _asyncToGenerator(
|
|
69
|
+
var _getById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id, options) {
|
|
70
70
|
var _this$handleRequestCo2;
|
|
71
71
|
var config, res, _options$onError, _options$onSuccess;
|
|
72
|
-
return _regeneratorRuntime.wrap(function
|
|
72
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
73
73
|
while (1) switch (_context2.prev = _context2.next) {
|
|
74
74
|
case 0:
|
|
75
75
|
config = {};
|
|
76
|
-
_context2.next =
|
|
76
|
+
_context2.next = 1;
|
|
77
77
|
return (_this$handleRequestCo2 = this.handleRequestConfig) === null || _this$handleRequestCo2 === void 0 ? void 0 : _this$handleRequestCo2.call(this, config);
|
|
78
|
-
case
|
|
79
|
-
_context2.next =
|
|
78
|
+
case 1:
|
|
79
|
+
_context2.next = 2;
|
|
80
80
|
return this.request.get(String(id), config);
|
|
81
|
-
case
|
|
81
|
+
case 2:
|
|
82
82
|
res = _context2.sent;
|
|
83
83
|
if (res.success) {
|
|
84
|
-
_context2.next =
|
|
84
|
+
_context2.next = 4;
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
87
|
this.showError("\u83B7\u53D6{" + id + "}\u5931\u8D25!", res).then();
|
|
88
|
-
_context2.next =
|
|
88
|
+
_context2.next = 3;
|
|
89
89
|
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
|
-
case
|
|
91
|
-
_context2.next =
|
|
90
|
+
case 3:
|
|
91
|
+
_context2.next = 5;
|
|
92
92
|
break;
|
|
93
|
-
case
|
|
94
|
-
_context2.next =
|
|
93
|
+
case 4:
|
|
94
|
+
_context2.next = 5;
|
|
95
95
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call(options, res);
|
|
96
|
-
case
|
|
96
|
+
case 5:
|
|
97
97
|
return _context2.abrupt("return", res);
|
|
98
|
-
case
|
|
98
|
+
case 6:
|
|
99
99
|
case "end":
|
|
100
100
|
return _context2.stop();
|
|
101
101
|
}
|
|
@@ -107,36 +107,36 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
107
107
|
return getById;
|
|
108
108
|
}();
|
|
109
109
|
_proto.save = /*#__PURE__*/function () {
|
|
110
|
-
var _save = _asyncToGenerator(
|
|
110
|
+
var _save = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data, options) {
|
|
111
111
|
var _this$handleRequestCo3;
|
|
112
112
|
var config, res, _options$onError2, _options$onSuccess2;
|
|
113
|
-
return _regeneratorRuntime.wrap(function
|
|
113
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
114
114
|
while (1) switch (_context3.prev = _context3.next) {
|
|
115
115
|
case 0:
|
|
116
116
|
config = {};
|
|
117
|
-
_context3.next =
|
|
117
|
+
_context3.next = 1;
|
|
118
118
|
return (_this$handleRequestCo3 = this.handleRequestConfig) === null || _this$handleRequestCo3 === void 0 ? void 0 : _this$handleRequestCo3.call(this, config);
|
|
119
|
-
case
|
|
120
|
-
_context3.next =
|
|
119
|
+
case 1:
|
|
120
|
+
_context3.next = 2;
|
|
121
121
|
return this.request.post("save", data, config);
|
|
122
|
-
case
|
|
122
|
+
case 2:
|
|
123
123
|
res = _context3.sent;
|
|
124
124
|
if (res.success) {
|
|
125
|
-
_context3.next =
|
|
125
|
+
_context3.next = 4;
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
this.showError("\u63D0\u4EA4\u5931\u8D25!", res).then();
|
|
129
|
-
_context3.next =
|
|
129
|
+
_context3.next = 3;
|
|
130
130
|
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
|
-
case
|
|
132
|
-
_context3.next =
|
|
131
|
+
case 3:
|
|
132
|
+
_context3.next = 5;
|
|
133
133
|
break;
|
|
134
|
-
case
|
|
135
|
-
_context3.next =
|
|
134
|
+
case 4:
|
|
135
|
+
_context3.next = 5;
|
|
136
136
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 ? void 0 : _options$onSuccess2.call(options, res);
|
|
137
|
-
case
|
|
137
|
+
case 5:
|
|
138
138
|
return _context3.abrupt("return", res);
|
|
139
|
-
case
|
|
139
|
+
case 6:
|
|
140
140
|
case "end":
|
|
141
141
|
return _context3.stop();
|
|
142
142
|
}
|
|
@@ -154,36 +154,36 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
154
154
|
_proto.create =
|
|
155
155
|
/*#__PURE__*/
|
|
156
156
|
function () {
|
|
157
|
-
var _create = _asyncToGenerator(
|
|
157
|
+
var _create = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data, options) {
|
|
158
158
|
var _this$handleRequestCo4;
|
|
159
159
|
var config, res, _options$onError3, _options$onSuccess3;
|
|
160
|
-
return _regeneratorRuntime.wrap(function
|
|
160
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
161
161
|
while (1) switch (_context4.prev = _context4.next) {
|
|
162
162
|
case 0:
|
|
163
163
|
config = {};
|
|
164
|
-
_context4.next =
|
|
164
|
+
_context4.next = 1;
|
|
165
165
|
return (_this$handleRequestCo4 = this.handleRequestConfig) === null || _this$handleRequestCo4 === void 0 ? void 0 : _this$handleRequestCo4.call(this, config);
|
|
166
|
-
case
|
|
167
|
-
_context4.next =
|
|
166
|
+
case 1:
|
|
167
|
+
_context4.next = 2;
|
|
168
168
|
return this.request.post("", data, config);
|
|
169
|
-
case
|
|
169
|
+
case 2:
|
|
170
170
|
res = _context4.sent;
|
|
171
171
|
if (res.success) {
|
|
172
|
-
_context4.next =
|
|
172
|
+
_context4.next = 4;
|
|
173
173
|
break;
|
|
174
174
|
}
|
|
175
175
|
this.showError("\u65B0\u589E\u5931\u8D25!", res).then();
|
|
176
|
-
_context4.next =
|
|
176
|
+
_context4.next = 3;
|
|
177
177
|
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
|
-
case
|
|
179
|
-
_context4.next =
|
|
178
|
+
case 3:
|
|
179
|
+
_context4.next = 5;
|
|
180
180
|
break;
|
|
181
|
-
case
|
|
182
|
-
_context4.next =
|
|
181
|
+
case 4:
|
|
182
|
+
_context4.next = 5;
|
|
183
183
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 ? void 0 : _options$onSuccess3.call(options, res);
|
|
184
|
-
case
|
|
184
|
+
case 5:
|
|
185
185
|
return _context4.abrupt("return", res);
|
|
186
|
-
case
|
|
186
|
+
case 6:
|
|
187
187
|
case "end":
|
|
188
188
|
return _context4.stop();
|
|
189
189
|
}
|
|
@@ -201,42 +201,42 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
201
201
|
_proto.update =
|
|
202
202
|
/*#__PURE__*/
|
|
203
203
|
function () {
|
|
204
|
-
var _update = _asyncToGenerator(
|
|
204
|
+
var _update = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, data, options) {
|
|
205
205
|
var _this$handleRequestCo5;
|
|
206
206
|
var config, res, _options$onError4, _options$onSuccess4;
|
|
207
|
-
return _regeneratorRuntime.wrap(function
|
|
207
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
208
208
|
while (1) switch (_context5.prev = _context5.next) {
|
|
209
209
|
case 0:
|
|
210
210
|
config = {};
|
|
211
|
-
_context5.next =
|
|
211
|
+
_context5.next = 1;
|
|
212
212
|
return (_this$handleRequestCo5 = this.handleRequestConfig) === null || _this$handleRequestCo5 === void 0 ? void 0 : _this$handleRequestCo5.call(this, config);
|
|
213
|
-
case
|
|
214
|
-
_context5.next =
|
|
213
|
+
case 1:
|
|
214
|
+
_context5.next = 2;
|
|
215
215
|
return this.request.put(String(id), data, config);
|
|
216
|
-
case
|
|
216
|
+
case 2:
|
|
217
217
|
res = _context5.sent;
|
|
218
218
|
if (res.success) {
|
|
219
|
-
_context5.next =
|
|
219
|
+
_context5.next = 4;
|
|
220
220
|
break;
|
|
221
221
|
}
|
|
222
222
|
this.showError("\u66F4\u65B0\u5931\u8D25!", res).then();
|
|
223
|
-
_context5.next =
|
|
223
|
+
_context5.next = 3;
|
|
224
224
|
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
|
-
case
|
|
226
|
-
_context5.next =
|
|
225
|
+
case 3:
|
|
226
|
+
_context5.next = 5;
|
|
227
227
|
break;
|
|
228
|
-
case
|
|
229
|
-
_context5.next =
|
|
228
|
+
case 4:
|
|
229
|
+
_context5.next = 5;
|
|
230
230
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess4 = options.onSuccess) === null || _options$onSuccess4 === void 0 ? void 0 : _options$onSuccess4.call(options, res);
|
|
231
|
-
case
|
|
231
|
+
case 5:
|
|
232
232
|
return _context5.abrupt("return", res);
|
|
233
|
-
case
|
|
233
|
+
case 6:
|
|
234
234
|
case "end":
|
|
235
235
|
return _context5.stop();
|
|
236
236
|
}
|
|
237
237
|
}, _callee5, this);
|
|
238
238
|
}));
|
|
239
|
-
function update(_x8, _x9,
|
|
239
|
+
function update(_x8, _x9, _x0) {
|
|
240
240
|
return _update.apply(this, arguments);
|
|
241
241
|
}
|
|
242
242
|
return update;
|
|
@@ -248,57 +248,57 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
248
248
|
_proto.deleteById =
|
|
249
249
|
/*#__PURE__*/
|
|
250
250
|
function () {
|
|
251
|
-
var _deleteById = _asyncToGenerator(
|
|
251
|
+
var _deleteById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id, options) {
|
|
252
252
|
var _this$handleRequestCo6;
|
|
253
253
|
var config, res, _options$onError5, _options$onSuccess5;
|
|
254
|
-
return _regeneratorRuntime.wrap(function
|
|
254
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
255
255
|
while (1) switch (_context6.prev = _context6.next) {
|
|
256
256
|
case 0:
|
|
257
257
|
config = {};
|
|
258
|
-
_context6.next =
|
|
258
|
+
_context6.next = 1;
|
|
259
259
|
return (_this$handleRequestCo6 = this.handleRequestConfig) === null || _this$handleRequestCo6 === void 0 ? void 0 : _this$handleRequestCo6.call(this, config);
|
|
260
|
-
case
|
|
261
|
-
_context6.next =
|
|
260
|
+
case 1:
|
|
261
|
+
_context6.next = 2;
|
|
262
262
|
return this.request["delete"](String(id), config);
|
|
263
|
-
case
|
|
263
|
+
case 2:
|
|
264
264
|
res = _context6.sent;
|
|
265
265
|
if (res.success) {
|
|
266
|
-
_context6.next =
|
|
266
|
+
_context6.next = 4;
|
|
267
267
|
break;
|
|
268
268
|
}
|
|
269
269
|
this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res).then();
|
|
270
|
-
_context6.next =
|
|
270
|
+
_context6.next = 3;
|
|
271
271
|
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
|
-
case
|
|
273
|
-
_context6.next =
|
|
272
|
+
case 3:
|
|
273
|
+
_context6.next = 5;
|
|
274
274
|
break;
|
|
275
|
-
case
|
|
276
|
-
_context6.next =
|
|
275
|
+
case 4:
|
|
276
|
+
_context6.next = 5;
|
|
277
277
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess5 = options.onSuccess) === null || _options$onSuccess5 === void 0 ? void 0 : _options$onSuccess5.call(options, res);
|
|
278
|
-
case
|
|
278
|
+
case 5:
|
|
279
279
|
return _context6.abrupt("return", res);
|
|
280
|
-
case
|
|
280
|
+
case 6:
|
|
281
281
|
case "end":
|
|
282
282
|
return _context6.stop();
|
|
283
283
|
}
|
|
284
284
|
}, _callee6, this);
|
|
285
285
|
}));
|
|
286
|
-
function deleteById(
|
|
286
|
+
function deleteById(_x1, _x10) {
|
|
287
287
|
return _deleteById.apply(this, arguments);
|
|
288
288
|
}
|
|
289
289
|
return deleteById;
|
|
290
290
|
}();
|
|
291
291
|
_proto["delete"] = /*#__PURE__*/function () {
|
|
292
|
-
var _delete2 = _asyncToGenerator(
|
|
292
|
+
var _delete2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data, options) {
|
|
293
293
|
var _this$handleRequestCo7;
|
|
294
294
|
var config, arrayData, idValue, res, _options$onError6, _options$onSuccess6;
|
|
295
|
-
return _regeneratorRuntime.wrap(function
|
|
295
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
296
296
|
while (1) switch (_context7.prev = _context7.next) {
|
|
297
297
|
case 0:
|
|
298
298
|
config = {};
|
|
299
|
-
_context7.next =
|
|
299
|
+
_context7.next = 1;
|
|
300
300
|
return (_this$handleRequestCo7 = this.handleRequestConfig) === null || _this$handleRequestCo7 === void 0 ? void 0 : _this$handleRequestCo7.call(this, config);
|
|
301
|
-
case
|
|
301
|
+
case 1:
|
|
302
302
|
arrayData = [];
|
|
303
303
|
idValue = transformerId(data);
|
|
304
304
|
if (!Array.isArray(idValue)) {
|
|
@@ -310,51 +310,133 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
310
310
|
return !!item;
|
|
311
311
|
});
|
|
312
312
|
if (!(arrayData.length == 0)) {
|
|
313
|
-
_context7.next =
|
|
313
|
+
_context7.next = 2;
|
|
314
314
|
break;
|
|
315
315
|
}
|
|
316
316
|
throw new Error("删除对象不可为空!");
|
|
317
|
-
case
|
|
318
|
-
_context7.next =
|
|
317
|
+
case 2:
|
|
318
|
+
_context7.next = 3;
|
|
319
319
|
return this.request.post("remove", arrayData, config);
|
|
320
|
-
case
|
|
320
|
+
case 3:
|
|
321
321
|
res = _context7.sent;
|
|
322
322
|
if (res.success) {
|
|
323
|
-
_context7.next =
|
|
323
|
+
_context7.next = 5;
|
|
324
324
|
break;
|
|
325
325
|
}
|
|
326
326
|
this.showError("\u5220\u9664\u5931\u8D25!", res).then();
|
|
327
|
-
_context7.next =
|
|
327
|
+
_context7.next = 4;
|
|
328
328
|
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
|
-
case
|
|
330
|
-
_context7.next =
|
|
329
|
+
case 4:
|
|
330
|
+
_context7.next = 6;
|
|
331
331
|
break;
|
|
332
|
-
case
|
|
333
|
-
_context7.next =
|
|
332
|
+
case 5:
|
|
333
|
+
_context7.next = 6;
|
|
334
334
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess6 = options.onSuccess) === null || _options$onSuccess6 === void 0 ? void 0 : _options$onSuccess6.call(options, res);
|
|
335
|
-
case
|
|
335
|
+
case 6:
|
|
336
336
|
return _context7.abrupt("return", res);
|
|
337
|
-
case
|
|
337
|
+
case 7:
|
|
338
338
|
case "end":
|
|
339
339
|
return _context7.stop();
|
|
340
340
|
}
|
|
341
341
|
}, _callee7, this);
|
|
342
342
|
}));
|
|
343
|
-
function _delete(
|
|
343
|
+
function _delete(_x11, _x12) {
|
|
344
344
|
return _delete2.apply(this, arguments);
|
|
345
345
|
}
|
|
346
346
|
return _delete;
|
|
347
347
|
}();
|
|
348
|
-
_proto
|
|
349
|
-
var
|
|
350
|
-
var
|
|
351
|
-
|
|
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;
|
|
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
|
|
371
|
-
case
|
|
452
|
+
return _context0.abrupt("return");
|
|
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
|
|
378
|
-
case
|
|
459
|
+
return _context0.abrupt("return");
|
|
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
|
|
385
|
-
case
|
|
386
|
-
|
|
466
|
+
return _context0.abrupt("return");
|
|
467
|
+
case 4:
|
|
468
|
+
_context0.next = 6;
|
|
387
469
|
break;
|
|
388
|
-
case
|
|
389
|
-
|
|
390
|
-
|
|
470
|
+
case 5:
|
|
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,
|
|
@@ -397,13 +479,13 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
397
479
|
message: res.message
|
|
398
480
|
})
|
|
399
481
|
});
|
|
400
|
-
case
|
|
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(
|
|
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;
|
|
@@ -5,21 +5,21 @@ export function getSchema(_x, _x2) {
|
|
|
5
5
|
return _getSchema.apply(this, arguments);
|
|
6
6
|
}
|
|
7
7
|
function _getSchema() {
|
|
8
|
-
_getSchema = _asyncToGenerator(
|
|
8
|
+
_getSchema = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageId, mock) {
|
|
9
9
|
var key;
|
|
10
|
-
return _regeneratorRuntime.wrap(function
|
|
10
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
11
11
|
while (1) switch (_context.prev = _context.next) {
|
|
12
12
|
case 0:
|
|
13
13
|
mock = getMock(mock);
|
|
14
14
|
key = mock ? pageId + ":mock" : pageId;
|
|
15
|
-
_context.next =
|
|
15
|
+
_context.next = 1;
|
|
16
16
|
return schema.getInstance(key, {
|
|
17
17
|
mock: mock,
|
|
18
18
|
pageId: pageId
|
|
19
19
|
});
|
|
20
|
-
case
|
|
20
|
+
case 1:
|
|
21
21
|
return _context.abrupt("return", _context.sent);
|
|
22
|
-
case
|
|
22
|
+
case 2:
|
|
23
23
|
case "end":
|
|
24
24
|
return _context.stop();
|
|
25
25
|
}
|