@zzdadelu/schema-builder 1.0.0-alpha.102 → 1.0.0-alpha.104

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,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 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 ";
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 // \u8BBE\u7F6E\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 React.PropTypes = window.parent.PropTypes;\n window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n \n // \u9884\u5B9A\u4E49 getFormRenderMaterial \u51FD\u6570\n (function() {\n // \u5B58\u50A8\u5B9E\u9645\u7684\u7269\u6599\u6570\u636E\n window.__FR_MATERIAL_DATA__ = {};\n window.__FR_MATERIAL_FUNCTION = null;\n \n // \u5B9A\u4E49 getFormRenderMaterial \u51FD\u6570\n window.getFormRenderMaterial = function(name, packageName) {\n // \u5982\u679C\u5DF2\u7ECF\u8BBE\u7F6E\u4E86\u5B9E\u9645\u7684\u51FD\u6570\uFF0C\u5C31\u8C03\u7528\u5B83\n if (window.__FR_MATERIAL_FUNCTION) {\n return window.__FR_MATERIAL_FUNCTION(name, packageName);\n }\n \n // \u5426\u5219\u8FD4\u56DE\u4E00\u4E2A\u5DE5\u5382\u51FD\u6570\uFF0C\u8FD9\u4E2A\u5DE5\u5382\u51FD\u6570\u8FD4\u56DE\u5B9E\u9645\u7684\u7269\u6599\u6570\u636E\n return function() {\n // \u68C0\u67E5\u662F\u5426\u5DF2\u7ECF\u6709\u7269\u6599\u6570\u636E\n var materialKey = name + '_' + packageName;\n if (window.__FR_MATERIAL_DATA__[materialKey]) {\n return window.__FR_MATERIAL_DATA__[materialKey];\n }\n \n // \u8FD4\u56DE\u4E00\u4E2A\u7A7A\u5BF9\u8C61\uFF0C\u907F\u514D\u62A5\u9519\n console.warn('FormRender material not ready yet for:', name, packageName);\n return {};\n };\n };\n \n // \u63D0\u4F9B\u4E00\u4E2A\u65B9\u6CD5\u8BA9\u5916\u90E8\u8BBE\u7F6E\u7269\u6599\u6570\u636E\n window.__setFormRenderMaterial = function(data) {\n if (typeof data === 'function') {\n window.__FR_MATERIAL_FUNCTION = data;\n } else if (typeof data === 'object') {\n window.__FR_MATERIAL_DATA__ = Object.assign({}, window.__FR_MATERIAL_DATA__, data);\n }\n };\n \n // \u76D1\u542C\u6765\u81EA\u7236\u7A97\u53E3\u7684\u6D88\u606F\uFF0C\u8BBE\u7F6E\u7269\u6599\u6570\u636E\n window.addEventListener('message', function(event) {\n if (event.data && event.data.type === 'SET_FORM_RENDER_MATERIAL') {\n window.__setFormRenderMaterial(event.data.materialData);\n }\n });\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 </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
3
  return html;
4
4
  };
