Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

9.7 KB
Raw Blame
//-- copyright
// OpenProject is an open source project management software.
// Copyright (C) the OpenProject GmbH
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License version 3.
//
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
// Copyright (C) 2006-2013 Jean-Philippe Lang
// Copyright (C) 2010-2013 the ChiliProject Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
// See COPYRIGHT and LICENSE files for more details.
//++

@keyframes fade-out
  from
    opacity: 1
  to
    opacity: 0

$input-elements: input, 'input.form--text-field', select, 'select.form--select', '.form--field-affix', 'a.button'

.generic-table--flex-container
  display: flex
  flex-direction: column
  flex: 1

.generic-table--container
  position:     relative
  height:       initial
  width:        100%
  overflow:
    x: hidden
    y: hidden

  &.-with-footer
    padding-bottom: var(--generic-table--footer-height)

  &_visible-overflow
    overflow: visible

  &_height-100
    height: 100%

.generic-table--results-container
  height:       100%
  overflow:
    x: auto
    y: auto
  @include styled-scroll-bar

.generic-table--action-buttons
  margin-top: 2rem

#generic-table
  tr.issue
    &.ng-enter, &.ng-move
      transition: 0.5s linear all
      opacity: 0
    &.ng-enter.ng-enter-active, &.ng-move.ng-move-active
      opacity: 1
    &.ng-leave
      @include animation(0.5s fade-out)

table.generic-table
  border-collapse: collapse
  width:  100%
  margin: 0
  font-size: 0.875rem

  col
    &:hover,
    &.hover
      background:   var(--bgColor-muted)

  thead
    height: var(--generic-table--header-height)

    tr
      &:hover
        background: none
    th
      font-size: var(--generic-table--header-font-size)
      font-weight: var(--base-text-weight-bold)
      text-transform: uppercase
      text-align: left
      line-height: 34px
      padding: 0
      // This is needed for a bug in FF as described here
      // https://www.456bereastreet.com/archive/201305/firefox_and_the_magical_text-overflowellipsis_z-index/
      z-index: 1

      action-menu
        text-transform: none

      &.-right
        text-align: right

      a
        text-decoration: none
        color: var(--body-font-color)
        &:hover, &:active
          text-decoration: none
          color: var(--body-font-color)

      .-required:after
        @include default-transition
        content:  '*'
        padding:  0 0.2rem

      &.-max
        .generic-table--sort-header
          max-width: none

    .sort
      &.asc:after
        @include icon-font-common
        @include icon-mixin-sort-ascending
        margin-left: 5px
        font-size: 1.2em
        vertical-align: text-bottom

      &.desc:after
        @include icon-font-common
        @include icon-mixin-sort-descending
        margin-left: 5px
        font-size: 1.2em
        vertical-align: text-bottom

  tfoot
    td
      font-weight: var(--base-text-weight-bold)

  tbody
    tr:not(.-no-highlighting)
      border-bottom: 1px solid var(--borderColor-default)

    @media screen
      td:not(.-no-ellipsis)
        @include text-shortener

    .project td
      > span,
      > a
        // Because of the way table-cell display works,
        // the easiest way to properly center-align inline
        // elements is to just push them down a pixel.
        position: relative
        top: 1px

    td
      max-width: 300px
      text-align: left
      line-height: 1.6
      padding-top: 0.5rem
      padding-bottom: 0.5rem

      &.form--td
        vertical-align: middle

      // Center input fields and select boxes vertically in tables
      .form--field
        margin: 0px
      @each $inputElement in $input-elements
        #{$inputElement},
        #{$inputElement}~.form-label
          vertical-align: middle

      input[type="checkbox"], input[type="radio"]
        margin-top: -0.25rem

      // In the interactive table the behaviour is like this:
      // * if there is more space available than is required to render
      //   all columns, the container width is set to 100%.
      //   Then, td.-max will take up all space available and it will cause all other
      //   elements to shrink to their minimum value. td-max will grow even beyond
      //   what is specified as max-width.
      // * if the contents requires more space than the container width permits,
      //   then the container width is set to the width calculated by summing up
      //   all the column widths. For td.-max, the max-width will be taken to be
      //   the column width because of the combination of max-width and width: 100%.
      // as a result, td.-max will always have at least a width of max-width, but it can
      // become even wider.
      &.-max
        @media screen
          width: 100%
          max-width: 500px

      &.-min-200
        @media screen
          min-width: 200px

      // The avatar image is not taken into the width calculation of the table cell by the browser.
      // That is why we add the space manually.
      &.-contains-avatar
        text-overflow: clip
        .wp-table--cell-container
          padding-right: 35px

      &.info
        a
          text-decoration: none
          color: var(--body-font-color)

      &.buttons
        text-align: right
        white-space: nowrap

      &.-no-highlighting
        background-color: var(--body-background)

      // fixed column width helpers
      &.-w-abs-45
        width: 45px

      &.-w-rel-20
        width: 20%

      &.-mw-abs-200
        max-width: 200px //override the default max-width for appropriate text ellipsis

      &.-w-rel-40
        width: 40%

      &.-mw-abs-400
        max-width: 400px //override the default max-width for appropriate text ellipsis

      &.-w-rel-60
        width: 60%

      &.-mw-abs-600
        max-width: 600px //override the default max-width for appropriate text ellipsis

      &.-w-rel-80
        width: 80%

      &.-mw-abs-800
        max-width: 800px //override the default max-width for appropriate text ellipsis

