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