@zhubangyun/lowcode-core 6.3.20 → 6.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.d.ts +1 -1
- package/es/index.js +5 -5
- package/es/index.less +0 -1
- package/es/utils/api/form-api/form-api.assemble-entity.js +9 -3
- package/es/utils/api/form-api/form-api.utils.js +13 -19
- package/es/utils/api/form-api.d.ts +0 -1
- package/es/utils/api/form-api.js +4 -37
- package/es/utils/api/index.d.ts +6 -1
- package/es/utils/api/rest-api.d.ts +2 -0
- package/es/utils/api/rest-api.js +125 -108
- package/es/utils/api/script-api.d.ts +1 -1
- package/es/utils/cache/cache.load-data.d.ts +1 -0
- package/es/utils/cache/cache.load-data.js +41 -0
- package/es/utils/cache/cache.page-permission.d.ts +1 -0
- package/es/utils/cache/cache.page-permission.js +28 -0
- package/es/utils/cache/cache.page-print.d.ts +1 -0
- package/es/utils/cache/cache.page-print.js +25 -0
- package/es/utils/cache/cache.page-schema.d.ts +1 -0
- package/es/utils/cache/cache.page-schema.js +96 -0
- package/es/utils/cache/cache.print.js +0 -0
- package/es/utils/cache/index.d.ts +5 -6
- package/es/utils/cache/index.js +19 -32
- package/es/utils/cache/index_db_cache.d.ts +11 -6
- package/es/utils/cache/index_db_cache.js +57 -5
- package/es/utils/page/index.js +1 -1
- package/es/utils/page/page-form-data-manager.d.ts +2 -1
- package/es/utils/page/page-form-group.js +10 -4
- package/es/utils/page/page-layout.d.ts +1 -1
- package/es/utils/page/page-load-schema.js +33 -15
- package/es/utils/page/page-render.js +5 -1
- package/es/utils/page/page-schema-utils.js +18 -2
- package/es/utils/page/print-form.js +2 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -6
- package/lib/index.less +0 -1
- package/lib/utils/api/form-api/form-api.assemble-entity.js +9 -3
- package/lib/utils/api/form-api/form-api.utils.js +13 -19
- package/lib/utils/api/form-api.d.ts +0 -1
- package/lib/utils/api/form-api.js +4 -37
- package/lib/utils/api/index.d.ts +6 -1
- package/lib/utils/api/rest-api.d.ts +2 -0
- package/lib/utils/api/rest-api.js +125 -108
- package/lib/utils/api/script-api.d.ts +1 -1
- package/lib/utils/cache/cache.load-data.d.ts +1 -0
- package/lib/utils/cache/cache.load-data.js +44 -0
- package/lib/utils/cache/cache.page-permission.d.ts +1 -0
- package/lib/utils/cache/cache.page-permission.js +33 -0
- package/lib/utils/cache/cache.page-print.d.ts +1 -0
- package/lib/utils/cache/cache.page-print.js +30 -0
- package/lib/utils/cache/cache.page-schema.d.ts +1 -0
- package/lib/utils/cache/cache.page-schema.js +101 -0
- package/lib/utils/cache/cache.print.js +1 -0
- package/lib/utils/cache/index.d.ts +5 -6
- package/lib/utils/cache/index.js +23 -35
- package/lib/utils/cache/index_db_cache.d.ts +11 -6
- package/lib/utils/cache/index_db_cache.js +61 -6
- package/lib/utils/page/index.js +1 -1
- package/lib/utils/page/page-form-data-manager.d.ts +2 -1
- package/lib/utils/page/page-form-group.js +10 -4
- package/lib/utils/page/page-layout.d.ts +1 -1
- package/lib/utils/page/page-load-schema.js +32 -14
- package/lib/utils/page/page-render.js +5 -1
- package/lib/utils/page/page-schema-utils.js +18 -2
- package/lib/utils/page/print-form.js +2 -4
- package/package.json +1 -1
|
@@ -19,24 +19,33 @@ function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof S
|
|
|
19
19
|
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; } }
|
|
20
20
|
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; }
|
|
21
21
|
var SimpleSerialFieldNames = ["parent", "instance"];
|
|
22
|
+
var IgnoreFieldNames = ["createdAt", "createdBy", "updatedAt", "updatedBy"];
|
|
22
23
|
function convertSaveData(data) {
|
|
23
24
|
if (!data) return data;
|
|
24
25
|
var seen = new WeakSet(); // WeakSet 只存储对象,非常适合检测引用
|
|
25
26
|
return JSON.parse(JSON.stringify(data, function (key, value) {
|
|
27
|
+
if (IgnoreFieldNames.includes(key)) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
26
30
|
if (value == null) {
|
|
27
31
|
return null;
|
|
28
32
|
} else if (Array.isArray(value)) {
|
|
29
33
|
return value;
|
|
30
34
|
} else if (typeof value == "object") {
|
|
35
|
+
if (key == "form") {
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
31
38
|
if (SimpleSerialFieldNames.includes(key)) {
|
|
32
39
|
var id = value === null || value === void 0 ? void 0 : value.id;
|
|
33
40
|
return id ? {
|
|
34
|
-
id: id
|
|
41
|
+
id: id,
|
|
42
|
+
form: value === null || value === void 0 ? void 0 : value.form
|
|
35
43
|
} : undefined;
|
|
36
44
|
} else if (seen.has(value)) {
|
|
37
|
-
if (value.id) {
|
|
45
|
+
if (value.id && value.form) {
|
|
38
46
|
return {
|
|
39
|
-
id: value.id
|
|
47
|
+
id: value.id,
|
|
48
|
+
form: value.form
|
|
40
49
|
};
|
|
41
50
|
} else {
|
|
42
51
|
return value;
|
|
@@ -167,24 +176,9 @@ function handleEntityLabel(data) {
|
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
}
|
|
170
|
-
function valueToFormDataArray(value) {
|
|
171
|
-
if (typeof value == null || typeof value !== "object") {
|
|
172
|
-
return [];
|
|
173
|
-
}
|
|
174
|
-
if (Array.isArray(value)) {
|
|
175
|
-
return value === null || value === void 0 ? void 0 : value.filter(function (item) {
|
|
176
|
-
var _item$form;
|
|
177
|
-
return (item === null || item === void 0 ? void 0 : item.id) && (item === null || item === void 0 ? void 0 : (_item$form = item.form) === null || _item$form === void 0 ? void 0 : _item$form.id);
|
|
178
|
-
});
|
|
179
|
-
} else if (typeof value == "object" && value !== null) {
|
|
180
|
-
return valueToFormDataArray([value]);
|
|
181
|
-
} else {
|
|
182
|
-
return [];
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
179
|
function assembleAssociationField(data, refs) {
|
|
186
180
|
var start = Date.now();
|
|
187
|
-
if ((0, _common.isLocalhost)() || (0, _util.isTemplateHost)()) {
|
|
181
|
+
if ((0, _common.isLocalhost)() || (0, _util.isTemplateHost)() || window.__mock) {
|
|
188
182
|
(0, _formApi.formApiAssembleEntity)(data, refs);
|
|
189
183
|
return Date.now() - start;
|
|
190
184
|
}
|
|
@@ -6,7 +6,6 @@ export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
|
6
6
|
private readonly fieldId?;
|
|
7
7
|
private readonly mock;
|
|
8
8
|
private initialized;
|
|
9
|
-
private schema;
|
|
10
9
|
constructor(formId: string, fieldId?: string, mock?: boolean);
|
|
11
10
|
initialize(): Promise<boolean>;
|
|
12
11
|
handleRequestConfig(config: AxiosRequestConfig): Promise<void>;
|
|
@@ -10,7 +10,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
var _restApi = require("./rest-api");
|
|
11
11
|
var _formApi = require("./form-api/form-api.utils");
|
|
12
12
|
var _cache = require("../cache");
|
|
13
|
-
var _schemaApi = require("./schema-api");
|
|
14
13
|
var _common = require("../common");
|
|
15
14
|
function getFormApi(_x, _x2, _x3) {
|
|
16
15
|
return _getFormApi.apply(this, arguments);
|
|
@@ -52,7 +51,6 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
52
51
|
_this.fieldId = void 0;
|
|
53
52
|
_this.mock = void 0;
|
|
54
53
|
_this.initialized = false;
|
|
55
|
-
_this.schema = void 0;
|
|
56
54
|
_this.formId = formId;
|
|
57
55
|
_this.fieldId = fieldId;
|
|
58
56
|
_this.mock = !!mock;
|
|
@@ -62,41 +60,10 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
62
60
|
var _proto = RestFormApi.prototype;
|
|
63
61
|
_proto.initialize = /*#__PURE__*/function () {
|
|
64
62
|
var _initialize = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
65
|
-
var _this2 = this;
|
|
66
|
-
var res, _this$schema, _this$schema$children, _this$schema$children2;
|
|
67
63
|
return _regenerator["default"].wrap(function (_context) {
|
|
68
64
|
while (1) switch (_context.prev = _context.next) {
|
|
69
65
|
case 0:
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
res = (0, _schemaApi.getSchemaFromCache)(this.formId, this.mock);
|
|
73
|
-
this.schema = res === null || res === void 0 ? void 0 : res.data;
|
|
74
|
-
this.initialized = !!this.schema;
|
|
75
|
-
if (this.initialized) {
|
|
76
|
-
this.title = (_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : (_this$schema$children = _this$schema.children[0]) === null || _this$schema$children === void 0 ? void 0 : (_this$schema$children2 = _this$schema$children.props) === null || _this$schema$children2 === void 0 ? void 0 : _this$schema$children2.label;
|
|
77
|
-
if (this.fieldId) {
|
|
78
|
-
JSON.stringify(this.schema, function (key, value) {
|
|
79
|
-
var _value$props;
|
|
80
|
-
if (key == "fdmSchema") {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
if ((value === null || value === void 0 ? void 0 : (_value$props = value.props) === null || _value$props === void 0 ? void 0 : _value$props.fieldId) === _this2.fieldId) {
|
|
84
|
-
if (value.props.label) {
|
|
85
|
-
_this2.title += "." + value.props.label;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return value;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
} catch (e) {
|
|
93
|
-
console.log("获取schema失败!", {
|
|
94
|
-
formId: this.formId,
|
|
95
|
-
field: this.fieldId,
|
|
96
|
-
mock: this.mock
|
|
97
|
-
}, e);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
66
|
+
this.initialized = true;
|
|
100
67
|
return _context.abrupt("return", this.initialized);
|
|
101
68
|
case 1:
|
|
102
69
|
case "end":
|
|
@@ -247,7 +214,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
247
214
|
}();
|
|
248
215
|
_proto.labelToValue = /*#__PURE__*/function () {
|
|
249
216
|
var _labelToValue = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(data, options) {
|
|
250
|
-
var
|
|
217
|
+
var _this2 = this;
|
|
251
218
|
var config, res;
|
|
252
219
|
return _regenerator["default"].wrap(function (_context5) {
|
|
253
220
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -264,8 +231,8 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
264
231
|
res.data.forEach(function (item) {
|
|
265
232
|
item.id = (0, _common.uuid)();
|
|
266
233
|
item.form = {
|
|
267
|
-
id:
|
|
268
|
-
fieldId:
|
|
234
|
+
id: _this2.formId,
|
|
235
|
+
fieldId: _this2.fieldId
|
|
269
236
|
};
|
|
270
237
|
});
|
|
271
238
|
}
|
package/lib/utils/api/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ 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
|
-
|
|
9
|
+
interface RequestResult {
|
|
10
|
+
success: boolean;
|
|
11
|
+
message?: string;
|
|
12
|
+
data: any;
|
|
13
|
+
}
|
|
14
|
+
export declare const request: (config: import("axios").AxiosRequestConfig<any>) => Promise<RequestResult>;
|
|
10
15
|
export declare function onFulfilled(res: AxiosResponse): any;
|
|
11
16
|
export declare function onRejected(error: any): any;
|
|
@@ -45,6 +45,7 @@ export declare abstract class BaseRestApi<DataType> {
|
|
|
45
45
|
*/
|
|
46
46
|
getById(id: string, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
47
47
|
save(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
48
|
+
saveMany(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
48
49
|
/**
|
|
49
50
|
* 创建
|
|
50
51
|
*/
|
|
@@ -98,6 +99,7 @@ export interface IBaseEntity {
|
|
|
98
99
|
labelField: string;
|
|
99
100
|
};
|
|
100
101
|
_load?: boolean;
|
|
102
|
+
_process?: boolean;
|
|
101
103
|
}
|
|
102
104
|
/**
|
|
103
105
|
* 基础返回结果
|
|
@@ -151,6 +151,23 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
151
151
|
return _save.apply(this, arguments);
|
|
152
152
|
}
|
|
153
153
|
return save;
|
|
154
|
+
}();
|
|
155
|
+
_proto.saveMany = /*#__PURE__*/function () {
|
|
156
|
+
var _saveMany = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(data, options) {
|
|
157
|
+
return _regenerator["default"].wrap(function (_context4) {
|
|
158
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
159
|
+
case 0:
|
|
160
|
+
return _context4.abrupt("return", this.save(data, options));
|
|
161
|
+
case 1:
|
|
162
|
+
case "end":
|
|
163
|
+
return _context4.stop();
|
|
164
|
+
}
|
|
165
|
+
}, _callee4, this);
|
|
166
|
+
}));
|
|
167
|
+
function saveMany(_x6, _x7) {
|
|
168
|
+
return _saveMany.apply(this, arguments);
|
|
169
|
+
}
|
|
170
|
+
return saveMany;
|
|
154
171
|
}()
|
|
155
172
|
/**
|
|
156
173
|
* 创建
|
|
@@ -159,42 +176,42 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
159
176
|
_proto.create =
|
|
160
177
|
/*#__PURE__*/
|
|
161
178
|
function () {
|
|
162
|
-
var _create = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
179
|
+
var _create = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(data, options) {
|
|
163
180
|
var _this$handleRequestCo4;
|
|
164
181
|
var config, res, _options$onError3, _options$onSuccess3;
|
|
165
|
-
return _regenerator["default"].wrap(function (
|
|
166
|
-
while (1) switch (
|
|
182
|
+
return _regenerator["default"].wrap(function (_context5) {
|
|
183
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
167
184
|
case 0:
|
|
168
185
|
config = {};
|
|
169
|
-
|
|
186
|
+
_context5.next = 1;
|
|
170
187
|
return (_this$handleRequestCo4 = this.handleRequestConfig) === null || _this$handleRequestCo4 === void 0 ? void 0 : _this$handleRequestCo4.call(this, config);
|
|
171
188
|
case 1:
|
|
172
|
-
|
|
189
|
+
_context5.next = 2;
|
|
173
190
|
return this.request.post("", data, config);
|
|
174
191
|
case 2:
|
|
175
|
-
res =
|
|
192
|
+
res = _context5.sent;
|
|
176
193
|
if (res.success) {
|
|
177
|
-
|
|
194
|
+
_context5.next = 4;
|
|
178
195
|
break;
|
|
179
196
|
}
|
|
180
197
|
this.showError("\u65B0\u589E\u5931\u8D25!", res).then();
|
|
181
|
-
|
|
198
|
+
_context5.next = 3;
|
|
182
199
|
return options === null || options === void 0 ? void 0 : (_options$onError3 = options.onError) === null || _options$onError3 === void 0 ? void 0 : _options$onError3.call(options, res);
|
|
183
200
|
case 3:
|
|
184
|
-
|
|
201
|
+
_context5.next = 5;
|
|
185
202
|
break;
|
|
186
203
|
case 4:
|
|
187
|
-
|
|
204
|
+
_context5.next = 5;
|
|
188
205
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 ? void 0 : _options$onSuccess3.call(options, res);
|
|
189
206
|
case 5:
|
|
190
|
-
return
|
|
207
|
+
return _context5.abrupt("return", res);
|
|
191
208
|
case 6:
|
|
192
209
|
case "end":
|
|
193
|
-
return
|
|
210
|
+
return _context5.stop();
|
|
194
211
|
}
|
|
195
|
-
},
|
|
212
|
+
}, _callee5, this);
|
|
196
213
|
}));
|
|
197
|
-
function create(
|
|
214
|
+
function create(_x8, _x9) {
|
|
198
215
|
return _create.apply(this, arguments);
|
|
199
216
|
}
|
|
200
217
|
return create;
|
|
@@ -206,42 +223,42 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
206
223
|
_proto.update =
|
|
207
224
|
/*#__PURE__*/
|
|
208
225
|
function () {
|
|
209
|
-
var _update = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
226
|
+
var _update = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(id, data, options) {
|
|
210
227
|
var _this$handleRequestCo5;
|
|
211
228
|
var config, res, _options$onError4, _options$onSuccess4;
|
|
212
|
-
return _regenerator["default"].wrap(function (
|
|
213
|
-
while (1) switch (
|
|
229
|
+
return _regenerator["default"].wrap(function (_context6) {
|
|
230
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
214
231
|
case 0:
|
|
215
232
|
config = {};
|
|
216
|
-
|
|
233
|
+
_context6.next = 1;
|
|
217
234
|
return (_this$handleRequestCo5 = this.handleRequestConfig) === null || _this$handleRequestCo5 === void 0 ? void 0 : _this$handleRequestCo5.call(this, config);
|
|
218
235
|
case 1:
|
|
219
|
-
|
|
236
|
+
_context6.next = 2;
|
|
220
237
|
return this.request.put(String(id), data, config);
|
|
221
238
|
case 2:
|
|
222
|
-
res =
|
|
239
|
+
res = _context6.sent;
|
|
223
240
|
if (res.success) {
|
|
224
|
-
|
|
241
|
+
_context6.next = 4;
|
|
225
242
|
break;
|
|
226
243
|
}
|
|
227
244
|
this.showError("\u66F4\u65B0\u5931\u8D25!", res).then();
|
|
228
|
-
|
|
245
|
+
_context6.next = 3;
|
|
229
246
|
return options === null || options === void 0 ? void 0 : (_options$onError4 = options.onError) === null || _options$onError4 === void 0 ? void 0 : _options$onError4.call(options, res);
|
|
230
247
|
case 3:
|
|
231
|
-
|
|
248
|
+
_context6.next = 5;
|
|
232
249
|
break;
|
|
233
250
|
case 4:
|
|
234
|
-
|
|
251
|
+
_context6.next = 5;
|
|
235
252
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess4 = options.onSuccess) === null || _options$onSuccess4 === void 0 ? void 0 : _options$onSuccess4.call(options, res);
|
|
236
253
|
case 5:
|
|
237
|
-
return
|
|
254
|
+
return _context6.abrupt("return", res);
|
|
238
255
|
case 6:
|
|
239
256
|
case "end":
|
|
240
|
-
return
|
|
257
|
+
return _context6.stop();
|
|
241
258
|
}
|
|
242
|
-
},
|
|
259
|
+
}, _callee6, this);
|
|
243
260
|
}));
|
|
244
|
-
function update(
|
|
261
|
+
function update(_x0, _x1, _x10) {
|
|
245
262
|
return _update.apply(this, arguments);
|
|
246
263
|
}
|
|
247
264
|
return update;
|
|
@@ -253,55 +270,55 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
253
270
|
_proto.deleteById =
|
|
254
271
|
/*#__PURE__*/
|
|
255
272
|
function () {
|
|
256
|
-
var _deleteById = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
273
|
+
var _deleteById = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(id, options) {
|
|
257
274
|
var _this$handleRequestCo6;
|
|
258
275
|
var config, res, _options$onError5, _options$onSuccess5;
|
|
259
|
-
return _regenerator["default"].wrap(function (
|
|
260
|
-
while (1) switch (
|
|
276
|
+
return _regenerator["default"].wrap(function (_context7) {
|
|
277
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
261
278
|
case 0:
|
|
262
279
|
config = {};
|
|
263
|
-
|
|
280
|
+
_context7.next = 1;
|
|
264
281
|
return (_this$handleRequestCo6 = this.handleRequestConfig) === null || _this$handleRequestCo6 === void 0 ? void 0 : _this$handleRequestCo6.call(this, config);
|
|
265
282
|
case 1:
|
|
266
|
-
|
|
283
|
+
_context7.next = 2;
|
|
267
284
|
return this.request["delete"](String(id), config);
|
|
268
285
|
case 2:
|
|
269
|
-
res =
|
|
286
|
+
res = _context7.sent;
|
|
270
287
|
if (res.success) {
|
|
271
|
-
|
|
288
|
+
_context7.next = 4;
|
|
272
289
|
break;
|
|
273
290
|
}
|
|
274
291
|
this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res).then();
|
|
275
|
-
|
|
292
|
+
_context7.next = 3;
|
|
276
293
|
return options === null || options === void 0 ? void 0 : (_options$onError5 = options.onError) === null || _options$onError5 === void 0 ? void 0 : _options$onError5.call(options, res);
|
|
277
294
|
case 3:
|
|
278
|
-
|
|
295
|
+
_context7.next = 5;
|
|
279
296
|
break;
|
|
280
297
|
case 4:
|
|
281
|
-
|
|
298
|
+
_context7.next = 5;
|
|
282
299
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess5 = options.onSuccess) === null || _options$onSuccess5 === void 0 ? void 0 : _options$onSuccess5.call(options, res);
|
|
283
300
|
case 5:
|
|
284
|
-
return
|
|
301
|
+
return _context7.abrupt("return", res);
|
|
285
302
|
case 6:
|
|
286
303
|
case "end":
|
|
287
|
-
return
|
|
304
|
+
return _context7.stop();
|
|
288
305
|
}
|
|
289
|
-
},
|
|
306
|
+
}, _callee7, this);
|
|
290
307
|
}));
|
|
291
|
-
function deleteById(
|
|
308
|
+
function deleteById(_x11, _x12) {
|
|
292
309
|
return _deleteById.apply(this, arguments);
|
|
293
310
|
}
|
|
294
311
|
return deleteById;
|
|
295
312
|
}();
|
|
296
313
|
_proto["delete"] = /*#__PURE__*/function () {
|
|
297
|
-
var _delete2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
314
|
+
var _delete2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(data, options) {
|
|
298
315
|
var _this$handleRequestCo7;
|
|
299
316
|
var config, arrayData, idValue, res, _options$onError6, _options$onSuccess6;
|
|
300
|
-
return _regenerator["default"].wrap(function (
|
|
301
|
-
while (1) switch (
|
|
317
|
+
return _regenerator["default"].wrap(function (_context8) {
|
|
318
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
302
319
|
case 0:
|
|
303
320
|
config = {};
|
|
304
|
-
|
|
321
|
+
_context8.next = 1;
|
|
305
322
|
return (_this$handleRequestCo7 = this.handleRequestConfig) === null || _this$handleRequestCo7 === void 0 ? void 0 : _this$handleRequestCo7.call(this, config);
|
|
306
323
|
case 1:
|
|
307
324
|
arrayData = [];
|
|
@@ -315,133 +332,133 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
315
332
|
return !!item;
|
|
316
333
|
});
|
|
317
334
|
if (!(arrayData.length == 0)) {
|
|
318
|
-
|
|
335
|
+
_context8.next = 2;
|
|
319
336
|
break;
|
|
320
337
|
}
|
|
321
338
|
throw new Error("删除对象不可为空!");
|
|
322
339
|
case 2:
|
|
323
|
-
|
|
340
|
+
_context8.next = 3;
|
|
324
341
|
return this.request.post("remove", arrayData, config);
|
|
325
342
|
case 3:
|
|
326
|
-
res =
|
|
343
|
+
res = _context8.sent;
|
|
327
344
|
if (res.success) {
|
|
328
|
-
|
|
345
|
+
_context8.next = 5;
|
|
329
346
|
break;
|
|
330
347
|
}
|
|
331
348
|
this.showError("\u5220\u9664\u5931\u8D25!", res).then();
|
|
332
|
-
|
|
349
|
+
_context8.next = 4;
|
|
333
350
|
return options === null || options === void 0 ? void 0 : (_options$onError6 = options.onError) === null || _options$onError6 === void 0 ? void 0 : _options$onError6.call(options, res);
|
|
334
351
|
case 4:
|
|
335
|
-
|
|
352
|
+
_context8.next = 6;
|
|
336
353
|
break;
|
|
337
354
|
case 5:
|
|
338
|
-
|
|
355
|
+
_context8.next = 6;
|
|
339
356
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess6 = options.onSuccess) === null || _options$onSuccess6 === void 0 ? void 0 : _options$onSuccess6.call(options, res);
|
|
340
357
|
case 6:
|
|
341
|
-
return
|
|
358
|
+
return _context8.abrupt("return", res);
|
|
342
359
|
case 7:
|
|
343
360
|
case "end":
|
|
344
|
-
return
|
|
361
|
+
return _context8.stop();
|
|
345
362
|
}
|
|
346
|
-
},
|
|
363
|
+
}, _callee8, this);
|
|
347
364
|
}));
|
|
348
|
-
function _delete(
|
|
365
|
+
function _delete(_x13, _x14) {
|
|
349
366
|
return _delete2.apply(this, arguments);
|
|
350
367
|
}
|
|
351
368
|
return _delete;
|
|
352
369
|
}();
|
|
353
370
|
_proto["export"] = /*#__PURE__*/function () {
|
|
354
|
-
var _export2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
371
|
+
var _export2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(data, options) {
|
|
355
372
|
var _this$handleRequestCo8;
|
|
356
373
|
var config, res, _options$onError7, _options$onSuccess7;
|
|
357
|
-
return _regenerator["default"].wrap(function (
|
|
358
|
-
while (1) switch (
|
|
374
|
+
return _regenerator["default"].wrap(function (_context9) {
|
|
375
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
359
376
|
case 0:
|
|
360
377
|
config = {};
|
|
361
|
-
|
|
378
|
+
_context9.next = 1;
|
|
362
379
|
return (_this$handleRequestCo8 = this.handleRequestConfig) === null || _this$handleRequestCo8 === void 0 ? void 0 : _this$handleRequestCo8.call(this, config);
|
|
363
380
|
case 1:
|
|
364
|
-
|
|
381
|
+
_context9.next = 2;
|
|
365
382
|
return this.request.post("/export", data, config);
|
|
366
383
|
case 2:
|
|
367
|
-
res =
|
|
384
|
+
res = _context9.sent;
|
|
368
385
|
if (res.success) {
|
|
369
|
-
|
|
386
|
+
_context9.next = 4;
|
|
370
387
|
break;
|
|
371
388
|
}
|
|
372
389
|
this.showError("\u5BFC\u51FA\u5931\u8D25!", res).then();
|
|
373
|
-
|
|
390
|
+
_context9.next = 3;
|
|
374
391
|
return options === null || options === void 0 ? void 0 : (_options$onError7 = options.onError) === null || _options$onError7 === void 0 ? void 0 : _options$onError7.call(options, res);
|
|
375
392
|
case 3:
|
|
376
|
-
|
|
393
|
+
_context9.next = 5;
|
|
377
394
|
break;
|
|
378
395
|
case 4:
|
|
379
|
-
|
|
396
|
+
_context9.next = 5;
|
|
380
397
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess7 = options.onSuccess) === null || _options$onSuccess7 === void 0 ? void 0 : _options$onSuccess7.call(options, res);
|
|
381
398
|
case 5:
|
|
382
|
-
return
|
|
399
|
+
return _context9.abrupt("return", res);
|
|
383
400
|
case 6:
|
|
384
401
|
case "end":
|
|
385
|
-
return
|
|
402
|
+
return _context9.stop();
|
|
386
403
|
}
|
|
387
|
-
},
|
|
404
|
+
}, _callee9, this);
|
|
388
405
|
}));
|
|
389
|
-
function _export(
|
|
406
|
+
function _export(_x15, _x16) {
|
|
390
407
|
return _export2.apply(this, arguments);
|
|
391
408
|
}
|
|
392
409
|
return _export;
|
|
393
410
|
}();
|
|
394
411
|
_proto["import"] = /*#__PURE__*/function () {
|
|
395
|
-
var _import2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
412
|
+
var _import2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(data, options) {
|
|
396
413
|
var _this$handleRequestCo9;
|
|
397
414
|
var config, res, _options$onError8, _options$onSuccess8;
|
|
398
|
-
return _regenerator["default"].wrap(function (
|
|
399
|
-
while (1) switch (
|
|
415
|
+
return _regenerator["default"].wrap(function (_context0) {
|
|
416
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
400
417
|
case 0:
|
|
401
418
|
config = {};
|
|
402
|
-
|
|
419
|
+
_context0.next = 1;
|
|
403
420
|
return (_this$handleRequestCo9 = this.handleRequestConfig) === null || _this$handleRequestCo9 === void 0 ? void 0 : _this$handleRequestCo9.call(this, config);
|
|
404
421
|
case 1:
|
|
405
|
-
|
|
422
|
+
_context0.next = 2;
|
|
406
423
|
return this.request.post("import", data, config);
|
|
407
424
|
case 2:
|
|
408
|
-
res =
|
|
425
|
+
res = _context0.sent;
|
|
409
426
|
if (res.success) {
|
|
410
|
-
|
|
427
|
+
_context0.next = 4;
|
|
411
428
|
break;
|
|
412
429
|
}
|
|
413
430
|
this.showError("\u5BFC\u5165\u5931\u8D25!", res).then();
|
|
414
|
-
|
|
431
|
+
_context0.next = 3;
|
|
415
432
|
return options === null || options === void 0 ? void 0 : (_options$onError8 = options.onError) === null || _options$onError8 === void 0 ? void 0 : _options$onError8.call(options, res);
|
|
416
433
|
case 3:
|
|
417
|
-
|
|
434
|
+
_context0.next = 5;
|
|
418
435
|
break;
|
|
419
436
|
case 4:
|
|
420
|
-
|
|
437
|
+
_context0.next = 5;
|
|
421
438
|
return options === null || options === void 0 ? void 0 : (_options$onSuccess8 = options.onSuccess) === null || _options$onSuccess8 === void 0 ? void 0 : _options$onSuccess8.call(options, res);
|
|
422
439
|
case 5:
|
|
423
|
-
return
|
|
440
|
+
return _context0.abrupt("return", res);
|
|
424
441
|
case 6:
|
|
425
442
|
case "end":
|
|
426
|
-
return
|
|
443
|
+
return _context0.stop();
|
|
427
444
|
}
|
|
428
|
-
},
|
|
445
|
+
}, _callee0, this);
|
|
429
446
|
}));
|
|
430
|
-
function _import(
|
|
447
|
+
function _import(_x17, _x18) {
|
|
431
448
|
return _import2.apply(this, arguments);
|
|
432
449
|
}
|
|
433
450
|
return _import;
|
|
434
451
|
}();
|
|
435
452
|
_proto.showError = /*#__PURE__*/function () {
|
|
436
|
-
var _showError = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
453
|
+
var _showError = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee1(type, res) {
|
|
437
454
|
var msg, props, _t;
|
|
438
|
-
return _regenerator["default"].wrap(function (
|
|
439
|
-
while (1) switch (
|
|
455
|
+
return _regenerator["default"].wrap(function (_context1) {
|
|
456
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
440
457
|
case 0:
|
|
441
458
|
msg = res.message;
|
|
442
|
-
|
|
459
|
+
_context1.prev = 1;
|
|
443
460
|
if (!msg) {
|
|
444
|
-
|
|
461
|
+
_context1.next = 4;
|
|
445
462
|
break;
|
|
446
463
|
}
|
|
447
464
|
props = JSON.parse(msg);
|
|
@@ -450,31 +467,31 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
450
467
|
props.title = "" + this.title + type;
|
|
451
468
|
}
|
|
452
469
|
if (!(props.type == "message")) {
|
|
453
|
-
|
|
470
|
+
_context1.next = 2;
|
|
454
471
|
break;
|
|
455
472
|
}
|
|
456
473
|
_message2["default"].error(props);
|
|
457
|
-
return
|
|
474
|
+
return _context1.abrupt("return");
|
|
458
475
|
case 2:
|
|
459
476
|
if (!(props.type == "modal")) {
|
|
460
|
-
|
|
477
|
+
_context1.next = 3;
|
|
461
478
|
break;
|
|
462
479
|
}
|
|
463
480
|
_modal["default"].error(props);
|
|
464
|
-
return
|
|
481
|
+
return _context1.abrupt("return");
|
|
465
482
|
case 3:
|
|
466
483
|
if (!(props.type == "notification")) {
|
|
467
|
-
|
|
484
|
+
_context1.next = 4;
|
|
468
485
|
break;
|
|
469
486
|
}
|
|
470
487
|
_notification2["default"].error(props);
|
|
471
|
-
return
|
|
488
|
+
return _context1.abrupt("return");
|
|
472
489
|
case 4:
|
|
473
|
-
|
|
490
|
+
_context1.next = 6;
|
|
474
491
|
break;
|
|
475
492
|
case 5:
|
|
476
|
-
|
|
477
|
-
_t =
|
|
493
|
+
_context1.prev = 5;
|
|
494
|
+
_t = _context1["catch"](1);
|
|
478
495
|
console.error("" + this.title + type + (msg || ""));
|
|
479
496
|
_modal["default"].error({
|
|
480
497
|
title: "" + this.title + type,
|
|
@@ -486,11 +503,11 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
486
503
|
});
|
|
487
504
|
case 6:
|
|
488
505
|
case "end":
|
|
489
|
-
return
|
|
506
|
+
return _context1.stop();
|
|
490
507
|
}
|
|
491
|
-
},
|
|
508
|
+
}, _callee1, this, [[1, 5]]);
|
|
492
509
|
}));
|
|
493
|
-
function showError(
|
|
510
|
+
function showError(_x19, _x20) {
|
|
494
511
|
return _showError.apply(this, arguments);
|
|
495
512
|
}
|
|
496
513
|
return showError;
|
|
@@ -512,16 +529,16 @@ var RestApi = exports.RestApi = /*#__PURE__*/function (_BaseRestApi2) {
|
|
|
512
529
|
(0, _inheritsLoose2["default"])(RestApi, _BaseRestApi2);
|
|
513
530
|
var _proto2 = RestApi.prototype;
|
|
514
531
|
_proto2.handleRequestConfig = /*#__PURE__*/function () {
|
|
515
|
-
var _handleRequestConfig = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
516
|
-
return _regenerator["default"].wrap(function (
|
|
517
|
-
while (1) switch (
|
|
532
|
+
var _handleRequestConfig = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee10(config) {
|
|
533
|
+
return _regenerator["default"].wrap(function (_context10) {
|
|
534
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
518
535
|
case 0:
|
|
519
536
|
case "end":
|
|
520
|
-
return
|
|
537
|
+
return _context10.stop();
|
|
521
538
|
}
|
|
522
|
-
},
|
|
539
|
+
}, _callee10);
|
|
523
540
|
}));
|
|
524
|
-
function handleRequestConfig(
|
|
541
|
+
function handleRequestConfig(_x21) {
|
|
525
542
|
return _handleRequestConfig.apply(this, arguments);
|
|
526
543
|
}
|
|
527
544
|
return handleRequestConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function loadDts(): Promise<any
|
|
1
|
+
export declare function loadDts(): Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare function cacheLoadSchemas(): Promise<any>;
|