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