tntd 1.4.32 → 1.4.33-beta.1

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 (157) hide show
  1. package/components/Ellipsis/index.js +47 -15
  2. package/components/QueryListScene/QueryForm.js +4 -4
  3. package/components/QueryListScene/createActions.js +4 -4
  4. package/dist/1.tntd.js +1 -1
  5. package/dist/stats.json +24089 -23289
  6. package/dist/tntd.css +1 -1
  7. package/dist/tntd.js +7 -10
  8. package/es/ArrayInput/icon.js +5 -5
  9. package/es/ArrayInput/index.js +79 -111
  10. package/es/AuthContext.js +1 -1
  11. package/es/Columns/index.js +33 -40
  12. package/es/DevelopmentLogin/LoginModal.js +33 -46
  13. package/es/DevelopmentLogin/index.js +14 -18
  14. package/es/Ellipsis/Svg/CopySVG.js +13 -13
  15. package/es/Ellipsis/Svg/TickSVG.js +8 -8
  16. package/es/Ellipsis/index.js +100 -79
  17. package/es/Handle/index.js +46 -64
  18. package/es/Icon/fonts/iconfont.js +7 -12
  19. package/es/Icon/index.js +12 -15
  20. package/es/Img/Contain.js +26 -31
  21. package/es/Img/Cover.js +43 -57
  22. package/es/Img/index.js +39 -48
  23. package/es/Layout/ActionsContext.js +3 -2
  24. package/es/Layout/AppList.js +39 -94
  25. package/es/Layout/Application.js +28 -74
  26. package/es/Layout/Avatar.js +30 -67
  27. package/es/Layout/CompatibleLanguage.js +41 -96
  28. package/es/Layout/EnterpriseLayout/Avatar.js +39 -77
  29. package/es/Layout/EnterpriseLayout/Language.js +16 -34
  30. package/es/Layout/EnterpriseLayout/Theme.js +18 -36
  31. package/es/Layout/EnterpriseLayout/index.js +14 -16
  32. package/es/Layout/GlobalNavigation/NavigationPopup.js +61 -172
  33. package/es/Layout/GlobalNavigation/index.js +22 -56
  34. package/es/Layout/Header.js +26 -47
  35. package/es/Layout/HeaderActions.js +45 -59
  36. package/es/Layout/HeaderNavs.js +24 -51
  37. package/es/Layout/HeaderTabs.js +53 -106
  38. package/es/Layout/Iconfont.js +1 -1
  39. package/es/Layout/Language.js +16 -34
  40. package/es/Layout/Layout.js +88 -110
  41. package/es/Layout/Logo.js +17 -33
  42. package/es/Layout/OrgAppList.js +64 -109
  43. package/es/Layout/SideMenu.js +67 -128
  44. package/es/Layout/Theme.js +25 -63
  45. package/es/Layout/index.js +28 -37
  46. package/es/Layout/paaslayout/CompactSideMenu.js +37 -76
  47. package/es/Layout/paaslayout/Header.js +23 -46
  48. package/es/Layout/paaslayout/Logo.js +4 -14
  49. package/es/Layout/paaslayout/SideMenu.js +41 -80
  50. package/es/Layout/paaslayout/index.js +77 -104
  51. package/es/Layout/storage.js +10 -9
  52. package/es/LoadingButton/index.js +18 -27
  53. package/es/Modal/index.js +42 -51
  54. package/es/Page/Box.js +36 -43
  55. package/es/Page/index.js +56 -71
  56. package/es/Page/utils.js +0 -5
  57. package/es/QueryForm/Field/Checkbox.js +7 -11
  58. package/es/QueryForm/Field/Select.js +34 -44
  59. package/es/QueryForm/Field/SelectInput.js +31 -46
  60. package/es/QueryForm/Field/fieldsMap.js +0 -1
  61. package/es/QueryForm/Field/index.js +46 -78
  62. package/es/QueryForm/createActions.js +6 -7
  63. package/es/QueryForm/index.js +79 -140
  64. package/es/QueryListScene/List.js +83 -139
  65. package/es/QueryListScene/QueryForm.js +54 -91
  66. package/es/QueryListScene/QueryListScene.js +29 -47
  67. package/es/QueryListScene/Title.js +3 -3
  68. package/es/QueryListScene/Toolbar.js +13 -14
  69. package/es/QueryListScene/createActions.js +4 -4
  70. package/es/Select/DropDownWrap.js +32 -55
  71. package/es/Select/index.js +140 -232
  72. package/es/Table/ResizableTable/index.js +29 -43
  73. package/es/Table/index.js +20 -19
  74. package/es/Title/index.js +23 -25
  75. package/es/locale.js +1 -5
  76. package/es/utils/checkAuth.js +6 -8
  77. package/es/utils/findMenuInfoByPath.js +0 -4
  78. package/es/utils/index.js +17 -27
  79. package/lib/ArrayInput/icon.js +7 -9
  80. package/lib/ArrayInput/index.js +82 -131
  81. package/lib/AuthContext.js +2 -6
  82. package/lib/Columns/index.js +36 -54
  83. package/lib/DevelopmentLogin/LoginModal.js +36 -63
  84. package/lib/DevelopmentLogin/index.js +21 -31
  85. package/lib/Ellipsis/Svg/CopySVG.js +15 -18
  86. package/lib/Ellipsis/Svg/TickSVG.js +10 -13
  87. package/lib/Ellipsis/index.js +105 -93
  88. package/lib/Handle/index.js +51 -87
  89. package/lib/Icon/fonts/iconfont.js +7 -12
  90. package/lib/Icon/iconList.js +1 -2
  91. package/lib/Icon/index.js +16 -26
  92. package/lib/Img/Contain.js +29 -40
  93. package/lib/Img/Cover.js +48 -72
  94. package/lib/Img/index.js +42 -58
  95. package/lib/Layout/ActionsContext.js +1 -5
  96. package/lib/Layout/AppList.js +45 -124
  97. package/lib/Layout/Application.js +31 -92
  98. package/lib/Layout/Avatar.js +36 -91
  99. package/lib/Layout/CompatibleLanguage.js +44 -116
  100. package/lib/Layout/EnterpriseLayout/Avatar.js +45 -105
  101. package/lib/Layout/EnterpriseLayout/Language.js +22 -54
  102. package/lib/Layout/EnterpriseLayout/Theme.js +21 -50
  103. package/lib/Layout/EnterpriseLayout/index.js +17 -27
  104. package/lib/Layout/GlobalNavigation/NavigationPopup.js +64 -192
  105. package/lib/Layout/GlobalNavigation/index.js +28 -80
  106. package/lib/Layout/Header.js +36 -68
  107. package/lib/Layout/HeaderActions.js +51 -81
  108. package/lib/Layout/HeaderNavs.js +30 -70
  109. package/lib/Layout/HeaderTabs.js +58 -127
  110. package/lib/Layout/Iconfont.js +4 -9
  111. package/lib/Layout/Language.js +22 -54
  112. package/lib/Layout/Layout.js +93 -134
  113. package/lib/Layout/Logo.js +26 -47
  114. package/lib/Layout/OrgAppList.js +69 -133
  115. package/lib/Layout/SideMenu.js +72 -151
  116. package/lib/Layout/Theme.js +28 -79
  117. package/lib/Layout/createActions.js +3 -9
  118. package/lib/Layout/images/index.js +5 -36
  119. package/lib/Layout/index.js +35 -63
  120. package/lib/Layout/paaslayout/CompactSideMenu.js +40 -90
  121. package/lib/Layout/paaslayout/Header.js +30 -60
  122. package/lib/Layout/paaslayout/Logo.js +11 -24
  123. package/lib/Layout/paaslayout/SideMenu.js +44 -93
  124. package/lib/Layout/paaslayout/index.js +82 -128
  125. package/lib/Layout/storage.js +26 -68
  126. package/lib/LoadingButton/index.js +21 -36
  127. package/lib/Modal/index.js +45 -62
  128. package/lib/Page/Box.js +38 -50
  129. package/lib/Page/index.js +58 -84
  130. package/lib/Page/utils.js +5 -16
  131. package/lib/QueryForm/Field/Checkbox.js +10 -19
  132. package/lib/QueryForm/Field/Select.js +39 -60
  133. package/lib/QueryForm/Field/SelectInput.js +36 -65
  134. package/lib/QueryForm/Field/fieldsMap.js +6 -23
  135. package/lib/QueryForm/Field/index.js +50 -91
  136. package/lib/QueryForm/createActions.js +9 -16
  137. package/lib/QueryForm/index.js +83 -165
  138. package/lib/QueryForm/useForm.js +1 -6
  139. package/lib/QueryListScene/List.js +89 -153
  140. package/lib/QueryListScene/QueryForm.js +58 -101
  141. package/lib/QueryListScene/QueryListScene.js +31 -56
  142. package/lib/QueryListScene/Title.js +6 -11
  143. package/lib/QueryListScene/Toolbar.js +16 -22
  144. package/lib/QueryListScene/createActions.js +7 -13
  145. package/lib/QueryListScene/index.js +5 -19
  146. package/lib/QueryListScene/useActions.js +1 -6
  147. package/lib/Select/DropDownWrap.js +35 -63
  148. package/lib/Select/index.js +142 -245
  149. package/lib/Table/ResizableTable/index.js +31 -54
  150. package/lib/Table/index.js +21 -34
  151. package/lib/Title/index.js +26 -34
  152. package/lib/index.js +36 -57
  153. package/lib/locale.js +9 -25
  154. package/lib/utils/checkAuth.js +9 -16
  155. package/lib/utils/findMenuInfoByPath.js +3 -12
  156. package/lib/utils/index.js +26 -60
  157. package/package.json +3 -2
