@zhubangyun/lowcode-core 5.12.161 → 6.2.30
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/load-materials/index.js +38 -22
- package/es/components/page-loading/index.js +4 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +19 -2
- package/es/index.less +21 -0
- package/es/init/init.bar-height.d.ts +1 -0
- package/es/init/init.bar-height.js +37 -0
- package/es/init/init.mobile-class.d.ts +1 -0
- package/es/init/init.mobile-class.js +10 -0
- package/es/init/init.scroll-size.d.ts +5 -0
- package/es/init/init.scroll-size.js +26 -0
- package/es/style.js +3 -3
- package/es/utils/api/form-api.d.ts +2 -0
- package/es/utils/api/form-api.js +155 -34
- package/es/utils/api/index.d.ts +1 -1
- package/es/utils/api/index.js +4 -2
- package/es/utils/api/rest-api.d.ts +3 -1
- package/es/utils/api/rest-api.js +105 -23
- package/es/utils/api/schema.util.d.ts +3 -3
- package/es/utils/api/schema.util.js +17 -12
- package/es/utils/cache/index.js +57 -17
- package/es/utils/common/index.d.ts +3 -0
- package/es/utils/common/index.js +17 -3
- package/es/utils/page/index.js +10 -6
- package/es/utils/page/page-form-data-manager-group.js +10 -10
- package/es/utils/page/page-form-data-manager.d.ts +1 -0
- package/es/utils/page/page-form-data-manager.js +10 -10
- package/es/utils/page/page-form-group.d.ts +1 -0
- package/es/utils/page/page-form-group.js +2 -2
- package/es/utils/page/page-form.d.ts +1 -0
- package/es/utils/page/page-form.js +12 -4
- package/es/utils/page/page-layout.d.ts +3 -1
- package/es/utils/page/page-layout.js +44 -7
- package/es/utils/page/page-load-schema.js +20 -28
- package/es/utils/page/page-render.js +4 -5
- package/es/utils/page/page-show.d.ts +2 -0
- package/es/utils/page/page-show.js +9 -4
- package/es/utils/page/print-form.d.ts +3 -2
- package/es/utils/page/print-form.js +200 -61
- package/es/utils/uni-bridge.d.ts +20 -0
- package/es/utils/uni-bridge.js +172 -0
- package/es/utils/util.common.d.ts +1 -0
- package/es/utils/util.common.js +4 -0
- package/es/utils/utils.scrollbar-size.js +0 -0
- package/lib/components/load-materials/index.js +38 -22
- package/lib/components/page-loading/index.js +4 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +22 -4
- package/lib/index.less +21 -0
- package/lib/init/init.bar-height.d.ts +1 -0
- package/lib/init/init.bar-height.js +42 -0
- package/lib/init/init.mobile-class.d.ts +1 -0
- package/lib/init/init.mobile-class.js +14 -0
- package/lib/init/init.scroll-size.d.ts +5 -0
- package/lib/init/init.scroll-size.js +31 -0
- package/lib/style.js +3 -3
- package/lib/utils/api/form-api.d.ts +2 -0
- package/lib/utils/api/form-api.js +155 -34
- package/lib/utils/api/index.d.ts +1 -1
- package/lib/utils/api/index.js +4 -2
- package/lib/utils/api/rest-api.d.ts +3 -1
- package/lib/utils/api/rest-api.js +105 -23
- package/lib/utils/api/schema.util.d.ts +3 -3
- package/lib/utils/api/schema.util.js +19 -13
- package/lib/utils/cache/index.js +56 -16
- package/lib/utils/common/index.d.ts +3 -0
- package/lib/utils/common/index.js +19 -2
- package/lib/utils/page/index.js +10 -6
- package/lib/utils/page/page-form-data-manager-group.js +10 -10
- package/lib/utils/page/page-form-data-manager.d.ts +1 -0
- package/lib/utils/page/page-form-data-manager.js +10 -10
- package/lib/utils/page/page-form-group.d.ts +1 -0
- package/lib/utils/page/page-form-group.js +2 -2
- package/lib/utils/page/page-form.d.ts +1 -0
- package/lib/utils/page/page-form.js +12 -4
- package/lib/utils/page/page-layout.d.ts +3 -1
- package/lib/utils/page/page-layout.js +44 -7
- package/lib/utils/page/page-load-schema.js +19 -27
- package/lib/utils/page/page-render.js +4 -5
- package/lib/utils/page/page-show.d.ts +2 -0
- package/lib/utils/page/page-show.js +9 -4
- package/lib/utils/page/print-form.d.ts +3 -2
- package/lib/utils/page/print-form.js +200 -61
- package/lib/utils/uni-bridge.d.ts +20 -0
- package/lib/utils/uni-bridge.js +177 -0
- package/lib/utils/util.common.d.ts +1 -0
- package/lib/utils/util.common.js +8 -0
- package/lib/utils/utils.scrollbar-size.js +1 -0
- package/package.json +2 -2
package/lib/utils/cache/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
|
|
|
17
17
|
var _proto = SchemaCache.prototype;
|
|
18
18
|
_proto.createInstance = /*#__PURE__*/function () {
|
|
19
19
|
var _createInstance = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(key, options) {
|
|
20
|
-
var mock, pageId, schemaRes, schema,
|
|
20
|
+
var mock, pageId, schemaRes, schema, handleCommonSchema, permission, printTemplates, workflow, cloneSchema, _t;
|
|
21
21
|
return _regenerator["default"].wrap(function (_context) {
|
|
22
22
|
while (1) switch (_context.prev = _context.next) {
|
|
23
23
|
case 0:
|
|
@@ -30,30 +30,70 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
|
|
|
30
30
|
});
|
|
31
31
|
case 1:
|
|
32
32
|
schemaRes = _context.sent;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_context.next = 3;
|
|
33
|
+
if (schemaRes.succss) {
|
|
34
|
+
_context.next = 2;
|
|
36
35
|
break;
|
|
37
36
|
}
|
|
38
|
-
_context.
|
|
39
|
-
return _api.apiRequest.get("pages/" + pageId + "/permission");
|
|
37
|
+
return _context.abrupt("return", schemaRes);
|
|
40
38
|
case 2:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
39
|
+
schema = schemaRes.data;
|
|
40
|
+
if (!(schema != null && typeof schema == "object")) {
|
|
41
|
+
_context.next = 8;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
handleCommonSchema = function handleCommonSchema(schema) {
|
|
45
|
+
schema.props = schema.props || {};
|
|
46
|
+
schema.props.permission = permission;
|
|
47
|
+
schema.props.printTemplates = printTemplates;
|
|
48
|
+
schema.props.workflow = workflow;
|
|
49
|
+
};
|
|
50
|
+
//处理权限
|
|
51
|
+
permission = null; //处理打印
|
|
52
|
+
workflow = null;
|
|
53
|
+
if (location.pathname.startsWith("/print")) {
|
|
54
|
+
_context.next = 7;
|
|
55
|
+
break;
|
|
48
56
|
}
|
|
57
|
+
_context.next = 3;
|
|
58
|
+
return _api.apiRequest.get("pages/" + pageId + "/permission");
|
|
49
59
|
case 3:
|
|
50
|
-
|
|
60
|
+
permission = _context.sent.data;
|
|
61
|
+
if (!((schema === null || schema === void 0 ? void 0 : schema.type) == "form")) {
|
|
62
|
+
_context.next = 7;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
_context.prev = 4;
|
|
66
|
+
_context.next = 5;
|
|
67
|
+
return _api.apiRequest.get("pages/" + pageId + "/printTemplates");
|
|
68
|
+
case 5:
|
|
69
|
+
printTemplates = _context.sent.data;
|
|
70
|
+
_context.next = 7;
|
|
71
|
+
break;
|
|
72
|
+
case 6:
|
|
73
|
+
_context.prev = 6;
|
|
74
|
+
_t = _context["catch"](4);
|
|
75
|
+
console.log(_t);
|
|
76
|
+
case 7:
|
|
77
|
+
(0, _schema.findFormSchemas)(schema).forEach(function (formSchema) {
|
|
78
|
+
handleCommonSchema(formSchema);
|
|
79
|
+
(0, _schema.findFdmSchemas)(formSchema.fdmSchema).forEach(function (fdmSchema) {
|
|
80
|
+
handleCommonSchema(fdmSchema);
|
|
81
|
+
fdmSchema.props.form.label = formSchema.props.label;
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
cloneSchema = JSON.parse(JSON.stringify(schema));
|
|
85
|
+
(0, _schema.findFormSchemas)(schema).forEach(function (formSchema) {
|
|
86
|
+
(0, _schema.findFdmSchemas)(formSchema.fdmSchema).forEach(function (fdmSchema) {
|
|
87
|
+
fdmSchema.props.formElement = cloneSchema;
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
case 8:
|
|
51
91
|
return _context.abrupt("return", schemaRes);
|
|
52
|
-
case
|
|
92
|
+
case 9:
|
|
53
93
|
case "end":
|
|
54
94
|
return _context.stop();
|
|
55
95
|
}
|
|
56
|
-
}, _callee);
|
|
96
|
+
}, _callee, null, [[4, 6]]);
|
|
57
97
|
}));
|
|
58
98
|
function createInstance(_x, _x2) {
|
|
59
99
|
return _createInstance.apply(this, arguments);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { loadPlugins } from "./LoadPlugins";
|
|
2
2
|
export declare function uuid(prefix?: string, separator?: string): string;
|
|
3
|
+
export declare function uuidVersion(id: string): number | false;
|
|
3
4
|
export declare function toArray(data: any): any[];
|
|
5
|
+
export declare function isLocalhost(): boolean;
|
|
6
|
+
export declare function isMobile(): boolean;
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
+
exports.isLocalhost = isLocalhost;
|
|
5
|
+
exports.isMobile = isMobile;
|
|
4
6
|
exports.loadPlugins = void 0;
|
|
5
7
|
exports.toArray = toArray;
|
|
6
8
|
exports.uuid = uuid;
|
|
9
|
+
exports.uuidVersion = uuidVersion;
|
|
7
10
|
var _uuid = require("uuid");
|
|
8
11
|
var _LoadPlugins = require("./LoadPlugins");
|
|
9
12
|
exports.loadPlugins = _LoadPlugins.loadPlugins;
|
|
10
13
|
function uuid(prefix, separator) {
|
|
11
14
|
if (!prefix && !separator) {
|
|
12
|
-
return (0, _uuid.
|
|
15
|
+
return (0, _uuid.v7)();
|
|
13
16
|
}
|
|
14
|
-
return [prefix, separator, (0, _uuid.
|
|
17
|
+
return [prefix, separator, (0, _uuid.v7)()].filter(function (v) {
|
|
15
18
|
return !!v;
|
|
16
19
|
}).join("");
|
|
17
20
|
}
|
|
21
|
+
function uuidVersion(id) {
|
|
22
|
+
try {
|
|
23
|
+
return (0, _uuid.version)(id);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
18
28
|
function toArray(data) {
|
|
19
29
|
if (!data) {
|
|
20
30
|
return [];
|
|
@@ -23,4 +33,11 @@ function toArray(data) {
|
|
|
23
33
|
} else {
|
|
24
34
|
return [data];
|
|
25
35
|
}
|
|
36
|
+
}
|
|
37
|
+
function isLocalhost() {
|
|
38
|
+
return window.location.hostname == "localhost";
|
|
39
|
+
}
|
|
40
|
+
function isMobile() {
|
|
41
|
+
var userAgent = navigator.userAgent;
|
|
42
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(userAgent);
|
|
26
43
|
}
|
package/lib/utils/page/index.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.showFormGroup = exports.showFormDataManagerGroup = exports.showFormDataM
|
|
|
10
10
|
exports.showLoading = showLoading;
|
|
11
11
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
var _uniBridge = require("../uni-bridge");
|
|
13
14
|
var _printForm = require("./print-form");
|
|
14
15
|
exports.print = _printForm.print;
|
|
15
16
|
exports.getFormPrintTemplates = _printForm.getFormPrintTemplates;
|
|
@@ -44,6 +45,7 @@ function _showLoading() {
|
|
|
44
45
|
return _regenerator["default"].wrap(function (_context) {
|
|
45
46
|
while (1) switch (_context.prev = _context.next) {
|
|
46
47
|
case 0:
|
|
48
|
+
console.log("page.show.loading");
|
|
47
49
|
loading = document.getElementById("fullscreen-loading");
|
|
48
50
|
if (loading) {
|
|
49
51
|
loading.style.display = "flex";
|
|
@@ -70,6 +72,7 @@ function _hideLoading() {
|
|
|
70
72
|
return _regenerator["default"].wrap(function (_context2) {
|
|
71
73
|
while (1) switch (_context2.prev = _context2.next) {
|
|
72
74
|
case 0:
|
|
75
|
+
console.log("page.hide.loading");
|
|
73
76
|
loading = document.getElementById("fullscreen-loading");
|
|
74
77
|
if (loading) {
|
|
75
78
|
loading.style.display = "none";
|
|
@@ -104,14 +107,15 @@ function _openPage() {
|
|
|
104
107
|
url: url
|
|
105
108
|
});
|
|
106
109
|
case 1:
|
|
107
|
-
|
|
108
|
-
_context3.next = 3;
|
|
109
|
-
break;
|
|
110
|
+
return _context3.abrupt("return", _context3.sent);
|
|
110
111
|
case 2:
|
|
111
|
-
|
|
112
|
+
if (!isMobile) {
|
|
113
|
+
_context3.next = 3;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
return _context3.abrupt("return", _uniBridge.uniBridge.navigateTo(url));
|
|
112
117
|
case 3:
|
|
113
|
-
|
|
114
|
-
return _context3.abrupt("return", page);
|
|
118
|
+
return _context3.abrupt("return", window.open(url, target));
|
|
115
119
|
case 4:
|
|
116
120
|
case "end":
|
|
117
121
|
return _context3.stop();
|
|
@@ -12,22 +12,22 @@ var _pageLayout = require("./page-layout");
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _reactRender = require("../../components/react-render");
|
|
14
14
|
var _pageRender = require("./page-render");
|
|
15
|
-
var
|
|
16
|
-
var _excluded = ["layout", "items", "onSelectOk", "onClose"],
|
|
17
|
-
_excluded2 = ["
|
|
15
|
+
var _common = require("../common");
|
|
16
|
+
var _excluded = ["layout", "items", "onSelectOk", "container", "onClose"],
|
|
17
|
+
_excluded2 = ["onClose"];
|
|
18
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
19
|
function showFormDataManagerGroup(_x) {
|
|
20
20
|
return _showFormDataManagerGroup.apply(this, arguments);
|
|
21
21
|
}
|
|
22
22
|
function _showFormDataManagerGroup() {
|
|
23
23
|
_showFormDataManagerGroup = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
24
|
-
var
|
|
24
|
+
var onClose, props;
|
|
25
25
|
return _regenerator["default"].wrap(function (_context) {
|
|
26
26
|
while (1) switch (_context.prev = _context.next) {
|
|
27
27
|
case 0:
|
|
28
|
-
|
|
28
|
+
onClose = options.onClose, props = (0, _objectWithoutPropertiesLoose2["default"])(options, _excluded2);
|
|
29
29
|
return _context.abrupt("return", (0, _pageRender.renderElement)({
|
|
30
|
-
container: container,
|
|
30
|
+
container: props.container,
|
|
31
31
|
onClose: onClose,
|
|
32
32
|
element: {
|
|
33
33
|
component: FormDataManagerRender,
|
|
@@ -61,6 +61,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
61
61
|
layout = _this$props.layout,
|
|
62
62
|
items = _this$props.items,
|
|
63
63
|
onSelectOk = _this$props.onSelectOk,
|
|
64
|
+
container = _this$props.container,
|
|
64
65
|
onClose = _this$props.onClose,
|
|
65
66
|
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
66
67
|
// @ts-ignore
|
|
@@ -78,17 +79,16 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
78
79
|
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
|
|
79
80
|
};
|
|
80
81
|
return /*#__PURE__*/_react["default"].createElement(_pageLayout.PageLayout, {
|
|
82
|
+
container: container,
|
|
81
83
|
ref: function ref(layout) {
|
|
82
84
|
return _this2.layoutRef = layout;
|
|
83
85
|
},
|
|
84
86
|
layout: layout,
|
|
85
|
-
onClose:
|
|
86
|
-
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
|
|
87
|
-
}
|
|
87
|
+
onClose: onClose
|
|
88
88
|
}, /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({}, restProps, {
|
|
89
89
|
components: window._components || window.components || window.__components,
|
|
90
90
|
schema: {
|
|
91
|
-
id: (0,
|
|
91
|
+
id: (0, _common.uuid)(),
|
|
92
92
|
componentName: "Page",
|
|
93
93
|
props: {},
|
|
94
94
|
state: {},
|
|
@@ -12,24 +12,24 @@ var _pageLayout = require("./page-layout");
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _pageLoadSchema = require("./page-load-schema");
|
|
14
14
|
var _reactRender = require("../../components/react-render");
|
|
15
|
-
var _schema = require("../cache/schema");
|
|
16
15
|
var _pageSchemaUtils = require("./page-schema-utils");
|
|
17
16
|
var _pageRender = require("./page-render");
|
|
18
|
-
var
|
|
19
|
-
|
|
17
|
+
var _schema = require("../api/schema.util");
|
|
18
|
+
var _excluded = ["layout", "form", "onSelectOk", "onClose", "container"],
|
|
19
|
+
_excluded2 = ["onClose"];
|
|
20
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
21
21
|
function showFormDataManager(_x) {
|
|
22
22
|
return _showFormDataManager.apply(this, arguments);
|
|
23
23
|
}
|
|
24
24
|
function _showFormDataManager() {
|
|
25
25
|
_showFormDataManager = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
26
|
-
var
|
|
26
|
+
var onClose, props;
|
|
27
27
|
return _regenerator["default"].wrap(function (_context) {
|
|
28
28
|
while (1) switch (_context.prev = _context.next) {
|
|
29
29
|
case 0:
|
|
30
|
-
|
|
30
|
+
onClose = options.onClose, props = (0, _objectWithoutPropertiesLoose2["default"])(options, _excluded2);
|
|
31
31
|
return _context.abrupt("return", (0, _pageRender.renderElement)({
|
|
32
|
-
container: container,
|
|
32
|
+
container: props.container,
|
|
33
33
|
onClose: onClose,
|
|
34
34
|
element: {
|
|
35
35
|
component: FormDataManagerRender,
|
|
@@ -64,6 +64,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
64
64
|
form = _this$props.form,
|
|
65
65
|
onSelectOk = _this$props.onSelectOk,
|
|
66
66
|
onClose = _this$props.onClose,
|
|
67
|
+
container = _this$props.container,
|
|
67
68
|
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
68
69
|
// @ts-ignore
|
|
69
70
|
restProps.layout = layout || "modal";
|
|
@@ -81,19 +82,18 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
81
82
|
};
|
|
82
83
|
var dataView = (0, _pageSchemaUtils.cloneDataView)(this.props.dataView, this.props.extraProps);
|
|
83
84
|
return /*#__PURE__*/_react["default"].createElement(_pageLayout.PageLayout, {
|
|
85
|
+
container: container,
|
|
84
86
|
ref: function ref(layout) {
|
|
85
87
|
return _this2.layoutRef = layout;
|
|
86
88
|
},
|
|
87
89
|
layout: layout,
|
|
88
|
-
onClose:
|
|
89
|
-
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
|
|
90
|
-
}
|
|
90
|
+
onClose: onClose
|
|
91
91
|
}, /*#__PURE__*/_react["default"].createElement(_pageLoadSchema.PageLoadSchema, {
|
|
92
92
|
pageId: form === null || form === void 0 ? void 0 : form.id
|
|
93
93
|
}, function (schema) {
|
|
94
94
|
var fdmSchema = schema.children[0].fdmSchema;
|
|
95
95
|
if (form !== null && form !== void 0 && form.fieldId) {
|
|
96
|
-
(0, _schema.
|
|
96
|
+
(0, _schema.forEachSchema)(schema, function (field) {
|
|
97
97
|
if (form.fieldId == field.props.fieldId) {
|
|
98
98
|
fdmSchema = field.fdmSchema;
|
|
99
99
|
return false;
|
|
@@ -12,8 +12,8 @@ var _pageLayout = require("./page-layout");
|
|
|
12
12
|
var _pageRender = require("./page-render");
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _reactRender = require("../../components/react-render");
|
|
15
|
-
var _uuid = require("uuid");
|
|
16
15
|
var _pageLoadSchema = require("./page-load-schema");
|
|
16
|
+
var _common = require("../common");
|
|
17
17
|
var _excluded = ["layout", "form", "items", "onClose"],
|
|
18
18
|
_excluded2 = ["container", "onClose"];
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -84,7 +84,7 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
84
84
|
return /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({}, restProps, {
|
|
85
85
|
components: window._components || window.components || window.__components,
|
|
86
86
|
schema: {
|
|
87
|
-
id: (0,
|
|
87
|
+
id: (0, _common.uuid)(),
|
|
88
88
|
componentName: "Page",
|
|
89
89
|
props: {},
|
|
90
90
|
state: {},
|
|
@@ -22,7 +22,7 @@ function showForm(_x) {
|
|
|
22
22
|
}
|
|
23
23
|
function _showForm() {
|
|
24
24
|
_showForm = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
25
|
-
var container, onClose, props, _options$form, paths, mode, dataId, params,
|
|
25
|
+
var container, onClose, props, _options$form, paths, mode, dataId, params, _options$form2, url;
|
|
26
26
|
return _regenerator["default"].wrap(function (_context) {
|
|
27
27
|
while (1) switch (_context.prev = _context.next) {
|
|
28
28
|
case 0:
|
|
@@ -34,15 +34,23 @@ function _showForm() {
|
|
|
34
34
|
paths = window.location.pathname.split("/");
|
|
35
35
|
mode = options.mode, dataId = options.dataId;
|
|
36
36
|
params = new URLSearchParams();
|
|
37
|
+
if ((_options$form = options.form) !== null && _options$form !== void 0 && _options$form.id) {
|
|
38
|
+
params.set("pageId", (_options$form2 = options.form) === null || _options$form2 === void 0 ? void 0 : _options$form2.id);
|
|
39
|
+
}
|
|
40
|
+
if (mode) {
|
|
41
|
+
params.set("mode", mode);
|
|
42
|
+
}
|
|
37
43
|
if (dataId) {
|
|
38
44
|
params.set("dataId", dataId);
|
|
39
45
|
}
|
|
40
|
-
url = "/
|
|
46
|
+
url = "/pages?" + params.toString();
|
|
47
|
+
if (paths[1] == "admin") {
|
|
48
|
+
url = "/admin/pages?" + params.toString();
|
|
49
|
+
}
|
|
50
|
+
//const url = `/${paths[1]}/${paths[2]}/${options.form?.id}/${mode}?${params.toString()}`;
|
|
41
51
|
_context.next = 1;
|
|
42
52
|
return (0, _index.openPage)(url, url);
|
|
43
53
|
case 1:
|
|
44
|
-
page = _context.sent;
|
|
45
|
-
console.debug("openPage", page);
|
|
46
54
|
return _context.abrupt("return");
|
|
47
55
|
case 2:
|
|
48
56
|
return _context.abrupt("return", (0, _pageRender.renderElement)({
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Component } from "react";
|
|
2
2
|
export type PageLayoutType = "page" | "modal" | "drawer";
|
|
3
3
|
interface PageLayoutProps {
|
|
4
|
+
container?: any;
|
|
4
5
|
layout?: PageLayoutType;
|
|
5
|
-
onClose?: (
|
|
6
|
+
onClose?: () => void;
|
|
6
7
|
keyboard?: boolean;
|
|
7
8
|
children: any;
|
|
8
9
|
}
|
|
@@ -12,6 +13,7 @@ interface PageLayoutState {
|
|
|
12
13
|
}
|
|
13
14
|
export declare class PageLayout extends Component<PageLayoutProps, PageLayoutState> {
|
|
14
15
|
state: PageLayoutState;
|
|
16
|
+
get layout(): PageLayoutType;
|
|
15
17
|
close: () => void;
|
|
16
18
|
constructor(props: any);
|
|
17
19
|
componentDidMount(): void;
|
|
@@ -7,10 +7,11 @@ var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
|
|
|
7
7
|
var _modal = _interopRequireDefault(require("antd/lib/modal"));
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
11
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _loadMaterials = require("../../components/load-materials");
|
|
13
|
-
var _excluded = ["
|
|
14
|
+
var _excluded = ["children"];
|
|
14
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
16
|
var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
16
17
|
function PageLayout(props) {
|
|
@@ -28,7 +29,7 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
28
29
|
return Math.min(window.innerWidth, 1600);
|
|
29
30
|
};
|
|
30
31
|
_this.handleResize = function () {
|
|
31
|
-
if (_this.
|
|
32
|
+
if (_this.layout == "drawer") {
|
|
32
33
|
_this.setState({
|
|
33
34
|
width: _this.getWith()
|
|
34
35
|
});
|
|
@@ -46,10 +47,11 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
46
47
|
window.removeEventListener("resize", this.handleResize);
|
|
47
48
|
};
|
|
48
49
|
_proto.render = function render() {
|
|
50
|
+
var _this2 = this;
|
|
49
51
|
var _this$props = this.props,
|
|
50
|
-
layout = _this$props.layout,
|
|
51
52
|
children = _this$props.children,
|
|
52
53
|
extraProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
54
|
+
var layout = this.layout;
|
|
53
55
|
var state = this.state;
|
|
54
56
|
var restProps = (0, _extends2["default"])({}, extraProps, {
|
|
55
57
|
children: undefined,
|
|
@@ -70,19 +72,54 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
70
72
|
padding: 0
|
|
71
73
|
}
|
|
72
74
|
},
|
|
73
|
-
maskClosable:
|
|
75
|
+
maskClosable: isMobile
|
|
74
76
|
});
|
|
75
77
|
var loadChildren = /*#__PURE__*/_react["default"].createElement(LoadMaterialChildren, null, children);
|
|
76
78
|
if (layout == "modal") {
|
|
77
79
|
restProps.style.top = 64;
|
|
78
80
|
restProps.styles.body.height = "calc(100vh - 120px)";
|
|
79
|
-
return /*#__PURE__*/_react["default"].createElement(_modal["default"], restProps,
|
|
81
|
+
return /*#__PURE__*/_react["default"].createElement(_modal["default"], (0, _extends2["default"])({}, restProps, {
|
|
82
|
+
getContainer: function getContainer() {
|
|
83
|
+
return _this2.props.container || window.document.body;
|
|
84
|
+
},
|
|
85
|
+
afterOpenChange: function afterOpenChange(open) {
|
|
86
|
+
if (!open) {
|
|
87
|
+
var _this2$props$onClose, _this2$props;
|
|
88
|
+
(_this2$props$onClose = (_this2$props = _this2.props).onClose) === null || _this2$props$onClose === void 0 ? void 0 : _this2$props$onClose.call(_this2$props);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}), loadChildren);
|
|
80
92
|
} else if (layout == "drawer") {
|
|
81
|
-
|
|
93
|
+
if (window.isMobile) {
|
|
94
|
+
restProps.placement = "bottom";
|
|
95
|
+
}
|
|
96
|
+
return /*#__PURE__*/_react["default"].createElement(_drawer["default"], (0, _extends2["default"])({}, restProps, {
|
|
97
|
+
getContainer: function getContainer() {
|
|
98
|
+
return _this2.props.container || window.document.body;
|
|
99
|
+
},
|
|
100
|
+
height: "75vh",
|
|
101
|
+
afterVisibleChange: function afterVisibleChange(open) {
|
|
102
|
+
if (!open) {
|
|
103
|
+
var _this2$props$onClose2, _this2$props2;
|
|
104
|
+
(_this2$props$onClose2 = (_this2$props2 = _this2.props).onClose) === null || _this2$props$onClose2 === void 0 ? void 0 : _this2$props$onClose2.call(_this2$props2);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}), loadChildren);
|
|
82
108
|
}
|
|
83
109
|
return loadChildren;
|
|
84
110
|
};
|
|
85
|
-
return PageLayout
|
|
111
|
+
return (0, _createClass2["default"])(PageLayout, [{
|
|
112
|
+
key: "layout",
|
|
113
|
+
get: function get() {
|
|
114
|
+
var layout = this.props.layout;
|
|
115
|
+
if (window.isMobile) {
|
|
116
|
+
if (layout == "modal") {
|
|
117
|
+
return "drawer";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return layout;
|
|
121
|
+
}
|
|
122
|
+
}]);
|
|
86
123
|
}(_react.Component);
|
|
87
124
|
function LoadMaterialChildren(props) {
|
|
88
125
|
return /*#__PURE__*/_react["default"].createElement(_loadMaterials.LoadMaterials, null, props.children);
|
|
@@ -7,55 +7,47 @@ var _result = _interopRequireDefault(require("antd/lib/result"));
|
|
|
7
7
|
var _message2 = _interopRequireDefault(require("antd/lib/message"));
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _api = require("../api");
|
|
10
|
-
var _pageLoading = require("../../components/page-loading");
|
|
11
10
|
var _schemaApi = require("../api/schema-api");
|
|
11
|
+
var _index = require("./index");
|
|
12
12
|
function PageLoadSchema(props) {
|
|
13
13
|
var pageId = props.pageId,
|
|
14
14
|
children = props.children;
|
|
15
15
|
var cache = (0, _schemaApi.getSchemaFromCache)(pageId);
|
|
16
|
-
var _useState = (0, _react.useState)(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _useState2 = (0, _react.useState)(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _useState3 = (0, _react.useState)(),
|
|
23
|
-
errorMsg = _useState3[0],
|
|
24
|
-
setErrorMsg = _useState3[1];
|
|
16
|
+
var _useState = (0, _react.useState)(cache === null || cache === void 0 ? void 0 : cache.data),
|
|
17
|
+
schema = _useState[0],
|
|
18
|
+
setSchema = _useState[1];
|
|
19
|
+
var _useState2 = (0, _react.useState)(),
|
|
20
|
+
errorMsg = _useState2[0],
|
|
21
|
+
setErrorMsg = _useState2[1];
|
|
25
22
|
(0, _react.useEffect)(function () {
|
|
26
|
-
if (cache) {
|
|
23
|
+
if (cache !== null && cache !== void 0 && cache.success) {
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
26
|
if (pageId) {
|
|
27
|
+
(0, _index.showLoading)().then();
|
|
30
28
|
(0, _api.getSchema)(pageId).then(function (res) {
|
|
31
29
|
if (res.success) {
|
|
32
|
-
|
|
33
|
-
setSchema(res.data);
|
|
30
|
+
setSchema(res === null || res === void 0 ? void 0 : res.data);
|
|
34
31
|
} else {
|
|
35
|
-
setErrorMsg(res.message);
|
|
32
|
+
setErrorMsg(res === null || res === void 0 ? void 0 : res.message);
|
|
36
33
|
}
|
|
34
|
+
})["finally"](function () {
|
|
35
|
+
(0, _index.hideLoading)().then();
|
|
37
36
|
});
|
|
38
37
|
} else {
|
|
39
|
-
|
|
40
|
-
setErrorMsg("
|
|
41
|
-
|
|
42
|
-
_message2["default"].error("页面id不可为空!").then();
|
|
38
|
+
(0, _index.hideLoading)().then();
|
|
39
|
+
setErrorMsg("参数错误:页面id不可为空!");
|
|
40
|
+
_message2["default"].error("参数错误:页面id不可为空!").then();
|
|
43
41
|
}
|
|
44
42
|
}, []);
|
|
45
|
-
if (
|
|
43
|
+
if (schema) {
|
|
46
44
|
return children(schema);
|
|
47
45
|
}
|
|
48
|
-
if (
|
|
49
|
-
return /*#__PURE__*/React.createElement(_pageLoading.PageLoading, {
|
|
50
|
-
loading: true,
|
|
51
|
-
background: "rgba(255, 255, 255, 0)"
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
if (!schema) {
|
|
46
|
+
if (errorMsg) {
|
|
55
47
|
return /*#__PURE__*/React.createElement(_result["default"], {
|
|
56
48
|
status: 500,
|
|
57
49
|
title: errorMsg
|
|
58
50
|
});
|
|
59
51
|
}
|
|
60
|
-
return
|
|
52
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null);
|
|
61
53
|
}
|
|
@@ -11,13 +11,13 @@ var _client = require("react-dom/client");
|
|
|
11
11
|
function renderElement(options) {
|
|
12
12
|
return new Promise(/*#__PURE__*/function () {
|
|
13
13
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(resolve, reject) {
|
|
14
|
-
var container, _onClose, _options$element, component, props,
|
|
14
|
+
var container, _onClose, _options$element, component, props, needUnmount, root, element;
|
|
15
15
|
return _regenerator["default"].wrap(function (_context) {
|
|
16
16
|
while (1) switch (_context.prev = _context.next) {
|
|
17
17
|
case 0:
|
|
18
18
|
container = options.container, _onClose = options.onClose;
|
|
19
19
|
_options$element = options.element, component = _options$element.component, props = _options$element.props;
|
|
20
|
-
|
|
20
|
+
needUnmount = !container;
|
|
21
21
|
if (!container) {
|
|
22
22
|
container = document.createElement("div");
|
|
23
23
|
document.body.append(container);
|
|
@@ -32,12 +32,11 @@ function renderElement(options) {
|
|
|
32
32
|
//等待动画结束
|
|
33
33
|
setTimeout(function () {
|
|
34
34
|
root.unmount();
|
|
35
|
-
if (
|
|
35
|
+
if (needUnmount) {
|
|
36
36
|
var _container;
|
|
37
|
-
//移除
|
|
38
37
|
(_container = container) === null || _container === void 0 ? void 0 : _container.remove();
|
|
39
38
|
}
|
|
40
|
-
},
|
|
39
|
+
}, 150);
|
|
41
40
|
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
42
41
|
}
|
|
43
42
|
}));
|
|
@@ -4,6 +4,8 @@ export interface ShowPageProps {
|
|
|
4
4
|
pageId: string;
|
|
5
5
|
layout?: PageLayoutType;
|
|
6
6
|
onClose?: () => void | Promise<void>;
|
|
7
|
+
extraProps?: any;
|
|
8
|
+
afterLoadSchema?: (schema: any) => void;
|
|
7
9
|
pageRef?: (page: any) => void;
|
|
8
10
|
}
|
|
9
11
|
export declare function show(options: ShowPageProps): Promise<any | any[]>;
|