Skip to content

Commit e3227c3

Browse files
committed
chore(demos): cleanup type check errors
1 parent e832bc3 commit e3227c3

File tree

17 files changed

+50
-46
lines changed

17 files changed

+50
-46
lines changed

src/app/grid-cellEditing/grid-cellEditing.component.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ <h3>Grid with primary key ProductID</h3>
2525
<igx-column field="ReorderLevel" width="200px" [sortable]="true" [filterable]="true" [editable]="true" [dataType]="'number'" [hasSummary]="false">
2626
</igx-column>
2727
<igx-column field="ProductName" width="200px" [groupable]="kk" [header]="pname" [sortable]="true" [dataType]="'string'" [editable]="true" [resizable]="true">
28-
<ng-template igxCellValidationError let-cell='cell'>
29-
<div *ngIf="cell.formGroup?.get(cell.column?.field).errors?.['forbiddenName']">
30-
This name is forbidden.
31-
</div>
32-
</ng-template>
3328
</igx-column>
3429
<igx-column required field="UnitsInStock" header="UnitsInStock" width="200px" [dataType]="'number'" [editable]="true" [sortable]="true" [hasSummary]="false">
3530
</igx-column>
@@ -74,4 +69,4 @@ <h3>Grid without PK</h3>
7469
<igx-paginator [perPage]="10"></igx-paginator>
7570
</igx-grid>
7671
<button (click)="moveColumns()">Move OrderDate and ProductName</button>
77-
<button (click)="updateSelectedCell()">Update Selected Cell</button>
72+
<button (click)="updateSelectedCell()">Update Selected Cell</button>