package/es/Icon/index.js CHANGED
@@ -1,26 +1,23 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
-
5
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
-
1
+ var _excluded = ["type", "prefix", "className"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ 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; }
4
+ 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; }
7
5
  import './fonts/iconfont';
8
6
  import './index.less';
9
7
  export { default as iconList } from './iconList';
10
8
  export default (function (_ref) {
11
9
  var type = _ref.type,
12
- _ref$prefix = _ref.prefix,
13
- prefix = _ref$prefix === void 0 ? 'tnt-' : _ref$prefix,
14
- _ref$className = _ref.className,
15
- className = _ref$className === void 0 ? '' : _ref$className,
16
- props = _objectWithoutProperties(_ref, ["type", "prefix", "className"]);
17
-
18
- return React.createElement("i", _extends({
10
+ _ref$prefix = _ref.prefix,
11
+ prefix = _ref$prefix === void 0 ? 'tnt-' : _ref$prefix,
12
+ _ref$className = _ref.className,
13
+ className = _ref$className === void 0 ? '' : _ref$className,
14
+ props = _objectWithoutProperties(_ref, _excluded);
15
+ return /*#__PURE__*/React.createElement("i", _extends({
19
16
  className: "tnt-icon ".concat(className),
20
17
  type: type
21
- }, props), React.createElement("svg", {
18
+ }, props), /*#__PURE__*/React.createElement("svg", {
22
19
  "aria-hidden": "true"
23
- }, React.createElement("use", {
20
+ }, /*#__PURE__*/React.createElement("use", {
24
21
  xlinkHref: "#".concat(prefix).concat(type)
25
22
  })));
26
23
  });
package/es/Img/Contain.js CHANGED
@@ -1,45 +1,40 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
-
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
9
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
-
11
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
-
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["alt", "title", "src", "width", "height", "style", "className", "onError", "shape", "errorImgSrc", "type"];
3
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
+ 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); }
9
+ 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; }
10
+ 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; }
13
11
  import React from 'react';
