Skip to content

Commit 5723d21

Browse files
authored
Merge branch 'vNext' into ikitanov/list-2988-vNext
2 parents 19b6ead + 5314977 commit 5723d21

17 files changed

Lines changed: 573 additions & 66 deletions

live-editing/configs/CardConfigGenerator.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ IgxChipsModule,
55
IgxDividerModule,
66
IgxExpansionPanelModule,
77
IgxIconModule,
8+
IgxLayoutModule,
89
IgxListModule,
910
IgxRippleModule,
1011
IgxSliderModule} from 'igniteui-angular';
@@ -74,14 +75,16 @@ export class CardConfigGenerator implements IConfigGenerator {
7475
'IgxIconModule',
7576
'IgxCardModule',
7677
'IgxDividerModule',
78+
'IgxLayoutModule',
7779
'CardSample2Component'
7880
],
7981
ngDeclarations: ['CardSample2Component'],
8082
ngImports: [
8183
'IgxButtonModule',
8284
'IgxIconModule',
8385
'IgxCardModule',
84-
'IgxDividerModule'
86+
'IgxDividerModule',
87+
'IgxLayoutModule',
8588
]
8689
}),
8790
additionalFiles: [

live-editing/configs/GridConfigGenerator.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,17 @@ export class GridConfigGenerator implements IConfigGenerator {
14211421
})
14221422
}));
14231423

1424+
configs.push(new Config({
1425+
component: 'GridStatePersistenceSampleComponent',
1426+
additionalFiles: ['/src/app/directives/prevent-scroll.directive.ts', '/src/app/data/financialData.ts', '/src/app/services/financial.service.ts'],
1427+
appModuleConfig: new AppModuleConfig({
1428+
imports: ['GridStatePersistenceSampleComponent', 'IgxAvatarModule', 'IgxGridModule', 'IgxSwitchModule',
1429+
'IgxExcelExporterService', 'IgxCsvExporterService', 'IgxPreventDocumentScrollModule', 'FinancialDataService'],
1430+
ngDeclarations: ['GridStatePersistenceSampleComponent'],
1431+
ngImports: ['IgxPreventDocumentScrollModule', 'IgxAvatarModule', 'IgxGridModule', 'IgxSwitchModule'],
1432+
ngProviders: ['FinancialDataService']
1433+
})
1434+
}));
14241435

14251436
return configs;
14261437
}

