<div class="header">
  {{yield this 'prefix'}}

  {{#if showActionsRow}}
    <div class="fixed-header-actions row clearfix">
      {{#if internalBulkActions}}
        <div class="bulk">
          {{#each availableActions as |act index|}}
            {{#if act.enabled}}
              <a class="btn bg-primary" href="#" onclick={{action 'executeBulkAction' act.action}} tabindex={{index}} data-action={{act.action}}>
                {{t act.label}}
                <i class="{{act.icon}}"></i>
              </a>
            {{else}}
              <a class="btn bg-default btn-disabled" href="#" onclick="return false;" tabindex={{index}}>
                {{t act.label}}
                <i class="{{act.icon}}"></i>
              </a>
            {{/if}}
          {{/each}}
          {{#if selectedNodes}}
            <div class="inline-block text-small">{{t pagingLabel pages=1 count=selectedNodes.length}}</div>
          {{/if}}
        </div>
      {{/if}}

      {{#if search}}
        <div class="search">
          {{#ember-wormhole to=searchToWormhole renderInPlace=(not searchToWormhole)}}
            {{input
              type="search"
              value=searchText
              class="input-sm"
              placeholder=(t 'generic.search')
              aria-title=(t 'generic.search')
            }}
          {{/ember-wormhole}}
        </div>
      {{/if}}

      {{#if rightActions}}
        <div class="right">
          {{yield this 'right-actions'}}
        </div>
      {{/if}}
    </div>
  {{/if}}

  <table class="{{_tableClasssNames}} floating">
    <thead>
      <tr class="fixed-header-widthinator">
        {{#if internalBulkActions}}
          <th width="{{checkWidth}}"></th>
        {{/if}}
        {{#each headers as |header idx|}}
          <th width={{if header.width header.width}} class="{{header.classNames}}"></th>
        {{/each}}
        {{#if rowActions}}
          <th width="{{actionsWidth}}"></th>
        {{/if}}
      </tr>
      <tr class="fixed-header" id="floating-header-{{tableId}}"></tr>
    </thead>
  </table>
</div>

<table class={{_tableClasssNames}}>
  <thead>

    <tr class="fixed-header-widthinator">
      {{#if internalBulkActions}}
        <th width="{{checkWidth}}"></th>
      {{/if}}
      {{#each headers as |header idx|}}
        <th width={{if header.width header.width}} class="{{header.classNames}}"></th>
      {{/each}}
      {{#if rowActions}}
        <th width="{{actionsWidth}}"></th>
      {{/if}}
    </tr>

    {{#ember-wormhole to=(concat 'floating-header-' tableId) renderInPlace=(not isFixed) tagName="tr" classNames="fixed-header"}}
      {{#if internalBulkActions}}
        <th width="{{checkWidth}}" class="check">
          {{check-box classNames="select-all-check" checked=isAll}}
        </th>
      {{/if}}
      {{#each headers as |header|}}
        {{sortable-th
          sortable=this
          current=sortBy
          descending=descending
          action=(action "changeSort")
          header=header
          baseIcon=sortBaseIcon
          upIcon=sortUpIcon
          downIcon=sortDownIcon
        }}
      {{/each}}
      {{#if rowActions}}
        <th width="{{actionsWidth}}"></th>
      {{/if}}
    {{/ember-wormhole}}
  </thead>
  {{#if prefix}}
    <tbody>
      {{yield this 'prefix'}}
    </tbody>
  {{/if}}

  {{#if groupByKey}}
    {{#if extraGroups.length}}
      {{#each extraGroups as |group|}}
        <tbody class="group">
          {{yield this 'group' group}}
          {{yield this 'norows'}}
        </tbody>
      {{/each}}
    {{/if}}
    {{#each groupedContent as |group|}}
      <tbody class="group">
        {{yield this 'group' group}}
        {{#each group.items as |row|}}
          {{yield this 'row' row dt (array-includes childFilterNodes row.id)}}
        {{/each}}
      </tbody>
    {{else}}
      {{yield this (if arranged.length 'no-match' 'no-rows')}}
    {{/each}}
  {{else}}
    <tbody>
      {{#each pagedContent as |row|}}
        {{yield this 'row' row dt (array-includes childFilterNodes row.id)}}
      {{else}}
        {{yield this (if arranged.length 'no-match' 'no-rows')}}
      {{/each}}
    </tbody>
  {{/if}}

  {{#if suffix}}
    {{yield this 'suffix'}}
  {{/if}}
</table>

{{#if (and paging (gt filtered.length pagedContent.length))}}
  {{page-numbers content=pagedContent class="text-center mt-10 mb-10 no-select" indexTo=indexTo indexFrom=indexFrom totalCount=filtered.length textLabel=pagingLabel}}
{{/if}}
