Skip to content

Commit

Permalink
#203 applies review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
patric-eberle committed Jan 26, 2023
1 parent 4f50d17 commit 1f32348
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions src/elements/e-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
:class="b('toggle-row')"
>
<th :colspan="colspan">
<div :id="`button--${uuid}`"
ref="toggleButton"
:class="b('toggle')"
role="button"
@click.prevent="toggleSortingOptions"
<button ref="toggleButton"
:class="b('toggle')"
type="button"
@click.prevent="toggleSortingOptions"
>
{{ $t('e-table.toggleSortingOptions') }}
</div>
</button>
</th>
</tr>
<tr :class="b('header-row')">
Expand All @@ -38,11 +37,9 @@
@change="toggleAll"
>

<!-- eslint-disable-next-line vue/attributes-order -->
<span v-if="!!selectedInternal.length" :class="{ invisible : !showSortingOptions || !isMobile}">
{{ $t('e-table.deselectAll') }}
</span>
<!-- eslint-disable-next-line vue/attributes-order -->
<span v-else :class="{ invisible : !showSortingOptions || !isMobile }">
{{ $t('e-table.selectAll') }}
</span>
Expand Down Expand Up @@ -261,8 +258,8 @@
* Accepts a method to generate a link for each row (except for columns with 'onClick' callback).
*
* @param {Object} rowLink - A definition for the row link.
* @param {Object} rowLink.href - The link for the row link element.
* @param {Object} rowLink.title - The title for the row link element.
* @param {Function} rowLink.href - A href generator function, that returns a href for the given item.
* @param {String|Function} rowLink.title - The title or title generator function for the row link element.
*/
rowLink: {
type: Object,
Expand Down Expand Up @@ -364,14 +361,14 @@
/**
* Returns the href generator method of the rowLink.
*
* @returns {Function}
* @returns {Function|null}
*/
rowHref() {
return this.rowLink?.href;
return this.rowLink?.href || null;
},
/**
* Manages changes for the select prop.
* Manages changes for the 'select' prop.
*/
selectedInternal: {
get() {
Expand Down Expand Up @@ -511,7 +508,7 @@
* Get the height of the sorting list toggle button.
*/
updateToggleButtonHeight() {
this.toggleButtonHeight = this.$refs.toggleButton.clientHeight;
this.toggleButtonHeight = this.$refs.toggleButton?.clientHeight || 0;
},
/**
Expand Down Expand Up @@ -737,16 +734,18 @@
onDetailToggleClick(item) {
const id = item[this.itemIdentifier];
if (id) {
const expandedRows = this.expandedRowsComputed.slice();
if (!id) {
return;
}
const expandedRows = this.expandedRowsComputed.slice();
if (expandedRows.includes(id)) {
this.expandedRowsComputed = expandedRows.filter(itemId => itemId !== id);
} else {
expandedRows.push(id);
if (expandedRows.includes(id)) {
this.expandedRowsComputed = expandedRows.filter(itemId => itemId !== id);
} else {
expandedRows.push(id);
this.expandedRowsComputed = expandedRows;
}
this.expandedRowsComputed = expandedRows;
}
},
},
Expand Down

0 comments on commit 1f32348

Please sign in to comment.