2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
|
|
|
<div class="cpjygsrt" :class="{ error: error != null, warn: warn != null }">
|
|
|
|
<header>
|
|
|
|
<div class="title"><slot name="header"></slot></div>
|
|
|
|
<div class="buttons">
|
|
|
|
<slot name="func"></slot>
|
2021-11-19 11:36:12 +01:00
|
|
|
<button v-if="removable" class="_button" @click="remove()">
|
2021-04-20 16:22:59 +02:00
|
|
|
<i class="fas fa-trash-alt"></i>
|
2020-01-29 20:37:25 +01:00
|
|
|
</button>
|
|
|
|
<button v-if="draggable" class="drag-handle _button">
|
2021-04-20 16:22:59 +02:00
|
|
|
<i class="fas fa-bars"></i>
|
2020-01-29 20:37:25 +01:00
|
|
|
</button>
|
2021-11-19 11:36:12 +01:00
|
|
|
<button class="_button" @click="toggleContent(!showBody)">
|
2021-04-20 16:22:59 +02:00
|
|
|
<template v-if="showBody"><i class="fas fa-angle-up"></i></template>
|
|
|
|
<template v-else><i class="fas fa-angle-down"></i></template>
|
2020-01-29 20:37:25 +01:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</header>
|
2021-11-19 11:36:12 +01:00
|
|
|
<p v-show="showBody" v-if="error != null" class="error">{{ $t('_pages.script.typeError', { slot: error.arg + 1, expect: $t(`script.types.${error.expect}`), actual: $t(`script.types.${error.actual}`) }) }}</p>
|
|
|
|
<p v-show="showBody" v-if="warn != null" class="warn">{{ $t('_pages.script.thereIsEmptySlot', { slot: warn.slot + 1 }) }}</p>
|
2020-04-16 16:13:33 +02:00
|
|
|
<div v-show="showBody" class="body">
|
2020-01-29 20:37:25 +01:00
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 13:12:00 +02:00
|
|
|
import { defineComponent } from 'vue';
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
export default defineComponent({
|
2020-01-29 20:37:25 +01:00
|
|
|
props: {
|
|
|
|
expanded: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
removable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
draggable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
error: {
|
|
|
|
required: false,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
warn: {
|
|
|
|
required: false,
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
2020-12-05 04:50:09 +01:00
|
|
|
emits: ['toggle', 'remove'],
|
2020-01-29 20:37:25 +01:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showBody: this.expanded,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleContent(show: boolean) {
|
|
|
|
this.showBody = show;
|
|
|
|
this.$emit('toggle', show);
|
|
|
|
},
|
|
|
|
remove() {
|
|
|
|
this.$emit('remove');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.cpjygsrt {
|
|
|
|
position: relative;
|
2021-03-02 14:57:16 +01:00
|
|
|
overflow: hidden;
|
2020-01-29 20:37:25 +01:00
|
|
|
background: var(--panel);
|
2020-07-04 20:49:58 +02:00
|
|
|
border: solid 2px var(--X12);
|
2020-01-29 20:37:25 +01:00
|
|
|
border-radius: 6px;
|
|
|
|
|
|
|
|
&:hover {
|
2020-07-04 20:49:58 +02:00
|
|
|
border: solid 2px var(--X13);
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
&.warn {
|
|
|
|
border: solid 2px #dec44c;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.error {
|
|
|
|
border: solid 2px #f00;
|
|
|
|
}
|
|
|
|
|
|
|
|
& + .cpjygsrt {
|
|
|
|
margin-top: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> 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 16:22:59 +02:00
|
|
|
> i {
|
2020-01-29 20:37:25 +01: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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .warn {
|
|
|
|
color: #b19e49;
|
|
|
|
margin: 0;
|
|
|
|
padding: 16px 16px 0 16px;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .error {
|
|
|
|
color: #f00;
|
|
|
|
margin: 0;
|
|
|
|
padding: 16px 16px 0 16px;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
2020-04-16 16:13:33 +02:00
|
|
|
|
|
|
|
> .body {
|
2020-10-17 13:12:00 +02:00
|
|
|
::v-deep(.juejbjww), ::v-deep(.eiipwacr) {
|
2020-04-16 16:13:33 +02:00
|
|
|
&:not(.inline):first-child {
|
|
|
|
margin-top: 28px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(.inline):last-child {
|
|
|
|
margin-bottom: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
</style>
|