mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
enable prefer-const rule for tslint, fix issues (#4409)
* enable prefer-const rule for tslint, fix issues * Update content-node-selector.component.spec.ts * Update content-node-selector.component.spec.ts * fix const * fix lint issues * update tests * update tests * update tests * fix code * fix page class
This commit is contained in:
committed by
Eugenio Romano
parent
26c5982a1a
commit
a7a48e8b2b
@@ -239,7 +239,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
}
|
||||
|
||||
ngDoCheck() {
|
||||
let changes = this.differ.diff(this.rows);
|
||||
const changes = this.differ.diff(this.rows);
|
||||
if (changes) {
|
||||
this.setTableRows(this.rows);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
|
||||
private initAndSubscribeClickStream() {
|
||||
this.unsubscribeClickStream();
|
||||
let singleClickStream = this.click$
|
||||
const singleClickStream = this.click$
|
||||
.pipe(
|
||||
buffer(
|
||||
this.click$.pipe(
|
||||
@@ -273,7 +273,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
);
|
||||
|
||||
this.singleClickStreamSub = singleClickStream.subscribe((dataRowEvents: DataRowEvent[]) => {
|
||||
let event: DataRowEvent = dataRowEvents[0];
|
||||
const event: DataRowEvent = dataRowEvents[0];
|
||||
this.handleRowSelection(event.value, <MouseEvent | KeyboardEvent> event.event);
|
||||
this.rowClick.emit(event);
|
||||
if (!event.defaultPrevented) {
|
||||
@@ -286,7 +286,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
}
|
||||
});
|
||||
|
||||
let multiClickStream = this.click$
|
||||
const multiClickStream = this.click$
|
||||
.pipe(
|
||||
buffer(
|
||||
this.click$.pipe(
|
||||
@@ -298,7 +298,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
);
|
||||
|
||||
this.multiClickStreamSub = multiClickStream.subscribe((dataRowEvents: DataRowEvent[]) => {
|
||||
let event: DataRowEvent = dataRowEvents[0];
|
||||
const event: DataRowEvent = dataRowEvents[0];
|
||||
this.rowDblClick.emit(event);
|
||||
if (!event.defaultPrevented) {
|
||||
this.elementRef.nativeElement.dispatchEvent(
|
||||
@@ -428,7 +428,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
let dataRowEvent = new DataRowEvent(row, event, this);
|
||||
const dataRowEvent = new DataRowEvent(row, event, this);
|
||||
this.clickObserver.next(dataRowEvent);
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
|
||||
onColumnHeaderClick(column: DataColumn) {
|
||||
if (column && column.sortable) {
|
||||
let current = this.data.getSorting();
|
||||
const current = this.data.getSorting();
|
||||
let newDirection = 'asc';
|
||||
if (current && column.key === current.key) {
|
||||
newDirection = current.direction === 'asc' ? 'desc' : 'asc';
|
||||
@@ -485,7 +485,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
this.isSelectAllChecked = matCheckboxChange.checked;
|
||||
|
||||
if (this.multiselect) {
|
||||
let rows = this.data.getRows();
|
||||
const rows = this.data.getRows();
|
||||
if (rows && rows.length > 0) {
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
this.selectRow(rows[i], matCheckboxChange.checked);
|
||||
@@ -510,7 +510,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
|
||||
onImageLoadingError(event: Event, row: DataRow) {
|
||||
if (event) {
|
||||
let element = <any> event.target;
|
||||
const element = <any> event.target;
|
||||
|
||||
if (this.fallbackThumbnail) {
|
||||
element.src = this.fallbackThumbnail;
|
||||
@@ -522,7 +522,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
|
||||
isIconValue(row: DataRow, col: DataColumn): boolean {
|
||||
if (row && col) {
|
||||
let value = row.getValue(col.key);
|
||||
const value = row.getValue(col.key);
|
||||
return value && value.startsWith('material-icons://');
|
||||
}
|
||||
return false;
|
||||
@@ -530,7 +530,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
|
||||
asIconValue(row: DataRow, col: DataColumn): string {
|
||||
if (this.isIconValue(row, col)) {
|
||||
let value = row.getValue(col.key) || '';
|
||||
const value = row.getValue(col.key) || '';
|
||||
return value.replace('material-icons://', '');
|
||||
}
|
||||
return null;
|
||||
@@ -542,14 +542,14 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
|
||||
isColumnSorted(col: DataColumn, direction: string): boolean {
|
||||
if (col && direction) {
|
||||
let sorting = this.data.getSorting();
|
||||
const sorting = this.data.getSorting();
|
||||
return sorting && sorting.key === col.key && sorting.direction === direction;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getContextMenuActions(row: DataRow, col: DataColumn): any[] {
|
||||
let event = new DataCellEvent(row, col, []);
|
||||
const event = new DataCellEvent(row, col, []);
|
||||
this.showRowContextMenu.emit(event);
|
||||
return event.value.actions;
|
||||
}
|
||||
@@ -558,7 +558,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
const id = row.getValue('id');
|
||||
|
||||
if (!this.rowMenuCache[id]) {
|
||||
let event = new DataCellEvent(row, col, []);
|
||||
const event = new DataCellEvent(row, col, []);
|
||||
this.showRowActionsMenu.emit(event);
|
||||
if (!this.rowMenuCacheEnabled) {
|
||||
return event.value.actions;
|
||||
|
Reference in New Issue
Block a user