@zzdadelu/schema-builder 1.0.0-alpha.39 → 1.0.0-alpha.40
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 +22 -3
- package/lib/createIframe.js +22 -3
- package/package.json +1 -1
package/es/createIframe.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// createIframe.ts
|
|
1
2
|
var createIframeContent = function createIframeContent() {
|
|
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\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
|
+
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 <meta http-equiv=\"Cache-Control\" content=\"no-cache, no-store, must-revalidate\">\n <meta http-equiv=\"Pragma\" content=\"no-cache\">\n <meta http-equiv=\"Expires\" content=\"0\">\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 // \u786E\u4FDD\u7236\u7A97\u53E3\u53EF\u4EE5\u8BBF\u95EE\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n \n // \u5B9A\u4E49\u5168\u5C40\u53D8\u91CF\u5B58\u50A8\u51FD\u6570\uFF0C\u786E\u4FDD\u5728\u7236\u7A97\u53E3\u53EF\u8BBF\u95EE\n window._xrenderFunctions = {};\n \n // \u5728\u51FD\u6570\u5B9A\u4E49\u65F6\uFF0C\u540C\u65F6\u66B4\u9732\u7ED9\u7236\u7A97\u53E3\n const exposeToParent = (functionName, func) => {\n window[functionName] = func;\n window._xrenderFunctions[functionName] = func;\n \n // \u540C\u65F6\u901A\u77E5\u7236\u7A97\u53E3\u51FD\u6570\u5DF2\u51C6\u5907\u597D\n try {\n window.parent.postMessage({\n type: 'xrender-function-ready',\n functionName: functionName,\n timestamp: Date.now()\n }, '*');\n } catch(e) {}\n };\n \n // \u5728 getFormRenderMaterial \u5B9A\u4E49\u524D\u52AB\u6301\n const originalDefineProperty = Object.defineProperty;\n Object.defineProperty = function(obj, prop, descriptor) {\n if (prop === 'getFormRenderMaterial' && obj === window) {\n const originalGetter = descriptor.get;\n const originalSetter = descriptor.set;\n \n if (originalGetter) {\n descriptor.get = function() {\n const result = originalGetter.call(this);\n exposeToParent('getFormRenderMaterial', result);\n return result;\n };\n }\n \n if (originalSetter) {\n descriptor.set = function(value) {\n originalSetter.call(this, value);\n exposeToParent('getFormRenderMaterial', value);\n };\n }\n }\n return originalDefineProperty.call(this, obj, prop, descriptor);\n };\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\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(Date.now(), "\"></script>\n <script>\n // \u786E\u4FDD\u6240\u6709\u811A\u672C\u52A0\u8F7D\u540E\uFF0C\u518D\u6B21\u68C0\u67E5\u51FD\u6570\n setTimeout(() => {\n if (typeof window.getFormRenderMaterial === 'function') {\n window.parent.postMessage({\n type: 'xrender-fully-loaded',\n functionName: 'getFormRenderMaterial',\n available: true,\n timestamp: Date.now()\n }, '*');\n } else {\n console.error('getFormRenderMaterial is not a function after all scripts loaded');\n window.parent.postMessage({\n type: 'xrender-load-error',\n message: 'getFormRenderMaterial not found',\n timestamp: Date.now()\n }, '*');\n }\n }, 1000);\n </script>\n </body>\n </html>\n ");
|
|
3
4
|
return html;
|
|
4
5
|
};
|
|
5
6
|
export default (function () {
|
|
@@ -7,7 +8,25 @@ export default (function () {
|
|
|
7
8
|
iframe.width = '100%';
|
|
8
9
|
iframe.height = '100%';
|
|
9
10
|
iframe.frameBorder = '0';
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
// 使用唯一ID来避免缓存
|
|
13
|
+
var iframeId = 'xrender-iframe-' + Date.now();
|
|
14
|
+
iframe.id = iframeId;
|
|
15
|
+
iframe.name = iframeId;
|
|
16
|
+
|
|
17
|
+
// 添加防缓存参数
|
|
18
|
+
var htmlContent = createIframeContent();
|
|
19
|
+
var blob = new Blob([htmlContent], {
|
|
20
|
+
type: 'text/html'
|
|
21
|
+
});
|
|
22
|
+
var url = URL.createObjectURL(blob);
|
|
23
|
+
iframe.src = url;
|
|
24
|
+
|
|
25
|
+
// 清理URL对象
|
|
26
|
+
iframe.onload = function () {
|
|
27
|
+
setTimeout(function () {
|
|
28
|
+
return URL.revokeObjectURL(url);
|
|
29
|
+
}, 1000);
|
|
30
|
+
};
|
|
12
31
|
return iframe;
|
|
13
32
|
});
|
package/lib/createIframe.js
CHANGED
|
@@ -4,8 +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
|
-
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\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
|
+
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 <meta http-equiv=\"Cache-Control\" content=\"no-cache, no-store, must-revalidate\">\n <meta http-equiv=\"Pragma\" content=\"no-cache\">\n <meta http-equiv=\"Expires\" content=\"0\">\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 // \u786E\u4FDD\u7236\u7A97\u53E3\u53EF\u4EE5\u8BBF\u95EE\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n \n // \u5B9A\u4E49\u5168\u5C40\u53D8\u91CF\u5B58\u50A8\u51FD\u6570\uFF0C\u786E\u4FDD\u5728\u7236\u7A97\u53E3\u53EF\u8BBF\u95EE\n window._xrenderFunctions = {};\n \n // \u5728\u51FD\u6570\u5B9A\u4E49\u65F6\uFF0C\u540C\u65F6\u66B4\u9732\u7ED9\u7236\u7A97\u53E3\n const exposeToParent = (functionName, func) => {\n window[functionName] = func;\n window._xrenderFunctions[functionName] = func;\n \n // \u540C\u65F6\u901A\u77E5\u7236\u7A97\u53E3\u51FD\u6570\u5DF2\u51C6\u5907\u597D\n try {\n window.parent.postMessage({\n type: 'xrender-function-ready',\n functionName: functionName,\n timestamp: Date.now()\n }, '*');\n } catch(e) {}\n };\n \n // \u5728 getFormRenderMaterial \u5B9A\u4E49\u524D\u52AB\u6301\n const originalDefineProperty = Object.defineProperty;\n Object.defineProperty = function(obj, prop, descriptor) {\n if (prop === 'getFormRenderMaterial' && obj === window) {\n const originalGetter = descriptor.get;\n const originalSetter = descriptor.set;\n \n if (originalGetter) {\n descriptor.get = function() {\n const result = originalGetter.call(this);\n exposeToParent('getFormRenderMaterial', result);\n return result;\n };\n }\n \n if (originalSetter) {\n descriptor.set = function(value) {\n originalSetter.call(this, value);\n exposeToParent('getFormRenderMaterial', value);\n };\n }\n }\n return originalDefineProperty.call(this, obj, prop, descriptor);\n };\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\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(Date.now(), "\"></script>\n <script>\n // \u786E\u4FDD\u6240\u6709\u811A\u672C\u52A0\u8F7D\u540E\uFF0C\u518D\u6B21\u68C0\u67E5\u51FD\u6570\n setTimeout(() => {\n if (typeof window.getFormRenderMaterial === 'function') {\n window.parent.postMessage({\n type: 'xrender-fully-loaded',\n functionName: 'getFormRenderMaterial',\n available: true,\n timestamp: Date.now()\n }, '*');\n } else {\n console.error('getFormRenderMaterial is not a function after all scripts loaded');\n window.parent.postMessage({\n type: 'xrender-load-error',\n message: 'getFormRenderMaterial not found',\n timestamp: Date.now()\n }, '*');\n }\n }, 1000);\n </script>\n </body>\n </html>\n ");
|
|
9
10
|
return html;
|
|
10
11
|
};
|
|
11
12
|
var _default = exports.default = function _default() {
|
|
@@ -13,7 +14,25 @@ var _default = exports.default = function _default() {
|
|
|
13
14
|
iframe.width = '100%';
|
|
14
15
|
iframe.height = '100%';
|
|
15
16
|
iframe.frameBorder = '0';
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
// 使用唯一ID来避免缓存
|
|
19
|
+
var iframeId = 'xrender-iframe-' + Date.now();
|
|
20
|
+
iframe.id = iframeId;
|
|
21
|
+
iframe.name = iframeId;
|
|
22
|
+
|
|
23
|
+
// 添加防缓存参数
|
|
24
|
+
var htmlContent = createIframeContent();
|
|
25
|
+
var blob = new Blob([htmlContent], {
|
|
26
|
+
type: 'text/html'
|
|
27
|
+
});
|
|
28
|
+
var url = URL.createObjectURL(blob);
|
|
29
|
+
iframe.src = url;
|
|
30
|
+
|
|
31
|
+
// 清理URL对象
|
|
32
|
+
iframe.onload = function () {
|
|
33
|
+
setTimeout(function () {
|
|
34
|
+
return URL.revokeObjectURL(url);
|
|
35
|
+
}, 1000);
|
|
36
|
+
};
|
|
18
37
|
return iframe;
|
|
19
38
|
};
|