@zhubangyun/lowcode-core 5.3.184 → 5.4.21

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.js CHANGED
@@ -4,7 +4,6 @@ export { RestFormApi } from "./utils/form/form.api";
4
4
  export { Layout } from "./components/layout";
5
5
  export { SchemaRender } from "./components/schema-render";
6
6
  export { ReactRender } from "./components/react-render";
7
-
8
7
  // @ts-ignore
9
8
  window.utils = utils;
10
9
  export { utils };
package/es/style.js CHANGED
@@ -1,4 +1,3 @@
1
- import 'antd/es/message/style';
2
1
  import 'antd/es/result/style';
3
2
  import 'antd/es/config-provider/style';
4
3
 
@@ -1,5 +1,4 @@
1
1
  import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
- import _message from "antd/es/message";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
4
  import axios from "axios";
@@ -126,7 +125,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
126
125
  _context3.next = 11;
127
126
  break;
128
127
  }
129
- this.showError("\u4FDD\u5B58\u5931\u8D25!", res.message).then();
128
+ this.showError("\u63D0\u4EA4\u5931\u8D25!", res.message).then();
130
129
  _context3.next = 9;
131
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);
132
131
  case 9:
@@ -288,7 +287,8 @@ export var BaseRestApi = /*#__PURE__*/function () {
288
287
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
289
288
  while (1) switch (_context7.prev = _context7.next) {
290
289
  case 0:
291
- _message === null || _message === void 0 ? void 0 : _message.error("{" + this.title + "}" + type + (msg || "")).then();
290
+ console.error("{" + this.title + "}" + type + (msg || ""));
291
+ //message?.error(`{${this.title}}` + type + (msg || "")).then();
292
292
  case 1:
293
293
  case "end":
294
294
  return _context7.stop();
@@ -1,3 +1,5 @@
1
+ import { OneResult } from "./RestApi";
2
+ import { RestFormApi } from "../form/form.api";
1
3
  export declare const request: import("axios").AxiosInstance;
2
- export declare function getSchema(schemaId: string, mock?: boolean): Promise<any>;
3
- export declare function getFormApi(schemaId: string, mock?: boolean): Promise<any>;
4
+ export declare function getSchema(schemaId: string, mock?: boolean): Promise<OneResult<any>>;
5
+ export declare function getFormApi(schemaId: string, mock?: boolean): Promise<RestFormApi<any>>;
@@ -44,12 +44,17 @@ function _getFormApi() {
44
44
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
45
45
  while (1) switch (_context2.prev = _context2.next) {
46
46
  case 0:
47
- key = mock ? schemaId + "_mock" : schemaId;
48
- _context2.next = 3;
47
+ if (typeof mock != "boolean") {
48
+ if (typeof window.__mock == "boolean") {
49
+ mock = window.__mock;
50
+ }
51
+ }
52
+ key = !!mock ? schemaId + "_mock" : schemaId;
53
+ _context2.next = 4;
49
54
  return formApi.getInstance(key);
50
- case 3:
51
- return _context2.abrupt("return", _context2.sent);
52
55
  case 4:
56
+ return _context2.abrupt("return", _context2.sent);
57
+ case 5:
53
58
  case "end":
54
59
  return _context2.stop();
55
60
  }
@@ -8,6 +8,7 @@ export function initEngine() {
8
8
  }
9
9
  function _initEngine() {
10
10
  _initEngine = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
11
+ var _window$AntdProMateri, _window$AntdProMateri2;
11
12
  return _regeneratorRuntime.wrap(function _callee$(_context) {
12
13
  while (1) switch (_context.prev = _context.next) {
13
14
  case 0:
@@ -19,8 +20,13 @@ function _initEngine() {
19
20
  return "https://cdn.zhiyunhe.com/lowcode/designer/" + uri;
20
21
  }));
21
22
  case 2:
23
+ _context.next = 4;
24
+ return loadPlugins(["https://cdn.zhiyunhe.com/plugin/dayjs/dayjs.min.js", "https://cdn.zhiyunhe.com/plugin/antd/latest/reset.css", "https://cdn.zhiyunhe.com/plugin/antd/latest/antd.min.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.css", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.js"]);
25
+ case 4:
26
+ //注册setter
27
+ (_window$AntdProMateri = window.AntdProMaterial) === null || _window$AntdProMateri === void 0 ? void 0 : (_window$AntdProMateri2 = _window$AntdProMateri.registerSetters) === null || _window$AntdProMateri2 === void 0 ? void 0 : _window$AntdProMateri2.call(_window$AntdProMateri);
22
28
  return _context.abrupt("return", new Engine());
23
- case 3:
29
+ case 6:
24
30
  case "end":
25
31
  return _context.stop();
26
32
  }
@@ -19,6 +19,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
19
19
  var _proto = RestFormApi.prototype;
20
20
  _proto.initialize = /*#__PURE__*/function () {
21
21
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
22
+ var res;
22
23
  return _regeneratorRuntime.wrap(function _callee$(_context) {
23
24
  while (1) switch (_context.prev = _context.next) {
24
25
  case 0:
@@ -32,25 +33,26 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
32
33
  _context.next = 7;
33
34
  return getSchema(this.formId, this.mock);
34
35
  case 7:
35
- this.schema = _context.sent;
36
+ res = _context.sent;
37
+ this.schema = res.data;
36
38
  this.initialized = !!this.schema;
37
- _context.next = 15;
39
+ _context.next = 16;
38
40
  break;
39
- case 11:
40
- _context.prev = 11;
41
+ case 12:
42
+ _context.prev = 12;
41
43
  _context.t0 = _context["catch"](4);
42
44
  console.log("获取schema失败!", {
43
45
  id: this.formId,
44
46
  mock: this.mock
45
47
  });
46
48
  throw _context.t0;
47
- case 15:
48
- return _context.abrupt("return", this.initialized);
49
49
  case 16:
50
+ return _context.abrupt("return", this.initialized);
51
+ case 17:
50
52
  case "end":
51
53
  return _context.stop();
52
54
  }
53
- }, _callee, this, [[4, 11]]);
55
+ }, _callee, this, [[4, 12]]);
54
56
  }));
55
57
  function initialize() {
56
58
  return _initialize.apply(this, arguments);
package/lib/style.js CHANGED
@@ -1,4 +1,3 @@
1
- require('antd/lib/message/style');
2
1
  require('antd/lib/result/style');
3
2
  require('antd/lib/config-provider/style');
4
3
 
@@ -5,7 +5,6 @@ exports.__esModule = true;
5
5
  exports.RestApi = exports.BaseRestApi = void 0;
6
6
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
7
  var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
8
- var _message2 = _interopRequireDefault(require("antd/lib/message"));
9
8
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
9
  var _axios = _interopRequireDefault(require("axios"));
11
10
  var _Request = require("./Request");
@@ -131,7 +130,7 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
131
130
  _context3.next = 11;
132
131
  break;
133
132
  }
134
- this.showError("\u4FDD\u5B58\u5931\u8D25!", res.message).then();
133
+ this.showError("\u63D0\u4EA4\u5931\u8D25!", res.message).then();
135
134
  _context3.next = 9;
136
135
  return options === null || options === void 0 ? void 0 : (_options$onError2 = options.onError) === null || _options$onError2 === void 0 ? void 0 : _options$onError2.call(options, res);
137
136
  case 9:
@@ -293,7 +292,8 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
293
292
  return _regenerator["default"].wrap(function _callee7$(_context7) {
294
293
  while (1) switch (_context7.prev = _context7.next) {
295
294
  case 0:
296
- _message2["default"] === null || _message2["default"] === void 0 ? void 0 : _message2["default"].error("{" + this.title + "}" + type + (msg || "")).then();
295
+ console.error("{" + this.title + "}" + type + (msg || ""));
296
+ //message?.error(`{${this.title}}` + type + (msg || "")).then();
297
297
  case 1:
298
298
  case "end":
299
299
  return _context7.stop();
@@ -1,3 +1,5 @@
1
+ import { OneResult } from "./RestApi";
2
+ import { RestFormApi } from "../form/form.api";
1
3
  export declare const request: import("axios").AxiosInstance;
2
- export declare function getSchema(schemaId: string, mock?: boolean): Promise<any>;
3
- export declare function getFormApi(schemaId: string, mock?: boolean): Promise<any>;
4
+ export declare function getSchema(schemaId: string, mock?: boolean): Promise<OneResult<any>>;
5
+ export declare function getFormApi(schemaId: string, mock?: boolean): Promise<RestFormApi<any>>;
@@ -51,12 +51,17 @@ function _getFormApi() {
51
51
  return _regenerator["default"].wrap(function _callee2$(_context2) {
52
52
  while (1) switch (_context2.prev = _context2.next) {
53
53
  case 0:
54
- key = mock ? schemaId + "_mock" : schemaId;
55
- _context2.next = 3;
54
+ if (typeof mock != "boolean") {
55
+ if (typeof window.__mock == "boolean") {
56
+ mock = window.__mock;
57
+ }
58
+ }
59
+ key = !!mock ? schemaId + "_mock" : schemaId;
60
+ _context2.next = 4;
56
61
  return _cache.formApi.getInstance(key);
57
- case 3:
58
- return _context2.abrupt("return", _context2.sent);
59
62
  case 4:
63
+ return _context2.abrupt("return", _context2.sent);
64
+ case 5:
60
65
  case "end":
61
66
  return _context2.stop();
62
67
  }
@@ -15,6 +15,7 @@ function initEngine() {
15
15
  }
16
16
  function _initEngine() {
17
17
  _initEngine = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
18
+ var _window$AntdProMateri, _window$AntdProMateri2;
18
19
  return _regenerator["default"].wrap(function _callee$(_context) {
19
20
  while (1) switch (_context.prev = _context.next) {
20
21
  case 0:
@@ -26,8 +27,13 @@ function _initEngine() {
26
27
  return "https://cdn.zhiyunhe.com/lowcode/designer/" + uri;
27
28
  }));
28
29
  case 2:
30
+ _context.next = 4;
31
+ return (0, _common.loadPlugins)(["https://cdn.zhiyunhe.com/plugin/dayjs/dayjs.min.js", "https://cdn.zhiyunhe.com/plugin/antd/latest/reset.css", "https://cdn.zhiyunhe.com/plugin/antd/latest/antd.min.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.css", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.js"]);
32
+ case 4:
33
+ //注册setter
34
+ (_window$AntdProMateri = window.AntdProMaterial) === null || _window$AntdProMateri === void 0 ? void 0 : (_window$AntdProMateri2 = _window$AntdProMateri.registerSetters) === null || _window$AntdProMateri2 === void 0 ? void 0 : _window$AntdProMateri2.call(_window$AntdProMateri);
29
35
  return _context.abrupt("return", new _engine.Engine());
30
- case 3:
36
+ case 6:
31
37
  case "end":
32
38
  return _context.stop();
33
39
  }
@@ -24,6 +24,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
24
24
  var _proto = RestFormApi.prototype;
25
25
  _proto.initialize = /*#__PURE__*/function () {
26
26
  var _initialize = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
27
+ var res;
27
28
  return _regenerator["default"].wrap(function _callee$(_context) {
28
29
  while (1) switch (_context.prev = _context.next) {
29
30
  case 0:
@@ -37,25 +38,26 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
37
38
  _context.next = 7;
38
39
  return (0, _api.getSchema)(this.formId, this.mock);
39
40
  case 7:
40
- this.schema = _context.sent;
41
+ res = _context.sent;
42
+ this.schema = res.data;
41
43
  this.initialized = !!this.schema;
42
- _context.next = 15;
44
+ _context.next = 16;
43
45
  break;
44
- case 11:
45
- _context.prev = 11;
46
+ case 12:
47
+ _context.prev = 12;
46
48
  _context.t0 = _context["catch"](4);
47
49
  console.log("获取schema失败!", {
48
50
  id: this.formId,
49
51
  mock: this.mock
50
52
  });
51
53
  throw _context.t0;
52
- case 15:
53
- return _context.abrupt("return", this.initialized);
54
54
  case 16:
55
+ return _context.abrupt("return", this.initialized);
56
+ case 17:
55
57
  case "end":
56
58
  return _context.stop();
57
59
  }
58
- }, _callee, this, [[4, 11]]);
60
+ }, _callee, this, [[4, 12]]);
59
61
  }));
60
62
  function initialize() {
61
63
  return _initialize.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhubangyun/lowcode-core",
3
- "version": "5.3.184",
3
+ "version": "5.4.021",
4
4
  "description": "低代码核心",
5
5
  "files": [
6
6
  "lib",
@@ -28,7 +28,6 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@alib/build-scripts": "^0.1.18",
31
-
32
31
  "@alilc/build-plugin-lce": "^0.0.5",
33
32
  "@alilc/lowcode-engine": "^1.1.2",
34
33
  "@alilc/lowcode-test-mate": "^1.0.1",