<template>
  <el-dialog
    v-bind="$attrs"
    :class="{'rcs_dialog': true, 'padding_empty': $attrs.paddingempty, 'hidden_title': $attrs.hiddentitle}"
  >
    <template
      v-for="(_, name) in $slots"
      #[name]
    >
      <slot :name="name" />
    </template>
    <template #title>
      <div class="title">
        <div class="context">{{ $attrs.title }}</div>
        <div class="right">
          <slot name="title-right" />
        </div>
      </div>
    </template>
  </el-dialog>
</template>
<script>
export default {
  name: 'RCSDialog',
  data() {
    return {};
  },
  mounted() {

  },
  methods: {

  },
};
</script>
<style lang="scss" scoped>
.rcs_dialog {
  // el-dialog
  ::v-deep .el-dialog {
    background-color: var(--bg-color-main-2);
  }
  ::v-deep .el-dialog__header {
    padding: 0;
  }
  ::v-deep .el-dialog__headerbtn {
    right: 16px;
  }
  ::v-deep .el-dialog__footer {
    border-top: 1px solid var(--application-color-8);
    padding: 10px 16px;
    min-height: 48px;
  }
  ::v-deep .el-dialog__body {
    // TODO 滚动栏宽度有 10 px。开启 overflow: scroll 之后 增加 UI 兼容处理 padding-right - 10px
    padding: 12px 2px 12px 12px !important;
    max-height: 522px;
    overflow: scroll;
  }
}

.padding_empty {
  ::v-deep .el-dialog__body {
    padding: 0 !important;
    scrollbar-width: none; /* 隐藏滚动条 */
  }
  ::v-deep .el-dialog__body::-webkit-scrollbar {
    display: none; // 隐藏滚动条
    width: 0; // 置滚动条的宽度为 0 来隐藏
  }
}
.hidden_title {
  ::v-deep .el-dialog__header {
    height: 0px !important;
    .title {
      display: none;
    }
  }
}

// el-button
::v-deep .el-button {
    width: 51px;
    height: 24px;
    font-size: 12px;
    padding: 0;
}

.title {
  padding: 8px 16px 8px 16px;

  min-height: 40px;
  display: flex;
  align-items: center;
  flex-direction: row;

  border-bottom: 1px solid var(--application-color-8);
  .context {
    font-size: 14px;
    line-height: 22px;
    color: var(--application-color-2);
    flex: 1;
    text-align: left;
  }
  .right {
    flex: 1;
    margin-right: 20px;
  }
}
</style>
