@zzdadelu/schema-builder 1.0.0-alpha.90 → 1.0.0-alpha.92

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.
Files changed (3) hide show
  1. package/es/main.js +10 -34
  2. package/lib/main.js +10 -34
  3. package/package.json +1 -1
package/es/main.js CHANGED
@@ -55,8 +55,8 @@ var Design = function Design(props, ref) {
55
55
  };
56
56
  var engineOnLoad = /*#__PURE__*/function () {
57
57
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
58
- var _iframe3, _iframeWindow$__FR_EN;
59
- var iframeWindow, waitForMaterial;
58
+ var _iframe3, _iframeWindow$, _iframeWindow$__FR_EN, _iframeWindow$2;
59
+ var iframeWindow;
60
60
  return _regenerator().w(function (_context) {
61
61
  while (1) switch (_context.n) {
62
62
  case 0:
@@ -74,36 +74,9 @@ var Design = function Design(props, ref) {
74
74
  return _context.a(2);
75
75
  case 2:
76
76
  console.log('iframe init engine: start waiting...');
77
-
78
- // 等待 AliFormRenderMaterial 出现
79
- waitForMaterial = function waitForMaterial() {
80
- return new Promise(function (resolve) {
81
- var attempts = 0;
82
- var maxAttempts = 50; // 最长等待 50 * 100ms = 5 秒
83
-
84
- var timer = setInterval(function () {
85
- var _iframeWindow$;
86
- attempts++;
87
- var material = (_iframeWindow$ = iframeWindow[0]) === null || _iframeWindow$ === void 0 ? void 0 : _iframeWindow$.AliFormRenderMaterial;
88
- if (material) {
89
- console.log('AliFormRenderMaterial is ready:', material);
90
- clearInterval(timer);
91
- resolve();
92
- }
93
- if (attempts >= maxAttempts) {
94
- console.warn('AliFormRenderMaterial load timeout');
95
- clearInterval(timer);
96
- resolve(); // 即使加载不到,也继续,不然永远挂住
97
- }
98
- }, 100); // 每 100ms 检查一次
99
- });
100
- }; // 1) 等待 AliFormRenderMaterial
101
- _context.n = 3;
102
- return waitForMaterial();
103
- case 3:
104
- console.log('iframe init engine: start init');
105
-
106
- // 2) 执行初始化
77
+ console.log('iframe init engine: start waiting...', iframeWindow);
78
+ console.log('iframe init engine: start waiting...', iframeWindow[0]);
79
+ console.log('iframe init engine: start waiting...', (_iframeWindow$ = iframeWindow[0]) === null || _iframeWindow$ === void 0 ? void 0 : _iframeWindow$.AliFormRenderMaterial);
107
80
  iframeWindow === null || iframeWindow === void 0 ? void 0 : (_iframeWindow$__FR_EN = iframeWindow.__FR_ENGINE__) === null || _iframeWindow$__FR_EN === void 0 ? void 0 : _iframeWindow$__FR_EN.init(_objectSpread({
108
81
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
109
82
  widgets: widgets,
@@ -111,8 +84,11 @@ var Design = function Design(props, ref) {
111
84
  title: 'XRender'
112
85
  }
113
86
  }, restProps));
114
- console.log('iframe init engine: init done');
115
- case 4:
87
+ console.log('iframe init engine: end init');
88
+ console.log('iframe init engine: end init...', iframeWindow);
89
+ console.log('iframe init engine: end init...', iframeWindow[0]);
90
+ console.log('iframe init engine: end init...', (_iframeWindow$2 = iframeWindow[0]) === null || _iframeWindow$2 === void 0 ? void 0 : _iframeWindow$2.AliFormRenderMaterial);
91
+ case 3:
116
92
  return _context.a(2);
117
93
  }
118
94
  }, _callee);
package/lib/main.js CHANGED
@@ -63,8 +63,8 @@ var Design = function Design(props, ref) {
63
63
  };
64
64
  var engineOnLoad = /*#__PURE__*/function () {
65
65
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
66
- var _iframe3, _iframeWindow$__FR_EN;
67
- var iframeWindow, waitForMaterial;
66
+ var _iframe3, _iframeWindow$, _iframeWindow$__FR_EN, _iframeWindow$2;
67
+ var iframeWindow;
68
68
  return _regenerator().w(function (_context) {
69
69
  while (1) switch (_context.n) {
70
70
  case 0:
@@ -82,36 +82,9 @@ var Design = function Design(props, ref) {
82
82
  return _context.a(2);
83
83
  case 2:
84
84
  console.log('iframe init engine: start waiting...');
85
-
86
- // 等待 AliFormRenderMaterial 出现
87
- waitForMaterial = function waitForMaterial() {
88
- return new Promise(function (resolve) {
89
- var attempts = 0;
90
- var maxAttempts = 50; // 最长等待 50 * 100ms = 5 秒
91
-
92
- var timer = setInterval(function () {
93
- var _iframeWindow$;
94
- attempts++;
95
- var material = (_iframeWindow$ = iframeWindow[0]) === null || _iframeWindow$ === void 0 ? void 0 : _iframeWindow$.AliFormRenderMaterial;
96
- if (material) {
97
- console.log('AliFormRenderMaterial is ready:', material);
98
- clearInterval(timer);
99
- resolve();
100
- }
101
- if (attempts >= maxAttempts) {
102
- console.warn('AliFormRenderMaterial load timeout');
103
- clearInterval(timer);
104
- resolve(); // 即使加载不到,也继续,不然永远挂住
105
- }
106
- }, 100); // 每 100ms 检查一次
107
- });
108
- }; // 1) 等待 AliFormRenderMaterial
109
- _context.n = 3;
110
- return waitForMaterial();
111
- case 3:
112
- console.log('iframe init engine: start init');
113
-
114
- // 2) 执行初始化
85
+ console.log('iframe init engine: start waiting...', iframeWindow);
86
+ console.log('iframe init engine: start waiting...', iframeWindow[0]);
87
+ console.log('iframe init engine: start waiting...', (_iframeWindow$ = iframeWindow[0]) === null || _iframeWindow$ === void 0 ? void 0 : _iframeWindow$.AliFormRenderMaterial);
115
88
  iframeWindow === null || iframeWindow === void 0 ? void 0 : (_iframeWindow$__FR_EN = iframeWindow.__FR_ENGINE__) === null || _iframeWindow$__FR_EN === void 0 ? void 0 : _iframeWindow$__FR_EN.init(_objectSpread({
116
89
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
117
90
  widgets: widgets,
@@ -119,8 +92,11 @@ var Design = function Design(props, ref) {
119
92
  title: 'XRender'
120
93
  }
121
94
  }, restProps));
122
- console.log('iframe init engine: init done');
123
- case 4:
95
+ console.log('iframe init engine: end init');
96
+ console.log('iframe init engine: end init...', iframeWindow);
97
+ console.log('iframe init engine: end init...', iframeWindow[0]);
98
+ console.log('iframe init engine: end init...', (_iframeWindow$2 = iframeWindow[0]) === null || _iframeWindow$2 === void 0 ? void 0 : _iframeWindow$2.AliFormRenderMaterial);
99
+ case 3:
124
100
  return _context.a(2);
125
101
  }
126
102
  }, _callee);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzdadelu/schema-builder",
3
- "version": "1.0.0-alpha.90",
3
+ "version": "1.0.0-alpha.92",
4
4
  "description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
5
5
  "keywords": [
6
6
  "Form",