@lemon-fe/components 0.0.1 → 0.0.5

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { BaseTableProps as Props } from './typings';
3
2
  declare function BaseTable<T extends Record<string, any>>(props: Props<T>): JSX.Element;
4
3
  declare namespace BaseTable {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Moment } from 'moment';
3
2
  import type { RangePickerProps } from 'antd/lib/date-picker';
4
3
  declare type Value = {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { FormItemProps } from 'antd';
3
2
  import { EditableTableProps } from './typings';
4
3
  declare type Props<T> = Pick<FormItemProps, 'name' | 'label' | 'labelCol' | 'wrapperCol' | 'className' | 'required' | 'style' | 'colon'> & EditableTableProps<T>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ComponentOption, FilterProps } from './typings';
3
2
  declare function Filter<T extends Record<string, any> = Record<string, any>>(props: FilterProps<T>): JSX.Element;
4
3
  declare namespace Filter {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MenuItem } from '../../typings';
3
2
  interface Props {
4
3
  data: MenuItem[];
@@ -12,10 +12,33 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
12
12
 
13
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
 
15
- import React, { useMemo, useRef, useState } from 'react';
15
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
16
+ import { createPortal } from 'react-dom';
16
17
  import classNames from 'classnames';
17
18
  import { useDebounce } from '@lemon-fe/hooks';
18
19
  import { PREFIX_CLS as prefixCls } from '../../../constants';
20
+ var drawerIcon = /*#__PURE__*/React.createElement("svg", {
21
+ width: "20",
22
+ height: "20",
23
+ xmlns: "http://www.w3.org/2000/svg"
24
+ }, /*#__PURE__*/React.createElement("g", {
25
+ fill: "none",
26
+ fillRule: "evenodd"
27
+ }, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("g", {
28
+ fill: "currentColor"
29
+ }, /*#__PURE__*/React.createElement("path", {
30
+ 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",
31
+ opacity: ".7",
32
+ transform: "translate(-274.000000, -586.000000) translate(274.000000, 586.000000)"
33
+ }), /*#__PURE__*/React.createElement("path", {
34
+ 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",
35
+ opacity: ".7",
36
+ transform: "translate(-274.000000, -586.000000) translate(274.000000, 586.000000)"
37
+ }), /*#__PURE__*/React.createElement("path", {
38
+ 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",
39
+ opacity: ".7",
40
+ transform: "translate(-274.000000, -586.000000) translate(274.000000, 586.000000)"
41
+ })))));
19
42
  export default function Menu(props) {
20
43
  var menus = props.data,
21
44
  onClick = props.onClick;
@@ -27,21 +50,27 @@ export default function Menu(props) {
27
50
  setPopover = _useState2[1];
28
51
 
29
52
  var popup = useRef(null);
53
+ var drawer = useRef(null);
30
54
 
31
55
  var _useState3 = useState(false),
32
56
  _useState4 = _slicedToArray(_useState3, 2),
33
57
  collapsed = _useState4[0],
34
58
  setCollapsed = _useState4[1];
35
59
 
36
- var _useState5 = useState(0),
60
+ var _useState5 = useState(false),
37
61
  _useState6 = _slicedToArray(_useState5, 2),
38
- top = _useState6[0],
39
- setTop = _useState6[1];
62
+ visible = _useState6[0],
63
+ setVisible = _useState6[1];
64
+
65
+ var _useState7 = useState(0),
66
+ _useState8 = _slicedToArray(_useState7, 2),
67
+ top = _useState8[0],
68
+ setTop = _useState8[1];
40
69
 
41
70
  var activeMenu = useMemo(function () {
42
71
  var check = function check(path) {
43
72
  if (path) {
44
- return new RegExp("".concat(path, "\\b")).test(location.pathname);
73
+ return new RegExp("".concat(path, "(?![^\\/])")).test(location.pathname);
45
74
  }
46
75
 
47
76
  return false;
@@ -54,7 +83,10 @@ export default function Menu(props) {
54
83
  topPath = _menus$i.path;
55
84
 
56
85
  if (check(topPath)) {
57
- return i;
86
+ return {
87
+ path: [i],
88
+ key: topPath
89
+ };
58
90
  }
59
91
 
60
92
  for (var j = 0; j < subMenus.length; j += 1) {
@@ -64,12 +96,18 @@ export default function Menu(props) {
64
96
  items = _subMenus$j$children === void 0 ? [] : _subMenus$j$children;
65
97
 
66
98
  if (check(subPath)) {
67
- return i;
99
+ return {
100
+ path: [i, j],
101
+ key: subPath
102
+ };
68
103
  }
69
104
 
70
105
  for (var k = 0; k < items.length; k += 1) {
71
106
  if (check(items[k].path)) {
72
- return i;
107
+ return {
108
+ path: [i, j, k],
109
+ key: items[k].path
110
+ };
73
111
  }
74
112
  }
75
113
  }
@@ -85,56 +123,170 @@ export default function Menu(props) {
85
123
  popup.current.classList.add('animated');
86
124
  }
87
125
  }, 16);
126
+ } else {
127
+ setPopover(null);
88
128
  }
89
129
  };
90
130
 
91
- var handleClick = function handleClick(item) {
92
- if (item.path) {
93
- setPopover(null);
94
- onClick(item);
131
+ var closeMenu = function closeMenu() {
132
+ if (popup.current) {
133
+ popup.current.classList.remove('animated');
134
+
135
+ var handler = function handler() {
136
+ var _popup$current;
137
+
138
+ setPopover(null);
139
+ (_popup$current = popup.current) === null || _popup$current === void 0 ? void 0 : _popup$current.removeEventListener('transitionend', handler);
140
+ };
141
+
142
+ popup.current.addEventListener('transitionend', handler);
95
143
  }
96
144
  };
97
145
 
98
- var handleMouseEnter = useDebounce(openMenu, 200);
146
+ var toggle = useDebounce(function (handler) {
147
+ if (handler) {
148
+ handler();
149
+ }
150
+ }, 200);
99
151
 
100
- var toggleMenu = function toggleMenu() {
152
+ var toggleCollapse = function toggleCollapse() {
101
153
  setCollapsed(function (prev) {
102
154
  return !prev;
103
155
  });
104
156
  };
105
157
 
106
- var closeMenu = function closeMenu() {
107
- handleMouseEnter.cancel();
158
+ useEffect(function () {
159
+ if (!visible) {
160
+ return;
161
+ }
108
162
 
109
- if (popup.current) {
110
- popup.current.classList.remove('animated');
163
+ var target = drawer.current;
164
+
165
+ if (target !== null) {
166
+ var handler = function handler(e) {
167
+ if (!target.contains(e.target)) {
168
+ closeDrawer();
169
+ }
170
+ };
171
+
172
+ requestAnimationFrame(function () {
173
+ window.addEventListener('click', handler);
174
+ });
175
+ return function () {
176
+ window.removeEventListener('click', handler);
177
+ };
178
+ }
179
+ }, [visible]);
180
+
181
+ var openDrawer = function openDrawer() {
182
+ setVisible(true);
183
+ setTimeout(function () {
184
+ var _drawer$current;
185
+
186
+ (_drawer$current = drawer.current) === null || _drawer$current === void 0 ? void 0 : _drawer$current.classList.add('animated');
187
+ }, 16);
188
+ };
189
+
190
+ var closeDrawer = function closeDrawer() {
191
+ if (drawer.current) {
192
+ drawer.current.classList.remove('animated');
111
193
 
112
194
  var handler = function handler() {
113
- var _popup$current;
195
+ var _drawer$current2;
114
196
 
115
- setPopover(null);
116
- (_popup$current = popup.current) === null || _popup$current === void 0 ? void 0 : _popup$current.removeEventListener('transitionend', handler);
197
+ (_drawer$current2 = drawer.current) === null || _drawer$current2 === void 0 ? void 0 : _drawer$current2.removeEventListener('transitionend', handler);
198
+ setVisible(false);
117
199
  };
118
200
 
119
- popup.current.addEventListener('transitionend', handler);
201
+ drawer.current.addEventListener('transitionend', handler);
202
+ }
203
+ };
204
+
205
+ var handleClick = function handleClick(item) {
206
+ if (item.path) {
207
+ onClick(item);
208
+ closeDrawer();
209
+ closeMenu();
120
210
  }
121
211
  };
122
212
 
123
213
  var renderItem = function renderItem(item, index) {
124
214
  return /*#__PURE__*/React.createElement("div", {
125
215
  key: index,
126
- className: "".concat(prefixCls, "-menu-item"),
216
+ className: classNames("".concat(prefixCls, "-menu-item"), _defineProperty({}, "".concat(prefixCls, "-menu-active"), activeMenu !== undefined && activeMenu.key === item.path)),
127
217
  onClick: function onClick() {
128
218
  return handleClick(item);
129
219
  }
130
220
  }, item.name);
131
221
  };
132
222
 
223
+ var renderDrawerItems = function renderDrawerItems() {
224
+ var cols = [[], [], []];
225
+ var value = [0, 0, 0];
226
+ menus.forEach(function (item) {
227
+ var list = [/*#__PURE__*/React.createElement("div", {
228
+ className: classNames("".concat(prefixCls, "-menu-drawer-1"), _defineProperty({}, "".concat(prefixCls, "-menu-drawer-1-path"), item.path !== undefined)),
229
+ key: item.name,
230
+ onClick: function onClick() {
231
+ return handleClick(item);
232
+ }
233
+ }, item.name)];
234
+
235
+ if (item.children) {
236
+ item.children.forEach(function (subItem) {
237
+ list.push( /*#__PURE__*/React.createElement("div", {
238
+ className: "".concat(prefixCls, "-menu-drawer-2"),
239
+ key: "2-".concat(subItem.name),
240
+ onClick: function onClick() {
241
+ return handleClick(subItem);
242
+ }
243
+ }, subItem.name));
244
+
245
+ if (subItem.children) {
246
+ subItem.children.forEach(function (child) {
247
+ list.push( /*#__PURE__*/React.createElement("div", {
248
+ className: classNames("".concat(prefixCls, "-menu-drawer-3"), _defineProperty({}, "".concat(prefixCls, "-menu-active"), activeMenu !== undefined && activeMenu.key === child.path)),
249
+ key: "3-".concat(child.name),
250
+ onClick: function onClick() {
251
+ return handleClick(child);
252
+ }
253
+ }, child.name));
254
+ });
255
+ }
256
+ });
257
+ }
258
+
259
+ var node = /*#__PURE__*/React.createElement("div", {
260
+ className: "".concat(prefixCls, "-menu-drawer-block")
261
+ }, /*#__PURE__*/React.createElement("div", null, list));
262
+ var target = 0;
263
+ var min = Infinity;
264
+
265
+ for (var i = 0; i < value.length; i++) {
266
+ if (value[i] < min) {
267
+ target = i;
268
+ min = value[i];
269
+ }
270
+ }
271
+
272
+ value[target] += list.length;
273
+ cols[target].push(node);
274
+ });
275
+ return cols.map(function (items, index) {
276
+ return /*#__PURE__*/React.createElement("div", {
277
+ className: "".concat(prefixCls, "-menu-drawer-col"),
278
+ key: index
279
+ }, items);
280
+ });
281
+ };
282
+
133
283
  return /*#__PURE__*/React.createElement("div", {
134
284
  className: classNames("".concat(prefixCls, "-menu"), _defineProperty({}, "".concat(prefixCls, "-menu-collapsed"), collapsed))
135
285
  }, /*#__PURE__*/React.createElement("div", {
136
286
  className: "".concat(prefixCls, "-menu-bar"),
137
- onMouseLeave: closeMenu
287
+ onMouseLeave: function onMouseLeave() {
288
+ return toggle(closeMenu);
289
+ }
138
290
  }, popover !== null && popover.children !== undefined && /*#__PURE__*/React.createElement("div", {
139
291
  className: "".concat(prefixCls, "-menu-popup"),
140
292
  style: {
@@ -142,7 +294,7 @@ export default function Menu(props) {
142
294
  },
143
295
  ref: popup,
144
296
  onMouseEnter: function onMouseEnter() {
145
- return handleMouseEnter.cancel();
297
+ return toggle.cancel();
146
298
  }
147
299
  }, /*#__PURE__*/React.createElement("div", {
148
300
  className: "".concat(prefixCls, "-menu-popup-body")
@@ -155,7 +307,7 @@ export default function Menu(props) {
155
307
  }, item.name), item.children !== undefined && item.children.map(renderItem));
156
308
  }))), /*#__PURE__*/React.createElement("div", {
157
309
  className: "".concat(prefixCls, "-menu-collapse"),
158
- onClick: toggleMenu
310
+ onClick: toggleCollapse
159
311
  }, /*#__PURE__*/React.createElement("svg", {
160
312
  width: "20",
161
313
  height: "20",
@@ -171,7 +323,7 @@ export default function Menu(props) {
171
323
  }), /*#__PURE__*/React.createElement("path", {
172
324
  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",
173
325
  fill: "currentColor",
174
- "fill-rule": "nonzero",
326
+ fillRule: "nonzero",
175
327
  transform: "translate(-274.000000, -57.000000) translate(284.000000, 67.000000) scale(-1, 1) translate(-284.000000, -67.000000) translate(274.000000, 57.000000)"
176
328
  }), /*#__PURE__*/React.createElement("path", {
177
329
  d: "M11.7426212,6.79290128 L5.32842371,6.79290128 L5.32842371,13.2070987",
@@ -182,16 +334,19 @@ export default function Menu(props) {
182
334
  strokeDasharray: "0,0",
183
335
  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)"
184
336
  })))))), menus.map(function (item, index) {
185
- var _classNames2;
337
+ var _classNames5;
186
338
 
187
339
  return /*#__PURE__*/React.createElement("div", {
188
340
  key: index,
189
- className: classNames("".concat(prefixCls, "-menu-top-item"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-menu-top-item-active"), index === activeMenu), _defineProperty(_classNames2, "".concat(prefixCls, "-menu-top-item-popover-active"), item === popover), _classNames2)),
341
+ 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)),
190
342
  onClick: function onClick() {
191
343
  return handleClick(item);
192
344
  },
193
345
  onMouseEnter: function onMouseEnter(e) {
194
- return handleMouseEnter(item, e.currentTarget);
346
+ var target = e.currentTarget;
347
+ toggle(function () {
348
+ return openMenu(item, target);
349
+ });
195
350
  }
196
351
  }, /*#__PURE__*/React.createElement("img", {
197
352
  className: "".concat(prefixCls, "-menu-icon"),
@@ -199,5 +354,50 @@ export default function Menu(props) {
199
354
  }), /*#__PURE__*/React.createElement("div", {
200
355
  className: "".concat(prefixCls, "-menu-title")
201
356
  }, item.name));
202
- })));
357
+ })), false && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
358
+ className: "".concat(prefixCls, "-menu-gutter")
359
+ }), collapsed ? /*#__PURE__*/React.createElement("div", {
360
+ className: "".concat(prefixCls, "-menu-top-item"),
361
+ onClick: openDrawer
362
+ }, drawerIcon) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
363
+ className: "".concat(prefixCls, "-menu-label")
364
+ }, "\u6CA1\u6709\u627E\u5230\u60F3\u8981\u7684\u529F\u80FD?"), /*#__PURE__*/React.createElement("div", {
365
+ className: "".concat(prefixCls, "-menu-more"),
366
+ onClick: openDrawer
367
+ }, drawerIcon, /*#__PURE__*/React.createElement("span", null, "\u67E5\u770B\u5168\u90E8")))), visible && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
368
+ className: "".concat(prefixCls, "-menu-drawer"),
369
+ ref: drawer
370
+ }, /*#__PURE__*/React.createElement("div", {
371
+ className: "".concat(prefixCls, "-menu-drawer-header")
372
+ }, /*#__PURE__*/React.createElement("div", null, "\u67E5\u770B\u5168\u90E8"), /*#__PURE__*/React.createElement("div", {
373
+ className: "".concat(prefixCls, "-menu-drawer-close"),
374
+ onClick: closeDrawer
375
+ }, /*#__PURE__*/React.createElement("svg", {
376
+ width: "16",
377
+ height: "16",
378
+ xmlns: "http://www.w3.org/2000/svg"
379
+ }, /*#__PURE__*/React.createElement("g", {
380
+ fill: "none",
381
+ fillRule: "evenodd",
382
+ opacity: ".7"
383
+ }, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("g", {
384
+ transform: "translate(-1880.000000, -20.000000) translate(1880.000000, 20.000000)",
385
+ fill: "currentColor"
386
+ }, /*#__PURE__*/React.createElement("rect", {
387
+ transform: "translate(8.000000, 8.000000) rotate(-45.000000) translate(-8.000000, -8.000000)",
388
+ x: "7.25",
389
+ y: "1",
390
+ width: "1.5",
391
+ height: "14",
392
+ rx: ".75"
393
+ }), /*#__PURE__*/React.createElement("rect", {
394
+ transform: "translate(8.000000, 8.000000) scale(-1, 1) rotate(-45.000000) translate(-8.000000, -8.000000)",
395
+ x: "7.25",
396
+ y: "1",
397
+ width: "1.5",
398
+ height: "14",
399
+ rx: ".75"
400
+ }))))))), /*#__PURE__*/React.createElement("div", {
401
+ className: "".concat(prefixCls, "-menu-drawer-body")
402
+ }, renderDrawerItems())), document.body));
203
403
  }
