@lemon-fe/components 0.1.82 → 0.1.85

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/Actions/index.d.ts +26 -0
  2. package/es/Actions/index.js +171 -0
  3. package/es/BaseTable/Actions.d.ts +8 -0
  4. package/es/BaseTable/Actions.js +136 -0
  5. package/es/BaseTable/BaseTableContext.d.ts +6 -0
  6. package/es/BaseTable/BaseTableContext.js +6 -0
  7. package/es/BaseTable/ResizeHeaderCell.d.ts +8 -0
  8. package/es/BaseTable/ResizeHeaderCell.js +126 -0
  9. package/es/BaseTable/VirtualBody.d.ts +8 -0
  10. package/es/BaseTable/VirtualBody.js +165 -0
  11. package/es/BaseTable/index.d.ts +7 -0
  12. package/es/BaseTable/index.js +467 -0
  13. package/es/BaseTable/utils.d.ts +4 -0
  14. package/es/BaseTable/utils.js +26 -0
  15. package/es/ColorPicker/index.d.ts +13 -0
  16. package/es/ColorPicker/index.js +114 -0
  17. package/es/Dropdown/index.d.ts +14 -0
  18. package/es/Dropdown/index.js +53 -0
  19. package/es/DurationPicker/index.d.ts +25 -0
  20. package/es/DurationPicker/index.js +237 -0
  21. package/es/EditableTable/EditableCell.d.ts +11 -0
  22. package/es/EditableTable/EditableCell.js +37 -0
  23. package/es/EditableTable/EditableTableFormItem.d.ts +5 -0
  24. package/es/EditableTable/EditableTableFormItem.js +51 -0
  25. package/es/EditableTable/Table.d.ts +7 -0
  26. package/es/EditableTable/Table.js +363 -0
  27. package/es/EditableTable/index.d.ts +9 -0
  28. package/es/EditableTable/index.js +8 -0
  29. package/es/EditableTable/util.d.ts +25 -0
  30. package/es/EditableTable/util.js +387 -0
  31. package/es/Filter/index.d.ts +7 -0
  32. package/es/Filter/index.js +612 -0
  33. package/es/FormHorizontal/index.d.ts +6 -0
  34. package/es/FormHorizontal/index.js +35 -0
  35. package/es/FormInline/index.d.ts +15 -0
  36. package/es/FormInline/index.js +90 -0
  37. package/es/FormLayout/index.d.ts +32 -0
  38. package/es/FormLayout/index.js +41 -0
  39. package/es/FormTable/index.d.ts +6 -0
  40. package/es/FormTable/index.js +159 -0
  41. package/es/Icons/BigTip/index.d.ts +6 -0
  42. package/es/Icons/BigTip/index.js +50 -0
  43. package/es/Icons/Calendar.d.ts +5 -0
  44. package/es/Icons/Calendar.js +47 -0
  45. package/es/Icons/Close.d.ts +5 -0
  46. package/es/Icons/Close.js +29 -0
  47. package/es/Icons/CollapseUp.d.ts +5 -0
  48. package/es/Icons/CollapseUp.js +31 -0
  49. package/es/Icons/DarkSearch.d.ts +5 -0
  50. package/es/Icons/DarkSearch.js +38 -0
  51. package/es/Icons/Down.d.ts +5 -0
  52. package/es/Icons/Down.js +35 -0
  53. package/es/Icons/Empty.d.ts +2 -0
  54. package/es/Icons/Empty.js +267 -0
  55. package/es/Icons/LookUp.d.ts +5 -0
  56. package/es/Icons/LookUp.js +74 -0
  57. package/es/Icons/More.d.ts +5 -0
  58. package/es/Icons/More.js +44 -0
  59. package/es/Icons/Search.d.ts +5 -0
  60. package/es/Icons/Search.js +35 -0
  61. package/es/Icons/Tip.d.ts +6 -0
  62. package/es/Icons/Tip.js +169 -0
  63. package/es/Icons/index.d.ts +24 -0
  64. package/es/Icons/index.js +25 -0
  65. package/es/InputMaxLength/index.d.ts +14 -0
  66. package/es/InputMaxLength/index.js +92 -0
  67. package/es/Layout/index.d.ts +41 -0
  68. package/es/Layout/index.js +175 -0
  69. package/es/MainFramework/components/DropMenu/index.d.ts +10 -0
  70. package/es/MainFramework/components/DropMenu/index.js +104 -0
  71. package/es/MainFramework/components/Menu/index.d.ts +9 -0
  72. package/es/MainFramework/components/Menu/index.js +656 -0
  73. package/es/MainFramework/components/Menu/index.less +407 -0
  74. package/es/MainFramework/components/RefreshButton/index.d.ts +5 -0
  75. package/es/MainFramework/components/RefreshButton/index.js +72 -0
  76. package/es/MainFramework/components/RefreshButton/index.less +30 -0
  77. package/es/MainFramework/components/TabBar/index.d.ts +9 -0
  78. package/es/MainFramework/components/TabBar/index.js +116 -0
  79. package/es/MainFramework/index.d.ts +24 -0
  80. package/es/MainFramework/index.js +66 -0
  81. package/es/PageLoading/index.d.ts +5 -0
  82. package/es/PageLoading/index.js +15 -0
  83. package/es/Popup/index.d.ts +37 -0
  84. package/es/Popup/index.js +198 -0
  85. package/es/Portal/index.d.ts +12 -0
  86. package/es/Portal/index.js +72 -0
  87. package/es/Section/TabBar.d.ts +12 -0
  88. package/es/Section/TabBar.js +48 -0
  89. package/es/Section/index.d.ts +54 -0
  90. package/es/Section/index.js +96 -0
  91. package/es/SelectView/index.d.ts +53 -0
  92. package/es/SelectView/index.js +257 -0
  93. package/es/SiderTree/TreeNodeTitle.d.ts +8 -0
  94. package/es/SiderTree/TreeNodeTitle.js +107 -0
  95. package/es/SiderTree/index.d.ts +37 -0
  96. package/es/SiderTree/index.js +221 -0
  97. package/es/SymbolIcon/index.d.ts +8 -0
  98. package/es/SymbolIcon/index.js +32 -0
  99. package/es/TabBar/index.d.ts +14 -0
  100. package/es/TabBar/index.js +52 -0
  101. package/es/Table/index.d.ts +2 -0
  102. package/es/Table/index.js +236 -0
  103. package/es/Table/utils.d.ts +2 -0
  104. package/es/Table/utils.js +3 -0
  105. package/es/TipMark/index.d.ts +10 -0
  106. package/es/TipMark/index.js +45 -0
  107. package/es/constants.d.ts +1 -0
  108. package/es/constants.js +1 -0
  109. package/es/index.d.ts +33 -0
  110. package/es/index.js +28 -0
  111. package/es/init.d.ts +3 -0
  112. package/es/init.js +149 -0
  113. package/es/utils.d.ts +2 -0
  114. package/es/utils.js +14 -0
  115. package/package.json +2 -2
