@zzdadelu/schema-builder 1.0.0-alpha.127 → 1.0.0-alpha.129

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/dist/index.js CHANGED
@@ -4136,21 +4136,27 @@
4136
4136
  });
4137
4137
 
4138
4138
  var _excluded = ["widgets", "settings"];
4139
- var iframe;
4139
+ if (typeof window !== 'undefined') {
4140
+ console.log('设置全局方法 getFormRenderMaterial', window);
4141
+ window.getFormRenderMaterial = function () {
4142
+ return defaultSetting;
4143
+ };
4144
+ }
4140
4145
  var Design = function Design(props, ref) {
4141
4146
  var widgets = props.widgets,
4142
4147
  settings = props.settings,
4143
4148
  restProps = _objectWithoutProperties(props, _excluded);
4144
4149
  var containerRef = React.useRef();
4150
+ var iframeRef = React.useRef(null);
4145
4151
  React.useImperativeHandle(ref, function () {
4146
4152
  return {
4147
4153
  getValue: function getValue() {
4148
- var _iframe, _iframe$contentWindow, _iframe$contentWindow2, _iframe$contentWindow3;
4149
- 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);
4154
+ var _iframeRef$current, _iframeRef$current$co, _iframeRef$current$co2, _iframeRef$current$co3;
4155
+ return (_iframeRef$current = iframeRef.current) === null || _iframeRef$current === void 0 ? void 0 : (_iframeRef$current$co = _iframeRef$current.contentWindow) === null || _iframeRef$current$co === void 0 ? void 0 : (_iframeRef$current$co2 = _iframeRef$current$co.__FR_ENGINE__) === null || _iframeRef$current$co2 === void 0 ? void 0 : (_iframeRef$current$co3 = _iframeRef$current$co2.exportSchema) === null || _iframeRef$current$co3 === void 0 ? void 0 : _iframeRef$current$co3.call(_iframeRef$current$co2);
4150
4156
  },
4151
4157
  setValue: function setValue(schema) {
4152
- var _iframe2, _iframe2$contentWindo, _iframe2$contentWindo2, _iframe2$contentWindo3;
4153
- 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);
4158
+ var _iframeRef$current2, _iframeRef$current2$c, _iframeRef$current2$c2, _iframeRef$current2$c3;
4159
+ return (_iframeRef$current2 = iframeRef.current) === null || _iframeRef$current2 === void 0 ? void 0 : (_iframeRef$current2$c = _iframeRef$current2.contentWindow) === null || _iframeRef$current2$c === void 0 ? void 0 : (_iframeRef$current2$c2 = _iframeRef$current2$c.__FR_ENGINE__) === null || _iframeRef$current2$c2 === void 0 ? void 0 : (_iframeRef$current2$c3 = _iframeRef$current2$c2.importSchema) === null || _iframeRef$current2$c3 === void 0 ? void 0 : _iframeRef$current2$c3.call(_iframeRef$current2$c2, schema);
4154
4160
  }
4155
4161
  };
4156
4162
  });
@@ -4162,15 +4168,16 @@
4162
4168
  };
4163
4169
  }, []);
4164
4170
  var initIframe = function initIframe() {
4165
- iframe = createIframe();
4171
+ var iframe = createIframe();
4172
+ iframeRef.current = iframe;
4166
4173
  containerRef.current.appendChild(iframe);
4167
4174
  };
4168
4175
  var engineOnLoad = function engineOnLoad(event) {
4169
- var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
4176
+ var _iframeRef$current3, _iframeRef$current3$c, _iframeRef$current3$c2;
4170
4177
  if (event.data.type !== 'engine-load') {
4171
4178
  return;
4172
4179
  }
4173
- (_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(_objectSpread2({
4180
+ (_iframeRef$current3 = iframeRef.current) === null || _iframeRef$current3 === void 0 ? void 0 : (_iframeRef$current3$c = _iframeRef$current3.contentWindow) === null || _iframeRef$current3$c === void 0 ? void 0 : (_iframeRef$current3$c2 = _iframeRef$current3$c.__FR_ENGINE__) === null || _iframeRef$current3$c2 === void 0 ? void 0 : _iframeRef$current3$c2.init(_objectSpread2({
4174
4181
  settings: _objectSpread2(_objectSpread2({}, defaultSetting), settings),
4175
4182
  widgets: widgets,
4176
4183
  // recordEnable: true,