@zzdadelu/schema-builder 1.0.0-alpha.121 → 1.0.0-alpha.123
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/createIframe.js +2 -2
- package/es/main.js +7 -4
- package/lib/createIframe.js +2 -2
- package/lib/main.js +7 -4
- package/package.json +1 -1
package/es/createIframe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
// 修改 createIframe.ts 内部结构建议:
|
|
1
2
|
var createIframeContent = function createIframeContent() {
|
|
2
|
-
|
|
3
|
-
return html;
|
|
3
|
+
return "\n <html>\n <head>\n <script>\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n </script>\n \n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js\"></script>\n \n <script src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js\"></script>\n <script src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js\"></script>\n </head>\n\n <body>\n <div id=\"lce-container\"></div>\n <script type=\"text/javascript\" src=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/js/index.js\"></script>\n </body>\n </html>\n ";
|
|
4
4
|
};
|
|
5
5
|
export default (function () {
|
|
6
6
|
var iframe = document.createElement('iframe');
|
package/es/main.js
CHANGED
|
@@ -38,15 +38,18 @@ var Design = function Design(props, ref) {
|
|
|
38
38
|
};
|
|
39
39
|
}, []);
|
|
40
40
|
var initIframe = function initIframe() {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
if (!containerRef.current) return;
|
|
42
|
+
var newIframe = createIframe();
|
|
43
|
+
iframeRef.current = newIframe; // 存入 ref
|
|
44
|
+
containerRef.current.innerHTML = ''; // 清空容器防止多次刷新重复注入
|
|
45
|
+
containerRef.current.appendChild(newIframe);
|
|
43
46
|
};
|
|
44
47
|
var engineOnLoad = function engineOnLoad(event) {
|
|
45
|
-
var _iframe
|
|
48
|
+
var _iframe$contentWindow, _iframe$contentWindow2;
|
|
46
49
|
if (event.data.type !== 'engine-load') {
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
49
|
-
|
|
52
|
+
iframe === null || iframe === void 0 ? void 0 : (_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : (_iframe$contentWindow2 = _iframe$contentWindow.__FR_ENGINE__) === null || _iframe$contentWindow2 === void 0 ? void 0 : _iframe$contentWindow2.init(_objectSpread({
|
|
50
53
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
51
54
|
widgets: widgets,
|
|
52
55
|
// recordEnable: true,
|
package/lib/createIframe.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
// 修改 createIframe.ts 内部结构建议:
|
|
7
8
|
var createIframeContent = function createIframeContent() {
|
|
8
|
-
|
|
9
|
-
return html;
|
|
9
|
+
return "\n <html>\n <head>\n <script>\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n </script>\n \n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js\"></script>\n \n <script src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js\"></script>\n <script src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js\"></script>\n </head>\n\n <body>\n <div id=\"lce-container\"></div>\n <script type=\"text/javascript\" src=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/js/index.js\"></script>\n </body>\n </html>\n ";
|
|
10
10
|
};
|
|
11
11
|
var _default = exports.default = function _default() {
|
|
12
12
|
var iframe = document.createElement('iframe');
|
package/lib/main.js
CHANGED
|
@@ -46,15 +46,18 @@ var Design = function Design(props, ref) {
|
|
|
46
46
|
};
|
|
47
47
|
}, []);
|
|
48
48
|
var initIframe = function initIframe() {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
if (!containerRef.current) return;
|
|
50
|
+
var newIframe = (0, _createIframe.default)();
|
|
51
|
+
iframeRef.current = newIframe; // 存入 ref
|
|
52
|
+
containerRef.current.innerHTML = ''; // 清空容器防止多次刷新重复注入
|
|
53
|
+
containerRef.current.appendChild(newIframe);
|
|
51
54
|
};
|
|
52
55
|
var engineOnLoad = function engineOnLoad(event) {
|
|
53
|
-
var _iframe
|
|
56
|
+
var _iframe$contentWindow, _iframe$contentWindow2;
|
|
54
57
|
if (event.data.type !== 'engine-load') {
|
|
55
58
|
return;
|
|
56
59
|
}
|
|
57
|
-
|
|
60
|
+
iframe === null || iframe === void 0 ? void 0 : (_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : (_iframe$contentWindow2 = _iframe$contentWindow.__FR_ENGINE__) === null || _iframe$contentWindow2 === void 0 ? void 0 : _iframe$contentWindow2.init(_objectSpread({
|
|
58
61
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
59
62
|
widgets: widgets,
|
|
60
63
|
// recordEnable: true,
|