Skip to content

Commit 02eed9c

Browse files
fix issues
1 parent 66e8172 commit 02eed9c

File tree

14 files changed

+213
-193
lines changed

14 files changed

+213
-193
lines changed

ASP.NET Core/package-lock.json

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"watch": "ng build --watch --configuration development",
99
"test": "ng test",
1010
"lint-html": "prettier --check .",
11-
"lint-ts": "eslint --ext .ts .",
11+
"lint-ts": "eslint --ext .ts . --fix",
1212
"lint-css": "stylelint src/**/*.{css,scss} --allow-empty-input",
1313
"lint": "npm-run-all -p -c lint-ts lint-css lint-html"
1414
},

Angular/src/app/app.component.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
<dx-data-grid id="gridContainer" [dataSource]="dataSource" [showBorders]="true"
2-
(onEditorPreparing)="onEditorPreparing($event)" (onSelectionChanged)="onSelectionChanged($event)">
3-
4-
<dxo-selection selectAllMode="allPages" showCheckBoxesMode="onClick" mode="multiple"></dxo-selection>
1+
<dx-data-grid
2+
id="gridContainer"
3+
[dataSource]="dataSource"
4+
[showBorders]="true"
5+
(onEditorPreparing)="onEditorPreparing($event)"
6+
(onSelectionChanged)="onSelectionChanged($event)"
7+
>
8+
<dxo-selection
9+
selectAllMode="allPages"
10+
showCheckBoxesMode="onClick"
11+
mode="multiple"
12+
></dxo-selection>
513

614
<dxi-column dataField="Prefix" [width]="60" caption="Title"></dxi-column>
715
<dxi-column dataField="FirstName"></dxi-column>
@@ -11,5 +19,4 @@
1119
<dxi-column dataField="Position" [width]="130"></dxi-column>
1220
<dxi-column dataField="BirthDate" [width]="100" dataType="date"></dxi-column>
1321
<dxi-column dataField="Approved" [visible]="false"></dxi-column>
14-
1522
</dx-data-grid>

Angular/src/app/app.component.ts

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { Component, ViewChild } from '@angular/core';
22
import { DxDataGridComponent } from 'devextreme-angular';
33

4-
import { Employee, Service } from './app.service';
5-
6-
import dxDataGrid from 'devextreme/ui/data_grid';
4+
import dxDataGrid, { SelectionChangedEvent } from 'devextreme/ui/data_grid';
75
import dxCheckBox, {
86
InitializedEvent,
97
ValueChangedEvent,
108
} from 'devextreme/ui/check_box';
11-
import { SelectionChangedEvent } from 'devextreme/ui/data_grid';
9+
import { Employee, Service } from './app.service';
1210
import { EditorPreparingEventEx } from './app.types';
1311

