2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2021-11-19 19:36:12 +09:00
|
|
|
<div v-size="{ max: [380] }" class="ukygtjoj _panel" :class="{ naked, thin, hideHeader: !showHeader, scrollable, closed: !showBody }">
|
2020-08-13 17:58:16 +09:00
|
|
|
<header v-if="showHeader" ref="header">
|
2020-01-30 04:37:25 +09:00
|
|
|
<div class="title"><slot name="header"></slot></div>
|
2020-08-13 23:02:43 +09:00
|
|
|
<div class="sub">
|
|
|
|
<slot name="func"></slot>
|
2021-11-19 19:36:12 +09:00
|
|
|
<button v-if="foldable" class="_button" @click="() => showBody = !showBody">
|
2022-11-07 11:49:47 +09:00
|
|
|
<template v-if="showBody"><i class="ph-caret-up-bold ph-lg"></i></template>
|
|
|
|
<template v-else><i class="ph-caret-down-bold ph-lg"></i></template>
|
2020-08-13 23:02:43 +09:00
|
|
|
</button>
|
|
|
|
</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</header>
|
2022-07-03 16:17:31 +09:00
|
|
|
<transition
|
|
|
|
:name="$store.state.animation ? 'container-toggle' : ''"
|
2020-02-08 14:31:51 +09:00
|
|
|
@enter="enter"
|
|
|
|
@after-enter="afterEnter"
|
|
|
|
@leave="leave"
|
|
|
|
@after-leave="afterLeave"
|
|
|
|
>
|
2021-11-19 19:36:12 +09:00
|
|
|
<div v-show="showBody" ref="content" class="content" :class="{ omitted }">
|
2020-02-08 14:31:51 +09:00
|
|
|
<slot></slot>
|
2021-04-16 09:41:56 +09:00
|
|
|
<button v-if="omitted" class="fade _button" @click="() => { ignoreOmit = true; omitted = false; }">
|
2022-11-11 07:12:44 +09:00
|
|
|
<span>{{ i18n.ts.showMore }}</span>
|
2021-04-16 09:41:56 +09:00
|
|
|
</button>
|
2020-02-08 14:31:51 +09:00
|
|
|
</div>
|
|
|
|
</transition>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 20:12:00 +09:00
|
|
|
import { defineComponent } from 'vue';
|
2022-11-11 07:12:44 +09:00
|
|
|
import { i18n } from '@/i18n';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
export default defineComponent({
|
2020-01-30 04:37:25 +09:00
|
|
|
props: {
|
|
|
|
showHeader: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
2022-07-03 16:17:31 +09:00
|
|
|
default: true,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
2021-10-23 00:04:19 +09:00
|
|
|
thin: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
2022-07-03 16:17:31 +09:00
|
|
|
default: false,
|
2021-10-23 00:04:19 +09:00
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
naked: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
2022-07-03 16:17:31 +09:00
|
|
|
default: false,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
2021-04-16 12:17:22 +09:00
|
|
|
foldable: {
|
2020-01-30 04:37:25 +09:00
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
2022-07-03 16:17:31 +09:00
|
|
|
default: false,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
expanded: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
2022-07-03 16:17:31 +09:00
|
|
|
default: true,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
2020-07-11 10:13:11 +09:00
|
|
|
scrollable: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
2022-07-03 16:17:31 +09:00
|
|
|
default: false,
|
2020-07-11 10:13:11 +09:00
|
|
|
},
|
2021-04-16 09:41:56 +09:00
|
|
|
maxHeight: {
|
|
|
|
type: Number,
|
|
|
|
required: false,
|
2022-07-03 16:17:31 +09:00
|
|
|
default: null,
|
2021-04-16 09:41:56 +09:00
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showBody: this.expanded,
|
2021-04-16 09:41:56 +09:00
|
|
|
omitted: null,
|
|
|
|
ignoreOmit: false,
|
2022-11-11 17:41:34 +09:00
|
|
|
i18n,
|
2020-01-30 04:37:25 +09:00
|
|
|
};
|
|
|
|
},
|
2020-08-13 17:58:16 +09:00
|
|
|
mounted() {
|
|
|
|
this.$watch('showBody', showBody => {
|
2020-10-17 20:12:00 +09:00
|
|
|
const headerHeight = this.showHeader ? this.$refs.header.offsetHeight : 0;
|
|
|
|
this.$el.style.minHeight = `${headerHeight}px`;
|
2020-08-13 17:58:16 +09:00
|
|
|
if (showBody) {
|
2022-07-03 16:17:31 +09:00
|
|
|
this.$el.style.flexBasis = 'auto';
|
2020-08-13 17:58:16 +09:00
|
|
|
} else {
|
2020-10-17 20:12:00 +09:00
|
|
|
this.$el.style.flexBasis = `${headerHeight}px`;
|
2020-08-13 17:58:16 +09:00
|
|
|
}
|
|
|
|
}, {
|
2022-07-03 16:17:31 +09:00
|
|
|
immediate: true,
|
2020-08-13 17:58:16 +09:00
|
|
|
});
|
2021-04-16 09:41:56 +09:00
|
|
|
|
|
|
|
this.$el.style.setProperty('--maxHeight', this.maxHeight + 'px');
|
|
|
|
|
|
|
|
const calcOmit = () => {
|
|
|
|
if (this.omitted || this.ignoreOmit || this.maxHeight == null) return;
|
|
|
|
const height = this.$refs.content.offsetHeight;
|
|
|
|
this.omitted = height > this.maxHeight;
|
|
|
|
};
|
|
|
|
|
|
|
|
calcOmit();
|
|
|
|
new ResizeObserver((entries, observer) => {
|
|
|
|
calcOmit();
|
|
|
|
}).observe(this.$refs.content);
|
2020-08-13 17:58:16 +09:00
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
methods: {
|
|
|
|
toggleContent(show: boolean) {
|
2021-04-16 12:17:22 +09:00
|
|
|
if (!this.foldable) return;
|
2020-01-30 04:37:25 +09:00
|
|
|
this.showBody = show;
|
2020-02-08 14:31:51 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
enter(el) {
|
2020-02-08 18:02:28 +09:00
|
|
|
const elementHeight = el.getBoundingClientRect().height;
|
|
|
|
el.style.height = 0;
|
|
|
|
el.offsetHeight; // reflow
|
|
|
|
el.style.height = elementHeight + 'px';
|
2020-02-08 14:31:51 +09:00
|
|
|
},
|
|
|
|
afterEnter(el) {
|
2020-02-08 18:02:28 +09:00
|
|
|
el.style.height = null;
|
2020-02-08 14:31:51 +09:00
|
|
|
},
|
|
|
|
leave(el) {
|
2020-02-08 18:02:28 +09:00
|
|
|
const elementHeight = el.getBoundingClientRect().height;
|
|
|
|
el.style.height = elementHeight + 'px';
|
|
|
|
el.offsetHeight; // reflow
|
|
|
|
el.style.height = 0;
|
2020-02-08 14:31:51 +09:00
|
|
|
},
|
|
|
|
afterLeave(el) {
|
2020-02-08 18:02:28 +09:00
|
|
|
el.style.height = null;
|
2020-02-08 14:31:51 +09:00
|
|
|
},
|
2022-07-03 16:17:31 +09:00
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-02-08 14:31:51 +09:00
|
|
|
.container-toggle-enter-active, .container-toggle-leave-active {
|
2020-02-08 18:02:28 +09:00
|
|
|
overflow-y: hidden;
|
2020-02-08 14:31:51 +09:00
|
|
|
transition: opacity 0.5s, height 0.5s !important;
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
.container-toggle-enter-from {
|
2020-02-08 14:31:51 +09:00
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
.container-toggle-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
.ukygtjoj {
|
|
|
|
position: relative;
|
2022-07-13 21:41:06 +09:00
|
|
|
overflow: clip;
|
2022-07-05 22:35:57 +09:00
|
|
|
contain: content;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
&.naked {
|
|
|
|
background: transparent !important;
|
|
|
|
box-shadow: none !important;
|
|
|
|
}
|
|
|
|
|
2020-07-11 10:13:11 +09:00
|
|
|
&.scrollable {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
2021-04-16 09:41:56 +09:00
|
|
|
> .content {
|
2020-07-11 10:13:11 +09:00
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
> header {
|
2021-04-12 13:20:04 +09:00
|
|
|
position: sticky;
|
|
|
|
top: var(--stickyTop, 0px);
|
|
|
|
left: 0;
|
2021-01-03 23:49:49 +09:00
|
|
|
color: var(--panelHeaderFg);
|
|
|
|
background: var(--panelHeaderBg);
|
2021-04-10 12:40:50 +09:00
|
|
|
border-bottom: solid 0.5px var(--panelHeaderDivider);
|
2020-07-11 10:13:11 +09:00
|
|
|
z-index: 2;
|
2020-08-10 12:42:51 +09:00
|
|
|
line-height: 1.4em;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
> .title {
|
|
|
|
margin: 0;
|
|
|
|
padding: 12px 16px;
|
|
|
|
|
2021-04-20 23:22:59 +09:00
|
|
|
> ::v-deep(i) {
|
2020-01-30 04:37:25 +09:00
|
|
|
margin-right: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:empty {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-13 23:02:43 +09:00
|
|
|
> .sub {
|
2020-01-30 04:37:25 +09:00
|
|
|
position: absolute;
|
|
|
|
z-index: 2;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
height: 100%;
|
2020-08-13 23:02:43 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> ::v-deep(button) {
|
2020-08-13 23:02:43 +09:00
|
|
|
width: 42px;
|
|
|
|
height: 100%;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
}
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2021-04-16 09:41:56 +09:00
|
|
|
> .content {
|
2021-07-19 11:36:35 +09:00
|
|
|
--stickyTop: 0px;
|
|
|
|
|
2021-04-16 09:41:56 +09:00
|
|
|
&.omitted {
|
|
|
|
position: relative;
|
|
|
|
max-height: var(--maxHeight);
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
> .fade {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
2021-04-24 22:38:24 +09:00
|
|
|
z-index: 10;
|
2021-04-16 09:41:56 +09:00
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 64px;
|
|
|
|
background: linear-gradient(0deg, var(--panel), var(--X15));
|
2020-08-09 15:51:02 +09:00
|
|
|
|
2021-04-16 09:41:56 +09:00
|
|
|
> span {
|
|
|
|
display: inline-block;
|
|
|
|
background: var(--panel);
|
|
|
|
padding: 6px 10px;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
> span {
|
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
}
|
2020-08-09 15:51:02 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-23 00:04:19 +09:00
|
|
|
&.max-width_380px, &.thin {
|
2020-07-11 10:13:11 +09:00
|
|
|
> header {
|
|
|
|
> .title {
|
|
|
|
padding: 8px 10px;
|
2021-01-03 23:49:49 +09:00
|
|
|
font-size: 0.9em;
|
2020-07-11 10:13:11 +09:00
|
|
|
}
|
|
|
|
}
|
2020-08-09 15:51:02 +09:00
|
|
|
|
2021-04-16 09:41:56 +09:00
|
|
|
> .content {
|
2020-08-09 15:51:02 +09:00
|
|
|
}
|
2020-07-11 10:13:11 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
._forceContainerFull_ .ukygtjoj {
|
|
|
|
> header {
|
|
|
|
> .title {
|
|
|
|
padding: 12px 16px !important;
|
|
|
|
}
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
2020-07-12 11:34:45 +09:00
|
|
|
|
|
|
|
._forceContainerFull_.ukygtjoj {
|
|
|
|
> header {
|
|
|
|
> .title {
|
|
|
|
padding: 12px 16px !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
</style>
|