@alicloud/alfa-react 1.4.39 → 1.4.40

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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/es/components/ErrorBoundary/ErrorPanel.js +0 -2
  3. package/es/components/ErrorBoundary/index.js +7 -19
  4. package/es/components/Loading/Paragraph.js +9 -25
  5. package/es/components/Loading/Skeleton.js +14 -46
  6. package/es/components/Loading/Title.js +3 -8
  7. package/es/components/Loading/index.js +0 -2
  8. package/es/createAlfaApp.js +6 -10
  9. package/es/createAlfaWidget.js +16 -28
  10. package/es/createApplication.js +143 -189
  11. package/es/hooks/beforeLoadHook.js +60 -81
  12. package/es/hooks/beforeResolveHook.js +24 -29
  13. package/es/index.js +2 -2
  14. package/es/types/base.js +0 -9
  15. package/es/utils/counter.js +1 -3
  16. package/es/utils/getConsoleConfig.js +13 -32
  17. package/es/utils/getConsoleGlobal.js +6 -13
  18. package/es/utils/index.js +2 -1
  19. package/es/version.js +1 -1
  20. package/es/widget/emitter.js +2 -11
  21. package/es/widget/env.js +2 -4
  22. package/es/widget/getWidgetConfigById.js +19 -27
  23. package/es/widget/getWidgetDeps.js +104 -130
  24. package/es/widget/getWidgetVersionById.js +79 -106
  25. package/es/widget.js +45 -58
  26. package/lib/addGlobalRequestInterceptor.js +0 -2
  27. package/lib/components/ErrorBoundary/ErrorPanel.js +0 -5
  28. package/lib/components/ErrorBoundary/index.js +7 -25
  29. package/lib/components/Loading/Paragraph.js +9 -32
  30. package/lib/components/Loading/Skeleton.js +14 -60
  31. package/lib/components/Loading/Title.js +3 -14
  32. package/lib/components/Loading/index.js +0 -6
  33. package/lib/createAlfaApp.js +6 -24
  34. package/lib/createAlfaWidget.js +16 -45
  35. package/lib/createApplication.js +143 -200
  36. package/lib/hooks/beforeLoadHook.js +60 -88
  37. package/lib/hooks/beforeResolveHook.js +21 -33
  38. package/lib/index.js +0 -9
  39. package/lib/types/base.js +0 -14
  40. package/lib/utils/counter.js +1 -4
  41. package/lib/utils/getConsoleConfig.js +12 -37
  42. package/lib/utils/getConsoleGlobal.js +6 -18
  43. package/lib/utils/index.js +2 -5
  44. package/lib/version.js +1 -1
  45. package/lib/widget/emitter.js +2 -16
  46. package/lib/widget/env.js +2 -6
  47. package/lib/widget/getWidgetConfigById.js +19 -36
  48. package/lib/widget/getWidgetDeps.js +103 -146
  49. package/lib/widget/getWidgetVersionById.js +79 -113
  50. package/lib/widget/index.js +0 -8
  51. package/lib/widget.js +45 -72
  52. package/package.json +22 -19
  53. package/types/components/ErrorBoundary/index.d.ts +1 -1
  54. package/types/components/Loading/Paragraph.d.ts +2 -2
  55. package/types/components/Loading/Skeleton.d.ts +2 -2
  56. package/types/components/Loading/Title.d.ts +2 -2
  57. package/types/components/Loading/index.d.ts +1 -1
  58. package/types/createAlfaApp.d.ts +3 -3
  59. package/types/createAlfaWidget.d.ts +3 -3
  60. package/types/createApplication.d.ts +2 -2
  61. package/types/types/index.d.ts +5 -5
  62. package/types/utils/getConsoleConfig.d.ts +4 -2
  63. package/types/utils/getConsoleGlobal.d.ts +3 -1
  64. package/types/version.d.ts +1 -1
  65. package/types/widget/getWidgetDeps.d.ts +1 -1
  66. package/types/widget.d.ts +2 -2
  67. package/dist/index.js +0 -21
  68. package/es/app.js +0 -194
  69. package/es/hooks/afterLoadHook.js +0 -69
  70. package/lib/app.d.ts +0 -3
  71. package/lib/app.js +0 -223
  72. package/lib/components/ErrorBoundary/ErrorPanel.d.ts +0 -6
  73. package/lib/components/ErrorBoundary/index.d.ts +0 -17
  74. package/lib/components/Loading/Paragraph.d.ts +0 -14
  75. package/lib/components/Loading/Skeleton.d.ts +0 -19
  76. package/lib/components/Loading/Title.d.ts +0 -8
  77. package/lib/components/Loading/index.d.ts +0 -4
  78. package/lib/components/Loading/style.d.ts +0 -2
  79. package/lib/createAlfaApp.d.ts +0 -7
  80. package/lib/createAlfaWidget.d.ts +0 -4
  81. package/lib/createApplication.d.ts +0 -12
  82. package/lib/hooks/afterLoadHook.d.ts +0 -3
  83. package/lib/hooks/afterLoadHook.js +0 -84
  84. package/lib/hooks/beforeLoadHook.d.ts +0 -3
  85. package/lib/hooks/beforeResolveHook.d.ts +0 -3
  86. package/lib/index.d.ts +0 -4
  87. package/lib/types/base.d.ts +0 -11
  88. package/lib/types/index.d.ts +0 -91
  89. package/lib/utils/getConsoleConfig.d.ts +0 -1
  90. package/lib/utils/getConsoleGlobal.d.ts +0 -1
  91. package/lib/utils/index.d.ts +0 -1
  92. package/lib/version.d.ts +0 -1
  93. package/lib/widget/emitter.d.ts +0 -8
  94. package/lib/widget/env.d.ts +0 -4
  95. package/lib/widget/getWidgetConfigById.d.ts +0 -2
  96. package/lib/widget/getWidgetDeps.d.ts +0 -2
  97. package/lib/widget/getWidgetVersionById.d.ts +0 -6
  98. package/lib/widget/index.d.ts +0 -4
  99. package/lib/widget.d.ts +0 -2
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Alibaba Cloud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -11,7 +11,6 @@ var commonErrorStyle = {
11
11
  color: '#d93026',
12
12
  fontSize: 14
13
13
  };