14
12
  import classnames from 'classnames';
15
13
  export default (function (props) {
16
14
  var alt = props.alt,
17
- title = props.title,
18
- src = props.src,
19
- width = props.width,
20
- height = props.height,
21
- _props$style = props.style,
22
- style = _props$style === void 0 ? {} : _props$style,
23
- className = props.className,
24
- onError = props.onError,
25
- shape = props.shape,
26
- errorImgSrc = props.errorImgSrc,
27
- type = props.type,
28
- others = _objectWithoutProperties(props, ["alt", "title", "src", "width", "height", "style", "className", "onError", "shape", "errorImgSrc", "type"]);
29
-
30
- var styles = _objectSpread({}, style, {
15
+ title = props.title,
16
+ src = props.src,
17
+ width = props.width,
18
+ height = props.height,
19
+ _props$style = props.style,
20
+ style = _props$style === void 0 ? {} : _props$style,
21
+ className = props.className,
22
+ onError = props.onError,
23
+ shape = props.shape,
24
+ errorImgSrc = props.errorImgSrc,
25
+ type = props.type,
26
+ others = _objectWithoutProperties(props, _excluded);
27
+ var styles = _objectSpread(_objectSpread({}, style), {}, {
31
28
  display: 'inline-block',
32
29
  width: width,
33
30
  height: height,
34
31
  overflow: 'hidden'
35
32
  });
36
-
37
33
  if (shape === 'rounded') {
38
34
  styles.borderRadius = '5px';
39
35
  } else if (shape === 'circle') {
40
36
  styles.borderRadius = '50%';
41
37
  }
42
-
43
38
  var centerStyles = {
44
39
  width: width,
45
40
  height: height,
@@ -54,12 +49,12 @@ export default (function (props) {
54
49
  maxHeight: height
55
50
  };
56
51
  var cls = classnames('tntd-img', shape, className);
57
- return React.createElement("div", _extends({
52
+ return /*#__PURE__*/React.createElement("div", _extends({
58
53
  className: cls,
59
54
  style: styles
60
- }, others), React.createElement("div", {
55
+ }, others), /*#__PURE__*/React.createElement("div", {
61
56
  style: centerStyles
62
- }, React.createElement("img", {
57
+ }, /*#__PURE__*/React.createElement("img", {
63
58
  style: imgStyles,
64
59
  onError: onError,
65
60
  src: src,
package/es/Img/Cover.js CHANGED
@@ -1,55 +1,48 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
-
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
9
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
10
-
11
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
12
-
13
- function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
14
-
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
-
17
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
-
19
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
-
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["alt", "title", "src", "width", "height", "style", "className", "onError", "shape", "errorImgSrc", "type"];
3
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
+ 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); }
9
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
10
+ 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."); }
11
+ 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; } }
12
+ 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; }
13
+ 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; } }
14
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
15
+ 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; }
16
+ 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; }
21
17
  import React from 'react';
22
18
  import { useEffect, useState, useRef } from 'react';
23
19
  import classnames from 'classnames';
24
20
  export default (function (props) {
25
21
  var alt = props.alt,
26
- title = props.title,
27
- src = props.src,
28
- width = props.width,
29
- height = props.height,
30
- _props$style = props.style,
31
- style = _props$style === void 0 ? {} : _props$style,
32
- className = props.className,
33
- onError = props.onError,
34
- shape = props.shape,
35
- errorImgSrc = props.errorImgSrc,
36
- type = props.type,
37
- others = _objectWithoutProperties(props, ["alt", "title", "src", "width", "height", "style", "className", "onError", "shape", "errorImgSrc", "type"]);
38
-
22
+ title = props.title,
23
+ src = props.src,
24
+ width = props.width,
25
+ height = props.height,
26
+ _props$style = props.style,
27
+ style = _props$style === void 0 ? {} : _props$style,
28
+ className = props.className,
29
+ onError = props.onError,
30
+ shape = props.shape,
31
+ errorImgSrc = props.errorImgSrc,
32
+ type = props.type,
33
+ others = _objectWithoutProperties(props, _excluded);
39
34
  var imgRef = useRef();
40
-
41
35
  var _useState = useState({
42
- display: 'block',
43
- maxWidth: 'none',
44
- width: 'auto',
45
- height: 'auto',
46
- // transition: 'opacity 0.2s ease',
47
- opacity: 0
48
- }),
49
- _useState2 = _slicedToArray(_useState, 2),
50
- imgStyles = _useState2[0],
51
- setImgStyles = _useState2[1];
52
-
36
+ display: 'block',
37
+ maxWidth: 'none',
38
+ width: 'auto',
39
+ height: 'auto',
40
+ // transition: 'opacity 0.2s ease',
41
+ opacity: 0
42
+ }),
43
+ _useState2 = _slicedToArray(_useState, 2),
44
+ imgStyles = _useState2[0],
45
+ setImgStyles = _useState2[1];
53
46
  var getStyles = function getStyles(wrapWidth, wrapHeight, imgWidth, imgHeight) {
54
47
  // 进行等比运算
55
48
  var wrapRatio = wrapWidth / wrapHeight;
@@ -58,7 +51,6 @@ export default (function (props) {
58
51
  var finalHeight = 0;
59
52
  var finalMarginTop = 0;
60
53
  var finalMarginLeft = 0;
61
-
62
54
  if (wrapRatio > imgRatio) {
63
55
  // 父框宽度更大,以父框的宽度为准,拉伸图片上移
64
56
  finalWidth = wrapWidth;
@@ -70,7 +62,6 @@ export default (function (props) {
70
62
  finalWidth = finalHeight * imgRatio;
71
63
  finalMarginLeft = (finalWidth - wrapWidth) / 2 * -1;
72
64
  }
73
-
74
65
  return {
75
66
  height: finalHeight,
76
67
  width: finalWidth,
@@ -78,43 +69,38 @@ export default (function (props) {
78
69
  marginTop: finalMarginTop
79
70
  };
80
71
  };
81
-
82
72
  var imgOnload = function imgOnload() {
83
73
  var imgDOM = imgRef.current;
84
74
  var width = props.width,
85
- height = props.height;
75
+ height = props.height;
86
76
  var imgWidth = imgDOM.width;
87
77
  var imgHeight = imgDOM.height;
88
78
  var imgStyles2 = getStyles(width, height, imgWidth, imgHeight);
89
- setImgStyles(_objectSpread({}, imgStyles, {}, imgStyles2, {
79
+ setImgStyles(_objectSpread(_objectSpread(_objectSpread({}, imgStyles), imgStyles2), {}, {
90
80
  opacity: 1
91
81
  }));
92
82
  };
93
-
94
83
  useEffect(function () {
95
84
  if (width || height) {
96
85
  imgOnload();
97
86
  }
98
87
  }, [width, height]);
99
-
100
- var styles = _objectSpread({}, style, {
88
+ var styles = _objectSpread(_objectSpread({}, style), {}, {
101
89
  display: 'inline-block',
102
90
  overflow: 'hidden',
103
91
  width: width,
104
92
  height: height
105
93
  });
106
-
107
94
  if (shape === 'rounded') {
108
95
  styles.borderRadius = '5px';
109
96
  } else if (shape === 'circle') {
110
97
  styles.borderRadius = '50%';
111
98
  }
112
-
113
99
  var cls = classnames('tntd-img', shape, className);
114
- return React.createElement("div", _extends({
100
+ return /*#__PURE__*/React.createElement("div", _extends({
115
101
  className: cls,
116
102
  style: styles
117
- }, others), React.createElement("img", {
103
+ }, others), /*#__PURE__*/React.createElement("img", {
118
104
  style: imgStyles,
119
105
  onError: onError,
120
106
  ref: imgRef,
package/es/Img/index.js CHANGED
@@ -1,60 +1,52 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
-
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
9
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
10
-
11
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
12
-
13
- function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
14
-
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
-
17
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
-
19
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
-
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["type", "src", "shape", "title", "alt", "className", "style", "width", "height", "errorImgSrc", "onError"];
3
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
+ 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); }
9
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
10
+ 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."); }
11
+ 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; } }
12
+ 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; }
13
+ 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; } }
14
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
15
+ 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; }
16
+ 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; }
21
17
  import { Fragment, useState } from 'react';
22
18
  import Cover from './Cover';
23
19
  import Contain from './Contain';
24
20
  export default (function (props) {
25
21
  var _ref = props || {},
26
- _ref$type = _ref.type,
27
- type = _ref$type === void 0 ? 'cover' : _ref$type,
28
- src = _ref.src,
29
- _ref$shape = _ref.shape,
30
- shape = _ref$shape === void 0 ? 'sharp' : _ref$shape,
31
- _ref$title = _ref.title,
32
- title = _ref$title === void 0 ? '' : _ref$title,
33
- _ref$alt = _ref.alt,
34
- alt = _ref$alt === void 0 ? '' : _ref$alt,
35
- className = _ref.className,
36
- style = _ref.style,
37
- _ref$width = _ref.width,
38
- width = _ref$width === void 0 ? 'auto' : _ref$width,
39
- _ref$height = _ref.height,
40
- height = _ref$height === void 0 ? 'auto' : _ref$height,
41
- errorImgSrc = _ref.errorImgSrc,
42
- onError = _ref.onError,
43
- rest = _objectWithoutProperties(_ref, ["type", "src", "shape", "title", "alt", "className", "style", "width", "height", "errorImgSrc", "onError"]);
44
-
22
+ _ref$type = _ref.type,
23
+ type = _ref$type === void 0 ? 'cover' : _ref$type,
24
+ src = _ref.src,
25
+ _ref$shape = _ref.shape,
26
+ shape = _ref$shape === void 0 ? 'sharp' : _ref$shape,
27
+ _ref$title = _ref.title,
28
+ title = _ref$title === void 0 ? '' : _ref$title,
29
+ _ref$alt = _ref.alt,
30
+ alt = _ref$alt === void 0 ? '' : _ref$alt,
31
+ className = _ref.className,
32
+ style = _ref.style,
33
+ _ref$width = _ref.width,
34
+ width = _ref$width === void 0 ? 'auto' : _ref$width,
35
+ _ref$height = _ref.height,
36
+ height = _ref$height === void 0 ? 'auto' : _ref$height,
37
+ errorImgSrc = _ref.errorImgSrc,
38
+ onError = _ref.onError,
39
+ rest = _objectWithoutProperties(_ref, _excluded);
45
40
  var _useState = useState(src),
46
- _useState2 = _slicedToArray(_useState, 2),
47
- src2 = _useState2[0],
48
- setSrc2 = _useState2[1];
49
-
41
+ _useState2 = _slicedToArray(_useState, 2),
42
+ src2 = _useState2[0],
43
+ setSrc2 = _useState2[1];
50
44
  var handleImgLoadError = function handleImgLoadError() {
51
45
  if (errorImgSrc) {
52
46
  setSrc2(props.errorImgSrc);
53
47
  }
54
-
55
48
  props.onError && props.onError();
56
49
  };
57
-
58
50
  var params = _objectSpread({
59
51
  type: type,
60
52
  src: src2,
@@ -67,10 +59,9 @@ export default (function (props) {
67
59
  height: height,
68
60
  errorImgSrc: errorImgSrc
69
61
  }, rest);
70
-
71
- return React.createElement(Fragment, null, type === 'contain' && React.createElement(Contain, _extends({}, params, {
62
+ return /*#__PURE__*/React.createElement(Fragment, null, type === 'contain' && /*#__PURE__*/React.createElement(Contain, _extends({}, params, {
72
63
  onError: handleImgLoadError
73
- })), type === 'cover' && React.createElement(Cover, _extends({}, params, {
64
+ })), type === 'cover' && /*#__PURE__*/React.createElement(Cover, _extends({}, params, {
74
65
  onError: handleImgLoadError
75
66
  })));
76
67
  });
@@ -1,3 +1,4 @@
1
- import { createContext } from 'react'; // import createActions from './createActions';
1
+ import { createContext } from 'react';
2
+ // import createActions from './createActions';
2
3
 
3
- export default createContext({});
4
+ export default /*#__PURE__*/createContext({});