@lemon-fe/components 0.1.0-alpha.0 → 0.1.0

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 (47) hide show
  1. package/es/Actions/index.js +21 -13
  2. package/es/Actions/index.less +25 -25
  3. package/es/BaseTable/Actions.d.ts +8 -0
  4. package/es/BaseTable/Actions.js +119 -0
  5. package/es/BaseTable/index.js +21 -29
  6. package/es/BaseTable/index.less +58 -2
  7. package/es/BaseTable/typings.d.ts +8 -4
  8. package/es/DurationPicker/index.js +2 -10
  9. package/es/DurationPicker/index.less +4 -4
  10. package/es/Filter/index.js +4 -7
  11. package/es/Filter/index.less +1 -0
  12. package/es/FormLayout/index.less +1 -1
  13. package/es/Icons/Calendar.d.ts +5 -0
  14. package/es/Icons/Calendar.js +47 -0
  15. package/es/Icons/Down.js +0 -1
  16. package/es/Icons/More.d.ts +5 -0
  17. package/es/Icons/More.js +44 -0
  18. package/es/Icons/index.d.ts +4 -0
  19. package/es/Icons/index.js +5 -1
  20. package/es/Layout/index.less +0 -4
  21. package/es/MainFramework/components/{DownBar → DropMenu}/index.d.ts +1 -1
  22. package/es/MainFramework/components/DropMenu/index.js +104 -0
  23. package/es/MainFramework/components/DropMenu/index.less +59 -0
  24. package/es/MainFramework/components/Menu/index.js +4 -8
  25. package/es/MainFramework/components/Menu/index.less +3 -3
  26. package/es/MainFramework/components/RefreshButton/index.d.ts +5 -0
  27. package/es/MainFramework/components/RefreshButton/index.js +72 -0
  28. package/es/MainFramework/components/RefreshButton/index.less +30 -0
  29. package/es/MainFramework/components/TabBar/index.js +64 -3
  30. package/es/MainFramework/components/TabBar/index.less +14 -0
  31. package/es/MainFramework/index.d.ts +3 -0
  32. package/es/MainFramework/index.js +12 -57
  33. package/es/MainFramework/index.less +10 -3
  34. package/es/SiderTree/index.less +12 -4
  35. package/es/SymbolIcon/index.d.ts +8 -0
  36. package/es/SymbolIcon/index.js +32 -0
  37. package/es/SymbolIcon/index.less +7 -0
  38. package/es/index.d.ts +1 -0
  39. package/es/index.js +2 -1
  40. package/es/index.less +3 -123
  41. package/es/init.js +4 -1
  42. package/es/overrides.less +136 -0
  43. package/es/theme.less +1 -8
  44. package/es/utils.less +53 -0
  45. package/package.json +3 -3
  46. package/es/MainFramework/components/DownBar/index.js +0 -84
  47. package/es/MainFramework/components/DownBar/index.less +0 -108
@@ -0,0 +1,44 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : 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
+ import React from 'react';
8
+ import Icon from '@ant-design/icons';
9
+
10
+ var MoreSvg = function MoreSvg(props) {
11
+ return /*#__PURE__*/React.createElement("svg", _objectSpread({
12
+ width: "18",
13
+ height: "18",
14
+ viewBox: "0 0 18 18",
15
+ xmlns: "http://www.w3.org/2000/svg"
16
+ }, props), /*#__PURE__*/React.createElement("g", {
17
+ fill: "currentColor",
18
+ "fill-rule": "evenodd"
19
+ }, /*#__PURE__*/React.createElement("circle", {
20
+ opacity: ".7",
21
+ cx: "15",
22
+ cy: "9",
23
+ r: "1.5"
24
+ }), /*#__PURE__*/React.createElement("circle", {
25
+ opacity: ".7",
26
+ cx: "9",
27
+ cy: "9",
28
+ r: "1.5"
29
+ }), /*#__PURE__*/React.createElement("circle", {
30
+ opacity: ".7",
31
+ cx: "3",
32
+ cy: "9",
33
+ r: "1.5"
34
+ })));
35
+ };
36
+
37
+ export default function More(props) {
38
+ return /*#__PURE__*/React.createElement(Icon, _objectSpread({
39
+ style: {
40
+ pointerEvents: 'none'
41
+ },
42
+ component: MoreSvg
43
+ }, props));
44
+ }
@@ -2,11 +2,15 @@ import Down from './Down';
2
2
  import Search from './Search';