14
-
15
14
  var ErrorPanel = function ErrorPanel(props) {
16
15
  var error = props.error;
17
16
  return /*#__PURE__*/React.createElement("div", {
@@ -24,5 +23,4 @@ var ErrorPanel = function ErrorPanel(props) {
24
23
  }
25
24
  }, error === null || error === void 0 ? void 0 : error.stack));
26
25
  };
27
-
28
26
  export default ErrorPanel;
@@ -3,25 +3,17 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
-
7
6
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
-
9
7
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
-
11
8
  import React from 'react';
12
9
  import isFunction from 'lodash/isFunction';
13
10
  import ErrorPanel from './ErrorPanel';
14
-
15
11
  var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
16
12
  _inherits(ErrorBoundary, _React$Component);
17
-
18
13
  var _super = _createSuper(ErrorBoundary);
19
-
20
14
  function ErrorBoundary(props) {
21
15
  var _this;
22
-
23
16
  _classCallCheck(this, ErrorBoundary);
24
-
25
17
  _this = _super.call(this, props);
26
18
  _this.state = {
27
19
  hasError: false,
@@ -29,22 +21,22 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
29
21
  };
30
22
  return _this;
31
23
  }
32
-
33
24
  _createClass(ErrorBoundary, [{
34
25
  key: "componentDidCatch",
35
26
  value: function componentDidCatch(error, errorInfo) {
36
27
  var _window, _window$__bl, _window2, _window2$__bl;
37
-
38
28
  var _this$props = this.props,
39
- appDidCatch = _this$props.appDidCatch,
40
- logger = _this$props.logger; // Display fallback UI
29
+ appDidCatch = _this$props.appDidCatch,
30
+ logger = _this$props.logger;
41
31
 
32
+ // Display fallback UI
42
33
  this.setState({
43
34
  hasError: true,
44
35
  error: error
45
36
  });
46
- isFunction((_window = window) === null || _window === void 0 ? void 0 : (_window$__bl = _window.__bl) === null || _window$__bl === void 0 ? void 0 : _window$__bl.error) && ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$__bl = _window2.__bl) === null || _window2$__bl === void 0 ? void 0 : _window2$__bl.error(error, errorInfo)); // You can also log the error to an error reporting service in appDidCatch
37
+ isFunction((_window = window) === null || _window === void 0 ? void 0 : (_window$__bl = _window.__bl) === null || _window$__bl === void 0 ? void 0 : _window$__bl.error) && ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$__bl = _window2.__bl) === null || _window2$__bl === void 0 ? void 0 : _window2$__bl.error(error, errorInfo));
47
38
 
