Added total rows and a message for no results
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
04a31f4cff
commit
fbf1c50f97
|
@ -1,5 +1,5 @@
|
||||||
<div class="vn-pa-md">
|
<div class="vn-pa-md">
|
||||||
<vn-horizontal>
|
<vn-horizontal class="actions">
|
||||||
<div class="actions-left">
|
<div class="actions-left">
|
||||||
<vn-button icon="view_column"
|
<vn-button icon="view_column"
|
||||||
ng-if="$ctrl.options.activeButtons.shownColumns"
|
ng-if="$ctrl.options.activeButtons.shownColumns"
|
||||||
|
@ -7,6 +7,13 @@
|
||||||
vn-tooltip="Shown columns">
|
vn-tooltip="Shown columns">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
<div ng-transclude="actions"></div> <!-- transcluded actions -->
|
<div ng-transclude="actions"></div> <!-- transcluded actions -->
|
||||||
|
<div class="totalRows" ng-if="$ctrl.model.data">
|
||||||
|
<
|
||||||
|
<span translate>Showing</span>
|
||||||
|
{{model.data.length}}
|
||||||
|
<span translate>rows</span>
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions-right">
|
<div class="actions-right">
|
||||||
<vn-button icon="search"
|
<vn-button icon="search"
|
||||||
|
|
|
@ -13,6 +13,8 @@ export default class SmartTable extends Component {
|
||||||
this.sortCriteria = [];
|
this.sortCriteria = [];
|
||||||
this.columns = [];
|
this.columns = [];
|
||||||
this.autoSave = false;
|
this.autoSave = false;
|
||||||
|
|
||||||
|
this.transclude();
|
||||||
}
|
}
|
||||||
|
|
||||||
get options() {
|
get options() {
|
||||||
|
@ -37,7 +39,6 @@ export default class SmartTable extends Component {
|
||||||
this._model = value;
|
this._model = value;
|
||||||
if (value) {
|
if (value) {
|
||||||
this.$.model = value;
|
this.$.model = value;
|
||||||
this.transclude();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +96,34 @@ export default class SmartTable extends Component {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transclude() {
|
||||||
|
const slotTable = this.element.querySelector('#table');
|
||||||
|
this.$transclude(($clone, $scope) => {
|
||||||
|
const table = $clone[0];
|
||||||
|
slotTable.appendChild(table);
|
||||||
|
this.registerColumns();
|
||||||
|
|
||||||
|
const header = this.element.querySelector('thead > tr');
|
||||||
|
const columns = header.querySelectorAll('th');
|
||||||
|
const tbody = this.element.querySelector('tbody');
|
||||||
|
if (tbody) {
|
||||||
|
const noSearch = this.$compile(`
|
||||||
|
<tr ng-if="!model.data">
|
||||||
|
<td class="empty-rows" colspan="${columns.length}" translate>Enter a new search</td>
|
||||||
|
</tr>
|
||||||
|
`)($scope);
|
||||||
|
tbody.appendChild(noSearch[0]);
|
||||||
|
|
||||||
|
const noRows = this.$compile(`
|
||||||
|
<tr ng-if="model.data.length == 0">
|
||||||
|
<td class="empty-rows" colspan="${columns.length}" translate>No data</td>
|
||||||
|
</tr>
|
||||||
|
`)($scope);
|
||||||
|
tbody.appendChild(noRows[0]);
|
||||||
|
}
|
||||||
|
}, null, 'table');
|
||||||
|
}
|
||||||
|
|
||||||
saveViewConfig() {
|
saveViewConfig() {
|
||||||
const userViewModel = this.$.userViewModel;
|
const userViewModel = this.$.userViewModel;
|
||||||
const [viewConfig] = userViewModel.data;
|
const [viewConfig] = userViewModel.data;
|
||||||
|
@ -155,17 +184,6 @@ export default class SmartTable extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creo que se puede hacer directamente desde ng-transclude
|
|
||||||
transclude() {
|
|
||||||
const slotTable = this.element.querySelector('#table');
|
|
||||||
this.$transclude(($clone, $scope) => {
|
|
||||||
const table = $clone[0];
|
|
||||||
$scope.hasChanges = this.hasChanges;
|
|
||||||
slotTable.appendChild(table);
|
|
||||||
this.registerColumns();
|
|
||||||
}, null, 'table');
|
|
||||||
}
|
|
||||||
|
|
||||||
orderHandler(element) {
|
orderHandler(element) {
|
||||||
const field = element.getAttribute('field');
|
const field = element.getAttribute('field');
|
||||||
const existingCriteria = this.sortCriteria.find(criteria => {
|
const existingCriteria = this.sortCriteria.find(criteria => {
|
||||||
|
|
|
@ -3,4 +3,6 @@ Add new row: Añadir nueva fila
|
||||||
Undo: Deshacer
|
Undo: Deshacer
|
||||||
Save data: Guardar datos
|
Save data: Guardar datos
|
||||||
Shown columns: Columnas visibles
|
Shown columns: Columnas visibles
|
||||||
Check the columns you want to see: Marca las columnas que quieres ver
|
Check the columns you want to see: Marca las columnas que quieres ver
|
||||||
|
Showing: Mostrando
|
||||||
|
rows: filas
|
|
@ -38,9 +38,14 @@ smart-table {
|
||||||
@extend %clickable;
|
@extend %clickable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.totalRows {
|
||||||
|
color: $color-font-secondary;
|
||||||
|
}
|
||||||
|
|
||||||
.actions-left,
|
.actions-left,
|
||||||
.actions-right {
|
.actions-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
Loading…
Reference in New Issue