@zhubangyun/lowcode-core 5.5.81 → 5.5.82
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.d.ts +5 -0
- package/es/components/load-materials/index.js +82 -0
- package/es/components/page-loading/index.d.ts +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/lib/components/load-materials/index.d.ts +5 -0
- package/lib/components/load-materials/index.js +89 -0
- package/lib/components/page-loading/index.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import React, { useEffect, useState } from "react";
|
|
4
|
+
import { PageLoading } from "../page-loading";
|
|
5
|
+
import { loadPlugins } from "../../utils/common";
|
|
6
|
+
var __hasLoading = false;
|
|
7
|
+
export function LoadMaterials(props) {
|
|
8
|
+
var _useState = useState(false),
|
|
9
|
+
init = _useState[0],
|
|
10
|
+
setInit = _useState[1];
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
initialize()["finally"](function () {
|
|
13
|
+
return setInit(true);
|
|
14
|
+
});
|
|
15
|
+
}, []);
|
|
16
|
+
function initialize() {
|
|
17
|
+
return _initialize.apply(this, arguments);
|
|
18
|
+
}
|
|
19
|
+
function _initialize() {
|
|
20
|
+
_initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
22
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
__hasLoading = true;
|
|
25
|
+
_context.next = 3;
|
|
26
|
+
return loadMaterials();
|
|
27
|
+
case 3:
|
|
28
|
+
case "end":
|
|
29
|
+
return _context.stop();
|
|
30
|
+
}
|
|
31
|
+
}, _callee);
|
|
32
|
+
}));
|
|
33
|
+
return _initialize.apply(this, arguments);
|
|
34
|
+
}
|
|
35
|
+
if (__hasLoading) {
|
|
36
|
+
return props.children;
|
|
37
|
+
}
|
|
38
|
+
if (init) {
|
|
39
|
+
return props.children;
|
|
40
|
+
} else {
|
|
41
|
+
return /*#__PURE__*/React.createElement(PageLoading, {
|
|
42
|
+
loading: true
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function loadMaterials() {
|
|
47
|
+
return _loadMaterials.apply(this, arguments);
|
|
48
|
+
}
|
|
49
|
+
function _loadMaterials() {
|
|
50
|
+
_loadMaterials = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
51
|
+
var components, urls;
|
|
52
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
components = {};
|
|
56
|
+
urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.6.1/lodash.min.js", "dayjs/dayjs.min.js", "antd/latest/reset.css", "antd/latest/antd.min.js", "antdIcon/1.0.0/antdIcon.min.js", "lowcode/core/index.js", "lowcode/core/index.css", "lowcode/materials/root/view.js", "lowcode/materials/root/view.css", "lowcode/materials/antd/view.js", "lowcode/materials/antd/view.css", "lowcode/materials/antd-pro/view.js", "lowcode/materials/antd-pro/view.css", "lowcode/icon-font/app/iconfont.js"];
|
|
57
|
+
_context2.next = 4;
|
|
58
|
+
return loadPlugins(urls.map(function (url) {
|
|
59
|
+
return "https://cdn.zhiyunhe.com/plugin/" + url;
|
|
60
|
+
}));
|
|
61
|
+
case 4:
|
|
62
|
+
["RootMaterial", "AntdMaterial", "AntdProMaterial"].forEach(function (lib) {
|
|
63
|
+
var data = window[lib];
|
|
64
|
+
if (data) {
|
|
65
|
+
Object.entries(data).forEach(function (_ref) {
|
|
66
|
+
var key = _ref[0],
|
|
67
|
+
value = _ref[1];
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
components[key] = value;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
window._components = components;
|
|
74
|
+
return _context2.abrupt("return", components);
|
|
75
|
+
case 7:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context2.stop();
|
|
78
|
+
}
|
|
79
|
+
}, _callee2);
|
|
80
|
+
}));
|
|
81
|
+
return _loadMaterials.apply(this, arguments);
|
|
82
|
+
}
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./index.less";
|
|
2
2
|
import utils from "./utils";
|
|
3
|
+
export { LoadMaterials } from "./components/load-materials";
|
|
3
4
|
export { PageLoading } from "./components/page-loading";
|
|
4
5
|
export { RestApi, RestFormApi, apiRequest } from "./utils/api";
|
|
5
6
|
export { Layout } from "./components/layout";
|
package/es/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./index.less";
|
|
2
2
|
import utils from "./utils";
|
|
3
3
|
import { ReactRender } from "./components/react-render";
|
|
4
|
+
export { LoadMaterials } from "./components/load-materials";
|
|
4
5
|
export { PageLoading } from "./components/page-loading";
|
|
5
6
|
export { RestApi, RestFormApi, apiRequest } from "./utils/api";
|
|
6
7
|
export { Layout } from "./components/layout";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.LoadMaterials = LoadMaterials;
|
|
6
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _pageLoading = require("../page-loading");
|
|
10
|
+
var _common = require("../../utils/common");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
|
+
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
|
+
var __hasLoading = false;
|
|
14
|
+
function LoadMaterials(props) {
|
|
15
|
+
var _useState = (0, _react.useState)(false),
|
|
16
|
+
init = _useState[0],
|
|
17
|
+
setInit = _useState[1];
|
|
18
|
+
(0, _react.useEffect)(function () {
|
|
19
|
+
initialize()["finally"](function () {
|
|
20
|
+
return setInit(true);
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
23
|
+
function initialize() {
|
|
24
|
+
return _initialize.apply(this, arguments);
|
|
25
|
+
}
|
|
26
|
+
function _initialize() {
|
|
27
|
+
_initialize = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
28
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
__hasLoading = true;
|
|
32
|
+
_context.next = 3;
|
|
33
|
+
return loadMaterials();
|
|
34
|
+
case 3:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}, _callee);
|
|
39
|
+
}));
|
|
40
|
+
return _initialize.apply(this, arguments);
|
|
41
|
+
}
|
|
42
|
+
if (__hasLoading) {
|
|
43
|
+
return props.children;
|
|
44
|
+
}
|
|
45
|
+
if (init) {
|
|
46
|
+
return props.children;
|
|
47
|
+
} else {
|
|
48
|
+
return /*#__PURE__*/_react["default"].createElement(_pageLoading.PageLoading, {
|
|
49
|
+
loading: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function loadMaterials() {
|
|
54
|
+
return _loadMaterials.apply(this, arguments);
|
|
55
|
+
}
|
|
56
|
+
function _loadMaterials() {
|
|
57
|
+
_loadMaterials = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
58
|
+
var components, urls;
|
|
59
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
60
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
61
|
+
case 0:
|
|
62
|
+
components = {};
|
|
63
|
+
urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.6.1/lodash.min.js", "dayjs/dayjs.min.js", "antd/latest/reset.css", "antd/latest/antd.min.js", "antdIcon/1.0.0/antdIcon.min.js", "lowcode/core/index.js", "lowcode/core/index.css", "lowcode/materials/root/view.js", "lowcode/materials/root/view.css", "lowcode/materials/antd/view.js", "lowcode/materials/antd/view.css", "lowcode/materials/antd-pro/view.js", "lowcode/materials/antd-pro/view.css", "lowcode/icon-font/app/iconfont.js"];
|
|
64
|
+
_context2.next = 4;
|
|
65
|
+
return (0, _common.loadPlugins)(urls.map(function (url) {
|
|
66
|
+
return "https://cdn.zhiyunhe.com/plugin/" + url;
|
|
67
|
+
}));
|
|
68
|
+
case 4:
|
|
69
|
+
["RootMaterial", "AntdMaterial", "AntdProMaterial"].forEach(function (lib) {
|
|
70
|
+
var data = window[lib];
|
|
71
|
+
if (data) {
|
|
72
|
+
Object.entries(data).forEach(function (_ref) {
|
|
73
|
+
var key = _ref[0],
|
|
74
|
+
value = _ref[1];
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
components[key] = value;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
window._components = components;
|
|
81
|
+
return _context2.abrupt("return", components);
|
|
82
|
+
case 7:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context2.stop();
|
|
85
|
+
}
|
|
86
|
+
}, _callee2);
|
|
87
|
+
}));
|
|
88
|
+
return _loadMaterials.apply(this, arguments);
|
|
89
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./index.less";
|
|
2
2
|
import utils from "./utils";
|
|
3
|
+
export { LoadMaterials } from "./components/load-materials";
|
|
3
4
|
export { PageLoading } from "./components/page-loading";
|
|
4
5
|
export { RestApi, RestFormApi, apiRequest } from "./utils/api";
|
|
5
6
|
export { Layout } from "./components/layout";
|
package/lib/index.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.apiRequest = exports.RestFormApi = exports.RestApi = exports.PageLoading = exports.Layout = void 0;
|
|
5
|
+
exports.apiRequest = exports.RestFormApi = exports.RestApi = exports.PageLoading = exports.LoadMaterials = exports.Layout = void 0;
|
|
6
6
|
require("./index.less");
|
|
7
7
|
var _utils = _interopRequireDefault(require("./utils"));
|
|
8
8
|
exports.utils = _utils["default"];
|
|
9
9
|
var _reactRender = require("./components/react-render");
|
|
10
10
|
exports.ReactRender = _reactRender.ReactRender;
|
|
11
|
+
var _loadMaterials = require("./components/load-materials");
|
|
12
|
+
exports.LoadMaterials = _loadMaterials.LoadMaterials;
|
|
11
13
|
var _pageLoading = require("./components/page-loading");
|
|
12
14
|
exports.PageLoading = _pageLoading.PageLoading;
|
|
13
15
|
var _api = require("./utils/api");
|