@@ -0,0 +1,407 @@
1
+ .transition() {
2
+ transition: background-color 0.2s;
3
+ }
4
+
5
+ .@{prefixCls}-menu {
6
+ flex: 0 0 200px;
7
+ min-width: 0;
8
+ height: 100%;
9
+ padding: 8px 0;
10
+ white-space: nowrap;
11
+ transition: flex 0.1s;
12
+
13
+ &-collapsed {
14
+ flex: 0 0 52px;
15
+ }
16
+
17
+ &-bar {
18
+ position: relative;
19
+ z-index: 3;
20
+ box-sizing: border-box;
21
+ width: 100%;
22
+ background: #f2f2f2;
23
+ }
24
+
25
+ &-collapse {
26
+ position: absolute;
27
+ right: 0;
28
+ z-index: 1;
29
+ box-sizing: content-box;
30
+ width: 20px;
31
+ height: 20px;
32
+ padding: 12px;
33
+ color: #333;
34
+ transform: rotate(180deg);
35
+ cursor: pointer;
36
+
37
+ &:hover {
38
+ color: .primary() [];
39
+ }
40
+ }
41
+
42
+ &-collapsed &-collapse {
43
+ position: static;
44
+ padding: 12px 16px;
45
+ transform: rotate(0);
46
+ }
47
+
48
+ &-collapsed &-popup {
49
+ left: 52px;
50
+ }
51
+
52
+ &-top-item {
53
+ display: flex;
54
+ align-items: center;
55
+ box-sizing: border-box;
56
+ height: 44px;
57
+ padding: 0 16px;
58
+ overflow: hidden;
59
+ color: #333;
60
+ font-size: 14px;
61
+ border-radius: 8px;
62
+ cursor: pointer;
63
+ .transition();
64
+
65
+ &:hover,
66
+ &-popover-active {
67
+ background: #e6e6e6;
68
+ }
69
+
70
+ &-active {
71
+ font-weight: 500;
72
+ background-color: #e6e6e6;
73
+
74
+ &::before {
75
+ position: absolute;
76
+ top: 50%;
77
+ left: 0;
78
+ display: block;
79
+ width: 2px;
80
+ height: 14px;
81
+ margin-top: -7px;
82
+ content: '';
83
+ }
84
+ }
85
+ }
86
+
87
+ &-icon {
88
+ width: 20px;
89
+ height: 20px;
90
+ margin-right: 8px;
91
+ color: rgba(108, 108, 108, 1);
92
+ font-size: 16px;
93
+ }
94
+
95
+ &-favorite-star {
96
+ color: var(--ant-primary-color);
97
+ }
98
+
99
+ &-title {
100
+ overflow: hidden;
101
+ white-space: nowrap;
102
+ text-overflow: ellipsis;
103
+ }
104
+
105
+ &-top-item:hover &-icon {
106
+ color: #333;
107
+ }
108
+
109
+ &-top-item&-top-item-active &-title,
110
+ &-top-item&-top-item-active &-icon {
111
+ color: .primary() [];
112
+ }
113
+
114
+ &-popup {
115
+ position: absolute;
116
+ top: 0;
117
+ left: 200px;
118
+ z-index: 2;
119
+ transition: left 0.1s;
120
+
121
+ &-body {
122
+ position: relative;
123
+ z-index: 1;
124
+ display: flex;
125
+ margin-left: 4px;
126
+ padding: 8px;
127
+ background: #fff;
128
+ border-radius: 10px;
129
+ box-shadow: 0 12px 48px 16px rgba(0, 0, 0, 0.03), 0 9px 28px 0 rgba(0, 0, 0, 0.05),
130
+ 0 6px 16px -8px rgba(0, 0, 0, 0.08);
131
+ transform: translate3d(-20px, 0, 0);
132
+ opacity: 0;
133
+ transition: all 0.15s;
134
+ }
135
+
136
+ &-tip {
137
+ height: 36px;
138
+ margin: 4px 0 0 4px;
139
+ padding: 0 16px;
140
+ color: #fff;
141
+ line-height: 36px;
142
+ text-align: center;
143
+ background-color: .primary() [];
144
+ border-radius: 22px;
145
+ transform: translate3d(-10px, 0, 0);
146
+ opacity: 0;
147
+ transition: all 0.15s;
148
+ }
149
+
150
+ &.animated &-body,
151
+ &.animated &-tip {
152
+ transform: translate3d(0, 0, 0);
153
+ opacity: 1;
154
+ }
155
+ }
156
+
157
+ &-block {
158
+ display: inline-block;
159
+
160
+ &-empty {
161
+ display: flex;
162
+ flex-direction: column;
163
+ align-items: center;
164
+ justify-content: center;
165
+ width: 256px;
166
+ height: 180px;
167
+
168
+ & > span {
169
+ margin-top: 24px;
170
+ color: #333;
171
+ font-weight: 400;
172
+ font-size: 14px;
173
+ line-height: 22px;
174
+ opacity: 0.5;
175
+ }
176
+ }
177
+
178
+ &-favorite {
179
+ display: grid;
180
+ grid-auto-flow: column;
181
+ grid-template-rows: repeat(5, auto);
182
+ }
183
+ }
184
+
185
+ &-sub-item {
186
+ box-sizing: border-box;
187
+ width: 120px;
188
+ height: 40px;
189
+ padding: 0 16px;
190
+ color: rgba(51, 51, 51, 0.5);
191
+ font-weight: 500;
192
+ font-size: 14px;
193
+ line-height: 40px;
194
+ }
195
+
196
+ &-item {
197
+ display: flex;
198
+ align-items: center;
199
+ justify-content: space-between;
200
+ box-sizing: border-box;
201
+ width: 120px;
202
+ height: 40px;
203
+ padding: 9px 4px 9px 16px;
204
+ color: rgba(51, 51, 51, 1);
205
+ font-size: 14px;
206
+ line-height: 40px;
207
+ border-radius: 8px;
208
+ cursor: pointer;
209
+ .transition();
210
+
211
+ &:hover {
212
+ background-color: #e6e6e6;
213
+ }
214
+
215
+ &-favorite {
216
+ display: none;
217
+
218
+ &:hover {
219
+ display: block;
220
+ }
221
+
222
+ & > svg {
223
+ display: block;
224
+ }
225
+ }
226
+
227
+ &:hover &-favorite {
228
+ display: block;
229
+ }
230
+ }
231
+
232
+ &-gutter {
233
+ height: 1px;
234
+ margin: 12px 0 16px 12px;
235
+ background-color: rgba(196, 196, 196, 0.2);
236
+ }
237
+
238
+ &-collapsed &-gutter {
239
+ margin: 0 12px;
240
+ }
241
+
242
+ &-label {
243
+ margin: 0 0 12px 12px;
244
+ color: rgba(0, 0, 0, 0.5);
245
+ font-weight: 400;
246
+ font-size: 14px;
247
+ line-height: 22px;
248
+ }
249
+
250
+ &-divider-div {
251
+ padding-left: 16px;
252
+ }
253
+
254
+ &-divider-div-collapsed {
255
+ padding-right: 12px;
256
+ padding-left: 12px;
257
+ }
258
+
259
+ &-divider {
260
+ margin-top: 12px;
261
+ margin-bottom: 16px;
262
+ }
263
+
264
+ &-other-title {
265
+ margin: 0 0 8px 16px;
266
+ color: #000;
267
+ font-weight: 400;
268
+ font-size: 14px;
269
+ line-height: 22px;
270
+ opacity: 0.5;
271
+ }
272
+
273
+ &-more {
274
+ display: flex;
275
+ align-items: center;
276
+ justify-content: center;
277
+ box-sizing: border-box;
278
+ width: 107px;
279
+ height: 36px;
280
+ margin-left: 12px;
281
+ color: .primary() [];
282
+ font-size: 14px;
283
+ text-align: center;
284
+ background-color: #fff;
285
+ border: 1px solid .primary() [];
286
+ border-radius: 4px;
287
+ cursor: pointer;
288
+ user-select: none;
289
+ .transition();
290
+
291
+ &:hover {
292
+ background-color: rgba(222, 234, 255, 1);
293
+ }
294
+
295
+ & > span {
296
+ margin-left: 8px;
297
+ }
298
+ }
299
+
300
+ &-drawer {
301
+ position: absolute;
302
+ top: 0;
303
+ right: 0;
304
+ z-index: 10;
305
+ width: 740px;
306
+ height: 100vh;
307
+ background-color: #fff;
308
+ box-shadow: 0 12px 48px 16px rgba(0, 0, 0, 0.03), 0 9px 28px 0 rgba(0, 0, 0, 0.05),
309
+ 0 6px 16px -8px rgba(0, 0, 0, 0.08);
310
+ transform: translate3d(60px, 0, 0);
311
+ opacity: 0;
312
+ transition: all 0.2s;
313
+
314
+ &.animated {
315
+ transform: translate3d(0, 0, 0);
316
+ opacity: 1;
317
+ }
318
+
319
+ &-header {
320
+ display: flex;
321
+ align-items: center;
322
+ justify-content: space-between;
323
+ height: 56px;
324
+ padding: 0 24px;
325
+ color: #333;
326
+ font-weight: 500;
327
+ font-size: 16px;
328
+ border-bottom: 1px solid rgba(0, 0, 0, 0.08);
329
+ }
330
+
331
+ &-body {
332
+ height: calc(100vh - 56px);
333
+ padding: 16px;
334
+ overflow-x: hidden;
335
+ overflow-y: auto;
336
+ }
337
+
338
+ &-col {
339
+ display: inline-block;
340
+ width: 33.33333333%;
341
+ vertical-align: top;
342
+ }
343
+
344
+ .item() {
345
+ height: 44px;
346
+ padding: 0 16px;
347
+ font-size: 14px;
348
+ line-height: 44px;
349
+ }
350
+
351
+ &-1 {
352
+ color: rgba(51, 51, 51, 1);
353
+ font-weight: 500;
354
+ .item();
355
+
356
+ &-path {
357
+ cursor: pointer;
358
+ .transition();
359
+
360
+ &:hover {
361
+ color: .primary() [];
362
+ background-color: rgba(238, 238, 238, 1);
363
+ }
364
+ }
365
+ }
366
+
367
+ &-2 {
368
+ color: rgba(51, 51, 51, 0.5);
369
+ font-weight: 500;
370
+ .item();
371
+ }
372
+
373
+ &-3 {
374
+ color: rgba(51, 51, 51, 1);
375
+ cursor: pointer;
376
+ .item();
377
+ .transition();
378
+
379
+ &:hover {
380
+ color: .primary() [];
381
+ background-color: rgba(238, 238, 238, 1);
382
+ }
383
+ }
384
+
385
+ &-block {
386
+ padding: 8px;
387
+
388
+ & > div {
389
+ overflow: hidden;
390
+ background-color: rgba(238, 238, 238, 0.5);
391
+ border-radius: 8px;
392
+ }
393
+ }
394
+
395
+ &-close {
396
+ cursor: pointer;
397
+
398
+ &:hover {
399
+ color: .primary() [];
400
+ }
401
+ }
402
+ }
403
+
404
+ &-active {
405
+ color: .primary() [];
406
+ }
407
+ }
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ export default function TabBar<T extends {
2
+ title: string;
3
+ closable?: boolean;
4
+ }>(props: {
5
+ tabs: T[];
6
+ active: number;
7
+ onClick: (active: number) => void;
8
+ onClose: (active: number) => void;
9
+ }): JSX.Element;
@@ -0,0 +1,116 @@
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, { useEffect, useRef, useState } from 'react';
16
+ import classNames from 'classnames';
17
+ import { PREFIX_CLS as prefixCls } from '../../../constants';
18
+ import DropMenu from '../DropMenu';
19
+ import { useDebounce } from '@lemon-fe/hooks';
20
+ export default function TabBar(props) {
21
+ var tabs = props.tabs,
22
+ active = props.active,
23
+ _onClick = props.onClick,
24
+ onClose = props.onClose;
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
+
33
+ var handleClose = function handleClose(e, index) {
34
+ e.stopPropagation();
35
+ onClose(index);
36
+ };
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]);
65
+ return /*#__PURE__*/React.createElement("div", {
66
+ className: "".concat(prefixCls, "-nav-tabs-layout"),
67
+ ref: tabRef
68
+ }, /*#__PURE__*/React.createElement("div", {
69
+ className: "".concat(prefixCls, "-nav-tabs")
70
+ }, tabs.map(function (item, index) {
71
+ var _classNames;
72
+
73
+ var key = item.title;
74
+ return /*#__PURE__*/React.createElement("div", {
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)),
76
+ onClick: function onClick() {
77
+ return _onClick(index);
78
+ },
79
+ key: key
80
+ }, /*#__PURE__*/React.createElement("div", {
81
+ className: "".concat(prefixCls, "-nav-tab-title")
82
+ }, /*#__PURE__*/React.createElement("div", {
83
+ className: "".concat(prefixCls, "-nav-tab-inner")
84
+ }, item.title), item.closable !== false && /*#__PURE__*/React.createElement("div", {
85
+ className: "".concat(prefixCls, "-nav-tab-close"),
86
+ onClick: function onClick(e) {
87
+ return handleClose(e, index);
88
+ }
89
+ }, /*#__PURE__*/React.createElement("svg", {
90
+ width: "14",
91
+ height: "14",
92
+ xmlns: "http://www.w3.org/2000/svg"
93
+ }, /*#__PURE__*/React.createElement("g", {
94
+ fill: "none",
95
+ fillRule: "evenodd"
96
+ }, /*#__PURE__*/React.createElement("g", {
97
+ fill: "currentColor"
98
+ }, /*#__PURE__*/React.createElement("g", {
99
+ fillRule: "nonzero"
100
+ }, /*#__PURE__*/React.createElement("path", {
101
+ 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",
102
+ transform: "translate(-367.000000, -21.000000) translate(367.000000, 21.000000) translate(6.999923, 7.000068) rotate(45.000000) translate(-6.999923, -7.000068)"
103
+ }), /*#__PURE__*/React.createElement("path", {
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",
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)"
106
+ }))))))));
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
+ })));
116
+ }
@@ -0,0 +1,24 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import type { MenuFavorites, MenuItem } from './typings';
3
+ interface Props<T> {
4
+ active: number;
5
+ tabs: T[];
6
+ menus: MenuItem[];
7
+ onTabClick: (index: number) => void;
8
+ onTabClose: (index: number) => void;
9
+ onMenuClick: (menu: MenuItem) => void;
10
+ onRefresh: () => void;
11
+ onCloseOther: () => void;
12
+ onCloseAll: () => void;
13
+ right?: ReactNode;
14
+ children?: ReactNode;
15
+ logo?: string | false | ReactElement;
16
+ title: string | ReactNode;
17
+ favorites?: MenuFavorites;
18
+ onFavoritesChange?: (value: MenuFavorites) => void;
19
+ }
20
+ export default function MainFramework<TabType extends {
21
+ title: string;
22
+ closable?: boolean;
23
+ }>(props: Props<TabType>): JSX.Element;
24
+ export {};