2020-10-17 13:12:00 +02:00
|
|
|
<template>
|
2023-02-19 00:27:12 +01:00
|
|
|
<Transition
|
|
|
|
:name="transitionName"
|
2023-04-08 02:01:42 +02:00
|
|
|
:enter-active-class="
|
|
|
|
$style['transition_' + transitionName + '_enterActive']
|
|
|
|
"
|
|
|
|
:leave-active-class="
|
|
|
|
$style['transition_' + transitionName + '_leaveActive']
|
|
|
|
"
|
|
|
|
:enter-from-class="
|
|
|
|
$style['transition_' + transitionName + '_enterFrom']
|
|
|
|
"
|
2023-02-19 00:27:12 +01:00
|
|
|
:leave-to-class="$style['transition_' + transitionName + '_leaveTo']"
|
2023-04-08 02:01:42 +02:00
|
|
|
:duration="transitionDuration"
|
|
|
|
appear
|
|
|
|
@after-leave="emit('closed')"
|
2023-04-29 02:26:10 +02:00
|
|
|
@keyup.esc="emit('click')"
|
2023-04-08 02:01:42 +02:00
|
|
|
@enter="emit('opening')"
|
|
|
|
@after-enter="onOpened"
|
2023-02-19 00:27:12 +01:00
|
|
|
>
|
2023-04-29 02:26:10 +02:00
|
|
|
<focus-trap v-model:active="isActive">
|
2023-04-08 02:01:42 +02:00
|
|
|
<div
|
2023-04-29 02:26:10 +02:00
|
|
|
v-show="manualShowing != null ? manualShowing : showing"
|
|
|
|
v-hotkey.global="keymap"
|
2023-04-08 02:01:42 +02:00
|
|
|
:class="[
|
2023-04-29 02:26:10 +02:00
|
|
|
$style.root,
|
2023-04-08 02:01:42 +02:00
|
|
|
{
|
2023-04-29 02:26:10 +02:00
|
|
|
[$style.drawer]: type === 'drawer',
|
|
|
|
[$style.dialog]: type === 'dialog' || type === 'dialog:top',
|
|
|
|
[$style.popup]: type === 'popup',
|
2023-04-08 02:01:42 +02:00
|
|
|
},
|
|
|
|
]"
|
2023-04-29 02:26:10 +02:00
|
|
|
:style="{
|
|
|
|
zIndex,
|
|
|
|
pointerEvents: (manualShowing != null ? manualShowing : showing)
|
|
|
|
? 'auto'
|
|
|
|
: 'none',
|
|
|
|
'--transformOrigin': transformOrigin,
|
|
|
|
}"
|
|
|
|
tabindex="-1"
|
|
|
|
v-focus
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
class="_modalBg data-cy-bg"
|
|
|
|
:class="[
|
|
|
|
$style.bg,
|
|
|
|
{
|
|
|
|
[$style.bgTransparent]: isEnableBgTransparent,
|
|
|
|
'data-cy-transparent': isEnableBgTransparent,
|
|
|
|
},
|
|
|
|
]"
|
|
|
|
:style="{ zIndex }"
|
|
|
|
@click="onBgClick"
|
|
|
|
@mousedown="onBgClick"
|
|
|
|
@contextmenu.prevent.stop="() => {}"
|
|
|
|
></div>
|
2023-04-29 01:57:19 +02:00
|
|
|
<div
|
|
|
|
ref="content"
|
|
|
|
:class="[
|
|
|
|
$style.content,
|
|
|
|
{ [$style.fixed]: fixed, top: type === 'dialog:top' },
|
|
|
|
]"
|
|
|
|
:style="{ zIndex }"
|
|
|
|
@click.self="onBgClick"
|
|
|
|
>
|
|
|
|
<slot :max-height="maxHeight" :type="type"></slot>
|
|
|
|
</div>
|
2023-04-29 02:26:10 +02:00
|
|
|
</div>
|
|
|
|
</focus-trap>
|
2023-02-19 00:27:12 +01:00
|
|
|
</Transition>
|
2020-10-17 13:12:00 +02:00
|
|
|
</template>
|
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 02:01:42 +02:00
|
|
|
import { nextTick, onMounted, watch, provide } from "vue";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { isTouchUsing } from "@/scripts/touch";
|
|
|
|
import { defaultStore } from "@/store";
|
|
|
|
import { deviceKind } from "@/scripts/device-kind";
|
2023-02-13 03:56:01 +01:00
|
|
|
import { FocusTrap } from 'focus-trap-vue';
|
2020-10-17 13:12:00 +02:00
|
|
|
|
|
|
|
function getFixedContainer(el: Element | null): Element | null {
|
2023-04-08 02:01:42 +02:00
|
|
|
if (el == null || el.tagName === "BODY") return null;
|
|
|
|
const position = window.getComputedStyle(el).getPropertyValue("position");
|
|
|
|
if (position === "fixed") {
|
2020-10-17 13:12:00 +02:00
|
|
|
return el;
|
|
|
|
} else {
|
|
|
|
return getFixedContainer(el.parentElement);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
type ModalTypes = "popup" | "dialog" | "dialog:top" | "drawer";
|
|
|
|
|
|
|
|
const props = withDefaults(
|
|
|
|
defineProps<{
|
|
|
|
manualShowing?: boolean | null;
|
|
|
|
anchor?: { x: string; y: string };
|
|
|
|
src?: HTMLElement;
|
|
|
|
preferType?: ModalTypes | "auto";
|
|
|
|
zPriority?: "low" | "middle" | "high";
|
|
|
|
noOverlap?: boolean;
|
|
|
|
transparentBg?: boolean;
|
|
|
|
}>(),
|
|
|
|
{
|
|
|
|
manualShowing: null,
|
|
|
|
src: null,
|
|
|
|
anchor: () => ({ x: "center", y: "bottom" }),
|
|
|
|
preferType: "auto",
|
|
|
|
zPriority: "low",
|
|
|
|
noOverlap: true,
|
|
|
|
transparentBg: false,
|
|
|
|
}
|
|
|
|
);
|
2021-12-16 18:14:40 +01:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
const emit = defineEmits<{
|
2023-04-08 02:01:42 +02:00
|
|
|
(ev: "opening"): void;
|
|
|
|
(ev: "opened"): void;
|
|
|
|
(ev: "click"): void;
|
|
|
|
(ev: "esc"): void;
|
|
|
|
(ev: "close"): void;
|
|
|
|
(ev: "closed"): void;
|
2022-01-28 04:14:21 +01:00
|
|
|
}>();
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
provide("modal", true);
|
2022-01-28 04:14:21 +01:00
|
|
|
|
2022-07-13 14:17:19 +02:00
|
|
|
let maxHeight = $ref<number>();
|
|
|
|
let fixed = $ref(false);
|
2023-04-08 02:01:42 +02:00
|
|
|
let transformOrigin = $ref("center");
|
2022-07-13 14:17:19 +02:00
|
|
|
let showing = $ref(true);
|
2023-02-19 00:27:12 +01:00
|
|
|
let content = $shallowRef<HTMLElement>();
|
2022-01-28 04:14:21 +01:00
|
|
|
const zIndex = os.claimZIndex(props.zPriority);
|
2023-02-19 00:27:12 +01:00
|
|
|
let useSendAnime = $ref(false);
|
|
|
|
const type = $computed<ModalTypes>(() => {
|
2023-04-08 02:01:42 +02:00
|
|
|
if (props.preferType === "auto") {
|
|
|
|
if (
|
|
|
|
!defaultStore.state.disableDrawer &&
|
|
|
|
isTouchUsing &&
|
|
|
|
deviceKind === "smartphone"
|
|
|
|
) {
|
|
|
|
return "drawer";
|
2022-01-28 04:14:21 +01:00
|
|
|
} else {
|
2023-04-08 02:01:42 +02:00
|
|
|
return props.src != null ? "popup" : "dialog";
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2022-01-28 04:14:21 +01:00
|
|
|
} else {
|
2022-01-28 04:20:42 +01:00
|
|
|
return props.preferType!;
|
2022-01-28 04:14:21 +01:00
|
|
|
}
|
|
|
|
});
|
2023-04-08 02:01:42 +02:00
|
|
|
const isEnableBgTransparent = $computed(
|
|
|
|
() => props.transparentBg && type === "popup"
|
|
|
|
);
|
|
|
|
let transitionName = $computed(() =>
|
2023-02-19 00:27:12 +01:00
|
|
|
defaultStore.state.animation
|
|
|
|
? useSendAnime
|
2023-04-08 02:01:42 +02:00
|
|
|
? "send"
|
|
|
|
: type === "drawer"
|
|
|
|
? "modal-drawer"
|
|
|
|
: type === "popup"
|
|
|
|
? "modal-popup"
|
|
|
|
: "modal"
|
|
|
|
: ""
|
|
|
|
);
|
|
|
|
let transitionDuration = $computed(() =>
|
|
|
|
transitionName === "send"
|
2023-02-19 00:27:12 +01:00
|
|
|
? 400
|
2023-04-08 02:01:42 +02:00
|
|
|
: transitionName === "modal-popup"
|
|
|
|
? 100
|
|
|
|
: transitionName === "modal"
|
|
|
|
? 200
|
|
|
|
: transitionName === "modal-drawer"
|
|
|
|
? 200
|
|
|
|
: 0
|
|
|
|
);
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
let contentClicking = false;
|
2021-12-16 18:14:40 +01:00
|
|
|
|
2023-02-13 02:49:41 +01:00
|
|
|
const focusedElement = document.activeElement;
|
2023-02-19 00:27:12 +01:00
|
|
|
function close(opts: { useSendAnimation?: boolean } = {}) {
|
|
|
|
if (opts.useSendAnimation) {
|
|
|
|
useSendAnime = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// eslint-disable-next-line vue/no-mutating-props
|
2023-04-08 02:01:42 +02:00
|
|
|
if (props.src) props.src.style.pointerEvents = "auto";
|
2022-07-13 14:17:19 +02:00
|
|
|
showing = false;
|
2023-04-08 02:01:42 +02:00
|
|
|
emit("close");
|
2023-02-13 02:49:41 +01:00
|
|
|
focusedElement.focus();
|
2023-02-19 00:27:12 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-02-19 00:27:12 +01:00
|
|
|
function onBgClick() {
|
2022-01-28 04:14:21 +01:00
|
|
|
if (contentClicking) return;
|
2023-04-08 02:01:42 +02:00
|
|
|
emit("click");
|
2023-04-29 02:52:09 +02:00
|
|
|
focusedElement.focus();
|
2023-02-19 00:27:12 +01:00
|
|
|
}
|
2021-12-16 18:14:40 +01:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
if (type === "drawer") {
|
2022-07-13 14:17:19 +02:00
|
|
|
maxHeight = window.innerHeight / 1.5;
|
2022-01-28 04:14:21 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
const keymap = {
|
2023-04-08 02:01:42 +02:00
|
|
|
esc: () => emit("esc"),
|
2022-01-28 04:14:21 +01:00
|
|
|
};
|
2021-03-05 08:59:43 +01:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
const MARGIN = 16;
|
2021-02-27 18:22:53 +01:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
const align = () => {
|
|
|
|
if (props.src == null) return;
|
2023-04-08 02:01:42 +02:00
|
|
|
if (type === "drawer") return;
|
|
|
|
if (type === "dialog") return;
|
2021-02-27 18:22:53 +01:00
|
|
|
|
2022-07-13 14:17:19 +02:00
|
|
|
if (content == null) return;
|
2022-01-28 04:14:21 +01:00
|
|
|
|
2022-03-19 14:03:53 +01:00
|
|
|
const srcRect = props.src.getBoundingClientRect();
|
2022-07-13 14:17:19 +02:00
|
|
|
|
|
|
|
const width = content!.offsetWidth;
|
|
|
|
const height = content!.offsetHeight;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
let left;
|
|
|
|
let top;
|
|
|
|
|
2022-07-13 14:17:19 +02:00
|
|
|
const x = srcRect.left + (fixed ? 0 : window.pageXOffset);
|
|
|
|
const y = srcRect.top + (fixed ? 0 : window.pageYOffset);
|
2022-03-06 15:21:19 +01:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
if (props.anchor.x === "center") {
|
|
|
|
left = x + props.src.offsetWidth / 2 - width / 2;
|
|
|
|
} else if (props.anchor.x === "left") {
|
2022-03-06 15:21:19 +01:00
|
|
|
// TODO
|
2023-04-08 02:01:42 +02:00
|
|
|
} else if (props.anchor.x === "right") {
|
2022-03-06 15:21:19 +01:00
|
|
|
left = x + props.src.offsetWidth;
|
|
|
|
}
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
if (props.anchor.y === "center") {
|
|
|
|
top = y - height / 2;
|
|
|
|
} else if (props.anchor.y === "top") {
|
2022-03-06 15:21:19 +01:00
|
|
|
// TODO
|
2023-04-08 02:01:42 +02:00
|
|
|
} else if (props.anchor.y === "bottom") {
|
2022-03-06 15:21:19 +01:00
|
|
|
top = y + props.src.offsetHeight;
|
2022-01-28 04:14:21 +01:00
|
|
|
}
|
|
|
|
|
2022-07-13 14:17:19 +02:00
|
|
|
if (fixed) {
|
2022-01-28 04:14:21 +01:00
|
|
|
// 画面から横にはみ出る場合
|
|
|
|
if (left + width > window.innerWidth) {
|
|
|
|
left = window.innerWidth - width;
|
|
|
|
}
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
const underSpace = window.innerHeight - MARGIN - top;
|
|
|
|
const upperSpace = srcRect.top - MARGIN;
|
2022-02-13 08:35:53 +01:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
// 画面から縦にはみ出る場合
|
2023-04-08 02:01:42 +02:00
|
|
|
if (top + height > window.innerHeight - MARGIN) {
|
|
|
|
if (props.noOverlap && props.anchor.x === "center") {
|
|
|
|
if (underSpace >= upperSpace / 3) {
|
2022-07-13 14:17:19 +02:00
|
|
|
maxHeight = underSpace;
|
2022-01-28 04:14:21 +01:00
|
|
|
} else {
|
2022-07-13 14:17:19 +02:00
|
|
|
maxHeight = upperSpace;
|
2023-04-08 02:01:42 +02:00
|
|
|
top = upperSpace + MARGIN - height;
|
2021-02-27 18:22:53 +01:00
|
|
|
}
|
|
|
|
} else {
|
2023-04-08 02:01:42 +02:00
|
|
|
top = window.innerHeight - MARGIN - height;
|
2022-01-28 04:14:21 +01:00
|
|
|
}
|
2022-02-13 08:35:53 +01:00
|
|
|
} else {
|
2022-07-13 14:17:19 +02:00
|
|
|
maxHeight = underSpace;
|
2022-01-28 04:14:21 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// 画面から横にはみ出る場合
|
2023-02-19 01:16:24 +01:00
|
|
|
if (left + width - window.scrollX > window.innerWidth) {
|
|
|
|
left = window.innerWidth - width + window.scrollX - 1;
|
2022-01-28 04:14:21 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
const underSpace =
|
|
|
|
window.innerHeight - MARGIN - (top - window.pageYOffset);
|
|
|
|
const upperSpace = srcRect.top - MARGIN;
|
2022-02-13 08:35:53 +01:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
// 画面から縦にはみ出る場合
|
2023-04-08 02:01:42 +02:00
|
|
|
if (top + height - window.scrollY > window.innerHeight - MARGIN) {
|
|
|
|
if (props.noOverlap && props.anchor.x === "center") {
|
|
|
|
if (underSpace >= upperSpace / 3) {
|
2022-07-13 14:17:19 +02:00
|
|
|
maxHeight = underSpace;
|
2022-01-28 04:14:21 +01:00
|
|
|
} else {
|
2022-07-13 14:17:19 +02:00
|
|
|
maxHeight = upperSpace;
|
2023-04-08 02:01:42 +02:00
|
|
|
top = window.scrollY + (upperSpace + MARGIN - height);
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2022-01-28 04:14:21 +01:00
|
|
|
} else {
|
2023-04-08 02:01:42 +02:00
|
|
|
top =
|
|
|
|
window.innerHeight -
|
|
|
|
MARGIN -
|
|
|
|
height +
|
|
|
|
window.pageYOffset -
|
|
|
|
1;
|
2021-02-27 18:22:53 +01:00
|
|
|
}
|
2022-02-13 08:35:53 +01:00
|
|
|
} else {
|
2022-07-13 14:17:19 +02:00
|
|
|
maxHeight = underSpace;
|
2022-01-28 04:14:21 +01:00
|
|
|
}
|
|
|
|
}
|
2021-02-27 18:22:53 +01:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
if (top < 0) {
|
|
|
|
top = MARGIN;
|
|
|
|
}
|
2021-02-27 18:22:53 +01:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
if (left < 0) {
|
|
|
|
left = 0;
|
|
|
|
}
|
2021-02-27 18:22:53 +01:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
let transformOriginX = "center";
|
|
|
|
let transformOriginY = "center";
|
2022-03-06 15:21:19 +01:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
if (
|
|
|
|
top >=
|
|
|
|
srcRect.top + props.src.offsetHeight + (fixed ? 0 : window.pageYOffset)
|
|
|
|
) {
|
|
|
|
transformOriginY = "top";
|
|
|
|
} else if (top + height <= srcRect.top + (fixed ? 0 : window.pageYOffset)) {
|
|
|
|
transformOriginY = "bottom";
|
2022-03-06 15:21:19 +01:00
|
|
|
}
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
if (
|
|
|
|
left >=
|
|
|
|
srcRect.left + props.src.offsetWidth + (fixed ? 0 : window.pageXOffset)
|
|
|
|
) {
|
|
|
|
transformOriginX = "left";
|
|
|
|
} else if (
|
|
|
|
left + width <=
|
|
|
|
srcRect.left + (fixed ? 0 : window.pageXOffset)
|
|
|
|
) {
|
|
|
|
transformOriginX = "right";
|
2022-01-28 04:14:21 +01:00
|
|
|
}
|
2021-02-27 18:22:53 +01:00
|
|
|
|
2022-07-13 14:17:19 +02:00
|
|
|
transformOrigin = `${transformOriginX} ${transformOriginY}`;
|
2022-03-06 15:21:19 +01:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
content.style.left = left + "px";
|
|
|
|
content.style.top = top + "px";
|
2022-01-28 04:14:21 +01:00
|
|
|
};
|
|
|
|
|
2022-06-11 08:45:44 +02:00
|
|
|
const onOpened = () => {
|
2023-04-08 02:01:42 +02:00
|
|
|
emit("opened");
|
2022-06-11 08:45:44 +02:00
|
|
|
|
2022-01-28 04:14:21 +01:00
|
|
|
// モーダルコンテンツにマウスボタンが押され、コンテンツ外でマウスボタンが離されたときにモーダルバックグラウンドクリックと判定させないためにマウスイベントを監視しフラグ管理する
|
2022-07-13 14:17:19 +02:00
|
|
|
const el = content!.children[0];
|
2023-04-08 02:01:42 +02:00
|
|
|
el.addEventListener(
|
|
|
|
"mousedown",
|
|
|
|
(ev) => {
|
|
|
|
contentClicking = true;
|
|
|
|
window.addEventListener(
|
|
|
|
"mouseup",
|
|
|
|
(ev) => {
|
|
|
|
// click イベントより先に mouseup イベントが発生するかもしれないのでちょっと待つ
|
|
|
|
window.setTimeout(() => {
|
|
|
|
contentClicking = false;
|
|
|
|
}, 100);
|
|
|
|
},
|
|
|
|
{ passive: true, once: true }
|
|
|
|
);
|
|
|
|
},
|
|
|
|
{ passive: true }
|
|
|
|
);
|
2022-01-28 04:14:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
2023-04-08 02:01:42 +02:00
|
|
|
watch(
|
|
|
|
() => props.src,
|
|
|
|
async () => {
|
|
|
|
if (props.src) {
|
|
|
|
// eslint-disable-next-line vue/no-mutating-props
|
|
|
|
props.src.style.pointerEvents = "none";
|
|
|
|
}
|
|
|
|
fixed = type === "drawer" || getFixedContainer(props.src) != null;
|
2022-01-28 04:14:21 +01:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
await nextTick();
|
2022-01-28 04:14:21 +01:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
align();
|
|
|
|
},
|
|
|
|
{ immediate: true }
|
|
|
|
);
|
2022-01-28 04:14:21 +01:00
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
new ResizeObserver((entries, observer) => {
|
|
|
|
align();
|
2022-07-13 14:17:19 +02:00
|
|
|
}).observe(content!);
|
2022-01-28 04:14:21 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
close,
|
2020-10-17 13:12:00 +02:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2023-02-19 00:27:12 +01:00
|
|
|
<style lang="scss" module>
|
|
|
|
.transition_send_enterActive,
|
|
|
|
.transition_send_leaveActive {
|
|
|
|
> .bg {
|
|
|
|
transition: opacity 0.3s !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
|
|
|
transform: translateY(0px);
|
2023-04-08 02:01:42 +02:00
|
|
|
transition: opacity 0.3s ease-in,
|
|
|
|
transform 0.3s cubic-bezier(0.5, -0.5, 1, 0.5) !important;
|
2023-02-19 00:27:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.transition_send_enterFrom,
|
|
|
|
.transition_send_leaveTo {
|
|
|
|
> .bg {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
|
|
|
pointer-events: none;
|
|
|
|
opacity: 0;
|
|
|
|
transform: translateY(-300px);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.transition_modal_enterActive,
|
|
|
|
.transition_modal_leaveActive {
|
2021-03-05 08:59:43 +01:00
|
|
|
> .bg {
|
2021-12-16 18:14:40 +01:00
|
|
|
transition: opacity 0.2s !important;
|
2021-03-05 08:59:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
2021-12-16 18:14:40 +01:00
|
|
|
transform-origin: var(--transformOrigin);
|
|
|
|
transition: opacity 0.2s, transform 0.2s !important;
|
2021-03-05 08:59:43 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2023-02-19 00:27:12 +01:00
|
|
|
.transition_modal_enterFrom,
|
|
|
|
.transition_modal_leaveTo {
|
2021-03-05 08:59:43 +01:00
|
|
|
> .bg {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
|
|
|
pointer-events: none;
|
|
|
|
opacity: 0;
|
2021-12-16 18:14:40 +01:00
|
|
|
transform-origin: var(--transformOrigin);
|
2021-03-05 08:59:43 +01:00
|
|
|
transform: scale(0.9);
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
|
2023-02-19 00:27:12 +01:00
|
|
|
.transition_modal-popup_enterActive,
|
|
|
|
.transition_modal-popup_leaveActive {
|
2021-03-05 08:59:43 +01:00
|
|
|
> .bg {
|
2021-12-16 18:14:40 +01:00
|
|
|
transition: opacity 0.2s !important;
|
2021-03-05 08:59:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
2021-12-16 18:14:40 +01:00
|
|
|
transform-origin: var(--transformOrigin);
|
2023-04-08 02:01:42 +02:00
|
|
|
transition: opacity 0.2s cubic-bezier(0, 0, 0.2, 1),
|
|
|
|
transform 0.2s cubic-bezier(0, 0, 0.2, 1) !important;
|
2021-03-05 08:59:43 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2023-02-19 00:27:12 +01:00
|
|
|
.transition_modal-popup_enterFrom,
|
|
|
|
.transition_modal-popup_leaveTo {
|
2021-03-05 08:59:43 +01:00
|
|
|
> .bg {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
|
|
|
pointer-events: none;
|
|
|
|
opacity: 0;
|
2021-12-16 18:14:40 +01:00
|
|
|
transform-origin: var(--transformOrigin);
|
2021-03-05 08:59:43 +01:00
|
|
|
transform: scale(0.9);
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
|
2023-02-19 00:27:12 +01:00
|
|
|
.transition_modal-drawer_enterActive {
|
2021-12-16 18:14:40 +01:00
|
|
|
> .bg {
|
|
|
|
transition: opacity 0.2s !important;
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2021-12-16 18:14:40 +01:00
|
|
|
> .content {
|
2023-04-08 02:01:42 +02:00
|
|
|
transition: transform 0.2s cubic-bezier(0, 0.5, 0, 1) !important;
|
2021-12-16 18:14:40 +01:00
|
|
|
}
|
|
|
|
}
|
2023-02-19 00:27:12 +01:00
|
|
|
.transition_modal-drawer_leaveActive {
|
2021-12-16 18:14:40 +01:00
|
|
|
> .bg {
|
|
|
|
transition: opacity 0.2s !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
2023-04-08 02:01:42 +02:00
|
|
|
transition: transform 0.2s cubic-bezier(0, 0.5, 0, 1) !important;
|
2021-12-16 18:14:40 +01:00
|
|
|
}
|
|
|
|
}
|
2023-02-19 00:27:12 +01:00
|
|
|
.transition_modal-drawer_enterFrom,
|
|
|
|
.transition_modal-drawer_leaveTo {
|
2021-12-16 18:14:40 +01:00
|
|
|
> .bg {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
|
|
|
pointer-events: none;
|
|
|
|
transform: translateY(100%);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-19 00:27:12 +01:00
|
|
|
.root {
|
2021-12-16 18:14:40 +01:00
|
|
|
&.dialog {
|
|
|
|
> .content {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
2020-10-17 13:12:00 +02:00
|
|
|
margin: auto;
|
2021-12-16 18:14:40 +01:00
|
|
|
padding: 32px;
|
|
|
|
// TODO: mask-imageはiOSだとやたら重い。なんとかしたい
|
2023-04-08 02:01:42 +02:00
|
|
|
-webkit-mask-image: linear-gradient(
|
|
|
|
0deg,
|
|
|
|
rgba(0, 0, 0, 0) 0%,
|
|
|
|
rgba(0, 0, 0, 1) 32px,
|
|
|
|
rgba(0, 0, 0, 1) calc(100% - 32px),
|
|
|
|
rgba(0, 0, 0, 0) 100%
|
|
|
|
);
|
|
|
|
mask-image: linear-gradient(
|
|
|
|
0deg,
|
|
|
|
rgba(0, 0, 0, 0) 0%,
|
|
|
|
rgba(0, 0, 0, 1) 32px,
|
|
|
|
rgba(0, 0, 0, 1) calc(100% - 32px),
|
|
|
|
rgba(0, 0, 0, 0) 100%
|
|
|
|
);
|
2021-12-16 18:14:40 +01:00
|
|
|
overflow: auto;
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
padding: 16px;
|
2023-04-08 02:01:42 +02:00
|
|
|
-webkit-mask-image: linear-gradient(
|
|
|
|
0deg,
|
|
|
|
rgba(0, 0, 0, 0) 0%,
|
|
|
|
rgba(0, 0, 0, 1) 16px,
|
|
|
|
rgba(0, 0, 0, 1) calc(100% - 16px),
|
|
|
|
rgba(0, 0, 0, 0) 100%
|
|
|
|
);
|
|
|
|
mask-image: linear-gradient(
|
|
|
|
0deg,
|
|
|
|
rgba(0, 0, 0, 0) 0%,
|
|
|
|
rgba(0, 0, 0, 1) 16px,
|
|
|
|
rgba(0, 0, 0, 1) calc(100% - 16px),
|
|
|
|
rgba(0, 0, 0, 0) 100%
|
|
|
|
);
|
2021-12-16 18:14:40 +01:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2021-03-05 08:59:43 +01:00
|
|
|
> ::v-deep(*) {
|
2021-12-16 18:14:40 +01:00
|
|
|
margin: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.top {
|
|
|
|
> ::v-deep(*) {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.popup {
|
|
|
|
> .content {
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
&.fixed {
|
|
|
|
position: fixed;
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-16 18:14:40 +01:00
|
|
|
&.drawer {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2022-07-13 14:41:06 +02:00
|
|
|
overflow: clip;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2021-12-16 18:14:40 +01:00
|
|
|
> .content {
|
2020-10-17 13:12:00 +02:00
|
|
|
position: fixed;
|
2021-12-16 18:14:40 +01:00
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
margin: auto;
|
|
|
|
|
|
|
|
> ::v-deep(*) {
|
|
|
|
margin: auto;
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
}
|
2023-02-19 00:27:12 +01:00
|
|
|
}
|
2021-12-16 18:14:40 +01:00
|
|
|
|
2023-02-19 00:27:12 +01:00
|
|
|
.bg {
|
|
|
|
&.bgTransparent {
|
|
|
|
background: transparent;
|
|
|
|
-webkit-backdrop-filter: none;
|
|
|
|
backdrop-filter: none;
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
</style>
|