3
3
  import Tip from './Tip';
4
4
  import DarkSearch from './DarkSearch';
5
+ import More from './More';
6
+ import Calendar from './Calendar';
5
7
  declare const Icons: {
6
8
  Search: typeof Search;
7
9
  Down: typeof Down;
8
10
  Tip: typeof Tip;
9
11
  Empty: () => JSX.Element;
10
12
  DarkSearch: typeof DarkSearch;
13
+ More: typeof More;
14
+ Calendar: typeof Calendar;
11
15
  };
12
16
  export default Icons;
package/es/Icons/index.js CHANGED
@@ -3,11 +3,15 @@ import Search from './Search';
3
3
  import Tip from './Tip';
4
4
  import Empty from './Empty';
5
5
  import DarkSearch from './DarkSearch';
6
+ import More from './More';
7
+ import Calendar from './Calendar';
6
8
  var Icons = {
7
9
  Search: Search,
8
10
  Down: Down,
9
11
  Tip: Tip,
10
12
  Empty: Empty,
11
- DarkSearch: DarkSearch
13
+ DarkSearch: DarkSearch,
14
+ More: More,
15
+ Calendar: Calendar
12
16
  };
13
17
  export default Icons;
@@ -49,10 +49,6 @@
49
49
  background-color: #e6e6e6;
50
50
  content: '';
51
51
  }
52
-
53
- & > .@{prefixCls}-tree-wrapper > .@{prefixCls}-tree-header {
54
- padding-right: 12px;
55
- }
56
52
  }
57
53
 
