<template>
  <a-drawer placement="right" :closable="false" :visible="visible" :destroyOnClose="true" class="bottomListed" height="405px">
    <!-- 摘牌是top  挂牌是bottom 期货交易是tradeDialog -->
    <div class="collapse" @click="cancel">
      <DoubleRightOutlined />
    </div>
    <div class="collapseCont">
      <div class="title">{{ title }}</div>
      <div class="content highContent">
        <slot></slot>
      </div>
    </div>
  </a-drawer>
</template>

<script lang="ts">
import { defineComponent, ref, PropType } from 'vue';
import { closeModal, ModalName } from '@/common/setup/modal/index';
import { _closeModal } from '@/common/setup/modal/modal';
import { DoubleRightOutlined } from '@ant-design/icons-vue';

export default defineComponent({
  name: 'drawer',
  emits: ['cancel', 'update'],
  props: {
    modalName: {
      default: 'drawer',
      type: String as PropType<keyof ModalName>,
    },
    title: {
      default: '',
      type: String,
    },
    placement: {
      // 需要绑定的值得 key
      default: 'right',
      type: String,
    },
    visible: {
      default: false,
      type: Boolean,
    },
  },
  components: {
    DoubleRightOutlined,
  },
  setup(props, context) {
    function cancel() {
      context.emit('cancel');
    }
    return {
      cancel,
    };
  },
});
</script>

<style lang="less">
@import './index.less';
.gpDetail {
    width: 400px;
    height: 450px;
    .position(fixed, auto, 486px, 0, auto);
    z-index: 10000;
    font-size: 16px;
    .title {
        width: 100%;
        height: 38px;
        line-height: 38px;
        background: @m-blue36;
        text-align: center;
        color: @m-grey67;
        .rounded-corners(5px);
    }
    .content {
        padding: 0 30px 0 20px;
        width: 100%;
        height: 412px;
        overflow-y: auto;
        background: @m-blue37;
        .flex;
        flex-direction: column;
        .item {
            display: inline-flex;
            height: 40px;
            line-height: 40px;
            .left {
                width: 80px;
                color: @m-grey2;
            }
            .right {
                width: calc(100% - 85px);
                flex: 1;
                padding-left: 5px;
                color: @m-white6;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                .grey {
                    color: @m-grey68;
                    margin-left: 5px;
                }
            }
        }
        .someItems {
            line-height: 24px;
            box-shadow: 0px 10px 10px 0px @m-black18;
            background: @m-blue38;
            .rounded-corners(5px);
            padding: 10px 15px;
            font-size: 14px;
            color: @m-blue39;
        }
    }
}
.bottom {
    .position(fixed, auto, 0, -2px, auto);
    width: 100%;
    height: 100%;
    z-index: 10;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 586px !important;
        height: 450px;
        bottom: 0;
        right: 0;
    }
}
.bottom486 {
    .position(fixed, auto, 0, -2px, auto);
    width: 100%;
    height: 100%;
    z-index: 10;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 486px !important;
        height: 450px;
        bottom: 0;
        right: 0;
        .ant-drawer-body {
            .collapseCont {
                .highContent {
                    max-width: 486px;
                }
            }
        }
    }
}
.delistingBottom {
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 586px !important;
        height: 450px;
        bottom: 0;
        right: 0;
    }
}
.ant-drawer.ant-drawer-bottom.ant-drawer-open.bottomListed {
    .position(fixed, auto, 0, 0, auto);
    width: 100%;
    height: 100%;
    z-index: 10;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 566px !important;
        height: 405px;
        bottom: 0;
        right: 0;
    }
}
.bottomListed.delistingBottom {
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 486px !important;
        height: 450px;
        bottom: 0;
        right: 0;
    }
}
.delistingBottom650 {
    .position(fixed, auto, 0, -2px, auto);
    width: 100%;
    height: 100%;
    z-index: 10;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 740px !important;
        height: 450px;
        bottom: 0;
        right: 0;
    }
}
.top {
    .position(fixed, 0, 0, auto, auto);
    width: 100%;
    height: 100%;
    z-index: 10;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: min-content !important;
        height: 450px;
        right: 0;
        top: 101px;
    }
}
.top486 {
    .position(fixed, 0, 0, auto, auto);
    width: 100%;
    height: 100%;
    z-index: 11;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 486px !important;
        height: 450px;
        right: 0;
        top: 101px;
    }
}
.top600 {
    .position(fixed, 0, 0, auto, auto);
    width: 100%;
    height: 100%;
    z-index: 11;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 600px !important;
        height: 450px;
        right: 0;
        top: 101px;
    }
}
.top500 {
    .position(fixed, 0, 0, auto, auto);
    width: 100%;
    height: 100%;
    z-index: 10;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 500px !important;
        height: 450px;
        right: 0;
        top: 101px;
    }
}
.topHigh {
    .position(fixed, 0, 0, auto, auto);
    width: 100%;
    height: 100%;
    z-index: 10;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 580px !important;
        height: 450px;
        right: 0;
        top: 101px;
    }
}
.bottomWidth {
    .position(fixed, auto, 0, 0, auto);
    width: 100%;
    height: 100%;
    z-index: 10;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 765px !important;
        height: 396px;
        right: 0;
        bottom: 0;
    }
}
.tradeDialog {
    .position(fixed, 0, 0, auto, auto);
    width: 100%;
    height: 100%;
    z-index: 10;
    .ant-drawer-mask {
        height: 100%;
        background: @m-black46 !important;
    }
    .ant-drawer-content-wrapper {
        width: 467px !important;
        height: 310px;
        right: 0;
        top: 116px;
    }
}
.collapse {
    width: 52px;
    height: 38px;
    cursor: pointer;
    .position(absolute, 0, auto, auto, 0);
    z-index: 11;
    text-align: center;
    line-height: 38px;
    .anticon {
        color: @m-blue25;
        font-weight: bold;
    }
}
.ant-drawer.ant-drawer-open {
    .ant-drawer-mask {
        background: @m-black46;
    }
    .ant-drawer-content-wrapper {
        box-shadow: none;
        .ant-drawer-content {
            background: transparent;
            .ant-drawer-wrapper-body {
                overflow: hidden;
                .ant-drawer-body {
                    width: 100%;
                    height: 100%;
                    padding: 0;
                    .inlineflex;

                    .collapseCont {
                        flex: 1;
                        height: 100%;
                        // border: 8px solid @m-blue5;
                        // border-right: 0;
                        .flex;
                        flex-direction: column;
                        .title {
                            width: 100%;
                            height: 38px;
                            line-height: 38px;
                            text-align: center;
                            background: linear-gradient(0deg, @m-blue4, @m-blue5);
                            font-size: 16px;
                            color: @m-white10;
                            // border-bottom: 2px solid @m-blue0;
                            .rounded-corners(5px, 5px, 0, 0);
                        }
                        .content {
                            flex: 1;
                            width: 100%;
                            max-height: calc(100% - 36px);
                            overflow-y: auto;
                            overflow-x: hidden;
                            background: @m-grey11;
                            border: 8px solid @m-blue21;
                            border-top: 0;
                        }
                        .highContent {
                            max-height: 100%;
                        }
                    }
                }
            }
        }
    }
}
.ant-form.inlineForm .ant-row.ant-form-item .ant-form-item-label label {
    width: 90px;
}
</style>
