tntd 1.4.7 → 1.4.8

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 (79) hide show
  1. package/dist/stats.json +38 -38
  2. package/lib/ArrayInput/icon.js +31 -27
  3. package/lib/ArrayInput/index.js +298 -211
  4. package/lib/AuthContext.js +13 -2
  5. package/lib/Columns/index.js +100 -71
  6. package/lib/DevelopmentLogin/LoginModal.js +141 -79
  7. package/lib/DevelopmentLogin/index.js +55 -28
  8. package/lib/Ellipsis/Svg/CopySVG.js +71 -23
  9. package/lib/Ellipsis/Svg/TickSVG.js +49 -17
  10. package/lib/Ellipsis/index.js +154 -148
  11. package/lib/Handle/index.js +109 -72
  12. package/lib/Icon/fonts/iconfont.js +43 -1
  13. package/lib/Icon/iconList.js +8 -119
  14. package/lib/Icon/index.js +45 -13
  15. package/lib/Img/Contain.js +81 -49
  16. package/lib/Img/Cover.js +136 -88
  17. package/lib/Img/index.js +89 -36
  18. package/lib/Layout/ActionsContext.js +11 -2
  19. package/lib/Layout/AppList.js +256 -262
  20. package/lib/Layout/Application.js +135 -119
  21. package/lib/Layout/Avatar.js +137 -137
  22. package/lib/Layout/CompatibleLanguage.js +195 -214
  23. package/lib/Layout/EnterpriseLayout/Avatar.js +168 -156
  24. package/lib/Layout/EnterpriseLayout/Language.js +100 -75
  25. package/lib/Layout/EnterpriseLayout/Theme.js +94 -96
  26. package/lib/Layout/EnterpriseLayout/index.js +45 -32
  27. package/lib/Layout/GlobalNavigation/NavigationPopup.js +407 -335
  28. package/lib/Layout/GlobalNavigation/index.js +158 -110
  29. package/lib/Layout/Header.js +116 -165
  30. package/lib/Layout/HeaderActions.js +129 -132
  31. package/lib/Layout/HeaderNavs.js +113 -90
  32. package/lib/Layout/HeaderTabs.js +278 -312
  33. package/lib/Layout/Iconfont.js +15 -2
  34. package/lib/Layout/Language.js +102 -63
  35. package/lib/Layout/Layout.js +261 -272
  36. package/lib/Layout/Logo.js +87 -132
  37. package/lib/Layout/OrgAppList.js +319 -440
  38. package/lib/Layout/SideMenu.js +343 -429
  39. package/lib/Layout/Theme.js +124 -95
  40. package/lib/Layout/checkAuth.js +35 -21
  41. package/lib/Layout/createActions.js +51 -38
  42. package/lib/Layout/images/index.js +41 -33
  43. package/lib/Layout/index.js +161 -110
  44. package/lib/Layout/paaslayout/CompactSideMenu.js +178 -200
  45. package/lib/Layout/paaslayout/Header.js +90 -84
  46. package/lib/Layout/paaslayout/Logo.js +32 -27
  47. package/lib/Layout/paaslayout/SideMenu.js +174 -161
  48. package/lib/Layout/paaslayout/index.js +261 -240
  49. package/lib/Layout/storage.js +78 -20
  50. package/lib/Layout/utils.js +143 -93
  51. package/lib/LoadingButton/index.js +67 -25
  52. package/lib/Modal/index.js +108 -83
  53. package/lib/Page/Box.js +81 -56
  54. package/lib/Page/index.js +173 -151
  55. package/lib/Page/utils.js +30 -12
  56. package/lib/QueryForm/Field/Checkbox.js +33 -11
  57. package/lib/QueryForm/Field/Select.js +99 -63
  58. package/lib/QueryForm/Field/SelectInput.js +114 -69
  59. package/lib/QueryForm/Field/fieldsMap.js +52 -30
  60. package/lib/QueryForm/Field/index.js +158 -76
  61. package/lib/QueryForm/createActions.js +65 -50
  62. package/lib/QueryForm/index.js +383 -304
  63. package/lib/QueryForm/useForm.js +17 -6
  64. package/lib/QueryListScene/List.js +366 -290
  65. package/lib/QueryListScene/QueryForm.js +161 -93
  66. package/lib/QueryListScene/QueryListScene.js +87 -33
  67. package/lib/QueryListScene/Title.js +20 -10
  68. package/lib/QueryListScene/Toolbar.js +31 -8
  69. package/lib/QueryListScene/createActions.js +79 -64
  70. package/lib/QueryListScene/index.js +40 -23
  71. package/lib/QueryListScene/useActions.js +17 -6
  72. package/lib/Select/DropDownWrap.js +124 -60
  73. package/lib/Select/index.js +561 -425
  74. package/lib/Table/ResizableTable/index.js +121 -77
  75. package/lib/Table/index.js +51 -19
  76. package/lib/Title/index.js +52 -34
  77. package/lib/index.js +159 -19
  78. package/lib/locale.js +63 -48
  79. package/package.json +1 -1
