2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2023-05-14 02:43:56 +00:00
|
|
|
<div class="cpjygsrt">
|
2020-01-29 19:37:25 +00:00
|
|
|
<header>
|
|
|
|
<div class="title"><slot name="header"></slot></div>
|
|
|
|
<div class="buttons">
|
|
|
|
<slot name="func"></slot>
|
2021-11-19 10:36:12 +00:00
|
|
|
<button v-if="removable" class="_button" @click="remove()">
|
2022-12-19 10:01:30 +00:00
|
|
|
<i class="ti ti-trash"></i>
|
2020-01-29 19:37:25 +00:00
|
|
|
</button>
|
|
|
|
<button v-if="draggable" class="drag-handle _button">
|
2022-12-19 10:01:30 +00:00
|
|
|
<i class="ti ti-menu-2"></i>
|
2020-01-29 19:37:25 +00:00
|
|
|
</button>
|
2021-11-19 10:36:12 +00:00
|
|
|
<button class="_button" @click="toggleContent(!showBody)">
|
2022-12-19 10:01:30 +00:00
|
|
|
<template v-if="showBody"><i class="ti ti-chevron-up"></i></template>
|
|
|
|
<template v-else><i class="ti ti-chevron-down"></i></template>
|
2020-01-29 19:37:25 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</header>
|
2020-04-16 14:13:33 +00:00
|
|
|
<div v-show="showBody" class="body">
|
2020-01-29 19:37:25 +00:00
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-05-14 02:43:56 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref } from 'vue';
|
2023-04-01 05:01:57 +00:00
|
|
|
import { i18n } from '@/i18n';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2023-05-14 02:43:56 +00:00
|
|
|
const props = withDefaults(defineProps<{
|
|
|
|
expanded?: boolean;
|
|
|
|
removable?: boolean;
|
|
|
|
draggable?: boolean;
|
|
|
|
}>(), {
|
|
|
|
expanded: true,
|
|
|
|
removable: true,
|
2020-01-29 19:37:25 +00:00
|
|
|
});
|
2023-05-14 02:43:56 +00:00
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'toggle', show: boolean): void;
|
|
|
|
(ev: 'remove'): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const showBody = ref(props.expanded);
|
|
|
|
|
|
|
|
function toggleContent(show: boolean) {
|
|
|
|
showBody.value = show;
|
|
|
|
emit('toggle', show);
|
|
|
|
}
|
|
|
|
|
|
|
|
function remove() {
|
|
|
|
emit('remove');
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 09:29:39 +00:00
|
|
|
<style lang="scss" scoped>
|
2020-01-29 19:37:25 +00:00
|
|
|
.cpjygsrt {
|
|
|
|
position: relative;
|
2021-03-02 13:57:16 +00:00
|
|
|
overflow: hidden;
|
2020-01-29 19:37:25 +00:00
|
|
|
background: var(--panel);
|
2020-07-04 18:49:58 +00:00
|
|
|
border: solid 2px var(--X12);
|
2022-12-24 02:57:06 +00:00
|
|
|
border-radius: 8px;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
|
|
|
&:hover {
|
2020-07-04 18:49:58 +00:00
|
|
|
border: solid 2px var(--X13);
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&.warn {
|
|
|
|
border: solid 2px #dec44c;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.error {
|
|
|
|
border: solid 2px #f00;
|
|
|
|
}
|
|
|
|
|
|
|
|
> header {
|
|
|
|
> .title {
|
|
|
|
z-index: 1;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0 16px;
|
|
|
|
line-height: 42px;
|
|
|
|
font-size: 0.9em;
|
|
|
|
font-weight: bold;
|
|
|
|
box-shadow: 0 1px rgba(#000, 0.07);
|
|
|
|
|
2021-04-20 14:22:59 +00:00
|
|
|
> i {
|
2020-01-29 19:37:25 +00:00
|
|
|
margin-right: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:empty {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .buttons {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 2;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 0;
|
|
|
|
width: 42px;
|
|
|
|
font-size: 0.9em;
|
|
|
|
line-height: 42px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.drag-handle {
|
|
|
|
cursor: move;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-16 14:13:33 +00:00
|
|
|
> .body {
|
2020-10-17 11:12:00 +00:00
|
|
|
::v-deep(.juejbjww), ::v-deep(.eiipwacr) {
|
2020-04-16 14:13:33 +00:00
|
|
|
&:not(.inline):first-child {
|
|
|
|
margin-top: 28px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(.inline):last-child {
|
|
|
|
margin-bottom: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
</style>
|