@zhubangyun/lowcode-core 1.1.0
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/layout/index.d.ts +34 -0
- package/es/components/layout/index.js +63 -0
- package/es/components/layout/index.less +20 -0
- package/es/components/schema-render/components/assets.d.ts +32 -0
- package/es/components/schema-render/components/assets.js +53 -0
- package/es/components/schema-render/components/demo-schema.d.ts +85 -0
- package/es/components/schema-render/components/demo-schema.js +107 -0
- package/es/components/schema-render/components/schema-render-base.d.ts +43 -0
- package/es/components/schema-render/components/schema-render-base.js +142 -0
- package/es/components/schema-render/components/schema-render-layout.d.ts +6 -0
- package/es/components/schema-render/components/schema-render-layout.js +46 -0
- package/es/components/schema-render/index.d.ts +31 -0
- package/es/components/schema-render/index.js +46 -0
- package/es/components/typing.d.ts +3 -0
- package/es/components/typing.js +12 -0
- package/es/index.d.ts +7 -0
- package/es/index.js +7 -0
- package/es/pages/data/assets.d.ts +32 -0
- package/es/pages/data/assets.js +53 -0
- package/es/pages/data/schema.d.ts +50 -0
- package/es/pages/data/schema.js +49 -0
- package/es/pages/index.d.ts +1 -0
- package/es/pages/index.js +31 -0
- package/es/pages/index.less +0 -0
- package/es/style.js +6 -0
- package/es/utils/api/index.d.ts +1 -0
- package/es/utils/api/index.js +12 -0
- package/es/utils/common/ClientCache.d.ts +36 -0
- package/es/utils/common/ClientCache.js +120 -0
- package/es/utils/common/FormDataHandler.d.ts +45 -0
- package/es/utils/common/FormDataHandler.js +410 -0
- package/es/utils/common/LoadPlugins.d.ts +1 -0
- package/es/utils/common/LoadPlugins.js +158 -0
- package/es/utils/common/ProcessHandler.d.ts +30 -0
- package/es/utils/common/ProcessHandler.js +303 -0
- package/es/utils/common/Request.d.ts +2 -0
- package/es/utils/common/Request.js +20 -0
- package/es/utils/common/RestApi.d.ts +80 -0
- package/es/utils/common/RestApi.js +226 -0
- package/es/utils/common/RestFormApi.d.ts +12 -0
- package/es/utils/common/RestFormApi.js +158 -0
- package/es/utils/common/SubFormInstance.d.ts +26 -0
- package/es/utils/common/SubFormInstance.js +100 -0
- package/es/utils/common/UserInfo.d.ts +9 -0
- package/es/utils/common/UserInfo.js +19 -0
- package/es/utils/common/index.d.ts +7 -0
- package/es/utils/common/index.js +39 -0
- package/es/utils/index.d.ts +17 -0
- package/es/utils/index.js +11 -0
- package/es/utils/lowcode/index.d.ts +1 -0
- package/es/utils/lowcode/index.js +1 -0
- package/es/utils/lowcode/parseAssets.d.ts +3 -0
- package/es/utils/lowcode/parseAssets.js +185 -0
- package/lib/components/layout/index.d.ts +34 -0
- package/lib/components/layout/index.js +69 -0
- package/lib/components/layout/index.less +20 -0
- package/lib/components/schema-render/components/assets.d.ts +32 -0
- package/lib/components/schema-render/components/assets.js +57 -0
- package/lib/components/schema-render/components/demo-schema.d.ts +85 -0
- package/lib/components/schema-render/components/demo-schema.js +111 -0
- package/lib/components/schema-render/components/schema-render-base.d.ts +43 -0
- package/lib/components/schema-render/components/schema-render-base.js +149 -0
- package/lib/components/schema-render/components/schema-render-layout.d.ts +6 -0
- package/lib/components/schema-render/components/schema-render-layout.js +51 -0
- package/lib/components/schema-render/index.d.ts +31 -0
- package/lib/components/schema-render/index.js +53 -0
- package/lib/components/typing.d.ts +3 -0
- package/lib/components/typing.js +17 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +15 -0
- package/lib/pages/data/assets.d.ts +32 -0
- package/lib/pages/data/assets.js +57 -0
- package/lib/pages/data/schema.d.ts +50 -0
- package/lib/pages/data/schema.js +53 -0
- package/lib/pages/index.d.ts +1 -0
- package/lib/pages/index.js +34 -0
- package/lib/pages/index.less +0 -0
- package/lib/style.js +6 -0
- package/lib/utils/api/index.d.ts +1 -0
- package/lib/utils/api/index.js +17 -0
- package/lib/utils/common/ClientCache.d.ts +36 -0
- package/lib/utils/common/ClientCache.js +125 -0
- package/lib/utils/common/FormDataHandler.d.ts +45 -0
- package/lib/utils/common/FormDataHandler.js +416 -0
- package/lib/utils/common/LoadPlugins.d.ts +1 -0
- package/lib/utils/common/LoadPlugins.js +163 -0
- package/lib/utils/common/ProcessHandler.d.ts +30 -0
- package/lib/utils/common/ProcessHandler.js +308 -0
- package/lib/utils/common/Request.d.ts +2 -0
- package/lib/utils/common/Request.js +25 -0
- package/lib/utils/common/RestApi.d.ts +80 -0
- package/lib/utils/common/RestApi.js +230 -0
- package/lib/utils/common/RestFormApi.d.ts +12 -0
- package/lib/utils/common/RestFormApi.js +163 -0
- package/lib/utils/common/SubFormInstance.d.ts +26 -0
- package/lib/utils/common/SubFormInstance.js +105 -0
- package/lib/utils/common/UserInfo.d.ts +9 -0
- package/lib/utils/common/UserInfo.js +24 -0
- package/lib/utils/common/index.d.ts +7 -0
- package/lib/utils/common/index.js +48 -0
- package/lib/utils/index.d.ts +17 -0
- package/lib/utils/index.js +34 -0
- package/lib/utils/lowcode/index.d.ts +1 -0
- package/lib/utils/lowcode/index.js +6 -0
- package/lib/utils/lowcode/parseAssets.d.ts +3 -0
- package/lib/utils/lowcode/parseAssets.js +192 -0
- package/package.json +65 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
3
|
+
import { SchemaRenderBase } from "./components/schema-render-base";
|
|
4
|
+
import React, { Component } from "react";
|
|
5
|
+
import { SchemaRenderLayout } from "./components/schema-render-layout";
|
|
6
|
+
export var SchemaRender = /*#__PURE__*/function (_Component) {
|
|
7
|
+
function SchemaRender(props) {
|
|
8
|
+
var _this;
|
|
9
|
+
_this = _Component.call(this, props) || this;
|
|
10
|
+
_this.state = {
|
|
11
|
+
show: true
|
|
12
|
+
};
|
|
13
|
+
_this.page = void 0;
|
|
14
|
+
/**
|
|
15
|
+
* 显示页面
|
|
16
|
+
*/
|
|
17
|
+
_this.showPage = function () {
|
|
18
|
+
_this.setState({
|
|
19
|
+
show: true
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 隐藏页面
|
|
24
|
+
*/
|
|
25
|
+
_this.hidePage = function () {
|
|
26
|
+
_this.setState({
|
|
27
|
+
show: false
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
_this.state.show = !!props.defaultShow;
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
_inheritsLoose(SchemaRender, _Component);
|
|
34
|
+
var _proto = SchemaRender.prototype;
|
|
35
|
+
_proto.render = function render() {
|
|
36
|
+
var _this2 = this;
|
|
37
|
+
return /*#__PURE__*/React.createElement(SchemaRenderLayout, {
|
|
38
|
+
root: this
|
|
39
|
+
}, /*#__PURE__*/React.createElement(SchemaRenderBase, _extends({}, this.props, {
|
|
40
|
+
ref: function ref(base) {
|
|
41
|
+
_this2.page = base === null || base === void 0 ? void 0 : base.page;
|
|
42
|
+
}
|
|
43
|
+
})));
|
|
44
|
+
};
|
|
45
|
+
return SchemaRender;
|
|
46
|
+
}(Component);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var PageSizeEnum = {
|
|
2
|
+
small: calWidth(1),
|
|
3
|
+
middle: calWidth(2),
|
|
4
|
+
larger: calWidth(4),
|
|
5
|
+
full: "100%"
|
|
6
|
+
};
|
|
7
|
+
export function getPageSize(size) {
|
|
8
|
+
return (size ? PageSizeEnum[size] : PageSizeEnum.larger) || PageSizeEnum.larger;
|
|
9
|
+
}
|
|
10
|
+
function calWidth(i) {
|
|
11
|
+
return 300 * i + (i + 1) * 12;
|
|
12
|
+
}
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as utils from "./utils";
|
|
2
|
+
export { RestApi } from "./utils";
|
|
3
|
+
export { RestFormApi } from "./utils";
|
|
4
|
+
export { ClientCache } from "./utils";
|
|
5
|
+
export { Layout } from "./components/layout";
|
|
6
|
+
export { SchemaRender } from "./components/schema-render";
|
|
7
|
+
export { utils };
|
package/es/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as utils from "./utils";
|
|
2
|
+
export { RestApi } from "./utils";
|
|
3
|
+
export { RestFormApi } from "./utils";
|
|
4
|
+
export { ClientCache } from "./utils";
|
|
5
|
+
export { Layout } from "./components/layout";
|
|
6
|
+
export { SchemaRender } from "./components/schema-render";
|
|
7
|
+
export { utils };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
packages: ({
|
|
3
|
+
package: string;
|
|
4
|
+
version: string;
|
|
5
|
+
library: string;
|
|
6
|
+
urls: string[];
|
|
7
|
+
title?: undefined;
|
|
8
|
+
description?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
title: string;
|
|
11
|
+
package: string;
|
|
12
|
+
version: string;
|
|
13
|
+
description: string;
|
|
14
|
+
urls: string[];
|
|
15
|
+
library: string;
|
|
16
|
+
})[];
|
|
17
|
+
components: {
|
|
18
|
+
exportName: string;
|
|
19
|
+
npm: {
|
|
20
|
+
package: string;
|
|
21
|
+
version: string;
|
|
22
|
+
};
|
|
23
|
+
url: string;
|
|
24
|
+
}[];
|
|
25
|
+
sort: {
|
|
26
|
+
groupList: string[];
|
|
27
|
+
categoryList: string[];
|
|
28
|
+
};
|
|
29
|
+
groupList: string[];
|
|
30
|
+
ignoreComponents: {};
|
|
31
|
+
};
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"packages": [{
|
|
3
|
+
"package": "root-material",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"library": "RootMaterial",
|
|
6
|
+
"urls": ["https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/view.css"]
|
|
7
|
+
}, {
|
|
8
|
+
"package": "antd-material",
|
|
9
|
+
"version": "0.1.0",
|
|
10
|
+
"library": "AntdMaterial",
|
|
11
|
+
"urls": ["https://cdn.zhiyunhe.com/plugin/dayjs/dayjs.min.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd/view.css"]
|
|
12
|
+
}, {
|
|
13
|
+
"title": "fusion组件库",
|
|
14
|
+
"package": "@alifd/next",
|
|
15
|
+
"version": "1.26.4",
|
|
16
|
+
"description": "不可删除否则会出问题",
|
|
17
|
+
"urls": ["https://g.alicdn.com/code/lib/alifd__next/1.26.4/next-with-locales.min.js"],
|
|
18
|
+
"library": "Next"
|
|
19
|
+
}, {
|
|
20
|
+
"package": "chart-material",
|
|
21
|
+
"version": "0.1.0",
|
|
22
|
+
"library": "ChartMaterial",
|
|
23
|
+
"urls": ["https://cdn.zhiyunhe.com/plugin/antv/g2/5.1.19/g2.min.js", "https://cdn.zhiyunhe.com/plugin/datav/1.2.5/datav.min.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/chart/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/chart/view.css"]
|
|
24
|
+
}],
|
|
25
|
+
"components": [{
|
|
26
|
+
"exportName": "RootMaterialMeta",
|
|
27
|
+
"npm": {
|
|
28
|
+
"package": "root-material",
|
|
29
|
+
"version": "1.0.0"
|
|
30
|
+
},
|
|
31
|
+
"url": "https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/meta.js"
|
|
32
|
+
}, {
|
|
33
|
+
"exportName": "AntdMaterialMeta",
|
|
34
|
+
"npm": {
|
|
35
|
+
"package": "antd-material",
|
|
36
|
+
"version": "1.0.0"
|
|
37
|
+
},
|
|
38
|
+
"url": "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd/meta.js"
|
|
39
|
+
}, {
|
|
40
|
+
"exportName": "ChartMaterialMeta",
|
|
41
|
+
"npm": {
|
|
42
|
+
"package": "chart-material",
|
|
43
|
+
"version": "1.0.0"
|
|
44
|
+
},
|
|
45
|
+
"url": "https://cdn.zhiyunhe.com/plugin/lowcode/materials/chart/meta.js"
|
|
46
|
+
}],
|
|
47
|
+
"sort": {
|
|
48
|
+
"groupList": ["", "默认分组", "原子组件", "精选组件", "图表组件"],
|
|
49
|
+
"categoryList": ["布局", "通用", "导航", "数据录入", "数据展示", "反馈", "大屏组件", "图表", "基础元素", "表格类", "表单详情类", "帮助类", "对话框类", "业务类", "引导", "信息输入", "信息展示", "信息反馈", "布局容器类"]
|
|
50
|
+
},
|
|
51
|
+
"groupList": ["默认分组", "原子组件", "精选组件", "图表组件"],
|
|
52
|
+
"ignoreComponents": {}
|
|
53
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
componentName: string;
|
|
3
|
+
props: {
|
|
4
|
+
ref: string;
|
|
5
|
+
style: {
|
|
6
|
+
height: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
dataSource: {
|
|
10
|
+
list: any[];
|
|
11
|
+
};
|
|
12
|
+
css: string;
|
|
13
|
+
hidden: boolean;
|
|
14
|
+
title: string;
|
|
15
|
+
isLocked: boolean;
|
|
16
|
+
condition: boolean;
|
|
17
|
+
conditionGroup: string;
|
|
18
|
+
state: {
|
|
19
|
+
isShowDialog: {
|
|
20
|
+
type: string;
|
|
21
|
+
value: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
methods: {
|
|
25
|
+
openDialog: {
|
|
26
|
+
type: string;
|
|
27
|
+
value: string;
|
|
28
|
+
source: string;
|
|
29
|
+
};
|
|
30
|
+
closeDialog: {
|
|
31
|
+
type: string;
|
|
32
|
+
value: string;
|
|
33
|
+
source: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
lifeCycles: {
|
|
37
|
+
componentDidMount: {
|
|
38
|
+
type: string;
|
|
39
|
+
value: string;
|
|
40
|
+
source: string;
|
|
41
|
+
};
|
|
42
|
+
componentWillUnmount: {
|
|
43
|
+
type: string;
|
|
44
|
+
value: string;
|
|
45
|
+
source: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
children: any[];
|
|
49
|
+
};
|
|
50
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"componentName": "Page",
|
|
3
|
+
"props": {
|
|
4
|
+
"ref": "root",
|
|
5
|
+
"style": {
|
|
6
|
+
"height": "100%"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"dataSource": {
|
|
10
|
+
"list": []
|
|
11
|
+
},
|
|
12
|
+
"css": "",
|
|
13
|
+
"hidden": false,
|
|
14
|
+
"title": "",
|
|
15
|
+
"isLocked": false,
|
|
16
|
+
"condition": true,
|
|
17
|
+
"conditionGroup": "",
|
|
18
|
+
"state": {
|
|
19
|
+
"isShowDialog": {
|
|
20
|
+
"type": "JSExpression",
|
|
21
|
+
"value": "false"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"methods": {
|
|
25
|
+
"openDialog": {
|
|
26
|
+
"type": "JSFunction",
|
|
27
|
+
"value": "function openDialog() {\n this.setState({\n isShowDialog: true\n });\n}",
|
|
28
|
+
"source": "function openDialog() {\n this.setState({\n isShowDialog: true\n });\n}"
|
|
29
|
+
},
|
|
30
|
+
"closeDialog": {
|
|
31
|
+
"type": "JSFunction",
|
|
32
|
+
"value": "function closeDialog() {\n this.setState({\n isShowDialog: false\n });\n}",
|
|
33
|
+
"source": "function closeDialog() {\n this.setState({\n isShowDialog: false\n });\n}"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"lifeCycles": {
|
|
37
|
+
"componentDidMount": {
|
|
38
|
+
"type": "JSFunction",
|
|
39
|
+
"value": "function componentDidMount() {\n console.log('did mount');\n}",
|
|
40
|
+
"source": "function componentDidMount() {\n console.log('did mount');\n}"
|
|
41
|
+
},
|
|
42
|
+
"componentWillUnmount": {
|
|
43
|
+
"type": "JSFunction",
|
|
44
|
+
"value": "function componentWillUnmount() {\n console.log('will unmount');\n}",
|
|
45
|
+
"source": "function componentWillUnmount() {\n console.log('will unmount');\n}"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"children": []
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
import { SchemaRender } from "../components/schema-render";
|
|
4
|
+
import { Layout } from "../components/layout";
|
|
5
|
+
function App() {
|
|
6
|
+
return /*#__PURE__*/React.createElement(Layout, {
|
|
7
|
+
left: "left",
|
|
8
|
+
right: "right",
|
|
9
|
+
header: "header",
|
|
10
|
+
footer: "footer"
|
|
11
|
+
}, "123");
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
style: {
|
|
14
|
+
padding: 24,
|
|
15
|
+
height: "100%",
|
|
16
|
+
background: "#f1f1f1"
|
|
17
|
+
}
|
|
18
|
+
}, /*#__PURE__*/React.createElement(SchemaRender, {
|
|
19
|
+
layout: "modal",
|
|
20
|
+
schemaId: "test",
|
|
21
|
+
defaultShow: true
|
|
22
|
+
}), /*#__PURE__*/React.createElement(SchemaRender, {
|
|
23
|
+
layout: "drawer",
|
|
24
|
+
schemaId: "test",
|
|
25
|
+
defaultShow: true
|
|
26
|
+
}), /*#__PURE__*/React.createElement(SchemaRender, {
|
|
27
|
+
schemaId: "test",
|
|
28
|
+
defaultShow: true
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(App, null), document.getElementById('root'));
|
|
File without changes
|
package/es/style.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const request: import("axios").AxiosInstance;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { onFulfilled, onRejected } from "../common/Request";
|
|
3
|
+
export var request = axios.create({
|
|
4
|
+
baseURL: "/api",
|
|
5
|
+
// 基础URL
|
|
6
|
+
timeout: 10000,
|
|
7
|
+
// 请求超时时间(毫秒)
|
|
8
|
+
headers: {
|
|
9
|
+
'Content-Type': 'application/json;charset=UTF-8'
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
request.interceptors.response.use(onFulfilled, onRejected);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare type LoadData = (key: string) => Promise<any>;
|
|
2
|
+
export declare class ClientCache {
|
|
3
|
+
private cacheMap;
|
|
4
|
+
name: string;
|
|
5
|
+
loadData: LoadData;
|
|
6
|
+
constructor(options: {
|
|
7
|
+
name: string;
|
|
8
|
+
loadData: LoadData;
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* 获取值
|
|
12
|
+
* @param key
|
|
13
|
+
* @param cache 是否从缓存中获取
|
|
14
|
+
*/
|
|
15
|
+
get(key: string, cache?: boolean): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* 重新加载
|
|
18
|
+
* @param key
|
|
19
|
+
*/
|
|
20
|
+
reload(key: string): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* 手动设置
|
|
23
|
+
* @param key
|
|
24
|
+
* @param value
|
|
25
|
+
*/
|
|
26
|
+
set(key: string, value: any): void;
|
|
27
|
+
/**
|
|
28
|
+
* 删除某个缓存
|
|
29
|
+
* @param key
|
|
30
|
+
*/
|
|
31
|
+
delete(key: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* 删除全部缓存
|
|
34
|
+
*/
|
|
35
|
+
clear(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
export var ClientCache = /*#__PURE__*/function () {
|
|
4
|
+
function ClientCache(options) {
|
|
5
|
+
this.cacheMap = void 0;
|
|
6
|
+
this.name = void 0;
|
|
7
|
+
this.loadData = void 0;
|
|
8
|
+
this.cacheMap = new Map();
|
|
9
|
+
this.name = options.name;
|
|
10
|
+
if (typeof options.loadData == "function") {
|
|
11
|
+
this.loadData = options.loadData;
|
|
12
|
+
} else {
|
|
13
|
+
this.loadData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
14
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
15
|
+
while (1) switch (_context.prev = _context.next) {
|
|
16
|
+
case 0:
|
|
17
|
+
return _context.abrupt("return", null);
|
|
18
|
+
case 1:
|
|
19
|
+
case "end":
|
|
20
|
+
return _context.stop();
|
|
21
|
+
}
|
|
22
|
+
}, _callee);
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 获取值
|
|
29
|
+
* @param key
|
|
30
|
+
* @param cache 是否从缓存中获取
|
|
31
|
+
*/
|
|
32
|
+
var _proto = ClientCache.prototype;
|
|
33
|
+
_proto.get =
|
|
34
|
+
/*#__PURE__*/
|
|
35
|
+
function () {
|
|
36
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key, cache) {
|
|
37
|
+
var value;
|
|
38
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
39
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
if (!(!cache && this.cacheMap.has(key))) {
|
|
42
|
+
_context2.next = 2;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
return _context2.abrupt("return", this.cacheMap.get(key));
|
|
46
|
+
case 2:
|
|
47
|
+
_context2.prev = 2;
|
|
48
|
+
_context2.next = 5;
|
|
49
|
+
return this.loadData(key);
|
|
50
|
+
case 5:
|
|
51
|
+
value = _context2.sent;
|
|
52
|
+
this.cacheMap.set(key, value);
|
|
53
|
+
return _context2.abrupt("return", value);
|
|
54
|
+
case 10:
|
|
55
|
+
_context2.prev = 10;
|
|
56
|
+
_context2.t0 = _context2["catch"](2);
|
|
57
|
+
console.log("\u7F13\u5B58 {" + this.name + "} \u83B7\u53D6\u503C\u5931\u8D25!\u5C06\u8FD4\u56DEnull", _context2.t0);
|
|
58
|
+
this.cacheMap.set(key, null);
|
|
59
|
+
return _context2.abrupt("return", null);
|
|
60
|
+
case 15:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context2.stop();
|
|
63
|
+
}
|
|
64
|
+
}, _callee2, this, [[2, 10]]);
|
|
65
|
+
}));
|
|
66
|
+
function get(_x, _x2) {
|
|
67
|
+
return _get.apply(this, arguments);
|
|
68
|
+
}
|
|
69
|
+
return get;
|
|
70
|
+
}()
|
|
71
|
+
/**
|
|
72
|
+
* 重新加载
|
|
73
|
+
* @param key
|
|
74
|
+
*/
|
|
75
|
+
;
|
|
76
|
+
_proto.reload =
|
|
77
|
+
/*#__PURE__*/
|
|
78
|
+
function () {
|
|
79
|
+
var _reload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(key) {
|
|
80
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
81
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
return _context3.abrupt("return", this.get(key, false));
|
|
84
|
+
case 1:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context3.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee3, this);
|
|
89
|
+
}));
|
|
90
|
+
function reload(_x3) {
|
|
91
|
+
return _reload.apply(this, arguments);
|
|
92
|
+
}
|
|
93
|
+
return reload;
|
|
94
|
+
}()
|
|
95
|
+
/**
|
|
96
|
+
* 手动设置
|
|
97
|
+
* @param key
|
|
98
|
+
* @param value
|
|
99
|
+
*/
|
|
100
|
+
;
|
|
101
|
+
_proto.set = function set(key, value) {
|
|
102
|
+
this.cacheMap.set(key, value);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 删除某个缓存
|
|
107
|
+
* @param key
|
|
108
|
+
*/;
|
|
109
|
+
_proto["delete"] = function _delete(key) {
|
|
110
|
+
this.cacheMap["delete"](key);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 删除全部缓存
|
|
115
|
+
*/;
|
|
116
|
+
_proto.clear = function clear() {
|
|
117
|
+
this.cacheMap.clear();
|
|
118
|
+
};
|
|
119
|
+
return ClientCache;
|
|
120
|
+
}();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ProcessScriptOptions, ProcessScriptType } from "./ProcessHandler";
|
|
2
|
+
declare type Schema = {
|
|
3
|
+
componentName: string;
|
|
4
|
+
props: {
|
|
5
|
+
scripts: ProcessScriptType[];
|
|
6
|
+
format: string;
|
|
7
|
+
defaultValue: {
|
|
8
|
+
custom: any;
|
|
9
|
+
linkage: any;
|
|
10
|
+
shortcut: string;
|
|
11
|
+
formula: string;
|
|
12
|
+
type: "linkage" | "custom" | "formula" | "shortcut";
|
|
13
|
+
};
|
|
14
|
+
trim: boolean;
|
|
15
|
+
name: string;
|
|
16
|
+
label: string;
|
|
17
|
+
fillTableValues?: string[];
|
|
18
|
+
formula?: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default class FormDataHandler {
|
|
22
|
+
schema: Schema;
|
|
23
|
+
name: string;
|
|
24
|
+
fields: Schema[];
|
|
25
|
+
scripts: ProcessScriptType[];
|
|
26
|
+
subFormHandlers: FormDataHandler[];
|
|
27
|
+
constructor(schema: any);
|
|
28
|
+
onValuesChange(options: ProcessScriptOptions): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* 处理联动数据
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
private handleLinkage;
|
|
34
|
+
private handleFieldValue;
|
|
35
|
+
/**
|
|
36
|
+
* 处理填充子表
|
|
37
|
+
*/
|
|
38
|
+
private handleFillTableValues;
|
|
39
|
+
/***
|
|
40
|
+
* 创建初期值
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
createInitValues(): Promise<any>;
|
|
44
|
+
}
|
|
45
|
+
export {};
|