@zzdadelu/schema-builder 1.0.0-alpha.8 → 1.0.0-alpha.81

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 \n // \u7B49\u5F85\u5F15\u64CE\u52A0\u8F7D\u5B8C\u6210\u540E\u4FEE\u6539\u6309\u94AE\u6587\u5B57\n function waitForEngineAndModifyButton() {\n // \u68C0\u67E5\u5F15\u64CE\u662F\u5426\u52A0\u8F7D\u5B8C\u6210\n if (window.__FR_ENGINE__) {\n modifyExportButtonText();\n } else {\n // \u5982\u679C\u5F15\u64CE\u8FD8\u6CA1\u52A0\u8F7D\uFF0C\u7B49\u5F85\u4E00\u6BB5\u65F6\u95F4\u540E\u91CD\u8BD5\n setTimeout(waitForEngineAndModifyButton, 100);\n }\n }\n \n // \u4FEE\u6539\u5BFC\u51FA\u6309\u94AE\u6587\u5B57\u7684\u51FD\u6570\n function modifyExportButtonText() {\n // \u5C1D\u8BD5\u591A\u79CD\u65B9\u5F0F\u67E5\u627E\u5BFC\u51FA\u6309\u94AE\n const selectors = [\n '.export-btn',\n '.export-button', \n '.fr-generator-export-btn',\n '.fr-generator-export-button',\n '[data-testid*=\"export\"]',\n '[data-testid*=\"exportBtn\"]',\n '.ant-btn[title*=\"\u5BFC\u51FA\"]',\n '.ant-btn[aria-label*=\"\u5BFC\u51FA\"]',\n 'button:contains(\"\u5BFC\u51FA\")',\n 'span:contains(\"\u5BFC\u51FA\")'\n ];\n \n let exportButton = null;\n \n // \u67E5\u627E\u6309\u94AE\n for (const selector of selectors) {\n try {\n if (selector.includes(':contains')) {\n // \u5904\u7406 :contains \u9009\u62E9\u5668\n const text = selector.match(/:contains(\"([^\"]+)\")/)[1];\n const elements = Array.from(document.querySelectorAll('*')).filter(el => \n el.textContent && el.textContent.includes(text)\n );\n if (elements.length > 0) {\n exportButton = elements[0];\n break;\n }\n } else {\n exportButton = document.querySelector(selector);\n if (exportButton) break;\n }\n } catch (e) {\n // \u5FFD\u7565\u9009\u62E9\u5668\u9519\u8BEF\n }\n }\n \n // \u5982\u679C\u627E\u5230\u4E86\u6309\u94AE\uFF0C\u4FEE\u6539\u6587\u5B57\n if (exportButton) {\n // \u65B9\u6CD51\uFF1A\u76F4\u63A5\u4FEE\u6539 textContent\n if (exportButton.textContent) {\n exportButton.textContent = exportButton.textContent.replace(/\u5BFC\u51FA/g, '\u4FDD\u5B58');\n }\n \n // \u65B9\u6CD52\uFF1A\u4FEE\u6539\u5B50\u5143\u7D20\u7684\u6587\u5B57\n const textElements = exportButton.querySelectorAll('span, div, label');\n textElements.forEach(el => {\n if (el.textContent && el.textContent.includes('\u5BFC\u51FA')) {\n el.textContent = el.textContent.replace(/\u5BFC\u51FA/g, '\u4FDD\u5B58');\n }\n });\n \n // \u65B9\u6CD53\uFF1A\u4FEE\u6539 title \u548C aria-label \u5C5E\u6027\n if (exportButton.title) {\n exportButton.title = exportButton.title.replace(/\u5BFC\u51FA/g, '\u4FDD\u5B58');\n }\n if (exportButton.getAttribute('aria-label')) {\n exportButton.setAttribute('aria-label', \n exportButton.getAttribute('aria-label').replace(/\u5BFC\u51FA/g, '\u4FDD\u5B58')\n );\n }\n \n console.log('\u6210\u529F\u5C06\u5BFC\u51FA\u6309\u94AE\u6587\u5B57\u6539\u4E3A\"\u4FDD\u5B58\"');\n } else {\n console.log('\u672A\u627E\u5230\u5BFC\u51FA\u6309\u94AE\uFF0C\u53EF\u80FD\u9009\u62E9\u5668\u4E0D\u6B63\u786E');\n }\n }\n \n // \u76D1\u542C\u5F15\u64CE\u52A0\u8F7D\u5B8C\u6210\u4E8B\u4EF6\n window.addEventListener('message', function(event) {\n if (event.data.type === 'engine-load') {\n // \u5F15\u64CE\u52A0\u8F7D\u5B8C\u6210\u540E\uFF0C\u7B49\u5F85\u4E00\u6BB5\u65F6\u95F4\u518D\u4FEE\u6539\u6309\u94AE\n setTimeout(waitForEngineAndModifyButton, 500);\n }\n });\n \n // \u9875\u9762\u52A0\u8F7D\u5B8C\u6210\u540E\u4E5F\u5C1D\u8BD5\u4FEE\u6539\n document.addEventListener('DOMContentLoaded', function() {\n setTimeout(waitForEngineAndModifyButton, 1000);\n });\n \n // \u5B9A\u671F\u68C0\u67E5\u5E76\u4FEE\u6539\uFF08\u4F5C\u4E3A\u5907\u9009\u65B9\u6848\uFF09\n setInterval(waitForEngineAndModifyButton, 2000);\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 \n <style>\n /* \u81EA\u5B9A\u4E49\u6837\u5F0F\uFF1A\u5C06\u5BFC\u51FA\u6309\u94AE\u6587\u5B57\u6539\u4E3A\"\u4FDD\u5B58\" */\n /* \u5C1D\u8BD5\u591A\u79CD\u53EF\u80FD\u7684\u9009\u62E9\u5668 */\n .export-btn,\n .export-button,\n .fr-generator-export-btn,\n .fr-generator-export-button,\n [data-testid*=\"export\"],\n [data-testid*=\"exportBtn\"],\n .ant-btn[title*=\"\u5BFC\u51FA\"],\n .ant-btn[aria-label*=\"\u5BFC\u51FA\"] {\n /* \u901A\u8FC7 CSS \u4FEE\u6539\u6309\u94AE\u6587\u5B57 */\n }\n \n /* \u5982\u679C\u6309\u94AE\u6587\u5B57\u662F\u901A\u8FC7 ::before \u6216 ::after \u4F2A\u5143\u7D20\u663E\u793A\u7684 */\n .export-btn::before,\n .export-button::before,\n .fr-generator-export-btn::before,\n .fr-generator-export-button::before {\n content: \"\u4FDD\u5B58\" !important;\n }\n \n /* \u5982\u679C\u6309\u94AE\u6587\u5B57\u662F\u901A\u8FC7 ::after \u4F2A\u5143\u7D20\u663E\u793A\u7684 */\n .export-btn::after,\n .export-button::after,\n .fr-generator-export-btn::after,\n .fr-generator-export-button::after {\n content: \"\u4FDD\u5B58\" !important;\n }\n \n /* \u9690\u85CF\u539F\u59CB\u6587\u5B57\u5E76\u6DFB\u52A0\u65B0\u6587\u5B57 */\n .export-btn span,\n .export-button span,\n .fr-generator-export-btn span,\n .fr-generator-export-button span {\n position: relative;\n }\n \n .export-btn span::before,\n .export-button span::before,\n .fr-generator-export-btn span::before,\n .fr-generator-export-button span::before {\n content: \"\u4FDD\u5B58\";\n position: absolute;\n left: 0;\n top: 0;\n background: inherit;\n color: inherit;\n font-size: inherit;\n font-weight: inherit;\n }\n </style>\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 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 ";
3
3
  return html;