@@ -1,18 +1,50 @@
1
- export default props => {
2
- return <div {...props}>
3
- <svg width="17px" height="16px" viewBox="0 0 17 16">
4
- <g id="全家桶视觉方案优化" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
- <g id="工作台1" transform="translate(-754.000000, -299.000000)">
6
- <g id="分组-6" transform="translate(240.000000, 96.000000)">
7
- <g id="编组-18" transform="translate(0.000000, 171.000000)">
8
- <g id="复制成功" transform="translate(514.500000, 32.000000)">
9
- <rect id="矩形" fill-opacity="0.01" fill="#FFFFFF" fill-rule="nonzero" x="0" y="0" width="16" height="16"></rect>
10
- <polyline id="路径" stroke="#07C790" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" points="14.3333333 3.66666667 5.625 12.3333333 1.66666667 8.39393333"></polyline>
11
- </g>
12
- </g>
13
- </g>
14
- </g>
15
- </g>
16
- </svg>
17
- </div>;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _default = function _default(props) {
9
+ return React.createElement("div", props, React.createElement("svg", {
10
+ width: "17px",
11
+ height: "16px",
12
+ viewBox: "0 0 17 16"
13
+ }, React.createElement("g", {
14
+ id: "\u5168\u5BB6\u6876\u89C6\u89C9\u65B9\u6848\u4F18\u5316",
15
+ stroke: "none",
16
+ "stroke-width": "1",
17
+ fill: "none",
18
+ "fill-rule": "evenodd"
19
+ }, React.createElement("g", {
20
+ id: "\u5DE5\u4F5C\u53F01",
21
+ transform: "translate(-754.000000, -299.000000)"
22
+ }, React.createElement("g", {
23
+ id: "\u5206\u7EC4-6",
24
+ transform: "translate(240.000000, 96.000000)"
25
+ }, React.createElement("g", {
26
+ id: "\u7F16\u7EC4-18",
27
+ transform: "translate(0.000000, 171.000000)"
28
+ }, React.createElement("g", {
29
+ id: "\u590D\u5236\u6210\u529F",
30
+ transform: "translate(514.500000, 32.000000)"
31
+ }, React.createElement("rect", {
32
+ id: "\u77E9\u5F62",
33
+ "fill-opacity": "0.01",
34
+ fill: "#FFFFFF",
35
+ "fill-rule": "nonzero",
36
+ x: "0",
37
+ y: "0",
38
+ width: "16",
39
+ height: "16"
40
+ }), React.createElement("polyline", {
41
+ id: "\u8DEF\u5F84",
42
+ stroke: "#07C790",
43
+ "stroke-width": "1.2",
44
+ "stroke-linecap": "round",
45
+ "stroke-linejoin": "round",
46
+ points: "14.3333333 3.66666667 5.625 12.3333333 1.66666667 8.39393333"
47
+ }))))))));
18
48
  };
49
+
50
+ exports["default"] = _default;
@@ -1,151 +1,157 @@
1
- /*
2
- * @Author: 梁洪刚
3
- * @CreatDate: 2021-03-31 13:57:32
4
- * @Describe: 省略号组件
5
- */
6
-
7
- import { useState, useEffect, useRef } from 'react';
8
- import { Popover, Tooltip } from 'antd';
9
- import copy from 'copy-to-clipboard';
10
- import CopySVG from './Svg/CopySVG';
11
- import TickSVG from './Svg/TickSVG';
12
- import './index.less';
13
-
14
- const tolerance = 0; // In px. Depends on the font you are using
15
-
16
- const isEllipsisActive = (e) => {
17
- return e.offsetWidth + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ require("antd/lib/tooltip/style");
9
+
10
+ var _tooltip = _interopRequireDefault(require("antd/lib/tooltip"));
11
+
12
+ require("antd/lib/popover/style");
13
+
14
+ var _popover2 = _interopRequireDefault(require("antd/lib/popover"));
15
+
16
+ var _react = require("react");
17
+
18
+ var _copyToClipboard = _interopRequireDefault(require("copy-to-clipboard"));
19
+
20
+ var _CopySVG = _interopRequireDefault(require("./Svg/CopySVG"));
21
+
22
+ var _TickSVG = _interopRequireDefault(require("./Svg/TickSVG"));
23
+
24
+ require("./index.less");
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
+
28
+ 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; }
29
+
30
+ 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; }
31
+
32
+ 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; }
33
+
34
+ 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); }
35
+
36
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
37
+
38
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
39
+
40
+ 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; }
41
+
42
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
+
44
+ var tolerance = 0; // In px. Depends on the font you are using
45
+
46
+ var isEllipsisActive = function isEllipsisActive(e) {
47
+ return e.offsetWidth + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight;
18
48
  };
