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

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.
@@ -1,6 +1,7 @@
1
- import { defineComponent, ref, useAttrs, computed, openBlock, createBlock, unref, mergeProps, createSlots, renderList, withCtx, renderSlot, mergeModels, useModel, createElementVNode, normalizeProps, guardReactiveProps, inject, createElementBlock, watch, resolveComponent, createVNode, onUnmounted, isVNode } from "vue";
2
- import { ElButton, ElTag, ElInput, ElForm, ElFormItem, ElSelect, ElOption, ElCheckbox, ElCheckboxGroup, ElRadio, ElRadioGroup, ElRadioButton, ElSwitch, ElCascader, ElDatePicker, ElTimePicker, ElUpload, ElTransfer, ElTable, ElTableColumn, ElTree, localeContextKey, ElPagination, ElImage, ElProgress, ElBadge, ElCard, ElDescriptions, ElAlert, ElDialog, ElDrawer, ElPopover, ElTooltip, ElNotification as ElNotification$1, vLoading as vLoading$1, ElMenu, ElDropdown, ElTabs, ElTabPane, ElMenuItem, ElSubMenu, ElDropdownMenu, ElDropdownItem, ElCollapse, ElCollapseItem, ElIcon, ElAvatar, ElRow, ElContainer, ElHeader, ElAside, ElMain, ElConfigProvider, ElScrollbar, ElDescriptionsItem, ElBreadcrumb, ElBreadcrumbItem, ElTour, ElTourStep, ElMessageBox, ElMessage } from "element-plus";
1
+ import { defineComponent, ref, useAttrs, computed, openBlock, createBlock, unref, mergeProps, createSlots, renderList, withCtx, renderSlot, mergeModels, useModel, createElementVNode, normalizeProps, guardReactiveProps, inject, createElementBlock, watch, resolveComponent, createVNode, onUnmounted, Teleport, normalizeClass, normalizeStyle, createCommentVNode, onMounted, Fragment, isVNode } from "vue";
2
+ import { ElButton, ElTag, ElInput, ElForm, ElFormItem, ElSelect, ElOption, ElCheckbox, ElCheckboxGroup, ElRadio, ElRadioGroup, ElRadioButton, ElSwitch, ElCascader, ElDatePicker, ElTimePicker, ElUpload, ElTransfer, ElTable, ElTableColumn, ElTree, localeContextKey, ElPagination, ElImage, ElProgress, ElBadge, ElCard, ElDescriptions, ElAlert, useZIndex, ElDialog, ElDrawer, ElPopover, ElTooltip, ElMessageBox, ElNotification as ElNotification$1, vLoading as vLoading$1, ElMenu, ElDropdown, ElTabs, ElTabPane, ElMenuItem, ElSubMenu, ElDropdownMenu, ElDropdownItem, ElCollapse, ElCollapseItem, ElIcon, ElAvatar, ElRow, ElContainer, ElHeader, ElAside, ElMain, ElConfigProvider, ElScrollbar, ElDescriptionsItem, ElBreadcrumb, ElBreadcrumbItem, ElTour, ElTourStep, ElMessage } from "element-plus";
3
3
  import { ElMessage as ElMessage2 } from "element-plus";
4
+ const overlayNoTransition = "";
4
5
  function useExpose(proxyElement) {
5
6
  const expose = new Proxy({}, {
6
7
  get(target, key) {
@@ -13,7 +14,7 @@ function useExpose(proxyElement) {
13
14
  });
14
15
  return expose;
15
16
  }
16
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
17
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
17
18
  ...{
18
19
  inheritAttrs: false
19
20
  },
@@ -61,7 +62,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
61
62
  }
62
63
  });
63
64
  const index_vue_vue_type_style_index_0_lang$u = "";
64
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
65
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
65
66
  __name: "index",
66
67
  setup(__props, { expose: __expose }) {
67
68
  const attrs = useAttrs();
@@ -93,7 +94,7 @@ function useDataTestId() {
93
94
  console.warn(`${UI_AUTOMATION_TOKEN} is required to UI Automation`);
94
95
  }
95
96
  }
96
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
97
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
97
98
  __name: "ElInput",
98
99
  props: {
99
100
  "modelValue": {
@@ -143,7 +144,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
143
144
  }
144
145
  });
