@zhubangyun/lowcode-core 5.4.120 → 5.4.150

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.
@@ -6,3 +6,5 @@ export { RestFormApi } from "./form-api";
6
6
  export declare const apiRequest: import("axios").AxiosInstance;
7
7
  export declare function getSchema(pageId: string, mock?: boolean): Promise<OneResult<any>>;
8
8
  export declare function getFormApi(formId: string, fieldId?: string, mock?: boolean): Promise<RestFormApi<any>>;
9
+ export declare function onFulfilled(res: any): any;
10
+ export declare function onRejected(error: any): any;
@@ -1,7 +1,6 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import axios from "axios";
4
- import { onFulfilled, onRejected } from "./request";
5
4
  import { formApi, schema } from "../cache";
6
5
  export { RestApi } from "./rest-api";
7
6
  export { loadUserInfo } from "./user-info";
@@ -76,4 +75,19 @@ function _getFormApi() {
76
75
  }, _callee2);
77
76
  }));
78
77
  return _getFormApi.apply(this, arguments);
78
+ }
79
+ export function onFulfilled(res) {
80
+ return res.data;
81
+ }
82
+ export function onRejected(error) {
83
+ var _error$response = error.response,
84
+ status = _error$response.status,
85
+ statusText = _error$response.statusText;
86
+ if (status == 400) {
87
+ return error.response.data || {};
88
+ }
89
+ return {
90
+ success: false,
91
+ message: statusText
92
+ };
79
93
  }
@@ -2,7 +2,7 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import axios from "axios";
5
- import { onFulfilled, onRejected } from "./request";
5
+ import { onFulfilled, onRejected } from "./index";
6
6
  export var BaseRestApi = /*#__PURE__*/function () {
7
7
  function BaseRestApi(uri, options) {
8
8
  this.uri = void 0;
@@ -7,7 +7,7 @@ var _excluded = ["layout", "form", "onClose"],
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import { PageLayout } from "./page-layout";
9
9
  import ReactDOM from "react-dom";
10
- import { Component } from "react";
10
+ import React, { Component } from "react";
11
11
  import { PageLoadSchema } from "./page-load-schema";
12
12
  import { ReactRender } from "../../components/react-render";
13
13
  import { openPage } from "./index";
@@ -16,13 +16,12 @@ export function showForm(_x) {
16
16
  }
17
17
  function _showForm() {
18
18
  _showForm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(options) {
19
- var container, onClose, restProps, unmount, _options$form, paths, mode, dataId, params, page;
19
+ var container, onClose, restProps, unmount, _options$form, paths, mode, dataId, params, url, page;
20
20
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
21
21
  while (1) switch (_context2.prev = _context2.next) {
22
22
  case 0:
23
23
  container = options.container, onClose = options.onClose, restProps = _objectWithoutPropertiesLoose(options, _excluded2); //容器不存在需要手动取消挂载
24
24
  unmount = !container;
25
- console.log("showForm.options", options);
26
25
  if (container) {
27
26
  _context2.next = 16;
28
27
  break;
@@ -35,8 +34,9 @@ function _showForm() {
35
34
  mode = options.mode, dataId = options.dataId;
36
35
  params = new URLSearchParams();
37
36
  params.set("dataId", dataId || "");
37
+ url = "/" + paths[1] + "/" + paths[2] + "/" + ((_options$form = options.form) === null || _options$form === void 0 ? void 0 : _options$form.id) + "/" + mode + "?" + params.toString();
38
38
  _context2.next = 11;
39
- return openPage("/" + paths[1] + "/" + paths[2] + "/" + ((_options$form = options.form) === null || _options$form === void 0 ? void 0 : _options$form.id) + "/" + mode + "?" + params.toString());
39
+ return openPage(url, url);
40
40
  case 11:
41
41
  page = _context2.sent;
42
42
  console.debug("openPage", page);
@@ -17,10 +17,10 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
17
17
  };
18
18
  _this.handleResize = function () {
19
19
  _this.setState({
20
- width: Math.min(window.innerWidth, 1400)
20
+ width: Math.min(window.innerWidth, 1200)
21
21
  });
22
22
  };
23
- _this.state.width = Math.min(window.innerWidth, 1400);
23
+ _this.state.width = Math.min(window.innerWidth, 1200);
24
24
  return _this;
25
25
  }
26
26
  _inheritsLoose(PageLayout, _Component);
@@ -6,3 +6,5 @@ export { RestFormApi } from "./form-api";
6
6
  export declare const apiRequest: import("axios").AxiosInstance;
7
7
  export declare function getSchema(pageId: string, mock?: boolean): Promise<OneResult<any>>;
8
8
  export declare function getFormApi(formId: string, fieldId?: string, mock?: boolean): Promise<RestFormApi<any>>;
9
+ export declare function onFulfilled(res: any): any;
10
+ export declare function onRejected(error: any): any;
@@ -6,10 +6,11 @@ exports.apiRequest = exports.RestFormApi = exports.RestApi = void 0;
6
6
  exports.getFormApi = getFormApi;
7
7
  exports.getSchema = getSchema;
8
8
  exports.loadUserInfo = void 0;
9
+ exports.onFulfilled = onFulfilled;
10
+ exports.onRejected = onRejected;
9
11
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
13
  var _axios = _interopRequireDefault(require("axios"));
12
- var _request = require("./request");
13
14
  var _cache = require("../cache");
14
15
  var _restApi = require("./rest-api");
15
16
  exports.RestApi = _restApi.RestApi;
@@ -26,7 +27,7 @@ var apiRequest = exports.apiRequest = _axios["default"].create({
26
27
  'Content-Type': 'application/json;charset=UTF-8'
27
28
  }
28
29
  });
29
- apiRequest.interceptors.response.use(_request.onFulfilled, _request.onRejected);
30
+ apiRequest.interceptors.response.use(onFulfilled, onRejected);
30
31
  function getSchema(_x, _x2) {
31
32
  return _getSchema.apply(this, arguments);
32
33
  }
@@ -87,4 +88,19 @@ function _getFormApi() {
87
88
  }, _callee2);
88
89
  }));