4
4
  };
5
5
  export default (function () {
package/es/main.js CHANGED
@@ -5,9 +5,15 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
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
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
11
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
8
14
  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
15
  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 } from 'react';
16
+ import React, { useEffect, useRef, useState, useImperativeHandle, forwardRef } from 'react';
11
17
  import createIframe from './createIframe';
12
18
  import * as defaultSetting from './settings';
13
19
  var iframe;
@@ -16,17 +22,19 @@ var Design = function Design(props, ref) {
16
22
  settings = props.settings,
17
23
  restProps = _objectWithoutProperties(props, _excluded);
18
24
  var containerRef = useRef();
25
+ var _useState = useState(false),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ delayDone = _useState2[0],
28
+ setDelayDone = _useState2[1];
19
29
  useImperativeHandle(ref, function () {
20
30
  return {
21
31
  getValue: function getValue() {
22
- var _iframe, _iframe2, _iframe2$contentWindo, _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2, _iframe3$contentWindo3;
23
- console.log("contentWindow", (_iframe = iframe) === null || _iframe === void 0 ? void 0 : _iframe.contentWindow);
24
- console.log("__FR_ENGINE__", (_iframe2 = iframe) === null || _iframe2 === void 0 ? void 0 : (_iframe2$contentWindo = _iframe2.contentWindow) === null || _iframe2$contentWindo === void 0 ? void 0 : _iframe2$contentWindo.__FR_ENGINE__);
25
- return (_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$contentWindo3 = _iframe3$contentWindo2.exportSchema) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2);
32
+ var _iframe, _iframe$contentWindow, _iframe$contentWindow2, _iframe$contentWindow3;
33
+ 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
34
  },
27
35
  setValue: function setValue(schema) {
28
- var _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2, _iframe4$contentWindo3;
29
- return (_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$contentWindo3 = _iframe4$contentWindo2.importSchema) === null || _iframe4$contentWindo3 === void 0 ? void 0 : _iframe4$contentWindo3.call(_iframe4$contentWindo2, schema);
36
+ var _iframe2, _iframe2$contentWindo, _iframe2$contentWindo2, _iframe2$contentWindo3;
37
+ 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
38
  }
31
39
  };
32
40
  });
@@ -38,46 +46,44 @@ var Design = function Design(props, ref) {
38
46
  };
39
47
  }, []);