// Enable sticky headers
thead.-sticky th
  position: sticky
  top: 0
  background: var(--body-background)


.generic-table--footer-outer
  padding:      0 6px
  line-height:  var(--generic-table--footer-height)
  width:        100%
  height:       var(--generic-table--footer-height)

.generic-table--header-outer,
.generic-table--sort-header-outer
  line-height:  var(--generic-table--header-height)
  height:  var(--generic-table--header-height)
  z-index:      1
  border-bottom: 1px solid var(--borderColor-default)

  &:hover,
  &.hover
    background:   var(--bgColor-muted)

  &_no-highlighting
    &:hover,
    &.hover
      background: initial

.generic-table--sort-header-outer
  padding:      0 12px 0 6px
  &.generic-table--header_no-padding
    padding: 0

.generic-table--header-outer,
.generic-table--empty-header
  padding: 0 6px

.generic-table--empty-header
  height:        var(--generic-table--header-height)
  line-height:   var(--generic-table--header-height)
  border-bottom: 1px solid var(--borderColor-default)
  z-index:       1

  // In case the table header contains invisible content for screen readers
  .generic-table--header,
  .generic-table--sort-header
    visibility: hidden
    // Matches the min-width of .generic-table--header, .generic-table--sort-header
    max-width: 40px

.generic-table--column-spacer
  white-space:  nowrap
  padding:      0 6px
  visibility:   hidden
  height:       0px
  line-height:  0px

.generic-table--header,
.generic-table--sort-header
  @include text-shortener
  width:   100%
  clear:   both
  min-width: 40px
  max-width: 300px
  display: flex

  &_no-min-width
    min-width: initial
  &_centered
    justify-content: center

  &--error-indicator
    margin-left: var(--base-size-8)

  & > a
    flex: 1 1
    width: 100%
    font-weight: var(--base-text-weight-bold)
    @include text-shortener

  & > op-icon
    flex: 0 0 0
    padding-left: 15px

  #startDate
    margin-left: $work-package--start-date-display-field-padding-left

.generic-table--sort-header-outer
  .dropdown-indicator
    width: 1em
    overflow: visible
    min-width: 1em
    visibility: hidden
    position: relative

  &:hover .dropdown-indicator
    visibility: visible

.generic-table--no-results-container
  background: var(--bgColor-neutral-muted)
  border: 1px solid var(--borderColor-neutral-muted)
  border-radius: 4px
  padding:      14px 14px 14px 36px
  display:      block

  > i,
  .generic-table--no-results-title
    display:        inline-block
    font-size:      1rem
    font-weight:    bold
    line-height:    1.4
    vertical-align: top

  > i
    margin:       1px 0 0 -24px
    width:        20px

.generic-table--no-results-title
  border:         0
  margin:         0
  padding:        0
  text-transform: none
  width:          99%

.generic-table--no-results-description
  font-size:      rem-calc(14)
  font-weight:    normal
  line-height:    1.4
  margin-top:     4px

  p:last-child
    margin-bottom: 0

.generic-table
  &--action-menu-button.leading-visual-icon-header
    position: relative
    top: 2px