@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
@@ -24,9 +24,9 @@
24
24
  align-items: center;
25
25
  justify-content: flex-end;
26
26
  height: 100%;
27
+ padding-left: 8px;
27
28
  white-space: nowrap;
28
29
  background-color: inherit;
29
- background-clip: content-box;
30
30
 
31
31
  &::before {
32
32
  position: absolute;
@@ -0,0 +1,47 @@
1
+ .lemon-color-picker {
2
+ position: relative;
3
+ display: flex;
4
+ align-items: center;
5
+ justify-content: space-between;
6
+ height: 36px;
7
+ padding: 6px;
8
+ color: #333;
9
+ border: 1px solid #ccc;
10
+ border-radius: 2px;
11
+ cursor: pointer;
12
+
13
+ &-hex {
14
+ user-select: none;
15
+ }
16
+
17
+ &-color {
18
+ width: 120px;
19
+ height: 100%;
20
+ border-radius: 2px;
21
+ }
22
+
23
+ &-alpha {
24
+ padding: 0 6px 0 12px;
25
+ line-height: 20px;
26
+ border-left: 1px solid #ccc;
27
+ user-select: none;
28
+ }
29
+ &-pop {
30
+ position: absolute;
31
+ top: 40px;
32
+ left: 0;
33
+ z-index: 1000;
34
+ }
35
+ &-react-picker {
36
+ border-radius: 4px;
37
+ box-shadow: #00000026 0 0 0 1px, #00000026 0 8px 16px;
38
+ }
39
+ &-mask {
40
+ position: fixed;
41
+ top: 0;
42
+ left: 0;
43
+ z-index: 800;
44
+ width: 100%;
45
+ height: 100%;
46
+ }
47
+ }
@@ -1,407 +0,0 @@
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
- }
@@ -22,5 +22,4 @@ export interface TableProps<RecordType> extends BaseTableProps<RecordType> {
22
22
  autoLoad?: boolean;
23
23
  actionRef?: RefObject<TableRef<RecordType>>;
24
24
  onLoading?: (loading: boolean) => void;
25
- pagination?: PaginationProps;
26
25
  }
package/es/index.less CHANGED
@@ -11,6 +11,7 @@
11
11
  @import './DurationPicker/index.less';
12
12
  @import './InputMaxLength/index.less';
13
13
  @import './TipMark/index.less';
14
+ @import './ColorPicker/index.less';
14
15
  @import './Popup/index.less';
15
16
  @import './SiderTree/index.less';
16
17
  @import './FormLayout/index.less';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.1.78",
3
+ "version": "0.1.82",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -19,6 +19,8 @@
19
19
  "@lemon-fe/hooks": "^0.1.67",
20
20
  "classnames": "^2.2.6",
21
21
  "lodash": "^4.17.21",
22
+ "react-color": "^2.19.3",
23
+ "react-gcolor-picker": "^1.2.4",
22
24
  "react-resizable": "^3.0.4"
23
25
  },
24
26
  "peerDependencies": {
@@ -35,11 +37,12 @@
35
37
  "devDependencies": {
36
38
  "@types/color-string": "^1.5.2",
37
39
  "@types/lodash": "^4.14.179",
40
+ "@types/react-color": "^3.0.6",
38
41
  "@types/react-resizable": "^1.7.4",
39
42
  "antd": "^4.21.6",
40
43
  "rc-resize-observer": "^1.2.0",
41
44
  "react": "^17.0.2",
42
45
  "react-dom": "^17.0.2"
43
46
  },
44
- "gitHead": "c3ea23e58ff912db41794c92c844fcf9b2d7c18c"
47
+ "gitHead": "c2ffb0903a7684bd2815c86144cbb5007215c104"
45
48
  }
