@lemon-fe/components 0.0.5 → 0.0.6

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.
@@ -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
 
@@ -94,12 +94,8 @@
94
94
  width: 20px;
95
95
  height: 20px;
96
96
  margin-right: 8px;
97
+ color: rgba(108, 108, 108, 1);
97
98
  font-size: 16px;
98
- opacity: 0.7;
99
- }
100
-
101
- &-top-item-active &-icon {
102
- opacity: 1;
103
99
  }
104
100
 
105
101
  &-title {
@@ -108,6 +104,15 @@
108
104
  text-overflow: ellipsis;
109
105
  }
110
106
 
107
+ &-top-item:hover &-icon {
108
+ color: #333;
109
+ }
110
+
111
+ &-top-item&-top-item-active &-title,
112
+ &-top-item&-top-item-active &-icon {
113
+ color: .primary() [];
114
+ }
115
+
111
116
  &-popup {
112
117
  position: absolute;
113
118
  top: 0;
@@ -125,12 +130,27 @@
125
130
  border-radius: 10px;
126
131
  box-shadow: 0 12px 48px 16px rgba(0, 0, 0, 0.03), 0 9px 28px 0 rgba(0, 0, 0, 0.05),
127
132
  0 6px 16px -8px rgba(0, 0, 0, 0.08);
128
- transform: translate3d(-40px, 0, 0);
133
+ transform: translate3d(-20px, 0, 0);
134
+ opacity: 0;
135
+ transition: all 0.15s;
136
+ }
137
+
138
+ &-tip {
139
+ height: 36px;
140
+ margin: 4px 0 0 4px;
141
+ padding: 0 16px;
142
+ color: #fff;
143
+ line-height: 36px;
144
+ text-align: center;
145
+ background-color: .primary() [];
146
+ border-radius: 22px;
147
+ transform: translate3d(-10px, 0, 0);
129
148
  opacity: 0;
130
- transition: all 0.2s;
149
+ transition: all 0.15s;
131
150
  }
132
151
 
133
- &.animated &-body {
152
+ &.animated &-body,
153
+ &.animated &-tip {
134
154
  transform: translate3d(0, 0, 0);
135
155
  opacity: 1;
136
156
  }
@@ -161,6 +181,7 @@
161
181
  height: 40px;
162
182
  padding: 0 16px;
163
183
  color: rgba(51, 51, 51, 0.5);
184
+ font-weight: 500;
164
185
  font-size: 14px;
165
186
  line-height: 40px;
166
187
  }
@@ -227,11 +248,11 @@
227
248
  width: 107px;
228
249
  height: 36px;
229
250
  margin-left: 12px;
230
- color: rgba(5, 96, 253, 1);
251
+ color: .primary() [];
231
252
  font-size: 14px;
232
253
  text-align: center;
233
254
  background-color: #fff;
234
- border: 1px solid rgba(5, 96, 253, 1);
255
+ border: 1px solid .primary() [];
235
256
  border-radius: 4px;
236
257
  cursor: pointer;
237
258
  user-select: none;
@@ -307,7 +328,7 @@
307
328
  .transition();
308
329
 
309
330
  &:hover {
310
- color: rgba(5, 96, 253, 1);
331
+ color: .primary() [];
311
332
  background-color: rgba(238, 238, 238, 1);
312
333
  }
313
334
  }
@@ -326,7 +347,7 @@
326
347
  .transition();
327
348
 
328
349
  &:hover {
329
- color: rgba(5, 96, 253, 1);
350
+ color: .primary() [];
330
351
  background-color: rgba(238, 238, 238, 1);
331
352
  }
332
353
  }
@@ -345,12 +366,12 @@
345
366
  cursor: pointer;
346
367
 
347
368
  &:hover {
348
- color: rgba(5, 96, 253, 1);
369
+ color: .primary() [];
349
370
  }
350
371
  }
351
372
  }
352
373
 
353
374
  &-active {
354
- color: rgba(5, 96, 253, 1);
375
+ color: .primary() [];
355
376
  }
356
377
  }
@@ -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.6",
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.6",
20
20
  "antd": "^4.17.0",
21
21
  "classnames": "^2.2.6",
22
22
  "lodash": "^4.17.21",
@@ -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": "031652790452c9baca3ea69f2fc1982c6a8c7a18"
43
43
  }