@@ -1,7 +1,13 @@
1
+ .transition() {
2
+ transition: background-color 0.2s;
3
+ }
4
+
1
5
  .@{prefixCls}-menu {
2
6
  flex: 0 0 200px;
3
7
  min-width: 0;
4
8
  height: 100%;
9
+ padding: 16px 0;
10
+ white-space: nowrap;
5
11
  transition: flex 0.1s;
6
12
 
7
13
  &-collapsed {
@@ -13,7 +19,6 @@
13
19
  z-index: 3;
14
20
  box-sizing: border-box;
15
21
  width: 100%;
16
- padding: 16px 0;
17
22
  background: #f2f2f2;
18
23
  }
19
24
 
@@ -45,15 +50,13 @@
45
50
  padding: 0 16px;
46
51
  }
47
52
 
48
- &-collapsed &-title {
49
- display: none;
50
- }
51
-
52
53
  &-collapsed &-popup {
53
54
  left: 52px;
54
55
  }
55
56
 
56
57
  &-top-item {
58
+ display: flex;
59
+ align-items: center;
57
60
  box-sizing: border-box;
58
61
  height: 44px;
59
62
  margin: 0 12px;
@@ -61,10 +64,9 @@
61
64
  overflow: hidden;
62
65
  color: #333;
63
66
  font-size: 14px;
64
- line-height: 44px;
65
67
  border-radius: 8px;
66
68
  cursor: pointer;
67
- transition: background-color 0.2s;
69
+ .transition();
68
70
 
69
71
  &:hover,
70
72
  &-popover-active {
@@ -89,12 +91,10 @@
89
91
  }
90
92
 
91
93
  &-icon {
92
- display: inline-block;
93
94
  width: 20px;
94
95
  height: 20px;
95
96
  margin-right: 8px;
96
97
  font-size: 16px;
97
- vertical-align: middle;
98
98
  opacity: 0.7;
99
99
  }
100
100
 
@@ -103,11 +103,9 @@
103
103
  }
