tntd 1.4.4 → 1.4.7
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.
- package/components/Layout/HeaderActions.js +90 -128
- package/components/LoadingButton/index.js +11 -15
- package/components/QueryListScene/QueryForm.js +7 -4
- package/dist/stats.json +4990 -4990
- package/dist/tntd.js +1 -1
- package/es/Layout/HeaderActions.js +10 -10
- package/es/LoadingButton/index.js +20 -10
- package/es/QueryListScene/QueryForm.js +6 -3
- package/lib/ArrayInput/icon.js +27 -31
- package/lib/ArrayInput/index.js +211 -298
- package/lib/AuthContext.js +2 -13
- package/lib/Columns/index.js +71 -100
- package/lib/DevelopmentLogin/LoginModal.js +79 -141
- package/lib/DevelopmentLogin/index.js +28 -55
- package/lib/Ellipsis/Svg/CopySVG.js +23 -71
- package/lib/Ellipsis/Svg/TickSVG.js +17 -49
- package/lib/Ellipsis/index.js +148 -154
- package/lib/Handle/index.js +72 -109
- package/lib/Icon/fonts/iconfont.js +1 -43
- package/lib/Icon/iconList.js +119 -8
- package/lib/Icon/index.js +13 -45
- package/lib/Img/Contain.js +49 -81
- package/lib/Img/Cover.js +88 -136
- package/lib/Img/index.js +36 -89
- package/lib/Layout/ActionsContext.js +2 -11
- package/lib/Layout/AppList.js +262 -256
- package/lib/Layout/Application.js +119 -135
- package/lib/Layout/Avatar.js +137 -137
- package/lib/Layout/CompatibleLanguage.js +214 -195
- package/lib/Layout/EnterpriseLayout/Avatar.js +156 -168
- package/lib/Layout/EnterpriseLayout/Language.js +75 -100
- package/lib/Layout/EnterpriseLayout/Theme.js +96 -94
- package/lib/Layout/EnterpriseLayout/index.js +32 -45
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +335 -407
- package/lib/Layout/GlobalNavigation/index.js +110 -158
- package/lib/Layout/Header.js +165 -116
- package/lib/Layout/HeaderActions.js +132 -129
- package/lib/Layout/HeaderNavs.js +90 -113
- package/lib/Layout/HeaderTabs.js +312 -278
- package/lib/Layout/Iconfont.js +2 -15
- package/lib/Layout/Language.js +63 -102
- package/lib/Layout/Layout.js +272 -261
- package/lib/Layout/Logo.js +132 -87
- package/lib/Layout/OrgAppList.js +440 -319
- package/lib/Layout/SideMenu.js +429 -343
- package/lib/Layout/Theme.js +95 -124
- package/lib/Layout/checkAuth.js +21 -35
- package/lib/Layout/createActions.js +38 -51
- package/lib/Layout/images/index.js +33 -41
- package/lib/Layout/index.js +110 -161
- package/lib/Layout/paaslayout/CompactSideMenu.js +200 -178
- package/lib/Layout/paaslayout/Header.js +84 -90
- package/lib/Layout/paaslayout/Logo.js +27 -32
- package/lib/Layout/paaslayout/SideMenu.js +161 -174
- package/lib/Layout/paaslayout/index.js +240 -261
- package/lib/Layout/storage.js +20 -78
- package/lib/Layout/utils.js +93 -143
- package/lib/LoadingButton/index.js +25 -57
- package/lib/Modal/index.js +83 -108
- package/lib/Page/Box.js +56 -81
- package/lib/Page/index.js +151 -173
- package/lib/Page/utils.js +12 -30
- package/lib/QueryForm/Field/Checkbox.js +11 -33
- package/lib/QueryForm/Field/Select.js +63 -99
- package/lib/QueryForm/Field/SelectInput.js +69 -114
- package/lib/QueryForm/Field/fieldsMap.js +30 -52
- package/lib/QueryForm/Field/index.js +76 -158
- package/lib/QueryForm/createActions.js +50 -65
- package/lib/QueryForm/index.js +304 -383
- package/lib/QueryForm/useForm.js +6 -17
- package/lib/QueryListScene/List.js +290 -366
- package/lib/QueryListScene/QueryForm.js +93 -158
- package/lib/QueryListScene/QueryListScene.js +33 -87
- package/lib/QueryListScene/Title.js +10 -20
- package/lib/QueryListScene/Toolbar.js +8 -31
- package/lib/QueryListScene/createActions.js +64 -79
- package/lib/QueryListScene/index.js +23 -40
- package/lib/QueryListScene/useActions.js +6 -17
- package/lib/Select/DropDownWrap.js +60 -124
- package/lib/Select/index.js +425 -561
- package/lib/Table/ResizableTable/index.js +77 -121
- package/lib/Table/index.js +19 -51
- package/lib/Title/index.js +34 -52
- package/lib/index.js +19 -159
- package/lib/locale.js +48 -63
- package/package.json +1 -1
- package/lib/Layout/EnterpriseLayout/Header.js +0 -113
- package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
package/lib/Icon/iconList.js
CHANGED
|
@@ -1,8 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
export default [
|
|
2
|
+
'system',
|
|
3
|
+
'entry',
|
|
4
|
+
'permission',
|
|
5
|
+
'graph',
|
|
6
|
+
'guanjia',
|
|
7
|
+
'case',
|
|
8
|
+
'celve1',
|
|
9
|
+
'shoucang',
|
|
10
|
+
'deal-type',
|
|
11
|
+
'pm',
|
|
12
|
+
'shoukuan',
|
|
13
|
+
'zhibiao',
|
|
14
|
+
'puzzle',
|
|
15
|
+
'user-group',
|
|
16
|
+
'yuce',
|
|
17
|
+
'jianmo',
|
|
18
|
+
'zhuanzhang',
|
|
19
|
+
'yunwei',
|
|
20
|
+
'baozhang',
|
|
21
|
+
'jizhang',
|
|
22
|
+
'tongji',
|
|
23
|
+
'pingfen',
|
|
24
|
+
'limit',
|
|
25
|
+
'spider',
|
|
26
|
+
'loan',
|
|
27
|
+
'access',
|
|
28
|
+
'role',
|
|
29
|
+
'org',
|
|
30
|
+
'celve',
|
|
31
|
+
'book',
|
|
32
|
+
'tag',
|
|
33
|
+
'shixufenxipeizhi',
|
|
34
|
+
'all-cases',
|
|
35
|
+
'xianeguanli',
|
|
36
|
+
'api',
|
|
37
|
+
'network',
|
|
38
|
+
'analysis',
|
|
39
|
+
'calendar',
|
|
40
|
+
'backup',
|
|
41
|
+
'all',
|
|
42
|
+
'attachment',
|
|
43
|
+
'chart-line',
|
|
44
|
+
'branches',
|
|
45
|
+
'chart-area',
|
|
46
|
+
'clock',
|
|
47
|
+
'check',
|
|
48
|
+
'charging-setting',
|
|
49
|
+
'chart-pie-alt',
|
|
50
|
+
'dashboard',
|
|
51
|
+
'datebase',
|
|
52
|
+
'check-reply',
|
|
53
|
+
'datacenter',
|
|
54
|
+
'connection',
|
|
55
|
+
'download',
|
|
56
|
+
'date-set',
|
|
57
|
+
'event',
|
|
58
|
+
'event-wait',
|
|
59
|
+
'fieldanalysis',
|
|
60
|
+
'exchange',
|
|
61
|
+
'knowledge',
|
|
62
|
+
'key',
|
|
63
|
+
'log',
|
|
64
|
+
'list',
|
|
65
|
+
'menu',
|
|
66
|
+
'index',
|
|
67
|
+
'project',
|
|
68
|
+
'monitorin',
|
|
69
|
+
'pointmap',
|
|
70
|
+
'ranking',
|
|
71
|
+
'model',
|
|
72
|
+
'plan',
|
|
73
|
+
'task',
|
|
74
|
+
'wait',
|
|
75
|
+
'upload',
|
|
76
|
+
'question-list',
|
|
77
|
+
'read',
|
|
78
|
+
'setting',
|
|
79
|
+
'reply',
|
|
80
|
+
'jinjianguanli',
|
|
81
|
+
'change-theme',
|
|
82
|
+
'application',
|
|
83
|
+
'flag-en',
|
|
84
|
+
'flag-cn',
|
|
85
|
+
'down',
|
|
86
|
+
'up',
|
|
87
|
+
'workflow',
|
|
88
|
+
'sync',
|
|
89
|
+
'folder',
|
|
90
|
+
'database',
|
|
91
|
+
'circle',
|
|
92
|
+
'edit',
|
|
93
|
+
'edit-color',
|
|
94
|
+
'box',
|
|
95
|
+
'layer',
|
|
96
|
+
'box-color',
|
|
97
|
+
'home-color',
|
|
98
|
+
'record',
|
|
99
|
+
'monitor',
|
|
100
|
+
'time-color',
|
|
101
|
+
'user',
|
|
102
|
+
'function-color',
|
|
103
|
+
'record-color',
|
|
104
|
+
'warning-color',
|
|
105
|
+
'layer-color',
|
|
106
|
+
'template',
|
|
107
|
+
'template-color',
|
|
108
|
+
'monitor-color',
|
|
109
|
+
'search',
|
|
110
|
+
'user-color',
|
|
111
|
+
'function',
|
|
112
|
+
'warning',
|
|
113
|
+
'search-color',
|
|
114
|
+
'home',
|
|
115
|
+
'time',
|
|
116
|
+
'application',
|
|
117
|
+
'plus',
|
|
118
|
+
'minus'
|
|
119
|
+
];
|
package/lib/Icon/index.js
CHANGED
|
@@ -1,46 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
require("./fonts/iconfont");
|
|
15
|
-
|
|
16
|
-
require("./index.less");
|
|
17
|
-
|
|
18
|
-
var _iconList = _interopRequireDefault(require("./iconList"));
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
|
-
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); }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
-
|
|
28
|
-
var _default = function _default(_ref) {
|
|
29
|
-
var type = _ref.type,
|
|
30
|
-
_ref$prefix = _ref.prefix,
|
|
31
|
-
prefix = _ref$prefix === void 0 ? 'tnt-' : _ref$prefix,
|
|
32
|
-
_ref$className = _ref.className,
|
|
33
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
34
|
-
props = _objectWithoutProperties(_ref, ["type", "prefix", "className"]);
|
|
35
|
-
|
|
36
|
-
return React.createElement("i", _extends({
|
|
37
|
-
className: "tnt-icon ".concat(className),
|
|
38
|
-
type: type
|
|
39
|
-
}, props), React.createElement("svg", {
|
|
40
|
-
"aria-hidden": "true"
|
|
41
|
-
}, React.createElement("use", {
|
|
42
|
-
xlinkHref: "#".concat(prefix).concat(type)
|
|
43
|
-
})));
|
|
1
|
+
import './fonts/iconfont';
|
|
2
|
+
import './index.less';
|
|
3
|
+
|
|
4
|
+
export { default as iconList } from './iconList';
|
|
5
|
+
|
|
6
|
+
export default ({ type, prefix = 'tnt-', className = '', ...props }) => {
|
|
7
|
+
return (
|
|
8
|
+
<i className={`tnt-icon ${className}`} type={type} {...props}>
|
|
9
|
+
<svg aria-hidden="true">
|
|
10
|
+
<use xlinkHref={`#${prefix}${type}`} />
|
|
11
|
+
</svg>
|
|
12
|
+
</i>
|
|
13
|
+
);
|
|
44
14
|
};
|
|
45
|
-
|
|
46
|
-
exports["default"] = _default;
|
package/lib/Img/Contain.js
CHANGED
|
@@ -1,82 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} else if (shape === 'circle') {
|
|
51
|
-
styles.borderRadius = '50%';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var centerStyles = {
|
|
55
|
-
width: width,
|
|
56
|
-
height: height,
|
|
57
|
-
display: 'table-cell',
|
|
58
|
-
verticalAlign: 'middle',
|
|
59
|
-
textAlign: 'center'
|
|
60
|
-
};
|
|
61
|
-
var imgStyles = {
|
|
62
|
-
width: 'auto',
|
|
63
|
-
height: 'auto',
|
|
64
|
-
maxWidth: width,
|
|
65
|
-
maxHeight: height
|
|
66
|
-
};
|
|
67
|
-
var cls = (0, _classnames["default"])('tntd-img', shape, className);
|
|
68
|
-
return _react["default"].createElement("div", _extends({
|
|
69
|
-
className: cls,
|
|
70
|
-
style: styles
|
|
71
|
-
}, others), _react["default"].createElement("div", {
|
|
72
|
-
style: centerStyles
|
|
73
|
-
}, _react["default"].createElement("img", {
|
|
74
|
-
style: imgStyles,
|
|
75
|
-
onError: onError,
|
|
76
|
-
src: src,
|
|
77
|
-
alt: alt,
|
|
78
|
-
title: title
|
|
79
|
-
})));
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export default props => {
|
|
5
|
+
const { alt, title, src, width, height, style = {}, className, onError, shape, errorImgSrc, type, ...others } = props;
|
|
6
|
+
|
|
7
|
+
const styles = {
|
|
8
|
+
...style,
|
|
9
|
+
display: 'inline-block',
|
|
10
|
+
width,
|
|
11
|
+
height,
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
};
|
|
14
|
+
if (shape === 'rounded') {
|
|
15
|
+
styles.borderRadius = '5px';
|
|
16
|
+
} else if (shape === 'circle') {
|
|
17
|
+
styles.borderRadius = '50%';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const centerStyles = {
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
23
|
+
display: 'table-cell',
|
|
24
|
+
verticalAlign: 'middle',
|
|
25
|
+
textAlign: 'center',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const imgStyles = {
|
|
29
|
+
width: 'auto',
|
|
30
|
+
height: 'auto',
|
|
31
|
+
maxWidth: width,
|
|
32
|
+
maxHeight: height,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const cls = classnames('tntd-img', shape, className);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className={cls} style={styles} {...others}>
|
|
39
|
+
<div style={centerStyles}>
|
|
40
|
+
<img
|
|
41
|
+
style={imgStyles}
|
|
42
|
+
onError={onError}
|
|
43
|
+
src={src}
|
|
44
|
+
alt={alt}
|
|
45
|
+
title={title}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
80
50
|
};
|
|
81
|
-
|
|
82
|
-
exports["default"] = _default;
|
package/lib/Img/Cover.js
CHANGED
|
@@ -1,144 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_props$style = props.style,
|
|
47
|
-
style = _props$style === void 0 ? {} : _props$style,
|
|
48
|
-
className = props.className,
|
|
49
|
-
onError = props.onError,
|
|
50
|
-
shape = props.shape,
|
|
51
|
-
errorImgSrc = props.errorImgSrc,
|
|
52
|
-
type = props.type,
|
|
53
|
-
others = _objectWithoutProperties(props, ["alt", "title", "src", "width", "height", "style", "className", "onError", "shape", "errorImgSrc", "type"]);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useEffect, useState, useRef } from 'react';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
|
|
5
|
+
export default props => {
|
|
6
|
+
const { alt, title, src, width, height, style = {}, className, onError, shape, errorImgSrc, type, ...others } = props;
|
|
7
|
+
const imgRef = useRef();
|
|
8
|
+
const [imgStyles, setImgStyles] = useState({
|
|
9
|
+
display: 'block',
|
|
10
|
+
maxWidth: 'none',
|
|
11
|
+
width: 'auto',
|
|
12
|
+
height: 'auto',
|
|
13
|
+
// transition: 'opacity 0.2s ease',
|
|
14
|
+
opacity: 0,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const getStyles = (wrapWidth, wrapHeight, imgWidth, imgHeight) => {
|
|
18
|
+
// 进行等比运算
|
|
19
|
+
const wrapRatio = wrapWidth / wrapHeight;
|
|
20
|
+
const imgRatio = imgWidth / imgHeight;
|
|
21
|
+
|
|
22
|
+
let finalWidth = 0;
|
|
23
|
+
let finalHeight = 0;
|
|
24
|
+
let finalMarginTop = 0;
|
|
25
|
+
let finalMarginLeft = 0;
|
|
26
|
+
|
|
27
|
+
if (wrapRatio > imgRatio) {
|
|
28
|
+
// 父框宽度更大,以父框的宽度为准,拉伸图片上移
|
|
29
|
+
finalWidth = wrapWidth;
|
|
30
|
+
finalHeight = finalWidth / imgRatio;
|
|
31
|
+
finalMarginTop = ((finalHeight - wrapHeight) / 2) * -1;
|
|
32
|
+
} else {
|
|
33
|
+
// 父框高度更大,以父框高度为准,拉伸图片左移动
|
|
34
|
+
finalHeight = wrapHeight;
|
|
35
|
+
finalWidth = finalHeight * imgRatio;
|
|
36
|
+
finalMarginLeft = ((finalWidth - wrapWidth) / 2) * -1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
height: finalHeight,
|
|
41
|
+
width: finalWidth,
|
|
42
|
+
marginLeft: finalMarginLeft,
|
|
43
|
+
marginTop: finalMarginTop,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
54
46
|
|
|
55
|
-
|
|
47
|
+
const imgOnload = () => {
|
|
48
|
+
const imgDOM = imgRef.current;
|
|
49
|
+
const { width, height } = props;
|
|
50
|
+
const imgWidth = imgDOM.width;
|
|
51
|
+
const imgHeight = imgDOM.height;
|
|
52
|
+
|
|
53
|
+
const imgStyles2 = getStyles(width, height, imgWidth, imgHeight);
|
|
54
|
+
setImgStyles({
|
|
55
|
+
...imgStyles,
|
|
56
|
+
...imgStyles2,
|
|
57
|
+
opacity: 1,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// transition: 'opacity 0.2s ease',
|
|
63
|
-
opacity: 0
|
|
64
|
-
}),
|
|
65
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
66
|
-
imgStyles = _useState2[0],
|
|
67
|
-
setImgStyles = _useState2[1];
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (width || height) {
|
|
63
|
+
imgOnload();
|
|
64
|
+
}
|
|
65
|
+
}, [width, height]);
|
|
68
66
|
|
|
69
|
-
var getStyles = function getStyles(wrapWidth, wrapHeight, imgWidth, imgHeight) {
|
|
70
|
-
// 进行等比运算
|
|
71
|
-
var wrapRatio = wrapWidth / wrapHeight;
|
|
72
|
-
var imgRatio = imgWidth / imgHeight;
|
|
73
|
-
var finalWidth = 0;
|
|
74
|
-
var finalHeight = 0;
|
|
75
|
-
var finalMarginTop = 0;
|
|
76
|
-
var finalMarginLeft = 0;
|
|
77
67
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// 父框高度更大,以父框高度为准,拉伸图片左移动
|
|
85
|
-
finalHeight = wrapHeight;
|
|
86
|
-
finalWidth = finalHeight * imgRatio;
|
|
87
|
-
finalMarginLeft = (finalWidth - wrapWidth) / 2 * -1;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
height: finalHeight,
|
|
92
|
-
width: finalWidth,
|
|
93
|
-
marginLeft: finalMarginLeft,
|
|
94
|
-
marginTop: finalMarginTop
|
|
68
|
+
const styles = {
|
|
69
|
+
...style,
|
|
70
|
+
display: 'inline-block',
|
|
71
|
+
overflow: 'hidden',
|
|
72
|
+
width,
|
|
73
|
+
height,
|
|
95
74
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var width = props.width,
|
|
101
|
-
height = props.height;
|
|
102
|
-
var imgWidth = imgDOM.width;
|
|
103
|
-
var imgHeight = imgDOM.height;
|
|
104
|
-
var imgStyles2 = getStyles(width, height, imgWidth, imgHeight);
|
|
105
|
-
setImgStyles(_objectSpread({}, imgStyles, {}, imgStyles2, {
|
|
106
|
-
opacity: 1
|
|
107
|
-
}));
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
(0, _react.useEffect)(function () {
|
|
111
|
-
if (width || height) {
|
|
112
|
-
imgOnload();
|
|
75
|
+
if (shape === 'rounded') {
|
|
76
|
+
styles.borderRadius = '5px';
|
|
77
|
+
} else if (shape === 'circle') {
|
|
78
|
+
styles.borderRadius = '50%';
|
|
113
79
|
}
|
|
114
|
-
}, [width, height]);
|
|
115
80
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
className: cls,
|
|
132
|
-
style: styles
|
|
133
|
-
}, others), _react["default"].createElement("img", {
|
|
134
|
-
style: imgStyles,
|
|
135
|
-
onError: onError,
|
|
136
|
-
ref: imgRef,
|
|
137
|
-
src: src,
|
|
138
|
-
alt: alt,
|
|
139
|
-
title: title,
|
|
140
|
-
onLoad: imgOnload
|
|
141
|
-
}));
|
|
81
|
+
const cls = classnames('tntd-img', shape, className);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div className={cls} style={styles} {...others}>
|
|
85
|
+
<img
|
|
86
|
+
style={imgStyles}
|
|
87
|
+
onError={onError}
|
|
88
|
+
ref={imgRef}
|
|
89
|
+
src={src}
|
|
90
|
+
alt={alt}
|
|
91
|
+
title={title}
|
|
92
|
+
onLoad={imgOnload}
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
142
96
|
};
|
|
143
|
-
|
|
144
|
-
exports["default"] = _default;
|