@zhubangyun/lowcode-core 5.4.21 → 5.4.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.d.ts +0 -1
- package/es/index.js +0 -1
- package/es/style.js +4 -4
- package/es/utils/api/RestApi.d.ts +1 -1
- package/es/utils/api/RestApi.js +86 -60
- package/es/utils/{common → api}/UserInfo.d.ts +1 -1
- package/es/utils/api/UserInfo.js +39 -0
- package/es/utils/api/index.d.ts +4 -3
- package/es/utils/api/index.js +25 -12
- package/es/utils/cache/index.d.ts +12 -4
- package/es/utils/cache/index.js +23 -17
- package/es/utils/cache/schema.d.ts +29 -0
- package/es/utils/cache/schema.js +42 -0
- package/es/utils/common/SingletonInstanceMap.d.ts +3 -3
- package/es/utils/common/SingletonInstanceMap.js +5 -5
- package/es/utils/designer/assets/assets.data.base.js +1 -1
- package/es/utils/form/form.api.d.ts +4 -9
- package/es/utils/form/form.api.js +14 -135
- package/es/utils/index.d.ts +2 -0
- package/es/utils/index.js +2 -0
- package/es/utils/page/index.d.ts +1 -0
- package/es/utils/page/index.js +1 -0
- package/es/utils/page/page.form.d.ts +14 -0
- package/es/utils/page/page.form.js +66 -0
- package/es/utils/page/page.layout.d.ts +15 -0
- package/es/utils/page/page.layout.js +56 -0
- package/es/utils/page/page.load-schema.d.ts +4 -0
- package/es/utils/page/page.load-schema.js +37 -0
- package/es/utils/page/page.render.d.ts +2 -0
- package/es/utils/page/page.render.js +6 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/style.js +4 -4
- package/lib/utils/api/RestApi.d.ts +1 -1
- package/lib/utils/api/RestApi.js +86 -60
- package/lib/utils/{common → api}/UserInfo.d.ts +1 -1
- package/lib/utils/{common → api}/UserInfo.js +22 -2
- package/lib/utils/api/index.d.ts +4 -3
- package/lib/utils/api/index.js +28 -13
- package/lib/utils/cache/index.d.ts +12 -4
- package/lib/utils/cache/index.js +23 -17
- package/lib/utils/cache/schema.d.ts +29 -0
- package/lib/utils/cache/schema.js +47 -0
- package/lib/utils/common/SingletonInstanceMap.d.ts +3 -3
- package/lib/utils/common/SingletonInstanceMap.js +5 -5
- package/lib/utils/designer/assets/assets.data.base.js +1 -1
- package/lib/utils/form/form.api.d.ts +4 -9
- package/lib/utils/form/form.api.js +14 -135
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/page/index.d.ts +1 -0
- package/lib/utils/page/index.js +6 -0
- package/lib/utils/page/page.form.d.ts +14 -0
- package/lib/utils/page/page.form.js +71 -0
- package/lib/utils/page/page.layout.d.ts +15 -0
- package/lib/utils/page/page.layout.js +63 -0
- package/lib/utils/page/page.load-schema.d.ts +4 -0
- package/lib/utils/page/page.load-schema.js +42 -0
- package/lib/utils/page/page.render.d.ts +2 -0
- package/lib/utils/page/page.render.js +10 -0
- package/package.json +1 -1
- package/es/components/schema-render/components/assets.d.ts +0 -32
- package/es/components/schema-render/components/assets.js +0 -53
- package/es/components/schema-render/components/demo-schema.d.ts +0 -85
- package/es/components/schema-render/components/demo-schema.js +0 -107
- package/es/components/schema-render/components/schema-render-base.d.ts +0 -43
- package/es/components/schema-render/components/schema-render-base.js +0 -142
- package/es/components/schema-render/components/schema-render-layout.d.ts +0 -6
- package/es/components/schema-render/components/schema-render-layout.js +0 -46
- package/es/components/schema-render/index.d.ts +0 -31
- package/es/components/schema-render/index.js +0 -46
- package/es/utils/common/SubFormInstance.d.ts +0 -26
- package/es/utils/common/SubFormInstance.js +0 -100
- package/es/utils/common/UserInfo.js +0 -19
- package/es/utils/form/form.process.js +0 -0
- package/lib/components/schema-render/components/assets.d.ts +0 -32
- package/lib/components/schema-render/components/assets.js +0 -57
- package/lib/components/schema-render/components/demo-schema.d.ts +0 -85
- package/lib/components/schema-render/components/demo-schema.js +0 -111
- package/lib/components/schema-render/components/schema-render-base.d.ts +0 -43
- package/lib/components/schema-render/components/schema-render-base.js +0 -149
- package/lib/components/schema-render/components/schema-render-layout.d.ts +0 -6
- package/lib/components/schema-render/components/schema-render-layout.js +0 -51
- package/lib/components/schema-render/index.d.ts +0 -31
- package/lib/components/schema-render/index.js +0 -53
- package/lib/utils/common/SubFormInstance.d.ts +0 -26
- package/lib/utils/common/SubFormInstance.js +0 -105
- package/lib/utils/form/form.process.js +0 -1
- /package/es/utils/{form/form.handler.js → page/page.utils.js} +0 -0
- /package/lib/utils/{form/form.handler.js → page/page.utils.js} +0 -0
|
@@ -38,7 +38,7 @@ var BaseAssets = {
|
|
|
38
38
|
utils: [],
|
|
39
39
|
"components": [],
|
|
40
40
|
"sort": {
|
|
41
|
-
"categoryList": ["布局", "通用", "导航", "数据录入", "数据展示", "反馈", "大屏组件", "图表", "基础元素", "表格类", "表单详情类", "帮助类", "对话框类", "业务类", "引导", "信息输入", "信息展示", "信息反馈", "布局容器类", "增强组件", "工具组件"],
|
|
41
|
+
"categoryList": ["布局", "通用", "导航", "数据录入", "数据展示", "反馈", "大屏组件", "图表", "基础元素", "表格类", "表单详情类", "帮助类", "对话框类", "业务类", "引导", "信息输入", "信息展示", "信息反馈", "布局容器类", "增强组件", "工具组件", "普通", "范围", "高级"],
|
|
42
42
|
"groupList": ["", "原子组件", "精选组件", "增强分组", "图表组件", "默认分组"]
|
|
43
43
|
}
|
|
44
44
|
};
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RestApi } from "../api/RestApi";
|
|
2
2
|
import { AxiosRequestConfig } from "axios";
|
|
3
3
|
export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
4
4
|
private readonly formId;
|
|
5
|
+
private readonly fieldId;
|
|
5
6
|
private readonly mock;
|
|
6
7
|
private initialized;
|
|
7
8
|
private schema;
|
|
8
|
-
constructor(formId: string, mock?: boolean);
|
|
9
|
+
constructor(formId: string, fieldId?: string, mock?: boolean);
|
|
9
10
|
initialize(): Promise<boolean>;
|
|
10
|
-
|
|
11
|
-
getById(id: string, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
12
|
-
save(data: DataType, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
13
|
-
create(data: DataType, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
14
|
-
update(id: string, data: DataType, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
15
|
-
deleteById(id: string, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
16
|
-
handleRequestConfig(config: AxiosRequestConfig): void;
|
|
11
|
+
handleRequestConfig(config: AxiosRequestConfig): Promise<void>;
|
|
17
12
|
}
|
|
@@ -4,14 +4,16 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import { RestApi } from "../api/RestApi";
|
|
5
5
|
import { getSchema } from "../api";
|
|
6
6
|
export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
7
|
-
function RestFormApi(formId, mock) {
|
|
7
|
+
function RestFormApi(formId, fieldId, mock) {
|
|
8
8
|
var _this;
|
|
9
9
|
_this = _RestApi.call(this, "forms", {}) || this;
|
|
10
10
|
_this.formId = void 0;
|
|
11
|
+
_this.fieldId = void 0;
|
|
11
12
|
_this.mock = void 0;
|
|
12
13
|
_this.initialized = false;
|
|
13
14
|
_this.schema = void 0;
|
|
14
15
|
_this.formId = formId;
|
|
16
|
+
_this.fieldId = formId;
|
|
15
17
|
_this.mock = !!mock;
|
|
16
18
|
return _this;
|
|
17
19
|
}
|
|
@@ -59,151 +61,28 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
59
61
|
}
|
|
60
62
|
return initialize;
|
|
61
63
|
}();
|
|
62
|
-
_proto.
|
|
63
|
-
var
|
|
64
|
+
_proto.handleRequestConfig = /*#__PURE__*/function () {
|
|
65
|
+
var _handleRequestConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
|
|
64
66
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
65
67
|
while (1) switch (_context2.prev = _context2.next) {
|
|
66
68
|
case 0:
|
|
67
|
-
|
|
68
|
-
params = {};
|
|
69
|
-
}
|
|
70
|
-
if (page === void 0) {
|
|
71
|
-
page = 1;
|
|
72
|
-
}
|
|
73
|
-
if (pageSize === void 0) {
|
|
74
|
-
pageSize = 20;
|
|
75
|
-
}
|
|
76
|
-
_context2.next = 5;
|
|
69
|
+
_context2.next = 2;
|
|
77
70
|
return this.initialize();
|
|
78
|
-
case
|
|
79
|
-
|
|
71
|
+
case 2:
|
|
72
|
+
config.params = config.params || {};
|
|
73
|
+
config.params.formId = this.formId;
|
|
74
|
+
config.params.fieldId = this.fieldId;
|
|
75
|
+
config.params.mock = this.mock;
|
|
80
76
|
case 6:
|
|
81
77
|
case "end":
|
|
82
78
|
return _context2.stop();
|
|
83
79
|
}
|
|
84
80
|
}, _callee2, this);
|
|
85
81
|
}));
|
|
86
|
-
function
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
return search;
|
|
90
|
-
}();
|
|
91
|
-
_proto.getById = /*#__PURE__*/function () {
|
|
92
|
-
var _getById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id, options) {
|
|
93
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
94
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
95
|
-
case 0:
|
|
96
|
-
_context3.next = 2;
|
|
97
|
-
return this.initialize();
|
|
98
|
-
case 2:
|
|
99
|
-
return _context3.abrupt("return", _RestApi.prototype.getById.call(this, id, options));
|
|
100
|
-
case 3:
|
|
101
|
-
case "end":
|
|
102
|
-
return _context3.stop();
|
|
103
|
-
}
|
|
104
|
-
}, _callee3, this);
|
|
105
|
-
}));
|
|
106
|
-
function getById(_x4, _x5) {
|
|
107
|
-
return _getById.apply(this, arguments);
|
|
108
|
-
}
|
|
109
|
-
return getById;
|
|
110
|
-
}();
|
|
111
|
-
_proto.save = /*#__PURE__*/function () {
|
|
112
|
-
var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data, options) {
|
|
113
|
-
var config;
|
|
114
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
115
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
116
|
-
case 0:
|
|
117
|
-
_context4.next = 2;
|
|
118
|
-
return this.initialize();
|
|
119
|
-
case 2:
|
|
120
|
-
config = {};
|
|
121
|
-
this.handleRequestConfig(config);
|
|
122
|
-
return _context4.abrupt("return", _RestApi.prototype.save.call(this, data, options));
|
|
123
|
-
case 5:
|
|
124
|
-
case "end":
|
|
125
|
-
return _context4.stop();
|
|
126
|
-
}
|
|
127
|
-
}, _callee4, this);
|
|
128
|
-
}));
|
|
129
|
-
function save(_x6, _x7) {
|
|
130
|
-
return _save.apply(this, arguments);
|
|
131
|
-
}
|
|
132
|
-
return save;
|
|
133
|
-
}();
|
|
134
|
-
_proto.create = /*#__PURE__*/function () {
|
|
135
|
-
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data, options) {
|
|
136
|
-
var config;
|
|
137
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
138
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
139
|
-
case 0:
|
|
140
|
-
_context5.next = 2;
|
|
141
|
-
return this.initialize();
|
|
142
|
-
case 2:
|
|
143
|
-
config = {};
|
|
144
|
-
this.handleRequestConfig(config);
|
|
145
|
-
return _context5.abrupt("return", _RestApi.prototype.create.call(this, data, options));
|
|
146
|
-
case 5:
|
|
147
|
-
case "end":
|
|
148
|
-
return _context5.stop();
|
|
149
|
-
}
|
|
150
|
-
}, _callee5, this);
|
|
151
|
-
}));
|
|
152
|
-
function create(_x8, _x9) {
|
|
153
|
-
return _create.apply(this, arguments);
|
|
154
|
-
}
|
|
155
|
-
return create;
|
|
156
|
-
}();
|
|
157
|
-
_proto.update = /*#__PURE__*/function () {
|
|
158
|
-
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id, data, options) {
|
|
159
|
-
var config;
|
|
160
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
161
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
162
|
-
case 0:
|
|
163
|
-
_context6.next = 2;
|
|
164
|
-
return this.initialize();
|
|
165
|
-
case 2:
|
|
166
|
-
config = {};
|
|
167
|
-
this.handleRequestConfig(config);
|
|
168
|
-
return _context6.abrupt("return", _RestApi.prototype.update.call(this, id, data, options));
|
|
169
|
-
case 5:
|
|
170
|
-
case "end":
|
|
171
|
-
return _context6.stop();
|
|
172
|
-
}
|
|
173
|
-
}, _callee6, this);
|
|
174
|
-
}));
|
|
175
|
-
function update(_x10, _x11, _x12) {
|
|
176
|
-
return _update.apply(this, arguments);
|
|
177
|
-
}
|
|
178
|
-
return update;
|
|
179
|
-
}();
|
|
180
|
-
_proto.deleteById = /*#__PURE__*/function () {
|
|
181
|
-
var _deleteById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, options) {
|
|
182
|
-
var config;
|
|
183
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
184
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
185
|
-
case 0:
|
|
186
|
-
_context7.next = 2;
|
|
187
|
-
return this.initialize();
|
|
188
|
-
case 2:
|
|
189
|
-
config = {};
|
|
190
|
-
this.handleRequestConfig(config);
|
|
191
|
-
return _context7.abrupt("return", _RestApi.prototype.deleteById.call(this, id, options));
|
|
192
|
-
case 5:
|
|
193
|
-
case "end":
|
|
194
|
-
return _context7.stop();
|
|
195
|
-
}
|
|
196
|
-
}, _callee7, this);
|
|
197
|
-
}));
|
|
198
|
-
function deleteById(_x13, _x14) {
|
|
199
|
-
return _deleteById.apply(this, arguments);
|
|
82
|
+
function handleRequestConfig(_x) {
|
|
83
|
+
return _handleRequestConfig.apply(this, arguments);
|
|
200
84
|
}
|
|
201
|
-
return
|
|
85
|
+
return handleRequestConfig;
|
|
202
86
|
}();
|
|
203
|
-
_proto.handleRequestConfig = function handleRequestConfig(config) {
|
|
204
|
-
config.params = config.params || {};
|
|
205
|
-
config.params.formId = this.formId;
|
|
206
|
-
config.params.mock = this.mock;
|
|
207
|
-
};
|
|
208
87
|
return RestFormApi;
|
|
209
88
|
}(RestApi);
|
package/es/utils/index.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ import * as cache from "./cache";
|
|
|
2
2
|
import * as common from "./common";
|
|
3
3
|
import * as api from "./api";
|
|
4
4
|
import * as designer from "./designer";
|
|
5
|
+
import * as page from "./page";
|
|
5
6
|
declare const _default: {
|
|
6
7
|
api: typeof api;
|
|
7
8
|
cache: typeof cache;
|
|
9
|
+
page: typeof page;
|
|
8
10
|
designer: typeof designer;
|
|
9
11
|
common: typeof common;
|
|
10
12
|
};
|
package/es/utils/index.js
CHANGED
|
@@ -2,9 +2,11 @@ import * as cache from "./cache";
|
|
|
2
2
|
import * as common from "./common";
|
|
3
3
|
import * as api from "./api";
|
|
4
4
|
import * as designer from "./designer";
|
|
5
|
+
import * as page from "./page";
|
|
5
6
|
export default {
|
|
6
7
|
api: api,
|
|
7
8
|
cache: cache,
|
|
9
|
+
page: page,
|
|
8
10
|
designer: designer,
|
|
9
11
|
common: common
|
|
10
12
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { showForm } from "./page.form";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { showForm } from "./page.form";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PageLayoutType } from "./page.layout";
|
|
2
|
+
interface ShowFormOptions {
|
|
3
|
+
container?: HTMLDivElement;
|
|
4
|
+
layout?: PageLayoutType;
|
|
5
|
+
form: {
|
|
6
|
+
id: string;
|
|
7
|
+
fieldId?: string;
|
|
8
|
+
};
|
|
9
|
+
mode?: "add" | "edit" | "copy" | "detail";
|
|
10
|
+
dataId?: string;
|
|
11
|
+
onClose?: (data: any) => void | Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare function showForm(options: ShowFormOptions): void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
5
|
+
var _excluded = ["container", "onClose"];
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
import { PageLayout } from "./page.layout";
|
|
8
|
+
import ReactDOM from "react-dom";
|
|
9
|
+
import { Component } from "react";
|
|
10
|
+
import { PageLoadSchema } from "./page.load-schema";
|
|
11
|
+
import { ReactRender } from "../../components/react-render";
|
|
12
|
+
export function showForm(options) {
|
|
13
|
+
var container = options.container,
|
|
14
|
+
onClose = options.onClose,
|
|
15
|
+
restProps = _objectWithoutPropertiesLoose(options, _excluded);
|
|
16
|
+
//容器不存在需要手动取消挂载
|
|
17
|
+
var unmount = !container;
|
|
18
|
+
if (!container) {
|
|
19
|
+
container = document.createElement("div");
|
|
20
|
+
document.body.append(container);
|
|
21
|
+
}
|
|
22
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(FormRender, _extends({}, restProps, {
|
|
23
|
+
onClose: ( /*#__PURE__*/function () {
|
|
24
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
|
25
|
+
var _container;
|
|
26
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
27
|
+
while (1) switch (_context.prev = _context.next) {
|
|
28
|
+
case 0:
|
|
29
|
+
if (unmount) {
|
|
30
|
+
//取消挂载
|
|
31
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
32
|
+
//移除
|
|
33
|
+
(_container = container) === null || _container === void 0 ? void 0 : _container.remove();
|
|
34
|
+
}
|
|
35
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(data);
|
|
36
|
+
case 2:
|
|
37
|
+
case "end":
|
|
38
|
+
return _context.stop();
|
|
39
|
+
}
|
|
40
|
+
}, _callee);
|
|
41
|
+
}));
|
|
42
|
+
return function (_x) {
|
|
43
|
+
return _ref.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
}())
|
|
46
|
+
})), container);
|
|
47
|
+
}
|
|
48
|
+
var FormRender = /*#__PURE__*/function (_Component) {
|
|
49
|
+
function FormRender() {
|
|
50
|
+
return _Component.apply(this, arguments) || this;
|
|
51
|
+
}
|
|
52
|
+
_inheritsLoose(FormRender, _Component);
|
|
53
|
+
var _proto = FormRender.prototype;
|
|
54
|
+
_proto.render = function render() {
|
|
55
|
+
var _this = this;
|
|
56
|
+
return /*#__PURE__*/React.createElement(PageLayout, null, /*#__PURE__*/React.createElement(PageLoadSchema, {
|
|
57
|
+
pageId: this.props.form.id
|
|
58
|
+
}, function (schema) {
|
|
59
|
+
return /*#__PURE__*/React.createElement(ReactRender, _extends({
|
|
60
|
+
schema: schema,
|
|
61
|
+
components: window.__components
|
|
62
|
+
}, _this.props));
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
return FormRender;
|
|
66
|
+
}(Component);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from "react";
|
|
2
|
+
export declare type PageLayoutType = "page" | "modal" | "drawer";
|
|
3
|
+
interface PageLayoutProps {
|
|
4
|
+
layout?: PageLayoutType;
|
|
5
|
+
children: any;
|
|
6
|
+
}
|
|
7
|
+
interface PageLayoutState {
|
|
8
|
+
open: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class PageLayout extends Component<PageLayoutProps, PageLayoutState> {
|
|
11
|
+
state: PageLayoutState;
|
|
12
|
+
close: () => void;
|
|
13
|
+
render(): any;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import _Drawer from "antd/es/drawer";
|
|
2
|
+
import _Modal from "antd/es/modal";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
4
|
+
import React, { Component } from "react";
|
|
5
|
+
export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
6
|
+
function PageLayout() {
|
|
7
|
+
var _this;
|
|
8
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9
|
+
args[_key] = arguments[_key];
|
|
10
|
+
}
|
|
11
|
+
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
12
|
+
_this.state = {
|
|
13
|
+
open: true
|
|
14
|
+
};
|
|
15
|
+
_this.close = function () {
|
|
16
|
+
_this.setState({
|
|
17
|
+
open: false
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return _this;
|
|
21
|
+
}
|
|
22
|
+
_inheritsLoose(PageLayout, _Component);
|
|
23
|
+
var _proto = PageLayout.prototype;
|
|
24
|
+
_proto.render = function render() {
|
|
25
|
+
var _this$props = this.props,
|
|
26
|
+
layout = _this$props.layout,
|
|
27
|
+
children = _this$props.children;
|
|
28
|
+
var state = this.state;
|
|
29
|
+
var restProps = {
|
|
30
|
+
open: state.open,
|
|
31
|
+
footer: false,
|
|
32
|
+
closable: false,
|
|
33
|
+
styles: {
|
|
34
|
+
header: {
|
|
35
|
+
display: "none"
|
|
36
|
+
},
|
|
37
|
+
body: {
|
|
38
|
+
padding: 0
|
|
39
|
+
},
|
|
40
|
+
content: {
|
|
41
|
+
padding: 0
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
onClose: this.close,
|
|
45
|
+
keyboard: false,
|
|
46
|
+
maskClosable: false
|
|
47
|
+
};
|
|
48
|
+
if (layout == "modal") {
|
|
49
|
+
return /*#__PURE__*/React.createElement(_Modal, restProps, children);
|
|
50
|
+
} else if (layout == "drawer") {
|
|
51
|
+
return /*#__PURE__*/React.createElement(_Drawer, restProps, children);
|
|
52
|
+
}
|
|
53
|
+
return children;
|
|
54
|
+
};
|
|
55
|
+
return PageLayout;
|
|
56
|
+
}(Component);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _Result from "antd/es/result";
|
|
2
|
+
import _Spin from "antd/es/spin";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { getSchema } from "../api";
|
|
5
|
+
export function PageLoadSchema(props) {
|
|
6
|
+
var _useState = useState(true),
|
|
7
|
+
loading = _useState[0],
|
|
8
|
+
setLoading = _useState[1];
|
|
9
|
+
var _useState2 = useState(),
|
|
10
|
+
schema = _useState2[0],
|
|
11
|
+
setSchema = _useState2[1];
|
|
12
|
+
var _useState3 = useState(),
|
|
13
|
+
errorMsg = _useState3[0],
|
|
14
|
+
setErrorMsg = _useState3[1];
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
getSchema(props.pageId).then(function (res) {
|
|
17
|
+
if (res.success) {
|
|
18
|
+
setLoading(false);
|
|
19
|
+
setSchema(res.data);
|
|
20
|
+
} else {
|
|
21
|
+
setErrorMsg(res.message);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
if (loading) {
|
|
26
|
+
return /*#__PURE__*/React.createElement(_Spin, {
|
|
27
|
+
spinning: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (!schema) {
|
|
31
|
+
return /*#__PURE__*/React.createElement(_Result, {
|
|
32
|
+
status: 500,
|
|
33
|
+
title: errorMsg
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return props.children(schema);
|
|
37
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,5 @@ import utils from "./utils";
|
|
|
2
2
|
export { RestApi } from "./utils/api/RestApi";
|
|
3
3
|
export { RestFormApi } from "./utils/form/form.api";
|
|
4
4
|
export { Layout } from "./components/layout";
|
|
5
|
-
export { SchemaRender } from "./components/schema-render";
|
|
6
5
|
export { ReactRender } from "./components/react-render";
|
|
7
6
|
export { utils };
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.
|
|
5
|
+
exports.RestFormApi = exports.RestApi = exports.ReactRender = exports.Layout = void 0;
|
|
6
6
|
var _utils = _interopRequireDefault(require("./utils"));
|
|
7
7
|
exports.utils = _utils["default"];
|
|
8
8
|
var _RestApi = require("./utils/api/RestApi");
|
|
@@ -11,8 +11,6 @@ var _form = require("./utils/form/form.api");
|
|
|
11
11
|
exports.RestFormApi = _form.RestFormApi;
|
|
12
12
|
var _layout = require("./components/layout");
|
|
13
13
|
exports.Layout = _layout.Layout;
|
|
14
|
-
var _schemaRender = require("./components/schema-render");
|
|
15
|
-
exports.SchemaRender = _schemaRender.SchemaRender;
|
|
16
14
|
var _reactRender = require("./components/react-render");
|
|
17
15
|
exports.ReactRender = _reactRender.ReactRender;
|
|
18
16
|
// @ts-ignore
|
package/lib/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require('antd/lib/result/style');
|
|
2
|
-
require('antd/lib/config-provider/style');
|
|
3
|
-
|
|
4
1
|
require('antd/lib/drawer/style');
|
|
5
|
-
require('antd/lib/modal/style');
|
|
2
|
+
require('antd/lib/modal/style');
|
|
3
|
+
require('antd/lib/result/style');
|
|
4
|
+
require('antd/lib/spin/style');
|
|
5
|
+
require('antd/lib/config-provider/style');
|
|
@@ -39,7 +39,7 @@ export declare abstract class BaseRestApi<DataType> {
|
|
|
39
39
|
}
|
|
40
40
|
export declare class RestApi<DataType> extends BaseRestApi<DataType> {
|
|
41
41
|
constructor(uri: string, options?: RestApiOptions);
|
|
42
|
-
handleRequestConfig(config: AxiosRequestConfig): void
|
|
42
|
+
handleRequestConfig(config: AxiosRequestConfig): Promise<void>;
|
|
43
43
|
}
|
|
44
44
|
export interface BaseType {
|
|
45
45
|
/**
|