Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unused code #109

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { DataTableBodyCellComponent } from './body-cell.component';
describe('DataTableBodyCellComponent', () => {
let fixture: ComponentFixture<DataTableBodyCellComponent>;
let component: DataTableBodyCellComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -21,7 +20,6 @@ describe('DataTableBodyCellComponent', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(DataTableBodyCellComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, TemplateRef } from '@angular/core';
import { Directive } from '@angular/core';
import { GroupContext } from '../../types/public.types';

@Directive({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { DataTableRowWrapperComponent } from './body-row-wrapper.component';
import { DatatableComponentToken } from '../../utils/table-token';

describe('DataTableRowWrapperComponent', () => {
let fixture: ComponentFixture<DataTableRowWrapperComponent>;
let component: DataTableRowWrapperComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [DataTableRowWrapperComponent]
declarations: [DataTableRowWrapperComponent],
providers: [
{
provide: DatatableComponentToken,
useValue: {}
}
]
});
});

beforeEach(waitForAsync(() => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(DataTableRowWrapperComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

/*
describe('fixture', () => {
it('should have a component instance', () => {
expect(component).toBeTruthy();
});
});
*/
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
ViewChild
} from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { NgStyle } from '@angular/common';
import { DatatableComponentToken } from '../../utils/table-token';
import { Group, GroupContext, RowDetailContext, RowOrGroup } from '../../types/public.types';
import { DatatableGroupHeaderDirective } from './body-group-header.directive';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { DataTableBodyCellComponent } from './body-cell.component';
describe('DataTableBodyRowComponent', () => {
let fixture: ComponentFixture<DataTableBodyRowComponent>;
let component: DataTableBodyRowComponent;
let element: any;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -18,15 +17,12 @@ describe('DataTableBodyRowComponent', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(DataTableBodyRowComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

/*
describe('fixture', () => {
it('should have a component instance', () => {
expect(component).toBeTruthy();
});
});
*/
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ import {

import { columnGroupWidths, columnsByPin, columnsByPinArr } from '../../utils/column';
import { Keys } from '../../utils/keys';
import { ScrollbarHelper } from '../../services/scrollbar-helper.service';
import { BehaviorSubject } from 'rxjs';
import { ActivateEvent, RowOrGroup, TreeStatus } from '../../types/public.types';
import { NgStyle } from '@angular/common';
import { TableColumn } from '../../types/table-column.type';
import { ColumnGroupWidth, PinnedColumns } from '../../types/internal.types';

Expand Down Expand Up @@ -60,7 +58,6 @@ import { ColumnGroupWidth, PinnedColumns } from '../../types/internal.types';
`
})
export class DataTableBodyRowComponent<TRow = any> implements DoCheck, OnChanges {
private scrollbarHelper = inject(ScrollbarHelper);
private cd = inject(ChangeDetectorRef);

@Input() set columns(val: TableColumn[]) {
Expand Down Expand Up @@ -157,11 +154,6 @@ export class DataTableBodyRowComponent<TRow = any> implements DoCheck, OnChanges
_offsetX: number;
_columns: TableColumn[];
_innerWidth: number;
_groupStyles: {
left: NgStyle['ngStyle'];
center: NgStyle['ngStyle'];
right: NgStyle['ngStyle'];
} = { left: {}, center: {}, right: {} };

private _rowDiffer: KeyValueDiffer<keyof RowOrGroup<TRow>, any> = inject(KeyValueDiffers)
.find({})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { ScrollbarHelper } from '../../services/scrollbar-helper.service';
describe('DataTableBodyComponent', () => {
let fixture: ComponentFixture<DataTableBodyComponent>;
let component: DataTableBodyComponent;
let element: any;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -35,7 +34,6 @@ describe('DataTableBodyComponent', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(DataTableBodyComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
21 changes: 0 additions & 21 deletions projects/ngx-datatable/src/lib/components/body/body.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,6 @@ export class DataTableBodyComponent<TRow extends { treeStatus?: TreeStatus } = a
// parameters as group paging parameters ie if limit 10 has been
// specified treat it as 10 groups rather than 10 rows
if (this.groupedRows) {
let maxRowsPerGroup = 3;
// if there is only one group set the maximum number of
// rows per group the same as the total number of rows
if (this.groupedRows.length === 1) {
maxRowsPerGroup = this.groupedRows[0].value.length;
}

while (rowIndex < last && rowIndex < this.groupedRows.length) {
// Add the groups into this page
const group = this.groupedRows[rowIndex];
Expand Down Expand Up @@ -767,13 +760,6 @@ export class DataTableBodyComponent<TRow extends { treeStatus?: TreeStatus } = a
};
});

/**
* Hides the loading indicator
*/
hideIndicator(): void {
setTimeout(() => (this.loadingIndicator = false), 500);
}

/**
* Updates the index of the rows in the viewport
*/
Expand Down Expand Up @@ -931,13 +917,6 @@ export class DataTableBodyComponent<TRow extends { treeStatus?: TreeStatus } = a
this.updateIndexes();
}

/**
* Tracks the column
*/
columnTrackingFn(index: number, column: any): any {
return column.$$id;
}

/**
* Returns if the row was expanded and set default row expansion when row expansion is empty
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DataTableGhostLoaderComponent } from './ghost-loader.component';
describe('DataTableGhostLoaderComponent', () => {
let fixture: ComponentFixture<DataTableGhostLoaderComponent>;
let component: DataTableGhostLoaderComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -17,7 +16,6 @@ describe('DataTableGhostLoaderComponent', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(DataTableGhostLoaderComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ProgressBarComponent } from './progress-bar.component';
describe('ProgressBarComponent', () => {
let fixture: ComponentFixture<ProgressBarComponent>;
let component: ProgressBarComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -17,7 +16,6 @@ describe('ProgressBarComponent', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(ProgressBarComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ScrollerComponent } from './scroller.component';
describe('ScrollerComponent', () => {
let fixture: ComponentFixture<ScrollerComponent>;
let component: ScrollerComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -17,7 +16,6 @@ describe('ScrollerComponent', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(ScrollerComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
HostBinding,
inject,
Input,
NgZone,
OnDestroy,
OnInit,
Output,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DataTableSelectionComponent } from './selection.component';
describe('DataTableSelectionComponent', () => {
let fixture: ComponentFixture<DataTableSelectionComponent>;
let component: DataTableSelectionComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -17,7 +16,6 @@ describe('DataTableSelectionComponent', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(DataTableSelectionComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { DebugElement, PipeTransform } from '@angular/core';
import { DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';

import { DataTableBodyRowComponent } from '../body-row.component';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, TemplateRef } from '@angular/core';
import { Directive } from '@angular/core';

@Directive({ selector: '[ngx-datatable-ghost-cell-template]' })
export class DataTableColumnGhostCellDirective {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class TestFixtureComponent {
describe('DataTableColumnDirective', () => {
let fixture: ComponentFixture<TestFixtureComponent>;
let component: TestFixtureComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -43,7 +42,6 @@ describe('DataTableColumnDirective', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(TestFixtureComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { DataTablePagerComponent } from './pager.component';
describe('DataTablePagerComponent', () => {
let fixture;
let pager: DataTablePagerComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() =>
Expand All @@ -19,7 +18,6 @@ describe('DataTablePagerComponent', () => {

fixture = TestBed.createComponent(DataTablePagerComponent);
pager = fixture.componentInstance;
element = fixture.nativeElement;
}));

describe('size', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DataTableHeaderCellComponent } from './header-cell.component';
describe('DataTableHeaderCellComponent', () => {
let fixture: ComponentFixture<DataTableHeaderCellComponent>;
let component: DataTableHeaderCellComponent;
let element: any;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -17,7 +16,6 @@ describe('DataTableHeaderCellComponent', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(DataTableHeaderCellComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, TemplateRef } from '@angular/core';
import { Directive } from '@angular/core';
import { RowDetailContext } from '../../types/public.types';

@Directive({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class TestFixtureComponent {}
describe('DatatableRowDetailDirective', () => {
let fixture: ComponentFixture<TestFixtureComponent>;
let component: TestFixtureComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -35,7 +34,6 @@ describe('DatatableRowDetailDirective', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(TestFixtureComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
AfterContentInit,
booleanAttribute,
Directive,
ElementRef,
inject,
Input
} from '@angular/core';
import { booleanAttribute, Directive, ElementRef, inject, Input } from '@angular/core';

/**
* Row Disable Directive
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { Component } from '@angular/core';
import { By } from '@angular/platform-browser';
import { LongPressDirective } from './long-press.directive';
Expand All @@ -12,7 +12,6 @@ class TestFixtureComponent {}
describe('LongPressDirective', () => {
let fixture: ComponentFixture<TestFixtureComponent>;
let component: TestFixtureComponent;
let element;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -25,7 +24,6 @@ describe('LongPressDirective', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(TestFixtureComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
OnDestroy,
Output
} from '@angular/core';
import { fromEvent, Observable, Subscription } from 'rxjs';
import { fromEvent, Subscription } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { MouseEvent } from '../events';
import { TableColumn } from '../types/table-column.type';

@Directive({ selector: '[long-press]' })
Expand Down
Loading