145
146
  const ElInput_vue_vue_type_style_index_0_lang = "";
146
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
147
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
147
148
  __name: "index",
148
149
  setup(__props, { expose: __expose }) {
149
150
  const proxyElement = ref();
@@ -168,7 +169,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
168
169
  }
169
170
  });
170
171
  const index_vue_vue_type_style_index_0_lang$s = "";
171
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
172
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
172
173
  __name: "index",
173
174
  setup(__props, { expose: __expose }) {
174
175
  const attrs = useAttrs();
@@ -192,7 +193,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
192
193
  };
193
194
  }
194
195
  });
195
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
196
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
196
197
  __name: "index",
197
198
  setup(__props, { expose: __expose }) {
198
199
  const proxyElement = ref();
@@ -218,7 +219,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
218
219
  }
219
220
  });
220
221
  const index_vue_vue_type_style_index_0_lang$r = "";
221
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
222
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
222
223
  __name: "index",
223
224
  setup(__props, { expose: __expose }) {
224
225
  const attrs = useAttrs();
@@ -242,7 +243,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
242
243
  };
243
244
  }
244
245
  });
245
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
246
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
246
247
  ...{
247
248
  inheritAttrs: false
248
249
  },
@@ -270,7 +271,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
270
271
  }
271
272
  });
272
273
  const index_vue_vue_type_style_index_0_lang$q = "";
273
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
274
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
274
275
  ...{
275
276
  inheritAttrs: false
276
277
  },
@@ -297,7 +298,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
297
298
  };
298
299
  }
299
300
  });
300
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
301
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
301
302
  __name: "index",
302
303
  setup(__props, { expose: __expose }) {
303
304
  const proxyElement = ref();
@@ -322,7 +323,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
322
323
  }
323
324
  });
324
325
  const index_vue_vue_type_style_index_0_lang$p = "";
325
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
326
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
326
327
  __name: "index",
327
328
  props: {
328
329
  round: {
@@ -355,7 +356,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
355
356
  }
356
357
  });
357
358
  const index_vue_vue_type_style_index_0_lang$o = "";
358
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
359
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
359
360
  __name: "index",
360
361
  setup(__props, { expose: __expose }) {
361
362
  const attrs = useAttrs();
@@ -379,7 +380,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
379
380
  };
380
381
  }
381
382
  });
382
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
383
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
383
384
  __name: "index",
384
385
  setup(__props, { expose: __expose }) {
385
386
  const proxyElement = ref();
@@ -405,7 +406,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
405
406
  }
406
407
  });
407
408
  const index_vue_vue_type_style_index_0_lang$n = "";
408
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
409
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
409
410
  __name: "index",
410
411
  setup(__props, { expose: __expose }) {
411
412
  const proxyElement = ref();
@@ -430,7 +431,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
430
431
  }
431
432
  });
432
433
  const index_vue_vue_type_style_index_0_lang$m = "";
433
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
434
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
434
435
  __name: "index",
435
436
  props: {
436
437
  defaultTime: {},
@@ -480,7 +481,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
480
481
  }
481
482
  });
482
483
  const index_vue_vue_type_style_index_0_lang$l = "";
483
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
484
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
484
485
  __name: "index",
485
486
  setup(__props, { expose: __expose }) {
486
487
  const proxyElement = ref();
@@ -505,7 +506,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
505
506
  }
506
507
  });
507
508
  const index_vue_vue_type_style_index_0_lang$k = "";
508
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
509
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
509
510
  __name: "index",
510
511
  setup(__props, { expose: __expose }) {
511
512
  const proxyElement = ref();
@@ -530,7 +531,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
530
531
  }
531
532
  });
532
533
  const index_vue_vue_type_style_index_0_lang$j = "";
533
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
534
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
534
535
  __name: "index",
535
536
  setup(__props, { expose: __expose }) {
536
537
  const attrs = useAttrs();
@@ -555,7 +556,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
555
556
  }
556
557
  });
557
558
  const index_vue_vue_type_style_index_0_lang$i = "";
558
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
559
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
559
560
  __name: "index",
560
561
  setup(__props, { expose: __expose }) {
561
562
  const proxyElement = ref();
@@ -587,7 +588,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
587
588
  }
