@import "mixins/mixins";
@import "common/var";
@import "common/transition";
@import "checkbox";

@include b(tree) {
  position: relative;
  cursor: default;
  color: $--tree-font-color;

  @include e(empty-block) {
    position: relative;
    min-height: 60px;
    text-align: center;
    width: 100%;
    height: 100%;
  }

  @include e(empty-text) {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: $--color-text-secondary;
    font-size: $--font-size-base;
  }

  @include e(drop-indicator) {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background-color: $--color-primary;
  }
}

@include b(tree-node) {
  white-space: nowrap;
  outline: none;
  &:focus { /* focus */
    > .el-tree-node__content {
      background-color: $--tree-node-hover-background-color;
    }
  }

  @include when(drop-inner) {
    > .el-tree-node__content .el-tree-node__label {
      background-color: $--color-primary;
      color: #fff;
    }
  }

  @include e(content) {
    display: flex;
    align-items: center;
    min-height: 26px;
    cursor: pointer;

    & > .el-tree-node__expand-icon {
      padding: 6px;
    }
    & > label.el-checkbox {
      margin-right: 8px;
    }
    &:hover {
      background-color: $--tree-node-hover-background-color;
      .el-checkbox__input .el-checkbox__inner {
        border: 1px solid $--color-primary;
      }
    }

    .el-tree.is-dragging & {
      cursor: move;

      & * {
        pointer-events: none;
      }
    }

    .el-tree.is-dragging.is-drop-not-allow & {
      cursor: not-allowed;
    }
  }

  @include e(expand-icon) {
    cursor: pointer;
    color: $--tree-expand-icon-color;
    font-size: 12px;

    transform: rotate(0deg);
    transition: transform 0.3s ease-in-out;

    &.expanded {
      transform: rotate(90deg);
    }

    &.is-leaf {
      color: transparent;
      cursor: default;
    }
  }

  @include e(label) {
    font-size: $--font-size-base;
  }

  @include e(loading-icon) {
    margin-right: 8px;
    font-size: $--font-size-base;
    color: $--tree-expand-icon-color;
  }

  & > .el-tree-node__children {
    overflow: hidden;
    background-color: transparent;
  }

  &.is-expanded > .el-tree-node__children {
    display: block;
  }
}
.el-tree-node.newTrees {
  margin-bottom: 16px;
  .el-tree-node__children.treeTable {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    min-height: 52px;
    line-height: 52px;
    border-left: $--table-border;
    border-bottom: $--table-border;
    border-right: $--table-border;
    box-sizing: border-box;
  }
  .el-tree-node__content.treeLast {
    height: 52px;
    border-left: $--table-border;
    border-bottom: $--table-border;
    border-right: $--table-border;
    box-sizing: border-box;
  }
  .el-tree-node__content.treeLast:hover {
    background-color: #ffffff;
  }
  .el-tree-node__content.treeRow {
    width: 100%;
    height: 52px;
    border-left: $--table-border;
    border-bottom: $--table-border;
    border-right: $--table-border;
    box-sizing: border-box;
    background-color: $--background-color-base;
  }
  .el-tree-node__content.tree1 {
    padding-left: 24px;
    width: 100%;
    height: 52px;
    background-color: $--table-header-background-color;
    border: $--table-border;
    box-sizing: border-box;
  }
  .treeTable .treeLast {
    border-left: none;
    border-right: none;
  }
  // table模式下，只需要第一个节点缩进，这里使用css来去除其他节点的样式效果
  .treeTable .el-tree-node:not(:first-child) .treeLast{
    padding-left: 0!important;
  }
}
.el-tree-node.inlineTrees {
    .is-leaf.el-tree-node__expand-icon {
      display: none;
    }
    &:focus > .el-tree-node__content {
      background-color: #ffffff;  
    }
    .el-tree-node__content.tree1:hover {
      background-color: #ffffff;
    }    
    .el-tree-node__children.treeTable {
      display: flex;
      flex-direction: row;
      align-items: center;
      flex-wrap: wrap;
      width: calc(100% - 50px);
      margin-top: 16px;
      margin-left: 45px;
      min-height: 32px;
      line-height: 32px;
      box-sizing: border-box;      
    }
    .el-tree-node__content.treeLast {
      height: 32px;
      box-sizing: border-box;
      margin: 8px 0;
      padding: 0 8px;
      border: 1px solid $--border-color-base;
      border-radius: 2px;
    }
    .el-tree-node__content.treeRow {
      width: 100%;
      height: 32px;
      box-sizing: border-box;
    }
    .el-tree-node__content.tree1 {
      padding-left: 0px !important;
      width: 100%;
      height: 32px;
      margin-top: 16px;
      box-sizing: border-box;
    }
}
.el-tree .el-tree-node.inlineTrees:first-of-type .el-tree-node__content.tree1 {
  margin-top: 0;  
}
.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
  background-color: mix($--color-white, $--color-primary, 92%);
}