live-editing/configs/TreeGridConfigGenerator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,9 @@ export class TreeGridConfigGenerator implements IConfigGenerator {
654654
additionalFiles: [
655655
'/src/app/directives/prevent-scroll.directive.ts',
656656
'/src/app/tree-grid/tree-grid-group-by-load-on-demand-sample/remoteService.ts',
657-
'/src/app/data/invoiceData.ts'
657+
'/src/app/data/invoiceData.ts',
658+
'/src/_variables.scss',
659+
'/src/_app-layout.scss'
658660
],
659661
appModuleConfig: new AppModuleConfig({
660662
imports: ['IgxPreventDocumentScrollModule', 'IgxTreeGridModule', 'TreeGridGroupByLoadOnDemandComponent'],

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

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
1-
<div class="grid__wrapper">
2-
<span class="button-group-wrapper">
3-
<igx-buttongroup [values]="selectionModes" (selected)="selectCellSelectionMode($event)"></igx-buttongroup>
4-
</span>
5-
<igx-grid [igxPreventDocumentScroll]="true" #grid [data]="data" [height]="'600px'" [width]="'100%'" [cellSelection]="selectionMode">
6-
<igx-column [field]="'ProductID'"></igx-column>
7-
<igx-column [field]="'ProductName'"></igx-column>
8-
<igx-column [field]="'UnitsInStock'" [dataType]="'number'"></igx-column>
9-
<igx-column [field]="'UnitPrice'" [dataType]="'number'"></igx-column>
10-
<igx-column [field]="'Discontinued'" [dataType]="'boolean'">
11-
</igx-column>
12-
<igx-column [field]="'OrderDate'" [dataType]="'date'"></igx-column>
13-
</igx-grid>
1+
<span class="button-group-wrapper">
2+
<igx-buttongroup [values]="selectionModes" (selected)="selectCellSelectionMode($event)"></igx-buttongroup>
3+
</span>
4+
<div class="sample-wrapper">
5+
<div class="grid-wrapper">
6+
<igx-grid [igxPreventDocumentScroll]="true" #grid [data]="data" [height]="'550px'" [cellSelection]="selectionMode"
7+
(rangeSelected)="onRangeSelected()"
8+
(selected)="onCellSelected($event)"
9+
>
10+
<igx-column [field]="'ProductID'"></igx-column>
11+
<igx-column [field]="'ProductName'"></igx-column>
12+
<igx-column [field]="'UnitsInStock'" [dataType]="'number'"></igx-column>
13+
<igx-column [field]="'UnitPrice'" [dataType]="'number'"></igx-column>
14+
<igx-column [field]="'Discontinued'" [dataType]="'boolean'">
15+
</igx-column>
16+
<igx-column [field]="'OrderDate'" [dataType]="'date'"></igx-column>
17+
</igx-grid>
18+
</div>
19+
<div class="log-wrapper">
20+
<div class="selected-data-area">
21+
<div class="logContainer">
22+
<div class="highlight">
23+
<span>Events execution sequence</span>
24+
<button class="clearBtn" igxButton="flat" (click)="clearLog()">
25+
<igx-icon>clear</igx-icon>
26+
<span>Clear log</span>
27+
</button>
28+
</div>
29+
<hr />
30+
<div #logger class="logger"></div>
31+
</div>
32+
</div>
33+
</div>
1434
</div>
1535

1636
<igx-snackbar #snackbar actionText="Got it. Thanks!" (clicked)="snackbar.close()">

src/app/grid/grid-cellSelection-sample/grid-cellSelection.component.scss

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
:host {
2+
width: 100%;
3+
}
4+
15
.grid__wrapper {
26
display: flex;
37
justify-content: space-between;
@@ -8,7 +12,8 @@
812
}
913

1014
.button-group-wrapper {
11-
margin-bottom: 16px;
15+
display: flex;
16+
margin: 10px;
1217
}
1318

1419
.igx-snackbar {
@@ -21,3 +26,49 @@
2126
margin: 20px;
2227
}
2328
}
29+
30+
.switches {
31+
margin-top: 12px;
32+
margin-bottom: 8px;
33+
width: 100%;
34+
display: flex;
35+
justify-content: space-around;
36+
}
37+
38+
.sample-wrapper {
39+
display: flex;
40+
flex-flow: row wrap;
41+
width: 100%;
42+
}
43+
44+
.grid-wrapper {
45+
width: 60%;
46+
margin: 8px;
47+
}
48+
.log-wrapper {
49+
width: 35%;
50+
}
51+
52+
.clearBtn {
53+
top: 3px;
54+
margin-left: 20px;
55+
}
56+
57+
.selected-data-area{
58+
overflow-y: auto;
59+
max-height: 550px;
60+
width: 100%;
61+
height: 100%;
62+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 2px 1px -1px rgba(0, 0, 0, 0.12);
63+
margin-top: 8px;
64+
}
65+
66+
.logContainer {
67+
padding: 0.2rem 0.4rem;
68+
}
69+
70+
.highlight {
71+
text-align: center;
72+
margin-bottom: 0.4rem;
73+
}
74+

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, ViewChild } from '@angular/core';
1+
import { Component, ElementRef, OnInit, Renderer2, ViewChild } from '@angular/core';
22
import { GridSelectionMode, IgxGridComponent, IgxSnackbarComponent } from 'igniteui-angular';
33
import { DATA } from '../../data/nwindData';
44

@@ -10,12 +10,13 @@ import { DATA } from '../../data/nwindData';
1010
export class GridCellSelectionComponent implements OnInit {
1111
@ViewChild('grid', { static: true }) public grid: IgxGridComponent;
1212
@ViewChild(IgxSnackbarComponent, { static: true }) public snackbar: IgxSnackbarComponent;
13+
@ViewChild('logger') public logger: ElementRef;
1314
public data: any[];
1415
public selection = true;
1516
public selectionMode: GridSelectionMode = 'multiple';
1617
public selectionModes = [];
1718

18-
constructor() { }
19+
constructor(private renderer: Renderer2) { }
1920

2021
public ngOnInit(): void {
2122
this.data = DATA;
@@ -32,4 +33,33 @@ export class GridCellSelectionComponent implements OnInit {
3233
this.selectionMode = this.selectionModes[args.index].label;
3334
this.snackbar.open();
3435
}
36+
37+
public onRangeSelected() {
38+
const selectedData = JSON.stringify(this.grid.getSelectedData());
39+
this.logAnEvent(`=> 'rangeSelected' with value: ` + selectedData);
40+
}
41+
42+
public onCellSelected(event) {
43+
this.logAnEvent(`=> 'selected' with value: ` + event.cell.value);
44+
}
45+
46+
public clearLog() {
47+
const elements = this.logger.nativeElement.querySelectorAll('p');
48+
for (let index = 0; index < elements.length; index++) {
49+
this.renderer.removeChild(this.logger.nativeElement, elements[index]);
50+
}
51+
}
52+
53+
private logAnEvent(msg: string, canceled?: boolean) {
54+
const createElem = this.renderer.createElement('p');
55+
56+
if (canceled) {
57+
msg = msg.concat(': has been canceled ');
58+
}
59+
60+
const text = this.renderer.createText(msg);
61+
this.renderer.appendChild(createElem, text);
62+
const container = this.logger.nativeElement;
63+
this.renderer.insertBefore(container, createElem, container.children[0]);
64+
}
3565
}

src/app/grid/grid-composite-data-binding/grid-composite-data.component.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
margin-bottom:5px;
2222
margin-top:3px;
2323
}
24+
25+
&--edit div{
26+
display: flex;
27+
flex-direction: column;
28+
margin-left: 10px;
29+
}
2430
}
2531