89
90
  return _getFormApi.apply(this, arguments);
91
+ }
92
+ function onFulfilled(res) {
93
+ return res.data;
94
+ }
95
+ function onRejected(error) {
96
+ var _error$response = error.response,
97
+ status = _error$response.status,
98
+ statusText = _error$response.statusText;
99
+ if (status == 400) {
100
+ return error.response.data || {};
101
+ }
102
+ return {
103
+ success: false,
104
+ message: statusText
105
+ };
90
106
  }
@@ -7,7 +7,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
7
7
  var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
8
8
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
9
  var _axios = _interopRequireDefault(require("axios"));
10
- var _request = require("./request");
10
+ var _index = require("./index");
11
11
  var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
12
12
  function BaseRestApi(uri, options) {
13
13
  this.uri = void 0;
@@ -24,7 +24,7 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
24
24
  'Content-Type': 'application/json;charset=UTF-8'
25
25
  }
26
26
  });
27
- this.request.interceptors.response.use(_request.onFulfilled, _request.onRejected);
27
+ this.request.interceptors.response.use(_index.onFulfilled, _index.onRejected);
28
28
  }
29
29
  var _proto = BaseRestApi.prototype;
30
30
  _proto.search = /*#__PURE__*/function () {
@@ -10,24 +10,25 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _pageLayout = require("./page-layout");
12
12
  var _reactDom = _interopRequireDefault(require("react-dom"));
13
- var _react = require("react");
13
+ var _react = _interopRequireWildcard(require("react"));
14
14
  var _pageLoadSchema = require("./page-load-schema");
15
15
  var _reactRender = require("../../components/react-render");
16
16
  var _index = require("./index");
17
17
  var _excluded = ["layout", "form", "onClose"],
18
18
  _excluded2 = ["container", "onClose"];
19
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
19
21
  function showForm(_x) {
20
22
  return _showForm.apply(this, arguments);
21
23
  }
22
24
  function _showForm() {
23
25
  _showForm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(options) {
24
- var container, onClose, restProps, unmount, _options$form, paths, mode, dataId, params, page;
26
+ var container, onClose, restProps, unmount, _options$form, paths, mode, dataId, params, url, page;
25
27
  return _regenerator["default"].wrap(function _callee2$(_context2) {
26
28
  while (1) switch (_context2.prev = _context2.next) {
27
29
  case 0:
28
30
  container = options.container, onClose = options.onClose, restProps = (0, _objectWithoutPropertiesLoose2["default"])(options, _excluded2); //容器不存在需要手动取消挂载
29
31
  unmount = !container;
30
- console.log("showForm.options", options);
31
32
  if (container) {
32
33
  _context2.next = 16;
33
34
  break;
@@ -40,8 +41,9 @@ function _showForm() {
40
41
  mode = options.mode, dataId = options.dataId;
41
42
  params = new URLSearchParams();
42
43
  params.set("dataId", dataId || "");
44
+ url = "/" + paths[1] + "/" + paths[2] + "/" + ((_options$form = options.form) === null || _options$form === void 0 ? void 0 : _options$form.id) + "/" + mode + "?" + params.toString();
43
45
  _context2.next = 11;
44
- return (0, _index.openPage)("/" + paths[1] + "/" + paths[2] + "/" + ((_options$form = options.form) === null || _options$form === void 0 ? void 0 : _options$form.id) + "/" + mode + "?" + params.toString());
46
+ return (0, _index.openPage)(url, url);
45
47
  case 11:
46
48
  page = _context2.sent;
47
49
  console.debug("openPage", page);
@@ -50,7 +52,7 @@ function _showForm() {
50
52
  container = document.createElement("div");
51
53
  document.body.append(container);
52
54
  case 16:
53
- _reactDom["default"].render( /*#__PURE__*/React.createElement(FormRender, (0, _extends2["default"])({}, restProps, {
55
+ _reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(FormRender, (0, _extends2["default"])({}, restProps, {
54
56
  onClose: /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
55
57
  return _regenerator["default"].wrap(function _callee$(_context) {
56
58
  while (1) switch (_context.prev = _context.next) {
@@ -109,15 +111,15 @@ var FormRender = /*#__PURE__*/function (_Component) {
109
111
  (_self$layoutRef = self.layoutRef) === null || _self$layoutRef === void 0 ? void 0 : _self$layoutRef.close();
110
112
  onClose === null || onClose === void 0 ? void 0 : onClose();
111
113
  };
112
- return /*#__PURE__*/React.createElement(_pageLayout.PageLayout, {
114
+ return /*#__PURE__*/_react["default"].createElement(_pageLayout.PageLayout, {
113
115
  layout: layout,
114
116
  ref: function ref(layout) {
115
117
  return _this2.layoutRef = layout;
116
118
  }
117
- }, /*#__PURE__*/React.createElement(_pageLoadSchema.PageLoadSchema, {
119
+ }, /*#__PURE__*/_react["default"].createElement(_pageLoadSchema.PageLoadSchema, {
118
120
  pageId: form === null || form === void 0 ? void 0 : form.id
119
121
  }, function (schema) {
120
- return /*#__PURE__*/React.createElement(_reactRender.ReactRender, (0, _extends2["default"])({
122
+ return /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({
121
123
  schema: schema,
122
124
  components: window.__components
123
125
  }, restProps));
@@ -24,10 +24,10 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
24
24
  };
25
25
  _this.handleResize = function () {
26
26
  _this.setState({
27
- width: Math.min(window.innerWidth, 1400)
27
+ width: Math.min(window.innerWidth, 1200)
28
28
  });
29
29
  };
30
- _this.state.width = Math.min(window.innerWidth, 1400);
30
+ _this.state.width = Math.min(window.innerWidth, 1200);
31
31
  return _this;
32
32
  }
33
33
  (0, _inheritsLoose2["default"])(PageLayout, _Component);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhubangyun/lowcode-core",
3
- "version": "5.4.120",
3
+ "version": "5.4.150",
4
4
  "description": "低代码核心",
5
5
  "files": [
6
6
  "lib",
File without changes
File without changes
File without changes
File without changes