40
48
  var initIframe = function initIframe() {
41
- console.log("开始创建 iframe");
42
49
  iframe = createIframe();
43
50
  containerRef.current.appendChild(iframe);
44
51
  };
45
52
  var engineOnLoad = function engineOnLoad(event) {
46
- var _iframe5, _iframe5$contentWindo, _iframe6, _iframe6$contentWindo, _iframe6$contentWindo2;
53
+ var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
47
54
  if (event.data.type !== 'engine-load') {
48
55
  return;
49
56
  }
50
- var engine = (_iframe5 = iframe) === null || _iframe5 === void 0 ? void 0 : (_iframe5$contentWindo = _iframe5.contentWindow) === null || _iframe5$contentWindo === void 0 ? void 0 : _iframe5$contentWindo.__FR_ENGINE__;
51
- (_iframe6 = iframe) === null || _iframe6 === void 0 ? void 0 : (_iframe6$contentWindo = _iframe6.contentWindow) === null || _iframe6$contentWindo === void 0 ? void 0 : (_iframe6$contentWindo2 = _iframe6$contentWindo.__FR_ENGINE__) === null || _iframe6$contentWindo2 === void 0 ? void 0 : _iframe6$contentWindo2.init(_objectSpread({
57
+ console.log('iframe init engine start', iframe);
58
+ (_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({
52
59
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
53
60
  widgets: widgets,
54
61
  // recordEnable: true,
55
62
  logo: {
56
63
  title: 'XRender'
57
- },
58
- // 自定义按钮文字配置 - 尝试多种可能的配置键
59
- buttonText: {
60
- export: '保存' // 将导出按钮文字改为"保存"
61
- },
62
- // 其他可能的配置键
63
- exportBtnText: '保存',
64
- exportButtonText: '保存',
65
- // 国际化配置
66
- locale: {
67
- export: '保存'
68
- },
69
- // 自定义配置
70
- customConfig: {
71
- exportButtonLabel: '保存'
72
- },
73
- // 按钮配置
74
- buttons: {
75
- export: {
76
- text: '保存'
77
- }
78
64
  }
79
65
  }, restProps));
66
+ console.log('iframe init engine end', iframe);
80
67
  };
68
+ useEffect(function () {
69
+ // 模拟 return 前的延迟
70
+ var timer = setTimeout(function () {
71
+ setDelayDone(true);
72
+ }, 5000); // 延迟 300ms 可自由调整
73
+
74
+ return function () {
75
+ return clearTimeout(timer);
76
+ };
77
+ }, []);
78
+ if (!delayDone) {
79
+ return /*#__PURE__*/React.createElement("div", {
80
+ ref: containerRef,
81
+ style: {
82
+ width: '100%',
83
+ height: '100%'
84
+ }
85
+ });
86
+ }
81
87
  return /*#__PURE__*/React.createElement("div", {
82
88
  ref: containerRef,
83
89
  style: {
@@ -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 \n // \u7B49\u5F85\u5F15\u64CE\u52A0\u8F7D\u5B8C\u6210\u540E\u4FEE\u6539\u6309\u94AE\u6587\u5B57\n function waitForEngineAndModifyButton() {\n // \u68C0\u67E5\u5F15\u64CE\u662F\u5426\u52A0\u8F7D\u5B8C\u6210\n if (window.__FR_ENGINE__) {\n modifyExportButtonText();\n } else {\n // \u5982\u679C\u5F15\u64CE\u8FD8\u6CA1\u52A0\u8F7D\uFF0C\u7B49\u5F85\u4E00\u6BB5\u65F6\u95F4\u540E\u91CD\u8BD5\n setTimeout(waitForEngineAndModifyButton, 100);\n }\n }\n \n // \u4FEE\u6539\u5BFC\u51FA\u6309\u94AE\u6587\u5B57\u7684\u51FD\u6570\n function modifyExportButtonText() {\n // \u5C1D\u8BD5\u591A\u79CD\u65B9\u5F0F\u67E5\u627E\u5BFC\u51FA\u6309\u94AE\n const selectors = [\n '.export-btn',\n '.export-button', \n '.fr-generator-export-btn',\n '.fr-generator-export-button',\n '[data-testid*=\"export\"]',\n '[data-testid*=\"exportBtn\"]',\n '.ant-btn[title*=\"\u5BFC\u51FA\"]',\n '.ant-btn[aria-label*=\"\u5BFC\u51FA\"]',\n 'button:contains(\"\u5BFC\u51FA\")',\n 'span:contains(\"\u5BFC\u51FA\")'\n ];\n \n let exportButton = null;\n \n // \u67E5\u627E\u6309\u94AE\n for (const selector of selectors) {\n try {\n if (selector.includes(':contains')) {\n // \u5904\u7406 :contains \u9009\u62E9\u5668\n const text = selector.match(/:contains(\"([^\"]+)\")/)[1];\n const elements = Array.from(document.querySelectorAll('*')).filter(el => \n el.textContent && el.textContent.includes(text)\n );\n if (elements.length > 0) {\n exportButton = elements[0];\n break;\n }\n } else {\n exportButton = document.querySelector(selector);\n if (exportButton) break;\n }\n } catch (e) {\n // \u5FFD\u7565\u9009\u62E9\u5668\u9519\u8BEF\n }\n }\n \n // \u5982\u679C\u627E\u5230\u4E86\u6309\u94AE\uFF0C\u4FEE\u6539\u6587\u5B57\n if (exportButton) {\n // \u65B9\u6CD51\uFF1A\u76F4\u63A5\u4FEE\u6539 textContent\n if (exportButton.textContent) {\n exportButton.textContent = exportButton.textContent.replace(/\u5BFC\u51FA/g, '\u4FDD\u5B58');\n }\n \n // \u65B9\u6CD52\uFF1A\u4FEE\u6539\u5B50\u5143\u7D20\u7684\u6587\u5B57\n const textElements = exportButton.querySelectorAll('span, div, label');\n textElements.forEach(el => {\n if (el.textContent && el.textContent.includes('\u5BFC\u51FA')) {\n el.textContent = el.textContent.replace(/\u5BFC\u51FA/g, '\u4FDD\u5B58');\n }\n });\n \n // \u65B9\u6CD53\uFF1A\u4FEE\u6539 title \u548C aria-label \u5C5E\u6027\n if (exportButton.title) {\n exportButton.title = exportButton.title.replace(/\u5BFC\u51FA/g, '\u4FDD\u5B58');\n }\n if (exportButton.getAttribute('aria-label')) {\n exportButton.setAttribute('aria-label', \n exportButton.getAttribute('aria-label').replace(/\u5BFC\u51FA/g, '\u4FDD\u5B58')\n );\n }\n \n console.log('\u6210\u529F\u5C06\u5BFC\u51FA\u6309\u94AE\u6587\u5B57\u6539\u4E3A\"\u4FDD\u5B58\"');\n } else {\n console.log('\u672A\u627E\u5230\u5BFC\u51FA\u6309\u94AE\uFF0C\u53EF\u80FD\u9009\u62E9\u5668\u4E0D\u6B63\u786E');\n }\n }\n \n // \u76D1\u542C\u5F15\u64CE\u52A0\u8F7D\u5B8C\u6210\u4E8B\u4EF6\n window.addEventListener('message', function(event) {\n if (event.data.type === 'engine-load') {\n // \u5F15\u64CE\u52A0\u8F7D\u5B8C\u6210\u540E\uFF0C\u7B49\u5F85\u4E00\u6BB5\u65F6\u95F4\u518D\u4FEE\u6539\u6309\u94AE\n setTimeout(waitForEngineAndModifyButton, 500);\n }\n });\n \n // \u9875\u9762\u52A0\u8F7D\u5B8C\u6210\u540E\u4E5F\u5C1D\u8BD5\u4FEE\u6539\n document.addEventListener('DOMContentLoaded', function() {\n setTimeout(waitForEngineAndModifyButton, 1000);\n });\n \n // \u5B9A\u671F\u68C0\u67E5\u5E76\u4FEE\u6539\uFF08\u4F5C\u4E3A\u5907\u9009\u65B9\u6848\uFF09\n setInterval(waitForEngineAndModifyButton, 2000);\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 \n <style>\n /* \u81EA\u5B9A\u4E49\u6837\u5F0F\uFF1A\u5C06\u5BFC\u51FA\u6309\u94AE\u6587\u5B57\u6539\u4E3A\"\u4FDD\u5B58\" */\n /* \u5C1D\u8BD5\u591A\u79CD\u53EF\u80FD\u7684\u9009\u62E9\u5668 */\n .export-btn,\n .export-button,\n .fr-generator-export-btn,\n .fr-generator-export-button,\n [data-testid*=\"export\"],\n [data-testid*=\"exportBtn\"],\n .ant-btn[title*=\"\u5BFC\u51FA\"],\n .ant-btn[aria-label*=\"\u5BFC\u51FA\"] {\n /* \u901A\u8FC7 CSS \u4FEE\u6539\u6309\u94AE\u6587\u5B57 */\n }\n \n /* \u5982\u679C\u6309\u94AE\u6587\u5B57\u662F\u901A\u8FC7 ::before \u6216 ::after \u4F2A\u5143\u7D20\u663E\u793A\u7684 */\n .export-btn::before,\n .export-button::before,\n .fr-generator-export-btn::before,\n .fr-generator-export-button::before {\n content: \"\u4FDD\u5B58\" !important;\n }\n \n /* \u5982\u679C\u6309\u94AE\u6587\u5B57\u662F\u901A\u8FC7 ::after \u4F2A\u5143\u7D20\u663E\u793A\u7684 */\n .export-btn::after,\n .export-button::after,\n .fr-generator-export-btn::after,\n .fr-generator-export-button::after {\n content: \"\u4FDD\u5B58\" !important;\n }\n \n /* \u9690\u85CF\u539F\u59CB\u6587\u5B57\u5E76\u6DFB\u52A0\u65B0\u6587\u5B57 */\n .export-btn span,\n .export-button span,\n .fr-generator-export-btn span,\n .fr-generator-export-button span {\n position: relative;\n }\n \n .export-btn span::before,\n .export-button span::before,\n .fr-generator-export-btn span::before,\n .fr-generator-export-button span::before {\n content: \"\u4FDD\u5B58\";\n position: absolute;\n left: 0;\n top: 0;\n background: inherit;\n color: inherit;\n font-size: inherit;\n font-weight: inherit;\n }\n </style>\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 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 ";
9
9
  return html;
10
10
  };
11
11
  var _default = exports.default = function _default() {
package/lib/main.js CHANGED
@@ -16,6 +16,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
18
  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); }
19
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
20
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
22
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
23
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
24
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
19
25
  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
26
  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
27
  var iframe;
@@ -24,17 +30,19 @@ var Design = function Design(props, ref) {
24
30
  settings = props.settings,
25
31
  restProps = _objectWithoutProperties(props, _excluded);
26
32
  var containerRef = (0, _react.useRef)();
33
+ var _useState = (0, _react.useState)(false),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ delayDone = _useState2[0],
36
+ setDelayDone = _useState2[1];
27
37
  (0, _react.useImperativeHandle)(ref, function () {
28
38
  return {
29
39
  getValue: function getValue() {
30
- var _iframe, _iframe2, _iframe2$contentWindo, _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2, _iframe3$contentWindo3;
31
- console.log("contentWindow", (_iframe = iframe) === null || _iframe === void 0 ? void 0 : _iframe.contentWindow);
32
- console.log("__FR_ENGINE__", (_iframe2 = iframe) === null || _iframe2 === void 0 ? void 0 : (_iframe2$contentWindo = _iframe2.contentWindow) === null || _iframe2$contentWindo === void 0 ? void 0 : _iframe2$contentWindo.__FR_ENGINE__);
33
- return (_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$contentWindo3 = _iframe3$contentWindo2.exportSchema) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2);
40
+ var _iframe, _iframe$contentWindow, _iframe$contentWindow2, _iframe$contentWindow3;
41
+ 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
42
  },
35
43
  setValue: function setValue(schema) {
36
- var _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2, _iframe4$contentWindo3;
37
- return (_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$contentWindo3 = _iframe4$contentWindo2.importSchema) === null || _iframe4$contentWindo3 === void 0 ? void 0 : _iframe4$contentWindo3.call(_iframe4$contentWindo2, schema);
44
+ var _iframe2, _iframe2$contentWindo, _iframe2$contentWindo2, _iframe2$contentWindo3;
45
+ 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
46
  }
39
47
  };
40
48
  });
@@ -46,46 +54,44 @@ var Design = function Design(props, ref) {
46
54
  };
47
55
  }, []);
48
56
  var initIframe = function initIframe() {
49
- console.log("开始创建 iframe");
50
57
  iframe = (0, _createIframe.default)();
51
58
  containerRef.current.appendChild(iframe);
52
59
  };
53
60
  var engineOnLoad = function engineOnLoad(event) {
54
- var _iframe5, _iframe5$contentWindo, _iframe6, _iframe6$contentWindo, _iframe6$contentWindo2;
61
+ var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
55
62
  if (event.data.type !== 'engine-load') {
56
63
  return;
57
64
  }
58
- var engine = (_iframe5 = iframe) === null || _iframe5 === void 0 ? void 0 : (_iframe5$contentWindo = _iframe5.contentWindow) === null || _iframe5$contentWindo === void 0 ? void 0 : _iframe5$contentWindo.__FR_ENGINE__;
59
- (_iframe6 = iframe) === null || _iframe6 === void 0 ? void 0 : (_iframe6$contentWindo = _iframe6.contentWindow) === null || _iframe6$contentWindo === void 0 ? void 0 : (_iframe6$contentWindo2 = _iframe6$contentWindo.__FR_ENGINE__) === null || _iframe6$contentWindo2 === void 0 ? void 0 : _iframe6$contentWindo2.init(_objectSpread({
65
+ console.log('iframe init engine start', iframe);
66
+ (_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({
60
67
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
61
68
  widgets: widgets,
62
69
  // recordEnable: true,
63
70
  logo: {
64
71
  title: 'XRender'
65
- },
66
- // 自定义按钮文字配置 - 尝试多种可能的配置键
67
- buttonText: {
68
- export: '保存' // 将导出按钮文字改为"保存"
69
- },
70
- // 其他可能的配置键
71
- exportBtnText: '保存',
72
- exportButtonText: '保存',
73
- // 国际化配置
74
- locale: {
75
- export: '保存'
76
- },
77
- // 自定义配置
78
- customConfig: {
79
- exportButtonLabel: '保存'
80
- },
81
- // 按钮配置
82
- buttons: {
83
- export: {
84
- text: '保存'
85
- }
86
72
  }
87
73
  }, restProps));
74
+ console.log('iframe init engine end', iframe);
88
75
  };
76
+ (0, _react.useEffect)(function () {
77
+ // 模拟 return 前的延迟
78
+ var timer = setTimeout(function () {
79
+ setDelayDone(true);
80
+ }, 5000); // 延迟 300ms 可自由调整
81
+
82
+ return function () {
83
+ return clearTimeout(timer);
84
+ };
85
+ }, []);
86
+ if (!delayDone) {
87
+ return /*#__PURE__*/_react.default.createElement("div", {
88
+ ref: containerRef,
89
+ style: {
90
+ width: '100%',
91
+ height: '100%'
92
+ }
93
+ });
94
+ }
89
95
  return /*#__PURE__*/_react.default.createElement("div", {
90
96
  ref: containerRef,
91
97
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzdadelu/schema-builder",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.81",
4
4
  "description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
5
5
  "keywords": [
6
6
  "Form",