@alicloud/console-base-rc-side-panel 1.1.24-beta.3 → 1.1.24-beta.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.
@@ -12,7 +12,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
12
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
13
  var ScCollapseWrapper = exports.ScCollapseWrapper = _styledComponents.default.div.withConfig({
14
14
  componentId: "sc-8cd4ie-0"
15
- })(["z-index:998;position:fixed;right:0;bottom:9px;transform:translateX(50%);transition:transform 250ms ease-in-out 0ms;", ""], function (_ref) {
15
+ })(["z-index:997;position:fixed;right:0;bottom:9px;transform:translateX(50%);transition:transform 250ms ease-in-out 0ms;", ""], function (_ref) {
16
16
  var $isHovered = _ref.$isHovered;
17
17
  return $isHovered && (0, _styledComponents.css)(["transform:translateX(0);"]);
18
18
  });
@@ -32,6 +32,21 @@ function CollapseWithAsideWidget() {
32
32
  var unread = (0, _model.useItemsTop)().some(function (v) {
33
33
  return v.unread;
34
34
  });
35
+ var _useState3 = (0, _react.useState)(window.innerHeight),
36
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
37
+ windowHeight = _useState4[0],
38
+ setWindowHeight = _useState4[1];
39
+ (0, _react.useEffect)(function () {
40
+ var handleResize = function handleResize() {
41
+ setWindowHeight(window.innerHeight);
42
+ };
43
+ window.addEventListener('resize', handleResize);
44
+
45
+ // 清理事件监听器
46
+ return function () {
47
+ window.removeEventListener('resize', handleResize);
48
+ };
49
+ }, []);
35
50
  return /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement(_reactDraggable.default, {
36
51
  axis: 'y',
37
52
  position: {
@@ -41,7 +56,8 @@ function CollapseWithAsideWidget() {
41
56
  bounds: {
42
57
  left: 0,
43
58
  right: 0,
44
- top: -500,
59
+ // 最大 500px,最小为屏幕高度 - 导航栏 50 - 自身高度 126 - 上下边距和 9 *2,约等于 200
60
+ top: -Math.min(windowHeight - 200, 500),
45
61
  bottom: 0
46
62
  },
47
63
  onDrag: function onDrag() {
@@ -12,7 +12,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
12
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
13
  var ScCollapseWrapper = exports.ScCollapseWrapper = _styledComponents.default.div.withConfig({
14
14
  componentId: "sc-140xzf5-0"
15
- })(["z-index:998;position:fixed;right:0;bottom:9px;*{-webkit-user-drag:none !important;}", " ", ""], function (_ref) {
15
+ })(["z-index:997;position:fixed;right:0;bottom:9px;*{-webkit-user-drag:none !important;}", " ", ""], function (_ref) {
16
16
  var $isDragging = _ref.$isDragging;
17
17
  return $isDragging ? (0, _styledComponents.css)(["cursor:move;*{pointer-events:none !important;}"]) : null;
18
18
  }, function (_ref2) {
@@ -3,7 +3,7 @@ import { mixinBgAccent, mixinTextWhite } from '@alicloud/console-base-theme';
3
3
  import { SidePanelItemButton } from '../../../rc';
4
4
  export var ScCollapseWrapper = styled.div.withConfig({
5
5
  componentId: "sc-8cd4ie-0"
6
- })(["z-index:998;position:fixed;right:0;bottom:9px;transform:translateX(50%);transition:transform 250ms ease-in-out 0ms;", ""], function (_ref) {
6
+ })(["z-index:997;position:fixed;right:0;bottom:9px;transform:translateX(50%);transition:transform 250ms ease-in-out 0ms;", ""], function (_ref) {
7
7
  var $isHovered = _ref.$isHovered;
8
8
  return $isHovered && css(["transform:translateX(0);"]);
9
9
  });
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import React, { useState } from 'react';
2
+ import React, { useEffect, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import Draggable from 'react-draggable';
5
5
  import { TooltipV1 } from '@alicloud/console-base-rc-tooltip';
@@ -22,6 +22,21 @@ export default function CollapseWithAsideWidget() {
22
22
  var unread = useItemsTop().some(function (v) {
23
23
  return v.unread;
24
24
  });
25
+ var _useState3 = useState(window.innerHeight),
26
+ _useState4 = _slicedToArray(_useState3, 2),
27
+ windowHeight = _useState4[0],
28
+ setWindowHeight = _useState4[1];
29
+ useEffect(function () {
30
+ var handleResize = function handleResize() {
31
+ setWindowHeight(window.innerHeight);
32
+ };
33
+ window.addEventListener('resize', handleResize);
34
+
35
+ // 清理事件监听器
36
+ return function () {
37
+ window.removeEventListener('resize', handleResize);
38
+ };
39
+ }, []);
25
40
  return /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(Draggable, {
26
41
  axis: 'y',
27
42
  position: {
@@ -31,7 +46,8 @@ export default function CollapseWithAsideWidget() {
31
46
  bounds: {
32
47
  left: 0,
33
48
  right: 0,
34
- top: -500,
49
+ // 最大 500px,最小为屏幕高度 - 导航栏 50 - 自身高度 126 - 上下边距和 9 *2,约等于 200
50
+ top: -Math.min(windowHeight - 200, 500),
35
51
  bottom: 0
36
52
  },
37
53
  onDrag: function onDrag() {
@@ -3,7 +3,7 @@ import { mixinBgAccent, mixinTextWhite } from '@alicloud/console-base-theme';
3
3
  import { SidePanelItemButton } from '../../../rc';
4
4
  export var ScCollapseWrapper = styled.div.withConfig({
5
5
  componentId: "sc-140xzf5-0"
6
- })(["z-index:998;position:fixed;right:0;bottom:9px;*{-webkit-user-drag:none !important;}", " ", ""], function (_ref) {
6
+ })(["z-index:997;position:fixed;right:0;bottom:9px;*{-webkit-user-drag:none !important;}", " ", ""], function (_ref) {
7
7
  var $isDragging = _ref.$isDragging;
8
8
  return $isDragging ? css(["cursor:move;*{pointer-events:none !important;}"]) : null;
9
9
  }, function (_ref2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/console-base-rc-side-panel",
3
- "version": "1.1.24-beta.3",
3
+ "version": "1.1.24-beta.5",
4
4
  "description": "ConsoleBase 组件 - 右侧边栏",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,