2632
.grid__wrapper {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { DATA } from '../../data/nwindData';
66
selector: 'app-grid-contextmenu-sample',
77
styleUrls: ['./grid-contextmenu-sample.component.scss'],
88
templateUrl: './grid-contextmenu-sample.component.html'
9-
109
})
1110

1211
export class GridContextmenuSampleComponent implements OnInit {

src/app/grid/grid-routes-data.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,6 @@ export const gridsRoutesData = {
123123
'grid-cross-field-validator-service': { displayName: 'Grid Cross Field Validator Service ', parentName: 'Grid' },
124124
'grid-validation-style': { displayName: 'Grid with Validation Styles', parentName: 'Grid' },
125125
'grid-validator-service-extended': { displayName: 'Grid Validator Service Extended', parentName: 'Grid'},
126-
'grid-summary-export': { displayName: 'Grid Summary Export', parentName: 'Grid'}
126+
'grid-summary-export': { displayName: 'Grid Summary Export', parentName: 'Grid'},
127+
'grid-state-persistence': { displayName: 'Grid State Persistence', parentName: 'Grid'}
127128
};

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

Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,68 @@
44
<igx-switch [(ngModel)]="hideRowSelectors">Hide Row Selectors</igx-switch>
55
<igx-buttongroup [values]="selectionModes" (selected)="selectCellSelectionMode($event)"></igx-buttongroup>
66
</div>
7-
<igx-grid [igxPreventDocumentScroll]="true" #grid1 [data]="data | async" [height]="'530px'" [primaryKey]="'ID'" width="100%" [cellSelection]="'none'"
8-
[rowSelection]="selectionMode" [selectedRows]="selectedRows" [hideRowSelectors]="hideRowSelectors" [allowFiltering]="true"
9-
(rowSelectionChanging)="handleRowSelection($event)">
10-
<igx-column [field]="'Category'"></igx-column>
11-
<igx-column [field]="'Type'" [filterable]='false'></igx-column>
12-
<igx-column [field]="'Price'" dataType="number" [formatter]="formatCurrency"></igx-column>
13-
<igx-column [field]="'Buy'" dataType="number" [formatter]="formatCurrency"></igx-column>
14-
<igx-column [field]="'Sell'" dataType="number" [formatter]="formatCurrency"></igx-column>
15-
<igx-column [field]="'Change'" dataType="number" [headerClasses]="'headerAlignSyle'">
16-
<ng-template igxHeader>
17-
<span>Change</span>
18-
</ng-template>
19-
<ng-template igxCell let-val>
20-
<div class="currency-badge-container">
21-
<igx-badge *ngIf="val>0" type="success" position="bottom-right" icon="arrow_upward"
22-
class="badge-left"></igx-badge>
23-
<igx-badge *ngIf="val<0" type="error" position="bottom-right" icon="arrow_downward"
24-
class="error badge-left"></igx-badge>
25-
<span class="cellAlignSyle" [class.up]="val>0" [class.down]="val<0">{{ formatNumber(val) }}</span>
26-
</div>
27-
</ng-template>
28-
</igx-column>
29-
<igx-column [field]="'Change(%)'" dataType="number" [formatter]="formatNumber">
30-
<ng-template igxHeader>
31-
<span>Change(%)</span>
32-
</ng-template>
33-
34-
<ng-template igxCell let-val>
35-
<span class="cellAlignSyle" [class.up]="val>0" [class.down]="val<0">{{ formatNumber(val) }}%</span>
36-
</ng-template>
37-
</igx-column>
38-
<igx-column [field]="'Change On Year(%)'" dataType="number" [formatter]="formatNumber">
39-
<ng-template igxCell let-val>
40-
<div class="currency-badge-container">
41-
<igx-badge *ngIf="val>0" type="success" position="bottom-right" icon="arrow_upward"
42-
class="badge-left"></igx-badge>
43-
<igx-badge *ngIf="val<0" type="error" position="bottom-right" icon="arrow_downward"
44-
class="error badge-left"></igx-badge>
7+
<div class="sample-wrapper">
8+
<div class="grid-wrapper">
9+
<igx-grid [igxPreventDocumentScroll]="true" #grid1 [data]="data | async" [height]="'550px'" [primaryKey]="'ID'" width="100%" [cellSelection]="'none'"
10+
[rowSelection]="selectionMode" [selectedRows]="selectedRows" [hideRowSelectors]="hideRowSelectors" [allowFiltering]="true"
11+
(rowSelectionChanging)="handleRowSelection($event)">
12+
<igx-column [field]="'Category'"></igx-column>
13+
<igx-column [field]="'Type'" [filterable]='false'></igx-column>
14+
<igx-column [field]="'Price'" dataType="number" [formatter]="formatCurrency"></igx-column>
15+
<igx-column [field]="'Buy'" dataType="number" [formatter]="formatCurrency"></igx-column>
16+
<igx-column [field]="'Sell'" dataType="number" [formatter]="formatCurrency"></igx-column>
17+
<igx-column [field]="'Change'" dataType="number" [headerClasses]="'headerAlignSyle'">
18+
<ng-template igxHeader>
19+
<span>Change</span>
20+
</ng-template>
21+
<ng-template igxCell let-val>
22+
<div class="currency-badge-container">
23+
<igx-badge *ngIf="val>0" type="success" position="bottom-right" icon="arrow_upward"
24+
class="badge-left"></igx-badge>
25+
<igx-badge *ngIf="val<0" type="error" position="bottom-right" icon="arrow_downward"
26+
class="error badge-left"></igx-badge>
27+
<span class="cellAlignSyle" [class.up]="val>0" [class.down]="val<0">{{ formatNumber(val) }}</span>
28+
</div>
29+
</ng-template>
30+
</igx-column>
31+
<igx-column [field]="'Change(%)'" dataType="number" [formatter]="formatNumber">
32+
<ng-template igxHeader>
33+
<span>Change(%)</span>
34+
</ng-template>
35+
36+
<ng-template igxCell let-val>
4537
<span class="cellAlignSyle" [class.up]="val>0" [class.down]="val<0">{{ formatNumber(val) }}%</span>
38+
</ng-template>
39+
</igx-column>
40+
<igx-column [field]="'Change On Year(%)'" dataType="number" [formatter]="formatNumber">
41+
<ng-template igxCell let-val>
42+
<div class="currency-badge-container">
43+
<igx-badge *ngIf="val>0" type="success" position="bottom-right" icon="arrow_upward"
44+
class="badge-left"></igx-badge>
45+
<igx-badge *ngIf="val<0" type="error" position="bottom-right" icon="arrow_downward"
46+
class="error badge-left"></igx-badge>
47+
<span class="cellAlignSyle" [class.up]="val>0" [class.down]="val<0">{{ formatNumber(val) }}%</span>
48+
</div>
49+
</ng-template>
50+
</igx-column>
51+
</igx-grid>
52+
</div>
53+
<div class="log-wrapper">
54+
<div class="selected-data-area">
55+
<div class="logContainer">
56+
<div class="highlight">
57+
<span>Events execution sequence</span>
58+
<button class="clearBtn" igxButton="flat" (click)="clearLog()">
59+
<igx-icon>clear</igx-icon>
60+
<span>Clear log</span>
61+
</button>
62+
</div>
63+
<hr />
64+
<div #logger class="logger"></div>
4665
</div>
47-
</ng-template>
48-
</igx-column>
49-
</igx-grid>
66+
</div>
67+
</div>
68+
</div>
5069
</div>
5170

5271
<igx-snackbar #snackbarRowCount actionText="Got it. Thanks!" (clicked)="snackbarRowCount.close()">

0 commit comments

Comments
 (0)