-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(grid): add row editing styling samples #1248
- Loading branch information
1 parent
24891b6
commit ccfef05
Showing
21 changed files
with
442 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/app/grid/grid-row-editing-style/grid-row-editing-style.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<div class="sample-wrapper"> | ||
<igx-grid #gridRowEdit [data]="data" [primaryKey]="'ProductID'" width="100%" height="500px" [rowEditable]="true"> | ||
<igx-column field="ProductID" header="Product ID"></igx-column> | ||
<igx-column field="ReorderLevel" header="ReorderLever" [dataType]="'number'"></igx-column> | ||
<igx-column field="ProductName" header="ProductName" [dataType]="'string'"></igx-column> | ||
<igx-column field="UnitsInStock" header="UnitsInStock" [dataType]="'number'"> | ||
<!--The following template can be omitted (grid handles this internally) but it is here as an example of custom cell editor.--> | ||
<ng-template igxCellEditor let-cell="cell"> | ||
<igx-input-group> | ||
<input igxInput [igxFocus]='true' name="units" [(ngModel)]="cell.value" style="color: black" /> | ||
</igx-input-group> | ||
</ng-template> | ||
</igx-column> | ||
<igx-column field="OrderDate" [dataType]="'date'"></igx-column> | ||
<igx-column field="Discontinued" header="Discontinued" [dataType]="'boolean'"></igx-column> | ||
<ng-template igxRowEditText let-rowChangesCount> | ||
<span class="changes"> Changes: {{rowChangesCount}}</span> | ||
|
||
</ng-template> | ||
<ng-template igxRowEditActions let-endRowEdit> | ||
<span class="custom-failure"> | ||
<button igxButton="icon" class="custom-button" igxRowEditTabStop (click)="endRowEdit(false)"> | ||
<igx-icon>clear</igx-icon> | ||
</button> | ||
</span> | ||
<span class="custom-success"> | ||
<button igxButton="icon" class="custom-button" igxRowEditTabStop (click)="endRowEdit(true)"> | ||
<igx-icon>check</igx-icon> | ||
</button> | ||
</span> | ||
</ng-template> | ||
</igx-grid> | ||
</div> |
64 changes: 64 additions & 0 deletions
64
src/app/grid/grid-row-editing-style/grid-row-editing-style.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
@import '~igniteui-angular/lib/core/styles/themes/index'; | ||
|
||
$button-color: igx-color($default-palette, "primary", 400); | ||
$changes-color: igx-color($default-palette, "primary", 400); | ||
$banner-color: igx-color($default-palette, "primary", 400); | ||
$editing-color: igx-contrast($default-palette, "primary", 200); | ||
$success: igx-color($default-palette, "success", 500); | ||
$failure: igx-color($default-palette, "error", 500); | ||
|
||
$my-success-error-palette: igx-palette($primary: $success, $secondary: $failure); | ||
|
||
$custom-grid: igx-grid-theme( | ||
$cell-editing-background: igx-color($default-palette, "primary", 200) | ||
); | ||
|
||
.sample-wrapper { | ||
margin: 0 auto; | ||
padding: 5px; | ||
} | ||
|
||
$input-group: igx-input-group-theme( | ||
$filled-text-color: $editing-color, | ||
$focused-text-color: $editing-color, | ||
$idle-text-color: $editing-color | ||
); | ||
|
||
$banner-theme: igx-banner-theme( | ||
$banner-background: igx-color($default-palette, "primary", 100), | ||
$banner-message-color: igx-contrast($default-palette, "primary", 100), | ||
$banner-border-color: igx-color($default-palette, "second", 800) | ||
); | ||
|
||
$button-theme-success: igx-button-theme( | ||
$icon-color: igx-contrast($my-success-error-palette, "primary", 200), | ||
$icon-hover-color: igx-contrast($my-success-error-palette, "primary", 600), | ||
$icon-focus-color: igx-contrast($my-success-error-palette, "primary", 300), | ||
$icon-background: igx-color($my-success-error-palette, "primary", 200), | ||
$icon-hover-background: igx-color($my-success-error-palette, "primary", 600), | ||
$icon-focus-background: igx-color($my-success-error-palette, "primary", 300) | ||
); | ||
$button-theme-failure: igx-button-theme( | ||
$icon-color: igx-contrast($my-success-error-palette, "secondary", 200), | ||
$icon-hover-color: igx-contrast($my-success-error-palette, "secondary", 600), | ||
$icon-focus-color: igx-contrast($my-success-error-palette, "secondary", 300), | ||
$icon-background: igx-color($my-success-error-palette, "secondary", 200), | ||
$icon-hover-background: igx-color($my-success-error-palette, "secondary", 600), | ||
$icon-focus-background: igx-color($my-success-error-palette, "secondary", 300) | ||
); | ||
|
||
.custom-failure { | ||
@include igx-button($button-theme-failure); | ||
} | ||
|
||
.custom-success { | ||
@include igx-button($button-theme-success); | ||
} | ||
|
||
::ng-deep { | ||
.sample-wrapper { | ||
@include igx-grid($custom-grid); | ||
@include igx-input-group($input-group); | ||
@include igx-banner($banner-theme); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/app/grid/grid-row-editing-style/grid-row-editing-style.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Component, ViewChild } from "@angular/core"; | ||
import { DATA } from "../../data/nwindData"; | ||
|
||
import { IgxGridComponent } from "igniteui-angular"; | ||
|
||
@Component({ | ||
selector: "app-grid-row-edit-style", | ||
styleUrls: [`grid-row-editing-style.component.scss`], | ||
templateUrl: "grid-row-editing-style.component.html" | ||
}) | ||
export class GridRowEditStyleComponent { | ||
@ViewChild("gridRowEdit", { read: IgxGridComponent, static: true }) public gridRowEdit: IgxGridComponent; | ||
|
||
public data: any[]; | ||
|
||
constructor() { | ||
this.data = DATA; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...cal-grid/hierarchical-grid-row-edit-style/hierarchical-grid-row-edit-style.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<igx-hierarchical-grid #hierarchicalGrid class="hgrid" [data]="localdata" [primaryKey]="'Photo'" [autoGenerate]="false" | ||
[height]="'500px'" [width]="'100%'" [rowHeight]="'65px'" [rowEditable]="true"> | ||
<igx-column field="Artist"></igx-column> | ||
<igx-column field="Photo" [editable]="false"> | ||
<ng-template igxCell let-cell="cell"> | ||
<div class="cell__inner_2"> | ||
<img [src]="cell.value" class="photo" /> | ||
</div> | ||
</ng-template> | ||
</igx-column> | ||
<igx-column field="Debut"></igx-column> | ||
<igx-column field="Grammy Nominations" [dataType]="'number'"></igx-column> | ||
<igx-column field="Grammy Awards" [dataType]="'number'"></igx-column> | ||
|
||
<igx-row-island [key]="'Albums'" [autoGenerate]="false" [primaryKey]="'Album'" [rowEditable]="true"> | ||
<igx-column field="Album"></igx-column> | ||
<igx-column field="Launch Date" [dataType]="'date'"></igx-column> | ||
<igx-column field="Billboard Review"></igx-column> | ||
<igx-column field="US Billboard 200"></igx-column> | ||
<igx-row-island [key]="'Songs'" [autoGenerate]="false"> | ||
<igx-column field="No."></igx-column> | ||
<igx-column field="Title"></igx-column> | ||
<igx-column field="Released"></igx-column> | ||
<igx-column field="Genre"></igx-column> | ||
</igx-row-island> | ||
</igx-row-island> | ||
|
||
<igx-row-island [key]="'Tours'" [autoGenerate]="false"> | ||
<igx-column field="Tour"></igx-column> | ||
<igx-column field="Started on"></igx-column> | ||
<igx-column field="Location"></igx-column> | ||
<igx-column field="Headliner"></igx-column> | ||
</igx-row-island> | ||
<ng-template igxRowEditText let-rowChangesCount> | ||
<span class="changes"> Changes: {{rowChangesCount}}</span> | ||
</ng-template> | ||
<ng-template igxRowEditActions let-endRowEdit> | ||
<span class="custom-failure"> | ||
<button igxButton="icon" class="custom-button" igxRowEditTabStop (click)="endRowEdit(false)"> | ||
<igx-icon>clear</igx-icon> | ||
</button> | ||
</span> | ||
<span class="custom-success"> | ||
<button igxButton="icon" class="custom-button" igxRowEditTabStop (click)="endRowEdit(true)"> | ||
<igx-icon>check</igx-icon> | ||
</button> | ||
</span> | ||
</ng-template> | ||
</igx-hierarchical-grid> |
Oops, something went wrong.