588
589
  });
589
590
  const index_vue_vue_type_style_index_0_lang$h = "";
590
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
591
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
591
592
  __name: "index",
592
593
  props: {
593
594
  formatter: {
@@ -625,7 +626,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
625
626
  };
626
627
  }
627
628
  });
628
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
629
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
629
630
  __name: "index",
630
631
  setup(__props, { expose: __expose }) {
631
632
  const attrs = useAttrs();
@@ -650,7 +651,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
650
651
  }
651
652
  });
652
653
  const index_vue_vue_type_style_index_0_lang$g = "";
653
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
654
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
654
655
  __name: "index",
655
656
  setup(__props, { expose: __expose }) {
656
657
  const attrs = useAttrs();
@@ -703,7 +704,7 @@ var _sfc_main197 = /* @__PURE__ */ defineComponent({
703
704
  }
704
705
  }), picture_default = _sfc_main197;
705
706
  const _hoisted_1 = { class: "error-slot" };
706
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
707
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
707
708
  ...{ inheritAttrs: false },
708
709
  __name: "index",
709
710
  props: {
@@ -776,7 +777,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
776
777
  }
777
778
  });
778
779
  const index_vue_vue_type_style_index_0_lang$e = "";
779
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
780
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
780
781
  __name: "index",
781
782
  setup(__props, { expose: __expose }) {
782
783
  const attrs = useAttrs();
@@ -801,7 +802,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
801
802
  }
802
803
  });
803
804
  const index_vue_vue_type_style_index_0_lang$d = "";
804
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
805
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
805
806
  __name: "index",
806
807
  setup(__props, { expose: __expose }) {
807
808
  const attrs = useAttrs();
@@ -826,7 +827,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
826
827
  }
827
828
  });
828
829
  const index_vue_vue_type_style_index_0_lang$c = "";
829
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
830
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
830
831
  __name: "index",
831
832
  setup(__props, { expose: __expose }) {
832
833
  const attrs = useAttrs();
@@ -851,7 +852,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
851
852
  }
852
853
  });
853
854
  const index_vue_vue_type_style_index_0_lang$b = "";
854
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
855
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
855
856
  __name: "index",
856
857
  setup(__props, { expose: __expose }) {
857
858
  const proxyElement = ref();
@@ -886,7 +887,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
886
887
  }
887
888
  });
888
889
  const index_vue_vue_type_style_index_0_lang$a = "";
889
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
890
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
890
891
  __name: "index",
891
892
  setup(__props, { expose: __expose }) {
892
893
  const attrs = useAttrs();
@@ -911,74 +912,259 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
911
912
  }
912
913
  });
913
914
  const index_vue_vue_type_style_index_0_lang$9 = "";
