@zzdadelu/schema-builder 1.0.0-alpha.4 → 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.
@@ -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 </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
+ 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,6 +8,25 @@ export default (function () {
7
8
  iframe.width = '100%';
8
9
  iframe.height = '100%';
9
10
  iframe.frameBorder = '0';
10
- iframe.srcdoc = createIframeContent();
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
+ };
11
31
  return iframe;
12
32
  });
package/es/main.js CHANGED
@@ -19,16 +19,14 @@ var Design = function Design(props, ref) {
19
19
  useImperativeHandle(ref, function () {
20
20
  return {
21
21
  getValue: function getValue() {
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);
22
+ var _iframe, _iframe2, _iframe2$contentWindo, _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2, _iframe3$contentWindo3;
23
+ console.log("contentWindow", (_iframe = iframe) === null || _iframe === void 0 ? void 0 : _iframe.contentWindow);
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);
24
26
  },
25
27
  setValue: function setValue(schema) {
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);
28
- },
29
- copyValue: function copyValue() {
30
- var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2, _iframe3$contentWindo3;
31
- 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.copyToClipboard) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2);
28
+ var _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2, _iframe4$contentWindo3;
29
+ return (_iframe4 = iframe) === null || _iframe4 === void 0 ? void 0 : (_iframe4$contentWindo = _iframe4.contentWindow) === null || _iframe4$contentWindo === void 0 ? void 0 : (_iframe4$contentWindo2 = _iframe4$contentWindo.__FR_ENGINE__) === null || _iframe4$contentWindo2 === void 0 ? void 0 : (_iframe4$contentWindo3 = _iframe4$contentWindo2.importSchema) === null || _iframe4$contentWindo3 === void 0 ? void 0 : _iframe4$contentWindo3.call(_iframe4$contentWindo2, schema);
32
30
  }
33
31
  };
34
32
  });
@@ -40,15 +38,18 @@ var Design = function Design(props, ref) {
40
38
  };
41
39
  }, []);
42
40
  var initIframe = function initIframe() {
41
+ console.log("开始创建 iframe");
43
42
  iframe = createIframe();
44
43
  containerRef.current.appendChild(iframe);
44
+ console.log("iframe 创建完成:", containerRef, iframe);
45
45
  };
46
46
  var engineOnLoad = function engineOnLoad(event) {
47
- var _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2;
47
+ var _iframe5, _iframe5$contentWindo, _iframe5$contentWindo2;
48
48
  if (event.data.type !== 'engine-load') {
49
49
  return;
50
50
  }
51
- (_iframe4 = iframe) === null || _iframe4 === void 0 ? void 0 : (_iframe4$contentWindo = _iframe4.contentWindow) === null || _iframe4$contentWindo === void 0 ? void 0 : (_iframe4$contentWindo2 = _iframe4$contentWindo.__FR_ENGINE__) === null || _iframe4$contentWindo2 === void 0 ? void 0 : _iframe4$contentWindo2.init(_objectSpread({
51
+ console.log("拿到 iframe props:", event);
52
+ (_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({
52
53
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
53
54
  widgets: widgets,
54
55
  // recordEnable: true,
@@ -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 </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
+ 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,6 +14,25 @@ var _default = exports.default = function _default() {
13
14
  iframe.width = '100%';
14
15
  iframe.height = '100%';
15
16
  iframe.frameBorder = '0';
16
- iframe.srcdoc = createIframeContent();
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
+ };
17
37
  return iframe;
18
38
  };
package/lib/main.js CHANGED
@@ -27,16 +27,14 @@ var Design = function Design(props, ref) {
27
27
  (0, _react.useImperativeHandle)(ref, function () {
28
28
  return {
29
29
  getValue: function getValue() {
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);
30
+ var _iframe, _iframe2, _iframe2$contentWindo, _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2, _iframe3$contentWindo3;
31
+ console.log("contentWindow", (_iframe = iframe) === null || _iframe === void 0 ? void 0 : _iframe.contentWindow);
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);
32
34
  },
33
35
  setValue: function setValue(schema) {
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);
36
- },
37
- copyValue: function copyValue() {
38
- var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2, _iframe3$contentWindo3;
39
- 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.copyToClipboard) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2);
36
+ var _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2, _iframe4$contentWindo3;
37
+ return (_iframe4 = iframe) === null || _iframe4 === void 0 ? void 0 : (_iframe4$contentWindo = _iframe4.contentWindow) === null || _iframe4$contentWindo === void 0 ? void 0 : (_iframe4$contentWindo2 = _iframe4$contentWindo.__FR_ENGINE__) === null || _iframe4$contentWindo2 === void 0 ? void 0 : (_iframe4$contentWindo3 = _iframe4$contentWindo2.importSchema) === null || _iframe4$contentWindo3 === void 0 ? void 0 : _iframe4$contentWindo3.call(_iframe4$contentWindo2, schema);
40
38
  }
41
39
  };
42
40
  });
@@ -48,15 +46,18 @@ var Design = function Design(props, ref) {
48
46
  };
49
47
  }, []);
50
48
  var initIframe = function initIframe() {
49
+ console.log("开始创建 iframe");
51
50
  iframe = (0, _createIframe.default)();
52
51
  containerRef.current.appendChild(iframe);
52
+ console.log("iframe 创建完成:", containerRef, iframe);
53
53
  };
54
54
  var engineOnLoad = function engineOnLoad(event) {
55
- var _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2;
55
+ var _iframe5, _iframe5$contentWindo, _iframe5$contentWindo2;
56
56
  if (event.data.type !== 'engine-load') {
57
57
  return;
58
58
  }
59
- (_iframe4 = iframe) === null || _iframe4 === void 0 ? void 0 : (_iframe4$contentWindo = _iframe4.contentWindow) === null || _iframe4$contentWindo === void 0 ? void 0 : (_iframe4$contentWindo2 = _iframe4$contentWindo.__FR_ENGINE__) === null || _iframe4$contentWindo2 === void 0 ? void 0 : _iframe4$contentWindo2.init(_objectSpread({
59
+ console.log("拿到 iframe props:", event);
60
+ (_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({
60
61
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
61
62
  widgets: widgets,
62
63
  // recordEnable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzdadelu/schema-builder",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.40",
4
4
  "description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
5
5
  "keywords": [
6
6
  "Form",