@zzdadelu/schema-builder 1.0.0-alpha.18 → 1.0.0-alpha.19
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/createIframe.js +3 -1
- package/es/main.js +16 -12
- package/lib/createIframe.js +3 -1
- package/lib/main.js +15 -11
- package/package.json +1 -1
package/es/createIframe.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
var createIframeContent = function createIframeContent() {
|
|
2
|
-
|
|
2
|
+
// 生成时间戳作为 cache-bust 参数
|
|
3
|
+
var timestamp = Math.floor(Date.now() / 1000);
|
|
4
|
+
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?t=".concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js?t=").concat(timestamp, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js?t=").concat(timestamp, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js?t=").concat(timestamp, "\"></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(timestamp, "\"></script>\n </body>\n </html>\n ");
|
|
3
5
|
return html;
|
|
4
6
|
};
|
|
5
7
|
export default (function () {
|
package/es/main.js
CHANGED
|
@@ -7,7 +7,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
|
-
import React, { useEffect, useRef, useImperativeHandle, forwardRef
|
|
10
|
+
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;
|
|
@@ -30,29 +30,33 @@ var Design = function Design(props, ref) {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
initIframe();
|
|
35
|
+
window.addEventListener('message', engineOnLoad);
|
|
36
|
+
return function () {
|
|
37
|
+
window.removeEventListener('message', engineOnLoad);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
33
40
|
var initIframe = function initIframe() {
|
|
34
41
|
console.log("开始创建 iframe");
|
|
35
42
|
iframe = createIframe();
|
|
36
43
|
containerRef.current.appendChild(iframe);
|
|
37
44
|
};
|
|
38
|
-
var engineOnLoad =
|
|
39
|
-
var
|
|
40
|
-
if (
|
|
45
|
+
var engineOnLoad = function engineOnLoad(event) {
|
|
46
|
+
var _iframe5, _iframe5$contentWindo, _iframe5$contentWindo2;
|
|
47
|
+
if (event.data.type !== 'engine-load') {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
console.log("拿到 iframe props:", event);
|
|
41
51
|
(_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({
|
|
42
52
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
43
53
|
widgets: widgets,
|
|
54
|
+
// recordEnable: true,
|
|
44
55
|
logo: {
|
|
45
56
|
title: 'XRender'
|
|
46
57
|
}
|
|
47
58
|
}, restProps));
|
|
48
|
-
}
|
|
49
|
-
useEffect(function () {
|
|
50
|
-
window.addEventListener('message', engineOnLoad);
|
|
51
|
-
initIframe();
|
|
52
|
-
return function () {
|
|
53
|
-
window.removeEventListener('message', engineOnLoad);
|
|
54
|
-
};
|
|
55
|
-
}, [engineOnLoad]);
|
|
59
|
+
};
|
|
56
60
|
return /*#__PURE__*/React.createElement("div", {
|
|
57
61
|
ref: containerRef,
|
|
58
62
|
style: {
|
package/lib/createIframe.js
CHANGED
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var createIframeContent = function createIframeContent() {
|
|
8
|
-
|
|
8
|
+
// 生成时间戳作为 cache-bust 参数
|
|
9
|
+
var timestamp = Math.floor(Date.now() / 1000);
|
|
10
|
+
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?t=".concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js?t=").concat(timestamp, "\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js?t=").concat(timestamp, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js?t=").concat(timestamp, "\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js?t=").concat(timestamp, "\"></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(timestamp, "\"></script>\n </body>\n </html>\n ");
|
|
9
11
|
return html;
|
|
10
12
|
};
|
|
11
13
|
var _default = exports.default = function _default() {
|
package/lib/main.js
CHANGED
|
@@ -38,29 +38,33 @@ var Design = function Design(props, ref) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
|
+
(0, _react.useEffect)(function () {
|
|
42
|
+
initIframe();
|
|
43
|
+
window.addEventListener('message', engineOnLoad);
|
|
44
|
+
return function () {
|
|
45
|
+
window.removeEventListener('message', engineOnLoad);
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
41
48
|
var initIframe = function initIframe() {
|
|
42
49
|
console.log("开始创建 iframe");
|
|
43
50
|
iframe = (0, _createIframe.default)();
|
|
44
51
|
containerRef.current.appendChild(iframe);
|
|
45
52
|
};
|
|
46
|
-
var engineOnLoad =
|
|
47
|
-
var
|
|
48
|
-
if (
|
|
53
|
+
var engineOnLoad = function engineOnLoad(event) {
|
|
54
|
+
var _iframe5, _iframe5$contentWindo, _iframe5$contentWindo2;
|
|
55
|
+
if (event.data.type !== 'engine-load') {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
console.log("拿到 iframe props:", event);
|
|
49
59
|
(_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({
|
|
50
60
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
51
61
|
widgets: widgets,
|
|
62
|
+
// recordEnable: true,
|
|
52
63
|
logo: {
|
|
53
64
|
title: 'XRender'
|
|
54
65
|
}
|
|
55
66
|
}, restProps));
|
|
56
|
-
}
|
|
57
|
-
(0, _react.useEffect)(function () {
|
|
58
|
-
window.addEventListener('message', engineOnLoad);
|
|
59
|
-
initIframe();
|
|
60
|
-
return function () {
|
|
61
|
-
window.removeEventListener('message', engineOnLoad);
|
|
62
|
-
};
|
|
63
|
-
}, [engineOnLoad]);
|
|
67
|
+
};
|
|
64
68
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
65
69
|
ref: containerRef,
|
|
66
70
|
style: {
|