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