@zhubangyun/lowcode-core 5.12.92 → 6.1.90
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 +44 -28
- package/es/components/page-loading/index.js +4 -1
- package/es/demo/index.js +8 -8
- package/es/index.d.ts +1 -1
- package/es/index.js +41 -2
- package/es/index.less +10 -0
- package/es/style.js +2 -2
- package/es/utils/api/file-api.js +21 -21
- package/es/utils/api/form-api.d.ts +2 -1
- package/es/utils/api/form-api.js +90 -51
- package/es/utils/api/form-api.utils.js +5 -4
- package/es/utils/api/index.d.ts +2 -2
- package/es/utils/api/index.js +1 -0
- package/es/utils/api/rest-api.d.ts +3 -1
- package/es/utils/api/rest-api.js +207 -125
- package/es/utils/api/schema-api.js +5 -5
- package/es/utils/api/schema.util.d.ts +3 -3
- package/es/utils/api/schema.util.js +17 -12
- package/es/utils/api/script-api.js +12 -12
- package/es/utils/api/user-info.js +7 -7
- package/es/utils/cache/index.js +66 -26
- package/es/utils/common/LoadPlugins.js +33 -33
- package/es/utils/common/SingletonInstanceMap.js +21 -21
- package/es/utils/common/index.d.ts +3 -0
- package/es/utils/common/index.js +13 -3
- package/es/utils/designer/assets/assets.parse.js +15 -15
- package/es/utils/designer/assets/assets.typing.js +6 -0
- package/es/utils/designer/engine/index.js +23 -23
- package/es/utils/designer/index.js +7 -7
- package/es/utils/page/index.js +18 -18
- package/es/utils/page/page-form-data-manager-group.js +9 -6
- package/es/utils/page/page-form-data-manager.d.ts +1 -0
- package/es/utils/page/page-form-data-manager.js +9 -6
- package/es/utils/page/page-form-group.d.ts +1 -0
- package/es/utils/page/page-form-group.js +8 -7
- package/es/utils/page/page-form.d.ts +1 -0
- package/es/utils/page/page-form.js +23 -12
- package/es/utils/page/page-layout.d.ts +3 -0
- package/es/utils/page/page-layout.js +33 -9
- package/es/utils/page/page-load-schema.js +20 -28
- package/es/utils/page/page-render.js +4 -4
- package/es/utils/page/page-show.d.ts +2 -0
- package/es/utils/page/page-show.js +8 -3
- package/es/utils/page/print-form.js +60 -51
- package/es/utils/uni-bridge.d.ts +18 -0
- package/es/utils/uni-bridge.js +130 -0
- package/es/utils/util.common.d.ts +1 -0
- package/es/utils/util.common.js +4 -0
- package/lib/components/load-materials/index.js +45 -30
- package/lib/components/page-loading/index.js +4 -1
- package/lib/demo/index.js +9 -10
- package/lib/index.d.ts +1 -1
- package/lib/index.js +45 -6
- package/lib/index.less +10 -0
- package/lib/style.js +2 -2
- package/lib/utils/api/file-api.js +21 -21
- package/lib/utils/api/form-api.d.ts +2 -1
- package/lib/utils/api/form-api.js +90 -51
- package/lib/utils/api/form-api.utils.js +5 -4
- package/lib/utils/api/index.d.ts +2 -2
- package/lib/utils/api/index.js +2 -2
- package/lib/utils/api/rest-api.d.ts +3 -1
- package/lib/utils/api/rest-api.js +207 -125
- package/lib/utils/api/schema-api.js +5 -5
- package/lib/utils/api/schema.util.d.ts +3 -3
- package/lib/utils/api/schema.util.js +19 -13
- package/lib/utils/api/script-api.js +12 -12
- package/lib/utils/api/user-info.js +7 -7
- package/lib/utils/cache/index.js +65 -25
- package/lib/utils/common/LoadPlugins.js +33 -33
- package/lib/utils/common/SingletonInstanceMap.js +21 -21
- package/lib/utils/common/index.d.ts +3 -0
- package/lib/utils/common/index.js +15 -2
- package/lib/utils/designer/assets/assets.parse.js +16 -17
- package/lib/utils/designer/assets/assets.typing.js +6 -0
- package/lib/utils/designer/engine/index.js +23 -23
- package/lib/utils/designer/index.js +7 -7
- package/lib/utils/index.js +1 -2
- package/lib/utils/page/index.js +18 -18
- package/lib/utils/page/page-form-data-manager-group.js +10 -8
- package/lib/utils/page/page-form-data-manager.d.ts +1 -0
- package/lib/utils/page/page-form-data-manager.js +10 -8
- package/lib/utils/page/page-form-group.d.ts +1 -0
- package/lib/utils/page/page-form-group.js +9 -9
- package/lib/utils/page/page-form.d.ts +1 -0
- package/lib/utils/page/page-form.js +24 -14
- package/lib/utils/page/page-layout.d.ts +3 -0
- package/lib/utils/page/page-layout.js +34 -11
- package/lib/utils/page/page-load-schema.js +19 -27
- package/lib/utils/page/page-render.js +4 -4
- package/lib/utils/page/page-show.d.ts +2 -0
- package/lib/utils/page/page-show.js +9 -5
- package/lib/utils/page/print-form.js +60 -51
- package/lib/utils/uni-bridge.d.ts +18 -0
- package/lib/utils/uni-bridge.js +135 -0
- package/lib/utils/util.common.d.ts +1 -0
- package/lib/utils/util.common.js +8 -0
- package/package.json +2 -2
|
@@ -10,17 +10,17 @@ function loadDts() {
|
|
|
10
10
|
return _loadDts.apply(this, arguments);
|
|
11
11
|
}
|
|
12
12
|
function _loadDts() {
|
|
13
|
-
_loadDts = (0, _asyncToGenerator2["default"])(
|
|
14
|
-
var api, res;
|
|
15
|
-
return _regenerator["default"].wrap(function
|
|
13
|
+
_loadDts = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
14
|
+
var api, res, _t;
|
|
15
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
16
16
|
while (1) switch (_context.prev = _context.next) {
|
|
17
17
|
case 0:
|
|
18
18
|
_context.prev = 0;
|
|
19
|
-
_context.next =
|
|
19
|
+
_context.next = 1;
|
|
20
20
|
return (0, _index.getFormApi)("c40772eb-864b-42bb-ae31-9921d8ede97f");
|
|
21
|
-
case
|
|
21
|
+
case 1:
|
|
22
22
|
api = _context.sent;
|
|
23
|
-
_context.next =
|
|
23
|
+
_context.next = 2;
|
|
24
24
|
return api.search({
|
|
25
25
|
pageSize: 1000,
|
|
26
26
|
searchFields: [{
|
|
@@ -29,18 +29,18 @@ function _loadDts() {
|
|
|
29
29
|
value: "dts"
|
|
30
30
|
}]
|
|
31
31
|
});
|
|
32
|
-
case
|
|
32
|
+
case 2:
|
|
33
33
|
res = _context.sent;
|
|
34
34
|
return _context.abrupt("return", res.data || []);
|
|
35
|
-
case
|
|
36
|
-
_context.prev =
|
|
37
|
-
|
|
35
|
+
case 3:
|
|
36
|
+
_context.prev = 3;
|
|
37
|
+
_t = _context["catch"](0);
|
|
38
38
|
return _context.abrupt("return", []);
|
|
39
|
-
case
|
|
39
|
+
case 4:
|
|
40
40
|
case "end":
|
|
41
41
|
return _context.stop();
|
|
42
42
|
}
|
|
43
|
-
}, _callee, null, [[0,
|
|
43
|
+
}, _callee, null, [[0, 3]]);
|
|
44
44
|
}));
|
|
45
45
|
return _loadDts.apply(this, arguments);
|
|
46
46
|
}
|
|
@@ -11,9 +11,9 @@ function getUserinfo() {
|
|
|
11
11
|
return _getUserinfo.apply(this, arguments);
|
|
12
12
|
}
|
|
13
13
|
function _getUserinfo() {
|
|
14
|
-
_getUserinfo = (0, _asyncToGenerator2["default"])(
|
|
14
|
+
_getUserinfo = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
15
15
|
var userinfo, cache, res;
|
|
16
|
-
return _regenerator["default"].wrap(function
|
|
16
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
18
|
case 0:
|
|
19
19
|
userinfo = null;
|
|
@@ -24,18 +24,18 @@ function _getUserinfo() {
|
|
|
24
24
|
} catch (e) {}
|
|
25
25
|
}
|
|
26
26
|
if (userinfo) {
|
|
27
|
-
_context.next =
|
|
27
|
+
_context.next = 2;
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
|
-
_context.next =
|
|
30
|
+
_context.next = 1;
|
|
31
31
|
return _index.apiRequest.get("auths/userinfo");
|
|
32
|
-
case
|
|
32
|
+
case 1:
|
|
33
33
|
res = _context.sent;
|
|
34
34
|
if (res.success) {
|
|
35
35
|
sessionStorage.setItem(userinfoKey, JSON.stringify(res.data));
|
|
36
36
|
userinfo = res.data;
|
|
37
37
|
}
|
|
38
|
-
case
|
|
38
|
+
case 2:
|
|
39
39
|
if (userinfo) {
|
|
40
40
|
Object.defineProperty(window, "userinfo", {
|
|
41
41
|
value: userinfo
|
|
@@ -45,7 +45,7 @@ function _getUserinfo() {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
return _context.abrupt("return", userinfo);
|
|
48
|
-
case
|
|
48
|
+
case 3:
|
|
49
49
|
case "end":
|
|
50
50
|
return _context.stop();
|
|
51
51
|
}
|
package/lib/utils/cache/index.js
CHANGED
|
@@ -16,44 +16,84 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
|
|
|
16
16
|
(0, _inheritsLoose2["default"])(SchemaCache, _SingletonInstanceMap);
|
|
17
17
|
var _proto = SchemaCache.prototype;
|
|
18
18
|
_proto.createInstance = /*#__PURE__*/function () {
|
|
19
|
-
var _createInstance = (0, _asyncToGenerator2["default"])(
|
|
20
|
-
var mock, pageId, schemaRes, schema,
|
|
21
|
-
return _regenerator["default"].wrap(function
|
|
19
|
+
var _createInstance = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(key, options) {
|
|
20
|
+
var mock, pageId, schemaRes, schema, handleCommonSchema, permission, printTemplates, workflow, cloneSchema, _t;
|
|
21
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
22
22
|
while (1) switch (_context.prev = _context.next) {
|
|
23
23
|
case 0:
|
|
24
24
|
mock = options.mock, pageId = options.pageId;
|
|
25
|
-
_context.next =
|
|
25
|
+
_context.next = 1;
|
|
26
26
|
return _api.apiRequest.get("pages/" + pageId + "/schema", {
|
|
27
27
|
params: {
|
|
28
28
|
mock: mock
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
case
|
|
31
|
+
case 1:
|
|
32
32
|
schemaRes = _context.sent;
|
|
33
|
+
if (schemaRes.succss) {
|
|
34
|
+
_context.next = 2;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
return _context.abrupt("return", schemaRes);
|
|
38
|
+
case 2:
|
|
33
39
|
schema = schemaRes.data;
|
|
34
|
-
if (!(typeof schema == "object")) {
|
|
35
|
-
_context.next =
|
|
40
|
+
if (!(schema != null && typeof schema == "object")) {
|
|
41
|
+
_context.next = 8;
|
|
36
42
|
break;
|
|
37
43
|
}
|
|
38
|
-
|
|
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;
|
|
56
|
+
}
|
|
57
|
+
_context.next = 3;
|
|
39
58
|
return _api.apiRequest.get("pages/" + pageId + "/permission");
|
|
40
|
-
case
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
child.props = child.props || {};
|
|
46
|
-
child.props.permission = permission;
|
|
47
|
-
});
|
|
59
|
+
case 3:
|
|
60
|
+
permission = _context.sent.data;
|
|
61
|
+
if (!((schema === null || schema === void 0 ? void 0 : schema.type) == "form")) {
|
|
62
|
+
_context.next = 7;
|
|
63
|
+
break;
|
|
48
64
|
}
|
|
49
|
-
|
|
50
|
-
|
|
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);
|
|
@@ -76,9 +116,9 @@ var FormApiCache = exports.FormApiCache = /*#__PURE__*/function (_SingletonInsta
|
|
|
76
116
|
(0, _inheritsLoose2["default"])(FormApiCache, _SingletonInstanceMap2);
|
|
77
117
|
var _proto2 = FormApiCache.prototype;
|
|
78
118
|
_proto2.createInstance = /*#__PURE__*/function () {
|
|
79
|
-
var _createInstance2 = (0, _asyncToGenerator2["default"])(
|
|
119
|
+
var _createInstance2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(key, options) {
|
|
80
120
|
var _options, formId, fieldId, mock, formApi;
|
|
81
|
-
return _regenerator["default"].wrap(function
|
|
121
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
82
122
|
while (1) switch (_context2.prev = _context2.next) {
|
|
83
123
|
case 0:
|
|
84
124
|
if (options === void 0) {
|
|
@@ -86,11 +126,11 @@ var FormApiCache = exports.FormApiCache = /*#__PURE__*/function (_SingletonInsta
|
|
|
86
126
|
}
|
|
87
127
|
_options = options, formId = _options.formId, fieldId = _options.fieldId, mock = _options.mock;
|
|
88
128
|
formApi = new _api.RestFormApi(formId, fieldId, mock);
|
|
89
|
-
_context2.next =
|
|
129
|
+
_context2.next = 1;
|
|
90
130
|
return formApi.initialize();
|
|
91
|
-
case
|
|
131
|
+
case 1:
|
|
92
132
|
return _context2.abrupt("return", formApi);
|
|
93
|
-
case
|
|
133
|
+
case 2:
|
|
94
134
|
case "end":
|
|
95
135
|
return _context2.stop();
|
|
96
136
|
}
|
|
@@ -5,45 +5,45 @@ exports.__esModule = true;
|
|
|
5
5
|
exports.loadPlugins = loadPlugins;
|
|
6
6
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
7
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
-
function _createForOfIteratorHelperLoose(
|
|
9
|
-
function _unsupportedIterableToArray(
|
|
10
|
-
function _arrayLikeToArray(
|
|
8
|
+
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."); }
|
|
9
|
+
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; } }
|
|
10
|
+
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; }
|
|
11
11
|
var doc = document;
|
|
12
12
|
function loadPlugins(_x) {
|
|
13
13
|
return _loadPlugins.apply(this, arguments);
|
|
14
14
|
}
|
|
15
15
|
function _loadPlugins() {
|
|
16
|
-
_loadPlugins = (0, _asyncToGenerator2["default"])(
|
|
16
|
+
_loadPlugins = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(plugins) {
|
|
17
17
|
var _iterator, _step, plugin, _iterator2, _step2, _plugin;
|
|
18
|
-
return _regenerator["default"].wrap(function
|
|
18
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
19
19
|
while (1) switch (_context.prev = _context.next) {
|
|
20
20
|
case 0:
|
|
21
21
|
_iterator = _createForOfIteratorHelperLoose(plugins);
|
|
22
22
|
case 1:
|
|
23
23
|
if ((_step = _iterator()).done) {
|
|
24
|
-
_context.next =
|
|
24
|
+
_context.next = 3;
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
27
|
plugin = _step.value;
|
|
28
|
-
_context.next =
|
|
28
|
+
_context.next = 2;
|
|
29
29
|
return loadStyle(plugin);
|
|
30
|
-
case
|
|
30
|
+
case 2:
|
|
31
31
|
_context.next = 1;
|
|
32
32
|
break;
|
|
33
|
-
case
|
|
33
|
+
case 3:
|
|
34
34
|
_iterator2 = _createForOfIteratorHelperLoose(plugins);
|
|
35
|
-
case
|
|
35
|
+
case 4:
|
|
36
36
|
if ((_step2 = _iterator2()).done) {
|
|
37
|
-
_context.next =
|
|
37
|
+
_context.next = 6;
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
40
40
|
_plugin = _step2.value;
|
|
41
|
-
_context.next =
|
|
41
|
+
_context.next = 5;
|
|
42
42
|
return loadScript(_plugin);
|
|
43
|
-
case
|
|
44
|
-
_context.next =
|
|
43
|
+
case 5:
|
|
44
|
+
_context.next = 4;
|
|
45
45
|
break;
|
|
46
|
-
case
|
|
46
|
+
case 6:
|
|
47
47
|
case "end":
|
|
48
48
|
return _context.stop();
|
|
49
49
|
}
|
|
@@ -55,20 +55,20 @@ function loadStyle(_x2) {
|
|
|
55
55
|
return _loadStyle.apply(this, arguments);
|
|
56
56
|
}
|
|
57
57
|
function _loadStyle() {
|
|
58
|
-
_loadStyle = (0, _asyncToGenerator2["default"])(
|
|
59
|
-
return _regenerator["default"].wrap(function
|
|
58
|
+
_loadStyle = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(src) {
|
|
59
|
+
return _regenerator["default"].wrap(function (_context3) {
|
|
60
60
|
while (1) switch (_context3.prev = _context3.next) {
|
|
61
61
|
case 0:
|
|
62
62
|
if (src.endsWith("css")) {
|
|
63
|
-
_context3.next =
|
|
63
|
+
_context3.next = 1;
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
return _context3.abrupt("return", true);
|
|
67
|
-
case
|
|
68
|
-
return _context3.abrupt("return", new Promise(
|
|
69
|
-
var _ref = (0, _asyncToGenerator2["default"])(
|
|
67
|
+
case 1:
|
|
68
|
+
return _context3.abrupt("return", new Promise(/*#__PURE__*/function () {
|
|
69
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(resolve) {
|
|
70
70
|
var callback, target;
|
|
71
|
-
return _regenerator["default"].wrap(function
|
|
71
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
72
72
|
while (1) switch (_context2.prev = _context2.next) {
|
|
73
73
|
case 0:
|
|
74
74
|
callback = function _callback(status) {
|
|
@@ -92,7 +92,7 @@ function _loadStyle() {
|
|
|
92
92
|
} else {
|
|
93
93
|
callback(true);
|
|
94
94
|
}
|
|
95
|
-
case
|
|
95
|
+
case 1:
|
|
96
96
|
case "end":
|
|
97
97
|
return _context2.stop();
|
|
98
98
|
}
|
|
@@ -102,7 +102,7 @@ function _loadStyle() {
|
|
|
102
102
|
return _ref.apply(this, arguments);
|
|
103
103
|
};
|
|
104
104
|
}()));
|
|
105
|
-
case
|
|
105
|
+
case 2:
|
|
106
106
|
case "end":
|
|
107
107
|
return _context3.stop();
|
|
108
108
|
}
|
|
@@ -114,20 +114,20 @@ function loadScript(_x3) {
|
|
|
114
114
|
return _loadScript.apply(this, arguments);
|
|
115
115
|
}
|
|
116
116
|
function _loadScript() {
|
|
117
|
-
_loadScript = (0, _asyncToGenerator2["default"])(
|
|
118
|
-
return _regenerator["default"].wrap(function
|
|
117
|
+
_loadScript = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(src) {
|
|
118
|
+
return _regenerator["default"].wrap(function (_context5) {
|
|
119
119
|
while (1) switch (_context5.prev = _context5.next) {
|
|
120
120
|
case 0:
|
|
121
121
|
if (src.endsWith("js")) {
|
|
122
|
-
_context5.next =
|
|
122
|
+
_context5.next = 1;
|
|
123
123
|
break;
|
|
124
124
|
}
|
|
125
125
|
return _context5.abrupt("return", true);
|
|
126
|
-
case
|
|
127
|
-
return _context5.abrupt("return", new Promise(
|
|
128
|
-
var _ref2 = (0, _asyncToGenerator2["default"])(
|
|
126
|
+
case 1:
|
|
127
|
+
return _context5.abrupt("return", new Promise(/*#__PURE__*/function () {
|
|
128
|
+
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(resolve, reject) {
|
|
129
129
|
var callback, target;
|
|
130
|
-
return _regenerator["default"].wrap(function
|
|
130
|
+
return _regenerator["default"].wrap(function (_context4) {
|
|
131
131
|
while (1) switch (_context4.prev = _context4.next) {
|
|
132
132
|
case 0:
|
|
133
133
|
callback = function _callback2(status) {
|
|
@@ -153,7 +153,7 @@ function _loadScript() {
|
|
|
153
153
|
} else {
|
|
154
154
|
callback(true);
|
|
155
155
|
}
|
|
156
|
-
case
|
|
156
|
+
case 1:
|
|
157
157
|
case "end":
|
|
158
158
|
return _context4.stop();
|
|
159
159
|
}
|
|
@@ -163,7 +163,7 @@ function _loadScript() {
|
|
|
163
163
|
return _ref2.apply(this, arguments);
|
|
164
164
|
};
|
|
165
165
|
}()));
|
|
166
|
-
case
|
|
166
|
+
case 2:
|
|
167
167
|
case "end":
|
|
168
168
|
return _context5.stop();
|
|
169
169
|
}
|
|
@@ -12,25 +12,25 @@ var SingletonInstanceMap = exports.SingletonInstanceMap = /*#__PURE__*/function
|
|
|
12
12
|
}
|
|
13
13
|
var _proto = SingletonInstanceMap.prototype;
|
|
14
14
|
_proto.getInstance = /*#__PURE__*/function () {
|
|
15
|
-
var _getInstance = (0, _asyncToGenerator2["default"])(
|
|
16
|
-
var self, value;
|
|
17
|
-
return _regenerator["default"].wrap(function
|
|
15
|
+
var _getInstance = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(key, options) {
|
|
16
|
+
var self, value, _t;
|
|
17
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
18
18
|
while (1) switch (_context2.prev = _context2.next) {
|
|
19
19
|
case 0:
|
|
20
20
|
self = this;
|
|
21
21
|
if (!this.valueMap.has(key)) {
|
|
22
|
-
_context2.next =
|
|
22
|
+
_context2.next = 1;
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
return _context2.abrupt("return", Promise.resolve(this.valueMap.get(key)));
|
|
26
|
-
case
|
|
26
|
+
case 1:
|
|
27
27
|
if (!this.lockMap.get(key)) {
|
|
28
|
-
_context2.next =
|
|
28
|
+
_context2.next = 2;
|
|
29
29
|
break;
|
|
30
30
|
}
|
|
31
31
|
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
32
|
-
setTimeout(
|
|
33
|
-
return _regenerator["default"].wrap(function
|
|
32
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
33
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
34
34
|
while (1) switch (_context.prev = _context.next) {
|
|
35
35
|
case 0:
|
|
36
36
|
resolve(self.getInstance(key, options));
|
|
@@ -41,29 +41,29 @@ var SingletonInstanceMap = exports.SingletonInstanceMap = /*#__PURE__*/function
|
|
|
41
41
|
}, _callee);
|
|
42
42
|
})), 500);
|
|
43
43
|
}));
|
|
44
|
-
case
|
|
45
|
-
_context2.prev =
|
|
44
|
+
case 2:
|
|
45
|
+
_context2.prev = 2;
|
|
46
46
|
this.lockMap.set(key, true);
|
|
47
|
-
_context2.next =
|
|
47
|
+
_context2.next = 3;
|
|
48
48
|
return this.createInstance(key, options);
|
|
49
|
-
case
|
|
49
|
+
case 3:
|
|
50
50
|
value = _context2.sent;
|
|
51
51
|
this.valueMap.set(key, value);
|
|
52
52
|
this.lockMap.set(key, false);
|
|
53
53
|
return _context2.abrupt("return", Promise.resolve(value));
|
|
54
|
-
case
|
|
55
|
-
_context2.prev =
|
|
56
|
-
|
|
57
|
-
throw
|
|
58
|
-
case
|
|
59
|
-
_context2.prev =
|
|
54
|
+
case 4:
|
|
55
|
+
_context2.prev = 4;
|
|
56
|
+
_t = _context2["catch"](2);
|
|
57
|
+
throw _t;
|
|
58
|
+
case 5:
|
|
59
|
+
_context2.prev = 5;
|
|
60
60
|
this.lockMap.set(key, false);
|
|
61
|
-
return _context2.finish(
|
|
62
|
-
case
|
|
61
|
+
return _context2.finish(5);
|
|
62
|
+
case 6:
|
|
63
63
|
case "end":
|
|
64
64
|
return _context2.stop();
|
|
65
65
|
}
|
|
66
|
-
}, _callee2, this, [[
|
|
66
|
+
}, _callee2, this, [[2, 4, 5, 6]]);
|
|
67
67
|
}));
|
|
68
68
|
function getInstance(_x, _x2) {
|
|
69
69
|
return _getInstance.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;
|
|
3
4
|
export declare function toArray(data: any): any[];
|
|
5
|
+
export declare function isLocalhost(): boolean;
|
|
6
|
+
export declare function isMobile(): boolean;
|
|
@@ -1,20 +1,26 @@
|
|
|
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
|
+
return (0, _uuid.version)(id);
|
|
23
|
+
}
|
|
18
24
|
function toArray(data) {
|
|
19
25
|
if (!data) {
|
|
20
26
|
return [];
|
|
@@ -23,4 +29,11 @@ function toArray(data) {
|
|
|
23
29
|
} else {
|
|
24
30
|
return [data];
|
|
25
31
|
}
|
|
32
|
+
}
|
|
33
|
+
function isLocalhost() {
|
|
34
|
+
return window.location.hostname == "localhost";
|
|
35
|
+
}
|
|
36
|
+
function isMobile() {
|
|
37
|
+
var userAgent = navigator.userAgent;
|
|
38
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(userAgent);
|
|
26
39
|
}
|
|
@@ -10,8 +10,7 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
|
|
|
10
10
|
var _lowcodeUtils = require("@zhubangyun/lowcode-utils");
|
|
11
11
|
var _lowcodeRenderCore = _interopRequireDefault(require("@zhubangyun/lowcode-render-core"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
function
|
|
14
|
-
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; }
|
|
13
|
+
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
14
|
function genLowcodeComp(schema, components) {
|
|
16
15
|
return /*#__PURE__*/function (_React$Component) {
|
|
17
16
|
function LowcodeComp() {
|
|
@@ -33,9 +32,9 @@ function assetsParse(_x) {
|
|
|
33
32
|
return _assetsParse.apply(this, arguments);
|
|
34
33
|
}
|
|
35
34
|
function _assetsParse() {
|
|
36
|
-
_assetsParse = (0, _asyncToGenerator2["default"])(
|
|
35
|
+
_assetsParse = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(assets) {
|
|
37
36
|
var rawComponents, packages, libraryAsset, libraryMap, packagesMap, assetLoader, newComponents, componentDescriptions, remoteComponentDescriptions, lowcodeComponentsArray, proCodeComponentsMap, genLowCodeComponentsMap, components, lowCodeComponents;
|
|
38
|
-
return _regenerator["default"].wrap(function
|
|
37
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
39
38
|
while (1) switch (_context2.prev = _context2.next) {
|
|
40
39
|
case 0:
|
|
41
40
|
genLowCodeComponentsMap = function _genLowCodeComponents(components) {
|
|
@@ -69,12 +68,12 @@ function _assetsParse() {
|
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
70
|
assetLoader = new _lowcodeUtils.AssetLoader();
|
|
72
|
-
_context2.next =
|
|
71
|
+
_context2.next = 1;
|
|
73
72
|
return assetLoader.load(libraryAsset);
|
|
74
|
-
case
|
|
73
|
+
case 1:
|
|
75
74
|
newComponents = rawComponents;
|
|
76
75
|
if (!(rawComponents && rawComponents.length)) {
|
|
77
|
-
_context2.next =
|
|
76
|
+
_context2.next = 2;
|
|
78
77
|
break;
|
|
79
78
|
}
|
|
80
79
|
componentDescriptions = [];
|
|
@@ -92,14 +91,14 @@ function _assetsParse() {
|
|
|
92
91
|
newComponents = [].concat(componentDescriptions);
|
|
93
92
|
// 如果有远程组件描述协议,则自动加载并补充到资产包中,同时出发 designer.incrementalAssetsReady 通知组件面板更新数据
|
|
94
93
|
if (!(remoteComponentDescriptions && remoteComponentDescriptions.length)) {
|
|
95
|
-
_context2.next =
|
|
94
|
+
_context2.next = 2;
|
|
96
95
|
break;
|
|
97
96
|
}
|
|
98
|
-
_context2.next =
|
|
99
|
-
return Promise.all(remoteComponentDescriptions.map(
|
|
100
|
-
var _ref = (0, _asyncToGenerator2["default"])(
|
|
97
|
+
_context2.next = 2;
|
|
98
|
+
return Promise.all(remoteComponentDescriptions.map(/*#__PURE__*/function () {
|
|
99
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(component) {
|
|
101
100
|
var exportName, url, npm, setAssetsComponent, setArrayAssets;
|
|
102
|
-
return _regenerator["default"].wrap(function
|
|
101
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
103
102
|
while (1) switch (_context.prev = _context.next) {
|
|
104
103
|
case 0:
|
|
105
104
|
setArrayAssets = function _setArrayAssets(value, preExportName, preSubName) {
|
|
@@ -141,9 +140,9 @@ function _assetsParse() {
|
|
|
141
140
|
// assets.componentList = assets.componentList.concat(component.componentList || []);
|
|
142
141
|
};
|
|
143
142
|
exportName = component.exportName, url = component.url, npm = component.npm;
|
|
144
|
-
_context.next =
|
|
143
|
+
_context.next = 1;
|
|
145
144
|
return new _lowcodeUtils.AssetLoader().load(url);
|
|
146
|
-
case
|
|
145
|
+
case 1:
|
|
147
146
|
if (window[exportName]) {
|
|
148
147
|
if (Array.isArray(window[exportName])) {
|
|
149
148
|
setArrayAssets(window[exportName]);
|
|
@@ -152,7 +151,7 @@ function _assetsParse() {
|
|
|
152
151
|
}
|
|
153
152
|
}
|
|
154
153
|
return _context.abrupt("return", window[exportName]);
|
|
155
|
-
case
|
|
154
|
+
case 2:
|
|
156
155
|
case "end":
|
|
157
156
|
return _context.stop();
|
|
158
157
|
}
|
|
@@ -162,7 +161,7 @@ function _assetsParse() {
|
|
|
162
161
|
return _ref.apply(this, arguments);
|
|
163
162
|
};
|
|
164
163
|
}()));
|
|
165
|
-
case
|
|
164
|
+
case 2:
|
|
166
165
|
lowcodeComponentsArray = [];
|
|
167
166
|
proCodeComponentsMap = newComponents.reduce(function (acc, cur) {
|
|
168
167
|
if ((cur.devMode || '').toLowerCase() === 'lowcode') {
|
|
@@ -181,7 +180,7 @@ function _assetsParse() {
|
|
|
181
180
|
return _context2.abrupt("return", {
|
|
182
181
|
components: (0, _extends2["default"])({}, components, lowCodeComponents)
|
|
183
182
|
});
|
|
184
|
-
case
|
|
183
|
+
case 3:
|
|
185
184
|
case "end":
|
|
186
185
|
return _context2.stop();
|
|
187
186
|
}
|
|
@@ -21,7 +21,13 @@ exports.LoadEnv = void 0;
|
|
|
21
21
|
* 资源加载环境种类
|
|
22
22
|
*/
|
|
23
23
|
var LoadEnv = exports.LoadEnv = /*#__PURE__*/function (LoadEnv) {
|
|
24
|
+
/**
|
|
25
|
+
* 设计态
|
|
26
|
+
*/
|
|
24
27
|
LoadEnv["design"] = "design";
|
|
28
|
+
/**
|
|
29
|
+
* 运行态
|
|
30
|
+
*/
|
|
25
31
|
LoadEnv["runtime"] = "runtime";
|
|
26
32
|
return LoadEnv;
|
|
27
33
|
}({});
|