19
49
 
20
- export default props => {
21
- let {
22
- _popover = props.Popover, // `Popover` or `Tooltip` ?
23
- title, // in most cases for `Tooltip`
24
- content, // in most cases for `Popover`
25
- className,
26
- style,
27
- widthLimit, // width trigger value
28
- _lines = props.lines !== 1 && props.lines, // number or lines, default 1 line;
29
- children, // children Node
30
- emptyText, // default: null
31
- _copyable = props.copyable, // copy function
32
- prefix, // 前缀dom
33
- suffix // 后缀dom
34
- } = props;
35
-
36
- // allow visible or not state
37
- const [flag, setFlag] = useState(true);
38
- // visible[Tooltip/Popover] state
39
- const [tipVisible, setTipVisible] = useState(false);
40
- // copy animation state
41
- const [hasCopy, setHasCopy] = useState(false);
42
-
43
- const elementRef = useRef();
44
-
45
- useEffect(() => {
46
- elementRef.current && isEllipsisActive(elementRef.current)
47
- ? setFlag(true)
48
- : (
49
- setFlag(false),
50
- setTipVisible(false)
51
- );
52
- });
53
-
54
- // original Node
55
- const inner = typeof children === 'string' ? children : (_popover ? content : title);
56
-
57
- // for className
58
- const getClassName = () => {
59
- return `overflow ${_lines ? 'ellipsis-wrap' : 'ellipsis-nowrap'} ${className || ''}`;
60
- };
61
-
62
- // Tooltip.trigger(default 'hover') ==trigger==> onVisibleChange(visible)
63
- const handleVisibleChange = (visible) => {
64
- // const { onVisibleChange } = props;
65
- // onVisibleChange(visible);
66
- flag && setTipVisible(visible);
67
- };
68
-
69
- // onClick Copy Button
70
- const handleCopy = (innerText) => {
71
- copy(innerText);
72
- setHasCopy(!hasCopy);
73
- setTimeout(() => {
74
- setHasCopy(false);
75
- }, 1000);
76
- };
77
-
78
- const renderNode = () => {
79
- const popoverNode = (
80
- <Popover
81
- {...props}
82
- content={content || children}
83
- visible={tipVisible}
84
- onVisibleChange={(visible) => handleVisibleChange(visible)}
85
- >
86
- <div
87
- className={className}
88
- style={{ WebkitLineClamp: _lines }}
89
- ref={elementRef}
90
- >
91
- {children || content}
92
- </div>
93
- </Popover>
94
- );
95
-
96
- const tooltipNode = (
97
- <Tooltip
98
- {...props}
99
- title={title || children}
100
- visible={tipVisible}
101
- onVisibleChange={(visible) => handleVisibleChange(visible)}
102
- >
103
- <div
104
- className={className}
105
- style={{ WebkitLineClamp: _lines }}
106
- ref={elementRef}
107
- >
108
- {children || title}
109
- </div>
110
- </Tooltip>
111
- );
112
-
113
- return _popover ? popoverNode : tooltipNode;
114
-
115
- };
116
-
117
- return <>
118
- <div
119
- className="tnt-ellipsis"
120
- style={{
121
- ...style,
122
- maxWidth: widthLimit
123
- }}
124
- >
125
- {/* prefix */}
126
- {prefix && prefix}
127
- {/* content */}
128
- <div
129
- className={getClassName()}
130
- >
131
- {inner ? renderNode() : emptyText}
132
- </div>
133
- {/* suffix */}
134
- {suffix && suffix}
135
- {/* copyable button */}
136
- {
137
- inner && _copyable &&
138
- <div
139
- className='svg-button'
140
- onClick={() => handleCopy(elementRef.current.innerText)}
141
- >
142
- {
143
- !hasCopy
144
- ? <CopySVG />
145
- : <TickSVG />
146
- }
147
- </div>
148
- }
149
- </div>
150
- </>;
50
+ var _default = function _default(props) {
51
+ var _props$_popover = props._popover,
52
+ _popover = _props$_popover === void 0 ? props.Popover : _props$_popover,
53
+ title = props.title,
54
+ content = props.content,
55
+ className = props.className,
56
+ style = props.style,
57
+ widthLimit = props.widthLimit,
58
+ _props$_lines = props._lines,
59
+ _lines = _props$_lines === void 0 ? props.lines !== 1 && props.lines : _props$_lines,
60
+ children = props.children,
61
+ emptyText = props.emptyText,
62
+ _props$_copyable = props._copyable,
63
+ _copyable = _props$_copyable === void 0 ? props.copyable : _props$_copyable,
64
+ prefix = props.prefix,
65
+ suffix = props.suffix; // allow visible or not state
66
+
67
+
68
+ var _useState = (0, _react.useState)(true),
69
+ _useState2 = _slicedToArray(_useState, 2),
70
+ flag = _useState2[0],
71
+ setFlag = _useState2[1]; // visible[Tooltip/Popover] state
72
+
73
+
74
+ var _useState3 = (0, _react.useState)(false),
75
+ _useState4 = _slicedToArray(_useState3, 2),
76
+ tipVisible = _useState4[0],
77
+ setTipVisible = _useState4[1]; // copy animation state
78
+
79
+
80
+ var _useState5 = (0, _react.useState)(false),
81
+ _useState6 = _slicedToArray(_useState5, 2),
82
+ hasCopy = _useState6[0],
83
+ setHasCopy = _useState6[1];
84
+
85
+ var elementRef = (0, _react.useRef)();
86
+ (0, _react.useEffect)(function () {
87
+ elementRef.current && isEllipsisActive(elementRef.current) ? setFlag(true) : (setFlag(false), setTipVisible(false));
88
+ }); // original Node
89
+
90
+ var inner = typeof children === 'string' ? children : _popover ? content : title; // for className
91
+
92
+ var getClassName = function getClassName() {
93
+ return "overflow ".concat(_lines ? 'ellipsis-wrap' : 'ellipsis-nowrap', " ").concat(className || '');
94
+ }; // Tooltip.trigger(default 'hover') ==trigger==> onVisibleChange(visible)
95
+
96
+
97
+ var handleVisibleChange = function handleVisibleChange(visible) {
98
+ // const { onVisibleChange } = props;
99
+ // onVisibleChange(visible);
100
+ flag && setTipVisible(visible);
101
+ }; // onClick Copy Button
102
+
103
+
104
+ var handleCopy = function handleCopy(innerText) {
105
+ (0, _copyToClipboard["default"])(innerText);
106
+ setHasCopy(!hasCopy);
107
+ setTimeout(function () {
108
+ setHasCopy(false);
109
+ }, 1000);
110
+ };
111
+
112
+ var renderNode = function renderNode() {
113
+ var popoverNode = React.createElement(_popover2["default"], _extends({}, props, {
114
+ content: content || children,
115
+ visible: tipVisible,
116
+ onVisibleChange: function onVisibleChange(visible) {
117
+ return handleVisibleChange(visible);
118
+ }
119
+ }), React.createElement("div", {
120
+ className: className,
121
+ style: {
122
+ WebkitLineClamp: _lines
123
+ },
124
+ ref: elementRef
125
+ }, children || content));
126
+ var tooltipNode = React.createElement(_tooltip["default"], _extends({}, props, {
127
+ title: title || children,
128
+ visible: tipVisible,
129
+ onVisibleChange: function onVisibleChange(visible) {
130
+ return handleVisibleChange(visible);
131
+ }
132
+ }), React.createElement("div", {
133
+ className: className,
134
+ style: {
135
+ WebkitLineClamp: _lines
136
+ },
137
+ ref: elementRef
138
+ }, children || title));
139
+ return _popover ? popoverNode : tooltipNode;
140
+ };
141
+
142
+ return React.createElement(React.Fragment, null, React.createElement("div", {
143
+ className: "tnt-ellipsis",
144
+ style: _objectSpread({}, style, {
145
+ maxWidth: widthLimit
146
+ })
147
+ }, prefix && prefix, React.createElement("div", {
148
+ className: getClassName()
149
+ }, inner ? renderNode() : emptyText), suffix && suffix, inner && _copyable && React.createElement("div", {
150
+ className: "svg-button",
151
+ onClick: function onClick() {
152
+ return handleCopy(elementRef.current.innerText);
153
+ }
154
+ }, !hasCopy ? React.createElement(_CopySVG["default"], null) : React.createElement(_TickSVG["default"], null))));
151
155
  };
156
+
157
+ exports["default"] = _default;
@@ -1,75 +1,112 @@
1
- import { Fragment } from 'react';
2
- import { Dropdown, Menu, Divider } from 'antd';
3
- import Icon from '../Icon';
4
- import './index.less';
5
-
6
- const clsPrefix = 'tnt-more-menus';
7
-
8
- export default props => {
9
- const { children = [], type, num = 3, lang, divider = true, lessOneMoreFit, ...rest } = props || {};
10
- let newChildren = [];
11
- if(Array.isArray(children)){
12
- newChildren = children?.filter(item => !!item) || [];
13
- }else if(children){
14
- newChildren.push(children);
15
- }
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ require("antd/lib/dropdown/style");
9
+
10
+ var _dropdown = _interopRequireDefault(require("antd/lib/dropdown"));
11
+
12
+ require("antd/lib/menu/style");
13
+
14
+ var _menu = _interopRequireDefault(require("antd/lib/menu"));
15
+
16
+ require("antd/lib/divider/style");
17
+
18
+ var _divider = _interopRequireDefault(require("antd/lib/divider"));
19
+
20
+ var _react = require("react");
21
+
22
+ var _Icon = _interopRequireDefault(require("../Icon"));
23
+
24
+ require("./index.less");
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
+
28
+ 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); }
16
29
 
