Skip to content

Commit

Permalink
fix(build): enable tsconfig strict mode tsconfig, fixes #675 (#702)
Browse files Browse the repository at this point in the history
* fix(build): enable tsconfig strict mode tsconfig, fixes #675
  • Loading branch information
ghiscoding authored Feb 24, 2021
1 parent 269f1e9 commit 7219249
Show file tree
Hide file tree
Showing 133 changed files with 1,098 additions and 1,093 deletions.
2 changes: 1 addition & 1 deletion src/app/examples/custom-actionFormatter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Component } from '@angular/core';
})
export class CustomActionFormatterComponent {
parent: any; // parent component context
row: number;
row!: number;
dataContext: any;
dropdownId = 'myDrop';
dropDownToggleId = 'toggleDrop';
Expand Down
8 changes: 4 additions & 4 deletions src/app/examples/custom-angularComponentEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export class CustomAngularComponentEditor implements Editor {
private _subscriptions: Subscription[] = [];

/** Angular Component Reference */
componentRef: ComponentRef<any>;
componentRef!: ComponentRef<any>;

/** default item Id */
defaultId: string;
defaultId = '';

/** default item object */
defaultItem: any;
Expand All @@ -46,7 +46,7 @@ export class CustomAngularComponentEditor implements Editor {

/** Get the Collection */
get collection(): any[] {
return this.columnDef && this.columnDef.internalColumnEditor.collection || [];
return this.columnDef && this.columnDef.internalColumnEditor!.collection || [];
}

/** Get Column Definition object */
Expand All @@ -69,7 +69,7 @@ export class CustomAngularComponentEditor implements Editor {
}

/** Get the Validator function, can be passed in Editor property or Column Definition */
get validator(): EditorValidator {
get validator(): EditorValidator | undefined {
return this.columnEditor.validator || this.columnDef.validator;
}

Expand Down
12 changes: 6 additions & 6 deletions src/app/examples/custom-angularComponentFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export class CustomAngularComponentFilter implements Filter {
private _subscriptions: Subscription[] = [];

/** Angular Component Reference */
componentRef: ComponentRef<any>;
componentRef!: ComponentRef<any>;

grid: any;
searchTerms: SearchTerm[];
columnDef: Column;
callback: FilterCallback;
searchTerms: SearchTerm[] = [];
columnDef!: Column;
callback!: FilterCallback;
operator: OperatorType | OperatorString = OperatorType.equal;

constructor() { }
Expand Down Expand Up @@ -86,7 +86,7 @@ export class CustomAngularComponentFilter implements Filter {
Object.assign(componentOuput.componentRef.instance, { collection: this.collection });

this._subscriptions.push(
componentOuput.componentRef.instance.onItemChanged.subscribe((item) => {
componentOuput.componentRef.instance.onItemChanged.subscribe((item: any) => {
this.callback(undefined, { columnDef: this.columnDef, operator: this.operator, searchTerms: [item.id], shouldTriggerQuery: this._shouldTriggerQuery });
// reset flag for next use
this._shouldTriggerQuery = true;
Expand Down Expand Up @@ -117,7 +117,7 @@ export class CustomAngularComponentFilter implements Filter {
}

/** Set value(s) on the DOM element */
setValues(values) {
setValues(values: SearchTerm[] | SearchTerm) {
if (this.componentRef && this.componentRef.instance && this.componentRef.instance.hasOwnProperty('selectedId')) {
this.componentRef.instance.selectedId = values;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/examples/custom-inputEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ declare const $: any;
* KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter.
*/
export class CustomInputEditor implements Editor {
private _lastInputEvent: JQuery.Event;
private _lastInputEvent?: JQuery.Event;
$input: any;
defaultValue: any;

Expand All @@ -31,7 +31,7 @@ export class CustomInputEditor implements Editor {
}

/** Get the Validator function, can be passed in Editor property or Column Definition */
get validator(): EditorValidator {
get validator(): EditorValidator | undefined {
return this.columnEditor.validator || this.columnDef.validator;
}

Expand Down
8 changes: 4 additions & 4 deletions src/app/examples/custom-inputFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export class CustomInputFilter implements Filter {
private _shouldTriggerQuery = true;
private $filterElm: any;
grid: any;
searchTerms: SearchTerm[];
columnDef: Column;
callback: FilterCallback;
searchTerms: SearchTerm[] = [];
columnDef!: Column;
callback!: FilterCallback;
operator: OperatorType | OperatorString = OperatorType.equal;

constructor() { }
Expand Down Expand Up @@ -96,7 +96,7 @@ export class CustomInputFilter implements Filter {
}

/** Set value(s) on the DOM element */
setValues(values) {
setValues(values: SearchTerm | SearchTerm[]) {
if (values) {
this.$filterElm.val(values);
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/examples/editor-ng-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { Subject } from 'rxjs';
</ng-select>`
})
export class EditorNgSelectComponent {
selectedId: string;
selectedId = '';
selectedItem: any;
collection; // this will be filled by the collection of your column definition
collection?: any[]; // this will be filled by the collection of your column definition
onItemChanged = new Subject<any>(); // object

onChange(item: any) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/examples/filter-ng-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import { Subject } from 'rxjs';
</ng-select>`
})
export class FilterNgSelectComponent {
selectedId: string;
selectedId = '';
selectedItem: any;
collection; // this will be filled by the collection of your column definition
collection?: any[]; // this will be filled by the collection of your column definition
onItemChanged = new Subject<any>(); // object

onChange(item: any) {
Expand Down
10 changes: 5 additions & 5 deletions src/app/examples/grid-additem.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export class GridAddItemComponent implements OnInit {
</ul>
`;

angularGrid: AngularGridInstance;
angularGrid!: AngularGridInstance;
grid: any;
gridService: GridService;
gridService!: GridService;
dataView: any;
columnDefinitions: Column[];
gridOptions: GridOption;
columnDefinitions: Column[] = [];
gridOptions!: GridOption;
dataset: any[];
updatedObject: any;

Expand Down Expand Up @@ -177,7 +177,7 @@ export class GridAddItemComponent implements OnInit {
createNewItem(incrementIdByHowMany = 1) {
const dataset = this.angularGrid.dataView.getItems();
let highestId = 0;
dataset.forEach(item => {
dataset.forEach((item: any) => {
if (item.id > highestId) {
highestId = item.id;
}
Expand Down
20 changes: 10 additions & 10 deletions src/app/examples/grid-angular.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ export class GridAngularComponent implements OnInit {
</ul>
`;

private _commandQueue = [];
angularGrid: AngularGridInstance;
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
private _commandQueue: any[] = [];
angularGrid!: AngularGridInstance;
columnDefinitions: Column[] = [];
gridOptions!: GridOption;
dataset!: any[];
gridObj: any;
isAutoEdit = true;
alertWarning: any;
Expand Down Expand Up @@ -270,7 +270,7 @@ export class GridAngularComponent implements OnInit {
this.dataset = this.mockData(NB_ITEMS);
}

mockData(itemCount, startingIndex = 0) {
mockData(itemCount: number, startingIndex = 0) {
// mock a dataset
const tempDataset = [];
for (let i = startingIndex; i < (startingIndex + itemCount); i++) {
Expand All @@ -294,11 +294,11 @@ export class GridAngularComponent implements OnInit {
return tempDataset;
}

onCellChanged(e, args) {
onCellChanged(e: Event, args: any) {
this.updatedObject = args.item;
}

onCellClicked(e, args) {
onCellClicked(e: Event, args: any) {
const metadata = this.angularGrid.gridService.getColumnFromEventArguments(args);
console.log(metadata);

Expand All @@ -317,7 +317,7 @@ export class GridAngularComponent implements OnInit {
}
}

onCellValidation(e, args) {
onCellValidation(e: Event, args: any) {
alert(args.validationResults.msg);
}

Expand All @@ -329,7 +329,7 @@ export class GridAngularComponent implements OnInit {
return true;
}

setAutoEdit(isAutoEdit) {
setAutoEdit(isAutoEdit: boolean) {
this.isAutoEdit = isAutoEdit;
this.gridObj.setOptions({ autoEdit: isAutoEdit }); // change the grid option dynamically
return true;
Expand Down
12 changes: 6 additions & 6 deletions src/app/examples/grid-autoheight.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ export class GridAutoHeightComponent implements OnInit {
</ul>
`;

angularGrid: AngularGridInstance;
angularGrid!: AngularGridInstance;
grid: any;
dataView: any;
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
columnDefinitions: Column[] = [];
gridOptions!: GridOption;
dataset!: any[];
operatorList: OperatorString[] = ['=', '<', '<=', '>', '>=', '<>', 'StartsWith', 'EndsWith'];
selectedOperator = '=';
searchValue = '';
selectedColumn: Column;
selectedColumn?: Column;

constructor() { }

Expand Down Expand Up @@ -138,7 +138,7 @@ export class GridAutoHeightComponent implements OnInit {

updateFilter() {
this.angularGrid.filterService.updateSingleFilter({
columnId: `${this.selectedColumn.id || ''}`,
columnId: `${this.selectedColumn!.id || ''}`,
operator: this.selectedOperator as OperatorString,
searchTerms: [this.searchValue || '']
});
Expand Down
12 changes: 6 additions & 6 deletions src/app/examples/grid-basic.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export class GridBasicComponent implements OnInit {
</ul>
`;

columnDefinitions1: Column[];
columnDefinitions2: Column[];
gridOptions1: GridOption;
gridOptions2: GridOption;
dataset1: any[];
dataset2: any[];
columnDefinitions1: Column[] = [];
columnDefinitions2: Column[] = [];
gridOptions1!: GridOption;
gridOptions2!: GridOption;
dataset1!: any[];
dataset2!: any[];

ngOnInit(): void {
this.columnDefinitions1 = [
Expand Down
8 changes: 4 additions & 4 deletions src/app/examples/grid-clientside.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ <h2>{{title}}</h2>
</button>

<angular-slickgrid gridId="grid4" [columnDefinitions]="columnDefinitions" [gridOptions]="gridOptions"
[dataset]="dataset" (onAngularGridCreated)="angularGridReady($event)"
(onGridStateChanged)="gridStateChanged($event)" (onBeforeGridDestroy)="saveCurrentGridState($event)"
(sgOnRowCountChanged)="refreshMetrics($event.detail.eventData, $event.detail.args)">
[dataset]="dataset" (onAngularGridCreated)="angularGridReady($event)"
(onGridStateChanged)="gridStateChanged($event)" (onBeforeGridDestroy)="saveCurrentGridState()"
(sgOnRowCountChanged)="refreshMetrics($event.detail.eventData, $event.detail.args)">
</angular-slickgrid>
</div>
</div>
18 changes: 9 additions & 9 deletions src/app/examples/grid-clientside.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
OperatorType,
} from './../modules/angular-slickgrid';

function randomBetween(min, max) {
function randomBetween(min: number, max: number) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
const NB_ITEMS = 1500;
Expand Down Expand Up @@ -50,11 +50,11 @@ export class GridClientSideComponent implements OnInit {
</ul>
`;

angularGrid: AngularGridInstance;
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
metrics: Metrics;
angularGrid!: AngularGridInstance;
columnDefinitions: Column[] = [];
gridOptions!: GridOption;
dataset!: any[];
metrics!: Metrics;

constructor(private http: HttpClient, private translate: TranslateService) { }

Expand Down Expand Up @@ -205,7 +205,7 @@ export class GridClientSideComponent implements OnInit {
this.angularGrid = angularGrid;
}

mockData(itemCount, startingIndex = 0): any[] {
mockData(itemCount: number, startingIndex = 0): any[] {
// mock a dataset
const tempDataset = [];
for (let i = startingIndex; i < (startingIndex + itemCount); i++) {
Expand Down Expand Up @@ -246,7 +246,7 @@ export class GridClientSideComponent implements OnInit {
}

/** Save current Filters, Sorters in LocaleStorage or DB */
saveCurrentGridState(grid) {
saveCurrentGridState() {
console.log('Client sample, last Grid State:: ', this.angularGrid.gridStateService.getCurrentGridState());
}

Expand All @@ -268,7 +268,7 @@ export class GridClientSideComponent implements OnInit {
]);
}

refreshMetrics(e, args) {
refreshMetrics(e: Event, args: any) {
if (args && args.current >= 0) {
setTimeout(() => {
this.metrics = {
Expand Down
14 changes: 7 additions & 7 deletions src/app/examples/grid-colspan.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export class GridColspanComponent implements OnInit {
</ul>
`;

angularGrid2: AngularGridInstance;
angularGrid2!: AngularGridInstance;
gridObj2: any;
columnDefinitions1: Column[];
columnDefinitions2: Column[];
gridOptions1: GridOption;
gridOptions2: GridOption;
dataset1 = [];
dataset2 = [];
columnDefinitions1!: Column[];
columnDefinitions2!: Column[];
gridOptions1!: GridOption;
gridOptions2!: GridOption;
dataset1: any[] = [];
dataset2: any[] = [];

ngOnInit(): void {
this.prepareGrid1();
Expand Down
12 changes: 6 additions & 6 deletions src/app/examples/grid-contextmenu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export class GridContextMenuComponent implements OnInit, OnDestroy {
</ul>`;

private subscriptions: Subscription[] = [];
angularGrid: AngularGridInstance;
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
angularGrid!: AngularGridInstance;
columnDefinitions!: Column[];
gridOptions!: GridOption;
dataset!: any[];
selectedLanguage: string;

constructor(private translate: TranslateService) {
Expand Down Expand Up @@ -301,7 +301,7 @@ export class GridContextMenuComponent implements OnInit, OnDestroy {
};
}

executeCommand(e, args) {
executeCommand(e: Event, args: any) {
const columnDef = args.column;
const command = args.command;
const dataContext = args.dataContext;
Expand Down Expand Up @@ -448,7 +448,7 @@ export class GridContextMenuComponent implements OnInit, OnDestroy {
});
}

showCellMenuCommandsAndOptions(showBothList) {
showCellMenuCommandsAndOptions(showBothList: boolean) {
// change via the plugin setOptions
this.cellMenuInstance.setOptions({
hideOptionSection: !showBothList
Expand Down
Loading

0 comments on commit 7219249

Please sign in to comment.