104
104
 
105
105
  &-title {
106
- display: inline-block;
107
106
  overflow: hidden;
108
107
  white-space: nowrap;
109
108
  text-overflow: ellipsis;
110
- vertical-align: middle;
111
109
  }
112
110
 
113
111
  &-popup {
@@ -120,6 +118,7 @@
120
118
  &-body {
121
119
  position: relative;
122
120
  z-index: 1;
121
+ display: flex;
123
122
  margin-left: 4px;
124
123
  padding: 8px;
125
124
  background: #f9f9f9;
@@ -128,7 +127,7 @@
128
127
  0 6px 16px -8px rgba(0, 0, 0, 0.08);
129
128
  transform: translate3d(-40px, 0, 0);
130
129
  opacity: 0;
131
- transition: all 0.3s;
130
+ transition: all 0.2s;
132
131
  }
133
132
 
134
133
  &.animated &-body {
@@ -161,8 +160,7 @@
161
160
  width: 120px;
162
161
  height: 40px;
163
162
  padding: 0 16px;
164
- color: #979797;
165
- font-weight: 600;
163
+ color: rgba(51, 51, 51, 0.5);
166
164
  font-size: 14px;
167
165
  line-height: 40px;
168
166
  }
@@ -175,12 +173,12 @@
175
173
  width: 120px;
176
174
  height: 40px;
177
175
  padding: 0 16px;
178
- color: rgba(51, 51, 51, 0.85);
176
+ color: rgba(51, 51, 51, 1);
179
177
  font-size: 14px;
180
178
  line-height: 40px;
181
179
  border-radius: 8px;
182
180
  cursor: pointer;
183
- transition: background-color 0.2s;
181
+ .transition();
184
182
 
185
183
  &:hover {
186
184
  background-color: #e6e6e6;
@@ -202,4 +200,157 @@
202
200
  display: block;
203
201
  }
204
202
  }