17
- let [preChildPart, lastChildPart] = [newChildren, null];
18
-
19
- // 只有1个时不适配
20
- if (lessOneMoreFit && newChildren.length - num === 1) {
21
- preChildPart = newChildren;
22
- } else if (newChildren && num && !isNaN(num) && newChildren.length > num) {
23
- preChildPart = newChildren.slice(0, num);
24
- lastChildPart = newChildren.slice(num);
25
- };
26
-
27
- if (divider && preChildPart) {
28
- const preChildLen = preChildPart.length;
29
- preChildPart = preChildPart.map((dom, i) => (
30
- <Fragment key = {i}>
31
- {dom}
32
- {
33
- !(
34
- i === (preChildLen - 1) &&
35
- !lastChildPart?.length // 没有更多 且 是最后一个时 不显示 Divider
36
- ) &&
37
- <Divider type="vertical" />
38
- }
39
- </Fragment>
40
- ));
30
+ 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; }
31
+
32
+ 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; }
33
+
34
+ var clsPrefix = 'tnt-more-menus';
35
+
36
+ var _default = function _default(props) {
37
+ var _lastChildPart2, _lastChildPart3;
38
+
39
+ var _ref = props || {},
40
+ _ref$children = _ref.children,
41
+ children = _ref$children === void 0 ? [] : _ref$children,
42
+ type = _ref.type,
43
+ _ref$num = _ref.num,
44
+ num = _ref$num === void 0 ? 3 : _ref$num,
45
+ lang = _ref.lang,
46
+ _ref$divider = _ref.divider,
47
+ divider = _ref$divider === void 0 ? true : _ref$divider,
48
+ lessOneMoreFit = _ref.lessOneMoreFit,
49
+ rest = _objectWithoutProperties(_ref, ["children", "type", "num", "lang", "divider", "lessOneMoreFit"]);
50
+
51
+ var newChildren = [];
52
+
53
+ if (Array.isArray(children)) {
54
+ newChildren = (children == null ? void 0 : children.filter(function (item) {
55
+ return !!item;
56
+ })) || [];
57
+ } else if (children) {
58
+ newChildren.push(children);
59
+ }
60
+
61
+ var preChildPart = newChildren,
62
+ lastChildPart = null; // 只有1个时不适配
63
+
64
+ if (lessOneMoreFit && newChildren.length - num === 1) {
65
+ preChildPart = newChildren;
66
+ } else if (newChildren && num && !isNaN(num) && newChildren.length > num) {
67
+ preChildPart = newChildren.slice(0, num);
68
+ lastChildPart = newChildren.slice(num);
69
+ }
70
+
71
+ ;
72
+
73
+ if (divider && preChildPart) {
74
+ var preChildLen = preChildPart.length;
75
+ preChildPart = preChildPart.map(function (dom, i) {
76
+ var _lastChildPart;
77
+
78
+ return React.createElement(_react.Fragment, {
79
+ key: i
80
+ }, dom, !(i === preChildLen - 1 && !((_lastChildPart = lastChildPart) == null ? void 0 : _lastChildPart.length) // 没有更多 且 是最后一个时 不显示 Divider
81
+ ) && React.createElement(_divider["default"], {
82
+ type: "vertical"
83
+ }));
84
+ });
85
+ }
86
+
87
+ var menu = React.createElement(_menu["default"], {
88
+ className: "org-pop-opera-btn"
89
+ }, (_lastChildPart2 = lastChildPart) == null ? void 0 : _lastChildPart2.map(function (child, i) {
90
+ return React.createElement(_menu["default"].Item, {
91
+ key: i
92
+ }, child);
93
+ }));
94
+ return React.createElement("div", _extends({
95
+ onClick: function onClick(e) {
96
+ e.stopPropagation();
41
97
  }
42
- const menu = (
43
- <Menu className="org-pop-opera-btn">
44
- {
45
- lastChildPart?.map(
46
- (child,i) => <Menu.Item key={i}>{child}</Menu.Item>
47
- )
48
- }
49
- </Menu>
50
- );
51
-
52
- return (
53
- <div
54
- onClick={(e) => { e.stopPropagation(); }}
55
- {...rest}
56
- >
57
- {preChildPart}
58
- {
59
- lastChildPart?.length > 0 &&
60
- <Dropdown overlay={menu} arrow>
61
- {
62
- type === 'icon' ?
63
- <Icon type="more" /> :
64
- <a className="ant-dropdown-more">
65
- {lang === 'en' ? 'More' : '更多'}
66
- <i className={`${clsPrefix}-dropdown-icon`}>
67
- <Icon type="down" />
68
- </i>
69
- </a>
70
- }
71
- </Dropdown>
72
- }
73
- </div>
74
- );
98
+ }, rest), preChildPart, ((_lastChildPart3 = lastChildPart) == null ? void 0 : _lastChildPart3.length) > 0 && React.createElement(_dropdown["default"], {
99
+ overlay: menu,
100
+ arrow: true
101
+ }, type === 'icon' ? React.createElement(_Icon["default"], {
102
+ type: "more"
103
+ }) : React.createElement("a", {
104
+ className: "ant-dropdown-more"
105
+ }, lang === 'en' ? 'More' : '更多', React.createElement("i", {
106
+ className: "".concat(clsPrefix, "-dropdown-icon")
107
+ }, React.createElement(_Icon["default"], {
108
+ type: "down"
109
+ })))));
75
110
  };
111
+
112
+ exports["default"] = _default;