All files / src/components/u-panel.vue index.vue

65% Statements 13/20
8.33% Branches 2/24
25% Functions 1/4
68.42% Lines 13/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110      7x   7x     7x                                                                                                                                             7x 7x                                                          
<template>
<div :class="$style.root" :shadow="shadow" :bordered="bordered">
    <div :class="$style.head" :flex="!title && !$slots.title">
        <slot name="head">
            <div :class="$style.title" vusion-slot-name="title" vusion-slot-name-edit="title">
                <slot name="title">
                    {{ title }}
                    <s-empty
                        v-if="!$slots.title
                            && !title
                            && $env.VUE_APP_DESIGNER
                            && !!$attrs['vusion-node-path']">
                    </s-empty>
                </slot>
            </div>
            <a :class="$style.close" @click="cancel()"></a>
            <div :class="$style.extra" vusion-slot-name="extra">
                <slot name="extra"></slot>
                <s-empty v-if="(!$slots.extra) && $env.VUE_APP_DESIGNER && !!$attrs['vusion-node-path']"></s-empty>
            </div>
        </slot>
    </div>
    <div :class="$style.body" vusion-slot-name="default">
        <slot>{{ content }}</slot>
        <s-empty v-if="(!$slots.default) && $env.VUE_APP_DESIGNER && !!$attrs['vusion-node-path']"></s-empty>
    </div>
    <div :class="$style.foot">
        <slot name="foot">
        </slot>
    </div>
</div>
</template>
 
<script>
import SEmpty from '../s-empty.vue';
export default {
    name: 'u-panel',
    components: {
        SEmpty,
    },
    props: {
        title: { type: String, default: null },
        content: { type: String, default: null },
        bordered: { type: Boolean, default: true },
        shadow: { type: String, default: 'always' },
    },
};
</script>
 
<style module>
.root {
    border-radius: var(--panel-border-radius);
    background: var(--panel-background);
}
 
.root[shadow="always"] {
    box-shadow: var(--panel-box-shadow);
}
 
.root[shadow="hover"]:hover {
    box-shadow: var(--panel-box-shadow-hover);
}
 
.root[shadow="always"],
.root[shadow="hover"] {
    transition: box-shadow var(--transition-duration-base);
}
 
.root[shadow="never"] {
    box-shadow: none;
}
 
.root[bordered] {
    border: var(--panel-border-width) solid var(--border-color-base);
}
 
.head {
    position: relative;
    padding: var(--panel-head-padding-y) var(--panel-head-padding-x) 0 var(--panel-head-padding-x);
}

.title {
    margin: 0;
    font-size: var(--panel-title-font-size);
    font-weight: var(--panel-title-font-weight);
}
 
.extra {
    position: absolute;
    top: var(--panel-head-padding-y);
    right: var(--panel-head-padding-x);
}
 
.body {
    clear: both;
    padding: var(--panel-body-padding-y) var(--panel-body-padding-x);
}
.title [s-empty] {
    max-width: 150px;
}
 
.head[flex] {
    display: flex;
    justify-content: space-between;
}
.head[flex] .extra {
    position: initial;
}
</style>