@lemon-fe/components 0.1.78 → 0.1.82

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 (115) hide show
  1. package/es/BaseTable/index.less +1 -1
  2. package/es/ColorPicker/index.less +47 -0
  3. package/es/MainFramework/components/Menu/index.less +0 -407
  4. package/es/Table/typings.d.ts +0 -1
  5. package/es/index.less +1 -0
  6. package/package.json +5 -2
  7. package/es/Actions/index.d.ts +0 -26
  8. package/es/Actions/index.js +0 -171
  9. package/es/BaseTable/Actions.d.ts +0 -8
  10. package/es/BaseTable/Actions.js +0 -136
  11. package/es/BaseTable/BaseTableContext.d.ts +0 -6
  12. package/es/BaseTable/BaseTableContext.js +0 -6
  13. package/es/BaseTable/ResizeHeaderCell.d.ts +0 -8
  14. package/es/BaseTable/ResizeHeaderCell.js +0 -126
  15. package/es/BaseTable/VirtualBody.d.ts +0 -8
  16. package/es/BaseTable/VirtualBody.js +0 -165
  17. package/es/BaseTable/index.d.ts +0 -7
  18. package/es/BaseTable/index.js +0 -465
  19. package/es/BaseTable/utils.d.ts +0 -4
  20. package/es/BaseTable/utils.js +0 -26
  21. package/es/Dropdown/index.d.ts +0 -14
  22. package/es/Dropdown/index.js +0 -53
  23. package/es/DurationPicker/index.d.ts +0 -25
  24. package/es/DurationPicker/index.js +0 -237
  25. package/es/EditableTable/EditableCell.d.ts +0 -11
  26. package/es/EditableTable/EditableCell.js +0 -37
  27. package/es/EditableTable/EditableTableFormItem.d.ts +0 -5
  28. package/es/EditableTable/EditableTableFormItem.js +0 -49
  29. package/es/EditableTable/Table.d.ts +0 -7
  30. package/es/EditableTable/Table.js +0 -363
  31. package/es/EditableTable/index.d.ts +0 -9
  32. package/es/EditableTable/index.js +0 -8
  33. package/es/EditableTable/util.d.ts +0 -25
  34. package/es/EditableTable/util.js +0 -387
  35. package/es/Filter/index.d.ts +0 -7
  36. package/es/Filter/index.js +0 -610
  37. package/es/FormHorizontal/index.d.ts +0 -6
  38. package/es/FormHorizontal/index.js +0 -35
  39. package/es/FormInline/index.d.ts +0 -15
  40. package/es/FormInline/index.js +0 -90
  41. package/es/FormLayout/index.d.ts +0 -32
  42. package/es/FormLayout/index.js +0 -41
  43. package/es/FormTable/index.d.ts +0 -6
  44. package/es/FormTable/index.js +0 -159
  45. package/es/Icons/BigTip/index.d.ts +0 -6
  46. package/es/Icons/BigTip/index.js +0 -50
  47. package/es/Icons/Calendar.d.ts +0 -5
  48. package/es/Icons/Calendar.js +0 -47
  49. package/es/Icons/CollapseUp.d.ts +0 -5
  50. package/es/Icons/CollapseUp.js +0 -31
  51. package/es/Icons/DarkSearch.d.ts +0 -5
  52. package/es/Icons/DarkSearch.js +0 -38
  53. package/es/Icons/Down.d.ts +0 -5
  54. package/es/Icons/Down.js +0 -35
  55. package/es/Icons/Empty.d.ts +0 -2
  56. package/es/Icons/Empty.js +0 -267
  57. package/es/Icons/LookUp.d.ts +0 -5
  58. package/es/Icons/LookUp.js +0 -74
  59. package/es/Icons/More.d.ts +0 -5
  60. package/es/Icons/More.js +0 -44
  61. package/es/Icons/Search.d.ts +0 -5
  62. package/es/Icons/Search.js +0 -35
  63. package/es/Icons/Tip.d.ts +0 -6
  64. package/es/Icons/Tip.js +0 -169
  65. package/es/Icons/index.d.ts +0 -22
  66. package/es/Icons/index.js +0 -23
  67. package/es/InputMaxLength/index.d.ts +0 -14
  68. package/es/InputMaxLength/index.js +0 -92
  69. package/es/Layout/index.d.ts +0 -41
  70. package/es/Layout/index.js +0 -175
  71. package/es/MainFramework/components/DropMenu/index.d.ts +0 -10
  72. package/es/MainFramework/components/DropMenu/index.js +0 -104
  73. package/es/MainFramework/components/Menu/index.d.ts +0 -9
  74. package/es/MainFramework/components/Menu/index.js +0 -656
  75. package/es/MainFramework/components/RefreshButton/index.d.ts +0 -5
  76. package/es/MainFramework/components/RefreshButton/index.js +0 -72
  77. package/es/MainFramework/components/RefreshButton/index.less +0 -30
  78. package/es/MainFramework/components/TabBar/index.d.ts +0 -9
  79. package/es/MainFramework/components/TabBar/index.js +0 -116
  80. package/es/MainFramework/index.d.ts +0 -24
  81. package/es/MainFramework/index.js +0 -66
  82. package/es/PageLoading/index.d.ts +0 -5
  83. package/es/PageLoading/index.js +0 -15
  84. package/es/Popup/index.d.ts +0 -37
  85. package/es/Popup/index.js +0 -198
  86. package/es/Portal/index.d.ts +0 -12
  87. package/es/Portal/index.js +0 -72
  88. package/es/Section/TabBar.d.ts +0 -12
  89. package/es/Section/TabBar.js +0 -48
  90. package/es/Section/index.d.ts +0 -54
  91. package/es/Section/index.js +0 -96
  92. package/es/SelectView/index.d.ts +0 -53
  93. package/es/SelectView/index.js +0 -257
  94. package/es/SiderTree/TreeNodeTitle.d.ts +0 -8
  95. package/es/SiderTree/TreeNodeTitle.js +0 -107
  96. package/es/SiderTree/index.d.ts +0 -37
  97. package/es/SiderTree/index.js +0 -221
  98. package/es/SymbolIcon/index.d.ts +0 -8
  99. package/es/SymbolIcon/index.js +0 -32
  100. package/es/TabBar/index.d.ts +0 -14
  101. package/es/TabBar/index.js +0 -52
  102. package/es/Table/index.d.ts +0 -2
  103. package/es/Table/index.js +0 -236
  104. package/es/Table/utils.d.ts +0 -2
  105. package/es/Table/utils.js +0 -3
  106. package/es/TipMark/index.d.ts +0 -10
  107. package/es/TipMark/index.js +0 -45
  108. package/es/constants.d.ts +0 -1
  109. package/es/constants.js +0 -1
  110. package/es/index.d.ts +0 -31
  111. package/es/index.js +0 -26
  112. package/es/init.d.ts +0 -3
  113. package/es/init.js +0 -135
  114. package/es/utils.d.ts +0 -2
  115. package/es/utils.js +0 -14