39
+ // You can also log the error to an error reporting service in appDidCatch
48
40
  appDidCatch && appDidCatch(error, errorInfo);
49
41
  (logger === null || logger === void 0 ? void 0 : logger.error) && logger.error({
50
42
  E_CODE: 'RuntimeError',
@@ -57,20 +49,16 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
57
49
  key: "render",
58
50
  value: function render() {
59
51
  var error = this.state.error;
60
-
61
52
  if (this.state.hasError) {
62
- if (this.props.fallbackRender) return this.props.fallbackRender(error); // You can render any custom fallback UI
63
-
53
+ if (this.props.fallbackRender) return this.props.fallbackRender(error);
54
+ // You can render any custom fallback UI
64
55
  return /*#__PURE__*/React.createElement(ErrorPanel, {
65
56
  error: error
66
57
  });
67
58
  }
68
-
69
59
  return this.props.children;
70
60
  }
71
61
  }]);
72
-
73
62
  return ErrorBoundary;
74
63
  }(React.Component);
75
-
76
64
  export default ErrorBoundary;
@@ -4,55 +4,42 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
4
  import _inherits from "@babel/runtime/helpers/esm/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
-
8
7
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
-
10
8
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
-
12
9
  import * as React from 'react';
13
10
  import classNames from 'classnames';
14
-
15
11
  var Paragraph = /*#__PURE__*/function (_React$Component) {
16
12
  _inherits(Paragraph, _React$Component);
17
-
18
13
  var _super = _createSuper(Paragraph);
19
-
20
14
  function Paragraph() {
21
15
  _classCallCheck(this, Paragraph);
22
-
23
16
  return _super.apply(this, arguments);
24
17
  }
25
-
26
18
  _createClass(Paragraph, [{
27
19
  key: "getWidth",
28
20
  value: function getWidth(index) {
29
21
  var _this$props = this.props,
30
- width = _this$props.width,
31
- _this$props$rows = _this$props.rows,
32
- rows = _this$props$rows === void 0 ? 2 : _this$props$rows;
33
-
22
+ width = _this$props.width,
23
+ _this$props$rows = _this$props.rows,
24
+ rows = _this$props$rows === void 0 ? 2 : _this$props$rows;
34
25
  if (Array.isArray(width)) {
35
26
  return width[index];
36
- } // last paragraph
37
-
38
-
27
+ }
28
+ // last paragraph
39
29
  if (rows - 1 === index) {
40
30
  return width;
41
31
  }
42
-
43
32
  return undefined;
44
33
  }
45
34
  }, {
46
35
  key: "render",
47
36
  value: function render() {
48
37
  var _this = this;
49
-
50
38
  var _this$props2 = this.props,
51
- prefixCls = _this$props2.prefixCls,
52
- className = _this$props2.className,
53
- style = _this$props2.style,
54
- rows = _this$props2.rows;
55
-
39
+ prefixCls = _this$props2.prefixCls,
40
+ className = _this$props2.className,
41
+ style = _this$props2.style,
42
+ rows = _this$props2.rows;
56
43
  var rowList = _toConsumableArray(Array(rows)).map(function (_, index) {
57
44
  return (
58
45
  /*#__PURE__*/
@@ -65,15 +52,12 @@ var Paragraph = /*#__PURE__*/function (_React$Component) {
65
52
  })
66
53
  );
67
54
  });
68
-
69
55
  return /*#__PURE__*/React.createElement("ul", {
70
56
  className: classNames(prefixCls, className),
71
57
  style: style
72
58
  }, rowList);
73
59
  }
74
60
  }]);
