pixuireactcomponents 1.3.59 → 1.3.60

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.3.59",
3
+ "version": "1.3.60",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,6 +20,7 @@ export function ScrollBar(props) {
20
20
  var _a = useState(0), sBlockY = _a[0], setSBlockY = _a[1]; // sBlock的Top值, block顶部相对于frames上边的差值
21
21
  var _b = useState({}), sBlockStyle = _b[0], setSBlockStyle = _b[1];
22
22
  var _c = useState({}), sFrameStyle = _c[0], setSFrameStyle = _c[1];
23
+ var _d = useState(false), hiddenBar = _d[0], setHiddenBar = _d[1];
23
24
  setSFrameStyle(props.style);
24
25
  useEffect(function () {
25
26
  // 初始化的 useEffect,其中只能添加初始化方法
@@ -40,6 +41,15 @@ export function ScrollBar(props) {
40
41
  console.warn('[CustomScrollBar][Error] 内部错误,无法找到 sBlock 或 sFrame!');
41
42
  return;
42
43
  }
44
+ // 如果 sWindow 尺寸 > Content 尺寸,无需滑动,隐藏sBar
45
+ var swindow_height = sWindow.getBoundingClientRect().height; // 滑动窗口高
46
+ var content_height = sWindow.scrollHeight;
47
+ if (content_height <= swindow_height) {
48
+ setHiddenBar(true);
49
+ }
50
+ else {
51
+ setHiddenBar(false);
52
+ }
43
53
  sWindow === null || sWindow === void 0 ? void 0 : sWindow.addEventListener('scroll', sWindowScrolling);
44
54
  // 设置背景图
45
55
  sBlock.style.backgroundImage = "url(".concat(props.sBlockImgNormal, ")");
@@ -126,7 +136,7 @@ export function ScrollBar(props) {
126
136
  sWindow.style.overflow = 'hidden';
127
137
  sWindow.style.overflow = 'scroll';
128
138
  };
129
- return (h("div", { id: "sframe", style: sFrameStyle },
139
+ return (h("div", { id: "sframe", style: sFrameStyle }, hiddenBar ? null :
130
140
  h("div", { id: "sblock", style: sBlockStyle, draggable: true, onDragStart: function (event) {
131
141
  sBlock.style.backgroundImage = "url(".concat(props.sBlockImgClick, ")");
132
142
  sFrame.style.backgroundImage = "url(".concat(props.sFrameImgClick, ")");