src/app/grid-cellEditing/grid-cellEditing.component.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ export class GridCellEditingComponent {
167167
const secColumn = this.gridWithoutPK.getColumnByName('OrderDate');
168168
this.gridWithoutPK.moveColumn(column, secColumn);
169169
}
170-
public checkValid(cell) {
171-
debugger;
172-
return cell.formGroup?.get(cell.column?.field).errors?.['appForbiddenName'];
173-
}
174170
public updateSelectedCell() {
175171
let newValue;
176172
const selectedCell = this.gridWithoutPK.selectedCells[0];

src/app/grid-filter-template/grid-filter-template.sample.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import {
55
IgxNumberFilteringOperand,
66
IgxDateFilteringOperand,
77
IgxStringFilteringOperand,
8-
IgxColumnComponent,
8+
// ColumnType,
99
GridSelectionMode
1010
} from 'igniteui-angular';
11+
import { ColumnType } from 'projects/igniteui-angular/src/lib/grids/common/grid.interface';
1112

1213
@Component({
1314
providers: [],
@@ -511,7 +512,7 @@ export class GridFilterTemplateSampleComponent implements OnInit {
511512
this.selectionMode = GridSelectionMode.multiple;
512513
}
513514

514-
public onInput(input: any, column: IgxColumnComponent) {
515+
public onInput(input: any, column: ColumnType) {
515516
let operand = null;
516517
let value = input.value;
517518

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="dark-grid">
2-
<igx-grid batchEditing ='true' #grid1 [data]="remoteData | async" [height]="'500px'" [width]="'100%'" [autoGenerate]='true' (dataPreLoad)="handlePreLoad()" [clipboardOptions]="clipboardOptions"
3-
(sortingDone)="processData(true)" (columnInit)='onColumnInit($event)'>
2+
<igx-grid [batchEditing]="true" #grid1 [data]="remoteData | async" height="500px" width="100%" [autoGenerate]="true" (dataPreLoad)="handlePreLoad()" [clipboardOptions]="clipboardOptions"
3+
(sortingDone)="processData(true)" (columnInit)="onColumnInit($event)">
44
</igx-grid>
55
</div>

src/app/grid-summaries/grid-summaries.sample.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="density-chooser">
22
<igx-buttongroup [values]="displayDensities" (selected)="selectDensity($event)"></igx-buttongroup>
33
</div>
4-
<igx-grid #grid1 [pinning]="pinningConfig" [data]="data" [autoGenerate]="false" [displayDensity]="'compact'" [width]="w" [height]="h"
4+
<igx-grid #grid1 [pinning]="pinningConfig" [data]="data" [autoGenerate]="false" [width]="w" [height]="h"
55
[allowFiltering]="true" [filterMode]="'excelStyleFilter'" [summaryCalculationMode]="'rootAndChildLevels'" [showSummaryOnCollapse]="true"
66
[summaryRowHeight]="rh" [rowSelection]="rowSelection ? 'multiple' : 'none'" [displayDensity]="density">
77
<igx-grid-toolbar *ngIf="showToolbar" [displayDensity]="grid1.displayDensity">

src/app/grid-summaries/grid-summaries.sample.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
IgxNumberSummaryOperand,
55
IgxSummaryResult,
66
ColumnPinningPosition,
7-
IPinningConfig
7+
IPinningConfig,
8+
DisplayDensity
89
} from 'igniteui-angular';
910

1011
class MySummary extends IgxNumberSummaryOperand {
@@ -52,7 +53,7 @@ export class GridSummaryComponent implements OnInit {
5253
public columnPinning = false;
5354
public pinningConfig: IPinningConfig = { columns: ColumnPinningPosition.End };
5455
public rowSelection = false;
55-
public density = 'compact';
56+
public density: DisplayDensity = 'compact';
5657
public displayDensities;
5758

5859
public data = [{

src/app/grid-validation/grid-validation.sample.component.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h4>Grid without transactions</h4>
44
<igx-switch [(ngModel)]="rowEditNoTransactions">Row edit</igx-switch>
55
<igx-grid [rowStyles]="rowStyles" validationTrigger='change' (validationStatusChange)='validationChange($event)' (cellEdit)='cellEdit($event)' (formGroupCreated)='formCreateHandler($event)' #gridNoTransactions primaryKey="ProductID" [data]="data" [rowEditable]="rowEditNoTransactions"
66
[width]="'1200px'" [height]="'800px'">
7-
<igx-column [field]="" editable='false'>
7+
<igx-column [field]="" [editable]='false'>
88
<ng-template igxCell let-cell="cell">
99
{{cell.row.validation.status}}
1010
</ng-template>
@@ -13,7 +13,7 @@ <h4>Grid without transactions</h4>
1313
<igx-column field='ProductName' appForbiddenName='bob' required [editable]='true'>
1414
<ng-template igxCellEditor let-cell="cell" let-value let-fc='formControl'>
1515
<input [(ngModel)]="cell.editValue"/>
16-
</ng-template>
16+
</ng-template>
1717
<ng-template igxCellValidationError let-cell='cell' let-defaultErr='defaultErrorTemplate'>
1818
<ng-container *ngTemplateOutlet="defaultErr" >
1919
</ng-container>
@@ -65,15 +65,14 @@ <h4>Grid with transactions</h4>
6565
<h4>TreeGrid</h4>
6666
<igx-tree-grid #treegrid [data]="treeData" primaryKey="employeeID" [rowStyles]="rowStyles"
6767
foreignKey="PID" [width]="'900px'" [height]="'800px'" [rowEditable]="true" [moving]="true">
68-
<igx-column [field]="" editable='false'>
68+
<igx-column [field]="" [editable]='false'>
6969
<ng-template igxCell let-cell="cell">
7070
{{cell.row.validation.status}}
7171
</ng-template>
7272
</igx-column>
7373
<igx-column *ngFor="let c of treeColumns" [field]="c.field" [dataType]="c.dataType" [header]="c.label"
74-
[pinned]="c.pinned" [groupable]="false" [resizable]="c.resizable" [width]="c.width"
75-
[sortable]="true" [filterable]="true" [editable]="true" [hidden]="c.hidden" [minWidth]="c.minWidth"
76-
[maxWidth]="c.maxWidth" required>
74+
[groupable]="false" [resizable]="c.resizable" [width]="c.width.toString()"
75+
[sortable]="true" [filterable]="true" [editable]="true" required>
7776
</igx-column>
7877
<igx-action-strip #actionstrip>
7978
<igx-grid-editing-actions [addRow]="true" [addChild]="actionstrip.context?.treeRow.level < 1">
@@ -87,10 +86,10 @@ <h4>TreeGrid</h4>
8786
<h4>Hierarchical Grid</h4>
8887
<igx-hierarchical-grid #hgrid [data]="hGridData" primaryKey="EmployeeID"
8988
[width]="'900px'" [height]="'550px'" [rowEditable]="true" [moving]="true">
90-
<igx-column *ngFor="let c of hColumns" [field]="c.field" required editable='true'>
89+
<igx-column *ngFor="let c of hColumns" [field]="c.field" required [editable]='true'>
9190
</igx-column>
9291
<igx-row-island [key]="'Orders'" [autoGenerate]="false">
93-
<igx-column *ngFor="let c of hColumns2" [field]="c.field" required appForbiddenName='bob' editable='true'>
92+
<igx-column *ngFor="let c of hColumns2" [field]="c.field" required appForbiddenName='bob' [editable]='true'>
9493
<ng-template igxCellValidationError let-cell='cell' let-defaultErr='defaultErrorTemplate'>
9594
<ng-container *ngTemplateOutlet="defaultErr" >
9695
</ng-container>

src/app/grid-validation/grid-validation.sample.component.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, Directive, ViewChild, Input } from '@angular/core';
22
import { data } from '../shared/data';
33

4-
import { IgxGridComponent, IRecordValidationState, IgxGridValidationService, IGridValidationStatusEventArgs, RowType } from 'igniteui-angular';
4+
import { IgxGridComponent, IRecordValidationState, IgxGridValidationService, IGridValidationStatusEventArgs, RowType, GridColumnDataType, IGridFormGroupCreatedEventArgs } from 'igniteui-angular';
55
import { AbstractControl, FormGroup, NG_VALIDATORS, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';
66
import { HIERARCHICAL_DATA } from '../shared/hierarchicalData';
77

@@ -40,7 +40,7 @@ export class GridValidationSampleComponent {
4040
public rowStyles = {
4141
background: (row: RowType) => {
4242
return row.validation.status === 'INVALID' ? '#FF000033' : '#00000000';
43-
}
43+
}
4444
};
4545
public columns = [
4646
{ field: 'ProductID' },
@@ -49,7 +49,14 @@ export class GridValidationSampleComponent {
4949
{ field: 'UnitsInStock' }
5050
];
5151

52-
public treeColumns = [
52+
public treeColumns: {
53+
field: string;
54+
label: string;
55+
width: number;
56+
resizable: boolean;
57+
dataType: GridColumnDataType;
58+
hasSummary: boolean;
59+
}[] = [
5360
{ field: 'employeeID', label: 'ID', width: 200, resizable: true, dataType: 'number', hasSummary: false },
5461
{ field: 'Salary', label: 'Salary', width: 200, resizable: true, dataType: 'number', hasSummary: true },
5562
{ field: 'firstName', label: 'First Name', width: 300, resizable: true, dataType: 'string', hasSummary: false },
@@ -154,7 +161,7 @@ public hColumns2 = [
154161
// }
155162
}
156163

157-
public formCreateHandler(formGr: FormGroup) {
164+
public formCreateHandler(formGr: IGridFormGroupCreatedEventArgs) {
158165
// can add validators here
159166
// const prodName = formGr.get('ProductName');
160167
// prodName.addValidators(forbiddenNameValidator(/bob/i));

src/app/grid/grid.sample.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ <h4>{{ col.field }}</h4>
150150
<ng-template igxHeader let-column="column">
151151
<p style="color: crimson">{{column.field}}</p>
152152
</ng-template>
153-
<ng-template igxCell let-item="item" let-ri="rowIndex" let-column="column">
154-
<igx-checkbox [checked]="item" (change)="grid2.updateCell($event.checkbox.checked, ri, column?.field)"></igx-checkbox>
153+
<ng-template igxCell let-value let-cell="cell">
154+
<igx-checkbox [checked]="value" (change)="grid2.updateCell($event.checkbox.checked, cell.row.key, cell.column.field)"></igx-checkbox>
155155
</ng-template>
156156
</igx-column>
157157
<igx-paginator [perPage]="10"></igx-paginator>
@@ -193,8 +193,8 @@ <h4 class="sample-title">Grid with templated cell remote data</h4>
193193
<ng-template igxHeader let-column="column">
194194
<p style="color: crimson">{{column.field</p>
195195
</ng-template>
196-
<ng-template igxCell let-item="item" let-ri="rowIndex" let-column="column">
197-
<igx-checkbox [checked]="item" (change)="grid3.updateCell($event.checkbox.checked, ri, column?.field)"></igx-checkbox>
196+
<ng-template igxCell let-item let-cell="cell">
197+
<igx-checkbox [checked]="item" (change)="grid3.updateCell($event.checkbox.checked, cell.row.key, cell.column.field)"></igx-checkbox>
198198
</ng-template>
199199
</igx-column>
200200
<igx-paginator [perPage]="10"></igx-paginator>

src/app/hierarchical-grid-remote/hierarchical-grid-remote.sample.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<igx-column field="Phone"></igx-column>
1616
<igx-row-island #rowIsland1 [key]="'Orders'" [primaryKey]="'OrderID'" [autoGenerate]="false" [rowSelection]='selectionMode' (gridCreated)="gridCreated($event, rowIsland1)" [emptyGridMessage]="''">
1717
<igx-grid-toolbar [grid]="grid" *igxGridToolbar="let grid">
18-
<igx-grid-toolbar-title>Child Toolbar - Level {{ grid.parentIsland.level }}</igx-grid-toolbar-title>
18+
<igx-grid-toolbar-title>Child Toolbar - Level 2</igx-grid-toolbar-title>
1919
<igx-grid-toolbar-actions>
2020
<igx-grid-toolbar-pinning></igx-grid-toolbar-pinning>
2121
</igx-grid-toolbar-actions>
@@ -27,7 +27,7 @@
2727
<igx-column field="ShipAddress"></igx-column>
2828
<igx-row-island #rowIsland2 [key]="'Order_Details'" [primaryKey]="'ProductID'" [autoGenerate]="false" [rowSelection]='selectionMode' (gridCreated)="gridCreated($event, rowIsland2)" [emptyGridMessage]="''">
2929
<igx-grid-toolbar [grid]="grid" *igxGridToolbar="let grid">
30-
<igx-grid-toolbar-title>Child Toolbar - Level {{ grid.parentIsland.level }}</igx-grid-toolbar-title>
30+
<igx-grid-toolbar-title>Child Toolbar - Level 3</igx-grid-toolbar-title>
3131
<igx-grid-toolbar-actions>
3232
<igx-grid-toolbar-pinning></igx-grid-toolbar-pinning>
3333
<igx-grid-toolbar-hiding></igx-grid-toolbar-hiding>

0 commit comments

Comments
 (0)