comand-component-library 3.3.59 → 3.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.
@@ -1604,13 +1604,18 @@ const jh = /* @__PURE__ */ N(Cs, [["render", ll]]);
1604
1604
  const ol = {
1605
1605
  name: "CmdBackToTopButton",
1606
1606
  data() {
1607
+ var e;
1607
1608
  return {
1608
1609
  windowInnerHeight: window.innerHeight,
1609
- windowScrollY: window.scrollY,
1610
- bodyScrollHeight: document.body.scrollHeight
1610
+ windowScrollY: this.getScrollY(),
1611
+ scrollHeight: ((e = document.querySelector(this.scrollContainer)) == null ? void 0 : e.scrollHeight) || 0
1611
1612
  };
1612
1613
  },
1613
1614
  props: {
1615
+ scrollContainer: {
1616
+ type: String,
1617
+ default: "body"
1618
+ },
1614
1619
  iconBackToTop: {
1615
1620
  type: Object,
1616
1621
  default: function() {
@@ -1622,23 +1627,31 @@ const ol = {
1622
1627
  }
1623
1628
  }
1624
1629
  },
1625
- created() {
1626
- window.addEventListener("resize", this.onViewportChange), window.addEventListener("scroll", this.onViewportChange);
1630
+ mounted() {
1631
+ var e;
1632
+ window.addEventListener("resize", this.onViewportChange), this.scrollContainer === "body" ? window.addEventListener("scroll", this.onViewportChange) : (e = document.querySelector(this.scrollContainer)) == null || e.addEventListener("scroll", this.onViewportChange);
1627
1633
  },
1628
1634
  unmounted() {
1629
- window.removeEventListener("resize", this.onViewportChange), window.removeEventListener("scroll", this.onViewportChange);
1635
+ var e;
1636
+ window.removeEventListener("resize", this.onViewportChange), this.scrollContainer === "body" ? window.addEventListener("scroll", this.onViewportChange) : (e = document.querySelector(this.scrollContainer)) == null || e.removeEventListener("scroll", this.onViewportChange);
1630
1637
  },
1631
1638
  computed: {
1632
1639
  show() {
1633
- return this.windowScrollY > 0 && this.windowInnerHeight < this.bodyScrollHeight;
1640
+ return this.windowScrollY > 0 && this.windowInnerHeight < this.scrollHeight;
1634
1641
  }
1635
1642
  },
1636
1643
  methods: {
1644
+ getScrollY() {
1645
+ var e;
1646
+ return this.scrollContainer === "body" ? window.scrollY : ((e = document.querySelector(this.scrollContainer)) == null ? void 0 : e.scrollTop) || 0;
1647
+ },
1637
1648
  onViewportChange() {
1638
- this.windowInnerHeight = window.innerHeight, this.windowScrollY = window.scrollY, this.bodyScrollHeight = document.body.scrollHeight;
1649
+ var e;
1650
+ this.windowInnerHeight = window.innerHeight, this.windowScrollY = this.getScrollY(), this.scrollHeight = ((e = document.querySelector(this.scrollContainer)) == null ? void 0 : e.scrollHeight) || 0;
1639
1651
  },
1640
1652
  onBackToTop() {
1641
- window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
1653
+ var e;
1654
+ this.scrollContainer === "body" ? window.scrollTo({ top: 0, left: 0, behavior: "smooth" }) : (e = document.querySelector(this.scrollContainer)) == null || e.scrollTo({ top: 0, left: 0, behavior: "smooth" });
1642
1655
  }
1643
1656
  }
1644
1657
  }, al = ["title"];