@@ -1,656 +0,0 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
-
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
-
7
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
-
9
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
-
11
- 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."); }
12
-
13
- 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); }
14
-
15
- 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; }
16
-
17
- 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; }
18
-
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
-
21
- 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; }
22
-
23
- 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; }
24
-
25
- 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; }
26
-
27
- import React, { useEffect, useMemo, useRef, useState } from 'react';
28
- import { createPortal } from 'react-dom';
29
- import classNames from 'classnames';
30
- import { useDebounce } from '@lemon-fe/hooks';
31
- import { PREFIX_CLS as prefixCls } from '../../../constants';
32
- import { Divider } from 'antd';
33
-
34
- function Star(props) {
35
- if (props.active) {
36
- return /*#__PURE__*/React.createElement("svg", {
37
- className: props.className,
38
- width: "20",
39
- height: "20",
40
- xmlns: "http://www.w3.org/2000/svg"
41
- }, /*#__PURE__*/React.createElement("path", {
42
- d: "m9.666 15.526-3.584 1.27a1 1 0 0 1-1.334-.97l.1-3.8a1 1 0 0 0-.206-.636L2.326 8.373a1 1 0 0 1 .51-1.567l3.646-1.08a1 1 0 0 0 .54-.393L9.176 2.2a1 1 0 0 1 1.648 0l2.154 3.134a1 1 0 0 0 .54.393l3.646 1.08a1 1 0 0 1 .51 1.567l-2.316 3.017a1 1 0 0 0-.206.635l.1 3.801a1 1 0 0 1-1.334.97l-3.584-1.27a1 1 0 0 0-.668 0Z",
43
- fill: "currentColor",
44
- fillRule: "evenodd"
45
- }));
46
- }
47
-
48
- return /*#__PURE__*/React.createElement("svg", {
49
- className: props.className,
50
- width: "20",
51
- height: "20",
52
- xmlns: "http://www.w3.org/2000/svg"
53
- }, /*#__PURE__*/React.createElement("path", {
54
- d: "m9.954 2.52 2.406 3.238c.227.33.56.573.945.687l3.646 1.08a.25.25 0 0 1 .179.22l-2.367 3.188a1.75 1.75 0 0 0-.36 1.112l.1 3.801a.25.25 0 0 1-.156.238l-3.77-1.267a1.75 1.75 0 0 0-1.161.002l-3.585 1.27a.25.25 0 0 1-.274-.075l.04-3.976a1.75 1.75 0 0 0-.36-1.105L2.92 7.917a.25.25 0 0 1-.014-.284l3.794-1.19a1.75 1.75 0 0 0 .94-.685l2.153-3.134a.25.25 0 0 1 .16-.104Z",
55
- stroke: "currentColor",
56
- strokeWidth: "1.5",
57
- fill: "none",
58
- fillRule: "evenodd"
59
- }));
60
- }
61
-
62
- var drawerIcon = /*#__PURE__*/React.createElement("svg", {
63
- width: "20",
64
- height: "20",
65
- xmlns: "http://www.w3.org/2000/svg"
66
- }, /*#__PURE__*/React.createElement("g", {
67
- fill: "none",
68
- fillRule: "evenodd"
69
- }, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("g", {
70
- fill: "currentColor"
71
- }, /*#__PURE__*/React.createElement("path", {
72
- d: "M4.75,5 L15.25,5 C15.6642136,5 16,5.33578644 16,5.75 C16,6.16421356 15.6642136,6.5 15.25,6.5 L4.75,6.5 C4.33578644,6.5 4,6.16421356 4,5.75 C4,5.33578644 4.33578644,5 4.75,5 Z",
73
- opacity: ".7",
74
- transform: "translate(-274.000000, -586.000000) translate(274.000000, 586.000000)"
75
- }), /*#__PURE__*/React.createElement("path", {
76
- d: "M4.75,9 L15.25,9 C15.6642136,9 16,9.33578644 16,9.75 C16,10.1642136 15.6642136,10.5 15.25,10.5 L4.75,10.5 C4.33578644,10.5 4,10.1642136 4,9.75 C4,9.33578644 4.33578644,9 4.75,9 Z",
77
- opacity: ".7",
78
- transform: "translate(-274.000000, -586.000000) translate(274.000000, 586.000000)"
79
- }), /*#__PURE__*/React.createElement("path", {
80
- d: "M4.75,13 L15.25,13 C15.6642136,13 16,13.3357864 16,13.75 C16,14.1642136 15.6642136,14.5 15.25,14.5 L4.75,14.5 C4.33578644,14.5 4,14.1642136 4,13.75 C4,13.3357864 4.33578644,13 4.75,13 Z",
81
- opacity: ".7",
82
- transform: "translate(-274.000000, -586.000000) translate(274.000000, 586.000000)"
83
- })))));
84
-
85
- function FavoritesEmpty(props) {
86
- return /*#__PURE__*/React.createElement("svg", _objectSpread(_objectSpread({}, props), {}, {
87
- width: "72",
88
- height: "72",
89
- xmlns: "http://www.w3.org/2000/svg",
90
- xmlnsXlink: "http://www.w3.org/1999/xlink"
91
- }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("path", {
92
- d: "M3.2 0h27.475a3.2 3.2 0 0 1 2.262.937l10.126 10.126c.6.6.937 1.414.937 2.262V46.8a3.2 3.2 0 0 1-3.2 3.2H3.2A3.2 3.2 0 0 1 0 46.8V3.2A3.2 3.2 0 0 1 3.2 0Z",
93
- id: "a"
94
- })), /*#__PURE__*/React.createElement("g", {
95
- fill: "none",
96
- fillRule: "evenodd"
97
- }, /*#__PURE__*/React.createElement("path", {
98
- d: "M10.766 23.2h20.889a3.2 3.2 0 0 1 3.051 2.236l9.98 31.6a3.2 3.2 0 0 1-3.052 4.164H20.745a3.2 3.2 0 0 1-3.051-2.236l-9.98-31.6a3.2 3.2 0 0 1 3.052-4.164Z",
99
- fill: "#E7E7E7",
100
- opacity: ".4"
101
- }), /*#__PURE__*/React.createElement("rect", {
102
- fill: "#E7E7E7",
103
- x: "49.2",
104
- y: "11.2",
105
- width: "14.8",
106
- height: "14.8",
107
- rx: "3.2"
108
- }), /*#__PURE__*/React.createElement("g", {
109
- transform: "translate(20 11.2)"
110
- }, /*#__PURE__*/React.createElement("mask", {
111
- id: "b",
112
- fill: "#fff"
113
- }, /*#__PURE__*/React.createElement("use", {
114
- xlinkHref: "#a"
115
- })), /*#__PURE__*/React.createElement("use", {
116
- fill: "#E7E7E7",
117
- xlinkHref: "#a"
118
- }), /*#__PURE__*/React.createElement("circle", {
119
- fill: "#CFCFCF",
120
- mask: "url(#b)",
121
- cx: "31.8",
122
- cy: "17",
123
- r: "35.4"
124
- }), /*#__PURE__*/React.createElement("rect", {
125
- fill: "#BEBEBE",
126
- mask: "url(#b)",
127
- x: "29.2",
128
- width: "14.8",
129
- height: "14.8",
130
- rx: "3.2"
131
- })), /*#__PURE__*/React.createElement("rect", {
132
- fill: "#FFF",
133
- x: "30",
134
- y: "31.6",
135
- width: "24",
136
- height: "2.4",
137
- rx: "1.2"
138
- }), /*#__PURE__*/React.createElement("rect", {
139
- fill: "#FFF",
140
- x: "30",
141
- y: "39.6",
142
- width: "12.8",
143
- height: "2.4",
144
- rx: "1.2"
145
- })));
146
- }
147
-
148
- var favoriteIcon = /*#__PURE__*/React.createElement("svg", {
149
- width: "20px",
150
- height: "20px",
151
- viewBox: "0 0 20 20",
152
- version: "1.1",
153
- xmlns: "http://www.w3.org/2000/svg",
154
- xmlnsXlink: "http://www.w3.org/1999/xlink"
155
- }, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("rect", {
156
- x: "0",
157
- y: "0",
158
- width: "20",
159
- height: "20"
160
- })), /*#__PURE__*/React.createElement("g", {
161
- stroke: "none",
162
- strokeWidth: "1",
163
- fill: "none",
164
- fillRule: "evenodd"
165
- }, /*#__PURE__*/React.createElement("g", {
166
- transform: "translate(-1398.000000, -481.000000)"
167
- }, /*#__PURE__*/React.createElement("g", {
168
- transform: "translate(1398.000000, 481.000000)"
169
- }, /*#__PURE__*/React.createElement("mask", {
170
- fill: "white"
171
- }, /*#__PURE__*/React.createElement("use", {
172
- xlinkHref: "#path-1"
173
- })), /*#__PURE__*/React.createElement("use", {
174
- fillOpacity: "0",
175
- fill: "#C4C4C4",
176
- xlinkHref: "#path-1"
177
- }), /*#__PURE__*/React.createElement("path", {
178
- d: "M17.4350762,7.192388 L17.4350762,13.192388 C17.4350762,15.9538117 15.1964999,18.192388 12.4350762,18.192388 C9.67365243,18.192388 7.43507618,15.9538117 7.43507618,13.192388 L7.43507618,7.192388 C7.43507618,4.43096425 9.67365243,2.192388 12.4350762,2.192388 C15.1964999,2.192388 17.4350762,4.43096425 17.4350762,7.192388 Z",
179
- fill: "currentColor",
180
- opacity: "0.5",
181
- mask: "url(#mask-2)",
182
- transform: "translate(12.435076, 10.192388) rotate(45.000000) translate(-12.435076, -10.192388) "
183
- }), /*#__PURE__*/React.createElement("path", {
184
- d: "M13.192388,7.19236523 L13.192388,13.1923652 C13.192388,15.953789 10.9538117,18.1923652 8.192388,18.1923652 C5.43096425,18.1923652 3.192388,15.953789 3.192388,13.1923652 L3.192388,7.19236523 C3.192388,4.43094148 5.43096425,2.19236523 8.192388,2.19236523 C10.9538117,2.19236523 13.192388,4.43094148 13.192388,7.19236523 Z",
185
- fill: "currentColor",
186
- fillRule: "nonzero",
187
- mask: "url(#mask-2)",
188
- transform: "translate(8.192388, 10.192365) rotate(-45.000000) translate(-8.192388, -10.192365) "
189
- }), /*#__PURE__*/React.createElement("path", {
190
- d: "M6,6 C5.5,6 4,6.5 4,8.5",
191
- stroke: "#F2F2F2",
192
- strokeLinecap: "round",
193
- strokeDasharray: "0,0",
194
- mask: "url(#mask-2)"
195
- })))));
196
- var WIDTH = 1280;
197
- var FAVORITES_POPOVER = 'FAVORITES_POPOVER';
198
- export default function Menu(props) {
199
- var menus = props.data,
200
- onClick = props.onClick,
201
- onFavoritesChange = props.onFavoritesChange,
202
- _props$favorites = props.favorites,
203
- favorites = _props$favorites === void 0 ? [] : _props$favorites;
204
- var location = window.location;
205
-
206
- var _useState = useState(null),
207
- _useState2 = _slicedToArray(_useState, 2),
208
- popover = _useState2[0],
209
- setPopover = _useState2[1];
210
-
211
- var popup = useRef(null);
212
- var drawer = useRef(null);
213
- var clientWidth = useRef(document.body.clientWidth);
214
-
215
- var _useState3 = useState(clientWidth.current <= WIDTH),
216
- _useState4 = _slicedToArray(_useState3, 2),
217
- collapsed = _useState4[0],
218
- setCollapsed = _useState4[1];
219
-
220
- var _useState5 = useState(false),
221
- _useState6 = _slicedToArray(_useState5, 2),
222
- visible = _useState6[0],
223
- setVisible = _useState6[1];
224
-
225
- var _useState7 = useState(0),
226
- _useState8 = _slicedToArray(_useState7, 2),
227
- top = _useState8[0],
228
- setTop = _useState8[1];
229
-
230
- var activeMenu = useMemo(function () {
231
- var check = function check(path) {
232
- if (path) {
233
- return new RegExp("".concat(path.split('?')[0], "(?![^\\/])")).test(location.pathname);
234
- }
235
-
236
- return false;
237
- };
238
-
239
- for (var i = 0; i < menus.length; i += 1) {
240
- var _menus$i = menus[i],
241
- _menus$i$children = _menus$i.children,
242
- subMenus = _menus$i$children === void 0 ? [] : _menus$i$children,
243
- topPath = _menus$i.path;
244
-
245
- if (check(topPath)) {
246
- return {
247
- path: [i],
248
- key: topPath
249
- };
250
- }
251
-
252
- for (var j = 0; j < subMenus.length; j += 1) {
253
- var _subMenus$j = subMenus[j],
254
- subPath = _subMenus$j.path,
255
- _subMenus$j$children = _subMenus$j.children,
256
- items = _subMenus$j$children === void 0 ? [] : _subMenus$j$children;
257
-
258
- if (check(subPath)) {
259
- return {
260
- path: [i, j],
261
- key: subPath
262
- };
263
- }
264
-
265
- for (var k = 0; k < items.length; k += 1) {
266
- if (check(items[k].path)) {
267
- return {
268
- path: [i, j, k],
269
- key: items[k].path
270
- };
271
- }
272
- }
273
- }
274
- }
275
- }, [location.pathname, menus]);
276
-
277
- var openMenu = function openMenu(item, elm) {
278
- if (item.name === FAVORITES_POPOVER || item.children !== undefined && item.children.length > 0 || collapsed) {
279
- setPopover(item);
280
- setTop(elm.offsetTop);
281
- setTimeout(function () {
282
- if (popup.current) {
283
- popup.current.classList.add('animated');
284
- }
285
- }, 16);
286
- } else {
287
- setPopover(null);
288
- }
289
- };
290
-
291
- var closeMenu = function closeMenu() {
292
- if (popup.current) {
293
- popup.current.classList.remove('animated');
294
-
295
- var handler = function handler() {
296
- var _popup$current;
297
-
298
- setPopover(null);
299
- (_popup$current = popup.current) === null || _popup$current === void 0 ? void 0 : _popup$current.removeEventListener('transitionend', handler);
300
- };
301
-
302
- popup.current.addEventListener('transitionend', handler);
303
- }
304
- };
305
-
306
- var toggle = useDebounce(function (handler) {
307
- if (handler) {
308
- handler();
309
- }
310
- }, 200);
311
-
312
- var toggleCollapse = function toggleCollapse() {
313
- setCollapsed(function (prev) {
314
- return !prev;
315
- });
316
- };
317
-
318
- useEffect(function () {
319
- if (!visible) {
320
- return;
321
- }
322
-
323
- var target = drawer.current;
324
-
325
- if (target !== null) {
326
- var handler = function handler(e) {
327
- if (!target.contains(e.target)) {
328
- closeDrawer();
329
- }
330
- };
331
-
332
- requestAnimationFrame(function () {
333
- window.addEventListener('click', handler);
334
- });
335
- return function () {
336
- window.removeEventListener('click', handler);
337
- };
338
- }
339
- }, [visible]);
340
- useEffect(function () {
341
- var handleResize = function handleResize() {
342
- var width = document.body.clientWidth;
343
-
344
- if (clientWidth.current > WIDTH && width <= WIDTH) {
345
- setCollapsed(true);
346
- } else if (clientWidth.current <= WIDTH && width > WIDTH) {
347
- setCollapsed(false);
348
- }
349
-
350
- clientWidth.current = width;
351
- };
352
-
353
- window.addEventListener('resize', handleResize);
354
- return function () {
355
- window.removeEventListener('resize', handleResize);
356
- };
357
- }, []);
358
-
359
- var openDrawer = function openDrawer() {
360
- setVisible(true);
361
- setTimeout(function () {
362
- var _drawer$current;
363
-
364
- (_drawer$current = drawer.current) === null || _drawer$current === void 0 ? void 0 : _drawer$current.classList.add('animated');
365
- }, 16);
366
- };
367
-
368
- var closeDrawer = function closeDrawer() {
369
- if (drawer.current) {
370
- drawer.current.classList.remove('animated');
371
-
372
- var handler = function handler() {
373
- var _drawer$current2;
374
-
375
- (_drawer$current2 = drawer.current) === null || _drawer$current2 === void 0 ? void 0 : _drawer$current2.removeEventListener('transitionend', handler);
376
- setVisible(false);
377
- };
378
-
379
- drawer.current.addEventListener('transitionend', handler);
380
- }
381
- };
382
-
383
- var handleClick = function handleClick(item) {
384
- if (item.path) {
385
- onClick(item);
386
- closeDrawer();
387
- closeMenu();
388
- }
389
- };
390
-
391
- var favoritesMap = useMemo(function () {
392
- return new Map(favorites.map(function (item) {
393
- return [item.path || '', item];
394
- }));
395
- }, [favorites]);
396
-
397
- var toggleFavorite = function toggleFavorite(e, item) {
398
- e.stopPropagation();
399
- var nextMap = new Map(favoritesMap);
400
- var key = item.path || '';
401
-
402
- if (nextMap.has(key)) {
403
- nextMap.delete(key);
404
- } else {
405
- nextMap.set(key, {
406
- name: item.name,
407
- path: item.path
408
- });
409
- }
410
-
411
- if (onFavoritesChange) {
412
- onFavoritesChange(_toConsumableArray(nextMap.values()));
413
- }
414
- };
415
-
416
- var renderItem = function renderItem(item, index) {
417
- var favorited = favoritesMap.has(item.path || '');
418
- return /*#__PURE__*/React.createElement("div", {
419
- key: index,
420
- className: classNames("".concat(prefixCls, "-menu-item"), _defineProperty({}, "".concat(prefixCls, "-menu-active"), activeMenu !== undefined && activeMenu.key === item.path)),
421
- onClick: function onClick() {
422
- return handleClick(item);
423
- }
424
- }, /*#__PURE__*/React.createElement("span", {
425
- style: {
426
- overflow: 'hidden'
427
- }
428
- }, item.name), /*#__PURE__*/React.createElement("div", {
429
- className: "".concat(prefixCls, "-menu-item-favorite"),
430
- onClick: function onClick(e) {
431
- toggleFavorite(e, item);
432
- }
433
- }, /*#__PURE__*/React.createElement(Star, {
434
- className: "".concat(prefixCls, "-menu-favorite-star"),
435
- active: favorited
436
- })));
437
- };
438
-
439
- var renderDrawerItems = function renderDrawerItems() {
440
- var cols = [[], [], []];
441
- var value = [0, 0, 0];
442
- menus.forEach(function (item) {
443
- var list = [/*#__PURE__*/React.createElement("div", {
444
- className: classNames("".concat(prefixCls, "-menu-drawer-1"), _defineProperty({}, "".concat(prefixCls, "-menu-drawer-1-path"), item.path !== undefined)),
445
- key: item.name,
446
- onClick: function onClick() {
447
- return handleClick(item);
448
- }
449
- }, item.name)];
450
-
451
- if (item.children) {
452
- item.children.forEach(function (subItem) {
453
- list.push( /*#__PURE__*/React.createElement("div", {
454
- className: "".concat(prefixCls, "-menu-drawer-2"),
455
- key: "2-".concat(subItem.name),
456
- onClick: function onClick() {
457
- return handleClick(subItem);
458
- }
459
- }, subItem.name));
460
-
461
- if (subItem.children) {
462
- subItem.children.forEach(function (child) {
463
- list.push( /*#__PURE__*/React.createElement("div", {
464
- className: classNames("".concat(prefixCls, "-menu-drawer-3"), _defineProperty({}, "".concat(prefixCls, "-menu-active"), activeMenu !== undefined && activeMenu.key === child.path)),
465
- key: "3-".concat(child.name),
466
- onClick: function onClick() {
467
- return handleClick(child);
468
- }
469
- }, child.name));
470
- });
471
- }
472
- });
473
- }
474
-
475
- var node = /*#__PURE__*/React.createElement("div", {
476
- className: "".concat(prefixCls, "-menu-drawer-block")
477
- }, /*#__PURE__*/React.createElement("div", null, list));
478
- var target = 0;
479
- var min = Infinity;
480
-
481
- for (var i = 0; i < value.length; i++) {
482
- if (value[i] < min) {
483
- target = i;
484
- min = value[i];
485
- }
486
- }
487
-
488
- value[target] += list.length;
489
- cols[target].push(node);
490
- });
491
- return cols.map(function (items, index) {
492
- return /*#__PURE__*/React.createElement("div", {
493
- className: "".concat(prefixCls, "-menu-drawer-col"),
494
- key: index
495
- }, items);
496
- });
497
- };
498
-
499
- return /*#__PURE__*/React.createElement("div", {
500
- className: classNames("".concat(prefixCls, "-menu"), _defineProperty({}, "".concat(prefixCls, "-menu-collapsed"), collapsed))
501
- }, /*#__PURE__*/React.createElement("div", {
502
- className: "".concat(prefixCls, "-menu-bar"),
503
- onMouseLeave: function onMouseLeave() {
504
- toggle(closeMenu);
505
- }
506
- }, popover !== null && /*#__PURE__*/React.createElement("div", {
507
- className: "".concat(prefixCls, "-menu-popup"),
508
- style: {
509
- top: top
510
- },
511
- ref: popup,
512
- onMouseEnter: function onMouseEnter() {
513
- return toggle.cancel();
514
- }
515
- }, popover.children !== undefined ? popover.name === FAVORITES_POPOVER ? /*#__PURE__*/React.createElement("div", {
516
- className: "".concat(prefixCls, "-menu-popup-body"),
517
- key: "pop"
518
- }, popover.children !== undefined && popover.children.length > 0 ? /*#__PURE__*/React.createElement("div", {
519
- className: "".concat(prefixCls, "-menu-block-favorite")
520
- }, popover.children.map(renderItem)) : /*#__PURE__*/React.createElement("div", {
521
- className: "".concat(prefixCls, "-menu-block-empty")
522
- }, /*#__PURE__*/React.createElement(FavoritesEmpty, null), /*#__PURE__*/React.createElement("span", null, "\u6682\u65E0\u6536\u85CF"))) : /*#__PURE__*/React.createElement("div", {
523
- className: "".concat(prefixCls, "-menu-popup-body"),
524
- key: "pop"
525
- }, popover.children.map(function (item, index) {
526
- return /*#__PURE__*/React.createElement("div", {
527
- className: "".concat(prefixCls, "-menu-block"),
528
- key: index
529
- }, /*#__PURE__*/React.createElement("div", {
530
- className: "".concat(prefixCls, "-menu-sub-item")
531
- }, item.name), item.children !== undefined && item.children.map(renderItem));
532
- })) : /*#__PURE__*/React.createElement("div", {
533
- className: "".concat(prefixCls, "-menu-popup-tip"),
534
- key: "tip"
535
- }, popover.name)), /*#__PURE__*/React.createElement("div", {
536
- className: "".concat(prefixCls, "-menu-collapse"),
537
- onClick: toggleCollapse,
538
- onMouseEnter: function onMouseEnter() {
539
- return toggle(closeMenu);
540
- }
541
- }, /*#__PURE__*/React.createElement("svg", {
542
- width: "20",
543
- height: "20",
544
- xmlns: "http://www.w3.org/2000/svg"
545
- }, /*#__PURE__*/React.createElement("g", {
546
- fill: "none",
547
- fillRule: "evenodd",
548
- opacity: ".7"
549
- }, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
550
- d: "M14.75,5 C15.1642136,5 15.5,5.33578644 15.5,5.75 L15.5,14.25 C15.5,14.6642136 15.1642136,15 14.75,15 C14.3357864,15 14,14.6642136 14,14.25 L14,5.75 C14,5.33578644 14.3357864,5 14.75,5 Z",
551
- fill: "currentColor",
552
- transform: "translate(-274.000000, -57.000000) translate(284.000000, 67.000000) scale(-1, 1) translate(-284.000000, -67.000000) translate(274.000000, 57.000000)"
553
- }), /*#__PURE__*/React.createElement("path", {
554
- d: "M15,10 C15,10.4142136 14.6642136,10.75 14.25,10.75 L5,10.75 L5,10.75 L5,9.25 L14.25,9.25 C14.6642136,9.25 15,9.58578644 15,10 Z",
555
- fill: "currentColor",
556
- fillRule: "nonzero",
557
- transform: "translate(-274.000000, -57.000000) translate(284.000000, 67.000000) scale(-1, 1) translate(-284.000000, -67.000000) translate(274.000000, 57.000000)"
558
- }), /*#__PURE__*/React.createElement("path", {
559
- d: "M11.7426212,6.79290128 L5.32842371,6.79290128 L5.32842371,13.2070987",
560
- stroke: "currentColor",
561
- strokeWidth: "1.5",
562
- strokeLinecap: "round",
563
- strokeLinejoin: "round",
564
- strokeDasharray: "0,0",
565
- 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)"
566
- })))))), menus.map(function (item, index) {
567
- var _classNames5;
568
-
569
- return /*#__PURE__*/React.createElement("div", {
570
- key: index,
571
- 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)),
572
- onClick: function onClick() {
573
- return handleClick(item);
574
- },
575
- onMouseEnter: function onMouseEnter(e) {
576
- var target = e.currentTarget;
577
- toggle(function () {
578
- return openMenu(item, target);
579
- });
580
- }
581
- }, typeof item.icon === 'string' ? /*#__PURE__*/React.createElement("img", {
582
- className: "".concat(prefixCls, "-menu-icon"),
583
- src: item.icon
584
- }) : /*#__PURE__*/React.createElement("div", {
585
- className: "".concat(prefixCls, "-menu-icon")
586
- }, item.icon), /*#__PURE__*/React.createElement("div", {
587
- className: "".concat(prefixCls, "-menu-title")
588
- }, item.name));
589
- }), /*#__PURE__*/React.createElement("div", {
590
- className: classNames("".concat(prefixCls, "-menu-divider-div"), _defineProperty({}, "".concat(prefixCls, "-menu-divider-div-collapsed"), collapsed))
591
- }, /*#__PURE__*/React.createElement(Divider, {
592
- className: "".concat(prefixCls, "-menu-divider")
593
- })), !collapsed ? /*#__PURE__*/React.createElement("div", {
594
- className: "".concat(prefixCls, "-menu-other-title")
595
- }, "\u529F\u80FD\u7BA1\u7406") : null, /*#__PURE__*/React.createElement("div", {
596
- className: classNames("".concat(prefixCls, "-menu-top-item"), _defineProperty({}, "".concat(prefixCls, "-menu-top-item-popover-active"), (popover === null || popover === void 0 ? void 0 : popover.name) === FAVORITES_POPOVER)),
597
- onMouseEnter: function onMouseEnter(e) {
598
- var target = e.currentTarget;
599
- toggle(function () {
600
- return openMenu({
601
- name: FAVORITES_POPOVER,
602
- children: _toConsumableArray(favoritesMap.values())
603
- }, target);
604
- });
605
- }
606
- }, /*#__PURE__*/React.createElement("div", {
607
- className: "".concat(prefixCls, "-menu-icon")
608
- }, favoriteIcon), /*#__PURE__*/React.createElement("div", {
609
- className: "".concat(prefixCls, "-menu-title")
610
- }, "\u6536\u85CF"))), false && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
611
- className: "".concat(prefixCls, "-menu-gutter")
612
- }), collapsed ? /*#__PURE__*/React.createElement("div", {
613
- className: "".concat(prefixCls, "-menu-top-item"),
614
- onClick: openDrawer
615
- }, drawerIcon) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
616
- className: "".concat(prefixCls, "-menu-label")
617
- }, "\u6CA1\u6709\u627E\u5230\u60F3\u8981\u7684\u529F\u80FD?"), /*#__PURE__*/React.createElement("div", {
618
- className: "".concat(prefixCls, "-menu-more"),
619
- onClick: openDrawer
620
- }, drawerIcon, /*#__PURE__*/React.createElement("span", null, "\u67E5\u770B\u5168\u90E8")))), visible && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
621
- className: "".concat(prefixCls, "-menu-drawer"),
622
- ref: drawer
623
- }, /*#__PURE__*/React.createElement("div", {
624
- className: "".concat(prefixCls, "-menu-drawer-header")
625
- }, /*#__PURE__*/React.createElement("div", null, "\u67E5\u770B\u5168\u90E8"), /*#__PURE__*/React.createElement("div", {
626
- className: "".concat(prefixCls, "-menu-drawer-close"),
627
- onClick: closeDrawer
628
- }, /*#__PURE__*/React.createElement("svg", {
629
- width: "16",
630
- height: "16",
631
- xmlns: "http://www.w3.org/2000/svg"
632
- }, /*#__PURE__*/React.createElement("g", {
633
- fill: "none",
634
- fillRule: "evenodd",
635
- opacity: ".7"
636
- }, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("g", {
637
- transform: "translate(-1880.000000, -20.000000) translate(1880.000000, 20.000000)",
638
- fill: "currentColor"
639
- }, /*#__PURE__*/React.createElement("rect", {
640
- transform: "translate(8.000000, 8.000000) rotate(-45.000000) translate(-8.000000, -8.000000)",
641
- x: "7.25",
642
- y: "1",
643
- width: "1.5",
644
- height: "14",
645
- rx: ".75"
646
- }), /*#__PURE__*/React.createElement("rect", {
647
- transform: "translate(8.000000, 8.000000) scale(-1, 1) rotate(-45.000000) translate(-8.000000, -8.000000)",
648
- x: "7.25",
649
- y: "1",
650
- width: "1.5",
651
- height: "14",
652
- rx: ".75"
653
- }))))))), /*#__PURE__*/React.createElement("div", {
654
- className: "".concat(prefixCls, "-menu-drawer-body")
655
- }, renderDrawerItems())), document.body));
656
- }
@@ -1,5 +0,0 @@
1
- export default function RefreshButton(props: {
2
- onRefresh: () => void;
3
- onCloseOther: () => void;
4
- onCloseAll: () => void;
5
- }): JSX.Element;