58
54
  &-collapse {
@@ -1,4 +1,4 @@
1
- export default function DownBar<T extends {
1
+ export default function DropMenu<T extends {
2
2
  title: string;
3
3
  closable?: boolean;
4
4
  }>(props: {
@@ -0,0 +1,104 @@
1
+ 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; }
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ import React, { useState } from 'react';
16
+ import classNames from 'classnames';
17
+ import { PREFIX_CLS as prefixCls } from '../../../constants';
18
+ import { Popover } from 'antd';
19
+ export default function DropMenu(props) {
20
+ var tabs = props.tabs,
21
+ active = props.active,
22
+ _props$visible = props.visible,
23
+ visible = _props$visible === void 0 ? false : _props$visible,
24
+ onClick = props.onClick,
25
+ onClose = props.onClose;
26
+
27
+ var _useState = useState(false),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ popVisible = _useState2[0],
30
+ setPopVisible = _useState2[1];
31
+
32
+ var handleClose = function handleClose(e, index) {
33
+ e.stopPropagation();
34
+ onClose(index);
35
+ };
36
+
37
+ var handleClick = function handleClick(index) {
38
+ onClick(index);
39
+ setPopVisible(false);
40
+ };
41
+
42
+ return /*#__PURE__*/React.createElement(Popover, {
43
+ visible: popVisible,
44
+ onVisibleChange: setPopVisible,
45
+ overlayClassName: "".concat(prefixCls, "-nav-menu-pop"),
46
+ trigger: "click",
47
+ placement: "bottomRight",
48
+ content: /*#__PURE__*/React.createElement("div", {
49
+ className: "".concat(prefixCls, "-nav-menu-tabs")
50
+ }, tabs.map(function (item, index) {
51
+ var key = item.title;
52
+ return /*#__PURE__*/React.createElement("div", {
53
+ className: classNames("".concat(prefixCls, "-nav-menu-tab"), _defineProperty({}, "".concat(prefixCls, "-nav-menu-tab-active"), index === active)),
54
+ onClick: function onClick() {
55
+ return handleClick(index);
56
+ },
57
+ key: key
58
+ }, item.title, item.closable !== false && /*#__PURE__*/React.createElement("div", {
59
+ className: "".concat(prefixCls, "-nav-menu-tab-close"),
60
+ onClick: function onClick(e) {
61
+ return handleClose(e, index);
62
+ }
63
+ }, /*#__PURE__*/React.createElement("svg", {
64
+ width: "14",
65
+ height: "14",
66
+ xmlns: "http://www.w3.org/2000/svg"
67
+ }, /*#__PURE__*/React.createElement("g", {
68
+ fill: "none",
69
+ fillRule: "evenodd"
70
+ }, /*#__PURE__*/React.createElement("g", {
71
+ fill: "currentColor"
72
+ }, /*#__PURE__*/React.createElement("g", {
73
+ fillRule: "nonzero"
74
+ }, /*#__PURE__*/React.createElement("path", {
75
+ d: "M7.74992318,2.75006802 L7.74992318,11.250068 C7.74992318,11.6642816 7.41413675,12.000068 6.99992318,12.000068 C6.58570962,12.000068 6.24992318,11.6642816 6.24992318,11.250068 L6.24992318,2.75006802 C6.24992318,2.33585446 6.58570962,2.00006802 6.99992318,2.00006802 C7.41413675,2.00006802 7.74992318,2.33585446 7.74992318,2.75006802 Z",
76
+ transform: "translate(-367.000000, -21.000000) translate(367.000000, 21.000000) translate(6.999923, 7.000068) rotate(45.000000) translate(-6.999923, -7.000068)"
77
+ }), /*#__PURE__*/React.createElement("path", {
78
+ d: "M7.74994595,2.75007682 L7.74994595,11.2500768 C7.74994595,11.6642904 7.41415952,12.0000768 6.99994595,12.0000768 C6.58573239,12.0000768 6.24994595,11.6642904 6.24994595,11.2500768 L6.24994595,2.75007682 C6.24994595,2.33586325 6.58573239,2.00007682 6.99994595,2.00007682 C7.41415952,2.00007682 7.74994595,2.33586325 7.74994595,2.75007682 Z",
79
+ transform: "translate(-367.000000, -21.000000) translate(367.000000, 21.000000) translate(6.999946, 7.000077) rotate(-45.000000) translate(-6.999946, -7.000077)"
80
+ })))))));
81
+ }))
82
+ }, /*#__PURE__*/React.createElement("div", {
83
+ className: classNames("".concat(prefixCls, "-nav-menu-drop-icon"), _defineProperty({}, "".concat(prefixCls, "-nav-menu-drop-icon-active"), popVisible)),
84
+ style: visible ? {
85
+ visibility: 'visible'
86
+ } : {
87
+ visibility: 'hidden'
88
+ }
89
+ }, /*#__PURE__*/React.createElement("svg", {
90
+ width: "20",
91
+ height: "20",
92
+ viewBox: "0 0 20 20",
93
+ xmlns: "http://www.w3.org/2000/svg"
94
+ }, /*#__PURE__*/React.createElement("path", {
95
+ d: "M5.757 7.757 10 12l4.243-4.243",
96
+ stroke: "currentColor",
97
+ strokeWidth: "1.5",
98
+ strokeLinecap: "round",
99
+ strokeLinejoin: "round",
100
+ strokeDasharray: "0,0",
101
+ fill: "none",
102
+ fillRule: "evenodd"
103
+ }))));
104
+ }
@@ -0,0 +1,59 @@
1
+ .@{prefixCls}-nav-menu {
2
+ &-pop {
3
+ .popover(160px);
4
+ }
5
+
6
+ &-tabs {
7
+ position: relative;
8
+ }
9
+
10
+ &-tab {
11
+ .popoverItem();
12
+
13
+ &:hover {
14
+ background-color: #eee;
15
+ }
16
+
17
+ &-active {
18
+ color: @primary-color;
19
+ background-color: .primary(0.1) [] !important;
20
+ }
21
+
22
+ &-close {
23
+ position: absolute;
24
+ top: 10px;
25
+ right: 12px;
26
+ display: none;
27
+ box-sizing: border-box;
28
+ width: 16px;
29
+ height: 16px;
30
+ padding: 1px;
31
+ line-height: 1;
32
+
33
+ &:hover {
34
+ color: @primary-color;
35
+ }
36
+ }
37
+
38
+ &:hover &-close {
39
+ display: block;
40
+ }
41
+ }
42
+
43
+ &-drop-icon {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ width: 34px;
48
+ height: 34px;
49
+ color: #6d6d6d;
50
+ border-radius: 50%;
51
+ cursor: pointer;
52
+
53
+ &:hover,
54
+ &-active {
55
+ color: #333;
56
+ background-color: #f7f7f7;
57
+ }
58
+ }
59
+ }
@@ -406,7 +406,7 @@ export default function Menu(props) {
406
406
  overflow: 'hidden'
407
407
  }
408
408
  }, item.name), /*#__PURE__*/React.createElement("div", {
409
- className: classNames("".concat(prefixCls, "-menu-item-favorite"), _defineProperty({}, "".concat(prefixCls, "-menu-item-favorite-active"), favorited)),
409
+ className: "".concat(prefixCls, "-menu-item-favorite"),
410
410
  onClick: function onClick(e) {
411
411
  toggleFavorite(e, item);
412
412
  }
@@ -544,11 +544,11 @@ export default function Menu(props) {
544
544
  strokeDasharray: "0,0",
545
545
  transform: "translate(-274.000000, -57.000000) translate(284.000000, 67.000000) scale(-1, 1) translate(-284.000000, -67.000000) translate(274.000000, 57.000000) translate(8.535522, 10.000000) rotate(-45.000000) translate(-8.535522, -10.000000)"
546
546
  })))))), menus.map(function (item, index) {
547
- var _classNames6;
547
+ var _classNames5;
548
548
 
549
549
  return /*#__PURE__*/React.createElement("div", {
550
550
  key: index,
551
- className: classNames("".concat(prefixCls, "-menu-top-item"), (_classNames6 = {}, _defineProperty(_classNames6, "".concat(prefixCls, "-menu-top-item-active"), activeMenu !== undefined && activeMenu.path[0] === index), _defineProperty(_classNames6, "".concat(prefixCls, "-menu-top-item-popover-active"), item === popover), _classNames6)),
551
+ className: classNames("".concat(prefixCls, "-menu-top-item"), (_classNames5 = {}, _defineProperty(_classNames5, "".concat(prefixCls, "-menu-top-item-active"), activeMenu !== undefined && activeMenu.path[0] === index), _defineProperty(_classNames5, "".concat(prefixCls, "-menu-top-item-popover-active"), item === popover), _classNames5)),
552
552
  onClick: function onClick() {
553
553
  return handleClick(item);
554
554
  },
@@ -587,11 +587,7 @@ export default function Menu(props) {
587
587
  className: "".concat(prefixCls, "-menu-icon")
588
588
  }, favoriteIcon), /*#__PURE__*/React.createElement("div", {
589
589
  className: "".concat(prefixCls, "-menu-title")
590
- }, "\u6536\u85CF")), /*#__PURE__*/React.createElement("div", {
591
- className: classNames("".concat(prefixCls, "-menu-divider-div"), _defineProperty({}, "".concat(prefixCls, "-menu-divider-div-collapsed"), collapsed))
592
- }, /*#__PURE__*/React.createElement(Divider, {
593
- className: "".concat(prefixCls, "-menu-divider")
594
- }))), false && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
590
+ }, "\u6536\u85CF"))), false && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
595
591
  className: "".concat(prefixCls, "-menu-gutter")
