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

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