@zzdadelu/schema-builder 1.0.0-alpha.14 → 1.0.0-alpha.16
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 -3
- package/es/main.js +1 -2
- package/lib/createIframe.js +2 -3
- package/lib/main.js +1 -2
- package/package.json +1 -1
package/es/createIframe.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
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
|
|
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 // \u5171\u4EAB\u7236\u7A97\u53E3\u7684 React/ReactDOM\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n\n // \u53EF\u63A7\u987A\u5E8F\u52A0\u8F7D\u811A\u672C\uFF08\u907F\u514D\u91CD\u590D\u52A0\u8F7D\u5E93\uFF09\n function loadScriptsSequential(urls, cb) {\n var i = 0;\n function next() {\n if (i >= urls.length) { cb && cb(); return; }\n var url = urls[i++];\n // \u68C0\u6D4B\u5E93\u662F\u5426\u5DF2\u5B58\u5728\uFF0C\u907F\u514D\u91CD\u590D\u52A0\u8F7D\n try {\n if (url.indexOf('engine-core') !== -1 && window.AliLowCodeEngine) return next();\n if (url.indexOf('engine-ext') !== -1 && window.AliLowCodeEngineExt) return next();\n if (url.indexOf('fr-generator') !== -1 && window.__FR_GENERATOR_LOADED__) return next();\n } catch (e) {}\n var s = document.createElement('script');\n s.src = url;\n s.crossOrigin = 'anonymous';\n s.onload = next;\n s.onerror = function() { next(); };\n document.head.appendChild(s);\n }\n next();\n }\n\n // \u4F7F\u7528 defineProperty \u4E3A getFormRenderMaterial \u521B\u5EFA\u5B89\u5168\u4EE3\u7406\n (function installGetFormRenderMaterialProxy() {\n if (window.__getFormRenderMaterial_installed) return;\n window.__getFormRenderMaterial_installed = true;\n window.__getFormRenderMaterial_queue = [];\n\n Object.defineProperty(window, 'getFormRenderMaterial', {\n configurable: true,\n enumerable: true,\n get: function() {\n if (window.__real_getFormRenderMaterial) return window.__real_getFormRenderMaterial;\n // \u8FD4\u56DE\u4E34\u65F6\u51FD\u6570\uFF0C\u628A\u8C03\u7528\u53C2\u6570\u5165\u961F\n return function() {\n window.__getFormRenderMaterial_queue.push(Array.prototype.slice.call(arguments));\n };\n },\n set: function(val) {\n // \u53EA\u6709\u51FD\u6570\u624D\u89C6\u4E3A\u771F\u5B9E\u5B9E\u73B0\n if (typeof val === 'function') {\n window.__real_getFormRenderMaterial = val;\n // \u91CD\u653E\u961F\u5217\u4E2D\u7684\u8C03\u7528\n var q = window.__getFormRenderMaterial_queue.splice(0);\n q.forEach(function(args) {\n try { window.__real_getFormRenderMaterial.apply(null, args); } catch (e) {}\n });\n // \u4E3A\u6027\u80FD\u4F18\u5316\uFF0C\u76F4\u63A5\u5B9A\u4E49\u4E3A\u771F\u5B9E\u51FD\u6570\n try {\n Object.defineProperty(window, 'getFormRenderMaterial', {\n value: window.__real_getFormRenderMaterial,\n writable: true,\n configurable: true\n });\n } catch (e) {}\n } else {\n console.warn('Ignored non-function assignment to window.getFormRenderMaterial:', val);\n }\n }\n });\n\n // \u5C1D\u8BD5\u4EE3\u7406\u7236\u7A97\u53E3\u5B9E\u73B0\uFF08\u540C\u6E90\u60C5\u51B5\uFF09\n try {\n setTimeout(function tryProxyParent() {\n try {\n if (window.parent && window.parent !== window && typeof window.parent.getFormRenderMaterial === 'function') {\n window.getFormRenderMaterial = function() {\n return window.parent.getFormRenderMaterial.apply(window.parent, arguments);\n };\n }\n } catch (e) {}\n }, 0);\n } catch (e) {}\n })();\n </script>\n </head>\n <body>\n <div id=\"lce-container\"></div>\n\n <script>\n // \u6309\u987A\u5E8F\u52A0\u8F7D\u4F9D\u8D56\uFF0C\u7136\u540E\u52A0\u8F7D fr-generator\uFF0C\u6700\u540E\u901A\u77E5\u7236\u7A97\u53E3\n loadScriptsSequential([\n \"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js\",\n \"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js\",\n \"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js\",\n \"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js\",\n \"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js\",\n \"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js\",\n \"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js\"\n ], function() {\n var s = document.createElement('script');\n s.type = 'text/javascript';\n s.src = 'https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/js/index.js';\n s.onload = function() {\n try {\n window.__FR_GENERATOR_LOADED__ = true;\n parent.postMessage({ type: 'engine-load' }, '*');\n } catch (e) {}\n };\n s.onerror = function() {\n try { parent.postMessage({ type: 'engine-load' }, '*'); } catch (e) {}\n };\n document.body.appendChild(s);\n });\n </script>\n </body>\n </html>\n ";
|
|
3
3
|
return html;
|
|
4
4
|
};
|
|
5
5
|
export default (function () {
|
|
@@ -7,7 +7,6 @@ export default (function () {
|
|
|
7
7
|
iframe.width = '100%';
|
|
8
8
|
iframe.height = '100%';
|
|
9
9
|
iframe.frameBorder = '0';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
iframe.srcdoc = createIframeContent();
|
|
12
11
|
return iframe;
|
|
13
12
|
});
|
package/es/main.js
CHANGED
|
@@ -31,8 +31,8 @@ var Design = function Design(props, ref) {
|
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
33
|
useEffect(function () {
|
|
34
|
-
initIframe();
|
|
35
34
|
window.addEventListener('message', engineOnLoad);
|
|
35
|
+
initIframe();
|
|
36
36
|
return function () {
|
|
37
37
|
window.removeEventListener('message', engineOnLoad);
|
|
38
38
|
};
|
|
@@ -48,7 +48,6 @@ var Design = function Design(props, ref) {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
console.log("拿到 iframe props:", event);
|
|
51
|
-
console.log("拿到 iframe props:", event);
|
|
52
51
|
(_iframe5 = iframe) === null || _iframe5 === void 0 ? void 0 : (_iframe5$contentWindo = _iframe5.contentWindow) === null || _iframe5$contentWindo === void 0 ? void 0 : (_iframe5$contentWindo2 = _iframe5$contentWindo.__FR_ENGINE__) === null || _iframe5$contentWindo2 === void 0 ? void 0 : _iframe5$contentWindo2.init(_objectSpread({
|
|
53
52
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
54
53
|
widgets: widgets,
|
package/lib/createIframe.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
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
|
|
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 // \u5171\u4EAB\u7236\u7A97\u53E3\u7684 React/ReactDOM\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n\n // \u53EF\u63A7\u987A\u5E8F\u52A0\u8F7D\u811A\u672C\uFF08\u907F\u514D\u91CD\u590D\u52A0\u8F7D\u5E93\uFF09\n function loadScriptsSequential(urls, cb) {\n var i = 0;\n function next() {\n if (i >= urls.length) { cb && cb(); return; }\n var url = urls[i++];\n // \u68C0\u6D4B\u5E93\u662F\u5426\u5DF2\u5B58\u5728\uFF0C\u907F\u514D\u91CD\u590D\u52A0\u8F7D\n try {\n if (url.indexOf('engine-core') !== -1 && window.AliLowCodeEngine) return next();\n if (url.indexOf('engine-ext') !== -1 && window.AliLowCodeEngineExt) return next();\n if (url.indexOf('fr-generator') !== -1 && window.__FR_GENERATOR_LOADED__) return next();\n } catch (e) {}\n var s = document.createElement('script');\n s.src = url;\n s.crossOrigin = 'anonymous';\n s.onload = next;\n s.onerror = function() { next(); };\n document.head.appendChild(s);\n }\n next();\n }\n\n // \u4F7F\u7528 defineProperty \u4E3A getFormRenderMaterial \u521B\u5EFA\u5B89\u5168\u4EE3\u7406\n (function installGetFormRenderMaterialProxy() {\n if (window.__getFormRenderMaterial_installed) return;\n window.__getFormRenderMaterial_installed = true;\n window.__getFormRenderMaterial_queue = [];\n\n Object.defineProperty(window, 'getFormRenderMaterial', {\n configurable: true,\n enumerable: true,\n get: function() {\n if (window.__real_getFormRenderMaterial) return window.__real_getFormRenderMaterial;\n // \u8FD4\u56DE\u4E34\u65F6\u51FD\u6570\uFF0C\u628A\u8C03\u7528\u53C2\u6570\u5165\u961F\n return function() {\n window.__getFormRenderMaterial_queue.push(Array.prototype.slice.call(arguments));\n };\n },\n set: function(val) {\n // \u53EA\u6709\u51FD\u6570\u624D\u89C6\u4E3A\u771F\u5B9E\u5B9E\u73B0\n if (typeof val === 'function') {\n window.__real_getFormRenderMaterial = val;\n // \u91CD\u653E\u961F\u5217\u4E2D\u7684\u8C03\u7528\n var q = window.__getFormRenderMaterial_queue.splice(0);\n q.forEach(function(args) {\n try { window.__real_getFormRenderMaterial.apply(null, args); } catch (e) {}\n });\n // \u4E3A\u6027\u80FD\u4F18\u5316\uFF0C\u76F4\u63A5\u5B9A\u4E49\u4E3A\u771F\u5B9E\u51FD\u6570\n try {\n Object.defineProperty(window, 'getFormRenderMaterial', {\n value: window.__real_getFormRenderMaterial,\n writable: true,\n configurable: true\n });\n } catch (e) {}\n } else {\n console.warn('Ignored non-function assignment to window.getFormRenderMaterial:', val);\n }\n }\n });\n\n // \u5C1D\u8BD5\u4EE3\u7406\u7236\u7A97\u53E3\u5B9E\u73B0\uFF08\u540C\u6E90\u60C5\u51B5\uFF09\n try {\n setTimeout(function tryProxyParent() {\n try {\n if (window.parent && window.parent !== window && typeof window.parent.getFormRenderMaterial === 'function') {\n window.getFormRenderMaterial = function() {\n return window.parent.getFormRenderMaterial.apply(window.parent, arguments);\n };\n }\n } catch (e) {}\n }, 0);\n } catch (e) {}\n })();\n </script>\n </head>\n <body>\n <div id=\"lce-container\"></div>\n\n <script>\n // \u6309\u987A\u5E8F\u52A0\u8F7D\u4F9D\u8D56\uFF0C\u7136\u540E\u52A0\u8F7D fr-generator\uFF0C\u6700\u540E\u901A\u77E5\u7236\u7A97\u53E3\n loadScriptsSequential([\n \"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js\",\n \"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js\",\n \"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js\",\n \"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js\",\n \"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js\",\n \"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js\",\n \"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js\"\n ], function() {\n var s = document.createElement('script');\n s.type = 'text/javascript';\n s.src = 'https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/js/index.js';\n s.onload = function() {\n try {\n window.__FR_GENERATOR_LOADED__ = true;\n parent.postMessage({ type: 'engine-load' }, '*');\n } catch (e) {}\n };\n s.onerror = function() {\n try { parent.postMessage({ type: 'engine-load' }, '*'); } catch (e) {}\n };\n document.body.appendChild(s);\n });\n </script>\n </body>\n </html>\n ";
|
|
9
9
|
return html;
|
|
10
10
|
};
|
|
11
11
|
var _default = exports.default = function _default() {
|
|
@@ -13,7 +13,6 @@ var _default = exports.default = function _default() {
|
|
|
13
13
|
iframe.width = '100%';
|
|
14
14
|
iframe.height = '100%';
|
|
15
15
|
iframe.frameBorder = '0';
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
iframe.srcdoc = createIframeContent();
|
|
18
17
|
return iframe;
|
|
19
18
|
};
|
package/lib/main.js
CHANGED
|
@@ -39,8 +39,8 @@ var Design = function Design(props, ref) {
|
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
41
|
(0, _react.useEffect)(function () {
|
|
42
|
-
initIframe();
|
|
43
42
|
window.addEventListener('message', engineOnLoad);
|
|
43
|
+
initIframe();
|
|
44
44
|
return function () {
|
|
45
45
|
window.removeEventListener('message', engineOnLoad);
|
|
46
46
|
};
|
|
@@ -56,7 +56,6 @@ var Design = function Design(props, ref) {
|
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
console.log("拿到 iframe props:", event);
|
|
59
|
-
console.log("拿到 iframe props:", event);
|
|
60
59
|
(_iframe5 = iframe) === null || _iframe5 === void 0 ? void 0 : (_iframe5$contentWindo = _iframe5.contentWindow) === null || _iframe5$contentWindo === void 0 ? void 0 : (_iframe5$contentWindo2 = _iframe5$contentWindo.__FR_ENGINE__) === null || _iframe5$contentWindo2 === void 0 ? void 0 : _iframe5$contentWindo2.init(_objectSpread({
|
|
61
60
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
62
61
|
widgets: widgets,
|