@zzdadelu/schema-builder 1.0.0-alpha.97 → 1.0.0-alpha.98

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 +22 -46
  2. package/lib/main.js +21 -45
  3. package/package.json +1 -1
package/es/main.js CHANGED
@@ -9,15 +9,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
9
9
  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); }
10
10
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
11
11
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
12
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
13
- 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."); }
14
- 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; } }
15
- 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; }
16
- 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; } }
17
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
18
12
  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; }
19
13
  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; }
20
- import React, { useEffect, useRef, useState, useImperativeHandle, forwardRef } from 'react';
14
+ import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
21
15
  import createIframe from './createIframe';
22
16
  import * as defaultSetting from './settings';
23
17
  var iframe;
@@ -26,10 +20,6 @@ var Design = function Design(props, ref) {
26
20
  settings = props.settings,
27
21
  restProps = _objectWithoutProperties(props, _excluded);
28
22
  var containerRef = useRef();
29
- var _useState = useState(false),
30
- _useState2 = _slicedToArray(_useState, 2),
31
- delayDone = _useState2[0],
32
- setDelayDone = _useState2[1];
33
23
  useImperativeHandle(ref, function () {
34
24
  return {
35
25
  getValue: function getValue() {
@@ -53,12 +43,14 @@ var Design = function Design(props, ref) {
53
43
  iframe = createIframe();
54
44
  containerRef.current.appendChild(iframe);
55
45
  };
56
- var simulatorUrl = ['https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/css/react-simulator-renderer.css', // 使用自定义的 JS 文件,或者在线修复
57
- "https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js?t=".concat(new Date().getTime())];
46
+ var delay = function delay(ms) {
47
+ return new Promise(function (resolve) {
48
+ return setTimeout(resolve, ms);
49
+ });
50
+ };
58
51
  var engineOnLoad = /*#__PURE__*/function () {
59
52
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
60
- var _iframe3, _iframeWindow$__FR_EN;
61
- var iframeWindow;
53
+ var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
62
54
  return _regenerator().w(function (_context) {
63
55
  while (1) switch (_context.n) {
64
56
  case 0:
@@ -68,26 +60,29 @@ var Design = function Design(props, ref) {
68
60
  }
69
61
  return _context.a(2);
70
62
  case 1:
71
- iframeWindow = (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow;
72
- if (iframeWindow) {
73
- _context.n = 2;
74
- break;
75
- }
76
- return _context.a(2);
63
+ _context.n = 2;
64
+ return delay(3000);
77
65
  case 2:
78
- console.log('iframe init engine: start waiting...');
79
- console.log('iframeWindow?.AliFormRenderMaterial', iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.AliFormRenderMaterial);
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({
66
+ // 设置延迟,例如 2000 毫秒(2 秒)
67
+
68
+ // 初始化引擎
69
+ (_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({
81
70
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
82
- simulatorUrl: simulatorUrl,
83
71
  widgets: widgets,
84
72
  logo: {
85
73
  title: 'XRender'
86
74
  }
87
75
  }, restProps));
88
- console.log('iframeWindow?.AliFormRenderMaterial', iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.AliFormRenderMaterial);
89
- console.log('iframe init engine: end init');
76
+ console.log('Engine initialization complete.');
77
+
78
+ // 在初始化后设置等待
79
+ _context.n = 3;
80
+ return delay(3000);
90
81
  case 3:
82
+ // 另一段延迟,例如 1000 毫秒(1 秒)
83
+
84
+ console.log('Post-initialization tasks completed.');
85
+ case 4:
91
86
  return _context.a(2);
92
87
  }
93
88
  }, _callee);
@@ -96,25 +91,6 @@ var Design = function Design(props, ref) {
96
91
  return _ref.apply(this, arguments);
97
92
  };
98
93
  }();
99
- useEffect(function () {
100
- // 模拟 return 前的延迟
101
- var timer = setTimeout(function () {
102
- setDelayDone(true);
103
- }, 5000); // 延迟 300ms 可自由调整
104
-
105
- return function () {
106
- return clearTimeout(timer);
107
- };
108
- }, []);
109
- if (!delayDone) {
110
- return /*#__PURE__*/React.createElement("div", {
111
- ref: containerRef,
112
- style: {
113
- width: '100%',
114
- height: '100%'
115
- }
116
- });
117
- }
118
94
  return /*#__PURE__*/React.createElement("div", {
119
95
  ref: containerRef,
120
96
  style: {
package/lib/main.js CHANGED
@@ -20,12 +20,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
20
20
  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); }
21
21
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
22
22
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
23
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
24
- 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."); }
25
- 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; } }
26
- 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; }
27
- 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; } }
28
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
29
23
  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; }
30
24
  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; }
31
25
  var iframe;
@@ -34,10 +28,6 @@ var Design = function Design(props, ref) {
34
28
  settings = props.settings,
35
29
  restProps = _objectWithoutProperties(props, _excluded);
36
30
  var containerRef = (0, _react.useRef)();
37
- var _useState = (0, _react.useState)(false),
38
- _useState2 = _slicedToArray(_useState, 2),
39
- delayDone = _useState2[0],
40
- setDelayDone = _useState2[1];
41
31
  (0, _react.useImperativeHandle)(ref, function () {
42
32
  return {
43
33
  getValue: function getValue() {
@@ -61,12 +51,14 @@ var Design = function Design(props, ref) {
61
51
  iframe = (0, _createIframe.default)();
62
52
  containerRef.current.appendChild(iframe);
63
53
  };
64
- var simulatorUrl = ['https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/css/react-simulator-renderer.css', // 使用自定义的 JS 文件,或者在线修复
65
- "https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js?t=".concat(new Date().getTime())];
54
+ var delay = function delay(ms) {
55
+ return new Promise(function (resolve) {
56
+ return setTimeout(resolve, ms);
57
+ });
58
+ };
66
59
  var engineOnLoad = /*#__PURE__*/function () {
67
60
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
68
- var _iframe3, _iframeWindow$__FR_EN;
69
- var iframeWindow;
61
+ var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
70
62
  return _regenerator().w(function (_context) {
71
63
  while (1) switch (_context.n) {
72
64
  case 0:
@@ -76,26 +68,29 @@ var Design = function Design(props, ref) {
76
68
  }
77
69
  return _context.a(2);
78
70
  case 1:
79
- iframeWindow = (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow;
80
- if (iframeWindow) {
81
- _context.n = 2;
82
- break;
83
- }
84
- return _context.a(2);
71
+ _context.n = 2;
72
+ return delay(3000);
85
73
  case 2:
86
- console.log('iframe init engine: start waiting...');
87
- console.log('iframeWindow?.AliFormRenderMaterial', iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.AliFormRenderMaterial);
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({
74
+ // 设置延迟,例如 2000 毫秒(2 秒)
75
+
76
+ // 初始化引擎
77
+ (_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({
89
78
  settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
90
- simulatorUrl: simulatorUrl,
91
79
  widgets: widgets,
92
80
  logo: {
93
81
  title: 'XRender'
94
82
  }
95
83
  }, restProps));
96
- console.log('iframeWindow?.AliFormRenderMaterial', iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.AliFormRenderMaterial);
97
- console.log('iframe init engine: end init');
84
+ console.log('Engine initialization complete.');
85
+
86
+ // 在初始化后设置等待
87
+ _context.n = 3;
88
+ return delay(3000);
98
89
  case 3:
90
+ // 另一段延迟,例如 1000 毫秒(1 秒)
91
+
92
+ console.log('Post-initialization tasks completed.');
93
+ case 4:
99
94
  return _context.a(2);
100
95
  }
101
96
  }, _callee);
@@ -104,25 +99,6 @@ var Design = function Design(props, ref) {
104
99
  return _ref.apply(this, arguments);
105
100
  };
106
101
  }();
107
- (0, _react.useEffect)(function () {
108
- // 模拟 return 前的延迟
109
- var timer = setTimeout(function () {
110
- setDelayDone(true);
111
- }, 5000); // 延迟 300ms 可自由调整
112
-
113
- return function () {
114
- return clearTimeout(timer);
115
- };
116
- }, []);
117
- if (!delayDone) {
118
- return /*#__PURE__*/_react.default.createElement("div", {
119
- ref: containerRef,
120
- style: {
121
- width: '100%',
122
- height: '100%'
123
- }
124
- });
125
- }
126
102
  return /*#__PURE__*/_react.default.createElement("div", {
127
103
  ref: containerRef,
128
104
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzdadelu/schema-builder",
3
- "version": "1.0.0-alpha.97",
3
+ "version": "1.0.0-alpha.98",
4
4
  "description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
5
5
  "keywords": [
6
6
  "Form",