comand-component-library 3.3.57 → 3.3.58

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
  },
@@ -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, {
@@ -2370,7 +2375,7 @@ function Wl(e, i, t, a, n, s) {
2370
2375
  onClick: e.showItem,
2371
2376
  imgIndex: e.index
2372
2377
  }, null, 8, ["thumbnailScrollerItems", "onClick", "imgIndex"])) : m("", !0)
2373
- ], 10, Nl)
2378
+ ], 42, Nl)
2374
2379
  ]);
2375
2380
  }
2376
2381
  const Ah = /* @__PURE__ */ N(Dl, [["render", Wl]]);