comand-component-library 3.3.40 → 3.3.41

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comand-component-library",
3
- "version": "3.3.40",
3
+ "version": "3.3.41",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -819,7 +819,7 @@
819
819
  <!-- end advanced form elements ----------------------------------------------------------------------------------------------------------------------------------------------------->
820
820
 
821
821
  <!-- begin back to top button ----------------------------------------------------------------------------------------------------------------------------------------------------->
822
- <CmdBackToTopButton/>
822
+ <CmdBackToTopButton />
823
823
  <!-- end back to top button ----------------------------------------------------------------------------------------------------------------------------------------------------->
824
824
 
825
825
  <!-- begin bank account data ----------------------------------------------------------------------------------------------------------------------------------------------------->
@@ -17,12 +17,12 @@ export default {
17
17
  data() {
18
18
  return {
19
19
  windowInnerHeight: window.innerHeight,
20
- windowScrollY: window.scrollY ?? (document.querySelector(this.parentSelector)?.scrollTop || 0),
21
- scrollHeight: document.querySelector(this.parentSelector)?.scrollHeight || 0
20
+ windowScrollY: this.getScrollY(),
21
+ scrollHeight: document.querySelector(this.scrollContainer)?.scrollHeight || 0
22
22
  }
23
23
  },
24
24
  props: {
25
- parentSelector: {
25
+ scrollContainer: {
26
26
  type: String,
27
27
  default: "body"
28
28
  },
@@ -44,18 +44,18 @@ export default {
44
44
  },
45
45
  mounted() {
46
46
  window.addEventListener('resize', this.onViewportChange)
47
- if (this.parentSelector === "body") {
47
+ if (this.scrollContainer === "body") {
48
48
  window.addEventListener('scroll', this.onViewportChange);
49
49
  } else {
50
- document.querySelector(this.parentSelector)?.addEventListener('scroll', this.onViewportChange);
50
+ document.querySelector(this.scrollContainer)?.addEventListener('scroll', this.onViewportChange);
51
51
  }
52
52
  },
53
53
  unmounted() {
54
54
  window.removeEventListener('resize', this.onViewportChange)
55
- if (this.parentSelector === "body") {
55
+ if (this.scrollContainer === "body") {
56
56
  window.addEventListener('scroll', this.onViewportChange);
57
57
  } else {
58
- document.querySelector(this.parentSelector)?.removeEventListener('scroll', this.onViewportChange)
58
+ document.querySelector(this.scrollContainer)?.removeEventListener('scroll', this.onViewportChange)
59
59
  }
60
60
  },
61
61
  /* watch for changes */
@@ -65,16 +65,22 @@ export default {
65
65
  }
66
66
  },
67
67
  methods: {
68
+ getScrollY() {
69
+ if (this.scrollContainer === "body") {
70
+ return window.scrollY
71
+ }
72
+ return document.querySelector(this.scrollContainer)?.scrollTop || 0
73
+ },
68
74
  onViewportChange() {
69
75
  this.windowInnerHeight = window.innerHeight;
70
- this.windowScrollY = window.scrollY ?? (document.querySelector(this.parentSelector)?.scrollTop || 0)
71
- this.scrollHeight = document.querySelector(this.parentSelector)?.scrollHeight || 0
76
+ this.windowScrollY = this.getScrollY()
77
+ this.scrollHeight = document.querySelector(this.scrollContainer)?.scrollHeight || 0
72
78
  },
73
79
  onBackToTop() {
74
- if (this.parentSelector === "body") {
80
+ if (this.scrollContainer === "body") {
75
81
  window.scrollTo({top: 0, left: 0, behavior: 'smooth'})
76
82
  } else {
77
- document.querySelector(this.parentSelector)?.scrollTo({top: 0, left: 0, behavior: 'smooth'})
83
+ document.querySelector(this.scrollContainer)?.scrollTo({top: 0, left: 0, behavior: 'smooth'})
78
84
  }
79
85
  }
80
86
  }