1<div class="bmc-table__container"> 2 <table-toolbar ng-if="$ctrl.selectable" 3 selection-count="$ctrl.selectedRows.size" 4 active="$ctrl.selectedRows.size > 0" 5 actions="$ctrl.batchActions" 6 emit-action="$ctrl.onEmitBatchAction(action)" 7 emit-close="$ctrl.onToolbarClose()" 8 ng-animate-children="true"> 9 </table-toolbar> 10 <table class="bmc-table {{$ctrl.size}}" 11 ng-class="{ 12 'bmc-table--sortable': $ctrl.sortable, 13 'bmc-table--expandable': $ctrl.expandable, 14 'bmc-table--selectable': $ctrl.selectable, 15 'bmc-table--row-actions-enabled': '$ctrl.rowActionsEnabled', 16 }"> 17 <thead class="bmc-table__head"> 18 <!-- Header row --> 19 <tr> 20 <!-- Expandable empty cell --> 21 <th ng-if="$ctrl.expandable" 22 class="bmc-table__column-header"></th> 23 <!-- Select checkbox --> 24 <th ng-if="$ctrl.selectable" 25 class="bmc-table__column-header"> 26 <table-checkbox ng-model="$ctrl.selectHeaderCheckbox" 27 indeterminate="$ctrl.someSelected" 28 emit-change="$ctrl.onHeaderSelectChange(checked)"> 29 </table-checkbox> 30 </th> 31 <!-- Header items --> 32 <th ng-repeat="headerItem in $ctrl.header track by $index" 33 class="bmc-table__column-header"> 34 <span ng-if="!$ctrl.sortable || !headerItem.sortable"> 35 {{headerItem.label}} 36 </span> 37 <span ng-if="$ctrl.sortable && headerItem.sortable" 38 ng-click="$ctrl.onClickSort($index)" 39 class="bmc-table__column-header--sortable"> 40 {{headerItem.label}} 41 <!-- Sort icons --> 42 <button class="sort-icon" 43 type="button" 44 aria-label="sort {{headerItem.label}}"> 45 <icon file="icon-arrow--up.svg" 46 ng-if="$index === $ctrl.activeSort" 47 ng-class="{ 48 'sort-icon--descending': !$ctrl.sortAscending, 49 'sort-icon--ascending' : $ctrl.sortAscending }" 50 class="sort-icon--active" 51 aria-hidden="true"></icon> 52 <span ng-if="$index !== $ctrl.activeSort" 53 class="sort-icon--inactive" 54 aria-hidden="true"> 55 <icon file="icon-arrow--up.svg"></icon> 56 <icon file="icon-arrow--down.svg"></icon> 57 </span> 58 </button> 59 </span> 60 </th> 61 <!-- Row actions empty cell --> 62 <th ng-if="$ctrl.rowActionsEnabled" 63 class="bmc-table__column-header"></th> 64 </tr> 65 </thead> 66 <tbody class="bmc-table__body"> 67 <!-- Data rows --> 68 <tr ng-if="$ctrl.data.length > 0" 69 ng-repeat-start="row in $ctrl.data track by $index" 70 class="bmc-table__row" 71 ng-class="{ 72 'bmc-table__row--expanded': $ctrl.expandedRows.has($index), 73 'bmc-table__row--selected': $ctrl.selectedRows.has($index), 74 }"> 75 <!-- Row expansion trigger --> 76 <td ng-if="$ctrl.expandable" 77 class="bmc-table__cell"> 78 <button type="button" 79 class="btn btn--expand" 80 aria-label="expand row" 81 ng-click="$ctrl.onClickExpand($index)"> 82 <icon file="icon-chevron-right.svg" aria-hidden="true"></icon> 83 </button> 84 </td> 85 <!-- Row checkbox --> 86 <td ng-if="$ctrl.selectable" 87 class="bmc-table__cell"> 88 <table-checkbox ng-if="row.selectable" 89 ng-model="row.selected" 90 emit-change="$ctrl.onRowSelectChange($index)"> 91 </table-checkbox> 92 </td> 93 <!-- Row item --> 94 <td ng-repeat="item in row.uiData track by $index" 95 class="bmc-table__cell"> 96 <ng-bind-html ng-bind-html="item"></ng-bind-html> 97 </td> 98 <!-- Row Actions --> 99 <td ng-if="$ctrl.rowActionsEnabled" 100 class="bmc-table__cell bmc-table__row-actions"> 101 <table-actions 102 actions="row.actions" 103 emit-action="$ctrl.onEmitRowAction(action, row)"> 104 </table-actions> 105 </td> 106 </tr> 107 <!-- Expansion row --> 108 <tr ng-repeat-end 109 ng-if="$ctrl.expandedRows.has($index)" 110 class="bmc-table__expansion-row"> 111 <td class="bmc-table__cell"></td> 112 <td class="bmc-table__cell" 113 colspan="{{$ctrl.header.length + $ctrl.sortable + 114 $ctrl.expandable + $ctrl.rowActionsEnabled}}"> 115 <ng-bind-html 116 ng-bind-html="row.expandContent || 'No data'"> 117 </ng-bind-html> 118 </td> 119 </tr> 120 <!-- Empty table --> 121 <tr ng-if="$ctrl.data.length === 0" 122 class="bmc-table__expansion-row"> 123 <td class="bmc-table__cell" 124 colspan="{{$ctrl.header.length + $ctrl.sortable + 125 $ctrl.expandable + $ctrl.rowActionsEnabled}}"> 126 No data 127 </td> 128 </tr> 129 </tbody> 130 </table> 131</div>