2020-01-29 13:37:25 -06: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>
|
|
|
|
<button v-if="removable" @click="remove()" class="_button">
|
2021-04-20 09:22:59 -05:00
|
|
|
<i class="fas fa-trash-alt"></i>
|
2020-01-29 13:37:25 -06:00
|
|
|
</button>
|
|
|
|
<button v-if="draggable" class="drag-handle _button">
|
2021-04-20 09:22:59 -05:00
|
|
|
<i class="fas fa-bars"></i>
|
2020-01-29 13:37:25 -06:00
|
|
|
</button>
|
|
|
|
<button @click="toggleContent(!showBody)" class="_button">
|
2021-04-20 09:22:59 -05: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 13:37:25 -06:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
<p v-show="showBody" class="error" v-if="error != null">{{ $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" class="warn" v-if="warn != null">{{ $t('_pages.script.thereIsEmptySlot', { slot: warn.slot + 1 }) }}</p>
|
2020-04-16 09:13:33 -05:00
|
|
|
<div v-show="showBody" class="body">
|
2020-01-29 13:37:25 -06:00
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 06:12:00 -05:00
|
|
|
import { defineComponent } from 'vue';
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
export default defineComponent({
|
2020-01-29 13:37:25 -06: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-04 21:50:09 -06:00
|
|
|
emits: ['toggle', 'remove'],
|
2020-01-29 13:37:25 -06: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 07:57:16 -06:00
|
|
|
overflow: hidden;
|
2020-01-29 13:37:25 -06:00
|
|
|
background: var(--panel);
|
2020-07-04 13:49:58 -05:00
|
|
|
border: solid 2px var(--X12);
|
2020-01-29 13:37:25 -06:00
|
|
|
border-radius: 6px;
|
|
|
|
|
|
|
|
&:hover {
|
2020-07-04 13:49:58 -05:00
|
|
|
border: solid 2px var(--X13);
|
2020-01-29 13:37:25 -06: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 09:22:59 -05:00
|
|
|
> i {
|
2020-01-29 13:37:25 -06: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 09:13:33 -05:00
|
|
|
|
|
|
|
> .body {
|
2020-10-17 06:12:00 -05:00
|
|
|
::v-deep(.juejbjww), ::v-deep(.eiipwacr) {
|
2020-04-16 09:13:33 -05:00
|
|
|
&:not(.inline):first-child {
|
|
|
|
margin-top: 28px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(.inline):last-child {
|
|
|
|
margin-bottom: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 13:37:25 -06:00
|
|
|
}
|
|
|
|
</style>
|