596
592
  }), collapsed ? /*#__PURE__*/React.createElement("div", {
597
593
  className: "".concat(prefixCls, "-menu-top-item"),
@@ -167,7 +167,7 @@
167
167
 
168
168
  & > span {
169
169
  margin-top: 24px;
170
- color: #333333;
170
+ color: #333;
171
171
  font-weight: 400;
172
172
  font-size: 14px;
173
173
  line-height: 22px;
@@ -215,7 +215,7 @@
215
215
  &-favorite {
216
216
  display: none;
217
217
 
218
- &-active {
218
+ &:hover {
219
219
  display: block;
220
220
  }
221
221
 
@@ -263,7 +263,7 @@
263
263
 
264
264
  &-other-title {
265
265
  margin: 0 0 8px 16px;
266
- color: #000000;
266
+ color: #000;
267
267
  font-weight: 400;
268
268
  font-size: 14px;
269
269
  line-height: 22px;
@@ -0,0 +1,5 @@
1
+ export default function RefreshButton(props: {
2
+ onRefresh: () => void;
3
+ onCloseOther: () => void;
4
+ onCloseAll: () => void;
5
+ }): JSX.Element;
@@ -0,0 +1,72 @@
1
+ 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; }
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ import { Popover } from 'antd';
16
+ import classNames from 'classnames';
17
+ import React, { useState } from 'react';
18
+ import { PREFIX_CLS as prefixCls } from '../../../constants';
19
+ export default function RefreshButton(props) {
20
+ var onRefresh = props.onRefresh,
21
+ onCloseOther = props.onCloseOther,
22
+ onCloseAll = props.onCloseAll;
23
+
24
+ var _useState = useState(false),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ popVisible = _useState2[0],
27
+ setPopVisible = _useState2[1];
28
+
29
+ return /*#__PURE__*/React.createElement(Popover, {
30
+ visible: popVisible,
31
+ onVisibleChange: setPopVisible,
32
+ trigger: "click",
33
+ overlayClassName: "".concat(prefixCls, "-refresh-down-pop"),
34
+ placement: "bottomRight",
35
+ content: /*#__PURE__*/React.createElement("div", {
36
+ className: "".concat(prefixCls, "-refresh-down-tabs")
37
+ }, /*#__PURE__*/React.createElement("div", {
38
+ className: "".concat(prefixCls, "-refresh-down-tab"),
39
+ onClick: function onClick() {
40
+ onRefresh();
41
+ setPopVisible(false);
42
+ }
43
+ }, "\u5237\u65B0\u5F53\u524D\u9875"), /*#__PURE__*/React.createElement("div", {
44
+ className: "".concat(prefixCls, "-refresh-down-tab"),
45
+ onClick: function onClick() {
46
+ onCloseOther();
47
+ setPopVisible(false);
48
+ }
49
+ }, "\u5173\u95ED\u5176\u4ED6\u9875"), /*#__PURE__*/React.createElement("div", {
50
+ className: "".concat(prefixCls, "-refresh-down-tab"),
51
+ onClick: function onClick() {
52
+ onCloseAll();
53
+ setPopVisible(false);
54
+ }
55
+ }, "\u5173\u95ED\u5168\u90E8\u9875"))
56
+ }, /*#__PURE__*/React.createElement("div", {
57
+ className: classNames("".concat(prefixCls, "-refresh-button-icon"), _defineProperty({}, "".concat(prefixCls, "-refresh-button-icon-active"), popVisible))
58
+ }, /*#__PURE__*/React.createElement("svg", {
59
+ width: "20",
60
+ height: "20",
61
+ xmlns: "http://www.w3.org/2000/svg"
62
+ }, /*#__PURE__*/React.createElement("path", {
63
+ d: "M17 10.06a7 7 0 0 1-13.033 3.492V17m-.96-7.33a7 7 0 0 1 12.884-3.453V3",
64
+ stroke: "currentColor",
65
+ strokeWidth: "1.5",
66
+ opacity: ".9",
67
+ strokeLinecap: "round",
68
+ strokeLinejoin: "round",
69
+ fill: "none",
70
+ fillRule: "evenodd"
71
+ }))));
72
+ }
@@ -0,0 +1,30 @@
1
+ .@{prefixCls}-refresh-button-icon {
2
+ width: 34px;
3
+ height: 34px;
4
+ margin-left: 7px;
5
+ padding: 7px;
6
+ color: #6d6d6d;
7
+ border-radius: 50%;
8
+ cursor: pointer;
9
+ transition: background-color 0.2s;
10
+
11
+ &:hover,
12
+ &-active {
13
+ color: #333;
14
+ background-color: #f3f3f3;
15
+ }
16
+ }
17
+
18
+ .@{prefixCls}-refresh-down {
19
+ display: flex;
20
+ align-items: center;
21
+ line-height: 1;
22
+
23
+ &-tab {
24
+ .popoverItem();
25
+ }
26
+
27
+ &-pop {
28
+ .popover();
29
+ }
30
+ }
@@ -1,25 +1,78 @@
1
1
  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; }
2
2
 
3
- import React from 'react';
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ import React, { useEffect, useRef, useState } from 'react';
4
16
  import classNames from 'classnames';
5
17
  import { PREFIX_CLS as prefixCls } from '../../../constants';
18
+ import DropMenu from '../DropMenu';
19
+ import { useDebounce } from '@lemon-fe/hooks';
6
20
  export default function TabBar(props) {
7
21
  var tabs = props.tabs,
8
22
  active = props.active,
9
23
  _onClick = props.onClick,
10
24
  onClose = props.onClose;
11
25
 
26
+ var _useState = useState(false),
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ hideTabs = _useState2[0],
29
+ setHideTabs = _useState2[1];
30
+
31
+ var tabRef = useRef(null);
32
+
12
33
  var handleClose = function handleClose(e, index) {
13
34
  e.stopPropagation();
14
35
  onClose(index);
15
36
  };
16
37
 
38
+ var handleDropMenu = useDebounce(function () {
39
+ var _tabRef$current, _tabRef$current$query;
40
+
41
+ if (tabRef.current === null) {
42
+ return;
43
+ }
44
+
45
+ var barWidth = (_tabRef$current = tabRef.current) === null || _tabRef$current === void 0 ? void 0 : _tabRef$current.offsetWidth;
46
+ var iconWidth = (_tabRef$current$query = tabRef.current.querySelector(".".concat(prefixCls, "-nav-tabs-layout-icon"))) === null || _tabRef$current$query === void 0 ? void 0 : _tabRef$current$query.offsetWidth;
47
+ var minWidth = 66 * tabs.length + 32;
48
+ var width = barWidth - (iconWidth || 0);
49
+
50
+ if (tabs.length && minWidth >= width) {
51
+ setHideTabs(true);
52
+ } else if (minWidth < width) {
53
+ setHideTabs(false);
54
+ }
55
+ }, 300);
56
+ useEffect(function () {
57
+ window.addEventListener('resize', handleDropMenu);
58
+ return function () {
59
+ window.removeEventListener('resize', handleDropMenu);
60
+ };
61
+ }, []);
62
+ useEffect(function () {
63
+ handleDropMenu();
64
+ }, [tabs, active]);
17
65
  return /*#__PURE__*/React.createElement("div", {
66
+ className: "".concat(prefixCls, "-nav-tabs-layout"),
67
+ ref: tabRef
68
+ }, /*#__PURE__*/React.createElement("div", {
18
69
  className: "".concat(prefixCls, "-nav-tabs")
19
70
  }, tabs.map(function (item, index) {
71
+ var _classNames;
72
+
20
73
  var key = item.title;
21
74
  return /*#__PURE__*/React.createElement("div", {
22
- className: classNames("".concat(prefixCls, "-nav-tab"), _defineProperty({}, "".concat(prefixCls, "-nav-tab-active"), index === active)),
75
+ className: classNames("".concat(prefixCls, "-nav-tab"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-nav-tab-active"), index === active), _defineProperty(_classNames, "".concat(prefixCls, "-nav-tabs-end"), index === tabs.length - 1), _classNames)),
23
76
  onClick: function onClick() {
24
77
  return _onClick(index);
25
78
  },
@@ -51,5 +104,13 @@ export default function TabBar(props) {
51
104
  d: "M7.74994595,2.75007682 L7.74994595,11.2500768 C7.74994595,11.6642904 7.41415952,12.0000768 6.99994595,12.0000768 C6.58573239,12.0000768 6.24994595,11.6642904 6.24994595,11.2500768 L6.24994595,2.75007682 C6.24994595,2.33586325 6.58573239,2.00007682 6.99994595,2.00007682 C7.41415952,2.00007682 7.74994595,2.33586325 7.74994595,2.75007682 Z",
52
105
  transform: "translate(-367.000000, -21.000000) translate(367.000000, 21.000000) translate(6.999946, 7.000077) rotate(-45.000000) translate(-6.999946, -7.000077)"
53
106
  }))))))));
54
- }));
107
+ })), /*#__PURE__*/React.createElement("div", {
108
+ className: "".concat(prefixCls, "-nav-tabs-layout-icon")
109
+ }, /*#__PURE__*/React.createElement(DropMenu, {
110
+ visible: hideTabs,
111
+ tabs: tabs,
112
+ active: active,
113
+ onClick: _onClick,
114
+ onClose: onClose
115
+ })));
55
116
  }