915
+ const isInIframe = typeof window !== "undefined" && window.self !== window.top;
916
+ const COUNT_KEY = "__elDialogOverlayCount__";
917
+ let transitionDisabled = false;
918
+ let enableTimer = null;
919
+ const OVERLAY_TRANSITION_DURATION = 200;
920
+ function disableOverlayTransition() {
921
+ if (!isInIframe)
922
+ return;
923
+ if (enableTimer) {
924
+ clearTimeout(enableTimer);
925
+ enableTimer = null;
926
+ }
927
+ if (transitionDisabled)
928
+ return;
929
+ transitionDisabled = true;
930
+ document.documentElement.classList.add("gw-overlay-no-transition");
931
+ }
932
+ function enableOverlayTransition() {
933
+ if (!isInIframe || !transitionDisabled)
934
+ return;
935
+ if (enableTimer)
936
+ clearTimeout(enableTimer);
937
+ enableTimer = setTimeout(() => {
938
+ transitionDisabled = false;
939
+ document.documentElement.classList.remove("gw-overlay-no-transition");
940
+ enableTimer = null;
941
+ }, OVERLAY_TRANSITION_DURATION);
942
+ }
943
+ function getCount() {
944
+ return window[COUNT_KEY] || 0;
945
+ }
946
+ function setCount(count) {
947
+ window[COUNT_KEY] = count;
948
+ }
949
+ function postOverlayMessage(visible) {
950
+ if (!isInIframe)
951
+ return;
952
+ try {
953
+ window.parent.postMessage({ overlayMask: visible }, "*");
954
+ } catch (e) {
955
+ console.log(e);
956
+ }
957
+ }
958
+ const globalOverlayVisible = ref(false);
959
+ const globalOverlayZIndex = ref(2e3);
960
+ function useOverlayMask() {
961
+ let hasCounted = false;
962
+ let isMounted = false;
963
+ function triggerOverlay(visible) {
964
+ if (!isInIframe)
965
+ return;
966
+ try {
967
+ let count = getCount();
968
+ if (visible) {
969
+ if (hasCounted)
970
+ return;
971
+ count++;
972
+ hasCounted = true;
973
+ } else {
974
+ if (!hasCounted)
975
+ return;
976
+ count = Math.max(0, count - 1);
977
+ hasCounted = false;
978
+ }
979
+ setCount(count);
980
+ const shouldShow = count > 0;
981
+ if (shouldShow) {
982
+ disableOverlayTransition();
983
+ } else {
984
+ enableOverlayTransition();
985
+ }
986
+ globalOverlayVisible.value = shouldShow;
987
+ postOverlayMessage(shouldShow);
988
+ } catch (e) {
989
+ console.log(e);
990
+ }
991
+ }
992
+ function onOpen() {
993
+ if (hasCounted)
994
+ return;
995
+ triggerOverlay(true);
996
+ }
997
+ function onClose() {
998
+ triggerOverlay(false);
999
+ }
1000
+ function onMount(modelValue) {
1001
+ isMounted = true;
1002
+ Promise.resolve().then(() => {
1003
+ if (isMounted && !hasCounted && modelValue === true) {
1004
+ onOpen();
1005
+ }
1006
+ });
1007
+ }
1008
+ function onUnmount() {
1009
+ isMounted = false;
1010
+ if (hasCounted) {
1011
+ triggerOverlay(false);
1012
+ }
1013
+ }
1014
+ return {
1015
+ overlayVisible: globalOverlayVisible,
1016
+ overlayZIndex: globalOverlayZIndex,
1017
+ onOpen,
1018
+ onClose,
1019
+ onUnmount,
1020
+ onMount
1021
+ };
1022
+ }
1023
+ const overlayMask = {
1024
+ show() {
1025
+ if (!isInIframe)
1026
+ return;
1027
+ try {
1028
+ let count = getCount();
1029
+ const wasZero = count === 0;
1030
+ count++;
1031
+ setCount(count);
1032
+ if (wasZero) {
1033
+ disableOverlayTransition();
1034
+ postOverlayMessage(true);
1035
+ }
1036
+ } catch (e) {
1037
+ console.log(e);
1038
+ }
1039
+ },
1040
+ hide() {
1041
+ if (!isInIframe)
1042
+ return;
1043
+ try {
1044
+ let count = getCount();
1045
+ count = Math.max(0, count - 1);
1046
+ setCount(count);
1047
+ if (count === 0) {
1048
+ postOverlayMessage(false);
1049
+ enableOverlayTransition();
1050
+ }
1051
+ } catch (e) {
1052
+ console.log(e);
1053
+ }
1054
+ }
1055
+ };
1056
+ const GwOverlayMaskKey = "__gwOverlayMaskActive__";
1057
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
1058
+ __name: "index",
1059
+ props: {
1060
+ visible: { type: Boolean, default: false },
1061
+ backgroundColor: { default: "rgba(0, 0, 0, 0.5)" },
1062
+ width: { default: "100%" },
1063
+ height: { default: "100%" },
1064
+ transitionDuration: { default: "0.2s" }
1065
+ },
1066
+ emits: ["click"],
1067
+ setup(__props, { emit: __emit }) {
1068
+ const props = __props;
1069
+ const emit = __emit;
1070
+ const isInstance = !window[GwOverlayMaskKey];
1071
+ if (isInstance) {
1072
+ window[GwOverlayMaskKey] = true;
1073
+ }
1074
+ onUnmounted(() => {
1075
+ if (isInstance) {
1076
+ window[GwOverlayMaskKey] = false;
1077
+ }
1078
+ });
1079
+ const overlayStyle = computed(() => ({
1080
+ position: "fixed",
1081
+ left: "0",
1082
+ top: "0",
1083
+ width: props.width,
1084
+ height: props.height,
1085
+ zIndex: 2e3,
1086
+ backgroundColor: props.backgroundColor,
1087
+ transitionDuration: props.transitionDuration
1088
+ }));
1089
+ const handleClick = (event) => {
1090
+ emit("click", event);
1091
+ };
1092
+ const handleMouseDown = (event) => {
1093
+ event.stopPropagation();
1094
+ };
1095
+ return (_ctx, _cache) => {
1096
+ return openBlock(), createBlock(Teleport, { to: "body" }, [
1097
+ isInstance ? (openBlock(), createElementBlock("div", {
1098
+ key: 0,
1099
+ class: normalizeClass(["gw-overlay-mask", { "gw-overlay-mask--visible": __props.visible }]),
1100
+ style: normalizeStyle(overlayStyle.value),
1101
+ onClick: handleClick,
1102
+ onMousedown: handleMouseDown
1103
+ }, null, 38)) : createCommentVNode("", true)
1104
+ ]);
1105
+ };
1106
+ }
1107
+ });
1108
+ const index_vue_vue_type_style_index_0_scoped_cf048b89_lang = "";
1109
+ const _export_sfc = (sfc, props) => {
1110
+ const target = sfc.__vccOpts || sfc;
1111
+ for (const [key, val] of props) {
1112
+ target[key] = val;
1113
+ }
1114
+ return target;
1115
+ };
1116
+ const GwOverlayMask = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-cf048b89"]]);
914
1117
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
915
1118
  __name: "index",
