comand-component-library 3.3.58 → 3.3.60

Sign up to get free protection for your applications and to get access to all the features.
@@ -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"];
@@ -1942,7 +1955,7 @@ const Il = {
1942
1955
  this.allowOpenFancyBox && Mt({ fancyBoxGallery: this.items, defaultGalleryIndex: e }), this.emitCurrentItemId(e);
1943
1956
  },
1944
1957
  emitCurrentItemId(e) {
1945
- this.$emit("click", this.items[e].id);
1958
+ this.$emit("click", this.items[e].image.id);
1946
1959
  },
1947
1960
  executeLink(e, i) {
1948
1961
  this.executeOnClick === "emit" ? (i.preventDefault(), this.emitCurrentItemId(e)) : this.executeOnClick === "fancybox" && (i.preventDefault(), this.showFancyBox(e));
@@ -1953,7 +1966,7 @@ const Il = {
1953
1966
  handler() {
1954
1967
  this.items = this.thumbnailScrollerItems.map((e) => {
1955
1968
  let i;
1956
- return this.contentType === "image" ? (i = { image: { ...e.image }, figcaption: { ...e.figcaption } }, i.image.src = i.image.srcImageSmall) : i = { ...e }, i;
1969
+ return this.contentType === "image" ? (i = { image: { ...e.image }, figcaption: { ...e.figcaption } }, i.image.srcImageSmall && (i.image.src = i.image.srcImageSmall)) : i = { ...e }, i;
1957
1970
  });
1958
1971
  },
1959
1972
  immediate: !0
@@ -2204,7 +2217,7 @@ const Mt = (e) => {
2204
2217
  },
2205
2218
  showItem(e) {
2206
2219
  for (let i = 0; i < this.fancyBoxGallery.length; i++)
2207
- if (this.fancyBoxGallery[i].id === e) {
2220
+ if (this.fancyBoxGallery[i].image.id === e) {
2208
2221
  this.index = i;
2209
2222
  break;
2210
2223
  }
@@ -2373,8 +2386,8 @@ function Wl(e, i, t, a, n, s) {
2373
2386
  thumbnailScrollerItems: [...e.fancyBoxGallery],
2374
2387
  allowOpenFancyBox: !1,
2375
2388
  onClick: e.showItem,
2376
- imgIndex: e.index
2377
- }, null, 8, ["thumbnailScrollerItems", "onClick", "imgIndex"])) : m("", !0)
2389
+ activeItemIndex: e.index
2390
+ }, null, 8, ["thumbnailScrollerItems", "onClick", "activeItemIndex"])) : m("", !0)
2378
2391
  ], 42, Nl)
2379
2392
  ]);
2380
2393
  }