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