916
1119
  setup(__props, { expose: __expose }) {
917
- useAttrs();
1120
+ const attrs = useAttrs();
918
1121
  const proxyElement = ref();
919
1122
  const expose = useExpose(proxyElement);
920
1123
  __expose(expose);
921
- const isInIframe = window.self !== window.top;
922
- let hasCounted = false;
923
- const dialogModal = ref(true);
924
- function onOpen() {
1124
+ const { overlayVisible, overlayZIndex, onOpen, onClose, onUnmount, onMount } = useOverlayMask();
1125
+ const { nextZIndex } = useZIndex();
1126
+ const dialogModal = computed(() => !isInIframe);
1127
+ function handleOpen() {
925
1128
  if (isInIframe) {
926
1129
  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
- }
936
- function triggerOverlay(visible) {
937
- if (!isInIframe)
938
- return;
939
- try {
940
- let count = window.__elDialogOverlayCount__ || 0;
941
- if (visible) {
942
- if (hasCounted)
943
- return;
944
- count++;
945
- hasCounted = true;
946
- } else {
947
- if (!hasCounted)
948
- return;
949
- count = Math.max(0, count - 1);
950
- hasCounted = false;
1130
+ if (currentCount === 0) {
1131
+ overlayZIndex.value = nextZIndex();
951
1132
  }
952
- ;
953
- window.__elDialogOverlayCount__ = count;
954
- const shouldShow = count > 0;
955
- window.parent.postMessage({ overlayMask: shouldShow }, "*");
956
- } catch (e) {
957
- console.log(e);
958
1133
  }
1134
+ onOpen();
1135
+ }
1136
+ function handleClose() {
1137
+ onClose();
959
1138
  }
1139
+ onMounted(() => {
1140
+ onMount(attrs.modelValue);
1141
+ });
960
1142
  onUnmounted(() => {
961
- if (hasCounted) {
962
- triggerOverlay(false);
963
- }
1143
+ onUnmount();
964
1144
  });
965
1145
  return (_ctx, _cache) => {
966
- return openBlock(), createBlock(unref(ElDialog), mergeProps(_ctx.$attrs, {
967
- modal: dialogModal.value,
968
- ref_key: "proxyElement",
969
- ref: proxyElement,
970
- onOpen,
971
- onClose
972
- }), createSlots({ _: 2 }, [
973
- renderList(_ctx.$slots, (value, key) => {
974
- return {
975
- name: key,
976
- fn: withCtx((slotProps) => [
977
- renderSlot(_ctx.$slots, key, mergeProps(slotProps, { key }))
978
- ])
979
- };
980
- })
981
- ]), 1040, ["modal"]);
1146
+ return openBlock(), createElementBlock(Fragment, null, [
1147
+ unref(isInIframe) ? (openBlock(), createBlock(GwOverlayMask, {
1148
+ key: 0,
1149
+ visible: unref(overlayVisible)
1150
+ }, null, 8, ["visible"])) : createCommentVNode("", true),
1151
+ createVNode(unref(ElDialog), mergeProps(_ctx.$attrs, {
1152
+ modal: dialogModal.value,
1153
+ ref_key: "proxyElement",
1154
+ ref: proxyElement,
1155
+ onOpen: handleOpen,
1156
+ onClose: handleClose
1157
+ }), createSlots({ _: 2 }, [
1158
+ renderList(_ctx.$slots, (value, key) => {
1159
+ return {
1160
+ name: key,
1161
+ fn: withCtx((slotProps) => [
1162
+ renderSlot(_ctx.$slots, key, mergeProps(slotProps, { key }))
1163
+ ])
1164
+ };
1165
+ })
1166
+ ]), 1040, ["modal"])
1167
+ ], 64);
982
1168
  };
983
1169
  }
984
1170
  });
@@ -1060,6 +1246,64 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1060
1246
  });