75
-
76
61
  return Paragraph;
77
62
  }(React.Component);
78
-
79
63
  export default Paragraph;
@@ -5,137 +5,107 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
7
  import _typeof from "@babel/runtime/helpers/esm/typeof";
8
-
9
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
-
17
12
  import * as React from 'react';
18
13
  import classNames from 'classnames';
19
14
  import Title from './Title';
20
15
  import Paragraph from './Paragraph';
21
16
  import style from './style';
22
-
23
17
  function getComponentProps(prop) {
24
18
  if (prop && _typeof(prop) === 'object') {
25
19
  return prop;
26
20
  }
27
-
28
21
  return {};
29
22
  }
30
-
31
23
  function getTitleBasicProps(hasParagraph) {
32
24
  if (hasParagraph) {
33
25
  return {
34
26
  width: '38%'
35
27
  };
36
28
  }
37
-
38
29
  return {};
39
30
  }
40
-
41
31
  function getParagraphBasicProps(hasTitle) {
42
- var basicProps = {}; // Width
32
+ var basicProps = {};
43
33
 
34
+ // Width
44
35
  if (!hasTitle) {
45
36
  basicProps.width = '61%';
46
- } // Rows
47
-
37
+ }
48
38
 
39
+ // Rows
49
40
  if (hasTitle) {
50
41
  basicProps.rows = 3;
51
42
  } else {
52
43
  basicProps.rows = 2;
53
44
  }
54
-
55
45
  return basicProps;
56
46
  }
57
-
58
47
  var Skeleton = /*#__PURE__*/function (_React$Component) {
59
48
  _inherits(Skeleton, _React$Component);
60
-
61
49
  var _super = _createSuper(Skeleton);
62
-
63
50
  function Skeleton() {
64
51
  var _this;
65
-
66
52
  _classCallCheck(this, Skeleton);
67
-
68
53
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
69
54
  args[_key] = arguments[_key];
70
55
  }
71
-
72
56
  _this = _super.call.apply(_super, [this].concat(args));
73
-
74
57
  _this.renderSkeleton = function () {
75
58
  var _this$props = _this.props,
76
- _this$props$prefixCls = _this$props.prefixCls,
77
- prefixCls = _this$props$prefixCls === void 0 ? '-os-skeleton' : _this$props$prefixCls,
78
- loading = _this$props.loading,
79
- className = _this$props.className,
80
- children = _this$props.children,
81
- title = _this$props.title,
82
- paragraph = _this$props.paragraph,
83
- active = _this$props.active;
84
-
59
+ _this$props$prefixCls = _this$props.prefixCls,
60
+ prefixCls = _this$props$prefixCls === void 0 ? '-os-skeleton' : _this$props$prefixCls,
61
+ loading = _this$props.loading,
62
+ className = _this$props.className,
63
+ children = _this$props.children,
64
+ title = _this$props.title,
65
+ paragraph = _this$props.paragraph,
66
+ active = _this$props.active;
85
67
  if (loading || !('loading' in _this.props)) {
86
68
  var hasTitle = !!title;
87
69
  var hasParagraph = !!paragraph;
88
70
  var contentNode;
89
-
90
71
  if (hasTitle || hasParagraph) {
91
72
  // Title
92
73
  var $title;
93
-
94
74
  if (hasTitle) {
95
75
  var titleProps = _objectSpread(_objectSpread({
96
76
  prefixCls: "".concat(prefixCls, "-title")
97
77
  }, getTitleBasicProps(hasParagraph)), getComponentProps(title));
98
-
99
78
  $title = /*#__PURE__*/React.createElement(Title, titleProps);
100
- } // Paragraph
101
-
79
+ }
102
80
 
81
+ // Paragraph
103
82
  var paragraphNode;
104
-
105
83
  if (hasParagraph) {
106
84
  var paragraphProps = _objectSpread(_objectSpread({
107
85
  prefixCls: "".concat(prefixCls, "-paragraph")
108
86
  }, getParagraphBasicProps(hasTitle)), getComponentProps(paragraph));
109
-
110
87
  paragraphNode = /*#__PURE__*/React.createElement(Paragraph, paragraphProps);
111
88
  }
112
-
113
89
  contentNode = /*#__PURE__*/React.createElement("div", {
114
90
  className: "".concat(prefixCls, "-content")
115
91
  }, $title, paragraphNode);
116
92
  }
117
-
118
93
  var cls = classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-active"), active));
119
94
  return /*#__PURE__*/React.createElement("div", {
120
95
  className: cls
121
96
  }, contentNode);
122
97
  }
123
-
124
98
  return children;
125
99
  };
