tntd 1.3.65 → 1.4.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.
- package/.eslintignore +2 -1
- package/babel.config.js +2 -2
- package/dist/0645cf743e4e44ca9da321d689897f07.png +0 -0
- package/dist/09db77de0c24fa0f45f8a5cf299a3d11.png +0 -0
- package/dist/1.tntd.js +12 -0
- package/dist/1d0b52448de217857b270af807e9360d.png +0 -0
- package/dist/25d78d77c9c2f0d403e5d899ceb5b1ef.png +0 -0
- package/dist/27fa44ff0c98e1594d79b73045aabedf.png +0 -0
- package/dist/2c95075adb68d6131b59cae9fa554ec2.png +0 -0
- package/dist/377c871d922a25c773a9e7c2f42ed7c0.png +0 -0
- package/dist/3d901589b40bd56ff1fde2bbb700bfe1.png +0 -0
- package/dist/4abe481e130d7be0574e45573de8beb7.png +0 -0
- package/dist/95ee2260a509cd630d89c5367ed1973b.png +0 -0
- package/dist/b9dd5ff3622296fbee51ed68f4bca1bf.png +0 -0
- package/dist/bd2921989f9296089ba58efb7a76f3ef.png +0 -0
- package/dist/stats.json +45855 -0
- package/dist/tntd.css +1 -0
- package/dist/tntd.js +15 -0
- package/es/ArrayInput/README.md +129 -0
- package/es/ArrayInput/icon.js +24 -0
- package/es/ArrayInput/index.js +274 -0
- package/es/ArrayInput/index.less +20 -0
- package/es/AuthContext.js +4 -0
- package/es/Columns/README.md +149 -0
- package/es/Columns/index.js +82 -0
- package/es/Columns/index.less +75 -0
- package/es/DevelopmentLogin/LoginModal.js +117 -0
- package/es/DevelopmentLogin/README.md +49 -0
- package/es/DevelopmentLogin/index.js +40 -0
- package/es/Ellipsis/README.md +104 -0
- package/es/Ellipsis/Svg/CopySVG.js +63 -0
- package/es/Ellipsis/Svg/TickSVG.js +41 -0
- package/es/Ellipsis/index.js +139 -0
- package/es/Ellipsis/index.less +56 -0
- package/es/Handle/README.md +104 -0
- package/es/Handle/index.js +86 -0
- package/es/Handle/index.less +9 -0
- package/es/Icon/README.md +119 -0
- package/es/Icon/fonts/demo.css +539 -0
- package/es/Icon/fonts/demo_index.html +3345 -0
- package/es/Icon/fonts/iconfont.css +569 -0
- package/es/Icon/fonts/iconfont.eot +0 -0
- package/es/Icon/fonts/iconfont.js +41 -0
- package/es/Icon/fonts/iconfont.json +975 -0
- package/es/Icon/fonts/iconfont.svg +440 -0
- package/es/Icon/fonts/iconfont.ttf +0 -0
- package/es/Icon/fonts/iconfont.woff +0 -0
- package/es/Icon/fonts/iconfont.woff2 +0 -0
- package/es/Icon/iconList.js +1 -0
- package/es/Icon/index.js +26 -0
- package/es/Icon/index.less +9 -0
- package/es/Img/Contain.js +69 -0
- package/es/Img/Cover.js +126 -0
- package/es/Img/README.md +131 -0
- package/es/Img/index.js +76 -0
- package/es/Layout/ActionsContext.js +3 -0
- package/es/Layout/AppList.js +223 -0
- package/es/Layout/Application.js +113 -0
- package/es/Layout/Avatar.js +112 -0
- package/es/Layout/CompatibleLanguage.js +177 -0
- package/es/Layout/EnterpriseLayout/Avatar.js +138 -0
- package/es/Layout/EnterpriseLayout/Language.js +81 -0
- package/es/Layout/EnterpriseLayout/Theme.js +75 -0
- package/es/Layout/EnterpriseLayout/index.js +31 -0
- package/es/Layout/GlobalNavigation/NavigationPopup.js +396 -0
- package/es/Layout/GlobalNavigation/index.js +137 -0
- package/es/Layout/Header.js +95 -0
- package/es/Layout/HeaderActions.js +105 -0
- package/es/Layout/HeaderNavs.js +93 -0
- package/es/Layout/HeaderTabs.js +264 -0
- package/es/Layout/Iconfont.js +4 -0
- package/es/Layout/Language.js +81 -0
- package/es/Layout/Layout.js +232 -0
- package/es/Layout/Logo.js +86 -0
- package/es/Layout/OrgAppList.js +304 -0
- package/es/Layout/README.md +783 -0
- package/es/Layout/SideMenu.js +338 -0
- package/es/Layout/Theme.js +105 -0
- package/es/Layout/checkAuth.js +29 -0
- package/es/Layout/createActions.js +39 -0
- package/es/Layout/images/avatar/empty.png +0 -0
- package/es/Layout/images/avatar/female1.png +0 -0
- package/es/Layout/images/avatar/female2.png +0 -0
- package/es/Layout/images/avatar/female3.png +0 -0
- package/es/Layout/images/avatar/female4.png +0 -0
- package/es/Layout/images/avatar/female5.png +0 -0
- package/es/Layout/images/avatar/female6.png +0 -0
- package/es/Layout/images/avatar/male1.png +0 -0
- package/es/Layout/images/avatar/male2.png +0 -0
- package/es/Layout/images/avatar/male3.png +0 -0
- package/es/Layout/images/avatar/male4.png +0 -0
- package/es/Layout/images/avatar/male5.png +0 -0
- package/es/Layout/images/avatar/male6.png +0 -0
- package/es/Layout/images/index.js +35 -0
- package/es/Layout/images/logo/baldur.svg +14 -0
- package/es/Layout/images/logo/bi.svg +14 -0
- package/es/Layout/images/logo/bridge.svg +15 -0
- package/es/Layout/images/logo/convert.svg +18 -0
- package/es/Layout/images/logo/dataocean.svg +31 -0
- package/es/Layout/images/logo/default.svg +19 -0
- package/es/Layout/images/logo/dispatch.svg +14 -0
- package/es/Layout/images/logo/graph.svg +26 -0
- package/es/Layout/images/logo/handle.svg +10 -0
- package/es/Layout/images/logo/indicator.svg +41 -0
- package/es/Layout/images/logo/kafka.svg +12 -0
- package/es/Layout/images/logo/logo-custom.svg +13 -0
- package/es/Layout/images/logo/model.svg +17 -0
- package/es/Layout/images/logo/mysql.svg +15 -0
- package/es/Layout/images/logo/orion.svg +24 -0
- package/es/Layout/images/logo/salaxy.svg +11 -0
- package/es/Layout/images/logo/storage.svg +16 -0
- package/es/Layout/images/logo/tnt_cli_identify.svg +19 -0
- package/es/Layout/images/logo/turing.svg +35 -0
- package/es/Layout/images/theme/theme1.svg +35 -0
- package/es/Layout/images/theme/theme2.svg +33 -0
- package/es/Layout/index.js +122 -0
- package/es/Layout/paaslayout/CompactSideMenu.js +167 -0
- package/es/Layout/paaslayout/Header.js +77 -0
- package/es/Layout/paaslayout/Logo.js +22 -0
- package/es/Layout/paaslayout/SideMenu.js +168 -0
- package/es/Layout/paaslayout/index.js +233 -0
- package/es/Layout/storage.js +47 -0
- package/es/Layout/utils.js +136 -0
- package/es/LoadingButton/README.md +75 -0
- package/es/LoadingButton/index.js +43 -0
- package/es/Modal/README.md +59 -0
- package/es/Modal/index.js +94 -0
- package/es/Modal/index.less +86 -0
- package/es/Page/Box.js +72 -0
- package/es/Page/README.md +180 -0
- package/es/Page/index.js +165 -0
- package/es/Page/index.less +144 -0
- package/es/Page/utils.js +23 -0
- package/es/QueryForm/Field/Checkbox.js +19 -0
- package/es/QueryForm/Field/Select.js +78 -0
- package/es/QueryForm/Field/SelectInput.js +88 -0
- package/es/QueryForm/Field/fieldsMap.js +27 -0
- package/es/QueryForm/Field/index.js +155 -0
- package/es/QueryForm/README.md +512 -0
- package/es/QueryForm/createActions.js +53 -0
- package/es/QueryForm/index.js +376 -0
- package/es/QueryForm/index.less +133 -0
- package/es/QueryForm/useForm.js +7 -0
- package/es/QueryListScene/List.js +376 -0
- package/es/QueryListScene/QueryForm.js +166 -0
- package/es/QueryListScene/QueryListScene.js +76 -0
- package/es/QueryListScene/README.md +790 -0
- package/es/QueryListScene/Title.js +12 -0
- package/es/QueryListScene/Toolbar.js +20 -0
- package/es/QueryListScene/createActions.js +72 -0
- package/es/QueryListScene/index.js +19 -0
- package/es/QueryListScene/index.less +97 -0
- package/es/QueryListScene/useActions.js +7 -0
- package/es/Select/DropDownWrap.js +116 -0
- package/es/Select/README.md +68 -0
- package/es/Select/index.js +618 -0
- package/es/Table/README.md +109 -0
- package/es/Table/ResizableTable/index.js +108 -0
- package/es/Table/ResizableTable/index.less +36 -0
- package/es/Table/index.js +33 -0
- package/es/Title/README.md +106 -0
- package/es/Title/index.js +40 -0
- package/es/Title/index.less +170 -0
- package/es/index.js +19 -0
- package/es/locale.js +60 -0
- package/package.json +1 -1
- package/doc-scripts.config.js +0 -37
- package/doc-scripts.renderer.js +0 -11
- package/docs/README.md +0 -1643
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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); }
|
|
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
|
+
/*
|
|
18
|
+
* @Author: 梁洪刚
|
|
19
|
+
* @CreatDate: 2021-03-31 13:57:32
|
|
20
|
+
* @Describe: 省略号组件
|
|
21
|
+
*/
|
|
22
|
+
import { useState, useEffect, useRef } from 'react';
|
|
23
|
+
import { Popover, Tooltip } from 'antd';
|
|
24
|
+
import copy from 'copy-to-clipboard';
|
|
25
|
+
import CopySVG from './Svg/CopySVG';
|
|
26
|
+
import TickSVG from './Svg/TickSVG';
|
|
27
|
+
import './index.less';
|
|
28
|
+
var tolerance = 0; // In px. Depends on the font you are using
|
|
29
|
+
|
|
30
|
+
var isEllipsisActive = function isEllipsisActive(e) {
|
|
31
|
+
return e.offsetWidth + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default (function (props) {
|
|
35
|
+
var _props$_popover = props._popover,
|
|
36
|
+
_popover = _props$_popover === void 0 ? props.Popover : _props$_popover,
|
|
37
|
+
title = props.title,
|
|
38
|
+
content = props.content,
|
|
39
|
+
className = props.className,
|
|
40
|
+
style = props.style,
|
|
41
|
+
widthLimit = props.widthLimit,
|
|
42
|
+
_props$_lines = props._lines,
|
|
43
|
+
_lines = _props$_lines === void 0 ? props.lines !== 1 && props.lines : _props$_lines,
|
|
44
|
+
children = props.children,
|
|
45
|
+
emptyText = props.emptyText,
|
|
46
|
+
_props$_copyable = props._copyable,
|
|
47
|
+
_copyable = _props$_copyable === void 0 ? props.copyable : _props$_copyable,
|
|
48
|
+
prefix = props.prefix,
|
|
49
|
+
suffix = props.suffix; // allow visible or not state
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var _useState = useState(true),
|
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
+
flag = _useState2[0],
|
|
55
|
+
setFlag = _useState2[1]; // visible[Tooltip/Popover] state
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
var _useState3 = useState(false),
|
|
59
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
60
|
+
tipVisible = _useState4[0],
|
|
61
|
+
setTipVisible = _useState4[1]; // copy animation state
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
var _useState5 = useState(false),
|
|
65
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
66
|
+
hasCopy = _useState6[0],
|
|
67
|
+
setHasCopy = _useState6[1];
|
|
68
|
+
|
|
69
|
+
var elementRef = useRef();
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
elementRef.current && isEllipsisActive(elementRef.current) ? setFlag(true) : (setFlag(false), setTipVisible(false));
|
|
72
|
+
}); // original Node
|
|
73
|
+
|
|
74
|
+
var inner = typeof children === 'string' ? children : _popover ? content : title; // for className
|
|
75
|
+
|
|
76
|
+
var getClassName = function getClassName() {
|
|
77
|
+
return "overflow ".concat(_lines ? 'ellipsis-wrap' : 'ellipsis-nowrap', " ").concat(className || '');
|
|
78
|
+
}; // Tooltip.trigger(default 'hover') ==trigger==> onVisibleChange(visible)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
var handleVisibleChange = function handleVisibleChange(visible) {
|
|
82
|
+
// const { onVisibleChange } = props;
|
|
83
|
+
// onVisibleChange(visible);
|
|
84
|
+
flag && setTipVisible(visible);
|
|
85
|
+
}; // onClick Copy Button
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
var handleCopy = function handleCopy(innerText) {
|
|
89
|
+
copy(innerText);
|
|
90
|
+
setHasCopy(!hasCopy);
|
|
91
|
+
setTimeout(function () {
|
|
92
|
+
setHasCopy(false);
|
|
93
|
+
}, 1000);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var renderNode = function renderNode() {
|
|
97
|
+
var popoverNode = React.createElement(Popover, _extends({}, props, {
|
|
98
|
+
content: content || children,
|
|
99
|
+
visible: tipVisible,
|
|
100
|
+
onVisibleChange: function onVisibleChange(visible) {
|
|
101
|
+
return handleVisibleChange(visible);
|
|
102
|
+
}
|
|
103
|
+
}), React.createElement("div", {
|
|
104
|
+
className: className,
|
|
105
|
+
style: {
|
|
106
|
+
WebkitLineClamp: _lines
|
|
107
|
+
},
|
|
108
|
+
ref: elementRef
|
|
109
|
+
}, children || content));
|
|
110
|
+
var tooltipNode = React.createElement(Tooltip, _extends({}, props, {
|
|
111
|
+
title: title || children,
|
|
112
|
+
visible: tipVisible,
|
|
113
|
+
onVisibleChange: function onVisibleChange(visible) {
|
|
114
|
+
return handleVisibleChange(visible);
|
|
115
|
+
}
|
|
116
|
+
}), React.createElement("div", {
|
|
117
|
+
className: className,
|
|
118
|
+
style: {
|
|
119
|
+
WebkitLineClamp: _lines
|
|
120
|
+
},
|
|
121
|
+
ref: elementRef
|
|
122
|
+
}, children || title));
|
|
123
|
+
return _popover ? popoverNode : tooltipNode;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
127
|
+
"class": "tnt-ellipsis",
|
|
128
|
+
style: _objectSpread({}, style, {
|
|
129
|
+
maxWidth: widthLimit
|
|
130
|
+
})
|
|
131
|
+
}, prefix && prefix, React.createElement("div", {
|
|
132
|
+
"class": getClassName()
|
|
133
|
+
}, inner ? renderNode() : emptyText), suffix && suffix, inner && _copyable && React.createElement("div", {
|
|
134
|
+
"class": "svg-button",
|
|
135
|
+
onClick: function onClick() {
|
|
136
|
+
return handleCopy(elementRef.current.innerText);
|
|
137
|
+
}
|
|
138
|
+
}, !hasCopy ? React.createElement(CopySVG, null) : React.createElement(TickSVG, null))));
|
|
139
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.tnt-ellipsis{
|
|
2
|
+
display:flex;
|
|
3
|
+
.overflow{
|
|
4
|
+
// white-space:nowrap; //溢出不换行
|
|
5
|
+
overflow:hidden; //超出的文本隐藏
|
|
6
|
+
text-overflow:ellipsis; //溢出用省略号显示
|
|
7
|
+
i {
|
|
8
|
+
margin: 0 0.3em;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ellipsis-nowrap{
|
|
13
|
+
white-space:nowrap; //溢出不换行
|
|
14
|
+
& * {
|
|
15
|
+
overflow:hidden; //超出的文本隐藏
|
|
16
|
+
text-overflow:ellipsis; //溢出用省略号显示
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ellipsis-wrap{
|
|
21
|
+
display:-webkit-inline-box;
|
|
22
|
+
-webkit-line-clamp:2;
|
|
23
|
+
-webkit-box-orient:vertical;
|
|
24
|
+
overflow:hidden;
|
|
25
|
+
text-overflow:ellipsis;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.button{
|
|
29
|
+
height:20px;
|
|
30
|
+
width:20px;
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
margin-left: 8px;
|
|
34
|
+
:hover{
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.button-hidden{
|
|
40
|
+
display:none !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.button-active{
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
g{
|
|
46
|
+
animation: copy-active 0.3s;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@keyframes copy-active
|
|
51
|
+
{
|
|
52
|
+
from {stroke: #07C790;}
|
|
53
|
+
to {stroke: #1e90ff;}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
## Handle组件
|
|
2
|
+
### 代码演示
|
|
3
|
+
```jsx
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
6
|
+
import 'antd/dist/antd.css';
|
|
7
|
+
import {Button, Table, Popconfirm} from 'antd';
|
|
8
|
+
import { Handle } from 'tntd';
|
|
9
|
+
|
|
10
|
+
const Demo = props => {
|
|
11
|
+
const dataSource = [
|
|
12
|
+
{
|
|
13
|
+
key: '1',
|
|
14
|
+
name: '胡彦斌',
|
|
15
|
+
age: 32,
|
|
16
|
+
address: '西湖区湖底公园1号',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: '2',
|
|
20
|
+
name: '胡彦祖',
|
|
21
|
+
age: 42,
|
|
22
|
+
address: '西湖区湖底公园1号',
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
const columns = [
|
|
27
|
+
{
|
|
28
|
+
title: '姓名',
|
|
29
|
+
dataIndex: 'name',
|
|
30
|
+
key: 'name',
|
|
31
|
+
width: 500,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: '年龄',
|
|
35
|
+
dataIndex: 'age',
|
|
36
|
+
key: 'age',
|
|
37
|
+
width: 600,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: '住址',
|
|
41
|
+
dataIndex: 'address',
|
|
42
|
+
key: 'address',
|
|
43
|
+
width: 400,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: '操作',
|
|
47
|
+
dataIndex:'opera',
|
|
48
|
+
fixed:"right",
|
|
49
|
+
width: 230,
|
|
50
|
+
render:()=>{
|
|
51
|
+
return (
|
|
52
|
+
<Handle className="custom-class" num={3}>
|
|
53
|
+
<a onClick={()=>{console.log("online")}}>上线</a>
|
|
54
|
+
<a>查看</a>
|
|
55
|
+
<a>编辑</a>
|
|
56
|
+
<a>测试</a>
|
|
57
|
+
{
|
|
58
|
+
false &&
|
|
59
|
+
<a>导入</a>
|
|
60
|
+
}
|
|
61
|
+
<a>导出</a>
|
|
62
|
+
<Popconfirm
|
|
63
|
+
title="Are you sure delete this task?"
|
|
64
|
+
onConfirm={void 0}
|
|
65
|
+
onCancel={void 0}
|
|
66
|
+
okText="Yes"
|
|
67
|
+
cancelText="No"
|
|
68
|
+
onClick={e => e.stopPropagation()}
|
|
69
|
+
getPopupContainer={trigger => trigger.parentNode}
|
|
70
|
+
trigger="hover"
|
|
71
|
+
overlayStyle={{
|
|
72
|
+
width: 300
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
<a>Delete</a>
|
|
76
|
+
</Popconfirm>
|
|
77
|
+
</Handle>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Table dataSource={dataSource} columns={columns} rowKey={(e,i)=>i} scroll={{x:1000}}/>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
ReactDOM.render(
|
|
90
|
+
<Demo />,
|
|
91
|
+
document.getElementById('root')
|
|
92
|
+
);
|
|
93
|
+
```
|
|
94
|
+
### API
|
|
95
|
+
#### Handle
|
|
96
|
+
| 属性名称 | 属性说明 | 类型 | 默认值 | 是否必须 |
|
|
97
|
+
| :---------- | :------------------------------ | :------ | :---------- | :------- |
|
|
98
|
+
| type | 类型,展示“更多”的模式,Icon或者文字 | String | 文字 | 否 |
|
|
99
|
+
| num | 最多展示的个数 | Number | 3 | 否 |
|
|
100
|
+
| lessOneMoreFit | 当更多中等于1个的时候不显示更多 | Bool | false | 否 |
|
|
101
|
+
| divider | 分隔线 | Bool | true | 否 |
|
|
102
|
+
| lang | 中英文 | String | cn | 否 |
|
|
103
|
+
| className | 自定义类名 | String | 无 | 否 |
|
|
104
|
+
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
|
|
7
|
+
import { Fragment } from 'react';
|
|
8
|
+
import { Dropdown, Menu, Divider } from 'antd';
|
|
9
|
+
import Icon from '../Icon';
|
|
10
|
+
import './index.less';
|
|
11
|
+
var clsPrefix = 'tnt-more-menus';
|
|
12
|
+
export default (function (props) {
|
|
13
|
+
var _lastChildPart2, _lastChildPart3;
|
|
14
|
+
|
|
15
|
+
var _ref = props || {},
|
|
16
|
+
_ref$children = _ref.children,
|
|
17
|
+
children = _ref$children === void 0 ? [] : _ref$children,
|
|
18
|
+
type = _ref.type,
|
|
19
|
+
_ref$num = _ref.num,
|
|
20
|
+
num = _ref$num === void 0 ? 3 : _ref$num,
|
|
21
|
+
lang = _ref.lang,
|
|
22
|
+
_ref$divider = _ref.divider,
|
|
23
|
+
divider = _ref$divider === void 0 ? true : _ref$divider,
|
|
24
|
+
lessOneMoreFit = _ref.lessOneMoreFit,
|
|
25
|
+
rest = _objectWithoutProperties(_ref, ["children", "type", "num", "lang", "divider", "lessOneMoreFit"]);
|
|
26
|
+
|
|
27
|
+
var newChildren = [];
|
|
28
|
+
|
|
29
|
+
if (Array.isArray(children)) {
|
|
30
|
+
newChildren = (children == null ? void 0 : children.filter(function (item) {
|
|
31
|
+
return !!item;
|
|
32
|
+
})) || [];
|
|
33
|
+
} else if (children) {
|
|
34
|
+
newChildren.push(children);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var preChildPart = newChildren,
|
|
38
|
+
lastChildPart = null; // 只有1个时不适配
|
|
39
|
+
|
|
40
|
+
if (lessOneMoreFit && newChildren.length - num === 1) {
|
|
41
|
+
preChildPart = newChildren;
|
|
42
|
+
} else if (newChildren && num && !isNaN(num) && newChildren.length > num) {
|
|
43
|
+
preChildPart = newChildren.slice(0, num);
|
|
44
|
+
lastChildPart = newChildren.slice(num);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
;
|
|
48
|
+
|
|
49
|
+
if (divider && preChildPart) {
|
|
50
|
+
var preChildLen = preChildPart.length;
|
|
51
|
+
preChildPart = preChildPart.map(function (dom, i) {
|
|
52
|
+
var _lastChildPart;
|
|
53
|
+
|
|
54
|
+
return React.createElement(Fragment, {
|
|
55
|
+
key: i
|
|
56
|
+
}, dom, !(i === preChildLen - 1 && !((_lastChildPart = lastChildPart) == null ? void 0 : _lastChildPart.length) // 没有更多 且 是最后一个时 不显示 Divider
|
|
57
|
+
) && React.createElement(Divider, {
|
|
58
|
+
type: "vertical"
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var menu = React.createElement(Menu, {
|
|
64
|
+
className: "org-pop-opera-btn"
|
|
65
|
+
}, (_lastChildPart2 = lastChildPart) == null ? void 0 : _lastChildPart2.map(function (child, i) {
|
|
66
|
+
return React.createElement(Menu.Item, {
|
|
67
|
+
key: i
|
|
68
|
+
}, child);
|
|
69
|
+
}));
|
|
70
|
+
return React.createElement("div", _extends({
|
|
71
|
+
onClick: function onClick(e) {
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
}
|
|
74
|
+
}, rest), preChildPart, ((_lastChildPart3 = lastChildPart) == null ? void 0 : _lastChildPart3.length) > 0 && React.createElement(Dropdown, {
|
|
75
|
+
overlay: menu,
|
|
76
|
+
arrow: true
|
|
77
|
+
}, type === 'icon' ? React.createElement(Icon, {
|
|
78
|
+
type: "more"
|
|
79
|
+
}) : React.createElement("a", {
|
|
80
|
+
className: "ant-dropdown-more"
|
|
81
|
+
}, lang === 'en' ? 'More' : '更多', React.createElement("i", {
|
|
82
|
+
className: "".concat(clsPrefix, "-dropdown-icon")
|
|
83
|
+
}, React.createElement(Icon, {
|
|
84
|
+
type: "down"
|
|
85
|
+
})))));
|
|
86
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
## Icon组件
|
|
2
|
+
### 代码演示
|
|
3
|
+
```jsx
|
|
4
|
+
import { Fragment, useState } from 'react';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
6
|
+
import { createGlobalStyle } from 'styled-components';
|
|
7
|
+
import { Icon } from 'tntd';
|
|
8
|
+
import 'antd/dist/antd.css';
|
|
9
|
+
|
|
10
|
+
const GlobalStyle = createGlobalStyle`
|
|
11
|
+
.site-body {
|
|
12
|
+
.ichYgh {
|
|
13
|
+
padding: 0;
|
|
14
|
+
overflow: visible;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
ReactDOM.render(
|
|
20
|
+
<Icon type="analysis" />,
|
|
21
|
+
document.getElementById('root')
|
|
22
|
+
);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
import { Fragment, useState } from 'react';
|
|
27
|
+
import ReactDOM from 'react-dom';
|
|
28
|
+
import styled, { createGlobalStyle } from 'styled-components';
|
|
29
|
+
import { Input } from 'antd';
|
|
30
|
+
import { Icon } from 'tntd';
|
|
31
|
+
import icons from 'tntd/Icon/iconList';
|
|
32
|
+
import 'antd/dist/antd.css';
|
|
33
|
+
|
|
34
|
+
const GlobalStyle = createGlobalStyle`
|
|
35
|
+
.site-body {
|
|
36
|
+
.ichYgh {
|
|
37
|
+
padding: 0;
|
|
38
|
+
overflow: visible;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const IconList = styled.ul`
|
|
44
|
+
margin: 10px 0;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
list-style: none;
|
|
47
|
+
`;
|
|
48
|
+
const IconItem = styled.li`
|
|
49
|
+
position: relative;
|
|
50
|
+
float: left;
|
|
51
|
+
width: 16.66%;
|
|
52
|
+
height: 100px;
|
|
53
|
+
margin: 3px 0;
|
|
54
|
+
padding: 10px 0 0;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
color: #555;
|
|
57
|
+
text-align: center;
|
|
58
|
+
list-style: none;
|
|
59
|
+
background-color: inherit;
|
|
60
|
+
border-radius: 4px;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
-webkit-transition: color 0.3s ease-in-out, background-color 0.3s ease-in-out;
|
|
63
|
+
transition: color 0.3s ease-in-out, background-color 0.3s ease-in-out;
|
|
64
|
+
&:hover {
|
|
65
|
+
color: #fff;
|
|
66
|
+
background-color: #1890ff;
|
|
67
|
+
}
|
|
68
|
+
.tnt-icon {
|
|
69
|
+
margin: 12px 0 8px;
|
|
70
|
+
font-size: 36px;
|
|
71
|
+
-webkit-transition: -webkit-transform 0.3s ease-in-out;
|
|
72
|
+
transition: -webkit-transform 0.3s ease-in-out;
|
|
73
|
+
transition: transform 0.3s ease-in-out;
|
|
74
|
+
transition: transform 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;
|
|
75
|
+
will-change: transform;
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
const IconsDemo = props => {
|
|
80
|
+
const [searchValue, setSearchValue] = useState();
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Fragment>
|
|
84
|
+
<Input.Search
|
|
85
|
+
onChange={evt => setSearchValue(evt.target.value)}
|
|
86
|
+
placeholder="输入icon标识搜索"
|
|
87
|
+
/>
|
|
88
|
+
<IconList>
|
|
89
|
+
{
|
|
90
|
+
icons.filter(
|
|
91
|
+
icon => (!searchValue || new RegExp(searchValue, 'i').test(icon))
|
|
92
|
+
).map(icon => (
|
|
93
|
+
<IconItem key={icon}>
|
|
94
|
+
<Icon type={icon} />
|
|
95
|
+
<p>{icon}</p>
|
|
96
|
+
</IconItem>
|
|
97
|
+
))
|
|
98
|
+
}
|
|
99
|
+
</IconList>
|
|
100
|
+
<GlobalStyle />
|
|
101
|
+
</Fragment>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
ReactDOM.render(
|
|
107
|
+
<IconsDemo />,
|
|
108
|
+
document.getElementById('root')
|
|
109
|
+
);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### API
|
|
114
|
+
#### Icon
|
|
115
|
+
|
|
116
|
+
| 属性名称 | 属性说明 | 类型 | 默认值 | 是否必须 |
|
|
117
|
+
| :---------- | :------------------------------ | :------ | :---------- | :------- |
|
|
118
|
+
| type | icon类型标识 | string | 无 | 是 |
|
|
119
|
+
| prefix | type 前缀 | string | | 否 |
|