tntd 1.3.66 → 1.4.2

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 (168) hide show
  1. package/babel.config.js +1 -1
  2. package/dist/0645cf743e4e44ca9da321d689897f07.png +0 -0
  3. package/dist/09db77de0c24fa0f45f8a5cf299a3d11.png +0 -0
  4. package/dist/1.tntd.js +12 -0
  5. package/dist/1d0b52448de217857b270af807e9360d.png +0 -0
  6. package/dist/25d78d77c9c2f0d403e5d899ceb5b1ef.png +0 -0
  7. package/dist/27fa44ff0c98e1594d79b73045aabedf.png +0 -0
  8. package/dist/2c95075adb68d6131b59cae9fa554ec2.png +0 -0
  9. package/dist/377c871d922a25c773a9e7c2f42ed7c0.png +0 -0
  10. package/dist/3d901589b40bd56ff1fde2bbb700bfe1.png +0 -0
  11. package/dist/4abe481e130d7be0574e45573de8beb7.png +0 -0
  12. package/dist/95ee2260a509cd630d89c5367ed1973b.png +0 -0
  13. package/dist/b9dd5ff3622296fbee51ed68f4bca1bf.png +0 -0
  14. package/dist/bd2921989f9296089ba58efb7a76f3ef.png +0 -0
  15. package/dist/stats.json +45855 -0
  16. package/dist/tntd.css +1 -0
  17. package/dist/tntd.js +15 -0
  18. package/es/ArrayInput/README.md +129 -0
  19. package/es/ArrayInput/icon.js +24 -0
  20. package/es/ArrayInput/index.js +282 -0
  21. package/es/ArrayInput/index.less +20 -0
  22. package/es/AuthContext.js +4 -0
  23. package/es/Columns/README.md +149 -0
  24. package/es/Columns/index.js +86 -0
  25. package/es/Columns/index.less +75 -0
  26. package/es/DevelopmentLogin/LoginModal.js +126 -0
  27. package/es/DevelopmentLogin/README.md +49 -0
  28. package/es/DevelopmentLogin/index.js +40 -0
  29. package/es/Ellipsis/README.md +104 -0
  30. package/es/Ellipsis/Svg/CopySVG.js +63 -0
  31. package/es/Ellipsis/Svg/TickSVG.js +41 -0
  32. package/es/Ellipsis/index.js +143 -0
  33. package/es/Ellipsis/index.less +56 -0
  34. package/es/Handle/README.md +104 -0
  35. package/es/Handle/index.js +92 -0
  36. package/es/Handle/index.less +9 -0
  37. package/es/Icon/README.md +119 -0
  38. package/es/Icon/fonts/demo.css +539 -0
  39. package/es/Icon/fonts/demo_index.html +3345 -0
  40. package/es/Icon/fonts/iconfont.css +569 -0
  41. package/es/Icon/fonts/iconfont.eot +0 -0
  42. package/es/Icon/fonts/iconfont.js +41 -0
  43. package/es/Icon/fonts/iconfont.json +975 -0
  44. package/es/Icon/fonts/iconfont.svg +440 -0
  45. package/es/Icon/fonts/iconfont.ttf +0 -0
  46. package/es/Icon/fonts/iconfont.woff +0 -0
  47. package/es/Icon/fonts/iconfont.woff2 +0 -0
  48. package/es/Icon/iconList.js +1 -0
  49. package/es/Icon/index.js +26 -0
  50. package/es/Icon/index.less +9 -0
  51. package/es/Img/Contain.js +69 -0
  52. package/es/Img/Cover.js +126 -0
  53. package/es/Img/README.md +131 -0
  54. package/es/Img/index.js +76 -0
  55. package/es/Layout/ActionsContext.js +3 -0
  56. package/es/Layout/AppList.js +233 -0
  57. package/es/Layout/Application.js +115 -0
  58. package/es/Layout/Avatar.js +116 -0
  59. package/es/Layout/CompatibleLanguage.js +179 -0
  60. package/es/Layout/EnterpriseLayout/Avatar.js +144 -0
  61. package/es/Layout/EnterpriseLayout/Language.js +81 -0
  62. package/es/Layout/EnterpriseLayout/Theme.js +77 -0
  63. package/es/Layout/EnterpriseLayout/index.js +31 -0
  64. package/es/Layout/GlobalNavigation/NavigationPopup.js +396 -0
  65. package/es/Layout/GlobalNavigation/index.js +137 -0
  66. package/es/Layout/Header.js +95 -0
  67. package/es/Layout/HeaderActions.js +107 -0
  68. package/es/Layout/HeaderNavs.js +93 -0
  69. package/es/Layout/HeaderTabs.js +264 -0
  70. package/es/Layout/Iconfont.js +4 -0
  71. package/es/Layout/Language.js +81 -0
  72. package/es/Layout/Layout.js +234 -0
  73. package/es/Layout/Logo.js +86 -0
  74. package/es/Layout/OrgAppList.js +310 -0
  75. package/es/Layout/README.md +783 -0
  76. package/es/Layout/SideMenu.js +340 -0
  77. package/es/Layout/Theme.js +107 -0
  78. package/es/Layout/checkAuth.js +29 -0
  79. package/es/Layout/createActions.js +39 -0
  80. package/es/Layout/images/avatar/empty.png +0 -0
  81. package/es/Layout/images/avatar/female1.png +0 -0
  82. package/es/Layout/images/avatar/female2.png +0 -0
  83. package/es/Layout/images/avatar/female3.png +0 -0
  84. package/es/Layout/images/avatar/female4.png +0 -0
  85. package/es/Layout/images/avatar/female5.png +0 -0
  86. package/es/Layout/images/avatar/female6.png +0 -0
  87. package/es/Layout/images/avatar/male1.png +0 -0
  88. package/es/Layout/images/avatar/male2.png +0 -0
  89. package/es/Layout/images/avatar/male3.png +0 -0
  90. package/es/Layout/images/avatar/male4.png +0 -0
  91. package/es/Layout/images/avatar/male5.png +0 -0
  92. package/es/Layout/images/avatar/male6.png +0 -0
  93. package/es/Layout/images/index.js +35 -0
  94. package/es/Layout/images/logo/baldur.svg +14 -0
  95. package/es/Layout/images/logo/bi.svg +14 -0
  96. package/es/Layout/images/logo/bridge.svg +15 -0
  97. package/es/Layout/images/logo/convert.svg +18 -0
  98. package/es/Layout/images/logo/dataocean.svg +31 -0
  99. package/es/Layout/images/logo/default.svg +19 -0
  100. package/es/Layout/images/logo/dispatch.svg +14 -0
  101. package/es/Layout/images/logo/graph.svg +26 -0
  102. package/es/Layout/images/logo/handle.svg +10 -0
  103. package/es/Layout/images/logo/indicator.svg +41 -0
  104. package/es/Layout/images/logo/kafka.svg +12 -0
  105. package/es/Layout/images/logo/logo-custom.svg +13 -0
  106. package/es/Layout/images/logo/model.svg +17 -0
  107. package/es/Layout/images/logo/mysql.svg +15 -0
  108. package/es/Layout/images/logo/orion.svg +24 -0
  109. package/es/Layout/images/logo/salaxy.svg +11 -0
  110. package/es/Layout/images/logo/storage.svg +16 -0
  111. package/es/Layout/images/logo/tnt_cli_identify.svg +19 -0
  112. package/es/Layout/images/logo/turing.svg +35 -0
  113. package/es/Layout/images/theme/theme1.svg +35 -0
  114. package/es/Layout/images/theme/theme2.svg +33 -0
  115. package/es/Layout/index.js +122 -0
  116. package/es/Layout/paaslayout/CompactSideMenu.js +167 -0
  117. package/es/Layout/paaslayout/Header.js +77 -0
  118. package/es/Layout/paaslayout/Logo.js +22 -0
  119. package/es/Layout/paaslayout/SideMenu.js +168 -0
  120. package/es/Layout/paaslayout/index.js +235 -0
  121. package/es/Layout/storage.js +47 -0
  122. package/es/Layout/utils.js +136 -0
  123. package/es/LoadingButton/README.md +75 -0
  124. package/es/LoadingButton/index.js +45 -0
  125. package/es/Modal/README.md +59 -0
  126. package/es/Modal/index.js +96 -0
  127. package/es/Modal/index.less +86 -0
  128. package/es/Page/Box.js +74 -0
  129. package/es/Page/README.md +180 -0
  130. package/es/Page/index.js +165 -0
  131. package/es/Page/index.less +144 -0
  132. package/es/Page/utils.js +23 -0
  133. package/es/QueryForm/Field/Checkbox.js +21 -0
  134. package/es/QueryForm/Field/Select.js +80 -0
  135. package/es/QueryForm/Field/SelectInput.js +92 -0
  136. package/es/QueryForm/Field/fieldsMap.js +32 -0
  137. package/es/QueryForm/Field/index.js +157 -0
  138. package/es/QueryForm/README.md +512 -0
  139. package/es/QueryForm/createActions.js +53 -0
  140. package/es/QueryForm/index.js +384 -0
  141. package/es/QueryForm/index.less +133 -0
  142. package/es/QueryForm/useForm.js +7 -0
  143. package/es/QueryListScene/List.js +378 -0
  144. package/es/QueryListScene/QueryForm.js +166 -0
  145. package/es/QueryListScene/QueryListScene.js +76 -0
  146. package/es/QueryListScene/README.md +790 -0
  147. package/es/QueryListScene/Title.js +12 -0
  148. package/es/QueryListScene/Toolbar.js +20 -0
  149. package/es/QueryListScene/createActions.js +72 -0
  150. package/es/QueryListScene/index.js +19 -0
  151. package/es/QueryListScene/index.less +97 -0
  152. package/es/QueryListScene/useActions.js +7 -0
  153. package/es/Select/DropDownWrap.js +116 -0
  154. package/es/Select/README.md +68 -0
  155. package/es/Select/index.js +622 -0
  156. package/es/Table/README.md +109 -0
  157. package/es/Table/ResizableTable/index.js +110 -0
  158. package/es/Table/ResizableTable/index.less +36 -0
  159. package/es/Table/index.js +35 -0
  160. package/es/Title/README.md +106 -0
  161. package/es/Title/index.js +40 -0
  162. package/es/Title/index.less +170 -0
  163. package/es/index.js +19 -0
  164. package/es/locale.js +60 -0
  165. package/package.json +1 -1
  166. package/doc-scripts.config.js +0 -37
  167. package/doc-scripts.renderer.js +0 -11
  168. package/docs/README.md +0 -1643
