@zzdadelu/schema-builder 1.0.0-alpha.123 → 1.0.0-alpha.125
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 +9 -14
- package/lib/createIframe.js +2 -2
- package/lib/main.js +9 -14
- package/package.json +1 -1
package/es/createIframe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// 修改 createIframe.ts 内部结构建议:
|
|
2
1
|
var createIframeContent = function createIframeContent() {
|
|
3
|
-
|
|
2
|
+
var html = "\n <html>\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" />\n <title>XRender</title>\n <link rel=\"icon\" href=\"https://img.alicdn.com/tfs/TB17UtINiLaK1RjSZFxXXamPFXa-606-643.png\">\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css\" rel=\"stylesheet\" />\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css\" rel=\"stylesheet\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/css/engine-core.css\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css\" />\n <link rel=\"stylesheet\" href=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/css/index.css\" />\n\n <script>\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n </script>\n \n <script src=\"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js\"></script>\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 <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js\"></script>\n <script crossorigin=\"anonymous\" 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 ";
|
|
3
|
+
return html;
|
|
4
4
|
};
|
|
5
5
|
export default (function () {
|
|
6
6
|
var iframe = document.createElement('iframe');
|
package/es/main.js
CHANGED
|
@@ -15,18 +15,16 @@ var Design = function Design(props, ref) {
|
|
|
15
15
|
var widgets = props.widgets,
|
|
16
16
|
settings = props.settings,
|
|
17
17
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
18
|
-
var containerRef = useRef(
|
|
19
|
-
var iframeRef = useRef(null); // 使用 ref 代替全局变量
|
|
20
|
-
|
|
18
|
+
var containerRef = useRef();
|
|
21
19
|
useImperativeHandle(ref, function () {
|
|
22
20
|
return {
|
|
23
21
|
getValue: function getValue() {
|
|
24
|
-
var
|
|
25
|
-
return (
|
|
22
|
+
var _iframe, _iframe$contentWindow, _iframe$contentWindow2, _iframe$contentWindow3;
|
|
23
|
+
return (_iframe = 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$contentWindow3 = _iframe$contentWindow2.exportSchema) === null || _iframe$contentWindow3 === void 0 ? void 0 : _iframe$contentWindow3.call(_iframe$contentWindow2);
|
|
26
24
|
},
|
|
27
25
|
setValue: function setValue(schema) {
|
|
28
|
-
var
|
|
29
|
-
return (
|
|
26
|
+
var _iframe2, _iframe2$contentWindo, _iframe2$contentWindo2, _iframe2$contentWindo3;
|
|
27
|
+
return (_iframe2 = iframe) === null || _iframe2 === void 0 ? void 0 : (_iframe2$contentWindo = _iframe2.contentWindow) === null || _iframe2$contentWindo === void 0 ? void 0 : (_iframe2$contentWindo2 = _iframe2$contentWindo.__FR_ENGINE__) === null || _iframe2$contentWindo2 === void 0 ? void 0 : (_iframe2$contentWindo3 = _iframe2$contentWindo2.importSchema) === null || _iframe2$contentWindo3 === void 0 ? void 0 : _iframe2$contentWindo3.call(_iframe2$contentWindo2, schema);
|
|
30
28
|
}
|
|
31
29
|
};
|
|
32
30
|
});
|
|
@@ -38,18 +36,15 @@ var Design = function Design(props, ref) {
|
|
|
38
36
|
};
|
|
39
37
|
}, []);
|
|
40
38
|
var initIframe = function initIframe() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
iframeRef.current = newIframe; // 存入 ref
|
|
44
|
-
containerRef.current.innerHTML = ''; // 清空容器防止多次刷新重复注入
|
|
45
|
-
containerRef.current.appendChild(newIframe);
|
|
39
|
+
iframe = createIframe();
|
|
40
|
+
containerRef.current.appendChild(iframe);
|
|
46
41
|
};
|
|
47
42
|
var engineOnLoad = function engineOnLoad(event) {
|
|
48
|
-
var
|
|
43
|
+
var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
|
|
49
44
|
if (event.data.type !== 'engine-load') {
|
|
50
45
|
return;
|
|
51
46
|
}
|
|
52
|
-
iframe === null ||
|
|
47
|
+
(_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : (_iframe3$contentWindo = _iframe3.contentWindow) === null || _iframe3$contentWindo === void 0 ? void 0 : (_iframe3$contentWindo2 = _iframe3$contentWindo.__FR_ENGINE__) === null || _iframe3$contentWindo2 === void 0 ? void 0 : _iframe3$contentWindo2.init(_objectSpread({
|
|
53
48
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
54
49
|
widgets: widgets,
|
|
55
50
|
// 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 内部结构建议:
|
|
8
7
|
var createIframeContent = function createIframeContent() {
|
|
9
|
-
|
|
8
|
+
var html = "\n <html>\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" />\n <title>XRender</title>\n <link rel=\"icon\" href=\"https://img.alicdn.com/tfs/TB17UtINiLaK1RjSZFxXXamPFXa-606-643.png\">\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css\" rel=\"stylesheet\" />\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css\" rel=\"stylesheet\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/css/engine-core.css\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css\" />\n <link rel=\"stylesheet\" href=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/css/index.css\" />\n\n <script>\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n </script>\n \n <script src=\"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js\"></script>\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 <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js\"></script>\n <script crossorigin=\"anonymous\" 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 ";
|
|
9
|
+
return html;
|
|
10
10
|
};
|
|
11
11
|
var _default = exports.default = function _default() {
|
|
12
12
|
var iframe = document.createElement('iframe');
|
package/lib/main.js
CHANGED
|
@@ -23,18 +23,16 @@ var Design = function Design(props, ref) {
|
|
|
23
23
|
var widgets = props.widgets,
|
|
24
24
|
settings = props.settings,
|
|
25
25
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
26
|
-
var containerRef = (0, _react.useRef)(
|
|
27
|
-
var iframeRef = (0, _react.useRef)(null); // 使用 ref 代替全局变量
|
|
28
|
-
|
|
26
|
+
var containerRef = (0, _react.useRef)();
|
|
29
27
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
30
28
|
return {
|
|
31
29
|
getValue: function getValue() {
|
|
32
|
-
var
|
|
33
|
-
return (
|
|
30
|
+
var _iframe, _iframe$contentWindow, _iframe$contentWindow2, _iframe$contentWindow3;
|
|
31
|
+
return (_iframe = 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$contentWindow3 = _iframe$contentWindow2.exportSchema) === null || _iframe$contentWindow3 === void 0 ? void 0 : _iframe$contentWindow3.call(_iframe$contentWindow2);
|
|
34
32
|
},
|
|
35
33
|
setValue: function setValue(schema) {
|
|
36
|
-
var
|
|
37
|
-
return (
|
|
34
|
+
var _iframe2, _iframe2$contentWindo, _iframe2$contentWindo2, _iframe2$contentWindo3;
|
|
35
|
+
return (_iframe2 = iframe) === null || _iframe2 === void 0 ? void 0 : (_iframe2$contentWindo = _iframe2.contentWindow) === null || _iframe2$contentWindo === void 0 ? void 0 : (_iframe2$contentWindo2 = _iframe2$contentWindo.__FR_ENGINE__) === null || _iframe2$contentWindo2 === void 0 ? void 0 : (_iframe2$contentWindo3 = _iframe2$contentWindo2.importSchema) === null || _iframe2$contentWindo3 === void 0 ? void 0 : _iframe2$contentWindo3.call(_iframe2$contentWindo2, schema);
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
38
|
});
|
|
@@ -46,18 +44,15 @@ var Design = function Design(props, ref) {
|
|
|
46
44
|
};
|
|
47
45
|
}, []);
|
|
48
46
|
var initIframe = function initIframe() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
iframeRef.current = newIframe; // 存入 ref
|
|
52
|
-
containerRef.current.innerHTML = ''; // 清空容器防止多次刷新重复注入
|
|
53
|
-
containerRef.current.appendChild(newIframe);
|
|
47
|
+
iframe = (0, _createIframe.default)();
|
|
48
|
+
containerRef.current.appendChild(iframe);
|
|
54
49
|
};
|
|
55
50
|
var engineOnLoad = function engineOnLoad(event) {
|
|
56
|
-
var
|
|
51
|
+
var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
|
|
57
52
|
if (event.data.type !== 'engine-load') {
|
|
58
53
|
return;
|
|
59
54
|
}
|
|
60
|
-
iframe === null ||
|
|
55
|
+
(_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : (_iframe3$contentWindo = _iframe3.contentWindow) === null || _iframe3$contentWindo === void 0 ? void 0 : (_iframe3$contentWindo2 = _iframe3$contentWindo.__FR_ENGINE__) === null || _iframe3$contentWindo2 === void 0 ? void 0 : _iframe3$contentWindo2.init(_objectSpread({
|
|
61
56
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
62
57
|
widgets: widgets,
|
|
63
58
|
// recordEnable: true,
|