mtxt-ui3 0.0.47 → 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.
@@ -19,7 +19,8 @@ const getScale = el => {
19
19
  if (zoom !== "1") {
20
20
  if (zoom !== "1") {
21
21
  return {
22
- x: Number(zoom)
22
+ x: Number(zoom),
23
+ y: Number(zoom)
23
24
  };
24
25
  } else {
25
26
  return getScale(parent);
@@ -27,6 +28,25 @@ const getScale = el => {
27
28
  }
28
29
  return getScale(parent);
29
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
+ };
30
50
  const autoScroll = {
31
51
  mounted(el, {
32
52
  value = "ant-table-body",
@@ -52,12 +72,15 @@ const autoScroll = {
52
72
  }
53
73
  if (hover) return;
54
74
  const scale = getScale(scrollEl);
55
- const scrollElHeight = scrollEl.getBoundingClientRect().height / (scale?.y ?? 1);
56
- const step = Math.ceil(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
+ }
57
80
  if (scrollElHeight >= scrollEl.scrollHeight) {
58
81
  return;
59
82
  }
60
- if (!hover && scrollEl.scrollTop + scrollElHeight > scrollEl.scrollHeight - step) {
83
+ if (!hover && scrollEl.scrollTop + scrollElHeight >= scrollEl.scrollHeight - step) {
61
84
  if (timer2) return;
62
85
  timer2 = setTimeout(() => {
63
86
  if (!hover) {
@@ -15,7 +15,8 @@ const getScale = el => {
15
15
  if (zoom !== "1") {
16
16
  if (zoom !== "1") {
17
17
  return {
18
- x: Number(zoom)
18
+ x: Number(zoom),
19
+ y: Number(zoom)
19
20
  };
20
21
  } else {
21
22
  return getScale(parent);
@@ -23,6 +24,25 @@ const getScale = el => {
23
24
  }
24
25
  return getScale(parent);
25
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
+ };
26
46
  const autoScroll = {
27
47
  mounted(el, {
28
48
  value = "ant-table-body",
@@ -48,12 +68,15 @@ const autoScroll = {
48
68
  }
49
69
  if (hover) return;
50
70
  const scale = getScale(scrollEl);
51
- const scrollElHeight = scrollEl.getBoundingClientRect().height / (scale?.y ?? 1);
52
- const step = Math.ceil(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
+ }
53
76
  if (scrollElHeight >= scrollEl.scrollHeight) {
54
77
  return;
55
78
  }
56
- if (!hover && scrollEl.scrollTop + scrollElHeight > scrollEl.scrollHeight - step) {
79
+ if (!hover && scrollEl.scrollTop + scrollElHeight >= scrollEl.scrollHeight - step) {
57
80
  if (timer2) return;
58
81
  timer2 = setTimeout(() => {
59
82
  if (!hover) {
package/dist/index.cjs CHANGED
@@ -21,7 +21,7 @@ var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
21
21
  var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
22
22
  var zhCN__default = /*#__PURE__*/_interopDefaultLegacy(zhCN);
23
23
 
24
- var version = "0.0.46";
24
+ var version = "0.0.48";
25
25
 
26
26
  const setRem = opt => {
27
27
  const fontSize = opt.fontSize || 14;
@@ -546,7 +546,8 @@ const getScale = el => {
546
546
  if (zoom !== "1") {
547
547
  if (zoom !== "1") {
548
548
  return {
549
- x: Number(zoom)
549
+ x: Number(zoom),
550
+ y: Number(zoom)
550
551
  };
551
552
  } else {
552
553
  return getScale(parent);
@@ -554,6 +555,25 @@ const getScale = el => {
554
555
  }
555
556
  return getScale(parent);
556
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
+ };
557
577
  const autoScroll = {
558
578
  mounted(el, {
559
579
  value = "ant-table-body",
@@ -579,12 +599,15 @@ const autoScroll = {
579
599
  }
580
600
  if (hover) return;
581
601
  const scale = getScale(scrollEl);
582
- const scrollElHeight = scrollEl.getBoundingClientRect().height / (scale?.y ?? 1);
583
- const step = Math.ceil(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
+ }
584
607
  if (scrollElHeight >= scrollEl.scrollHeight) {
585
608
  return;
586
609
  }
587
- if (!hover && scrollEl.scrollTop + scrollElHeight > scrollEl.scrollHeight - step) {
610
+ if (!hover && scrollEl.scrollTop + scrollElHeight >= scrollEl.scrollHeight - step) {
588
611
  if (timer2) return;
589
612
  timer2 = setTimeout(() => {
590
613
  if (!hover) {
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { MaybeRef, MaybeComputedRef } from '@vueuse/core';
7
7
  import { Key } from 'ant-design-vue/lib/table/interface';
8
8
  import * as vue_jsx_runtime from 'vue/jsx-runtime';
9
9
 
10
- var version = "0.0.46";
10
+ var version = "0.0.48";
11
11
 
12
12
  /**
13
13
  *
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { SearchOutlined, CaretUpOutlined, CaretRightOutlined, CaretDownOutlined,
9
9
  import 'ant-design-vue/dist/antd.less';
10
10
  import zhCN from 'dayjs/locale/zh-cn';
11
11
 
12
- var version = "0.0.46";
12
+ var version = "0.0.48";
13
13
 
14
14
  const setRem = opt => {
15
15
  const fontSize = opt.fontSize || 14;
@@ -534,7 +534,8 @@ const getScale = el => {
534
534
  if (zoom !== "1") {
535
535
  if (zoom !== "1") {
536
536
  return {
537
- x: Number(zoom)
537
+ x: Number(zoom),
538
+ y: Number(zoom)
538
539
  };
539
540
  } else {
540
541
  return getScale(parent);
@@ -542,6 +543,25 @@ const getScale = el => {
542
543
  }
543
544
  return getScale(parent);
544
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
+ };
545
565
  const autoScroll = {
546
566
  mounted(el, {
547
567
  value = "ant-table-body",
@@ -567,12 +587,15 @@ const autoScroll = {
567
587
  }
568
588
  if (hover) return;
569
589
  const scale = getScale(scrollEl);
570
- const scrollElHeight = scrollEl.getBoundingClientRect().height / (scale?.y ?? 1);
571
- const step = Math.ceil(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
+ }
572
595
  if (scrollElHeight >= scrollEl.scrollHeight) {
573
596
  return;
574
597
  }
575
- if (!hover && scrollEl.scrollTop + scrollElHeight > scrollEl.scrollHeight - step) {
598
+ if (!hover && scrollEl.scrollTop + scrollElHeight >= scrollEl.scrollHeight - step) {
576
599
  if (timer2) return;
577
600
  timer2 = setTimeout(() => {
578
601
  if (!hover) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtxt-ui3",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "description": "系统运营组件库",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",