comand-component-library 3.3.57 → 3.3.59

Sign up to get free protection for your applications and to get access to all the features.
@@ -1942,7 +1942,7 @@ const Il = {
1942
1942
  this.allowOpenFancyBox && Mt({ fancyBoxGallery: this.items, defaultGalleryIndex: e }), this.emitCurrentItemId(e);
1943
1943
  },
1944
1944
  emitCurrentItemId(e) {
1945
- this.$emit("click", this.items[e].id);
1945
+ this.$emit("click", this.items[e].image.id);
1946
1946
  },
1947
1947
  executeLink(e, i) {
1948
1948
  this.executeOnClick === "emit" ? (i.preventDefault(), this.emitCurrentItemId(e)) : this.executeOnClick === "fancybox" && (i.preventDefault(), this.showFancyBox(e));
@@ -1953,7 +1953,7 @@ const Il = {
1953
1953
  handler() {
1954
1954
  this.items = this.thumbnailScrollerItems.map((e) => {
1955
1955
  let i;
1956
- return this.contentType === "image" ? (i = { image: { ...e.image }, figcaption: { ...e.figcaption } }, i.image.src = i.image.srcImageSmall) : i = { ...e }, i;
1956
+ return this.contentType === "image" ? (i = { image: { ...e.image }, figcaption: { ...e.figcaption } }, i.image.srcImageSmall && (i.image.src = i.image.srcImageSmall)) : i = { ...e }, i;
1957
1957
  });
1958
1958
  },
1959
1959
  immediate: !0
@@ -2154,7 +2154,7 @@ const Mt = (e) => {
2154
2154
  }
2155
2155
  },
2156
2156
  created() {
2157
- this.allowEscapeKey && (this.$_FancyBox_escapeKeyHandler = (e) => (e.key === "Escape" || e.key === "Esc") && this.close(), document.querySelector("body").addEventListener("keyup", this.$_FancyBox_escapeKeyHandler)), this.$_FancyBox_scrollHandler = () => {
2157
+ this.$_FancyBox_scrollHandler = () => {
2158
2158
  window.scrollTo(0, this.$_FancyBox_verticalScrollPosition);
2159
2159
  }, this.$watch(
2160
2160
  () => [
@@ -2169,9 +2169,6 @@ const Mt = (e) => {
2169
2169
  mounted() {
2170
2170
  this.showFancyBox && this.showDialog();
2171
2171
  },
2172
- beforeUnmount() {
2173
- this.allowEscapeKey && document.querySelector("body").removeEventListener("keyup", this.$_FancyBox_escapeKeyHandler);
2174
- },
2175
2172
  computed: {
2176
2173
  largeGalleryImage() {
2177
2174
  const e = { ...this.fancyBoxGallery[this.index].image };
@@ -2184,6 +2181,13 @@ const Mt = (e) => {
2184
2181
  }
2185
2182
  },
2186
2183
  methods: {
2184
+ onDialogCancel(e) {
2185
+ if (!this.allowEscapeKey) {
2186
+ e.preventDefault();
2187
+ return;
2188
+ }
2189
+ this.close();
2190
+ },
2187
2191
  showDialog() {
2188
2192
  document.querySelector("body").classList.add("avoid-scrolling"), this.$refs.dialog.showModal(), this.$refs["close-dialog"].focus();
2189
2193
  },
@@ -2200,7 +2204,7 @@ const Mt = (e) => {
2200
2204
  },
2201
2205
  showItem(e) {
2202
2206
  for (let i = 0; i < this.fancyBoxGallery.length; i++)
2203
- if (this.fancyBoxGallery[i].id === e) {
2207
+ if (this.fancyBoxGallery[i].image.id === e) {
2204
2208
  this.index = i;
2205
2209
  break;
2206
2210
  }
@@ -2209,7 +2213,7 @@ const Mt = (e) => {
2209
2213
  this.index < this.fancyBoxGallery.length - 1 ? this.index++ : this.index = 0;
2210
2214
  },
2211
2215
  close() {
2212
- this.$options.el ? (this.$destroy(), this.$el.remove()) : (this.showFancyBox = !1, this.$emit("update:show", !1)), document.querySelector("body").classList.remove("avoid-scrolling");
2216
+ this.showFancyBox = !1, this.$emit("update:show", !1), document.querySelector("body").classList.remove("avoid-scrolling");
2213
2217
  },
2214
2218
  cancel() {
2215
2219
  this.$emit("cancel", !0), this.close();
@@ -2259,7 +2263,8 @@ function Wl(e, i, t, a, n, s) {
2259
2263
  h("dialog", {
2260
2264
  ref: "dialog",
2261
2265
  class: _(["cmd-fancybox", { "show-overlay": e.showOverlay, image: e.fancyBoxImageUrl || e.fancyBoxGallery, "image-gallery": e.fancyBoxGallery }]),
2262
- "aria-label": e.ariaLabelText
2266
+ "aria-label": e.ariaLabelText,
2267
+ onCancel: i[5] || (i[5] = (...ce) => e.onDialogCancel && e.onDialogCancel(...ce))
2263
2268
  }, [
2264
2269
  h("header", jl, [
2265
2270
  (p = e.cmdHeadline) != null && p.show ? (l(), C(u, {
@@ -2368,9 +2373,9 @@ function Wl(e, i, t, a, n, s) {
2368
2373
  thumbnailScrollerItems: [...e.fancyBoxGallery],
2369
2374
  allowOpenFancyBox: !1,
2370
2375
  onClick: e.showItem,
2371
- imgIndex: e.index
2372
- }, null, 8, ["thumbnailScrollerItems", "onClick", "imgIndex"])) : m("", !0)
2373
- ], 10, Nl)
2376
+ activeItemIndex: e.index
2377
+ }, null, 8, ["thumbnailScrollerItems", "onClick", "activeItemIndex"])) : m("", !0)
2378
+ ], 42, Nl)
2374
2379
  ]);
2375
2380
  }
2376
2381
  const Ah = /* @__PURE__ */ N(Dl, [["render", Wl]]);