@zzdadelu/schema-builder 1.0.0-alpha.108 → 1.0.0-alpha.109
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/main.js +24 -47
- package/lib/main.js +24 -47
- package/package.json +1 -1
package/es/main.js
CHANGED
|
@@ -40,62 +40,39 @@ var Design = function Design(props, ref) {
|
|
|
40
40
|
containerRef.current.appendChild(iframe);
|
|
41
41
|
};
|
|
42
42
|
var engineOnLoad = function engineOnLoad(event) {
|
|
43
|
-
var _iframe3
|
|
43
|
+
var _iframe3;
|
|
44
44
|
if (event.data.type !== 'engine-load') {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// --- 解决方案开始 ---
|
|
49
49
|
var iframeWindow = (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow;
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
var iframeDoc = iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.document;
|
|
51
|
+
if (!iframeWindow || !iframeDoc) {
|
|
52
|
+
console.error('Iframe 窗口或文档引用丢失。');
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
var _checkAndInit = function checkAndInit() {
|
|
56
|
+
// 检查条件:文档状态和函数存在性
|
|
57
|
+
if ((iframeDoc.readyState === 'complete' || iframeDoc.readyState === 'interactive') && typeof iframeWindow.getFormRenderMaterial === 'function' // 确认无命名空间
|
|
58
|
+
) {
|
|
59
|
+
var _iframeWindow$__FR_EN;
|
|
60
|
+
// ✅ 环境就绪,执行引擎初始化
|
|
61
|
+
(_iframeWindow$__FR_EN = iframeWindow.__FR_ENGINE__) === null || _iframeWindow$__FR_EN === void 0 ? void 0 : _iframeWindow$__FR_EN.init(_objectSpread({
|
|
62
|
+
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
63
|
+
widgets: widgets,
|
|
64
|
+
// recordEnable: true,
|
|
65
|
+
logo: {
|
|
66
|
+
title: 'XRender'
|
|
67
|
+
}
|
|
68
|
+
}, restProps));
|
|
69
|
+
} else {
|
|
70
|
+
// ⌛ 继续等待
|
|
71
|
+
console.warn('XRender 依赖资源 getFormRenderMaterial 尚未加载完毕,文档状态:', iframeDoc.readyState, '正在重试...');
|
|
72
|
+
setTimeout(_checkAndInit, 50);
|
|
62
73
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
console.error('iframeWindow.FR', iframeWindow.__FR_ENGINE__);
|
|
66
|
-
console.error('iframeWindow.FR', iframeWindow.__ReactSimulatorRenderer__);
|
|
67
|
-
console.error('iframeWindow.FR', iframeWindow.__LowCodeEngineDemo__);
|
|
68
|
-
|
|
69
|
-
// 定义一个检查并初始化引擎的函数
|
|
70
|
-
// const checkAndInit = () => {
|
|
71
|
-
// // 检查关键依赖函数是否存在
|
|
72
|
-
// if (typeof iframeWindow?.__ReactSimulatorRenderer__?.getFormRenderMaterial === 'function') {
|
|
73
|
-
|
|
74
|
-
// // ✅ 环境就绪,执行引擎初始化
|
|
75
|
-
// iframeWindow.__FR_ENGINE__?.init({
|
|
76
|
-
// settings: {
|
|
77
|
-
// ...defaultSetting,
|
|
78
|
-
// ...settings
|
|
79
|
-
// },
|
|
80
|
-
// widgets,
|
|
81
|
-
// // recordEnable: true,
|
|
82
|
-
// logo: {
|
|
83
|
-
// title: 'XRender'
|
|
84
|
-
// },
|
|
85
|
-
// ...restProps
|
|
86
|
-
// });
|
|
87
|
-
|
|
88
|
-
// } else {
|
|
89
|
-
// // ⌛ 环境未就绪,可能是 fr-generator.js 还在加载/解析中,设置定时器重试
|
|
90
|
-
// console.warn('XRender 依赖资源 getFormRenderMaterial 尚未加载完毕,正在重试...');
|
|
91
|
-
// // 使用 setTimeout 进行非阻塞式轮询,避免阻塞 UI 线程
|
|
92
|
-
// setTimeout(checkAndInit, 50);
|
|
93
|
-
// }
|
|
94
|
-
// };
|
|
95
|
-
|
|
96
|
-
// 启动检查流程
|
|
97
|
-
// checkAndInit();
|
|
98
|
-
// --- 解决方案结束 ---
|
|
74
|
+
};
|
|
75
|
+
_checkAndInit();
|
|
99
76
|
};
|
|
100
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
101
78
|
ref: containerRef,
|
package/lib/main.js
CHANGED
|
@@ -48,62 +48,39 @@ var Design = function Design(props, ref) {
|
|
|
48
48
|
containerRef.current.appendChild(iframe);
|
|
49
49
|
};
|
|
50
50
|
var engineOnLoad = function engineOnLoad(event) {
|
|
51
|
-
var _iframe3
|
|
51
|
+
var _iframe3;
|
|
52
52
|
if (event.data.type !== 'engine-load') {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// --- 解决方案开始 ---
|
|
57
57
|
var iframeWindow = (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow;
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
var iframeDoc = iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.document;
|
|
59
|
+
if (!iframeWindow || !iframeDoc) {
|
|
60
|
+
console.error('Iframe 窗口或文档引用丢失。');
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
var _checkAndInit = function checkAndInit() {
|
|
64
|
+
// 检查条件:文档状态和函数存在性
|
|
65
|
+
if ((iframeDoc.readyState === 'complete' || iframeDoc.readyState === 'interactive') && typeof iframeWindow.getFormRenderMaterial === 'function' // 确认无命名空间
|
|
66
|
+
) {
|
|
67
|
+
var _iframeWindow$__FR_EN;
|
|
68
|
+
// ✅ 环境就绪,执行引擎初始化
|
|
69
|
+
(_iframeWindow$__FR_EN = iframeWindow.__FR_ENGINE__) === null || _iframeWindow$__FR_EN === void 0 ? void 0 : _iframeWindow$__FR_EN.init(_objectSpread({
|
|
70
|
+
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
71
|
+
widgets: widgets,
|
|
72
|
+
// recordEnable: true,
|
|
73
|
+
logo: {
|
|
74
|
+
title: 'XRender'
|
|
75
|
+
}
|
|
76
|
+
}, restProps));
|
|
77
|
+
} else {
|
|
78
|
+
// ⌛ 继续等待
|
|
79
|
+
console.warn('XRender 依赖资源 getFormRenderMaterial 尚未加载完毕,文档状态:', iframeDoc.readyState, '正在重试...');
|
|
80
|
+
setTimeout(_checkAndInit, 50);
|
|
70
81
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
console.error('iframeWindow.FR', iframeWindow.__FR_ENGINE__);
|
|
74
|
-
console.error('iframeWindow.FR', iframeWindow.__ReactSimulatorRenderer__);
|
|
75
|
-
console.error('iframeWindow.FR', iframeWindow.__LowCodeEngineDemo__);
|
|
76
|
-
|
|
77
|
-
// 定义一个检查并初始化引擎的函数
|
|
78
|
-
// const checkAndInit = () => {
|
|
79
|
-
// // 检查关键依赖函数是否存在
|
|
80
|
-
// if (typeof iframeWindow?.__ReactSimulatorRenderer__?.getFormRenderMaterial === 'function') {
|
|
81
|
-
|
|
82
|
-
// // ✅ 环境就绪,执行引擎初始化
|
|
83
|
-
// iframeWindow.__FR_ENGINE__?.init({
|
|
84
|
-
// settings: {
|
|
85
|
-
// ...defaultSetting,
|
|
86
|
-
// ...settings
|
|
87
|
-
// },
|
|
88
|
-
// widgets,
|
|
89
|
-
// // recordEnable: true,
|
|
90
|
-
// logo: {
|
|
91
|
-
// title: 'XRender'
|
|
92
|
-
// },
|
|
93
|
-
// ...restProps
|
|
94
|
-
// });
|
|
95
|
-
|
|
96
|
-
// } else {
|
|
97
|
-
// // ⌛ 环境未就绪,可能是 fr-generator.js 还在加载/解析中,设置定时器重试
|
|
98
|
-
// console.warn('XRender 依赖资源 getFormRenderMaterial 尚未加载完毕,正在重试...');
|
|
99
|
-
// // 使用 setTimeout 进行非阻塞式轮询,避免阻塞 UI 线程
|
|
100
|
-
// setTimeout(checkAndInit, 50);
|
|
101
|
-
// }
|
|
102
|
-
// };
|
|
103
|
-
|
|
104
|
-
// 启动检查流程
|
|
105
|
-
// checkAndInit();
|
|
106
|
-
// --- 解决方案结束 ---
|
|
82
|
+
};
|
|
83
|
+
_checkAndInit();
|
|
107
84
|
};
|
|
108
85
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
109
86
|
ref: containerRef,
|