203
+
204
+ &-gutter {
205
+ height: 1px;
206
+ margin: 12px 0 16px 12px;
207
+ background-color: rgba(196, 196, 196, 0.2);
208
+ }
209
+
210
+ &-collapsed &-gutter {
211
+ margin: 0 12px;
212
+ }
213
+
214
+ &-label {
215
+ margin: 0 0 12px 12px;
216
+ color: rgba(0, 0, 0, 0.5);
217
+ font-weight: 400;
218
+ font-size: 14px;
219
+ line-height: 22px;
220
+ }
221
+
222
+ &-more {
223
+ display: flex;
224
+ align-items: center;
225
+ justify-content: center;
226
+ box-sizing: border-box;
227
+ width: 107px;
228
+ height: 36px;
229
+ margin-left: 12px;
230
+ color: rgba(5, 96, 253, 1);
231
+ font-size: 14px;
232
+ text-align: center;
233
+ background-color: #fff;
234
+ border: 1px solid rgba(5, 96, 253, 1);
235
+ border-radius: 4px;
236
+ cursor: pointer;
237
+ user-select: none;
238
+ .transition();
239
+
240
+ &:hover {
241
+ background-color: rgba(222, 234, 255, 1);
242
+ }
243
+
244
+ & > span {
245
+ margin-left: 8px;
246
+ }
247
+ }
248
+
249
+ &-drawer {
250
+ position: absolute;
251
+ top: 0;
252
+ right: 0;
253
+ z-index: 10;
254
+ width: 740px;
255
+ height: 100vh;
256
+ background-color: #fff;
257
+ box-shadow: 0 12px 48px 16px rgba(0, 0, 0, 0.03), 0 9px 28px 0 rgba(0, 0, 0, 0.05),
258
+ 0 6px 16px -8px rgba(0, 0, 0, 0.08);
259
+ transform: translate3d(60px, 0, 0);
260
+ opacity: 0;
261
+ transition: all 0.2s;
262
+
263
+ &.animated {
264
+ transform: translate3d(0, 0, 0);
265
+ opacity: 1;
266
+ }
267
+
268
+ &-header {
269
+ display: flex;
270
+ align-items: center;
271
+ justify-content: space-between;
272
+ height: 56px;
273
+ padding: 0 24px;
274
+ color: #333;
275
+ font-weight: 500;
276
+ font-size: 16px;
277
+ border-bottom: 1px solid rgba(0, 0, 0, 0.08);
278
+ }
279
+
280
+ &-body {
281
+ height: calc(100vh - 56px);
282
+ padding: 16px;
283
+ overflow-x: hidden;
284
+ overflow-y: auto;
285
+ }
286
+
287
+ &-col {
288
+ display: inline-block;
289
+ width: 33.33333333%;
290
+ vertical-align: top;
291
+ }
292
+
293
+ .item() {
294
+ height: 44px;
295
+ padding: 0 16px;
296
+ font-size: 14px;
297
+ line-height: 44px;
298
+ }
299
+
300
+ &-1 {
301
+ color: rgba(51, 51, 51, 1);
302
+ font-weight: 500;
303
+ .item();
304
+
305
+ &-path {
306
+ cursor: pointer;
307
+ .transition();
308
+
309
+ &:hover {
310
+ color: rgba(5, 96, 253, 1);
311
+ background-color: rgba(238, 238, 238, 1);
312
+ }
313
+ }
314
+ }
315
+
316
+ &-2 {
317
+ color: rgba(51, 51, 51, 0.5);
318
+ font-weight: 500;
319
+ .item();
320
+ }
321
+
322
+ &-3 {
323
+ color: rgba(51, 51, 51, 1);
324
+ cursor: pointer;
325
+ .item();
326
+ .transition();
327
+
328
+ &:hover {
329
+ color: rgba(5, 96, 253, 1);
330
+ background-color: rgba(238, 238, 238, 1);
331
+ }
332
+ }
333
+
334
+ &-block {
335
+ padding: 8px;
336
+
337
+ & > div {
338
+ overflow: hidden;
339
+ background-color: rgba(238, 238, 238, 0.5);
340
+ border-radius: 8px;
341
+ }
342
+ }
343
+
344
+ &-close {
345
+ cursor: pointer;
346
+
347
+ &:hover {
348
+ color: rgba(5, 96, 253, 1);
349
+ }
350
+ }
351
+ }
352
+
353
+ &-active {
354
+ color: rgba(5, 96, 253, 1);
355
+ }
205
356
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export default function TabBar<T extends {
3
2
  title: string;
4
3
  }>(props: {
@@ -34,28 +34,22 @@ export default function TabBar(props) {
34
34
  return handleClose(e, index);
35
35
  }
36
36
  }, /*#__PURE__*/React.createElement("svg", {
37
- width: "10",
38
- height: "10",
39
- viewBox: "0 0 9 9",
37
+ width: "14",
38
+ height: "14",
40
39
  xmlns: "http://www.w3.org/2000/svg"
41
40
  }, /*#__PURE__*/React.createElement("g", {
42
- fill: "#000",
43
- fillRule: "evenodd",
44
- fillOpacity: ".25"
45
- }, /*#__PURE__*/React.createElement("rect", {
46
- transform: "rotate(45 4.559 4.559)",
47
- x: "3.976",
48
- y: ".059",
49
- width: "1",
50
- height: "9",
51
- rx: ".5"
52
- }), /*#__PURE__*/React.createElement("rect", {
53
- transform: "rotate(-45 4.559 4.441)",
54
- x: "3.976",
55
- y: "-.059",
56
- width: "1",
57
- height: "9",
58
- rx: ".5"
59
- }))))));
41
+ fill: "none",
42
+ fillRule: "evenodd"
43
+ }, /*#__PURE__*/React.createElement("g", {
44
+ fill: "currentColor"
45
+ }, /*#__PURE__*/React.createElement("g", {
46
+ fillRule: "nonzero"
47
+ }, /*#__PURE__*/React.createElement("path", {
48
+ 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",
49
+ transform: "translate(-367.000000, -21.000000) translate(367.000000, 21.000000) translate(6.999923, 7.000068) rotate(45.000000) translate(-6.999923, -7.000068)"
50
+ }), /*#__PURE__*/React.createElement("path", {
51
+ 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
+ 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
+ }))))))));
60
54
  }));
