@lemon-fe/components 0.0.5 → 0.0.8

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,11 +1,9 @@
1
- @import '../theme.less';
2
-
3
1
  .@{prefixCls}-layout {
4
2
  position: relative;
5
3
  display: flex;
6
4
  flex-direction: column;
7
5
  min-height: 100%;
8
- background: #f5f5f5;
6
+ background: #f2f2f2;
9
7
 
10
8
  &-header {
11
9
  padding: (@space - 3) @space 0;
@@ -115,7 +115,7 @@ export default function Menu(props) {
115
115
  }, [location.pathname, menus]);
116
116
 
117
117
  var openMenu = function openMenu(item, elm) {
118
- if (item.children && item.children.length > 0) {
118
+ if (item.children !== undefined && item.children.length > 0 || collapsed) {
119
119
  setPopover(item);
120
120
  setTop(elm.offsetTop);
121
121
  setTimeout(function () {
@@ -287,7 +287,7 @@ export default function Menu(props) {
287
287
  onMouseLeave: function onMouseLeave() {
288
288
  return toggle(closeMenu);
289
289
  }
290
- }, popover !== null && popover.children !== undefined && /*#__PURE__*/React.createElement("div", {
290
+ }, popover !== null && /*#__PURE__*/React.createElement("div", {
291
291
  className: "".concat(prefixCls, "-menu-popup"),
292
292
  style: {
293
293
  top: top
@@ -296,8 +296,9 @@ export default function Menu(props) {
296
296
  onMouseEnter: function onMouseEnter() {
297
297
  return toggle.cancel();
298
298
  }
299
- }, /*#__PURE__*/React.createElement("div", {
300
- className: "".concat(prefixCls, "-menu-popup-body")
299
+ }, popover.children !== undefined ? /*#__PURE__*/React.createElement("div", {
300
+ className: "".concat(prefixCls, "-menu-popup-body"),
301
+ key: "pop"
301
302
  }, popover.children.map(function (item, index) {
302
303
  return /*#__PURE__*/React.createElement("div", {
303
304
  className: "".concat(prefixCls, "-menu-block"),
@@ -305,9 +306,15 @@ export default function Menu(props) {
305
306
  }, /*#__PURE__*/React.createElement("div", {
306
307
  className: "".concat(prefixCls, "-menu-sub-item")
307
308
  }, item.name), item.children !== undefined && item.children.map(renderItem));
308
- }))), /*#__PURE__*/React.createElement("div", {
309
+ })) : /*#__PURE__*/React.createElement("div", {
310
+ className: "".concat(prefixCls, "-menu-popup-tip"),
311
+ key: "tip"
312
+ }, popover.name)), /*#__PURE__*/React.createElement("div", {
309
313
  className: "".concat(prefixCls, "-menu-collapse"),
310
- onClick: toggleCollapse
314
+ onClick: toggleCollapse,
315
+ onMouseEnter: function onMouseEnter() {
316
+ return toggle(closeMenu);
317
+ }
311
318
  }, /*#__PURE__*/React.createElement("svg", {
312
319
  width: "20",
313
320
  height: "20",
@@ -348,10 +355,12 @@ export default function Menu(props) {
348
355
  return openMenu(item, target);
349
356
  });
350
357
  }
351
- }, /*#__PURE__*/React.createElement("img", {
358
+ }, typeof item.icon === 'string' ? /*#__PURE__*/React.createElement("img", {
352
359
  className: "".concat(prefixCls, "-menu-icon"),
353
360
  src: item.icon
354
- }), /*#__PURE__*/React.createElement("div", {
361
+ }) : /*#__PURE__*/React.createElement("div", {
362
+ className: "".concat(prefixCls, "-menu-icon")
363
+ }, item.icon), /*#__PURE__*/React.createElement("div", {
355
364
  className: "".concat(prefixCls, "-menu-title")
356
365
  }, item.name));
357
366
  })), false && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -6,7 +6,7 @@
6
6
  flex: 0 0 200px;
7
7
  min-width: 0;
8
8
  height: 100%;
9
- padding: 16px 0;
9
+ padding: 8px 0;
10
10
  white-space: nowrap;
11
11
  transition: flex 0.1s;
12
12
 
@@ -45,11 +45,6 @@
45
45
  transform: rotate(0);
46
46
  }
47
47
 
48
- &-collapsed &-top-item {
49
- margin: 0;
50
- padding: 0 16px;
51
- }
52
-
53
48
  &-collapsed &-popup {
54
49
  left: 52px;
55
50
  }
@@ -59,8 +54,7 @@
59
54
  align-items: center;
60
55
  box-sizing: border-box;
61
56
  height: 44px;
62
- margin: 0 12px;
63
- padding: 0 4px;
57
+ padding: 0 16px;
64
58
  overflow: hidden;
65
59
  color: #333;
66
60
  font-size: 14px;
@@ -94,12 +88,8 @@
94
88
  width: 20px;
95
89
  height: 20px;
96
90
  margin-right: 8px;
91
+ color: rgba(108, 108, 108, 1);
97
92
  font-size: 16px;
98
- opacity: 0.7;
99
- }
100
-
101
- &-top-item-active &-icon {
102
- opacity: 1;
103
93
  }
104
94
 
105
95
  &-title {
@@ -108,6 +98,15 @@
108
98
  text-overflow: ellipsis;
109
99
  }
110
100
 
101
+ &-top-item:hover &-icon {
102
+ color: #333;
103
+ }
104
+
105
+ &-top-item&-top-item-active &-title,
106
+ &-top-item&-top-item-active &-icon {
107
+ color: .primary() [];
108
+ }
109
+
111
110
  &-popup {
112
111
  position: absolute;
113
112
  top: 0;
@@ -125,12 +124,27 @@
125
124
  border-radius: 10px;
126
125
  box-shadow: 0 12px 48px 16px rgba(0, 0, 0, 0.03), 0 9px 28px 0 rgba(0, 0, 0, 0.05),
127
126
  0 6px 16px -8px rgba(0, 0, 0, 0.08);
128
- transform: translate3d(-40px, 0, 0);
127
+ transform: translate3d(-20px, 0, 0);
128
+ opacity: 0;
129
+ transition: all 0.15s;
130
+ }
131
+
132
+ &-tip {
133
+ height: 36px;
134
+ margin: 4px 0 0 4px;
135
+ padding: 0 16px;
136
+ color: #fff;
137
+ line-height: 36px;
138
+ text-align: center;
139
+ background-color: .primary() [];
140
+ border-radius: 22px;
141
+ transform: translate3d(-10px, 0, 0);
129
142
  opacity: 0;
130
- transition: all 0.2s;
143
+ transition: all 0.15s;
131
144
  }
132
145
 
133
- &.animated &-body {
146
+ &.animated &-body,
147
+ &.animated &-tip {
134
148
  transform: translate3d(0, 0, 0);
135
149
  opacity: 1;
136
150
  }
@@ -161,6 +175,7 @@
161
175
  height: 40px;
162
176
  padding: 0 16px;
163
177
  color: rgba(51, 51, 51, 0.5);
178
+ font-weight: 500;
164
179
  font-size: 14px;
165
180
  line-height: 40px;
166
181
  }
@@ -227,11 +242,11 @@
227
242
  width: 107px;
228
243
  height: 36px;
229
244
  margin-left: 12px;
230
- color: rgba(5, 96, 253, 1);
245
+ color: .primary() [];
231
246
  font-size: 14px;
232
247
  text-align: center;
233
248
  background-color: #fff;
234
- border: 1px solid rgba(5, 96, 253, 1);
249
+ border: 1px solid .primary() [];
235
250
  border-radius: 4px;
236
251
  cursor: pointer;
237
252
  user-select: none;
@@ -307,7 +322,7 @@
307
322
  .transition();
308
323
 
309
324
  &:hover {
310
- color: rgba(5, 96, 253, 1);
325
+ color: .primary() [];
311
326
  background-color: rgba(238, 238, 238, 1);
312
327
  }
313
328
  }
@@ -326,7 +341,7 @@
326
341
  .transition();
327
342
 
328
343
  &:hover {
329
- color: rgba(5, 96, 253, 1);
344
+ color: .primary() [];
330
345
  background-color: rgba(238, 238, 238, 1);
331
346
  }
332
347
  }
@@ -345,12 +360,12 @@
345
360
  cursor: pointer;
346
361
 
347
362
  &:hover {
348
- color: rgba(5, 96, 253, 1);
363
+ color: .primary() [];
349
364
  }
350
365
  }
351
366
  }