@@ -1,3 +1,17 @@
1
+ .@{prefixCls}-nav-tabs-layout {
2
+ position: relative;
3
+ display: flex;
4
+ flex-grow: 1;
5
+ flex-wrap: nowrap;
6
+ align-items: flex-end;
7
+ justify-content: space-between;
8
+ overflow-x: hidden;
9
+
10
+ &-icon {
11
+ align-self: center;
12
+ }
13
+ }
14
+
1
15
  .@{prefixCls}-nav-tabs {
2
16
  position: relative;
3
17
  display: flex;
@@ -7,6 +7,9 @@ interface Props<T> {
7
7
  onTabClick: (index: number) => void;
8
8
  onTabClose: (index: number) => void;
9
9
  onMenuClick: (menu: MenuItem) => void;
10
+ onRefresh: () => void;
11
+ onCloseOther: () => void;
12
+ onCloseAll: () => void;
10
13
  right?: ReactNode;
11
14
  children?: ReactNode;
12
15
  logo?: string | false | ReactElement;
@@ -1,21 +1,8 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
- import React, { useEffect, useRef, useState } from 'react';
1
+ import React from 'react';
14
2
  import TabBar from './components/TabBar';
15
3
  import Menu from './components/Menu';
16
4
  import { PREFIX_CLS as prefixCls } from '../constants';
17
- import DownBar from './components/DownBar';
18
- import { useDebounce } from '@lemon-fe/hooks';
5
+ import RefreshButton from './components/RefreshButton';
19
6
  export default function MainFramework(props) {
20
7
  var tabs = props.tabs,
21
8
  active = props.active,
@@ -25,49 +12,17 @@ export default function MainFramework(props) {
25
12
  onTabClick = props.onTabClick,
26
13
  onMenuClick = props.onMenuClick,
27
14
  onTabClose = props.onTabClose,
15
+ onRefresh = props.onRefresh,
16
+ onCloseOther = props.onCloseOther,
17
+ onCloseAll = props.onCloseAll,
28
18
  logo = props.logo,
29
19
  title = props.title,
30
20
  favorites = props.favorites,
31
21
  onFavoritesChange = props.onFavoritesChange;
32
-
33
- var _useState = useState(false),
34
- _useState2 = _slicedToArray(_useState, 2),
35
- hideTabs = _useState2[0],
36
- setHideTabs = _useState2[1];
37
-
38
- var tabRef = useRef(null);
39
- var handleDownBar = useDebounce(function () {
40
- var _tabRef$current$query, _tabRef$current$query2;
41
-
42
- if (tabRef.current === null) {
43
- return;
44
- }
45
-
46
- var leftLength = (_tabRef$current$query = tabRef.current.querySelector(".".concat(prefixCls, "-nav-left"))) === null || _tabRef$current$query === void 0 ? void 0 : _tabRef$current$query.offsetWidth;
47
- var rightLength = (_tabRef$current$query2 = tabRef.current.querySelector(".".concat(prefixCls, "-nav-right"))) === null || _tabRef$current$query2 === void 0 ? void 0 : _tabRef$current$query2.offsetWidth;
48
- var minWidth = 66 * tabs.length + 32;
49
- var width = window.innerWidth - (leftLength || 0) - (rightLength || 0);
50
-
51
- if (tabs.length && minWidth >= width) {
52
- setHideTabs(true);
53
- } else if (minWidth < width) {
54
- setHideTabs(false);
55
- }
56
- }, 300);
57
- useEffect(function () {
58
- window.addEventListener('resize', handleDownBar);
59
- return function () {
60
- window.removeEventListener('resize', handleDownBar);
61
- };
62
- }, []);
63
- useEffect(function () {
64
- handleDownBar();
65
- }, [tabs, active]);
66
22
  return /*#__PURE__*/React.createElement("div", {
67
23
  className: "".concat(prefixCls, "-main")
68
24
  }, /*#__PURE__*/React.createElement("div", {
69
- className: "".concat(prefixCls, "-nav"),
70
- ref: tabRef
25
+ className: "".concat(prefixCls, "-nav")
71
26
  }, /*#__PURE__*/React.createElement("div", {
72
27
  className: "".concat(prefixCls, "-nav-left")
73
28
  }, logo !== false && /*#__PURE__*/React.createElement("div", {
@@ -92,12 +47,12 @@ export default function MainFramework(props) {
92
47
  onClose: onTabClose
93
48
  }), /*#__PURE__*/React.createElement("div", {
94
49
  className: "".concat(prefixCls, "-nav-right")
95
- }, /*#__PURE__*/React.createElement(DownBar, {
96
- visible: hideTabs,
97
- tabs: tabs,
98
- active: active,
99
- onClick: onTabClick,
100
- onClose: onTabClose
50
+ }, /*#__PURE__*/React.createElement(RefreshButton, {
51
+ onRefresh: onRefresh,
52
+ onCloseAll: onCloseAll,
53
+ onCloseOther: onCloseOther
54
+ }), /*#__PURE__*/React.createElement("div", {
55
+ className: "".concat(prefixCls, "-nav-divider")
101
56
  }), right)), /*#__PURE__*/React.createElement("div", {
102
57
  className: "".concat(prefixCls, "-body")
103
58
  }, /*#__PURE__*/React.createElement(Menu, {