61
55
  }
@@ -38,7 +38,7 @@
38
38
  box-sizing: content-box;
39
39
  min-width: 14px;
40
40
  max-width: 120px;
41
- height: 49px;
41
+ height: 43px;
42
42
  cursor: pointer;
43
43
 
44
44
  &::before {
@@ -72,7 +72,7 @@
72
72
  z-index: 4;
73
73
  display: flex;
74
74
  align-items: center;
75
- padding: 10px 10px 17px;
75
+ padding: 7px 12px 14px;
76
76
  background-color: #fff;
77
77
  border-radius: 10px;
78
78
  transition: background-color 0.2s;
@@ -128,12 +128,14 @@
128
128
  &-close {
129
129
  width: 14px;
130
130
  height: 14px;
131
+ color: #c4c4c4;
131
132
  line-height: 14px;
132
133
  text-align: center;
133
134
  border-radius: 50%;
134
135
 
135
136
  &:hover {
136
- background-color: rgba(0, 0, 0, 0.15);
137
+ color: #f2f2f2;
138
+ background-color: #c1c1c1;
137
139
  }
138
140
  }
139
141
  }
@@ -17,7 +17,7 @@
17
17
  align-items: center;
18
18
  box-sizing: border-box;
19
19
  width: 100vw;
20
- height: 56px;
20
+ height: 50px;
21
21
  padding: 0 16px;
22
22
  background: #ffff;
23
23
 
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { OperationType, TreeData } from './typings';
3
2
  interface Props<T> {
4
3
  node: TreeData<T>;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { TableProps } from './typings';
3
2
  export default function Table<RecordType extends Record<string, any>>(props: TableProps<RecordType>): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.0.1",
3
+ "version": "0.0.5",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -12,8 +12,11 @@
12
12
  "scripts": {
13
13
  "test": "echo \"Error: run tests from root\" && exit 1"
14
14
  },
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org"
17
+ },
15
18
  "dependencies": {
16
- "@lemon-fe/hooks": "^0.0.1",
19
+ "@lemon-fe/hooks": "^0.0.5",
17
20
  "antd": "^4.17.0",
18
21
  "classnames": "^2.2.6",
19
22
  "lodash": "^4.17.21",
@@ -35,5 +38,6 @@
35
38
  "@types/color-string": "^1.5.2",
36
39
  "@types/lodash": "^4.14.179",
37
40
  "@types/react-resizable": "^1.7.4"
38
- }
41
+ },
42
+ "gitHead": "477ae82a91341a6f769cfd87ff7c8d961c0ec4be"
39
43
  }