@ganwei-web/gw-base-components-plus 1.0.36 → 1.0.37

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.
@@ -915,37 +915,61 @@ const index_vue_vue_type_style_index_0_lang$9 = "";
915
915
  const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
916
916
  __name: "index",
917
917
  setup(__props, { expose: __expose }) {
918
- const attrs = vue.useAttrs();
918
+ vue.useAttrs();
919
919
  const proxyElement = vue.ref();
920
920
  const expose = useExpose(proxyElement);
921
921
  __expose(expose);
922
- let dialogCount = window.__elDialogOverlayCount__ || 0;
922
+ const isInIframe = window.self !== window.top;
923
+ let hasCounted = false;
924
+ const dialogModal = vue.ref(true);
925
+ function onOpen() {
926
+ if (isInIframe) {
927
+ const currentCount = window.__elDialogOverlayCount__ || 0;
928
+ dialogModal.value = currentCount === 0;
929
+ } else {
930
+ dialogModal.value = true;
931
+ }
932
+ triggerOverlay(true);
933
+ }
934
+ function onClose() {
935
+ triggerOverlay(false);
936
+ }
923
937
  function triggerOverlay(visible) {
938
+ if (!isInIframe)
939
+ return;
924
940
  try {
941
+ let count = window.__elDialogOverlayCount__ || 0;
925
942
  if (visible) {
926
- dialogCount++;
927
- window.__elDialogOverlayCount__ = dialogCount;
943
+ if (hasCounted)
944
+ return;
945
+ count++;
946
+ hasCounted = true;
928
947
  } else {
929
- dialogCount = Math.max(0, dialogCount - 1);
930
- window.__elDialogOverlayCount__ = dialogCount;
948
+ if (!hasCounted)
949
+ return;
950
+ count = Math.max(0, count - 1);
951
+ hasCounted = false;
931
952
  }
932
- const shouldShow = dialogCount > 0;
953
+ ;
954
+ window.__elDialogOverlayCount__ = count;
955
+ const shouldShow = count > 0;
933
956
  window.parent.postMessage({ overlayMask: shouldShow }, "*");
934
957
  } catch (e) {
935
958
  console.log(e);
936
959
  }
937
960
  }
938
961
  vue.onUnmounted(() => {
939
- if (attrs.modelValue) {
962
+ if (hasCounted) {
940
963
  triggerOverlay(false);
941
964
  }
942
965
  });
943
966
  return (_ctx, _cache) => {
944
967
  return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElDialog), vue.mergeProps(_ctx.$attrs, {
968
+ modal: dialogModal.value,
945
969
  ref_key: "proxyElement",
946
970
  ref: proxyElement,
947
- onOpen: _cache[0] || (_cache[0] = ($event) => triggerOverlay(true)),
948
- onClose: _cache[1] || (_cache[1] = ($event) => triggerOverlay(false))
971
+ onOpen,
972
+ onClose
949
973
  }), vue.createSlots({ _: 2 }, [
950
974
  vue.renderList(_ctx.$slots, (value, key) => {
951
975
  return {
@@ -955,7 +979,7 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
955
979
  ])
956
980
  };
957
981
  })
958
- ]), 1040);
982
+ ]), 1040, ["modal"]);
959
983
  };
960
984
  }
961
985
  });