@lemon-fe/components 0.1.26 → 0.1.29

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.
@@ -198,9 +198,15 @@ function BaseTable(props) {
198
198
  setScrollY(calcScrollY() || undefined);
199
199
  };
200
200
 
201
+ var hasPagination = false;
202
+
203
+ if (paginationProp !== false) {
204
+ hasPagination = paginationProp !== undefined && !!paginationProp.total || dataSource.length > 0;
205
+ }
206
+
201
207
  useLayoutEffect(function () {
202
208
  setScrollY(calcScrollY() || undefined);
203
- }, [paginationProp !== false && !!(paginationProp === null || paginationProp === void 0 ? void 0 : paginationProp.total)]);
209
+ }, [hasPagination]);
204
210
  useEffect(function () {
205
211
  if (scrollYProp !== true) {
206
212
  setScrollY(scrollYProp);
@@ -116,6 +116,7 @@
116
116
  height: 65px;
117
117
  padding: @space;
118
118
  background: #fff;
119
+ border-top: 1px solid #dfdfdf;
119
120
  }
120
121
 
121
122
  &-spin {
@@ -193,6 +193,8 @@ var favoriteIcon = /*#__PURE__*/React.createElement("svg", {
193
193
  strokeDasharray: "0,0",
194
194
  mask: "url(#mask-2)"
195
195
  })))));
196
+ var WIDTH = 1280;
197
+ var FAVORITES_POPOVER = 'FAVORITES_POPOVER';
196
198
  export default function Menu(props) {
197
199
  var menus = props.data,
198
200
  onClick = props.onClick,
@@ -208,8 +210,9 @@ export default function Menu(props) {
208
210
 
209
211
  var popup = useRef(null);
210
212
  var drawer = useRef(null);
213
+ var clientWidth = useRef(document.body.clientWidth);
211
214
 
212
- var _useState3 = useState(document.body.clientWidth <= 1280),
215
+ var _useState3 = useState(clientWidth.current <= WIDTH),
213
216
  _useState4 = _slicedToArray(_useState3, 2),
214
217
  collapsed = _useState4[0],
215
218
  setCollapsed = _useState4[1];
@@ -224,7 +227,6 @@ export default function Menu(props) {
224
227
  top = _useState8[0],
225
228
  setTop = _useState8[1];
226
229
 
227
- var FAVORITES_POPOVER = 'FAVORITES_POPOVER';
228
230
  var activeMenu = useMemo(function () {
229
231
  var check = function check(path) {
230
232
  if (path) {
@@ -335,6 +337,24 @@ export default function Menu(props) {
335
337
  };
336
338
  }
337
339
  }, [visible]);
340
+ useEffect(function () {
341
+ var handleResize = function handleResize() {
342
+ var width = document.body.clientWidth;
343
+
344
+ if (clientWidth.current > WIDTH && width <= WIDTH) {
345
+ setCollapsed(true);
346
+ } else if (clientWidth.current <= WIDTH && width > WIDTH) {
347
+ setCollapsed(false);
348
+ }
349
+
350
+ clientWidth.current = width;
351
+ };
352
+
353
+ window.addEventListener('resize', handleResize);
354
+ return function () {
355
+ window.removeEventListener('resize', handleResize);
356
+ };
357
+ }, []);
338
358
 
339
359
  var openDrawer = function openDrawer() {
340
360
  setVisible(true);
@@ -578,7 +598,7 @@ export default function Menu(props) {
578
598
  var target = e.currentTarget;
579
599
  toggle(function () {
580
600
  return openMenu({
581
- name: 'FAVORITES_POPOVER',
601
+ name: FAVORITES_POPOVER,
582
602
  children: _toConsumableArray(favoritesMap.values())
583
603
  }, target);
584
604
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.1.26",
3
+ "version": "0.1.29",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -41,5 +41,5 @@
41
41
  "react": "^17.0.2",
42
42
  "react-dom": "^17.0.2"
43
43
  },
44
- "gitHead": "14dc8a92689ded718e70523282c3979784044154"
44
+ "gitHead": "76eb517b4b3fa047aa55e61f1793a0ffa8cfb2c5"
45
45
  }