@zhubangyun/lowcode-core 5.4.150 → 5.4.251
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/react-render/index.js +7 -3
- package/es/index.js +3 -0
- package/es/style.js +2 -2
- package/es/utils/api/form-api.js +0 -1
- package/es/utils/api/rest-api.d.ts +3 -2
- package/es/utils/api/rest-api.js +3 -2
- package/es/utils/cache/index.d.ts +1 -1
- package/es/utils/cache/index.js +1 -1
- package/es/utils/cache/schema.d.ts +4 -0
- package/es/utils/cache/schema.js +22 -1
- package/es/utils/designer/assets/assets.data.base.js +1 -1
- package/es/utils/designer/engine/index.js +6 -2
- package/es/utils/page/index.js +1 -1
- package/es/utils/page/page-form.js +5 -2
- package/es/utils/page/page-layout.d.ts +1 -0
- package/es/utils/page/page-layout.js +6 -7
- package/es/utils/page/page-load-schema.js +10 -2
- package/lib/components/react-render/index.js +7 -3
- package/lib/index.js +6 -4
- package/lib/style.js +2 -2
- package/lib/utils/api/form-api.js +0 -1
- package/lib/utils/api/rest-api.d.ts +3 -2
- package/lib/utils/api/rest-api.js +3 -2
- package/lib/utils/cache/index.d.ts +1 -1
- package/lib/utils/cache/index.js +2 -3
- package/lib/utils/cache/schema.d.ts +4 -0
- package/lib/utils/cache/schema.js +22 -1
- package/lib/utils/designer/assets/assets.data.base.js +1 -1
- package/lib/utils/designer/engine/index.js +6 -2
- package/lib/utils/page/index.js +1 -1
- package/lib/utils/page/page-form.js +5 -2
- package/lib/utils/page/page-layout.d.ts +1 -0
- package/lib/utils/page/page-layout.js +6 -7
- package/lib/utils/page/page-load-schema.js +10 -2
- package/package.json +1 -1
- package/es/utils/api/Request.d.ts +0 -2
- package/es/utils/api/Request.js +0 -15
- package/lib/utils/api/Request.d.ts +0 -2
- package/lib/utils/api/Request.js +0 -20
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import _ConfigProvider from "antd/es/config-provider";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
3
4
|
import { PureComponent } from 'react';
|
|
4
5
|
import { createFetchHandler } from "@alilc/lowcode-datasource-fetch-handler";
|
|
5
6
|
import ReactRenderFactory from "./react-render-factory";
|
|
6
7
|
import utils from "../../utils";
|
|
8
|
+
import zhCN from "antd/locale/zh_CN";
|
|
7
9
|
export var ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
8
10
|
function ReactRender() {
|
|
9
11
|
var _this;
|
|
@@ -21,21 +23,23 @@ export var ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
21
23
|
var _this2 = this;
|
|
22
24
|
var components = this.props.components;
|
|
23
25
|
// @ts-ignore
|
|
24
|
-
return /*#__PURE__*/React.createElement(
|
|
26
|
+
return /*#__PURE__*/React.createElement(_ConfigProvider, {
|
|
27
|
+
locale: zhCN
|
|
28
|
+
}, /*#__PURE__*/React.createElement(ReactRenderFactory, _extends({
|
|
25
29
|
key: this.key
|
|
26
30
|
}, this.props, {
|
|
27
31
|
ref: function ref(node) {
|
|
28
32
|
_this2.node = node === null || node === void 0 ? void 0 : node.__ref;
|
|
29
33
|
},
|
|
30
34
|
thisRequiredInJSE: true,
|
|
31
|
-
components: components || window.
|
|
35
|
+
components: components || window._components || {},
|
|
32
36
|
appHelper: {
|
|
33
37
|
utils: utils,
|
|
34
38
|
requestHandlersMap: {
|
|
35
39
|
fetch: createFetchHandler()
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
|
-
}));
|
|
42
|
+
})));
|
|
39
43
|
};
|
|
40
44
|
return ReactRender;
|
|
41
45
|
}(PureComponent);
|
package/es/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import utils from "./utils";
|
|
2
|
+
import { ReactRender } from "./components/react-render";
|
|
2
3
|
export { RestApi, RestFormApi, apiRequest } from "./utils/api";
|
|
3
4
|
export { Layout } from "./components/layout";
|
|
4
5
|
export { ReactRender } from "./components/react-render";
|
|
5
6
|
// @ts-ignore
|
|
6
7
|
window.utils = utils;
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
window.__ReactRender = ReactRender;
|
|
7
10
|
export { utils };
|
package/es/style.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import 'antd/es/message/style';
|
|
1
2
|
import 'antd/es/drawer/style';
|
|
2
3
|
import 'antd/es/modal/style';
|
|
3
4
|
import 'antd/es/result/style';
|
|
4
5
|
import 'antd/es/spin/style';
|
|
5
|
-
import 'antd/es/
|
|
6
|
-
import 'antd/es/config-provider/style';
|
|
6
|
+
import 'antd/es/config-provider/style';
|
package/es/utils/api/form-api.js
CHANGED
|
@@ -6,7 +6,6 @@ import { getSchema } from "./index";
|
|
|
6
6
|
export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
7
7
|
function RestFormApi(formId, fieldId, mock) {
|
|
8
8
|
var _this;
|
|
9
|
-
console.log(formId, fieldId);
|
|
10
9
|
_this = _RestApi.call(this, "forms", {}) || this;
|
|
11
10
|
_this.formId = void 0;
|
|
12
11
|
_this.fieldId = void 0;
|
|
@@ -5,6 +5,7 @@ export interface RestApiOptions {
|
|
|
5
5
|
*/
|
|
6
6
|
timeout?: number;
|
|
7
7
|
/**
|
|
8
|
+
*
|
|
8
9
|
* 标题 用于message显示
|
|
9
10
|
*/
|
|
10
11
|
title?: string;
|
|
@@ -82,6 +83,6 @@ export interface ManyResult<DataType> extends BaseResult<DataType> {
|
|
|
82
83
|
total: number;
|
|
83
84
|
}
|
|
84
85
|
export interface BaseRequestOptions<DataType> {
|
|
85
|
-
onError?: (res: OneResult<DataType>) => Promise<void
|
|
86
|
-
onSuccess?: (res: OneResult<DataType>) => Promise<void
|
|
86
|
+
onError?: (res: OneResult<DataType>) => Promise<void> | void;
|
|
87
|
+
onSuccess?: (res: OneResult<DataType>) => Promise<void> | void;
|
|
87
88
|
}
|
package/es/utils/api/rest-api.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
|
+
import _message from "antd/es/message";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
5
|
import axios from "axios";
|
|
@@ -300,8 +301,8 @@ export var BaseRestApi = /*#__PURE__*/function () {
|
|
|
300
301
|
while (1) switch (_context7.prev = _context7.next) {
|
|
301
302
|
case 0:
|
|
302
303
|
console.error("{" + this.title + "}" + type + (msg || ""));
|
|
303
|
-
|
|
304
|
-
case
|
|
304
|
+
_message === null || _message === void 0 ? void 0 : _message.error("{" + this.title + "}" + type + (msg || "")).then();
|
|
305
|
+
case 2:
|
|
305
306
|
case "end":
|
|
306
307
|
return _context7.stop();
|
|
307
308
|
}
|
package/es/utils/cache/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import { SingletonInstanceMap } from "../common/SingletonInstanceMap";
|
|
5
|
-
import { RestFormApi } from "../api
|
|
5
|
+
import { RestFormApi } from "../api";
|
|
6
6
|
import { handleFormSchema } from "./schema";
|
|
7
7
|
import { apiRequest } from "../api";
|
|
8
8
|
export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
|
|
@@ -7,6 +7,8 @@ export declare function handleFormSchema(schema: FormSchema): void;
|
|
|
7
7
|
export declare function forEachFormSchema(schema: FormSchema, callback: (child: FormSchema, index: number, children: any[]) => boolean): void;
|
|
8
8
|
export interface FormSchema {
|
|
9
9
|
id?: string;
|
|
10
|
+
state: any;
|
|
11
|
+
methods: any;
|
|
10
12
|
componentName: string;
|
|
11
13
|
formId?: string;
|
|
12
14
|
tableName?: string;
|
|
@@ -22,6 +24,8 @@ export interface FormSchemaProps {
|
|
|
22
24
|
fieldSchema?: any;
|
|
23
25
|
columnName: string;
|
|
24
26
|
array: boolean;
|
|
27
|
+
layout?: "inline";
|
|
28
|
+
fdmSchema?: any;
|
|
25
29
|
associationForm: {
|
|
26
30
|
id: string;
|
|
27
31
|
fieldId: string;
|
package/es/utils/cache/schema.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
export function handleFormSchema(schema) {
|
|
2
2
|
var fdmItems = [];
|
|
3
3
|
var fieldIdMap = new Map();
|
|
4
|
+
schema.state = schema.state || {};
|
|
5
|
+
schema.methods = schema.methods || {};
|
|
4
6
|
forEachFormSchema(schema, function (field) {
|
|
5
7
|
if (field.fdmSchema) {
|
|
8
|
+
var _field$fdmSchema;
|
|
6
9
|
fdmItems.push(field);
|
|
10
|
+
field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
field.fdmSchema.props.noContainer = true;
|
|
7
13
|
}
|
|
8
14
|
if (field.props.fieldId) {
|
|
9
15
|
//删除children防止循环
|
|
@@ -13,13 +19,28 @@ export function handleFormSchema(schema) {
|
|
|
13
19
|
}
|
|
14
20
|
return true;
|
|
15
21
|
});
|
|
22
|
+
//处理查询列
|
|
16
23
|
fdmItems.forEach(function (fdmField) {
|
|
17
24
|
forEachFormSchema(fdmField.fdmSchema, function (field) {
|
|
18
25
|
var _field$props;
|
|
19
26
|
var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
|
|
20
27
|
if (findSchema) {
|
|
21
28
|
field.componentName = findSchema.componentName;
|
|
22
|
-
Object.assign(
|
|
29
|
+
field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
|
|
30
|
+
if (findSchema.componentName == "SubFormField") {
|
|
31
|
+
if (findSchema.fdmSchema) {
|
|
32
|
+
var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
|
|
33
|
+
forEachFormSchema(subFormFdmSchema, function (field) {
|
|
34
|
+
if (field.componentName === "PageFdm") {
|
|
35
|
+
field.props.layout = "inline";
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
field.props.fdmSchema = subFormFdmSchema;
|
|
41
|
+
field.children = subFormFdmSchema.children[0].children;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
23
44
|
}
|
|
24
45
|
return true;
|
|
25
46
|
});
|
|
@@ -18,7 +18,7 @@ var BaseAssets = {
|
|
|
18
18
|
"library": "antd",
|
|
19
19
|
"id": "antd",
|
|
20
20
|
"external": true,
|
|
21
|
-
"urls": ["https://cdn.zhiyunhe.com/plugin/antd/
|
|
21
|
+
"urls": ["https://cdn.zhiyunhe.com/plugin/antd/latest/antd.min.js", "https://cdn.zhiyunhe.com/plugin/antd/latest/reset.css", "https://cdn.zhiyunhe.com/plugin/antdIcon/1.0.0/antdIcon.min.js", "https://cdn.zhiyunhe.com/plugin/lowcode/core/index.js"]
|
|
22
22
|
}, {
|
|
23
23
|
"package": "root-material",
|
|
24
24
|
"version": "0.1.0",
|
|
@@ -99,9 +99,13 @@ export var Engine = function Engine() {
|
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
case 2:
|
|
102
|
-
|
|
102
|
+
if (!schema) {
|
|
103
|
+
_context4.next = 5;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
_context4.next = 5;
|
|
103
107
|
return _this.openDocument(schema);
|
|
104
|
-
case
|
|
108
|
+
case 5:
|
|
105
109
|
case "end":
|
|
106
110
|
return _context4.stop();
|
|
107
111
|
}
|
package/es/utils/page/index.js
CHANGED
|
@@ -33,7 +33,9 @@ function _showForm() {
|
|
|
33
33
|
paths = window.location.pathname.split("/");
|
|
34
34
|
mode = options.mode, dataId = options.dataId;
|
|
35
35
|
params = new URLSearchParams();
|
|
36
|
-
|
|
36
|
+
if (dataId) {
|
|
37
|
+
params.set("dataId", dataId);
|
|
38
|
+
}
|
|
37
39
|
url = "/" + paths[1] + "/" + paths[2] + "/" + ((_options$form = options.form) === null || _options$form === void 0 ? void 0 : _options$form.id) + "/" + mode + "?" + params.toString();
|
|
38
40
|
_context2.next = 11;
|
|
39
41
|
return openPage(url, url);
|
|
@@ -112,9 +114,10 @@ var FormRender = /*#__PURE__*/function (_Component) {
|
|
|
112
114
|
}, /*#__PURE__*/React.createElement(PageLoadSchema, {
|
|
113
115
|
pageId: form === null || form === void 0 ? void 0 : form.id
|
|
114
116
|
}, function (schema) {
|
|
117
|
+
console.log(window._components || window.components || window.__components);
|
|
115
118
|
return /*#__PURE__*/React.createElement(ReactRender, _extends({
|
|
116
119
|
schema: schema,
|
|
117
|
-
components: window.__components
|
|
120
|
+
components: window._components || window.components || window.__components
|
|
118
121
|
}, restProps));
|
|
119
122
|
}));
|
|
120
123
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _Drawer from "antd/es/drawer";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
2
|
import _Modal from "antd/es/modal";
|
|
4
3
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
5
4
|
import React, { Component } from "react";
|
|
@@ -15,12 +14,15 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
15
14
|
open: false
|
|
16
15
|
});
|
|
17
16
|
};
|
|
17
|
+
_this.getWith = function () {
|
|
18
|
+
return Math.min(window.innerWidth, 1440);
|
|
19
|
+
};
|
|
18
20
|
_this.handleResize = function () {
|
|
19
21
|
_this.setState({
|
|
20
|
-
width:
|
|
22
|
+
width: _this.getWith()
|
|
21
23
|
});
|
|
22
24
|
};
|
|
23
|
-
_this.state.width =
|
|
25
|
+
_this.state.width = _this.getWith();
|
|
24
26
|
return _this;
|
|
25
27
|
}
|
|
26
28
|
_inheritsLoose(PageLayout, _Component);
|
|
@@ -53,15 +55,12 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
53
55
|
padding: 0
|
|
54
56
|
}
|
|
55
57
|
},
|
|
56
|
-
keyboard: false,
|
|
57
58
|
maskClosable: false
|
|
58
59
|
};
|
|
59
60
|
if (layout == "modal") {
|
|
60
61
|
return /*#__PURE__*/React.createElement(_Modal, restProps, children);
|
|
61
62
|
} else if (layout == "drawer") {
|
|
62
|
-
return /*#__PURE__*/React.createElement(_Drawer,
|
|
63
|
-
width: Math.max(1200, window.innerWidth)
|
|
64
|
-
}), children);
|
|
63
|
+
return /*#__PURE__*/React.createElement(_Drawer, restProps, children);
|
|
65
64
|
}
|
|
66
65
|
return children;
|
|
67
66
|
};
|
|
@@ -26,13 +26,21 @@ export function PageLoadSchema(props) {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
} else {
|
|
29
|
+
setLoading(false);
|
|
30
|
+
setErrorMsg("页面id不可为空!");
|
|
31
|
+
console.error("页面id不可为空!");
|
|
29
32
|
_message.error("页面id不可为空!").then();
|
|
30
33
|
}
|
|
31
34
|
}, []);
|
|
32
35
|
if (loading) {
|
|
33
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
style: {
|
|
38
|
+
width: "100%",
|
|
39
|
+
height: "100%"
|
|
40
|
+
}
|
|
41
|
+
}, /*#__PURE__*/React.createElement(_Spin, {
|
|
34
42
|
spinning: true
|
|
35
|
-
});
|
|
43
|
+
}));
|
|
36
44
|
}
|
|
37
45
|
if (!schema) {
|
|
38
46
|
return /*#__PURE__*/React.createElement(_Result, {
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.ReactRender = void 0;
|
|
6
|
+
var _configProvider = _interopRequireDefault(require("antd/lib/config-provider"));
|
|
6
7
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
8
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
8
9
|
var _react = require("react");
|
|
9
10
|
var _lowcodeDatasourceFetchHandler = require("@alilc/lowcode-datasource-fetch-handler");
|
|
10
11
|
var _reactRenderFactory = _interopRequireDefault(require("./react-render-factory"));
|
|
11
12
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
13
|
+
var _zh_CN = _interopRequireDefault(require("antd/locale/zh_CN"));
|
|
12
14
|
var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
13
15
|
function ReactRender() {
|
|
14
16
|
var _this;
|
|
@@ -26,21 +28,23 @@ var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
26
28
|
var _this2 = this;
|
|
27
29
|
var components = this.props.components;
|
|
28
30
|
// @ts-ignore
|
|
29
|
-
return /*#__PURE__*/React.createElement(
|
|
31
|
+
return /*#__PURE__*/React.createElement(_configProvider["default"], {
|
|
32
|
+
locale: _zh_CN["default"]
|
|
33
|
+
}, /*#__PURE__*/React.createElement(_reactRenderFactory["default"], (0, _extends2["default"])({
|
|
30
34
|
key: this.key
|
|
31
35
|
}, this.props, {
|
|
32
36
|
ref: function ref(node) {
|
|
33
37
|
_this2.node = node === null || node === void 0 ? void 0 : node.__ref;
|
|
34
38
|
},
|
|
35
39
|
thisRequiredInJSE: true,
|
|
36
|
-
components: components || window.
|
|
40
|
+
components: components || window._components || {},
|
|
37
41
|
appHelper: {
|
|
38
42
|
utils: _utils["default"],
|
|
39
43
|
requestHandlersMap: {
|
|
40
44
|
fetch: (0, _lowcodeDatasourceFetchHandler.createFetchHandler)()
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
|
-
}));
|
|
47
|
+
})));
|
|
44
48
|
};
|
|
45
49
|
return ReactRender;
|
|
46
50
|
}(_react.PureComponent);
|
package/lib/index.js
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.apiRequest = exports.RestFormApi = exports.RestApi = exports.
|
|
5
|
+
exports.apiRequest = exports.RestFormApi = exports.RestApi = exports.Layout = void 0;
|
|
6
6
|
var _utils = _interopRequireDefault(require("./utils"));
|
|
7
7
|
exports.utils = _utils["default"];
|
|
8
|
+
var _reactRender = require("./components/react-render");
|
|
9
|
+
exports.ReactRender = _reactRender.ReactRender;
|
|
8
10
|
var _api = require("./utils/api");
|
|
9
11
|
exports.RestApi = _api.RestApi;
|
|
10
12
|
exports.RestFormApi = _api.RestFormApi;
|
|
11
13
|
exports.apiRequest = _api.apiRequest;
|
|
12
14
|
var _layout = require("./components/layout");
|
|
13
15
|
exports.Layout = _layout.Layout;
|
|
14
|
-
var _reactRender = require("./components/react-render");
|
|
15
|
-
exports.ReactRender = _reactRender.ReactRender;
|
|
16
16
|
// @ts-ignore
|
|
17
|
-
window.utils = _utils["default"];
|
|
17
|
+
window.utils = _utils["default"];
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
window.__ReactRender = _reactRender.ReactRender;
|
package/lib/style.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
require('antd/lib/message/style');
|
|
1
2
|
require('antd/lib/drawer/style');
|
|
2
3
|
require('antd/lib/modal/style');
|
|
3
4
|
require('antd/lib/result/style');
|
|
4
5
|
require('antd/lib/spin/style');
|
|
5
|
-
require('antd/lib/
|
|
6
|
-
require('antd/lib/config-provider/style');
|
|
6
|
+
require('antd/lib/config-provider/style');
|
|
@@ -11,7 +11,6 @@ var _index = require("./index");
|
|
|
11
11
|
var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
12
12
|
function RestFormApi(formId, fieldId, mock) {
|
|
13
13
|
var _this;
|
|
14
|
-
console.log(formId, fieldId);
|
|
15
14
|
_this = _RestApi.call(this, "forms", {}) || this;
|
|
16
15
|
_this.formId = void 0;
|
|
17
16
|
_this.fieldId = void 0;
|
|
@@ -5,6 +5,7 @@ export interface RestApiOptions {
|
|
|
5
5
|
*/
|
|
6
6
|
timeout?: number;
|
|
7
7
|
/**
|
|
8
|
+
*
|
|
8
9
|
* 标题 用于message显示
|
|
9
10
|
*/
|
|
10
11
|
title?: string;
|
|
@@ -82,6 +83,6 @@ export interface ManyResult<DataType> extends BaseResult<DataType> {
|
|
|
82
83
|
total: number;
|
|
83
84
|
}
|
|
84
85
|
export interface BaseRequestOptions<DataType> {
|
|
85
|
-
onError?: (res: OneResult<DataType>) => Promise<void
|
|
86
|
-
onSuccess?: (res: OneResult<DataType>) => Promise<void
|
|
86
|
+
onError?: (res: OneResult<DataType>) => Promise<void> | void;
|
|
87
|
+
onSuccess?: (res: OneResult<DataType>) => Promise<void> | void;
|
|
87
88
|
}
|
|
@@ -5,6 +5,7 @@ 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"));
|
|
8
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
10
|
var _axios = _interopRequireDefault(require("axios"));
|
|
10
11
|
var _index = require("./index");
|
|
@@ -305,8 +306,8 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
305
306
|
while (1) switch (_context7.prev = _context7.next) {
|
|
306
307
|
case 0:
|
|
307
308
|
console.error("{" + this.title + "}" + type + (msg || ""));
|
|
308
|
-
|
|
309
|
-
case
|
|
309
|
+
_message2["default"] === null || _message2["default"] === void 0 ? void 0 : _message2["default"].error("{" + this.title + "}" + type + (msg || "")).then();
|
|
310
|
+
case 2:
|
|
310
311
|
case "end":
|
|
311
312
|
return _context7.stop();
|
|
312
313
|
}
|
package/lib/utils/cache/index.js
CHANGED
|
@@ -7,9 +7,8 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
7
7
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
8
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
9
9
|
var _SingletonInstanceMap3 = require("../common/SingletonInstanceMap");
|
|
10
|
-
var _formApi = require("../api/form-api");
|
|
11
|
-
var _schema = require("./schema");
|
|
12
10
|
var _api = require("../api");
|
|
11
|
+
var _schema = require("./schema");
|
|
13
12
|
var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
|
|
14
13
|
function SchemaCache() {
|
|
15
14
|
return _SingletonInstanceMap.apply(this, arguments) || this;
|
|
@@ -65,7 +64,7 @@ var FormApiCache = exports.FormApiCache = /*#__PURE__*/function (_SingletonInsta
|
|
|
65
64
|
options = {};
|
|
66
65
|
}
|
|
67
66
|
_options = options, formId = _options.formId, fieldId = _options.fieldId, mock = _options.mock;
|
|
68
|
-
formApi = new
|
|
67
|
+
formApi = new _api.RestFormApi(formId, fieldId, mock);
|
|
69
68
|
_context2.next = 5;
|
|
70
69
|
return formApi.initialize();
|
|
71
70
|
case 5:
|
|
@@ -7,6 +7,8 @@ export declare function handleFormSchema(schema: FormSchema): void;
|
|
|
7
7
|
export declare function forEachFormSchema(schema: FormSchema, callback: (child: FormSchema, index: number, children: any[]) => boolean): void;
|
|
8
8
|
export interface FormSchema {
|
|
9
9
|
id?: string;
|
|
10
|
+
state: any;
|
|
11
|
+
methods: any;
|
|
10
12
|
componentName: string;
|
|
11
13
|
formId?: string;
|
|
12
14
|
tableName?: string;
|
|
@@ -22,6 +24,8 @@ export interface FormSchemaProps {
|
|
|
22
24
|
fieldSchema?: any;
|
|
23
25
|
columnName: string;
|
|
24
26
|
array: boolean;
|
|
27
|
+
layout?: "inline";
|
|
28
|
+
fdmSchema?: any;
|
|
25
29
|
associationForm: {
|
|
26
30
|
id: string;
|
|
27
31
|
fieldId: string;
|
|
@@ -6,9 +6,15 @@ exports.handleFormSchema = handleFormSchema;
|
|
|
6
6
|
function handleFormSchema(schema) {
|
|
7
7
|
var fdmItems = [];
|
|
8
8
|
var fieldIdMap = new Map();
|
|
9
|
+
schema.state = schema.state || {};
|
|
10
|
+
schema.methods = schema.methods || {};
|
|
9
11
|
forEachFormSchema(schema, function (field) {
|
|
10
12
|
if (field.fdmSchema) {
|
|
13
|
+
var _field$fdmSchema;
|
|
11
14
|
fdmItems.push(field);
|
|
15
|
+
field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
field.fdmSchema.props.noContainer = true;
|
|
12
18
|
}
|
|
13
19
|
if (field.props.fieldId) {
|
|
14
20
|
//删除children防止循环
|
|
@@ -18,13 +24,28 @@ function handleFormSchema(schema) {
|
|
|
18
24
|
}
|
|
19
25
|
return true;
|
|
20
26
|
});
|
|
27
|
+
//处理查询列
|
|
21
28
|
fdmItems.forEach(function (fdmField) {
|
|
22
29
|
forEachFormSchema(fdmField.fdmSchema, function (field) {
|
|
23
30
|
var _field$props;
|
|
24
31
|
var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
|
|
25
32
|
if (findSchema) {
|
|
26
33
|
field.componentName = findSchema.componentName;
|
|
27
|
-
Object.assign(
|
|
34
|
+
field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
|
|
35
|
+
if (findSchema.componentName == "SubFormField") {
|
|
36
|
+
if (findSchema.fdmSchema) {
|
|
37
|
+
var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
|
|
38
|
+
forEachFormSchema(subFormFdmSchema, function (field) {
|
|
39
|
+
if (field.componentName === "PageFdm") {
|
|
40
|
+
field.props.layout = "inline";
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
});
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
field.props.fdmSchema = subFormFdmSchema;
|
|
46
|
+
field.children = subFormFdmSchema.children[0].children;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
28
49
|
}
|
|
29
50
|
return true;
|
|
30
51
|
});
|
|
@@ -22,7 +22,7 @@ var BaseAssets = {
|
|
|
22
22
|
"library": "antd",
|
|
23
23
|
"id": "antd",
|
|
24
24
|
"external": true,
|
|
25
|
-
"urls": ["https://cdn.zhiyunhe.com/plugin/antd/
|
|
25
|
+
"urls": ["https://cdn.zhiyunhe.com/plugin/antd/latest/antd.min.js", "https://cdn.zhiyunhe.com/plugin/antd/latest/reset.css", "https://cdn.zhiyunhe.com/plugin/antdIcon/1.0.0/antdIcon.min.js", "https://cdn.zhiyunhe.com/plugin/lowcode/core/index.js"]
|
|
26
26
|
}, {
|
|
27
27
|
"package": "root-material",
|
|
28
28
|
"version": "0.1.0",
|
|
@@ -104,9 +104,13 @@ var Engine = exports.Engine = function Engine() {
|
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
case 2:
|
|
107
|
-
|
|
107
|
+
if (!schema) {
|
|
108
|
+
_context4.next = 5;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
_context4.next = 5;
|
|
108
112
|
return _this.openDocument(schema);
|
|
109
|
-
case
|
|
113
|
+
case 5:
|
|
110
114
|
case "end":
|
|
111
115
|
return _context4.stop();
|
|
112
116
|
}
|
package/lib/utils/page/index.js
CHANGED
|
@@ -40,7 +40,9 @@ function _showForm() {
|
|
|
40
40
|
paths = window.location.pathname.split("/");
|
|
41
41
|
mode = options.mode, dataId = options.dataId;
|
|
42
42
|
params = new URLSearchParams();
|
|
43
|
-
|
|
43
|
+
if (dataId) {
|
|
44
|
+
params.set("dataId", dataId);
|
|
45
|
+
}
|
|
44
46
|
url = "/" + paths[1] + "/" + paths[2] + "/" + ((_options$form = options.form) === null || _options$form === void 0 ? void 0 : _options$form.id) + "/" + mode + "?" + params.toString();
|
|
45
47
|
_context2.next = 11;
|
|
46
48
|
return (0, _index.openPage)(url, url);
|
|
@@ -119,9 +121,10 @@ var FormRender = /*#__PURE__*/function (_Component) {
|
|
|
119
121
|
}, /*#__PURE__*/_react["default"].createElement(_pageLoadSchema.PageLoadSchema, {
|
|
120
122
|
pageId: form === null || form === void 0 ? void 0 : form.id
|
|
121
123
|
}, function (schema) {
|
|
124
|
+
console.log(window._components || window.components || window.__components);
|
|
122
125
|
return /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({
|
|
123
126
|
schema: schema,
|
|
124
|
-
components: window.__components
|
|
127
|
+
components: window._components || window.components || window.__components
|
|
125
128
|
}, restProps));
|
|
126
129
|
}));
|
|
127
130
|
};
|
|
@@ -4,7 +4,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.PageLayout = void 0;
|
|
6
6
|
var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
|
|
7
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
7
|
var _modal = _interopRequireDefault(require("antd/lib/modal"));
|
|
9
8
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -22,12 +21,15 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
22
21
|
open: false
|
|
23
22
|
});
|
|
24
23
|
};
|
|
24
|
+
_this.getWith = function () {
|
|
25
|
+
return Math.min(window.innerWidth, 1440);
|
|
26
|
+
};
|
|
25
27
|
_this.handleResize = function () {
|
|
26
28
|
_this.setState({
|
|
27
|
-
width:
|
|
29
|
+
width: _this.getWith()
|
|
28
30
|
});
|
|
29
31
|
};
|
|
30
|
-
_this.state.width =
|
|
32
|
+
_this.state.width = _this.getWith();
|
|
31
33
|
return _this;
|
|
32
34
|
}
|
|
33
35
|
(0, _inheritsLoose2["default"])(PageLayout, _Component);
|
|
@@ -60,15 +62,12 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
60
62
|
padding: 0
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
|
-
keyboard: false,
|
|
64
65
|
maskClosable: false
|
|
65
66
|
};
|
|
66
67
|
if (layout == "modal") {
|
|
67
68
|
return /*#__PURE__*/_react["default"].createElement(_modal["default"], restProps, children);
|
|
68
69
|
} else if (layout == "drawer") {
|
|
69
|
-
return /*#__PURE__*/_react["default"].createElement(_drawer["default"],
|
|
70
|
-
width: Math.max(1200, window.innerWidth)
|
|
71
|
-
}), children);
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement(_drawer["default"], restProps, children);
|
|
72
71
|
}
|
|
73
72
|
return children;
|
|
74
73
|
};
|
|
@@ -31,13 +31,21 @@ function PageLoadSchema(props) {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
} else {
|
|
34
|
+
setLoading(false);
|
|
35
|
+
setErrorMsg("页面id不可为空!");
|
|
36
|
+
console.error("页面id不可为空!");
|
|
34
37
|
_message2["default"].error("页面id不可为空!").then();
|
|
35
38
|
}
|
|
36
39
|
}, []);
|
|
37
40
|
if (loading) {
|
|
38
|
-
return /*#__PURE__*/React.createElement(
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
style: {
|
|
43
|
+
width: "100%",
|
|
44
|
+
height: "100%"
|
|
45
|
+
}
|
|
46
|
+
}, /*#__PURE__*/React.createElement(_spin["default"], {
|
|
39
47
|
spinning: true
|
|
40
|
-
});
|
|
48
|
+
}));
|
|
41
49
|
}
|
|
42
50
|
if (!schema) {
|
|
43
51
|
return /*#__PURE__*/React.createElement(_result["default"], {
|
package/package.json
CHANGED
package/es/utils/api/Request.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function onFulfilled(res) {
|
|
2
|
-
return res.data;
|
|
3
|
-
}
|
|
4
|
-
export function onRejected(error) {
|
|
5
|
-
var _error$response = error.response,
|
|
6
|
-
status = _error$response.status,
|
|
7
|
-
statusText = _error$response.statusText;
|
|
8
|
-
if (status == 400) {
|
|
9
|
-
return error.response.data || {};
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
12
|
-
success: false,
|
|
13
|
-
message: statusText
|
|
14
|
-
};
|
|
15
|
-
}
|
package/lib/utils/api/Request.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.onFulfilled = onFulfilled;
|
|
5
|
-
exports.onRejected = onRejected;
|
|
6
|
-
function onFulfilled(res) {
|
|
7
|
-
return res.data;
|
|
8
|
-
}
|
|
9
|
-
function onRejected(error) {
|
|
10
|
-
var _error$response = error.response,
|
|
11
|
-
status = _error$response.status,
|
|
12
|
-
statusText = _error$response.statusText;
|
|
13
|
-
if (status == 400) {
|
|
14
|
-
return error.response.data || {};
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
success: false,
|
|
18
|
-
message: statusText
|
|
19
|
-
};
|
|
20
|
-
}
|