@@ -1,26 +0,0 @@
1
- import { ReactElement } from 'react';
2
- import type { CSSProperties } from 'react';
3
- import { ButtonProps } from 'antd';
4
- interface ActionBtn extends ButtonProps {
5
- text: string | ReactElement;
6
- onClick?: () => void;
7
- /**
8
- * @deprecated
9
- * 请不要使用
10
- */
11
- action?: () => void;
12
- dropDown?: ({
13
- text: string;
14
- onClick: () => void;
15
- disabled?: boolean;
16
- } | null)[];
17
- }
18
- interface Props {
19
- actions: (ActionBtn | ReactElement | null)[];
20
- style?: CSSProperties;
21
- className?: string;
22
- prefixCls?: string;
23
- maxShowCount?: number;
24
- }
25
- declare function Actions(props: Props): JSX.Element;
26
- export default Actions;
@@ -1,171 +0,0 @@
1
- var _excluded = ["disabled", "dropDown", "text", "onClick", "icon", "action"];
2
-
3
- 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; }
4
-
5
- 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; }
6
-
7
- 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; }
8
-
9
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
-
11
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
-
13
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
-
15
- 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."); }
16
-
17
- 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); }
18
-
19
- 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; }
20
-
21
- 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; }
22
-
23
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
-
25
- import React, { Fragment, useState } from 'react';
26
- import { Space, Dropdown, Menu, Button, Popover } from 'antd';
27
- import classNames from 'classnames';
28
- import Icons from '../Icons';
29
- import { PREFIX_CLS } from '../constants';
30
-
31
- function Actions(props) {
32
- var actions = props.actions,
33
- className = props.className,
34
- style = props.style,
35
- _props$prefixCls = props.prefixCls,
36
- prefixCls = _props$prefixCls === void 0 ? PREFIX_CLS : _props$prefixCls,
37
- _props$maxShowCount = props.maxShowCount,
38
- maxShowCount = _props$maxShowCount === void 0 ? 3 : _props$maxShowCount;
39
-
40
- var _useState = useState(false),
41
- _useState2 = _slicedToArray(_useState, 2),
42
- visible = _useState2[0],
43
- setVisible = _useState2[1];
44
-
45
- var visibleBtns = actions.slice(0, maxShowCount);
46
- var collapsedBtns = actions.slice(maxShowCount);
47
- return /*#__PURE__*/React.createElement("div", {
48
- className: classNames("".concat(prefixCls, "-actions"), className),
49
- style: style
50
- }, /*#__PURE__*/React.createElement(Space, {
51
- direction: "horizontal",
52
- size: 12
53
- }, visibleBtns.map(function (item, index) {
54
- if (item === null) {
55
- return item;
56
- }
57
-
58
- if ( /*#__PURE__*/React.isValidElement(item)) {
59
- return /*#__PURE__*/React.createElement(Fragment, {
60
- key: index
61
- }, item);
62
- }
63
-
64
- var disabled = item.disabled,
65
- dropDown = item.dropDown,
66
- text = item.text,
67
- onClick = item.onClick,
68
- icon = item.icon,
69
- action = item.action,
70
- rest = _objectWithoutProperties(item, _excluded);
71
-
72
- if ( /*#__PURE__*/React.isValidElement(text)) {
73
- return /*#__PURE__*/React.createElement(Fragment, {
74
- key: index
75
- }, text);
76
- }
77
-
78
- var handleClick = onClick || action;
79
-
80
- if (Array.isArray(dropDown)) {
81
- var overlay = /*#__PURE__*/React.createElement(Menu, null, dropDown.map(function (subItem) {
82
- if (subItem) {
83
- return /*#__PURE__*/React.createElement(Menu.Item, {
84
- onClick: function onClick() {
85
- return subItem.onClick();
86
- },
87
- key: subItem.text,
88
- disabled: subItem.disabled
89
- }, subItem.text);
90
- }
91
- }));
92
-
93
- if (handleClick !== undefined) {
94
- return /*#__PURE__*/React.createElement(Dropdown.Button, {
95
- key: text,
96
- disabled: disabled,
97
- overlay: overlay,
98
- onClick: handleClick,
99
- buttonsRender: function buttonsRender(_ref) {
100
- var _ref2 = _slicedToArray(_ref, 2),
101
- leftBtn = _ref2[0],
102
- _ = _ref2[1];
103
-
104
- return [leftBtn, /*#__PURE__*/React.createElement(Button, {
105
- icon: /*#__PURE__*/React.createElement(Icons.More, null)
106
- })];
107
- }
108
- }, text);
109
- }
110
-
111
- return /*#__PURE__*/React.createElement(Dropdown, {
112
- key: text,
113
- disabled: disabled,
114
- overlay: overlay
115
- }, /*#__PURE__*/React.createElement(Button, _objectSpread({
116
- disabled: disabled,
117
- icon: icon
118
- }, rest), text, /*#__PURE__*/React.createElement(Icons.Down, {
119
- style: {
120
- opacity: 0.7,
121
- fontSize: 16,
122
- verticalAlign: -3
123
- }
124
- })));
125
- }
126
-
127
- return /*#__PURE__*/React.createElement(Button, _objectSpread({
128
- key: text,
129
- disabled: disabled,
130
- onClick: handleClick,
131
- icon: icon
132
- }, rest), text);
133
- }), collapsedBtns.length > 0 ? /*#__PURE__*/React.createElement(Popover, {
134
- placement: "bottomRight",
135
- overlayClassName: "".concat(prefixCls, "-actions-popover"),
136
- onVisibleChange: setVisible,
137
- visible: visible,
138
- trigger: "click",
139
- content: collapsedBtns.map(function (item, index) {
140
- if (item === null) {
141
- return item;
142
- }
143
-
144
- if ( /*#__PURE__*/React.isValidElement(item)) {
145
- return /*#__PURE__*/React.createElement(Fragment, {
146
- key: index
147
- }, item);
148
- }
149
-
150
- var disabled = item.disabled;
151
- return /*#__PURE__*/React.createElement("div", {
152
- className: classNames("".concat(prefixCls, "-actions-popover-item"), _defineProperty({}, "".concat(prefixCls, "-actions-popover-item-disabled"), disabled)),
153
- key: index,
154
- onClick: function onClick() {
155
- if (!disabled) {
156
- var handleClick = item.onClick || item.action;
157
- setVisible(false);
158
-
159
- if (handleClick) {
160
- handleClick();
161
- }
162
- }
163
- }
164
- }, item.text);
165
- })
166
- }, /*#__PURE__*/React.createElement(Button, {
167
- icon: /*#__PURE__*/React.createElement(Icons.More, null)
168
- })) : null));
169
- }
170
-
171
- export default Actions;