@zhubangyun/lowcode-core 6.1.90 → 6.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/react-render/index.js +11 -1
- package/es/index.js +12 -34
- package/es/index.less +11 -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 +1 -1
- package/es/utils/api/form-api/form-api.assemble-entity.d.ts +2 -0
- package/es/utils/api/form-api/form-api.assemble-entity.js +95 -0
- package/es/utils/api/form-api/form-api.entity-map.d.ts +12 -0
- package/es/utils/api/form-api/form-api.entity-map.js +50 -0
- package/es/utils/api/{form-api.utils.d.ts → form-api/form-api.utils.d.ts} +3 -2
- package/es/utils/api/{form-api.utils.js → form-api/form-api.utils.js} +41 -8
- package/es/utils/api/form-api.d.ts +1 -0
- package/es/utils/api/form-api.js +105 -30
- package/es/utils/api/index.js +3 -2
- package/es/utils/api/rest-api.d.ts +2 -1
- package/es/utils/api/schema-api.d.ts +2 -1
- package/es/utils/api/schema-api.js +1 -1
- package/es/utils/api/schema.util.d.ts +1 -0
- package/es/utils/api/schema.util.js +10 -0
- package/es/utils/cache/index.d.ts +0 -1
- package/es/utils/cache/index.js +58 -35
- package/es/utils/cache/index_db_cache.d.ts +9 -0
- package/es/utils/cache/index_db_cache.js +7 -0
- package/es/utils/common/SingletonInstanceMap.d.ts +2 -2
- package/es/utils/common/index.d.ts +1 -1
- package/es/utils/common/index.js +5 -1
- package/es/utils/data/index.d.ts +3 -1
- package/es/utils/data/index.js +10 -3
- package/es/utils/page/index.d.ts +1 -0
- package/es/utils/page/index.js +10 -6
- package/es/utils/page/page-create-element.d.ts +6 -0
- package/es/utils/page/page-create-element.js +23 -0
- package/es/utils/page/page-form-data-manager-group.js +8 -8
- package/es/utils/page/page-form-data-manager.js +8 -8
- package/es/utils/page/page-form.js +4 -6
- package/es/utils/page/page-layout.d.ts +2 -1
- package/es/utils/page/page-layout.js +23 -3
- package/es/utils/page/page-render.js +5 -6
- package/es/utils/page/page-schema-utils.js +2 -1
- package/es/utils/page/page-show.js +4 -4
- package/es/utils/page/print-form.d.ts +3 -2
- package/es/utils/page/print-form.js +193 -57
- package/es/utils/uni-bridge.d.ts +2 -0
- package/es/utils/uni-bridge.js +76 -36
- package/es/utils/util.common.d.ts +1 -1
- package/es/utils/util.common.js +1 -2
- package/lib/components/react-render/index.js +11 -1
- package/lib/index.js +12 -34
- package/lib/index.less +11 -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 +1 -1
- package/lib/utils/api/form-api/form-api.assemble-entity.d.ts +2 -0
- package/lib/utils/api/form-api/form-api.assemble-entity.js +99 -0
- package/lib/utils/api/form-api/form-api.entity-map.d.ts +12 -0
- package/lib/utils/api/form-api/form-api.entity-map.js +54 -0
- package/lib/utils/api/{form-api.utils.d.ts → form-api/form-api.utils.d.ts} +3 -2
- package/lib/utils/api/{form-api.utils.js → form-api/form-api.utils.js} +41 -7
- package/lib/utils/api/form-api.d.ts +1 -0
- package/lib/utils/api/form-api.js +104 -29
- package/lib/utils/api/index.js +3 -2
- package/lib/utils/api/rest-api.d.ts +2 -1
- package/lib/utils/api/schema-api.d.ts +2 -1
- package/lib/utils/api/schema-api.js +1 -1
- package/lib/utils/api/schema.util.d.ts +1 -0
- package/lib/utils/api/schema.util.js +11 -0
- package/lib/utils/cache/index.d.ts +0 -1
- package/lib/utils/cache/index.js +57 -34
- package/lib/utils/cache/index_db_cache.d.ts +9 -0
- package/lib/utils/cache/index_db_cache.js +11 -0
- package/lib/utils/common/SingletonInstanceMap.d.ts +2 -2
- package/lib/utils/common/index.d.ts +1 -1
- package/lib/utils/common/index.js +5 -1
- package/lib/utils/data/index.d.ts +3 -1
- package/lib/utils/data/index.js +10 -3
- package/lib/utils/page/index.d.ts +1 -0
- package/lib/utils/page/index.js +13 -7
- package/lib/utils/page/page-create-element.d.ts +6 -0
- package/lib/utils/page/page-create-element.js +29 -0
- package/lib/utils/page/page-form-data-manager-group.js +8 -8
- package/lib/utils/page/page-form-data-manager.js +8 -8
- package/lib/utils/page/page-form.js +4 -6
- package/lib/utils/page/page-layout.d.ts +2 -1
- package/lib/utils/page/page-layout.js +23 -3
- package/lib/utils/page/page-render.js +5 -6
- package/lib/utils/page/page-schema-utils.js +2 -1
- package/lib/utils/page/page-show.js +4 -4
- package/lib/utils/page/print-form.d.ts +3 -2
- package/lib/utils/page/print-form.js +193 -57
- package/lib/utils/uni-bridge.d.ts +2 -0
- package/lib/utils/uni-bridge.js +76 -36
- package/lib/utils/util.common.d.ts +1 -1
- package/lib/utils/util.common.js +2 -3
- package/package.json +5 -4
- package/es/utils/cache/schema.d.ts +0 -6
- package/es/utils/cache/schema.js +0 -14
- package/lib/utils/cache/schema.d.ts +0 -6
- package/lib/utils/cache/schema.js +0 -18
package/es/utils/uni-bridge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _message from "antd/es/message";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
|
|
4
|
+
import { v7 } from "uuid";
|
|
5
5
|
var UniBridge = /*#__PURE__*/function () {
|
|
6
6
|
function UniBridge() {
|
|
7
7
|
this.callbacks = {};
|
|
@@ -12,9 +12,13 @@ var UniBridge = /*#__PURE__*/function () {
|
|
|
12
12
|
if (!src.startsWith("http")) {
|
|
13
13
|
url = new URL(url, window.location.href).href;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (window.plus) {
|
|
16
|
+
uni.navigateTo({
|
|
17
|
+
url: "/pages/web-page/index?url=" + encodeURIComponent(url)
|
|
18
|
+
});
|
|
19
|
+
} else {
|
|
20
|
+
window.open(url);
|
|
21
|
+
}
|
|
18
22
|
};
|
|
19
23
|
_proto.scanCode = /*#__PURE__*/function () {
|
|
20
24
|
var _scanCode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
@@ -22,21 +26,21 @@ var UniBridge = /*#__PURE__*/function () {
|
|
|
22
26
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
23
27
|
while (1) switch (_context.prev = _context.next) {
|
|
24
28
|
case 0:
|
|
25
|
-
|
|
26
|
-
_context.
|
|
29
|
+
options.scanType = ['qrCode', 'barCode'];
|
|
30
|
+
_context.prev = 1;
|
|
31
|
+
_context.next = 2;
|
|
27
32
|
return this.doAction("scanCode", options);
|
|
28
|
-
case 1:
|
|
29
|
-
return _context.abrupt("return", _context.sent);
|
|
30
33
|
case 2:
|
|
31
|
-
_context.
|
|
32
|
-
_t = _context["catch"](0);
|
|
33
|
-
_message.error("");
|
|
34
|
-
throw _t;
|
|
34
|
+
return _context.abrupt("return", _context.sent);
|
|
35
35
|
case 3:
|
|
36
|
+
_context.prev = 3;
|
|
37
|
+
_t = _context["catch"](1);
|
|
38
|
+
throw _t;
|
|
39
|
+
case 4:
|
|
36
40
|
case "end":
|
|
37
41
|
return _context.stop();
|
|
38
42
|
}
|
|
39
|
-
}, _callee, this, [[
|
|
43
|
+
}, _callee, this, [[1, 3]]);
|
|
40
44
|
}));
|
|
41
45
|
function scanCode(_x) {
|
|
42
46
|
return _scanCode.apply(this, arguments);
|
|
@@ -60,53 +64,88 @@ var UniBridge = /*#__PURE__*/function () {
|
|
|
60
64
|
}
|
|
61
65
|
return getBarHeight;
|
|
62
66
|
}();
|
|
63
|
-
_proto.
|
|
64
|
-
var
|
|
67
|
+
_proto.scanCodeResult = /*#__PURE__*/function () {
|
|
68
|
+
var _scanCodeResult = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
69
|
+
var res;
|
|
65
70
|
return _regeneratorRuntime.wrap(function (_context3) {
|
|
66
71
|
while (1) switch (_context3.prev = _context3.next) {
|
|
67
72
|
case 0:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
_context3.next = 1;
|
|
74
|
+
return this.scanCode({
|
|
75
|
+
onlyFromCamera: false,
|
|
76
|
+
openUrl: false
|
|
77
|
+
});
|
|
71
78
|
case 1:
|
|
79
|
+
res = _context3.sent;
|
|
80
|
+
return _context3.abrupt("return", res.result);
|
|
81
|
+
case 2:
|
|
72
82
|
case "end":
|
|
73
83
|
return _context3.stop();
|
|
74
84
|
}
|
|
75
85
|
}, _callee3, this);
|
|
76
86
|
}));
|
|
87
|
+
function scanCodeResult() {
|
|
88
|
+
return _scanCodeResult.apply(this, arguments);
|
|
89
|
+
}
|
|
90
|
+
return scanCodeResult;
|
|
91
|
+
}();
|
|
92
|
+
_proto.getLocation = /*#__PURE__*/function () {
|
|
93
|
+
var _getLocation = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(options) {
|
|
94
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
95
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
return _context4.abrupt("return", this.doAction("getLocation", {
|
|
98
|
+
type: 'wgs84'
|
|
99
|
+
}));
|
|
100
|
+
case 1:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context4.stop();
|
|
103
|
+
}
|
|
104
|
+
}, _callee4, this);
|
|
105
|
+
}));
|
|
77
106
|
function getLocation(_x2) {
|
|
78
107
|
return _getLocation.apply(this, arguments);
|
|
79
108
|
}
|
|
80
109
|
return getLocation;
|
|
81
110
|
}();
|
|
82
111
|
_proto.doAction = /*#__PURE__*/function () {
|
|
83
|
-
var _doAction = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
112
|
+
var _doAction = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(action, options) {
|
|
84
113
|
var _this = this;
|
|
85
114
|
var messageId;
|
|
86
|
-
return _regeneratorRuntime.wrap(function (
|
|
87
|
-
while (1) switch (
|
|
115
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
116
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
88
117
|
case 0:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
118
|
+
if (window.uni) {
|
|
119
|
+
_context5.next = 1;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
_message.error("\u6267\u884C\u5931\u8D25\uFF01\u7F3A\u5C11uni\u63D2\u4EF6");
|
|
123
|
+
return _context5.abrupt("return");
|
|
124
|
+
case 1:
|
|
125
|
+
messageId = v7();
|
|
126
|
+
return _context5.abrupt("return", new Promise(function (resolve, reject) {
|
|
92
127
|
_this.callbacks[messageId] = {
|
|
93
128
|
resolve: resolve,
|
|
94
129
|
reject: reject
|
|
95
130
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
131
|
+
try {
|
|
132
|
+
uni.postMessage({
|
|
133
|
+
data: {
|
|
134
|
+
action: action,
|
|
135
|
+
messageId: messageId,
|
|
136
|
+
options: options
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
} catch (e) {
|
|
140
|
+
console.log("UniBridge.doAction 异常", e);
|
|
141
|
+
delete _this.callbacks[messageId];
|
|
142
|
+
}
|
|
104
143
|
}));
|
|
105
|
-
case
|
|
144
|
+
case 2:
|
|
106
145
|
case "end":
|
|
107
|
-
return
|
|
146
|
+
return _context5.stop();
|
|
108
147
|
}
|
|
109
|
-
},
|
|
148
|
+
}, _callee5);
|
|
110
149
|
}));
|
|
111
150
|
function doAction(_x3, _x4) {
|
|
112
151
|
return _doAction.apply(this, arguments);
|
|
@@ -114,8 +153,9 @@ var UniBridge = /*#__PURE__*/function () {
|
|
|
114
153
|
return doAction;
|
|
115
154
|
}();
|
|
116
155
|
_proto.receiveMessage = function receiveMessage(message) {
|
|
117
|
-
console.log('收到 UniApp 消息:', message);
|
|
118
156
|
var callback = this.callbacks[message.messageId];
|
|
157
|
+
console.log('客户端收到 UniApp 消息:', JSON.stringify(message));
|
|
158
|
+
console.log('客户端收到 UniApp 消息:callbacks', JSON.stringify(Object.keys(this.callbacks)), callback);
|
|
119
159
|
if (callback) {
|
|
120
160
|
if (message.success) {
|
|
121
161
|
callback.resolve(message.data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function isTemplateHost(): boolean;
|
package/es/utils/util.common.js
CHANGED
|
@@ -24,6 +24,10 @@ var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
24
24
|
_proto.render = function render() {
|
|
25
25
|
var _this2 = this;
|
|
26
26
|
var components = this.props.components || window._components;
|
|
27
|
+
if (!components.Page) {
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
components["Page"] = Page;
|
|
30
|
+
}
|
|
27
31
|
return /*#__PURE__*/React.createElement(_reactRenderFactory["default"], (0, _extends2["default"])({
|
|
28
32
|
key: this.key
|
|
29
33
|
}, this.props, {
|
|
@@ -41,4 +45,10 @@ var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
41
45
|
}));
|
|
42
46
|
};
|
|
43
47
|
return ReactRender;
|
|
44
|
-
}(_react.PureComponent);
|
|
48
|
+
}(_react.PureComponent);
|
|
49
|
+
function Page(props) {
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "lce-page",
|
|
52
|
+
style: props.style
|
|
53
|
+
}, props.children);
|
|
54
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.lodash = exports.apiRequest = exports.RestFormApi = exports.RestApi = exports.PageLoading = exports.LoadMaterials = exports.Layout = void 0;
|
|
6
|
-
var
|
|
7
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _message2 = _interopRequireDefault(require("antd/lib/message"));
|
|
8
7
|
require("./index.less");
|
|
9
8
|
var _reactRender = require("./components/react-render");
|
|
10
9
|
exports.ReactRender = _reactRender.ReactRender;
|
|
@@ -23,6 +22,9 @@ exports.Layout = _layout.Layout;
|
|
|
23
22
|
var _index2 = _interopRequireDefault(require("./utils/index"));
|
|
24
23
|
exports.utils = _index2["default"];
|
|
25
24
|
var _uniBridge = require("./utils/uni-bridge");
|
|
25
|
+
var _init = require("./init/init.bar-height");
|
|
26
|
+
var _init2 = require("./init/init.scroll-size");
|
|
27
|
+
var _init3 = require("./init/init.mobile-class");
|
|
26
28
|
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); }
|
|
27
29
|
// @ts-ignore
|
|
28
30
|
window.__ReactRender = _reactRender.ReactRender;
|
|
@@ -36,40 +38,16 @@ if (!window.utils) {
|
|
|
36
38
|
// @ts-ignore
|
|
37
39
|
window.utils = _index2["default"];
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var classList = window.document.body.classList;
|
|
42
|
-
if (!classList.contains("mobile")) {
|
|
43
|
-
classList.add("mobile");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
var bar_height_key = "bar_height";
|
|
41
|
+
(0, _init3.initMobileClass)();
|
|
42
|
+
|
|
47
43
|
// @ts-ignore
|
|
48
44
|
_index2["default"].uniBridge = _uniBridge.uniBridge;
|
|
49
45
|
// @ts-ignore
|
|
50
46
|
window.uniBridge = _uniBridge.uniBridge;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
while (1) switch (_context.prev = _context.next) {
|
|
56
|
-
case 0:
|
|
57
|
-
_context.next = 1;
|
|
58
|
-
return _uniBridge.uniBridge.getBarHeight();
|
|
59
|
-
case 1:
|
|
60
|
-
height = _context.sent;
|
|
61
|
-
localStorage.setItem(bar_height_key, height);
|
|
62
|
-
updateBarHeight();
|
|
63
|
-
case 2:
|
|
64
|
-
case "end":
|
|
65
|
-
return _context.stop();
|
|
66
|
-
}
|
|
67
|
-
}, _callee);
|
|
68
|
-
})), 100);
|
|
47
|
+
_message2["default"].config({
|
|
48
|
+
top: 150,
|
|
49
|
+
duration: 5,
|
|
50
|
+
maxCount: 3
|
|
69
51
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
document.documentElement.style.setProperty('--bar-height', localStorage.getItem(bar_height_key));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
updateBarHeight();
|
|
52
|
+
(0, _init.initBarHeight)();
|
|
53
|
+
(0, _init2.initScrollSize)();
|
package/lib/index.less
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--scroll-bar-width: 15px;
|
|
3
|
+
--scroll-bar-height: 15px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ant-table-cell-scrollbar {
|
|
7
|
+
padding: 0 !important;
|
|
8
|
+
width: var(--scroll-bar-width);
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
[componentname="Page"] {
|
|
2
12
|
height: 100%;
|
|
3
13
|
}
|
|
4
14
|
|
|
15
|
+
|
|
5
16
|
ul {
|
|
6
17
|
margin-bottom: 0;
|
|
7
18
|
padding-left: 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initBarHeight(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.initBarHeight = initBarHeight;
|
|
6
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
+
var _uniBridge = require("../utils/uni-bridge");
|
|
9
|
+
var bar_height_key = "bar_height";
|
|
10
|
+
function initBarHeight() {
|
|
11
|
+
updateBarHeight();
|
|
12
|
+
window.onload = function () {
|
|
13
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
14
|
+
var height;
|
|
15
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
if (!window.uni) {
|
|
19
|
+
_context.next = 2;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
_context.next = 1;
|
|
23
|
+
return _uniBridge.uniBridge.getBarHeight();
|
|
24
|
+
case 1:
|
|
25
|
+
height = _context.sent;
|
|
26
|
+
localStorage.setItem(bar_height_key, height);
|
|
27
|
+
updateBarHeight();
|
|
28
|
+
case 2:
|
|
29
|
+
case "end":
|
|
30
|
+
return _context.stop();
|
|
31
|
+
}
|
|
32
|
+
}, _callee);
|
|
33
|
+
})), 100);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function updateBarHeight() {
|
|
37
|
+
var style = document.documentElement.style;
|
|
38
|
+
var barHeight = localStorage.getItem(bar_height_key);
|
|
39
|
+
if (barHeight) {
|
|
40
|
+
style.setProperty('--bar-height', barHeight);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initMobileClass(): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.initMobileClass = initMobileClass;
|
|
5
|
+
var _common = require("../utils/common");
|
|
6
|
+
function initMobileClass() {
|
|
7
|
+
window.isMobile = (0, _common.isMobile)();
|
|
8
|
+
if (window.isMobile) {
|
|
9
|
+
var classList = window.document.body.classList;
|
|
10
|
+
if (!classList.contains("mobile")) {
|
|
11
|
+
classList.add("mobile");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getScrollbarSize = getScrollbarSize;
|
|
5
|
+
exports.initScrollSize = initScrollSize;
|
|
6
|
+
var scrollbarSize = {};
|
|
7
|
+
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
window.scrollbarSize = scrollbarSize;
|
|
10
|
+
function initScrollSize() {
|
|
11
|
+
var size = getScrollbarSize();
|
|
12
|
+
var style = document.documentElement.style;
|
|
13
|
+
style.setProperty('--scroll-bar-height', size.height + "px");
|
|
14
|
+
style.setProperty('--scroll-bar-width', size.width + "px");
|
|
15
|
+
}
|
|
16
|
+
function getScrollbarSize() {
|
|
17
|
+
if (typeof scrollbarSize.height == "number" && typeof scrollbarSize.width == "number") {
|
|
18
|
+
return scrollbarSize;
|
|
19
|
+
}
|
|
20
|
+
var outer = document.createElement('div');
|
|
21
|
+
outer.style.cssText = "\n visibility: hidden;\n overflow: scroll;\n position: absolute;\n top: -9999px;\n width: 50px;\n height: 50px;\n ";
|
|
22
|
+
document.body.appendChild(outer);
|
|
23
|
+
var inner = document.createElement('div');
|
|
24
|
+
inner.style.width = '100%';
|
|
25
|
+
inner.style.height = '100%';
|
|
26
|
+
outer.appendChild(inner);
|
|
27
|
+
scrollbarSize.width = outer.offsetWidth - inner.offsetWidth;
|
|
28
|
+
scrollbarSize.height = outer.offsetHeight - inner.offsetHeight;
|
|
29
|
+
document.body.removeChild(outer);
|
|
30
|
+
return scrollbarSize;
|
|
31
|
+
}
|
package/lib/style.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
require('antd/lib/message/style');
|
|
1
2
|
require('antd/lib/config-provider/style');
|
|
2
3
|
|
|
3
4
|
require('antd/lib/notification/style');
|
|
4
5
|
require('antd/lib/modal/style');
|
|
5
|
-
require('antd/lib/message/style');
|
|
6
6
|
require('antd/lib/typography/style');
|
|
7
7
|
require('antd/lib/drawer/style');
|
|
8
8
|
require('antd/lib/result/style');
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.formApiAssembleEntity = formApiAssembleEntity;
|
|
5
|
+
var _formApi = require("./form-api.entity-map");
|
|
6
|
+
var _formApi2 = require("./form-api.utils");
|
|
7
|
+
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
|
+
function formApiAssembleEntity(data, refs) {
|
|
11
|
+
if (!data || !refs) return;
|
|
12
|
+
var dataMap = new _formApi.FormApiEntityMap();
|
|
13
|
+
for (var _iterator = _createForOfIteratorHelperLoose(refs), _step; !(_step = _iterator()).done;) {
|
|
14
|
+
var ref = _step.value;
|
|
15
|
+
ref.label = ref.form.label;
|
|
16
|
+
dataMap.addEntities(ref.data);
|
|
17
|
+
}
|
|
18
|
+
assembleRefs(refs, dataMap);
|
|
19
|
+
var dataArray = Array.isArray(data) ? data : [data];
|
|
20
|
+
assembleData(dataArray, dataMap);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 装配数据
|
|
25
|
+
*/
|
|
26
|
+
function assembleData(data, dataMap) {
|
|
27
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(data), _step2; !(_step2 = _iterator2()).done;) {
|
|
28
|
+
var item = _step2.value;
|
|
29
|
+
assembleObject(item, dataMap, {
|
|
30
|
+
maxDepth: 5,
|
|
31
|
+
depth: 1
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 装配相关数据
|
|
38
|
+
*/
|
|
39
|
+
function assembleRefs(refs, dataMap) {
|
|
40
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(refs), _step3; !(_step3 = _iterator3()).done;) {
|
|
41
|
+
var ref = _step3.value;
|
|
42
|
+
ref.label = ref.form.label;
|
|
43
|
+
var data = ref.data;
|
|
44
|
+
for (var _iterator4 = _createForOfIteratorHelperLoose(data), _step4; !(_step4 = _iterator4()).done;) {
|
|
45
|
+
var item = _step4.value;
|
|
46
|
+
assembleObject(item, dataMap, {
|
|
47
|
+
maxDepth: 2,
|
|
48
|
+
depth: 1
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function assembleObject(values, dataMap, options) {
|
|
54
|
+
var depth = options.depth,
|
|
55
|
+
maxDepth = options.maxDepth;
|
|
56
|
+
if (options.depth >= options.maxDepth) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (dataMap.isEntity(values)) {
|
|
60
|
+
handleEntityLabel(values);
|
|
61
|
+
}
|
|
62
|
+
for (var _i = 0, _Object$keys = Object.keys(values); _i < _Object$keys.length; _i++) {
|
|
63
|
+
var key = _Object$keys[_i];
|
|
64
|
+
var value = values[key];
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
if (dataMap.needLoad(value[0])) {
|
|
67
|
+
//需要加载的属性
|
|
68
|
+
values[key] = value.map(function (item) {
|
|
69
|
+
if (dataMap.hasEntity(item)) {
|
|
70
|
+
return dataMap.getEntity(item);
|
|
71
|
+
}
|
|
72
|
+
return item;
|
|
73
|
+
});
|
|
74
|
+
} else if (dataMap.isEntity(value[0])) {
|
|
75
|
+
//子表属性
|
|
76
|
+
for (var _iterator5 = _createForOfIteratorHelperLoose(value), _step5; !(_step5 = _iterator5()).done;) {
|
|
77
|
+
var valueElement = _step5.value;
|
|
78
|
+
assembleObject(valueElement, dataMap, {
|
|
79
|
+
maxDepth: maxDepth,
|
|
80
|
+
depth: depth + 1
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
} else if (typeof value == "object") {
|
|
85
|
+
if (dataMap.needLoad(value)) {
|
|
86
|
+
if (dataMap.hasEntity(value)) {
|
|
87
|
+
values[key] = dataMap.getEntity(value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function handleEntityLabel(data) {
|
|
94
|
+
var _data$form;
|
|
95
|
+
var labelField = data === null || data === void 0 ? void 0 : (_data$form = data.form) === null || _data$form === void 0 ? void 0 : _data$form.labelField;
|
|
96
|
+
if (labelField) {
|
|
97
|
+
data.label = (0, _formApi2.dataToLabel)((0, _formApi2.safeGet)(data, labelField));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IBaseEntity } from "../rest-api";
|
|
2
|
+
export declare class FormApiEntityMap {
|
|
3
|
+
dataMap: Map<string, IBaseEntity>;
|
|
4
|
+
hasEntity(entity: IBaseEntity): boolean;
|
|
5
|
+
getEntity(entity: IBaseEntity): IBaseEntity;
|
|
6
|
+
addEntity(entity: IBaseEntity): void;
|
|
7
|
+
addEntities(entities: IBaseEntity[]): void;
|
|
8
|
+
isEntity(value: any): boolean;
|
|
9
|
+
needLoad(entity: IBaseEntity): boolean;
|
|
10
|
+
destroy(): void;
|
|
11
|
+
private createEntityKey;
|
|
12
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.FormApiEntityMap = void 0;
|
|
5
|
+
var FormApiEntityMap = exports.FormApiEntityMap = /*#__PURE__*/function () {
|
|
6
|
+
function FormApiEntityMap() {
|
|
7
|
+
this.dataMap = new Map();
|
|
8
|
+
}
|
|
9
|
+
var _proto = FormApiEntityMap.prototype;
|
|
10
|
+
_proto.hasEntity = function hasEntity(entity) {
|
|
11
|
+
var key = this.createEntityKey(entity);
|
|
12
|
+
return this.dataMap.has(key);
|
|
13
|
+
};
|
|
14
|
+
_proto.getEntity = function getEntity(entity) {
|
|
15
|
+
var key = this.createEntityKey(entity);
|
|
16
|
+
return this.dataMap.get(key);
|
|
17
|
+
};
|
|
18
|
+
_proto.addEntity = function addEntity(entity) {
|
|
19
|
+
var key = this.createEntityKey(entity);
|
|
20
|
+
this.dataMap.set(key, entity);
|
|
21
|
+
};
|
|
22
|
+
_proto.addEntities = function addEntities(entities) {
|
|
23
|
+
var _this = this;
|
|
24
|
+
entities === null || entities === void 0 ? void 0 : entities.forEach(function (item) {
|
|
25
|
+
return _this.addEntity(item);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
_proto.isEntity = function isEntity(value) {
|
|
29
|
+
if (value == null) {
|
|
30
|
+
return false;
|
|
31
|
+
} else if (Array.isArray(value)) {
|
|
32
|
+
return false;
|
|
33
|
+
} else if (typeof value == "object") {
|
|
34
|
+
var _value$form;
|
|
35
|
+
return !!value.id && !!((_value$form = value.form) !== null && _value$form !== void 0 && _value$form.id);
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
_proto.needLoad = function needLoad(entity) {
|
|
40
|
+
return this.isEntity(entity) && entity._load == false;
|
|
41
|
+
};
|
|
42
|
+
_proto.destroy = function destroy() {
|
|
43
|
+
this.dataMap.clear();
|
|
44
|
+
};
|
|
45
|
+
_proto.createEntityKey = function createEntityKey(entity) {
|
|
46
|
+
var _entity$form, _entity$form2;
|
|
47
|
+
var key = (_entity$form = entity.form) === null || _entity$form === void 0 ? void 0 : _entity$form.id;
|
|
48
|
+
if ((_entity$form2 = entity.form) !== null && _entity$form2 !== void 0 && _entity$form2.fieldId) {
|
|
49
|
+
key += "." + entity.form.fieldId;
|
|
50
|
+
}
|
|
51
|
+
return key + "." + entity.id;
|
|
52
|
+
};
|
|
53
|
+
return FormApiEntityMap;
|
|
54
|
+
}();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FilterRule, IBaseEntity, Refs } from "
|
|
1
|
+
import { FilterRule, IBaseEntity, Refs } from "../rest-api";
|
|
2
2
|
export declare function convertSaveData(data: any): any;
|
|
3
3
|
export declare function dataToLabel(value: any): any;
|
|
4
4
|
export declare function assembleAssociationFieldV2(data: IBaseEntity | IBaseEntity[], refs?: Refs): void;
|
|
@@ -9,7 +9,8 @@ export declare function assembleAssociationFieldV2(data: IBaseEntity | IBaseEnti
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function assembleAssociationFieldDataV2(data: IBaseEntity | IBaseEntity[], dataMap: Map<string, IBaseEntity>): void;
|
|
11
11
|
export declare function handleEntityLabel(data: IBaseEntity | IBaseEntity[]): void;
|
|
12
|
-
export declare function assembleAssociationField(data: IBaseEntity | IBaseEntity[], refs?: Refs):
|
|
12
|
+
export declare function assembleAssociationField(data: IBaseEntity | IBaseEntity[], refs?: Refs): number;
|
|
13
13
|
export declare function handleFilterRules(filters: FilterRule[], options: {
|
|
14
14
|
filterNullValue: boolean;
|
|
15
15
|
}): FilterRule[];
|
|
16
|
+
export declare function safeGet(value: any, key: string | null): any;
|