2020-01-29 11:37:25 -08:00
|
|
|
<template>
|
2020-08-08 23:51:02 -07:00
|
|
|
<div class="ukygtjoj _panel" :class="{ naked, hideHeader: !showHeader, scrollable }" v-size="{ max: [380], el: resizeBaseEl }">
|
2020-01-29 11:37:25 -08:00
|
|
|
<header v-if="showHeader">
|
|
|
|
<div class="title"><slot name="header"></slot></div>
|
|
|
|
<slot name="func"></slot>
|
|
|
|
<button class="_button" v-if="bodyTogglable" @click="() => showBody = !showBody">
|
|
|
|
<template v-if="showBody"><fa :icon="faAngleUp"/></template>
|
|
|
|
<template v-else><fa :icon="faAngleDown"/></template>
|
|
|
|
</button>
|
|
|
|
</header>
|
2020-02-07 21:31:51 -08:00
|
|
|
<transition name="container-toggle"
|
|
|
|
@enter="enter"
|
|
|
|
@after-enter="afterEnter"
|
|
|
|
@leave="leave"
|
|
|
|
@after-leave="afterLeave"
|
|
|
|
>
|
|
|
|
<div v-show="showBody">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</transition>
|
2020-01-29 11:37:25 -08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import { faAngleUp, faAngleDown } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: {
|
|
|
|
showHeader: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
naked: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
bodyTogglable: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
expanded: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true
|
|
|
|
},
|
2020-07-10 18:13:11 -07:00
|
|
|
scrollable: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
},
|
2020-08-08 23:51:02 -07:00
|
|
|
resizeBaseEl: {
|
|
|
|
required: false,
|
|
|
|
},
|
2020-01-29 11:37:25 -08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showBody: this.expanded,
|
|
|
|
faAngleUp, faAngleDown
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleContent(show: boolean) {
|
|
|
|
if (!this.bodyTogglable) return;
|
|
|
|
this.showBody = show;
|
2020-02-07 21:31:51 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
enter(el) {
|
2020-02-08 01:02:28 -08:00
|
|
|
const elementHeight = el.getBoundingClientRect().height;
|
|
|
|
el.style.height = 0;
|
|
|
|
el.offsetHeight; // reflow
|
|
|
|
el.style.height = elementHeight + 'px';
|
2020-02-07 21:31:51 -08:00
|
|
|
},
|
|
|
|
afterEnter(el) {
|
2020-02-08 01:02:28 -08:00
|
|
|
el.style.height = null;
|
2020-02-07 21:31:51 -08:00
|
|
|
},
|
|
|
|
leave(el) {
|
2020-02-08 01:02:28 -08:00
|
|
|
const elementHeight = el.getBoundingClientRect().height;
|
|
|
|
el.style.height = elementHeight + 'px';
|
|
|
|
el.offsetHeight; // reflow
|
|
|
|
el.style.height = 0;
|
2020-02-07 21:31:51 -08:00
|
|
|
},
|
|
|
|
afterLeave(el) {
|
2020-02-08 01:02:28 -08:00
|
|
|
el.style.height = null;
|
2020-02-07 21:31:51 -08:00
|
|
|
},
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-02-07 21:31:51 -08:00
|
|
|
.container-toggle-enter-active, .container-toggle-leave-active {
|
2020-02-08 01:02:28 -08:00
|
|
|
overflow-y: hidden;
|
2020-02-07 21:31:51 -08:00
|
|
|
transition: opacity 0.5s, height 0.5s !important;
|
|
|
|
}
|
|
|
|
.container-toggle-enter {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
.container-toggle-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
2020-01-29 11:37:25 -08:00
|
|
|
.ukygtjoj {
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
&.naked {
|
|
|
|
background: transparent !important;
|
|
|
|
box-shadow: none !important;
|
|
|
|
}
|
|
|
|
|
2020-07-10 18:13:11 -07:00
|
|
|
&.scrollable {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
> div {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-29 11:37:25 -08:00
|
|
|
> header {
|
|
|
|
position: relative;
|
2020-07-04 11:11:39 -07:00
|
|
|
box-shadow: 0 1px 0 0 var(--panelHeaderDivider);
|
2020-07-10 18:13:11 -07:00
|
|
|
z-index: 2;
|
2020-07-04 11:11:39 -07:00
|
|
|
background: var(--panelHeaderBg);
|
|
|
|
color: var(--panelHeaderFg);
|
2020-08-09 20:42:51 -07:00
|
|
|
line-height: 1.4em;
|
2020-01-29 11:37:25 -08:00
|
|
|
|
|
|
|
> .title {
|
|
|
|
margin: 0;
|
|
|
|
padding: 12px 16px;
|
|
|
|
|
|
|
|
> [data-icon] {
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:empty {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> button {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 2;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
padding: 0;
|
|
|
|
width: 42px;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
}
|
2020-07-10 18:13:11 -07:00
|
|
|
|
2020-08-08 23:51:02 -07:00
|
|
|
> div {
|
|
|
|
> ::v-deep ._content {
|
|
|
|
padding: 24px;
|
|
|
|
|
|
|
|
& + ._content {
|
|
|
|
border-top: solid 1px var(--divider);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.max-width_380px {
|
2020-07-10 18:13:11 -07:00
|
|
|
> header {
|
|
|
|
> .title {
|
|
|
|
padding: 8px 10px;
|
|
|
|
}
|
|
|
|
}
|
2020-08-08 23:51:02 -07:00
|
|
|
|
|
|
|
> div {
|
|
|
|
> ::v-deep ._content {
|
|
|
|
padding: 16px;
|
|
|
|
}
|
|
|
|
}
|
2020-07-10 18:13:11 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
._forceContainerFull_ .ukygtjoj {
|
|
|
|
> header {
|
|
|
|
> .title {
|
|
|
|
padding: 12px 16px !important;
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
2020-07-11 19:34:45 -07:00
|
|
|
|
|
|
|
._forceContainerFull_.ukygtjoj {
|
|
|
|
> header {
|
|
|
|
> .title {
|
|
|
|
padding: 12px 16px !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
</style>
|