@import "./../themes";

@mixin generate-tree-table($themes: $themes) {
  @each $theme, $map in $themes {
    $table: map-get($map, table);
    :host-context(.#{$theme}-theme) .tree-table{

      .col-header {
        padding-left: 7px;
        padding-top: 11px;
        padding-bottom: 13px;
      }

      ::ng-deep .ui-paginator-bottom.ui-paginator.ui-widget.ui-widget-header {
        border: none;
        margin-top: 15px;
        margin-bottom: 15px;
      }

      ::ng-deep table {

        // override ng-prime
        .ui-treetable .ui-treetable-thead > tr > th.ui-state-default.ui-unselectable-text {
          background-color: map-get($table, header-bg) !important;
          color: map-get($table, header-color) !important;
        }

        // override ng-prime
        th.ui-state-default.ui-unselectable-text {
          border-color: map-get($table, border-color) !important;
          text-align: left !important;
          font-size: 12px !important;

          &:first-of-type {
            border-top-left-radius: map-get($table, border-radius) !important;
          }
          &:last-of-type {
            border-top-right-radius: map-get($table, border-radius) !important;
          }
        }

        // override ng-prime
        tr.ui-treetable-even.ui-widget-content {
          background-color: map-get($table, even-bg) !important;
        }

        // override ng-prime
        tr.ui-treetable-odd.ui-widget-content {
          background-color: map-get($table, bg) !important;
        }

        // override ng-prime
        td {
          border-color: transparent !important;
          vertical-align: middle;
          div {
            width: 99%;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
          }
        }

        // override ng-prime
        td.ui-treetable-emptymessage {
          background-color: map-get($table, bg) !important;
        }

        tbody.ui-treetable-hoverable-rows > tr.ui-widget-content:not(.ui-state-highlight) {
          &:hover {
            background-color: map-get($table, hover-bg) !important;
          }
        }

        tbody .ui-state-highlight {
          background-color: map-get($table, active-bg) !important;
        }

        tr.ui-widget-content {
          color: map-get($table, row-color) !important;
        }

        .ui-treetable tbody.ui-treetable-hoverable-rows > tr.ui-widget-content:not(.ui-state-highlight){
          &:hover {
            color: map-get($table, hover-color) !important;
            background-color: map-get($table, hover-bg) !important;
          }
        }

        // override ng-prime
        .ui-paginator-bottom.ui-paginator.ui-widget.ui-widget-header.ui-unselectable-text.ui-helper-clearfix {
          background-color: transparent !important;
        }
      }

    }

  }
}
