tanxin-ui 1.0.4 → 1.0.6

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.
@@ -16403,15 +16403,28 @@ function getModalLevelCount(vm) {
16403
16403
  }
16404
16404
  const zIndex = ref(0);
16405
16405
  const fromIndex = 2e3;
16406
- const useZIndex = () => {
16406
+ const closingTag = ref(false);
16407
+ const useModal = () => {
16407
16408
  const currentZIndex = computed(() => fromIndex + zIndex.value);
16408
16409
  const nextZIndex = () => {
16409
16410
  zIndex.value++;
16410
16411
  return currentZIndex.value;
16411
16412
  };
16413
+ const addClosingTag = () => {
16414
+ closingTag.value = true;
16415
+ };
16416
+ const removeClosingTag = () => {
16417
+ closingTag.value = false;
16418
+ };
16419
+ const existsClosingTag = () => {
16420
+ return closingTag.value;
16421
+ };
16412
16422
  return {
16413
16423
  currentZIndex,
16414
- nextZIndex
16424
+ nextZIndex,
16425
+ addClosingTag,
16426
+ removeClosingTag,
16427
+ existsClosingTag
16415
16428
  };
16416
16429
  };
16417
16430
  function _isSlot$f(s2) {
@@ -16543,6 +16556,7 @@ var Modal = defineComponent({
16543
16556
  loading.value = props.loading;
16544
16557
  });
16545
16558
  const modalLevel = ref(0);
16559
+ const modal = useModal();
16546
16560
  watch(() => visible.value, () => {
16547
16561
  if (!isClient)
16548
16562
  return;
@@ -16582,16 +16596,17 @@ var Modal = defineComponent({
16582
16596
  };
16583
16597
  };
16584
16598
  const handleClose2 = () => {
16599
+ if (modal.existsClosingTag())
16600
+ return;
16601
+ modal.addClosingTag();
16585
16602
  visible.value = false;
16586
16603
  emit("update:visible", false);
16604
+ setTimeout(() => modal.removeClosingTag(), 10);
16587
16605
  };
16588
16606
  const handleKeyup = (event) => {
16589
16607
  if (event.code == "Escape") {
16590
- console.log(`modal modalLevel.value = ${modalLevel.value}, getModalLevelCount(vm) - 1=${getModalLevelCount(vm) - 1}`);
16591
- if (modalLevel.value == getModalLevelCount(vm) - 1)
16592
- setTimeout(() => {
16593
- handleClose2();
16594
- }, 10);
16608
+ if (visible.value && modalLevel.value == getModalLevelCount(vm) - 1)
16609
+ handleClose2();
16595
16610
  }
16596
16611
  };
16597
16612
  const mouseMoving = ref(false);
@@ -16680,7 +16695,7 @@ var Modal = defineComponent({
16680
16695
  onBeforeMount(() => {
16681
16696
  if (!isClient)
16682
16697
  return;
16683
- zIndex2.value = useZIndex().nextZIndex();
16698
+ zIndex2.value = modal.nextZIndex();
16684
16699
  });
16685
16700
  onMounted(() => {
16686
16701
  if (!isClient)
@@ -17240,6 +17255,7 @@ var Drawer = defineComponent({
17240
17255
  });
17241
17256
  const vm = getCurrentInstance();
17242
17257
  const modalLevel = ref(0);
17258
+ const modal = useModal();
17243
17259
  watch(() => visible.value, () => {
17244
17260
  if (!visible.value)
17245
17261
  loading.value = false;
@@ -17264,22 +17280,24 @@ var Drawer = defineComponent({
17264
17280
  }
17265
17281
  };
17266
17282
  const handleClose2 = () => {
17283
+ if (modal.existsClosingTag())
17284
+ return;
17285
+ modal.addClosingTag();
17267
17286
  visible.value = false;
17268
17287
  emit("update:visible", false);
17288
+ setTimeout(() => modal.removeClosingTag(), 10);
17269
17289
  };
17270
17290
  const handleKeyup = (event) => {
17271
17291
  if (event.code == "Escape") {
17272
- if (modalLevel.value == getModalLevelCount(vm) - 1)
17273
- setTimeout(() => {
17274
- handleClose2();
17275
- }, 10);
17292
+ if (visible.value && modalLevel.value == getModalLevelCount(vm) - 1)
17293
+ handleClose2();
17276
17294
  }
17277
17295
  };
17278
17296
  const dialogPosition = ref();
17279
17297
  onBeforeMount(() => {
17280
17298
  if (!isClient)
17281
17299
  return;
17282
- zIndex2.value = useZIndex().nextZIndex();
17300
+ zIndex2.value = modal.nextZIndex();
17283
17301
  });
17284
17302
  onMounted(() => {
17285
17303
  if (!isClient)
@@ -21361,6 +21379,7 @@ var ImagePreview = defineComponent({
21361
21379
  });
21362
21380
  const vm = getCurrentInstance();
21363
21381
  const modalLevel = ref(0);
21382
+ const modal = useModal();
21364
21383
  const zIndex2 = ref(0);
21365
21384
  const topStyles = computed(() => {
21366
21385
  return {
@@ -21379,17 +21398,18 @@ var ImagePreview = defineComponent({
21379
21398
  removeEventListener();
21380
21399
  });
21381
21400
  const handleClose2 = () => {
21401
+ if (modal.existsClosingTag())
21402
+ return;
21403
+ modal.addClosingTag();
21382
21404
  visible.value = false;
21383
21405
  emit("update:visible", false);
21406
+ setTimeout(() => modal.removeClosingTag(), 200);
21384
21407
  };
21385
21408
  const handleKeydown = (event) => {
21386
21409
  switch (event.code) {
21387
21410
  case "Escape":
21388
- console.log(`preview modalLevel.value = ${modalLevel.value}, getModalLevelCount(vm) - 1=${getModalLevelCount(vm) - 1}`);
21389
- if (modalLevel.value == getModalLevelCount(vm) - 1)
21390
- setTimeout(() => {
21391
- handleClose2();
21392
- }, 10);
21411
+ if (visible.value && modalLevel.value == getModalLevelCount(vm) - 1)
21412
+ handleClose2();
21393
21413
  break;
21394
21414
  case "ArrowDown":
21395
21415
  handleScale(event, -1);
@@ -21511,7 +21531,7 @@ var ImagePreview = defineComponent({
21511
21531
  onBeforeMount(() => {
21512
21532
  if (!isClient)
21513
21533
  return;
21514
- zIndex2.value = useZIndex().nextZIndex();
21534
+ zIndex2.value = modal.nextZIndex();
21515
21535
  });
21516
21536
  const render = () => {
21517
21537
  const maskTransitionProps = getTransitionGroupProps("fade");