5
5
  export default (function () {
package/es/main.js CHANGED
@@ -11,6 +11,7 @@ import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react
11
11
  import createIframe from './createIframe';
12
12
  import * as defaultSetting from './settings';
13
13
  var iframe;
14
+ var materialData = null;
14
15
  var Design = function Design(props, ref) {
15
16
  var widgets = props.widgets,
16
17
  settings = props.settings,
@@ -37,17 +38,74 @@ var Design = function Design(props, ref) {
37
38
  }, []);
38
39
  var initIframe = function initIframe() {
39
40
  iframe = createIframe();
41
+
42
+ // 监听 iframe 加载完成
43
+ iframe.onload = function () {
44
+ // 立即设置 getFormRenderMaterial 函数,防止 create-simulator 调用时报错
45
+ if (iframe.contentWindow) {
46
+ // 创建一个临时的 getFormRenderMaterial 函数
47
+ iframe.contentWindow.getFormRenderMaterial = function (name, packageName) {
48
+ console.log('getFormRenderMaterial called with:', name, packageName);
49
+
50
+ // 返回一个工厂函数
51
+ return function () {
52
+ console.log('Material factory called for:', name, packageName);
53
+
54
+ // 检查是否有缓存的物料
55
+ if (materialData) {
56
+ return materialData;
57
+ }
58
+
59
+ // 返回一个模拟的物料,包含必要的属性
60
+ return {
61
+ __esModule: true,
62
+ // 添加一些默认的组件配置
63
+ components: {},
64
+ snippets: [],
65
+ componentList: []
66
+ };
67
+ };
68
+ };
69
+
70
+ // 发送物料数据到 iframe
71
+ if (widgets) {
72
+ materialData = widgets;
73
+ iframe.contentWindow.postMessage({
74
+ type: 'SET_FORM_RENDER_MATERIAL',
75
+ materialData: widgets
76
+ }, '*');
77
+ }
78
+ }
79
+ };
80
+ setTimeout(function () {
81
+ // 延迟设置物料
82
+ iframe.contentWindow.AliFormRenderMaterial = materialData;
83
+ }, 100);
40
84
  containerRef.current.appendChild(iframe);
41
85
  };
42
86
  var engineOnLoad = function engineOnLoad(event) {
43
- var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
87
+ var _iframe3, _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2;
44
88
  if (event.data.type !== 'engine-load') {
45
89
  return;
46
90
  }
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({
91
+
92
+ // 确保物料数据已经准备好
93
+ if (!materialData && widgets) {
94
+ materialData = widgets;
95
+ }
96
+
97
+ // 再次发送物料数据,确保 fr-generator 能够收到
98
+ if (((_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow) && materialData) {
99
+ iframe.contentWindow.postMessage({
100
+ type: 'SET_FORM_RENDER_MATERIAL',
101
+ materialData: materialData
102
+ }, '*');
103
+ }
104
+
105
+ // 初始化引擎
106
+ (_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({
48
107
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
49
- widgets: widgets,
50
- // recordEnable: true,
108
+ widgets: materialData || widgets,
51
109
  logo: {
52
110
  title: 'XRender'
53
111
  }
@@ -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 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 ";
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 // \u8BBE\u7F6E\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 React.PropTypes = window.parent.PropTypes;\n window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n \n // \u9884\u5B9A\u4E49 getFormRenderMaterial \u51FD\u6570\n (function() {\n // \u5B58\u50A8\u5B9E\u9645\u7684\u7269\u6599\u6570\u636E\n window.__FR_MATERIAL_DATA__ = {};\n window.__FR_MATERIAL_FUNCTION = null;\n \n // \u5B9A\u4E49 getFormRenderMaterial \u51FD\u6570\n window.getFormRenderMaterial = function(name, packageName) {\n // \u5982\u679C\u5DF2\u7ECF\u8BBE\u7F6E\u4E86\u5B9E\u9645\u7684\u51FD\u6570\uFF0C\u5C31\u8C03\u7528\u5B83\n if (window.__FR_MATERIAL_FUNCTION) {\n return window.__FR_MATERIAL_FUNCTION(name, packageName);\n }\n \n // \u5426\u5219\u8FD4\u56DE\u4E00\u4E2A\u5DE5\u5382\u51FD\u6570\uFF0C\u8FD9\u4E2A\u5DE5\u5382\u51FD\u6570\u8FD4\u56DE\u5B9E\u9645\u7684\u7269\u6599\u6570\u636E\n return function() {\n // \u68C0\u67E5\u662F\u5426\u5DF2\u7ECF\u6709\u7269\u6599\u6570\u636E\n var materialKey = name + '_' + packageName;\n if (window.__FR_MATERIAL_DATA__[materialKey]) {\n return window.__FR_MATERIAL_DATA__[materialKey];\n }\n \n // \u8FD4\u56DE\u4E00\u4E2A\u7A7A\u5BF9\u8C61\uFF0C\u907F\u514D\u62A5\u9519\n console.warn('FormRender material not ready yet for:', name, packageName);\n return {};\n };\n };\n \n // \u63D0\u4F9B\u4E00\u4E2A\u65B9\u6CD5\u8BA9\u5916\u90E8\u8BBE\u7F6E\u7269\u6599\u6570\u636E\n window.__setFormRenderMaterial = function(data) {\n if (typeof data === 'function') {\n window.__FR_MATERIAL_FUNCTION = data;\n } else if (typeof data === 'object') {\n window.__FR_MATERIAL_DATA__ = Object.assign({}, window.__FR_MATERIAL_DATA__, data);\n }\n };\n \n // \u76D1\u542C\u6765\u81EA\u7236\u7A97\u53E3\u7684\u6D88\u606F\uFF0C\u8BBE\u7F6E\u7269\u6599\u6570\u636E\n window.addEventListener('message', function(event) {\n if (event.data && event.data.type === 'SET_FORM_RENDER_MATERIAL') {\n window.__setFormRenderMaterial(event.data.materialData);\n }\n });\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 </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
9
  return html;
10
10
  };
11
11
  var _default = exports.default = function _default() {
package/lib/main.js CHANGED
@@ -19,6 +19,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
19
19
  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; }
20
20
  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; }
21
21
  var iframe;
22
+ var materialData = null;
22
23
  var Design = function Design(props, ref) {
23
24
  var widgets = props.widgets,
24
25
  settings = props.settings,
@@ -45,17 +46,74 @@ var Design = function Design(props, ref) {
45
46
  }, []);
46
47
  var initIframe = function initIframe() {
47
48
  iframe = (0, _createIframe.default)();
49
+
50
+ // 监听 iframe 加载完成
51
+ iframe.onload = function () {
52
+ // 立即设置 getFormRenderMaterial 函数,防止 create-simulator 调用时报错
53
+ if (iframe.contentWindow) {
54
+ // 创建一个临时的 getFormRenderMaterial 函数
55
+ iframe.contentWindow.getFormRenderMaterial = function (name, packageName) {
56
+ console.log('getFormRenderMaterial called with:', name, packageName);
57
+
58
+ // 返回一个工厂函数
59
+ return function () {
60
+ console.log('Material factory called for:', name, packageName);
61
+
62
+ // 检查是否有缓存的物料
63
+ if (materialData) {
64
+ return materialData;
65
+ }
66
+
67
+ // 返回一个模拟的物料,包含必要的属性
68
+ return {
69
+ __esModule: true,
70
+ // 添加一些默认的组件配置
71
+ components: {},
72
+ snippets: [],
73
+ componentList: []
74
+ };
75
+ };
76
+ };
77
+
78
+ // 发送物料数据到 iframe
79
+ if (widgets) {
80
+ materialData = widgets;
81
+ iframe.contentWindow.postMessage({
82
+ type: 'SET_FORM_RENDER_MATERIAL',
83
+ materialData: widgets
84
+ }, '*');
85
+ }
86
+ }
87
+ };
88
+ setTimeout(function () {
89
+ // 延迟设置物料
90
+ iframe.contentWindow.AliFormRenderMaterial = materialData;
91
+ }, 100);
48
92
  containerRef.current.appendChild(iframe);
49
93
  };
50
94
  var engineOnLoad = function engineOnLoad(event) {
51
- var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
95
+ var _iframe3, _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2;
52
96
  if (event.data.type !== 'engine-load') {
53
97
  return;
54
98
  }
55
- (_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({
99
+
100
+ // 确保物料数据已经准备好
101
+ if (!materialData && widgets) {
102
+ materialData = widgets;
103
+ }
104
+
105
+ // 再次发送物料数据,确保 fr-generator 能够收到
106
+ if (((_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow) && materialData) {
107
+ iframe.contentWindow.postMessage({
108
+ type: 'SET_FORM_RENDER_MATERIAL',
109
+ materialData: materialData
110
+ }, '*');
111
+ }
112
+
113
+ // 初始化引擎
114
+ (_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({
56
115
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
57
- widgets: widgets,
58
- // recordEnable: true,
116
+ widgets: materialData || widgets,
59
117
  logo: {
60
118
  title: 'XRender'
61
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzdadelu/schema-builder",
3
- "version": "1.0.0-alpha.102",
3
+ "version": "1.0.0-alpha.104",
4
4
  "description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
5
5
  "keywords": [
6
6
  "Form",