352
367
 
353
368
  &-active {
354
- color: rgba(5, 96, 253, 1);
369
+ color: .primary() [];
355
370
  }
356
371
  }
@@ -1,6 +1,8 @@
1
+ import type { ReactElement } from 'react';
2
+
1
3
  export type MenuItem = {
2
4
  name: string;
3
5
  path?: string;
4
- icon?: string;
6
+ icon?: string | ReactElement;
5
7
  children?: MenuItem[];
6
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -16,7 +16,7 @@
16
16
  "registry": "https://registry.npmjs.org"
17
17
  },
18
18
  "dependencies": {
19
- "@lemon-fe/hooks": "^0.0.5",
19
+ "@lemon-fe/hooks": "^0.0.8",
20
20
  "antd": "^4.17.0",
21
21
  "classnames": "^2.2.6",
22
22
  "lodash": "^4.17.21",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@ant-design/icons": ">=4.0.0",
29
- "antd": ">=4.17.0-alpha.8",
29
+ "antd": ">=4.17.0",
30
30
  "classnames": ">=2.2.6",
31
31
  "color-string": ">=1.0.0",
32
32
  "lodash": ">=4.17.0",
@@ -39,5 +39,5 @@
39
39
  "@types/lodash": "^4.14.179",
40
40
  "@types/react-resizable": "^1.7.4"
41
41
  },
42
- "gitHead": "477ae82a91341a6f769cfd87ff7c8d961c0ec4be"
42
+ "gitHead": "cd8c8e854c16f5605657b3b92fb2deecd1a116e8"
43
43
  }