@zzdadelu/schema-builder 1.0.0-alpha.107 → 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 +9 -14
- package/lib/main.js +9 -14
- package/package.json +1 -1
package/es/main.js
CHANGED
|
@@ -47,16 +47,15 @@ var Design = function Design(props, ref) {
|
|
|
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
55
|
var _checkAndInit = function checkAndInit() {
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
|
|
56
|
+
// 检查条件:文档状态和函数存在性
|
|
57
|
+
if ((iframeDoc.readyState === 'complete' || iframeDoc.readyState === 'interactive') && typeof iframeWindow.getFormRenderMaterial === 'function' // 确认无命名空间
|
|
58
|
+
) {
|
|
60
59
|
var _iframeWindow$__FR_EN;
|
|
61
60
|
// ✅ 环境就绪,执行引擎初始化
|
|
62
61
|
(_iframeWindow$__FR_EN = iframeWindow.__FR_ENGINE__) === null || _iframeWindow$__FR_EN === void 0 ? void 0 : _iframeWindow$__FR_EN.init(_objectSpread({
|
|
@@ -68,16 +67,12 @@ var Design = function Design(props, ref) {
|
|
|
68
67
|
}
|
|
69
68
|
}, restProps));
|
|
70
69
|
} else {
|
|
71
|
-
// ⌛
|
|
72
|
-
console.warn('XRender 依赖资源 getFormRenderMaterial
|
|
73
|
-
// 使用 setTimeout 进行非阻塞式轮询,避免阻塞 UI 线程
|
|
70
|
+
// ⌛ 继续等待
|
|
71
|
+
console.warn('XRender 依赖资源 getFormRenderMaterial 尚未加载完毕,文档状态:', iframeDoc.readyState, '正在重试...');
|
|
74
72
|
setTimeout(_checkAndInit, 50);
|
|
75
73
|
}
|
|
76
74
|
};
|
|
77
|
-
|
|
78
|
-
// 启动检查流程
|
|
79
|
-
// checkAndInit();
|
|
80
|
-
// --- 解决方案结束 ---
|
|
75
|
+
_checkAndInit();
|
|
81
76
|
};
|
|
82
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
83
78
|
ref: containerRef,
|
package/lib/main.js
CHANGED
|
@@ -55,16 +55,15 @@ var Design = function Design(props, ref) {
|
|
|
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
63
|
var _checkAndInit = function checkAndInit() {
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
|
|
64
|
+
// 检查条件:文档状态和函数存在性
|
|
65
|
+
if ((iframeDoc.readyState === 'complete' || iframeDoc.readyState === 'interactive') && typeof iframeWindow.getFormRenderMaterial === 'function' // 确认无命名空间
|
|
66
|
+
) {
|
|
68
67
|
var _iframeWindow$__FR_EN;
|
|
69
68
|
// ✅ 环境就绪,执行引擎初始化
|
|
70
69
|
(_iframeWindow$__FR_EN = iframeWindow.__FR_ENGINE__) === null || _iframeWindow$__FR_EN === void 0 ? void 0 : _iframeWindow$__FR_EN.init(_objectSpread({
|
|
@@ -76,16 +75,12 @@ var Design = function Design(props, ref) {
|
|
|
76
75
|
}
|
|
77
76
|
}, restProps));
|
|
78
77
|
} else {
|
|
79
|
-
// ⌛
|
|
80
|
-
console.warn('XRender 依赖资源 getFormRenderMaterial
|
|
81
|
-
// 使用 setTimeout 进行非阻塞式轮询,避免阻塞 UI 线程
|
|
78
|
+
// ⌛ 继续等待
|
|
79
|
+
console.warn('XRender 依赖资源 getFormRenderMaterial 尚未加载完毕,文档状态:', iframeDoc.readyState, '正在重试...');
|
|
82
80
|
setTimeout(_checkAndInit, 50);
|
|
83
81
|
}
|
|
84
82
|
};
|
|
85
|
-
|
|
86
|
-
// 启动检查流程
|
|
87
|
-
// checkAndInit();
|
|
88
|
-
// --- 解决方案结束 ---
|
|
83
|
+
_checkAndInit();
|
|
89
84
|
};
|
|
90
85
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
91
86
|
ref: containerRef,
|