1061
1247
  const index_vue_vue_type_style_index_0_lang$5 = "";
1062
1248
  const index$2 = "";
1249
+ function wrapMethod(fn) {
1250
+ return function(...args) {
1251
+ let hasHidden = false;
1252
+ const injectOptions = (options) => {
1253
+ const userBeforeClose = options == null ? void 0 : options.beforeClose;
1254
+ const wrappedBeforeClose = (action, instance, done) => {
1255
+ const wrappedDone = () => {
1256
+ if (!hasHidden) {
1257
+ hasHidden = true;
1258
+ overlayMask.hide();
1259
+ }
1260
+ done();
1261
+ };
1262
+ if (typeof userBeforeClose === "function") {
1263
+ userBeforeClose(action, instance, wrappedDone);
1264
+ } else {
1265
+ wrappedDone();
1266
+ }
1267
+ };
1268
+ return { ...options, beforeClose: wrappedBeforeClose };
1269
+ };
1270
+ if (args.length > 0 && typeof args[0] === "object" && !Array.isArray(args[0])) {
1271
+ args[0] = injectOptions(args[0]);
1272
+ } else {
1273
+ args[2] = injectOptions(args[2] || {});
1274
+ }
1275
+ overlayMask.show();
1276
+ const result = fn.apply(this, args);
1277
+ return result.finally(() => {
1278
+ if (!hasHidden) {
1279
+ hasHidden = true;
1280
+ overlayMask.hide();
1281
+ }
1282
+ });
1283
+ };
1284
+ }
1285
+ const wrappedMsgbox = wrapMethod(ElMessageBox);
1286
+ const wrappedAlert = wrapMethod(ElMessageBox.alert.bind(ElMessageBox));
1287
+ const wrappedConfirm = wrapMethod(ElMessageBox.confirm.bind(ElMessageBox));
1288
+ const wrappedPrompt = wrapMethod(ElMessageBox.prompt.bind(ElMessageBox));
1289
+ const WrappedElMessageBox = Object.assign(wrappedMsgbox, {
1290
+ alert: wrappedAlert,
1291
+ confirm: wrappedConfirm,
1292
+ prompt: wrappedPrompt,
1293
+ close: ElMessageBox.close.bind(ElMessageBox),
1294
+ _context: null
1295
+ });
1296
+ WrappedElMessageBox.install = function(app) {
1297
+ if (WrappedElMessageBox._installed)
1298
+ return;
1299
+ WrappedElMessageBox._installed = true;
1300
+ WrappedElMessageBox._context = app._context;
1301
+ app.config.globalProperties.$msgbox = WrappedElMessageBox;
1302
+ app.config.globalProperties.$messageBox = WrappedElMessageBox;
1303
+ app.config.globalProperties.$alert = wrappedAlert;
1304
+ app.config.globalProperties.$confirm = wrappedConfirm;
1305
+ app.config.globalProperties.$prompt = wrappedPrompt;
1306
+ };
1063
1307
  const index$1 = "";
