@zhubangyun/lowcode-core 5.7.301 → 5.8.290
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 +1 -1
- package/es/components/page-loading/index.less +12 -10
- package/es/index.js +6 -2
- package/es/style.js +1 -0
- package/es/utils/api/form-api.d.ts +2 -1
- package/es/utils/api/form-api.js +44 -112
- package/es/utils/api/form-api.utils.d.ts +8 -0
- package/es/utils/api/form-api.utils.js +199 -0
- package/es/utils/api/rest-api.d.ts +9 -0
- package/es/utils/api/rest-api.js +113 -44
- package/es/utils/cache/schema.d.ts +1 -0
- package/es/utils/cache/schema.js +267 -175
- package/es/utils/data/index.d.ts +1 -0
- package/es/utils/data/index.js +20 -0
- package/es/utils/page/page-layout.js +1 -1
- package/lib/components/load-materials/index.js +1 -1
- package/lib/components/page-loading/index.less +12 -10
- package/lib/index.js +5 -2
- package/lib/style.js +1 -0
- package/lib/utils/api/form-api.d.ts +2 -1
- package/lib/utils/api/form-api.js +49 -117
- package/lib/utils/api/form-api.utils.d.ts +8 -0
- package/lib/utils/api/form-api.utils.js +208 -0
- package/lib/utils/api/rest-api.d.ts +9 -0
- package/lib/utils/api/rest-api.js +113 -44
- package/lib/utils/cache/schema.d.ts +1 -0
- package/lib/utils/cache/schema.js +269 -175
- package/lib/utils/data/index.d.ts +1 -0
- package/lib/utils/data/index.js +24 -0
- package/lib/utils/page/page-layout.js +1 -1
- package/package.json +1 -1
package/es/utils/api/rest-api.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
|
+
import _Typography from "antd/es/typography";
|
|
2
3
|
import _notification from "antd/es/notification";
|
|
3
4
|
import _Modal from "antd/es/modal";
|
|
4
5
|
import _message from "antd/es/message";
|
|
@@ -6,6 +7,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
6
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
8
|
import axios from "axios";
|
|
8
9
|
import { onFulfilled, onRejected } from "./index";
|
|
10
|
+
import { transformerId } from "../data";
|
|
9
11
|
export var BaseRestApi = /*#__PURE__*/function () {
|
|
10
12
|
function BaseRestApi(uri, options) {
|
|
11
13
|
this.uri = void 0;
|
|
@@ -116,7 +118,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
116
118
|
return (_this$handleRequestCo3 = this.handleRequestConfig) === null || _this$handleRequestCo3 === void 0 ? void 0 : _this$handleRequestCo3.call(this, config);
|
|
117
119
|
case 3:
|
|
118
120
|
_context3.next = 5;
|
|
119
|
-
return this.request.post("", data, config);
|
|
121
|
+
return this.request.post("save", data, config);
|
|
120
122
|
case 5:
|
|
121
123
|
res = _context3.sent;
|
|
122
124
|
if (res.success) {
|
|
@@ -286,67 +288,134 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
286
288
|
}
|
|
287
289
|
return deleteById;
|
|
288
290
|
}();
|
|
289
|
-
_proto
|
|
290
|
-
var
|
|
291
|
-
var
|
|
291
|
+
_proto["delete"] = /*#__PURE__*/function () {
|
|
292
|
+
var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data, options) {
|
|
293
|
+
var _this$handleRequestCo7;
|
|
294
|
+
var config, arrayData, idValue, res, _options$onError6, _options$onSuccess6;
|
|
292
295
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
293
296
|
while (1) switch (_context7.prev = _context7.next) {
|
|
294
297
|
case 0:
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (!(
|
|
302
|
-
|
|
303
|
-
|
|
298
|
+
config = {};
|
|
299
|
+
_context7.next = 3;
|
|
300
|
+
return (_this$handleRequestCo7 = this.handleRequestConfig) === null || _this$handleRequestCo7 === void 0 ? void 0 : _this$handleRequestCo7.call(this, config);
|
|
301
|
+
case 3:
|
|
302
|
+
arrayData = [];
|
|
303
|
+
idValue = transformerId(data);
|
|
304
|
+
if (!Array.isArray(idValue)) {
|
|
305
|
+
arrayData.push(idValue);
|
|
306
|
+
} else {
|
|
307
|
+
arrayData = idValue;
|
|
304
308
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
content: message
|
|
309
|
+
arrayData = arrayData.filter(function (item) {
|
|
310
|
+
return !!item;
|
|
308
311
|
});
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if (!(_type == "modal")) {
|
|
312
|
-
_context7.next = 13;
|
|
312
|
+
if (!(arrayData.length == 0)) {
|
|
313
|
+
_context7.next = 9;
|
|
313
314
|
break;
|
|
314
315
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return
|
|
319
|
-
case
|
|
320
|
-
|
|
321
|
-
|
|
316
|
+
throw new Error("删除对象不可为空!");
|
|
317
|
+
case 9:
|
|
318
|
+
_context7.next = 11;
|
|
319
|
+
return this.request.post("remove", arrayData, config);
|
|
320
|
+
case 11:
|
|
321
|
+
res = _context7.sent;
|
|
322
|
+
if (res.success) {
|
|
323
|
+
_context7.next = 18;
|
|
322
324
|
break;
|
|
323
325
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return _context7.abrupt("return");
|
|
326
|
+
this.showError("\u5220\u9664\u5931\u8D25!", res.message).then();
|
|
327
|
+
_context7.next = 16;
|
|
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);
|
|
328
329
|
case 16:
|
|
329
330
|
_context7.next = 20;
|
|
330
331
|
break;
|
|
331
332
|
case 18:
|
|
332
|
-
_context7.
|
|
333
|
-
|
|
333
|
+
_context7.next = 20;
|
|
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);
|
|
334
335
|
case 20:
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
case 22:
|
|
336
|
+
return _context7.abrupt("return", res);
|
|
337
|
+
case 21:
|
|
338
338
|
case "end":
|
|
339
339
|
return _context7.stop();
|
|
340
340
|
}
|
|
341
|
-
}, _callee7, this
|
|
341
|
+
}, _callee7, this);
|
|
342
|
+
}));
|
|
343
|
+
function _delete(_x13, _x14) {
|
|
344
|
+
return _delete2.apply(this, arguments);
|
|
345
|
+
}
|
|
346
|
+
return _delete;
|
|
347
|
+
}();
|
|
348
|
+
_proto.showError = /*#__PURE__*/function () {
|
|
349
|
+
var _showError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(type, msg) {
|
|
350
|
+
var props;
|
|
351
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
352
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
353
|
+
case 0:
|
|
354
|
+
_context8.prev = 0;
|
|
355
|
+
if (!msg) {
|
|
356
|
+
_context8.next = 18;
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
props = JSON.parse(msg);
|
|
360
|
+
props.content = props.message;
|
|
361
|
+
if (!props.title) {
|
|
362
|
+
props.title = "" + this.title + type;
|
|
363
|
+
}
|
|
364
|
+
if (!(props.type == "message")) {
|
|
365
|
+
_context8.next = 10;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
_message.error(props);
|
|
369
|
+
return _context8.abrupt("return");
|
|
370
|
+
case 10:
|
|
371
|
+
if (!(props.type == "modal")) {
|
|
372
|
+
_context8.next = 15;
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
_Modal.error(props);
|
|
376
|
+
return _context8.abrupt("return");
|
|
377
|
+
case 15:
|
|
378
|
+
if (!(props.type == "notification")) {
|
|
379
|
+
_context8.next = 18;
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
_notification.error(props);
|
|
383
|
+
return _context8.abrupt("return");
|
|
384
|
+
case 18:
|
|
385
|
+
_context8.next = 24;
|
|
386
|
+
break;
|
|
387
|
+
case 20:
|
|
388
|
+
_context8.prev = 20;
|
|
389
|
+
_context8.t0 = _context8["catch"](0);
|
|
390
|
+
console.error("" + this.title + type + (msg || ""));
|
|
391
|
+
_Modal.error({
|
|
392
|
+
title: "" + this.title + type,
|
|
393
|
+
centered: true,
|
|
394
|
+
content: /*#__PURE__*/React.createElement(_Typography.Text, {
|
|
395
|
+
type: "danger"
|
|
396
|
+
}, msg || "")
|
|
397
|
+
});
|
|
398
|
+
case 24:
|
|
399
|
+
case "end":
|
|
400
|
+
return _context8.stop();
|
|
401
|
+
}
|
|
402
|
+
}, _callee8, this, [[0, 20]]);
|
|
342
403
|
}));
|
|
343
|
-
function showError(
|
|
404
|
+
function showError(_x15, _x16) {
|
|
344
405
|
return _showError.apply(this, arguments);
|
|
345
406
|
}
|
|
346
407
|
return showError;
|
|
347
408
|
}();
|
|
348
409
|
return BaseRestApi;
|
|
349
410
|
}();
|
|
411
|
+
function getStringId(item) {
|
|
412
|
+
if (typeof (item === null || item === void 0 ? void 0 : item.id) === "string") {
|
|
413
|
+
return item.id;
|
|
414
|
+
} else if (typeof item === "string") {
|
|
415
|
+
return item;
|
|
416
|
+
}
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
350
419
|
export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
|
|
351
420
|
function RestApi(uri, options) {
|
|
352
421
|
return _BaseRestApi2.call(this, uri, options) || this;
|
|
@@ -354,16 +423,16 @@ export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
|
|
|
354
423
|
_inheritsLoose(RestApi, _BaseRestApi2);
|
|
355
424
|
var _proto2 = RestApi.prototype;
|
|
356
425
|
_proto2.handleRequestConfig = /*#__PURE__*/function () {
|
|
357
|
-
var _handleRequestConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
358
|
-
return _regeneratorRuntime.wrap(function
|
|
359
|
-
while (1) switch (
|
|
426
|
+
var _handleRequestConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(config) {
|
|
427
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
428
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
360
429
|
case 0:
|
|
361
430
|
case "end":
|
|
362
|
-
return
|
|
431
|
+
return _context9.stop();
|
|
363
432
|
}
|
|
364
|
-
},
|
|
433
|
+
}, _callee9);
|
|
365
434
|
}));
|
|
366
|
-
function handleRequestConfig(
|
|
435
|
+
function handleRequestConfig(_x17) {
|
|
367
436
|
return _handleRequestConfig.apply(this, arguments);
|
|
368
437
|
}
|
|
369
438
|
return handleRequestConfig;
|
|
@@ -5,3 +5,4 @@ export declare function handleFormSchema(schema: any): Promise<void>;
|
|
|
5
5
|
* @param callback 返回true 继续往下遍历
|
|
6
6
|
*/
|
|
7
7
|
export declare function forEachFormSchema(schema: any, callback: (child: any, index: number, children: any[]) => boolean): void;
|
|
8
|
+
export declare function getAdminFormSchema(id: string): Promise<any>;
|