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

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 </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 ";
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 ";
3
3
  return html;
4
4
  };
5
5
  export default (function () {
package/es/main.js CHANGED
@@ -19,13 +19,14 @@ var Design = function Design(props, ref) {
19
19
  useImperativeHandle(ref, function () {
20
20
  return {
21
21
  getValue: function getValue() {
22
- var _iframe, _iframe$contentWindow, _iframe2, _iframe2$contentWindo, _iframe2$contentWindo2, _iframe2$contentWindo3;
23
- console.log("__FR_ENGINE__", (_iframe = iframe) === null || _iframe === void 0 ? void 0 : (_iframe$contentWindow = _iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.__FR_ENGINE__);
24
- 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.exportSchema) === null || _iframe2$contentWindo3 === void 0 ? void 0 : _iframe2$contentWindo3.call(_iframe2$contentWindo2);
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);
25
26
  },
26
27
  setValue: function setValue(schema) {
27
- var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2, _iframe3$contentWindo3;
28
- 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.importSchema) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2, 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);
29
30
  }
30
31
  };
31
32
  });
@@ -42,16 +43,38 @@ var Design = function Design(props, ref) {
42
43
  containerRef.current.appendChild(iframe);
43
44
  };
44
45
  var engineOnLoad = function engineOnLoad(event) {
45
- var _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2;
46
+ var _iframe5, _iframe5$contentWindo, _iframe6, _iframe6$contentWindo, _iframe6$contentWindo2;
46
47
  if (event.data.type !== 'engine-load') {
47
48
  return;
48
49
  }
49
- (_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$contentWindo2.init(_objectSpread({
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({
50
52
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
51
53
  widgets: widgets,
52
54
  // recordEnable: true,
53
55
  logo: {
54
56
  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
+ }
55
78
  }
56
79
  }, restProps));
57
80
  };
@@ -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 </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 ";
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 ";
9
9
  return html;
10
10
  };
11
11
  var _default = exports.default = function _default() {
package/lib/main.js CHANGED
@@ -27,13 +27,14 @@ var Design = function Design(props, ref) {
27
27
  (0, _react.useImperativeHandle)(ref, function () {
28
28
  return {
29
29
  getValue: function getValue() {
30
- var _iframe, _iframe$contentWindow, _iframe2, _iframe2$contentWindo, _iframe2$contentWindo2, _iframe2$contentWindo3;
31
- console.log("__FR_ENGINE__", (_iframe = iframe) === null || _iframe === void 0 ? void 0 : (_iframe$contentWindow = _iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.__FR_ENGINE__);
32
- 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.exportSchema) === null || _iframe2$contentWindo3 === void 0 ? void 0 : _iframe2$contentWindo3.call(_iframe2$contentWindo2);
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);
33
34
  },
34
35
  setValue: function setValue(schema) {
35
- var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2, _iframe3$contentWindo3;
36
- 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.importSchema) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2, 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);
37
38
  }
38
39
  };
39
40
  });
@@ -50,16 +51,38 @@ var Design = function Design(props, ref) {
50
51
  containerRef.current.appendChild(iframe);
51
52
  };
52
53
  var engineOnLoad = function engineOnLoad(event) {
53
- var _iframe4, _iframe4$contentWindo, _iframe4$contentWindo2;
54
+ var _iframe5, _iframe5$contentWindo, _iframe6, _iframe6$contentWindo, _iframe6$contentWindo2;
54
55
  if (event.data.type !== 'engine-load') {
55
56
  return;
56
57
  }
57
- (_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$contentWindo2.init(_objectSpread({
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({
58
60
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
59
61
  widgets: widgets,
60
62
  // recordEnable: true,
61
63
  logo: {
62
64
  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
+ }
63
86
  }
64
87
  }, restProps));
65
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzdadelu/schema-builder",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-alpha.8",
4
4
  "description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
5
5
  "keywords": [
6
6
  "Form",