1064
1308
  const install = ElNotification$1.install;
1065
1309
  const defaultOption = {
@@ -1403,8 +1647,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1403
1647
  const index_vue_vue_type_style_index_0_lang = "";
1404
1648
  const Adapter = {
1405
1649
  // 基础组件
1406
- ElButton: _sfc_main$G,
1407
- ElTag: _sfc_main$F,
1650
+ ElButton: _sfc_main$H,
1651
+ ElTag: _sfc_main$G,
1408
1652
  ElIcon,
1409
1653
  ElAvatar,
1410
1654
  ElRow,
@@ -1416,35 +1660,35 @@ const Adapter = {
1416
1660
  ElConfigProvider,
1417
1661
  ElScrollbar,
1418
1662
  // 表单组件
1419
- ElInput: _sfc_main$E,
1420
- ElForm: _sfc_main$D,
1421
- ElFormItem: _sfc_main$C,
1422
- ElSelect: _sfc_main$B,
1423
- ElOption: _sfc_main$A,
1424
- ElCheckbox: _sfc_main$z,
1425
- ElCheckboxGroup: _sfc_main$y,
1426
- ElRadio: _sfc_main$x,
1427
- ElRadioGroup: _sfc_main$w,
1428
- ElRadioButton: _sfc_main$v,
1429
- ElSwitch: _sfc_main$u,
1430
- ElCascader: _sfc_main$t,
1431
- ElDatePicker: _sfc_main$s,
1432
- ElTimePicker: _sfc_main$r,
1433
- ElUpload: _sfc_main$q,
1434
- ElTransfer: _sfc_main$p,
1663
+ ElInput: _sfc_main$F,
1664
+ ElForm: _sfc_main$E,
1665
+ ElFormItem: _sfc_main$D,
1666
+ ElSelect: _sfc_main$C,
1667
+ ElOption: _sfc_main$B,
1668
+ ElCheckbox: _sfc_main$A,
1669
+ ElCheckboxGroup: _sfc_main$z,
1670
+ ElRadio: _sfc_main$y,
1671
+ ElRadioGroup: _sfc_main$x,
1672
+ ElRadioButton: _sfc_main$w,
1673
+ ElSwitch: _sfc_main$v,
1674
+ ElCascader: _sfc_main$u,
1675
+ ElDatePicker: _sfc_main$t,
1676
+ ElTimePicker: _sfc_main$s,
1677
+ ElUpload: _sfc_main$r,
1678
+ ElTransfer: _sfc_main$q,
1435
1679
  // 数据展示
1436
- ElTable: _sfc_main$o,
1437
- ElTableColumn: _sfc_main$n,
1438
- ElTree: _sfc_main$m,
1439
- ElPagination: _sfc_main$l,
1440
- ElImage: _sfc_main$k,
1441
- ElProgress: _sfc_main$j,
1442
- ElBadge: _sfc_main$i,
1443
- ElCard: _sfc_main$h,
1444
- ElDescriptions: _sfc_main$g,
1680
+ ElTable: _sfc_main$p,
1681
+ ElTableColumn: _sfc_main$o,
1682
+ ElTree: _sfc_main$n,
1683
+ ElPagination: _sfc_main$m,
1684
+ ElImage: _sfc_main$l,
1685
+ ElProgress: _sfc_main$k,
1686
+ ElBadge: _sfc_main$j,
1687
+ ElCard: _sfc_main$i,
1688
+ ElDescriptions: _sfc_main$h,
1445
1689
  ElDescriptionsItem,
1446
1690
  // 反馈组件
1447
- ElAlert: _sfc_main$f,
1691
+ ElAlert: _sfc_main$g,
1448
1692
  ElDialog: _sfc_main$e,
1449
1693
  ElDrawer: _sfc_main$d,
1450
1694
  ElPopover: _sfc_main$c,
@@ -1472,7 +1716,7 @@ function adapterInstall(app) {
1472
1716
  app.component(key, component);
1473
1717
  }
1474
1718
  adapterLoading(app);
1475
- app.use(ElMessageBox);
1719
+ app.use(WrappedElMessageBox);
1476
1720
  app.use(ElNotification);
1477
1721
  app.config.globalProperties.$message = ElMessage;
1478
1722
  }