@zzdadelu/schema-builder 1.0.0-alpha.122 → 1.0.0-alpha.124
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
|
@@ -15,18 +15,16 @@ var Design = function Design(props, ref) {
|
|
|
15
15
|
var widgets = props.widgets,
|
|
16
16
|
settings = props.settings,
|
|
17
17
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
18
|
-
var containerRef = useRef(
|
|
19
|
-
var iframeRef = useRef(null); // 使用 ref 代替全局变量
|
|
20
|
-
|
|
18
|
+
var containerRef = useRef();
|
|
21
19
|
useImperativeHandle(ref, function () {
|
|
22
20
|
return {
|
|
23
21
|
getValue: function getValue() {
|
|
24
|
-
var
|
|
25
|
-
return (
|
|
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);
|
|
26
24
|
},
|
|
27
25
|
setValue: function setValue(schema) {
|
|
28
|
-
var
|
|
29
|
-
return (
|
|
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);
|
|
30
28
|
}
|
|
31
29
|
};
|
|
32
30
|
});
|
|
@@ -38,18 +36,15 @@ var Design = function Design(props, ref) {
|
|
|
38
36
|
};
|
|
39
37
|
}, []);
|
|
40
38
|
var initIframe = function initIframe() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
iframeRef.current = newIframe; // 存入 ref
|
|
44
|
-
containerRef.current.innerHTML = ''; // 清空容器防止多次刷新重复注入
|
|
45
|
-
containerRef.current.appendChild(newIframe);
|
|
39
|
+
iframe = createIframe();
|
|
40
|
+
containerRef.current.appendChild(iframe);
|
|
46
41
|
};
|
|
47
42
|
var engineOnLoad = function engineOnLoad(event) {
|
|
48
|
-
var
|
|
43
|
+
var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
|
|
49
44
|
if (event.data.type !== 'engine-load') {
|
|
50
45
|
return;
|
|
51
46
|
}
|
|
52
|
-
iframe === null ||
|
|
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({
|
|
53
48
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
54
49
|
widgets: widgets,
|
|
55
50
|
// recordEnable: true,
|
package/lib/main.js
CHANGED
|
@@ -23,18 +23,16 @@ var Design = function Design(props, ref) {
|
|
|
23
23
|
var widgets = props.widgets,
|
|
24
24
|
settings = props.settings,
|
|
25
25
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
26
|
-
var containerRef = (0, _react.useRef)(
|
|
27
|
-
var iframeRef = (0, _react.useRef)(null); // 使用 ref 代替全局变量
|
|
28
|
-
|
|
26
|
+
var containerRef = (0, _react.useRef)();
|
|
29
27
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
30
28
|
return {
|
|
31
29
|
getValue: function getValue() {
|
|
32
|
-
var
|
|
33
|
-
return (
|
|
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);
|
|
34
32
|
},
|
|
35
33
|
setValue: function setValue(schema) {
|
|
36
|
-
var
|
|
37
|
-
return (
|
|
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);
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
38
|
});
|
|
@@ -46,18 +44,15 @@ var Design = function Design(props, ref) {
|
|
|
46
44
|
};
|
|
47
45
|
}, []);
|
|
48
46
|
var initIframe = function initIframe() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
iframeRef.current = newIframe; // 存入 ref
|
|
52
|
-
containerRef.current.innerHTML = ''; // 清空容器防止多次刷新重复注入
|
|
53
|
-
containerRef.current.appendChild(newIframe);
|
|
47
|
+
iframe = (0, _createIframe.default)();
|
|
48
|
+
containerRef.current.appendChild(iframe);
|
|
54
49
|
};
|
|
55
50
|
var engineOnLoad = function engineOnLoad(event) {
|
|
56
|
-
var
|
|
51
|
+
var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
|
|
57
52
|
if (event.data.type !== 'engine-load') {
|
|
58
53
|
return;
|
|
59
54
|
}
|
|
60
|
-
iframe === null ||
|
|
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({
|
|
61
56
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
62
57
|
widgets: widgets,
|
|
63
58
|
// recordEnable: true,
|