1412
@Component({
@@ -19,10 +17,12 @@ import { EditorPreparingEventEx } from './app.types';
1917
})
2018
export class AppComponent {
2119
@ViewChild(DxDataGridComponent, { static: false })
22-
dataGrid!: DxDataGridComponent;
20+
dataGrid!: DxDataGridComponent;
2321

2422
dataSource: Employee[];
23+
2524
selectAllCheckBox!: dxCheckBox;
25+
2626
checkBoxUpdating = false;
2727

2828
constructor(service: Service) {
@@ -31,11 +31,11 @@ export class AppComponent {
3131
this.onSelectionChanged = this.onSelectionChanged.bind(this);
3232
}
3333

34-
isSelectable(item: Employee) {
34+
isSelectable(item: Employee): boolean {
3535
return item.Approved;
3636
}
3737

38-
isSelectAll = (dataGrid: dxDataGrid) => {
38+
isSelectAll = (dataGrid: dxDataGrid): boolean | undefined => {
3939
const selectableItems = this.dataSource.filter(this.isSelectable);
4040
const selectedRowKeys = dataGrid.option('selectedRowKeys');
4141

@@ -44,19 +44,18 @@ export class AppComponent {
4444
}
4545
return selectedRowKeys.length >= selectableItems.length ? true : undefined;
4646
};
47-
onEditorPreparing(e: EditorPreparingEventEx<Employee, number>) {
47+
48+
onEditorPreparing(e: EditorPreparingEventEx<Employee, number>): void {
4849
if (e.type !== 'selection') return;
4950

50-
if (e.parentType === 'dataRow' && e.row && !this.isSelectable(e.row.data))
51-
e.editorOptions.disabled = true;
51+
if (e.parentType === 'dataRow' && e.row && !this.isSelectable(e.row.data)) e.editorOptions.disabled = true;
5252
if (e.parentType === 'headerRow') {
5353
const dataGrid = e.component;
5454
e.editorOptions.value = this.isSelectAll(dataGrid);
55-
e.editorOptions.onInitialized = (e: InitializedEvent) => {
55+
e.editorOptions.onInitialized = (e: InitializedEvent): void => {
5656
if (e.component) this.selectAllCheckBox = e.component;
5757
};
58-
e.editorOptions.onValueChanged = (e: ValueChangedEvent) => {
59-
58+
e.editorOptions.onValueChanged = (e: ValueChangedEvent): void => {
6059
if (!e.event) {
6160
if (e.previousValue && !this.checkBoxUpdating) {
6261
e.component.option('value', e.previousValue);
@@ -67,22 +66,20 @@ export class AppComponent {
6766
if (this.isSelectAll(dataGrid) === e.value) {
6867
return;
6968
}
70-
7169
e.value ? dataGrid.selectAll() : dataGrid.deselectAll();
7270
e.event.preventDefault();
7371
};
7472
}
7573
}
7674

77-
onSelectionChanged(e: SelectionChangedEvent<Employee, number>) {
75+
async onSelectionChanged(e: SelectionChangedEvent<Employee, number>): Promise<void> {
7876
const deselectRowKeys: number[] = [];
79-
const dataGrid = e.component
77+
const dataGrid = e.component;
8078
e.selectedRowsData.forEach((item) => {
81-
if (!this.isSelectable(item))
82-
deselectRowKeys.push(dataGrid.keyOf(item));
79+
if (!this.isSelectable(item)) deselectRowKeys.push(dataGrid.keyOf(item));
8380
});
8481
if (deselectRowKeys.length) {
85-
dataGrid.deselectRows(deselectRowKeys);
82+
await dataGrid.deselectRows(deselectRowKeys);
8683
}
8784
this.checkBoxUpdating = true;
8885
this.selectAllCheckBox.option('value', this.isSelectAll(dataGrid));

Angular/src/app/app.module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { NgModule } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
3-
import { DxButtonModule } from "devextreme-angular/ui/button";
4-
import { DxDataGridModule } from "devextreme-angular/ui/data-grid"
3+
import { DxButtonModule } from 'devextreme-angular/ui/button';
4+
import { DxDataGridModule } from 'devextreme-angular/ui/data-grid';
55
import { AppRoutingModule } from './app-routing.module';
66
import { AppComponent } from './app.component';
77

88
@NgModule({
99
declarations: [
10-
AppComponent
10+
AppComponent,
1111
],
1212
imports: [
1313
BrowserModule,
1414
AppRoutingModule,
1515
DxDataGridModule,
16-
DxButtonModule
16+
DxButtonModule,
1717
],
1818
providers: [],
19-
bootstrap: [AppComponent]
19+
bootstrap: [AppComponent],
2020
})
2121
export class AppModule { }

Angular/src/app/app.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ let employees: Employee[] = [
7979
BirthDate: '1977/11/22',
8080
HireDate: '1998/04/23',
8181
Notes:
82-
"Greta has been DevAV's HR Manager since 2003. She joined DevAV from Sonee Corp.\r\n\r\nGreta is currently training for the NYC marathon. Her best marathon time is 4 hours. Go Greta.",
82+
'Greta has been DevAV\'s HR Manager since 2003. She joined DevAV from Sonee Corp.\r\n\r\nGreta is currently training for the NYC marathon. Her best marathon time is 4 hours. Go Greta.',
8383
Address: '1700 S Grandview Dr.',
8484
State: 'Georgia',
8585
City: 'Atlanta',
@@ -113,7 +113,7 @@ let employees: Employee[] = [
113113
BirthDate: '1974/11/15',
114114
HireDate: '2005/05/11',
115115
Notes:
116-
"Sandra is a CPA and has been our controller since 2008. She loves to interact with staff so if you've not met her, be certain to say hi.\r\n\r\nSandra has 2 daughters both of whom are accomplished gymnasts.",
116+
'Sandra is a CPA and has been our controller since 2008. She loves to interact with staff so if you\'ve not met her, be certain to say hi.\r\n\r\nSandra has 2 daughters both of whom are accomplished gymnasts.',
117117
Address: '4600 N Virginia Rd.',
118118
State: 'Utah',
119119
City: 'Beaver',
@@ -180,7 +180,7 @@ let employees: Employee[] = [
180180
BirthDate: '1982/08/14',
181181
HireDate: '2012/04/14',
182182
Notes:
183-
"If you are like the rest of us at DevAV, then you've probably reached out for help from Taylor. He does a great job as a member of our IT department.",
183+
'If you are like the rest of us at DevAV, then you\'ve probably reached out for help from Taylor. He does a great job as a member of our IT department.',
184184
Address: '7776 Torreyson Dr',
185185
State: 'California',
186186
City: 'San Jose',
@@ -190,7 +190,7 @@ let employees: Employee[] = [
190190

191191
@Injectable()
192192
export class Service {
193-
getEmployees() {
193+
getEmployees(): Employee[] {
194194
return employees;
195195
}
196196
}

Angular/src/app/app.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import { EditorPreparingEvent } from 'devextreme/ui/data_grid';
22

33
export type EditorPreparingEventEx<TRowData = any, TKey = any> = EditorPreparingEvent<TRowData, TKey> & {
44
type?: string;
5-
}
5+
};

Angular/src/index.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8">
5-
<title>Angular</title>
6-
<base href="/">
7-
<meta name="viewport" content="width=device-width, initial-scale=1">
8-
<link rel="icon" type="image/x-icon" href="favicon.ico">
9-
</head>
10-
<body>
11-
<app-root></app-root>
12-
</body>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Angular</title>
6+
<base href="/" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
9+
</head>
10+
<body>
11+
<app-root></app-root>
12+
</body>
1313
</html>

Angular/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
33
import { AppModule } from './app/app.module';
44

55
platformBrowserDynamic().bootstrapModule(AppModule)
6+
// @eslint-disable-next-line no-console
67
.catch((err) => console.error(err));

0 commit comments

Comments
 (0)