mtxt-ui3 0.0.48 → 0.0.49

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.
@@ -28,6 +28,25 @@ const getScale = el => {
28
28
  }
29
29
  return getScale(parent);
30
30
  };
31
+ const getChromeVersion = () => {
32
+ const userAgent = navigator.userAgent;
33
+ const match = userAgent.match(/Chrome\/(\d+)/) || userAgent.match(/HeadlessChrome\/(\d+)/);
34
+ return match ? parseInt(match[1], 10) : 0;
35
+ };
36
+ const chromeVersion = getChromeVersion();
37
+ const getScrollElHeight = (scrollEl, value, scale) => {
38
+ const rectHeight = scrollEl.getBoundingClientRect().height;
39
+ const scrollHeight = scrollEl.scrollHeight;
40
+ const scaleY = value === "ant-table-body" && chromeVersion < 128 ? 1 : scale?.y ?? 1;
41
+ let calculatedHeight = rectHeight / scaleY;
42
+ if (value !== "ant-table-body" && chromeVersion < 128 && scaleY < 1) {
43
+ return rectHeight;
44
+ }
45
+ if (calculatedHeight > scrollHeight + 5) {
46
+ return rectHeight;
47
+ }
48
+ return calculatedHeight;
49
+ };
31
50
  const autoScroll = {
32
51
  mounted(el, {
33
52
  value = "ant-table-body",
@@ -53,12 +72,15 @@ const autoScroll = {
53
72
  }
54
73
  if (hover) return;
55
74
  const scale = getScale(scrollEl);
56
- const scrollElHeight = scrollEl.getBoundingClientRect().height / (scale?.y ?? 1);
57
- const step = 1 / (scale?.x ?? 1);
75
+ const scrollElHeight = getScrollElHeight(scrollEl, value, scale);
76
+ let step = 1 / (scale?.x ?? 1);
77
+ if (step < 1) {
78
+ step = 1;
79
+ }
58
80
  if (scrollElHeight >= scrollEl.scrollHeight) {
59
81
  return;
60
82
  }
61
- if (!hover && scrollEl.scrollTop + scrollElHeight > scrollEl.scrollHeight - step) {
83
+ if (!hover && scrollEl.scrollTop + scrollElHeight >= scrollEl.scrollHeight - step) {
62
84
  if (timer2) return;
63
85
  timer2 = setTimeout(() => {
64
86
  if (!hover) {
@@ -24,6 +24,25 @@ const getScale = el => {
24
24
  }
25
25
  return getScale(parent);
26
26
  };
27
+ const getChromeVersion = () => {
28
+ const userAgent = navigator.userAgent;
29
+ const match = userAgent.match(/Chrome\/(\d+)/) || userAgent.match(/HeadlessChrome\/(\d+)/);
30
+ return match ? parseInt(match[1], 10) : 0;
31
+ };
32
+ const chromeVersion = getChromeVersion();
33
+ const getScrollElHeight = (scrollEl, value, scale) => {
34
+ const rectHeight = scrollEl.getBoundingClientRect().height;
35
+ const scrollHeight = scrollEl.scrollHeight;
36
+ const scaleY = value === "ant-table-body" && chromeVersion < 128 ? 1 : scale?.y ?? 1;
37
+ let calculatedHeight = rectHeight / scaleY;
38
+ if (value !== "ant-table-body" && chromeVersion < 128 && scaleY < 1) {
39
+ return rectHeight;
40
+ }
41
+ if (calculatedHeight > scrollHeight + 5) {
42
+ return rectHeight;
43
+ }
44
+ return calculatedHeight;
45
+ };
27
46
  const autoScroll = {
28
47
  mounted(el, {
29
48
  value = "ant-table-body",
@@ -49,12 +68,15 @@ const autoScroll = {
49
68
  }
50
69
  if (hover) return;
51
70
  const scale = getScale(scrollEl);
52
- const scrollElHeight = scrollEl.getBoundingClientRect().height / (scale?.y ?? 1);
53
- const step = 1 / (scale?.x ?? 1);
71
+ const scrollElHeight = getScrollElHeight(scrollEl, value, scale);
72
+ let step = 1 / (scale?.x ?? 1);
73
+ if (step < 1) {
74
+ step = 1;
75
+ }
54
76
  if (scrollElHeight >= scrollEl.scrollHeight) {
55
77
  return;
56
78
  }
57
- if (!hover && scrollEl.scrollTop + scrollElHeight > scrollEl.scrollHeight - step) {
79
+ if (!hover && scrollEl.scrollTop + scrollElHeight >= scrollEl.scrollHeight - step) {
58
80
  if (timer2) return;
59
81
  timer2 = setTimeout(() => {
60
82
  if (!hover) {
package/dist/index.cjs CHANGED
@@ -555,6 +555,25 @@ const getScale = el => {
555
555
  }
556
556
  return getScale(parent);
557
557
  };
558
+ const getChromeVersion = () => {
559
+ const userAgent = navigator.userAgent;
560
+ const match = userAgent.match(/Chrome\/(\d+)/) || userAgent.match(/HeadlessChrome\/(\d+)/);
561
+ return match ? parseInt(match[1], 10) : 0;
562
+ };
563
+ const chromeVersion = getChromeVersion();
564
+ const getScrollElHeight = (scrollEl, value, scale) => {
565
+ const rectHeight = scrollEl.getBoundingClientRect().height;
566
+ const scrollHeight = scrollEl.scrollHeight;
567
+ const scaleY = value === "ant-table-body" && chromeVersion < 128 ? 1 : scale?.y ?? 1;
568
+ let calculatedHeight = rectHeight / scaleY;
569
+ if (value !== "ant-table-body" && chromeVersion < 128 && scaleY < 1) {
570
+ return rectHeight;
571
+ }
572
+ if (calculatedHeight > scrollHeight + 5) {
573
+ return rectHeight;
574
+ }
575
+ return calculatedHeight;
576
+ };
558
577
  const autoScroll = {
559
578
  mounted(el, {
560
579
  value = "ant-table-body",
@@ -580,12 +599,15 @@ const autoScroll = {
580
599
  }
581
600
  if (hover) return;
582
601
  const scale = getScale(scrollEl);
583
- const scrollElHeight = scrollEl.getBoundingClientRect().height / (scale?.y ?? 1);
584
- const step = 1 / (scale?.x ?? 1);
602
+ const scrollElHeight = getScrollElHeight(scrollEl, value, scale);
603
+ let step = 1 / (scale?.x ?? 1);
604
+ if (step < 1) {
605
+ step = 1;
606
+ }
585
607
  if (scrollElHeight >= scrollEl.scrollHeight) {
586
608
  return;
587
609
  }
588
- if (!hover && scrollEl.scrollTop + scrollElHeight > scrollEl.scrollHeight - step) {
610
+ if (!hover && scrollEl.scrollTop + scrollElHeight >= scrollEl.scrollHeight - step) {
589
611
  if (timer2) return;
590
612
  timer2 = setTimeout(() => {
591
613
  if (!hover) {
package/dist/index.js CHANGED
@@ -543,6 +543,25 @@ const getScale = el => {
543
543
  }
544
544
  return getScale(parent);
545
545
  };
546
+ const getChromeVersion = () => {
547
+ const userAgent = navigator.userAgent;
548
+ const match = userAgent.match(/Chrome\/(\d+)/) || userAgent.match(/HeadlessChrome\/(\d+)/);
549
+ return match ? parseInt(match[1], 10) : 0;
550
+ };
551
+ const chromeVersion = getChromeVersion();
552
+ const getScrollElHeight = (scrollEl, value, scale) => {
553
+ const rectHeight = scrollEl.getBoundingClientRect().height;
554
+ const scrollHeight = scrollEl.scrollHeight;
555
+ const scaleY = value === "ant-table-body" && chromeVersion < 128 ? 1 : scale?.y ?? 1;
556
+ let calculatedHeight = rectHeight / scaleY;
557
+ if (value !== "ant-table-body" && chromeVersion < 128 && scaleY < 1) {
558
+ return rectHeight;
559
+ }
560
+ if (calculatedHeight > scrollHeight + 5) {
561
+ return rectHeight;
562
+ }
563
+ return calculatedHeight;
564
+ };
546
565
  const autoScroll = {
547
566
  mounted(el, {
548
567
  value = "ant-table-body",
@@ -568,12 +587,15 @@ const autoScroll = {
568
587
  }
569
588
  if (hover) return;
570
589
  const scale = getScale(scrollEl);
571
- const scrollElHeight = scrollEl.getBoundingClientRect().height / (scale?.y ?? 1);
572
- const step = 1 / (scale?.x ?? 1);
590
+ const scrollElHeight = getScrollElHeight(scrollEl, value, scale);
591
+ let step = 1 / (scale?.x ?? 1);
592
+ if (step < 1) {
593
+ step = 1;
594
+ }
573
595
  if (scrollElHeight >= scrollEl.scrollHeight) {
574
596
  return;
575
597
  }
576
- if (!hover && scrollEl.scrollTop + scrollElHeight > scrollEl.scrollHeight - step) {
598
+ if (!hover && scrollEl.scrollTop + scrollElHeight >= scrollEl.scrollHeight - step) {
577
599
  if (timer2) return;
578
600
  timer2 = setTimeout(() => {
579
601
  if (!hover) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtxt-ui3",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "系统运营组件库",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -72,4 +72,4 @@
72
72
  "lodash": "^4.17.21",
73
73
  "vue-router": "^4.1.6"
74
74
  }
75
- }
75
+ }