@zzdadelu/schema-builder 1.0.0-alpha.64 → 1.0.0-alpha.66
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 +6 -1
- package/lib/createIframe.js +6 -1
- package/package.json +1 -1
package/es/createIframe.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
// 创建一个新的文件:iframeOverride.js
|
|
2
|
+
// 直接在 iframe 加载时注入,确保在 fr-generator 之前执行
|
|
1
3
|
var createIframeContent = function createIframeContent() {
|
|
2
4
|
var timestamp = new Date().getTime();
|
|
3
|
-
|
|
5
|
+
|
|
6
|
+
// 创建一个代理方法,确保 getFormRenderMaterial 总是可用
|
|
7
|
+
var overrideScript = "\n <script>\n // \u8986\u76D6 getFormRenderMaterial \u7684\u4EE3\u7406\n (function() {\n console.log('[XRender Override] Installing getFormRenderMaterial proxy');\n \n // \u521B\u5EFA\u4E00\u4E2A\u5B89\u5168\u7684\u4EE3\u7406\n var getFormRenderMaterialProxy = function(name, packageName) {\n console.log('[Proxy] getFormRenderMaterial called:', name, packageName);\n \n // \u5C1D\u8BD5\u4ECE\u591A\u4E2A\u53EF\u80FD\u7684\u4F4D\u7F6E\u83B7\u53D6\u6570\u636E\n var sources = [\n window.__FR_ENGINE__?._editorWidgets,\n window.__FR_ENGINE__?.editorWidgets,\n window._editorWidgets,\n window.editorWidgets\n ];\n \n for (var i = 0; i < sources.length; i++) {\n if (sources[i]) {\n console.log('[Proxy] Found widgets in source', i, Object.keys(sources[i]));\n return Object.assign({__esModule: true}, sources[i], {});\n }\n }\n \n console.warn('[Proxy] No widgets found, returning empty object');\n return {};\n };\n \n // \u7ACB\u5373\u8BBE\u7F6E\uFF0C\u786E\u4FDD\u4F4E\u4EE3\u7801\u5F15\u64CE\u53EF\u4EE5\u8C03\u7528\n window.getFormRenderMaterial = getFormRenderMaterialProxy;\n \n // \u76D1\u542C FR_ENGINE \u7684\u521D\u59CB\u5316\n var originalInit = null;\n Object.defineProperty(window, '__FR_ENGINE__', {\n set: function(value) {\n console.log('[Proxy] FR_ENGINE setter called');\n \n // \u4FDD\u5B58\u539F\u59CB\u503C\n this._frEngine = value;\n \n // \u5982\u679C FR_ENGINE \u6709 init \u65B9\u6CD5\uFF0C\u5305\u88C5\u5B83\n if (value && typeof value.init === 'function') {\n originalInit = value.init;\n \n value.init = function(options) {\n console.log('[Proxy] FR_ENGINE.init called with options:', options);\n \n // \u4FDD\u5B58 editorWidgets \u4F9B getFormRenderMaterial \u4F7F\u7528\n if (options && options.editorWidgets) {\n window._editorWidgets = options.editorWidgets;\n console.log('[Proxy] Saved editorWidgets:', Object.keys(options.editorWidgets));\n }\n \n // \u8C03\u7528\u539F\u59CB init\n if (originalInit) {\n return originalInit.call(this, options);\n }\n };\n }\n \n // \u5982\u679C FR_ENGINE \u6709 polling \u65B9\u6CD5\uFF0C\u4E5F\u5305\u88C5\u5B83\n if (value && typeof value.polling === 'function') {\n var originalPolling = value.polling;\n \n value.polling = function(editorWidgets) {\n console.log('[Proxy] FR_ENGINE.polling called');\n \n // \u4FDD\u5B58 widgets\n window._editorWidgets = editorWidgets;\n \n // \u8C03\u7528\u539F\u59CB polling\n if (originalPolling) {\n return originalPolling.call(this, editorWidgets);\n }\n };\n }\n },\n get: function() {\n return this._frEngine;\n },\n configurable: true\n });\n \n console.log('[XRender Override] Proxy installation complete');\n })();\n </script>\n ";
|
|
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 \n <!-- \u6837\u5F0F -->\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css?t=".concat(timestamp, "\" rel=\"stylesheet\" />\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css?t=").concat(timestamp, "\" rel=\"stylesheet\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/css/engine-core.css?t=").concat(timestamp, "\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css?t=").concat(timestamp, "\" />\n <link rel=\"stylesheet\" href=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/css/index.css?t=").concat(timestamp, "\" />\n \n <!-- \u5173\u952E\uFF1A\u5728\u6240\u6709\u5176\u4ED6\u811A\u672C\u4E4B\u524D\u6CE8\u5165\u6211\u4EEC\u7684\u4EE3\u7406 -->\n ").concat(overrideScript, "\n \n <script>\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n window.__is_simulator_env__ = true;\n </script>\n \n <!-- \u7136\u540E\u52A0\u8F7D\u5176\u4ED6\u4F9D\u8D56 -->\n <script src=\"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js?t=").concat(timestamp, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js?t=").concat(timestamp, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js?t=").concat(timestamp, "\"></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?t=").concat(timestamp, "\"></script>\n <script>\n // \u6700\u7EC8\u68C0\u67E5\n window.addEventListener('load', function() {\n console.log('Page loaded. getFormRenderMaterial exists?', !!window.getFormRenderMaterial);\n console.log('FR_ENGINE exists?', !!window.__FR_ENGINE__);\n \n // \u901A\u77E5\u7236\u7A97\u53E3\n setTimeout(function() {\n window.parent.postMessage({ type: 'engine-load' }, '*');\n }, 100);\n });\n </script>\n </body>\n </html>\n ");
|
|
4
9
|
return html;
|
|
5
10
|
};
|
|
6
11
|
export default (function () {
|
package/lib/createIframe.js
CHANGED
|
@@ -4,9 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
// 创建一个新的文件:iframeOverride.js
|
|
8
|
+
// 直接在 iframe 加载时注入,确保在 fr-generator 之前执行
|
|
7
9
|
var createIframeContent = function createIframeContent() {
|
|
8
10
|
var timestamp = new Date().getTime();
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
// 创建一个代理方法,确保 getFormRenderMaterial 总是可用
|
|
13
|
+
var overrideScript = "\n <script>\n // \u8986\u76D6 getFormRenderMaterial \u7684\u4EE3\u7406\n (function() {\n console.log('[XRender Override] Installing getFormRenderMaterial proxy');\n \n // \u521B\u5EFA\u4E00\u4E2A\u5B89\u5168\u7684\u4EE3\u7406\n var getFormRenderMaterialProxy = function(name, packageName) {\n console.log('[Proxy] getFormRenderMaterial called:', name, packageName);\n \n // \u5C1D\u8BD5\u4ECE\u591A\u4E2A\u53EF\u80FD\u7684\u4F4D\u7F6E\u83B7\u53D6\u6570\u636E\n var sources = [\n window.__FR_ENGINE__?._editorWidgets,\n window.__FR_ENGINE__?.editorWidgets,\n window._editorWidgets,\n window.editorWidgets\n ];\n \n for (var i = 0; i < sources.length; i++) {\n if (sources[i]) {\n console.log('[Proxy] Found widgets in source', i, Object.keys(sources[i]));\n return Object.assign({__esModule: true}, sources[i], {});\n }\n }\n \n console.warn('[Proxy] No widgets found, returning empty object');\n return {};\n };\n \n // \u7ACB\u5373\u8BBE\u7F6E\uFF0C\u786E\u4FDD\u4F4E\u4EE3\u7801\u5F15\u64CE\u53EF\u4EE5\u8C03\u7528\n window.getFormRenderMaterial = getFormRenderMaterialProxy;\n \n // \u76D1\u542C FR_ENGINE \u7684\u521D\u59CB\u5316\n var originalInit = null;\n Object.defineProperty(window, '__FR_ENGINE__', {\n set: function(value) {\n console.log('[Proxy] FR_ENGINE setter called');\n \n // \u4FDD\u5B58\u539F\u59CB\u503C\n this._frEngine = value;\n \n // \u5982\u679C FR_ENGINE \u6709 init \u65B9\u6CD5\uFF0C\u5305\u88C5\u5B83\n if (value && typeof value.init === 'function') {\n originalInit = value.init;\n \n value.init = function(options) {\n console.log('[Proxy] FR_ENGINE.init called with options:', options);\n \n // \u4FDD\u5B58 editorWidgets \u4F9B getFormRenderMaterial \u4F7F\u7528\n if (options && options.editorWidgets) {\n window._editorWidgets = options.editorWidgets;\n console.log('[Proxy] Saved editorWidgets:', Object.keys(options.editorWidgets));\n }\n \n // \u8C03\u7528\u539F\u59CB init\n if (originalInit) {\n return originalInit.call(this, options);\n }\n };\n }\n \n // \u5982\u679C FR_ENGINE \u6709 polling \u65B9\u6CD5\uFF0C\u4E5F\u5305\u88C5\u5B83\n if (value && typeof value.polling === 'function') {\n var originalPolling = value.polling;\n \n value.polling = function(editorWidgets) {\n console.log('[Proxy] FR_ENGINE.polling called');\n \n // \u4FDD\u5B58 widgets\n window._editorWidgets = editorWidgets;\n \n // \u8C03\u7528\u539F\u59CB polling\n if (originalPolling) {\n return originalPolling.call(this, editorWidgets);\n }\n };\n }\n },\n get: function() {\n return this._frEngine;\n },\n configurable: true\n });\n \n console.log('[XRender Override] Proxy installation complete');\n })();\n </script>\n ";
|
|
14
|
+
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 \n <!-- \u6837\u5F0F -->\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css?t=".concat(timestamp, "\" rel=\"stylesheet\" />\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css?t=").concat(timestamp, "\" rel=\"stylesheet\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/css/engine-core.css?t=").concat(timestamp, "\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css?t=").concat(timestamp, "\" />\n <link rel=\"stylesheet\" href=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/css/index.css?t=").concat(timestamp, "\" />\n \n <!-- \u5173\u952E\uFF1A\u5728\u6240\u6709\u5176\u4ED6\u811A\u672C\u4E4B\u524D\u6CE8\u5165\u6211\u4EEC\u7684\u4EE3\u7406 -->\n ").concat(overrideScript, "\n \n <script>\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n window.__is_simulator_env__ = true;\n </script>\n \n <!-- \u7136\u540E\u52A0\u8F7D\u5176\u4ED6\u4F9D\u8D56 -->\n <script src=\"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js?t=").concat(timestamp, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js?t=").concat(timestamp, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js?t=").concat(timestamp, "\"></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?t=").concat(timestamp, "\"></script>\n <script>\n // \u6700\u7EC8\u68C0\u67E5\n window.addEventListener('load', function() {\n console.log('Page loaded. getFormRenderMaterial exists?', !!window.getFormRenderMaterial);\n console.log('FR_ENGINE exists?', !!window.__FR_ENGINE__);\n \n // \u901A\u77E5\u7236\u7A97\u53E3\n setTimeout(function() {\n window.parent.postMessage({ type: 'engine-load' }, '*');\n }, 100);\n });\n </script>\n </body>\n </html>\n ");
|
|
10
15
|
return html;
|
|
11
16
|
};
|
|
12
17
|
var _default = exports.default = function _default() {
|