@@ -0,0 +1,143 @@
1
+ import "antd/lib/tooltip/style";
2
+ import _Tooltip from "antd/lib/tooltip";
3
+ import "antd/lib/popover/style";
4
+ import _Popover from "antd/lib/popover";
5
+
6
+ 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; }
7
+
8
+ 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; }
9
+
10
+ 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; }
11
+
12
+ 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); }
13
+
14
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
15
+
16
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
17
+
18
+ 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; }
19
+
20
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
+
22
+ /*
23
+ * @Author: 梁洪刚
24
+ * @CreatDate: 2021-03-31 13:57:32
25
+ * @Describe: 省略号组件
26
+ */
27
+ import { useState, useEffect, useRef } from 'react';
28
+ import copy from 'copy-to-clipboard';
29
+ import CopySVG from './Svg/CopySVG';
30
+ import TickSVG from './Svg/TickSVG';
31
+ import './index.less';
32
+ var tolerance = 0; // In px. Depends on the font you are using
33
+
34
+ var isEllipsisActive = function isEllipsisActive(e) {
35
+ return e.offsetWidth + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight;
36
+ };
37
+
38
+ export default (function (props) {
39
+ var _props$_popover = props._popover,
40
+ _popover = _props$_popover === void 0 ? props.Popover : _props$_popover,
41
+ title = props.title,
42
+ content = props.content,
43
+ className = props.className,
44
+ style = props.style,
45
+ widthLimit = props.widthLimit,
46
+ _props$_lines = props._lines,
47
+ _lines = _props$_lines === void 0 ? props.lines !== 1 && props.lines : _props$_lines,
48
+ children = props.children,
49
+ emptyText = props.emptyText,
50
+ _props$_copyable = props._copyable,
51
+ _copyable = _props$_copyable === void 0 ? props.copyable : _props$_copyable,
52
+ prefix = props.prefix,
53
+ suffix = props.suffix; // allow visible or not state
54
+
55
+
56
+ var _useState = useState(true),
57
+ _useState2 = _slicedToArray(_useState, 2),
58
+ flag = _useState2[0],
59
+ setFlag = _useState2[1]; // visible[Tooltip/Popover] state
60
+
61
+
62
+ var _useState3 = useState(false),
63
+ _useState4 = _slicedToArray(_useState3, 2),
64
+ tipVisible = _useState4[0],
65
+ setTipVisible = _useState4[1]; // copy animation state
66
+
67
+
68
+ var _useState5 = useState(false),
69
+ _useState6 = _slicedToArray(_useState5, 2),
70
+ hasCopy = _useState6[0],
71
+ setHasCopy = _useState6[1];
72
+
73
+ var elementRef = useRef();
74
+ useEffect(function () {
75
+ elementRef.current && isEllipsisActive(elementRef.current) ? setFlag(true) : (setFlag(false), setTipVisible(false));
76
+ }); // original Node
77
+
78
+ var inner = typeof children === 'string' ? children : _popover ? content : title; // for className
79
+
80
+ var getClassName = function getClassName() {
81
+ return "overflow ".concat(_lines ? 'ellipsis-wrap' : 'ellipsis-nowrap', " ").concat(className || '');
82
+ }; // Tooltip.trigger(default 'hover') ==trigger==> onVisibleChange(visible)
83
+
84
+
85
+ var handleVisibleChange = function handleVisibleChange(visible) {
86
+ // const { onVisibleChange } = props;
87
+ // onVisibleChange(visible);
88
+ flag && setTipVisible(visible);
89
+ }; // onClick Copy Button
90
+
91
+
92
+ var handleCopy = function handleCopy(innerText) {
93
+ copy(innerText);
94
+ setHasCopy(!hasCopy);
95
+ setTimeout(function () {
96
+ setHasCopy(false);
97
+ }, 1000);
98
+ };
99
+
100
+ var renderNode = function renderNode() {
101
+ var popoverNode = React.createElement(_Popover, _extends({}, props, {
102
+ content: content || children,
103
+ visible: tipVisible,
104
+ onVisibleChange: function onVisibleChange(visible) {
105
+ return handleVisibleChange(visible);
106
+ }
107
+ }), React.createElement("div", {
108
+ className: className,
109
+ style: {
110
+ WebkitLineClamp: _lines
111
+ },
112
+ ref: elementRef
113
+ }, children || content));
114
+ var tooltipNode = React.createElement(_Tooltip, _extends({}, props, {
115
+ title: title || children,
116
+ visible: tipVisible,
117
+ onVisibleChange: function onVisibleChange(visible) {
118
+ return handleVisibleChange(visible);
119
+ }
120
+ }), React.createElement("div", {
121
+ className: className,
122
+ style: {
123
+ WebkitLineClamp: _lines
124
+ },
125
+ ref: elementRef
126
+ }, children || title));
127
+ return _popover ? popoverNode : tooltipNode;
128
+ };
129
+
130
+ return React.createElement(React.Fragment, null, React.createElement("div", {
131
+ "class": "tnt-ellipsis",
132
+ style: _objectSpread({}, style, {
133
+ maxWidth: widthLimit
134
+ })
135
+ }, prefix && prefix, React.createElement("div", {
136
+ "class": getClassName()
137
+ }, inner ? renderNode() : emptyText), suffix && suffix, inner && _copyable && React.createElement("div", {
138
+ "class": "svg-button",
139
+ onClick: function onClick() {
140
+ return handleCopy(elementRef.current.innerText);
141
+ }
142
+ }, !hasCopy ? React.createElement(CopySVG, null) : React.createElement(TickSVG, null))));
143
+ });
@@ -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,92 @@
1
+ import "antd/lib/dropdown/style";
2
+ import _Dropdown from "antd/lib/dropdown";
3
+ import "antd/lib/menu/style";
4
+ import _Menu from "antd/lib/menu";
5
+ import "antd/lib/divider/style";
6
+ import _Divider from "antd/lib/divider";
7
+
8
+ 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); }
9
+
10
+ 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; }
11
+
12
+ 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; }
13
+
14
+ import { Fragment } from 'react';
15
+ import Icon from '../Icon';
16
+ import './index.less';
17
+ var clsPrefix = 'tnt-more-menus';
18
+ export default (function (props) {
19
+ var _lastChildPart2, _lastChildPart3;
20
+
21
+ var _ref = props || {},
22
+ _ref$children = _ref.children,
23
+ children = _ref$children === void 0 ? [] : _ref$children,
24
+ type = _ref.type,
25
+ _ref$num = _ref.num,
26
+ num = _ref$num === void 0 ? 3 : _ref$num,
27
+ lang = _ref.lang,
28
+ _ref$divider = _ref.divider,
29
+ divider = _ref$divider === void 0 ? true : _ref$divider,
30
+ lessOneMoreFit = _ref.lessOneMoreFit,
31
+ rest = _objectWithoutProperties(_ref, ["children", "type", "num", "lang", "divider", "lessOneMoreFit"]);
32
+
33
+ var newChildren = [];
34
+
35
+ if (Array.isArray(children)) {
36
+ newChildren = (children == null ? void 0 : children.filter(function (item) {
37
+ return !!item;
38
+ })) || [];
39
+ } else if (children) {
40
+ newChildren.push(children);
41
+ }
42
+
43
+ var preChildPart = newChildren,
44
+ lastChildPart = null; // 只有1个时不适配
45
+
46
+ if (lessOneMoreFit && newChildren.length - num === 1) {
47
+ preChildPart = newChildren;
48
+ } else if (newChildren && num && !isNaN(num) && newChildren.length > num) {
49
+ preChildPart = newChildren.slice(0, num);
50
+ lastChildPart = newChildren.slice(num);
51
+ }
52
+
53
+ ;
54
+
55
+ if (divider && preChildPart) {
56
+ var preChildLen = preChildPart.length;
57
+ preChildPart = preChildPart.map(function (dom, i) {
58
+ var _lastChildPart;
59
+
60
+ return React.createElement(Fragment, {
61
+ key: i
62
+ }, dom, !(i === preChildLen - 1 && !((_lastChildPart = lastChildPart) == null ? void 0 : _lastChildPart.length) // 没有更多 且 是最后一个时 不显示 Divider
63
+ ) && React.createElement(_Divider, {
64
+ type: "vertical"
65
+ }));
66
+ });
67
+ }
68
+
69
+ var menu = React.createElement(_Menu, {
70
+ className: "org-pop-opera-btn"
71
+ }, (_lastChildPart2 = lastChildPart) == null ? void 0 : _lastChildPart2.map(function (child, i) {
72
+ return React.createElement(_Menu.Item, {
73
+ key: i
74
+ }, child);
75
+ }));
76
+ return React.createElement("div", _extends({
77
+ onClick: function onClick(e) {
78
+ e.stopPropagation();
79
+ }
80
+ }, rest), preChildPart, ((_lastChildPart3 = lastChildPart) == null ? void 0 : _lastChildPart3.length) > 0 && React.createElement(_Dropdown, {
81
+ overlay: menu,
82
+ arrow: true
83
+ }, type === 'icon' ? React.createElement(Icon, {
84
+ type: "more"
85
+ }) : React.createElement("a", {
86
+ className: "ant-dropdown-more"
87
+ }, lang === 'en' ? 'More' : '更多', React.createElement("i", {
88
+ className: "".concat(clsPrefix, "-dropdown-icon")
89
+ }, React.createElement(Icon, {
90
+ type: "down"
91
+ })))));
92
+ });
@@ -0,0 +1,9 @@
1
+ .tnt-more-menus {
2
+ // display: flex;
3
+ // align-items: center;
4
+
5
+ &-dropdown-icon {
6
+ font-size: 12px;
7
+ margin-left: 2px;
8
+ }
9
+ }
@@ -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 | | 否 |