@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.
Files changed (107) hide show
  1. package/es/components/layout/index.d.ts +34 -0
  2. package/es/components/layout/index.js +63 -0
  3. package/es/components/layout/index.less +20 -0
  4. package/es/components/schema-render/components/assets.d.ts +32 -0
  5. package/es/components/schema-render/components/assets.js +53 -0
  6. package/es/components/schema-render/components/demo-schema.d.ts +85 -0
  7. package/es/components/schema-render/components/demo-schema.js +107 -0
  8. package/es/components/schema-render/components/schema-render-base.d.ts +43 -0
  9. package/es/components/schema-render/components/schema-render-base.js +142 -0
  10. package/es/components/schema-render/components/schema-render-layout.d.ts +6 -0
  11. package/es/components/schema-render/components/schema-render-layout.js +46 -0
  12. package/es/components/schema-render/index.d.ts +31 -0
  13. package/es/components/schema-render/index.js +46 -0
  14. package/es/components/typing.d.ts +3 -0
  15. package/es/components/typing.js +12 -0
  16. package/es/index.d.ts +7 -0
  17. package/es/index.js +7 -0
  18. package/es/pages/data/assets.d.ts +32 -0
  19. package/es/pages/data/assets.js +53 -0
  20. package/es/pages/data/schema.d.ts +50 -0
  21. package/es/pages/data/schema.js +49 -0
  22. package/es/pages/index.d.ts +1 -0
  23. package/es/pages/index.js +31 -0
  24. package/es/pages/index.less +0 -0
  25. package/es/style.js +6 -0
  26. package/es/utils/api/index.d.ts +1 -0
  27. package/es/utils/api/index.js +12 -0
  28. package/es/utils/common/ClientCache.d.ts +36 -0
  29. package/es/utils/common/ClientCache.js +120 -0
  30. package/es/utils/common/FormDataHandler.d.ts +45 -0
  31. package/es/utils/common/FormDataHandler.js +410 -0
  32. package/es/utils/common/LoadPlugins.d.ts +1 -0
  33. package/es/utils/common/LoadPlugins.js +158 -0
  34. package/es/utils/common/ProcessHandler.d.ts +30 -0
  35. package/es/utils/common/ProcessHandler.js +303 -0
  36. package/es/utils/common/Request.d.ts +2 -0
  37. package/es/utils/common/Request.js +20 -0
  38. package/es/utils/common/RestApi.d.ts +80 -0
  39. package/es/utils/common/RestApi.js +226 -0
  40. package/es/utils/common/RestFormApi.d.ts +12 -0
  41. package/es/utils/common/RestFormApi.js +158 -0
  42. package/es/utils/common/SubFormInstance.d.ts +26 -0
  43. package/es/utils/common/SubFormInstance.js +100 -0
  44. package/es/utils/common/UserInfo.d.ts +9 -0
  45. package/es/utils/common/UserInfo.js +19 -0
  46. package/es/utils/common/index.d.ts +7 -0
  47. package/es/utils/common/index.js +39 -0
  48. package/es/utils/index.d.ts +17 -0
  49. package/es/utils/index.js +11 -0
  50. package/es/utils/lowcode/index.d.ts +1 -0
  51. package/es/utils/lowcode/index.js +1 -0
  52. package/es/utils/lowcode/parseAssets.d.ts +3 -0
  53. package/es/utils/lowcode/parseAssets.js +185 -0
  54. package/lib/components/layout/index.d.ts +34 -0
  55. package/lib/components/layout/index.js +69 -0
  56. package/lib/components/layout/index.less +20 -0
  57. package/lib/components/schema-render/components/assets.d.ts +32 -0
  58. package/lib/components/schema-render/components/assets.js +57 -0
  59. package/lib/components/schema-render/components/demo-schema.d.ts +85 -0
  60. package/lib/components/schema-render/components/demo-schema.js +111 -0
  61. package/lib/components/schema-render/components/schema-render-base.d.ts +43 -0
  62. package/lib/components/schema-render/components/schema-render-base.js +149 -0
  63. package/lib/components/schema-render/components/schema-render-layout.d.ts +6 -0
  64. package/lib/components/schema-render/components/schema-render-layout.js +51 -0
  65. package/lib/components/schema-render/index.d.ts +31 -0
  66. package/lib/components/schema-render/index.js +53 -0
  67. package/lib/components/typing.d.ts +3 -0
  68. package/lib/components/typing.js +17 -0
  69. package/lib/index.d.ts +7 -0
  70. package/lib/index.js +15 -0
  71. package/lib/pages/data/assets.d.ts +32 -0
  72. package/lib/pages/data/assets.js +57 -0
  73. package/lib/pages/data/schema.d.ts +50 -0
  74. package/lib/pages/data/schema.js +53 -0
  75. package/lib/pages/index.d.ts +1 -0
  76. package/lib/pages/index.js +34 -0
  77. package/lib/pages/index.less +0 -0
  78. package/lib/style.js +6 -0
  79. package/lib/utils/api/index.d.ts +1 -0
  80. package/lib/utils/api/index.js +17 -0
  81. package/lib/utils/common/ClientCache.d.ts +36 -0
  82. package/lib/utils/common/ClientCache.js +125 -0
  83. package/lib/utils/common/FormDataHandler.d.ts +45 -0
  84. package/lib/utils/common/FormDataHandler.js +416 -0
  85. package/lib/utils/common/LoadPlugins.d.ts +1 -0
  86. package/lib/utils/common/LoadPlugins.js +163 -0
  87. package/lib/utils/common/ProcessHandler.d.ts +30 -0
  88. package/lib/utils/common/ProcessHandler.js +308 -0
  89. package/lib/utils/common/Request.d.ts +2 -0
  90. package/lib/utils/common/Request.js +25 -0
  91. package/lib/utils/common/RestApi.d.ts +80 -0
  92. package/lib/utils/common/RestApi.js +230 -0
  93. package/lib/utils/common/RestFormApi.d.ts +12 -0
  94. package/lib/utils/common/RestFormApi.js +163 -0
  95. package/lib/utils/common/SubFormInstance.d.ts +26 -0
  96. package/lib/utils/common/SubFormInstance.js +105 -0
  97. package/lib/utils/common/UserInfo.d.ts +9 -0
  98. package/lib/utils/common/UserInfo.js +24 -0
  99. package/lib/utils/common/index.d.ts +7 -0
  100. package/lib/utils/common/index.js +48 -0
  101. package/lib/utils/index.d.ts +17 -0
  102. package/lib/utils/index.js +34 -0
  103. package/lib/utils/lowcode/index.d.ts +1 -0
  104. package/lib/utils/lowcode/index.js +6 -0
  105. package/lib/utils/lowcode/parseAssets.d.ts +3 -0
  106. package/lib/utils/lowcode/parseAssets.js +192 -0
  107. package/package.json +65 -0
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.Layout = Layout;
5
+ exports.LayoutHorizontal = LayoutHorizontal;
6
+ exports.LayoutVertical = LayoutVertical;
7
+ require("./index.less");
8
+ function Layout(props) {
9
+ var _props$styles;
10
+ return /*#__PURE__*/React.createElement("main", {
11
+ className: "layout",
12
+ style: {
13
+ flexDirection: "column"
14
+ }
15
+ }, /*#__PURE__*/React.createElement(LayoutVertical, {
16
+ footer: props.footer,
17
+ header: props.header
18
+ }, /*#__PURE__*/React.createElement(LayoutHorizontal, {
19
+ left: props.left,
20
+ right: props.right
21
+ }, /*#__PURE__*/React.createElement("div", {
22
+ style: (_props$styles = props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.content,
23
+ className: "layout-content"
24
+ }, /*#__PURE__*/React.createElement("div", {
25
+ style: {
26
+ height: "100%",
27
+ background: "white"
28
+ }
29
+ }, props.children)))));
30
+ }
31
+ function LayoutVertical(props) {
32
+ var _props$styles2, _props$styles3;
33
+ var header = props.header ? /*#__PURE__*/React.createElement("header", {
34
+ style: (_props$styles2 = props.styles) === null || _props$styles2 === void 0 ? void 0 : _props$styles2.header
35
+ }, props.header) : undefined;
36
+ var footer = props.header ? /*#__PURE__*/React.createElement("footer", {
37
+ style: (_props$styles3 = props.styles) === null || _props$styles3 === void 0 ? void 0 : _props$styles3.footer
38
+ }, props.footer) : undefined;
39
+ return /*#__PURE__*/React.createElement("main", {
40
+ className: "layout-vertical",
41
+ style: {
42
+ flexDirection: "column",
43
+ overflow: "hidden"
44
+ }
45
+ }, header, /*#__PURE__*/React.createElement("main", {
46
+ style: {
47
+ flex: 1
48
+ }
49
+ }, props.children), footer);
50
+ }
51
+ function LayoutHorizontal(props) {
52
+ var _props$styles4, _props$styles5;
53
+ var left = props.left ? /*#__PURE__*/React.createElement("aside", {
54
+ style: (_props$styles4 = props.styles) === null || _props$styles4 === void 0 ? void 0 : _props$styles4.left
55
+ }, props.left) : undefined;
56
+ var right = props.right ? /*#__PURE__*/React.createElement("aside", {
57
+ style: (_props$styles5 = props.styles) === null || _props$styles5 === void 0 ? void 0 : _props$styles5.right
58
+ }, props.right) : undefined;
59
+ return /*#__PURE__*/React.createElement("main", {
60
+ className: "layout-horizontal",
61
+ style: {
62
+ flexDirection: "row"
63
+ }
64
+ }, left, /*#__PURE__*/React.createElement("main", {
65
+ style: {
66
+ flex: 1
67
+ }
68
+ }, props.children), right);
69
+ }
@@ -0,0 +1,20 @@
1
+ .layout,
2
+ .layout-vertical,
3
+ .layout-horizontal {
4
+ height: 100%;
5
+ display: flex;
6
+
7
+ aside,
8
+ footer,
9
+ header {
10
+ padding: 12px;
11
+ }
12
+
13
+ }
14
+
15
+ .layout-content {
16
+ height: 100%;
17
+ overflow-y: auto;
18
+ background: #f1f1f1;
19
+ padding: 12px;
20
+ }
@@ -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,57 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports["default"] = void 0;
5
+ var _default = exports["default"] = {
6
+ "packages": [{
7
+ "package": "root-material",
8
+ "version": "0.1.0",
9
+ "library": "RootMaterial",
10
+ "urls": ["https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/view.css"]
11
+ }, {
12
+ "package": "antd-material",
13
+ "version": "0.1.0",
14
+ "library": "AntdMaterial",
15
+ "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"]
16
+ }, {
17
+ "title": "fusion组件库",
18
+ "package": "@alifd/next",
19
+ "version": "1.26.4",
20
+ "description": "不可删除否则会出问题",
21
+ "urls": ["https://g.alicdn.com/code/lib/alifd__next/1.26.4/next-with-locales.min.js"],
22
+ "library": "Next"
23
+ }, {
24
+ "package": "chart-material",
25
+ "version": "0.1.0",
26
+ "library": "ChartMaterial",
27
+ "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"]
28
+ }],
29
+ "components": [{
30
+ "exportName": "RootMaterialMeta",
31
+ "npm": {
32
+ "package": "root-material",
33
+ "version": "1.0.0"
34
+ },
35
+ "url": "https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/meta.js"
36
+ }, {
37
+ "exportName": "AntdMaterialMeta",
38
+ "npm": {
39
+ "package": "antd-material",
40
+ "version": "1.0.0"
41
+ },
42
+ "url": "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd/meta.js"
43
+ }, {
44
+ "exportName": "ChartMaterialMeta",
45
+ "npm": {
46
+ "package": "chart-material",
47
+ "version": "1.0.0"
48
+ },
49
+ "url": "https://cdn.zhiyunhe.com/plugin/lowcode/materials/chart/meta.js"
50
+ }],
51
+ "sort": {
52
+ "groupList": ["", "默认分组", "原子组件", "精选组件", "图表组件"],
53
+ "categoryList": ["布局", "通用", "导航", "数据录入", "数据展示", "反馈", "大屏组件", "图表", "基础元素", "表格类", "表单详情类", "帮助类", "对话框类", "业务类", "引导", "信息输入", "信息展示", "信息反馈", "布局容器类"]
54
+ },
55
+ "groupList": ["默认分组", "原子组件", "精选组件", "图表组件"],
56
+ "ignoreComponents": {}
57
+ };
@@ -0,0 +1,85 @@
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: {
49
+ componentName: string;
50
+ props: {};
51
+ hidden: boolean;
52
+ title: string;
53
+ isLocked: boolean;
54
+ condition: boolean;
55
+ conditionGroup: string;
56
+ children: ({
57
+ componentName: string;
58
+ props: {};
59
+ hidden: boolean;
60
+ title: string;
61
+ isLocked: boolean;
62
+ condition: boolean;
63
+ conditionGroup: string;
64
+ children?: undefined;
65
+ } | {
66
+ componentName: string;
67
+ props: {};
68
+ hidden: boolean;
69
+ title: string;
70
+ isLocked: boolean;
71
+ condition: boolean;
72
+ conditionGroup: string;
73
+ children: {
74
+ componentName: string;
75
+ props: {};
76
+ hidden: boolean;
77
+ title: string;
78
+ isLocked: boolean;
79
+ condition: boolean;
80
+ conditionGroup: string;
81
+ }[];
82
+ })[];
83
+ }[];
84
+ };
85
+ export default _default;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports["default"] = void 0;
5
+ var _default = exports["default"] = {
6
+ "componentName": "Page",
7
+ "props": {
8
+ "ref": "root",
9
+ "style": {
10
+ "height": "100%"
11
+ }
12
+ },
13
+ "dataSource": {
14
+ "list": []
15
+ },
16
+ "css": "",
17
+ "hidden": false,
18
+ "title": "",
19
+ "isLocked": false,
20
+ "condition": true,
21
+ "conditionGroup": "",
22
+ "state": {
23
+ "isShowDialog": {
24
+ "type": "JSExpression",
25
+ "value": "false"
26
+ }
27
+ },
28
+ "methods": {
29
+ "openDialog": {
30
+ "type": "JSFunction",
31
+ "value": "function openDialog() {\n this.setState({\n isShowDialog: true\n });\n}",
32
+ "source": "function openDialog() {\n this.setState({\n isShowDialog: true\n });\n}"
33
+ },
34
+ "closeDialog": {
35
+ "type": "JSFunction",
36
+ "value": "function closeDialog() {\n this.setState({\n isShowDialog: false\n });\n}",
37
+ "source": "function closeDialog() {\n this.setState({\n isShowDialog: false\n });\n}"
38
+ }
39
+ },
40
+ "lifeCycles": {
41
+ "componentDidMount": {
42
+ "type": "JSFunction",
43
+ "value": "function componentDidMount() {\n console.log('did mount');\n}",
44
+ "source": "function componentDidMount() {\n console.log('did mount');\n}"
45
+ },
46
+ "componentWillUnmount": {
47
+ "type": "JSFunction",
48
+ "value": "function componentWillUnmount() {\n console.log('will unmount');\n}",
49
+ "source": "function componentWillUnmount() {\n console.log('will unmount');\n}"
50
+ }
51
+ },
52
+ "children": [{
53
+ "componentName": "Layout",
54
+ "props": {},
55
+ "hidden": false,
56
+ "title": "",
57
+ "isLocked": false,
58
+ "condition": true,
59
+ "conditionGroup": "",
60
+ "children": [{
61
+ "componentName": "LayoutHeader",
62
+ "props": {},
63
+ "hidden": false,
64
+ "title": "",
65
+ "isLocked": false,
66
+ "condition": true,
67
+ "conditionGroup": ""
68
+ }, {
69
+ "componentName": "LayoutContent",
70
+ "props": {},
71
+ "hidden": false,
72
+ "title": "",
73
+ "isLocked": false,
74
+ "condition": true,
75
+ "conditionGroup": "",
76
+ "children": [{
77
+ "componentName": "LayoutLeft",
78
+ "props": {},
79
+ "hidden": false,
80
+ "title": "",
81
+ "isLocked": false,
82
+ "condition": true,
83
+ "conditionGroup": ""
84
+ }, {
85
+ "componentName": "LayoutMain",
86
+ "props": {},
87
+ "hidden": false,
88
+ "title": "",
89
+ "isLocked": false,
90
+ "condition": true,
91
+ "conditionGroup": ""
92
+ }, {
93
+ "componentName": "LayoutRight",
94
+ "props": {},
95
+ "hidden": false,
96
+ "title": "",
97
+ "isLocked": false,
98
+ "condition": true,
99
+ "conditionGroup": ""
100
+ }]
101
+ }, {
102
+ "componentName": "LayoutFooter",
103
+ "props": {},
104
+ "hidden": false,
105
+ "title": "",
106
+ "isLocked": false,
107
+ "condition": true,
108
+ "conditionGroup": ""
109
+ }]
110
+ }]
111
+ };
@@ -0,0 +1,43 @@
1
+ import { Component } from "react";
2
+ import { ResultProps } from "antd";
3
+ import { FormInstance } from "antd/lib";
4
+ import { SchemaFormMode } from "../index";
5
+ export interface FormProps {
6
+ mode: SchemaFormMode;
7
+ /**
8
+ * 继续提交按钮 新增模式有效
9
+ */
10
+ submitContinue?: boolean;
11
+ /**
12
+ * 数据id
13
+ */
14
+ dataId?: string;
15
+ /**
16
+ * 展示那些列
17
+ */
18
+ showFields?: "all" | string[];
19
+ /**
20
+ * 表单初期话回调
21
+ * @param values
22
+ */
23
+ onInit?: (values: any, form: FormInstance) => Promise<void>;
24
+ }
25
+ export interface SchemaBaseRenderProps {
26
+ schemaId: string;
27
+ params?: FormProps;
28
+ }
29
+ export interface SchemaBaseRenderState {
30
+ key?: string;
31
+ result?: ResultProps;
32
+ schema?: any;
33
+ }
34
+ export declare class SchemaRenderBase extends Component<SchemaBaseRenderProps, SchemaBaseRenderState> {
35
+ state: SchemaBaseRenderState;
36
+ constructor(props: Readonly<SchemaBaseRenderProps> | SchemaBaseRenderProps);
37
+ componentDidMount(): Promise<void>;
38
+ page: any;
39
+ loadSchema: () => Promise<void>;
40
+ components: any;
41
+ loadComponent: () => Promise<void>;
42
+ render(): JSX.Element;
43
+ }
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.SchemaRenderBase = void 0;
6
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
+ var _result = _interopRequireDefault(require("antd/lib/result"));
8
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
+ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
10
+ var _configProvider = _interopRequireDefault(require("antd/lib/config-provider"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _lowcodeRendererCore = _interopRequireWildcard(require("@zhubangyun/lowcode-renderer-core"));
13
+ var _lowcodeDatasourceFetchHandler = require("@alilc/lowcode-datasource-fetch-handler");
14
+ var _utils = _interopRequireDefault(require("../../../utils"));
15
+ var _assets = _interopRequireDefault(require("./assets"));
16
+ var _demoSchema = _interopRequireDefault(require("./demo-schema"));
17
+ var _zh_CN = _interopRequireDefault(require("antd/locale/zh_CN"));
18
+ var _window$antd, _window$antd2;
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; }
21
+ // @ts-ignore
22
+ _lowcodeRendererCore.adapter.setConfigProvider(((_window$antd = window.antd) === null || _window$antd === void 0 ? void 0 : _window$antd.ConfigProvider) || _configProvider["default"]);
23
+ // @ts-ignore
24
+ var LocalConfig = ((_window$antd2 = window.antd) === null || _window$antd2 === void 0 ? void 0 : _window$antd2.ConfigProvider) || _configProvider["default"];
25
+ var SchemaRenderBase = exports.SchemaRenderBase = /*#__PURE__*/function (_Component) {
26
+ function SchemaRenderBase(props) {
27
+ var _this;
28
+ _this = _Component.call(this, props) || this;
29
+ _this.state = {
30
+ result: undefined
31
+ };
32
+ _this.page = void 0;
33
+ _this.loadSchema = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
34
+ var schemaId, schema;
35
+ return _regenerator["default"].wrap(function _callee$(_context) {
36
+ while (1) switch (_context.prev = _context.next) {
37
+ case 0:
38
+ _context.next = 2;
39
+ return _this.loadComponent();
40
+ case 2:
41
+ schemaId = _this.props.schemaId;
42
+ if (!(schemaId == "test")) {
43
+ _context.next = 6;
44
+ break;
45
+ }
46
+ _this.setState({
47
+ schema: _demoSchema["default"]
48
+ });
49
+ return _context.abrupt("return");
50
+ case 6:
51
+ _context.next = 8;
52
+ return _utils["default"].schemaCache.get(schemaId);
53
+ case 8:
54
+ schema = _context.sent;
55
+ _this.setState({
56
+ schema: schema,
57
+ result: schema ? undefined : {
58
+ status: 404,
59
+ title: "404",
60
+ subTitle: "\u89C6\u56FE:" + schemaId + "\u4E0D\u5B58\u5728!"
61
+ }
62
+ });
63
+ case 10:
64
+ case "end":
65
+ return _context.stop();
66
+ }
67
+ }, _callee);
68
+ }));
69
+ _this.components = void 0;
70
+ _this.loadComponent = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
71
+ var _yield$utils$lowcode$, components;
72
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
73
+ while (1) switch (_context2.prev = _context2.next) {
74
+ case 0:
75
+ _context2.next = 2;
76
+ return _utils["default"].lowcode.parseAssets(_assets["default"]);
77
+ case 2:
78
+ _yield$utils$lowcode$ = _context2.sent;
79
+ components = _yield$utils$lowcode$.components;
80
+ _this.components = components;
81
+ case 5:
82
+ case "end":
83
+ return _context2.stop();
84
+ }
85
+ }, _callee2);
86
+ }));
87
+ _this.setState({
88
+ key: _utils["default"].uuid("key.")
89
+ });
90
+ return _this;
91
+ }
92
+ (0, _inheritsLoose2["default"])(SchemaRenderBase, _Component);
93
+ var _proto = SchemaRenderBase.prototype;
94
+ _proto.componentDidMount = /*#__PURE__*/function () {
95
+ var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
96
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
97
+ while (1) switch (_context3.prev = _context3.next) {
98
+ case 0:
99
+ _context3.next = 2;
100
+ return this.loadSchema();
101
+ case 2:
102
+ case "end":
103
+ return _context3.stop();
104
+ }
105
+ }, _callee3, this);
106
+ }));
107
+ function componentDidMount() {
108
+ return _componentDidMount.apply(this, arguments);
109
+ }
110
+ return componentDidMount;
111
+ }();
112
+ _proto.render = function render() {
113
+ var _this2 = this;
114
+ var components = this.components;
115
+ var _this$state = this.state,
116
+ key = _this$state.key,
117
+ result = _this$state.result,
118
+ schema = _this$state.schema;
119
+ var params = this.props.params;
120
+ if (result) {
121
+ return /*#__PURE__*/_react["default"].createElement(_result["default"], result);
122
+ }
123
+ if (schema) {
124
+ return /*#__PURE__*/_react["default"].createElement(LocalConfig, {
125
+ locale: _zh_CN["default"]
126
+ }, /*#__PURE__*/_react["default"].createElement(_lowcodeRendererCore["default"], {
127
+ key: key,
128
+ ref: function ref(page) {
129
+ _this2.page = page === null || page === void 0 ? void 0 : page.__ref;
130
+ }
131
+ // @ts-ignore
132
+ ,
133
+ params: params,
134
+ schema: schema,
135
+ thisRequiredInJSE: true,
136
+ className: "schema-render",
137
+ components: components,
138
+ appHelper: {
139
+ utils: _utils["default"],
140
+ requestHandlersMap: {
141
+ fetch: (0, _lowcodeDatasourceFetchHandler.createFetchHandler)()
142
+ }
143
+ }
144
+ }));
145
+ }
146
+ return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null);
147
+ };
148
+ return SchemaRenderBase;
149
+ }(_react.Component);
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { SchemaRender } from "../index";
3
+ export declare function SchemaRenderLayout(props: {
4
+ root: SchemaRender;
5
+ children: any;
6
+ }): JSX.Element;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.SchemaRenderLayout = SchemaRenderLayout;
6
+ var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
7
+ var _modal = _interopRequireDefault(require("antd/lib/modal"));
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _layout = require("../../layout");
10
+ function SchemaRenderLayout(props) {
11
+ var root = props.root;
12
+ var state = root.state,
13
+ hidePage = root.hidePage;
14
+ var _root$props = root.props,
15
+ layout = _root$props.layout,
16
+ header = _root$props.header,
17
+ footer = _root$props.footer,
18
+ left = _root$props.left,
19
+ right = _root$props.right;
20
+ var children = /*#__PURE__*/_react["default"].createElement(_layout.Layout, {
21
+ header: header === null || header === void 0 ? void 0 : header(root),
22
+ footer: footer === null || footer === void 0 ? void 0 : footer(root),
23
+ left: left === null || left === void 0 ? void 0 : left(root),
24
+ right: right === null || right === void 0 ? void 0 : right(root)
25
+ }, props.children);
26
+ var restProps = {
27
+ open: state.show,
28
+ footer: false,
29
+ closable: false,
30
+ styles: {
31
+ header: {
32
+ display: "none"
33
+ },
34
+ body: {
35
+ padding: 0
36
+ },
37
+ content: {
38
+ padding: 0
39
+ }
40
+ },
41
+ onClose: hidePage,
42
+ keyboard: false,
43
+ maskClosable: false
44
+ };
45
+ if (layout == "modal") {
46
+ return /*#__PURE__*/_react["default"].createElement(_modal["default"], restProps, children);
47
+ } else if (layout == "drawer") {
48
+ return /*#__PURE__*/_react["default"].createElement(_drawer["default"], restProps, children);
49
+ }
50
+ return children;
51
+ }
@@ -0,0 +1,31 @@
1
+ import { SchemaBaseRenderProps } from "./components/schema-render-base";
2
+ import { Component, ReactNode } from "react";
3
+ export declare type SchemaFormMode = "create" | "update" | "detail" | "copy";
4
+ export declare type RenderLayout = "drawer" | "modal";
5
+ export declare type RenderChild = (props: SchemaRender) => ReactNode;
6
+ export interface SchemaRenderProps extends SchemaBaseRenderProps {
7
+ layout?: RenderLayout;
8
+ header?: RenderChild;
9
+ footer?: RenderChild;
10
+ left?: RenderChild;
11
+ right?: RenderChild;
12
+ defaultShow?: boolean;
13
+ width?: number;
14
+ }
15
+ export interface SchemaRenderState {
16
+ show: boolean;
17
+ }
18
+ export declare class SchemaRender extends Component<SchemaRenderProps, SchemaRenderState> {
19
+ state: SchemaRenderState;
20
+ page: any;
21
+ constructor(props: SchemaRenderProps);
22
+ /**
23
+ * 显示页面
24
+ */
25
+ showPage: () => void;
26
+ /**
27
+ * 隐藏页面
28
+ */
29
+ hidePage: () => void;
30
+ render(): JSX.Element;
31
+ }