126
-
127
100
  return _this;
128
101
  }
129
-
130
102
  _createClass(Skeleton, [{
131
103
  key: "componentDidMount",
132
104
  value: function componentDidMount() {
133
105
  var id = '-os-skeleton-style';
134
-
135
106
  if (document.getElementById('-os-skeleton-style')) {
136
107
  return;
137
108
  }
138
-
139
109
  var styleSheet = document.createElement('style');
140
110
  styleSheet.innerHTML = style;
141
111
  styleSheet.id = id;
@@ -147,10 +117,8 @@ var Skeleton = /*#__PURE__*/function (_React$Component) {
147
117
  return this.renderSkeleton();
148
118
  }
149
119
  }]);
150
-
151
120
  return Skeleton;
152
121
  }(React.Component);
153
-
154
122
  Skeleton.defaultProps = {
155
123
  title: true,
156
124
  paragraph: true
@@ -1,17 +1,13 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
4
  import * as React from 'react';
8
5
  import classNames from 'classnames';
9
-
10
6
  var Title = function Title(_ref) {
11
7
  var prefixCls = _ref.prefixCls,
12
- className = _ref.className,
13
- width = _ref.width,
14
- style = _ref.style;
8
+ className = _ref.className,
9
+ width = _ref.width,
10
+ style = _ref.style;
15
11
  return /*#__PURE__*/React.createElement("h3", {
16
12
  className: classNames(prefixCls, className),
17
13
  style: _objectSpread({
@@ -19,5 +15,4 @@ var Title = function Title(_ref) {
19
15
  }, style)
20
16
  });
21
17
  };
22
-
23
18
  export default Title;
@@ -2,13 +2,11 @@ import React from 'react';
2
2
  import Skeleton from './Skeleton';
3
3
  export default function getLoading(_ref) {
4
4
  var loading = _ref.loading;
5
-
6
5
  if (loading === false) {
7
6
  return null;
8
7
  } else if (loading && /*#__PURE__*/React.isValidElement(loading)) {
9
8
  return loading;
10
9
  }
11
-
12
10
  return /*#__PURE__*/React.createElement(Skeleton, {
13
11
  active: true
14
12
  });
@@ -1,10 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
-
4
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
-
6
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
-
8
5
  import React, { useMemo } from 'react';
9
6
  import { BaseLoader } from '@alicloud/alfa-core';
10
7
  import ErrorBoundary from './components/ErrorBoundary';
@@ -15,13 +12,12 @@ var loader = BaseLoader.create();
15
12
  loader.beforeResolve.use(beforeResolveHook);
16
13
  loader.beforeLoad.use(beforeLoadHook);
17
14
  var Application = createApplication(loader);
18
-
19
15
  function createAlfaApp(option) {
20
16
  var _ref = option || {},
21
- name = _ref.name,
22
- dependencies = _ref.dependencies; // check app option
23
-
17
+ name = _ref.name,
18
+ dependencies = _ref.dependencies;
24
19
 
20
+ // check app option
25
21
  if (!name) return function () {
26
22
  return null;
27
23
  };
@@ -32,7 +28,8 @@ function createAlfaApp(option) {
32
28
  __injectHistory: props.history
33
29
  });
34
30
  }, [props]);
35
- return /*#__PURE__*/React.createElement(ErrorBoundary, props, /*#__PURE__*/React.createElement(Application // 兼容历史逻辑,优先使用 option 中的 sandbox 参数
31
+ return /*#__PURE__*/React.createElement(ErrorBoundary, props, /*#__PURE__*/React.createElement(Application
32
+ // 兼容历史逻辑,优先使用 option 中的 sandbox 参数
36
33
  , _extends({}, passedInOption, {
37
34
  syncHistory: props.syncHistory,
38
35
  basename: props.basename,
@@ -42,13 +39,12 @@ function createAlfaApp(option) {
42
39
  })));
43
40
  };
44
41
  }
42
+
45
43
  /**
46
44
  * create memorized app in react function component, just create App after first mounted
47
45
  * @param option
48
46
  * @returns
49
47
  */
50
-
51
-
52
48
  export function useAlfaApp(option) {
53
49
  var App = useMemo(function () {
54
50
  return createAlfaApp(option);
@@ -1,11 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
-
5
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
7
  import React, { useMemo } from 'react';
11
8
  import { BaseLoader } from '@alicloud/alfa-core';
@@ -21,43 +18,35 @@ loader.beforeLoad.use( /*#__PURE__*/function () {
21
18
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appConfig) {
22
19
  var app;
23
20
  return _regeneratorRuntime.wrap(function _callee$(_context) {
24
- while (1) {
25
- switch (_context.prev = _context.next) {
26
- case 0:
27
- app = appConfig.app;
28
-
29
- if (app && app.context) {
30
- // disable history
31
- app.context.history = {};
32
- }
33
-
34
- return _context.abrupt("return", appConfig);
35
-
36
- case 3:
37
- case "end":
38
- return _context.stop();
39
- }
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ app = appConfig.app;
24
+ if (app && app.context) {
25
+ // disable history
26
+ app.context.history = {};
27
+ }
28
+ return _context.abrupt("return", appConfig);
29
+ case 3:
30
+ case "end":
31
+ return _context.stop();
40
32
  }
41
33
  }, _callee);
42
34
  }));
43
-
44
35
  return function (_x) {
45
36
  return _ref.apply(this, arguments);
46
37
  };
47
38
  }());
48
39
  var Application = createApplication(loader);
49
-
50
40
  function createAlfaWidget(option) {
51
41
  var _ref2 = option || {},
52
- name = _ref2.name,
53
- dependencies = _ref2.dependencies;
54
-
42
+ name = _ref2.name,
43
+ dependencies = _ref2.dependencies;
55
44
  if (name.match(/@ali\/widget-/)) {
56
45
  // TODO load style
57
46
  return createCWSWidget(option);
58
- } // check app option
59
-
47
+ }
60
48
 
49
+ // check app option
61
50
  if (!name) return function () {
62
51
  return null;
63
52
  };
@@ -75,13 +64,12 @@ function createAlfaWidget(option) {
75
64
  );
76
65
  };
77
66
  }
67
+
78
68
  /**
79
69
  * create memorized app in react function component, just create App after first mounted
80
70
  * @param option
81
71
  * @returns
82
72
  */
83
-
84
-
85
73
  export function useAlfaWidget(option) {
86
74
  var App = useMemo(function () {
87
75
  return createAlfaWidget(option);