@zzdadelu/schema-builder 1.0.0-alpha.7 → 1.0.0-alpha.70
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 +10 -7
- package/es/main.js +9 -12
- package/lib/createIframe.js +10 -7
- package/lib/main.js +9 -13
- package/package.json +1 -1
- package/es/example.js +0 -1
- package/lib/example.js +0 -1
package/es/createIframe.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return html;
|
|
4
|
-
};
|
|
5
|
-
export default (function () {
|
|
1
|
+
// 创建一个新的 iframe 加载器:iframeLoaderEnhanced.ts
|
|
2
|
+
export var createFixedIframe = function createFixedIframe(widgets) {
|
|
6
3
|
var iframe = document.createElement('iframe');
|
|
7
4
|
iframe.width = '100%';
|
|
8
5
|
iframe.height = '100%';
|
|
9
6
|
iframe.frameBorder = '0';
|
|
10
|
-
|
|
7
|
+
var timestamp = Date.now();
|
|
8
|
+
var cacheBuster = "?t=".concat(timestamp);
|
|
9
|
+
|
|
10
|
+
// 将 widgets 转换为 JSON 字符串用于注入
|
|
11
|
+
var widgetsJson = JSON.stringify(widgets || {});
|
|
12
|
+
var html = "<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>XRender</title>\n <link rel=\"icon\" href=\"https://img.alicdn.com/tfs/TB17UtINiLaK1RjSZFxXXamPFXa-606-643.png\">\n \n <!-- \u6837\u5F0F -->\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css".concat(cacheBuster, "\" rel=\"stylesheet\">\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css").concat(cacheBuster, "\" rel=\"stylesheet\">\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/css/engine-core.css").concat(cacheBuster, "\">\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css").concat(cacheBuster, "\">\n <link rel=\"stylesheet\" href=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/css/index.css").concat(cacheBuster, "\">\n \n <script>\n // \u6838\u5FC3\u4FEE\u590D\uFF1A\u5B8C\u5168\u63A5\u7BA1 polling \u673A\u5236\n (function() {\n // \u5B58\u50A8\u539F\u59CB\u7684 polling \u65B9\u6CD5\n var originalPolling = null;\n \n // \u5B9A\u4E49\u6211\u4EEC\u81EA\u5DF1\u7684 polling \u5B9E\u73B0\n var fixedPolling = function(t) {\n console.log('Fixed polling called with data:', t ? 'has data' : 'no data');\n \n // \u76F4\u63A5\u8BBE\u7F6E getFormRenderMaterial\uFF0C\u4E0D\u4F9D\u8D56\u4E8E\u67E5\u627E iframe\n window.getFormRenderMaterial = function() {\n console.log('Fixed getFormRenderMaterial called');\n // \u8FD4\u56DE\u5B9E\u9645\u7684 widgets \u6570\u636E\n var widgetsData = window.__WIDGETS_DATA__ || t || {};\n return Object.assign({__esModule: true}, widgetsData, {});\n };\n \n // \u786E\u4FDD\u65B9\u6CD5\u5DF2\u8BBE\u7F6E\n console.log('getFormRenderMaterial set:', !!window.getFormRenderMaterial);\n \n // \u5982\u679C\u6709\u539F\u59CB polling\uFF0C\u4E5F\u8C03\u7528\u5B83\uFF08\u5982\u679C\u5B83\u5B58\u5728\uFF09\n if (originalPolling) {\n try {\n originalPolling.call(this, t);\n } catch(e) {\n console.error('Original polling failed:', e);\n }\n }\n \n // \u6807\u8BB0 polling \u5B8C\u6210\n window.__POLLING_COMPLETE__ = true;\n };\n \n // \u62E6\u622A fr-generator \u7684 polling \u65B9\u6CD5\n var interceptPolling = function() {\n if (window.__FR_ENGINE__ && typeof window.__FR_ENGINE__.polling === 'function') {\n originalPolling = window.__FR_ENGINE__.polling;\n window.__FR_ENGINE__.polling = fixedPolling;\n console.log('Successfully intercepted polling method');\n return true;\n }\n return false;\n };\n \n // \u7ACB\u5373\u5C1D\u8BD5\u62E6\u622A\n if (!interceptPolling()) {\n // \u5982\u679C fr-generator \u8FD8\u6CA1\u52A0\u8F7D\uFF0C\u8BBE\u7F6E\u4E00\u4E2A\u76D1\u542C\u5668\n var checkInterval = setInterval(function() {\n if (interceptPolling()) {\n clearInterval(checkInterval);\n console.log('Polling interception complete');\n }\n }, 100);\n \n // \u6700\u591A\u68C0\u67E5 5 \u79D2\n setTimeout(function() {\n clearInterval(checkInterval);\n }, 5000);\n }\n \n // \u6CE8\u5165 widgets \u6570\u636E\n window.__WIDGETS_DATA__ = ").concat(widgetsJson, ";\n \n // \u8BBE\u7F6E\u5176\u4ED6\u5FC5\u8981\u7684\u5168\u5C40\u53D8\u91CF\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n window.__is_simulator_env__ = true;\n window.PropTypes = window.parent.PropTypes;\n window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n \n // \u9884\u5B9A\u4E49 getFormRenderMaterial \u4F5C\u4E3A\u540E\u5907\n window.getFormRenderMaterial = window.getFormRenderMaterial || function() {\n console.log('Fallback getFormRenderMaterial called');\n return Object.assign({__esModule: true}, window.__WIDGETS_DATA__ || {});\n };\n })();\n </script>\n </head>\n <body>\n <div id=\"lce-container\"></div>\n \n <!-- \u52A0\u8F7D\u6240\u6709\u811A\u672C -->\n <script src=\"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js").concat(cacheBuster, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js").concat(cacheBuster, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js").concat(cacheBuster, "\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js").concat(cacheBuster, "\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js").concat(cacheBuster, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js").concat(cacheBuster, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js").concat(cacheBuster, "\"></script>\n <script type=\"text/javascript\" src=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/js/index.js").concat(cacheBuster, "\"></script>\n \n <script>\n // \u786E\u4FDD\u5728 iframe \u52A0\u8F7D\u5B8C\u6210\u540E\u901A\u77E5\u7236\u7A97\u53E3\n window.addEventListener('load', function() {\n console.log('iframe fully loaded, polling status:', window.__POLLING_COMPLETE__);\n \n // \u518D\u6B21\u786E\u4FDD getFormRenderMaterial \u5B58\u5728\n if (!window.getFormRenderMaterial) {\n console.warn('getFormRenderMaterial still missing, setting emergency fallback');\n window.getFormRenderMaterial = function() {\n return {};\n };\n }\n \n // \u901A\u77E5\u7236\u7A97\u53E3 iframe \u5DF2\u51C6\u5907\u5C31\u7EEA\n setTimeout(function() {\n window.parent.postMessage({ type: 'iframe-ready' }, '*');\n window.parent.postMessage({ type: 'engine-load' }, '*');\n }, 300);\n });\n </script>\n </body>\n </html>");
|
|
13
|
+
iframe.srcdoc = html;
|
|
11
14
|
return iframe;
|
|
12
|
-
}
|
|
15
|
+
};
|
package/es/main.js
CHANGED
|
@@ -8,8 +8,8 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
8
8
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
9
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
10
|
import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
11
|
-
import createIframe from './createIframe';
|
|
12
11
|
import * as defaultSetting from './settings';
|
|
12
|
+
import { createFixedIframe } from './createIframe';
|
|
13
13
|
var iframe;
|
|
14
14
|
var Design = function Design(props, ref) {
|
|
15
15
|
var widgets = props.widgets,
|
|
@@ -19,35 +19,32 @@ var Design = function Design(props, ref) {
|
|
|
19
19
|
useImperativeHandle(ref, function () {
|
|
20
20
|
return {
|
|
21
21
|
getValue: function getValue() {
|
|
22
|
-
var _iframe,
|
|
23
|
-
|
|
24
|
-
console.log("__FR_ENGINE__", (_iframe2 = iframe) === null || _iframe2 === void 0 ? void 0 : (_iframe2$contentWindo = _iframe2.contentWindow) === null || _iframe2$contentWindo === void 0 ? void 0 : _iframe2$contentWindo.__FR_ENGINE__);
|
|
25
|
-
return (_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$contentWindo3 = _iframe3$contentWindo2.exportSchema) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2);
|
|
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
|
});
|
|
33
31
|
useEffect(function () {
|
|
34
|
-
initIframe();
|
|
35
32
|
window.addEventListener('message', engineOnLoad);
|
|
33
|
+
initIframe();
|
|
36
34
|
return function () {
|
|
37
35
|
window.removeEventListener('message', engineOnLoad);
|
|
38
36
|
};
|
|
39
37
|
}, []);
|
|
40
38
|
var initIframe = function initIframe() {
|
|
41
|
-
|
|
42
|
-
iframe = createIframe();
|
|
39
|
+
iframe = createFixedIframe;
|
|
43
40
|
containerRef.current.appendChild(iframe);
|
|
44
41
|
};
|
|
45
42
|
var engineOnLoad = function engineOnLoad(event) {
|
|
46
|
-
var
|
|
43
|
+
var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
|
|
47
44
|
if (event.data.type !== 'engine-load') {
|
|
48
45
|
return;
|
|
49
46
|
}
|
|
50
|
-
(
|
|
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({
|
|
51
48
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
52
49
|
widgets: widgets,
|
|
53
50
|
// recordEnable: true,
|
package/lib/createIframe.js
CHANGED
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return html;
|
|
10
|
-
};
|
|
11
|
-
var _default = exports.default = function _default() {
|
|
6
|
+
exports.createFixedIframe = void 0;
|
|
7
|
+
// 创建一个新的 iframe 加载器:iframeLoaderEnhanced.ts
|
|
8
|
+
var createFixedIframe = exports.createFixedIframe = function createFixedIframe(widgets) {
|
|
12
9
|
var iframe = document.createElement('iframe');
|
|
13
10
|
iframe.width = '100%';
|
|
14
11
|
iframe.height = '100%';
|
|
15
12
|
iframe.frameBorder = '0';
|
|
16
|
-
|
|
13
|
+
var timestamp = Date.now();
|
|
14
|
+
var cacheBuster = "?t=".concat(timestamp);
|
|
15
|
+
|
|
16
|
+
// 将 widgets 转换为 JSON 字符串用于注入
|
|
17
|
+
var widgetsJson = JSON.stringify(widgets || {});
|
|
18
|
+
var html = "<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>XRender</title>\n <link rel=\"icon\" href=\"https://img.alicdn.com/tfs/TB17UtINiLaK1RjSZFxXXamPFXa-606-643.png\">\n \n <!-- \u6837\u5F0F -->\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css".concat(cacheBuster, "\" rel=\"stylesheet\">\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css").concat(cacheBuster, "\" rel=\"stylesheet\">\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/css/engine-core.css").concat(cacheBuster, "\">\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css").concat(cacheBuster, "\">\n <link rel=\"stylesheet\" href=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/css/index.css").concat(cacheBuster, "\">\n \n <script>\n // \u6838\u5FC3\u4FEE\u590D\uFF1A\u5B8C\u5168\u63A5\u7BA1 polling \u673A\u5236\n (function() {\n // \u5B58\u50A8\u539F\u59CB\u7684 polling \u65B9\u6CD5\n var originalPolling = null;\n \n // \u5B9A\u4E49\u6211\u4EEC\u81EA\u5DF1\u7684 polling \u5B9E\u73B0\n var fixedPolling = function(t) {\n console.log('Fixed polling called with data:', t ? 'has data' : 'no data');\n \n // \u76F4\u63A5\u8BBE\u7F6E getFormRenderMaterial\uFF0C\u4E0D\u4F9D\u8D56\u4E8E\u67E5\u627E iframe\n window.getFormRenderMaterial = function() {\n console.log('Fixed getFormRenderMaterial called');\n // \u8FD4\u56DE\u5B9E\u9645\u7684 widgets \u6570\u636E\n var widgetsData = window.__WIDGETS_DATA__ || t || {};\n return Object.assign({__esModule: true}, widgetsData, {});\n };\n \n // \u786E\u4FDD\u65B9\u6CD5\u5DF2\u8BBE\u7F6E\n console.log('getFormRenderMaterial set:', !!window.getFormRenderMaterial);\n \n // \u5982\u679C\u6709\u539F\u59CB polling\uFF0C\u4E5F\u8C03\u7528\u5B83\uFF08\u5982\u679C\u5B83\u5B58\u5728\uFF09\n if (originalPolling) {\n try {\n originalPolling.call(this, t);\n } catch(e) {\n console.error('Original polling failed:', e);\n }\n }\n \n // \u6807\u8BB0 polling \u5B8C\u6210\n window.__POLLING_COMPLETE__ = true;\n };\n \n // \u62E6\u622A fr-generator \u7684 polling \u65B9\u6CD5\n var interceptPolling = function() {\n if (window.__FR_ENGINE__ && typeof window.__FR_ENGINE__.polling === 'function') {\n originalPolling = window.__FR_ENGINE__.polling;\n window.__FR_ENGINE__.polling = fixedPolling;\n console.log('Successfully intercepted polling method');\n return true;\n }\n return false;\n };\n \n // \u7ACB\u5373\u5C1D\u8BD5\u62E6\u622A\n if (!interceptPolling()) {\n // \u5982\u679C fr-generator \u8FD8\u6CA1\u52A0\u8F7D\uFF0C\u8BBE\u7F6E\u4E00\u4E2A\u76D1\u542C\u5668\n var checkInterval = setInterval(function() {\n if (interceptPolling()) {\n clearInterval(checkInterval);\n console.log('Polling interception complete');\n }\n }, 100);\n \n // \u6700\u591A\u68C0\u67E5 5 \u79D2\n setTimeout(function() {\n clearInterval(checkInterval);\n }, 5000);\n }\n \n // \u6CE8\u5165 widgets \u6570\u636E\n window.__WIDGETS_DATA__ = ").concat(widgetsJson, ";\n \n // \u8BBE\u7F6E\u5176\u4ED6\u5FC5\u8981\u7684\u5168\u5C40\u53D8\u91CF\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n window.__is_simulator_env__ = true;\n window.PropTypes = window.parent.PropTypes;\n window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n \n // \u9884\u5B9A\u4E49 getFormRenderMaterial \u4F5C\u4E3A\u540E\u5907\n window.getFormRenderMaterial = window.getFormRenderMaterial || function() {\n console.log('Fallback getFormRenderMaterial called');\n return Object.assign({__esModule: true}, window.__WIDGETS_DATA__ || {});\n };\n })();\n </script>\n </head>\n <body>\n <div id=\"lce-container\"></div>\n \n <!-- \u52A0\u8F7D\u6240\u6709\u811A\u672C -->\n <script src=\"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js").concat(cacheBuster, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js").concat(cacheBuster, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js").concat(cacheBuster, "\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js").concat(cacheBuster, "\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js").concat(cacheBuster, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js").concat(cacheBuster, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js").concat(cacheBuster, "\"></script>\n <script type=\"text/javascript\" src=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/js/index.js").concat(cacheBuster, "\"></script>\n \n <script>\n // \u786E\u4FDD\u5728 iframe \u52A0\u8F7D\u5B8C\u6210\u540E\u901A\u77E5\u7236\u7A97\u53E3\n window.addEventListener('load', function() {\n console.log('iframe fully loaded, polling status:', window.__POLLING_COMPLETE__);\n \n // \u518D\u6B21\u786E\u4FDD getFormRenderMaterial \u5B58\u5728\n if (!window.getFormRenderMaterial) {\n console.warn('getFormRenderMaterial still missing, setting emergency fallback');\n window.getFormRenderMaterial = function() {\n return {};\n };\n }\n \n // \u901A\u77E5\u7236\u7A97\u53E3 iframe \u5DF2\u51C6\u5907\u5C31\u7EEA\n setTimeout(function() {\n window.parent.postMessage({ type: 'iframe-ready' }, '*');\n window.parent.postMessage({ type: 'engine-load' }, '*');\n }, 300);\n });\n </script>\n </body>\n </html>");
|
|
19
|
+
iframe.srcdoc = html;
|
|
17
20
|
return iframe;
|
|
18
21
|
};
|
package/lib/main.js
CHANGED
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _createIframe = _interopRequireDefault(require("./createIframe"));
|
|
10
9
|
var defaultSetting = _interopRequireWildcard(require("./settings"));
|
|
10
|
+
var _createIframe = require("./createIframe");
|
|
11
11
|
var _excluded = ["widgets", "settings"];
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
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); }
|
|
14
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -27,35 +26,32 @@ var Design = function Design(props, ref) {
|
|
|
27
26
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
28
27
|
return {
|
|
29
28
|
getValue: function getValue() {
|
|
30
|
-
var _iframe,
|
|
31
|
-
|
|
32
|
-
console.log("__FR_ENGINE__", (_iframe2 = iframe) === null || _iframe2 === void 0 ? void 0 : (_iframe2$contentWindo = _iframe2.contentWindow) === null || _iframe2$contentWindo === void 0 ? void 0 : _iframe2$contentWindo.__FR_ENGINE__);
|
|
33
|
-
return (_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$contentWindo3 = _iframe3$contentWindo2.exportSchema) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2);
|
|
29
|
+
var _iframe, _iframe$contentWindow, _iframe$contentWindow2, _iframe$contentWindow3;
|
|
30
|
+
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
31
|
},
|
|
35
32
|
setValue: function setValue(schema) {
|
|
36
|
-
var
|
|
37
|
-
return (
|
|
33
|
+
var _iframe2, _iframe2$contentWindo, _iframe2$contentWindo2, _iframe2$contentWindo3;
|
|
34
|
+
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
35
|
}
|
|
39
36
|
};
|
|
40
37
|
});
|
|
41
38
|
(0, _react.useEffect)(function () {
|
|
42
|
-
initIframe();
|
|
43
39
|
window.addEventListener('message', engineOnLoad);
|
|
40
|
+
initIframe();
|
|
44
41
|
return function () {
|
|
45
42
|
window.removeEventListener('message', engineOnLoad);
|
|
46
43
|
};
|
|
47
44
|
}, []);
|
|
48
45
|
var initIframe = function initIframe() {
|
|
49
|
-
|
|
50
|
-
iframe = (0, _createIframe.default)();
|
|
46
|
+
iframe = _createIframe.createFixedIframe;
|
|
51
47
|
containerRef.current.appendChild(iframe);
|
|
52
48
|
};
|
|
53
49
|
var engineOnLoad = function engineOnLoad(event) {
|
|
54
|
-
var
|
|
50
|
+
var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
|
|
55
51
|
if (event.data.type !== 'engine-load') {
|
|
56
52
|
return;
|
|
57
53
|
}
|
|
58
|
-
(
|
|
54
|
+
(_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({
|
|
59
55
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
60
56
|
widgets: widgets,
|
|
61
57
|
// recordEnable: true,
|
package/package.json
CHANGED
package/es/example.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/example.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|