Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom content outlet for IgxGridToolbar - 6.2.x #3107

Merged
merged 30 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
df6698e
test(toolbar): adding tests for the toolbar's custom content #2983
Nov 22, 2018
88438aa
test(toolbar): removing f from fdescribe #2983
Nov 22, 2018
f5219e6
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
tachojelev Nov 22, 2018
e915768
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 22, 2018
4b59c8a
feat(toolbar): adding the toolbar custom content outlet #2983
Nov 22, 2018
c7f1921
Merge branch 'rkolev/toolbar-template-6.2.x' of https://github.com/Ig…
Nov 22, 2018
26fe665
docs(toolbar): adding more API docs #2983
Nov 22, 2018
01092ff
chore(toolbar): remove f from describe #2983
Nov 22, 2018
d08b90b
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
Nov 22, 2018
86551ec
feat(toolbar): updating CHANGELOG.md #2983
Nov 23, 2018
658948d
Merge branch 'rkolev/toolbar-template-6.2.x' of https://github.com/Ig…
Nov 23, 2018
7c68d1a
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 23, 2018
0357fcf
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 23, 2018
7652e18
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 26, 2018
0a6377f
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rkaraivanov Nov 26, 2018
32d0d75
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 27, 2018
1a2ad82
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 27, 2018
770bf8b
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rkaraivanov Nov 27, 2018
2485210
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 28, 2018
a57ad05
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 29, 2018
b120029
fix(toolbar): including custom content in the show toolbar check #2983
Nov 29, 2018
92f9773
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 30, 2018
35fb3f7
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Nov 30, 2018
c33be18
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
kdinev Dec 3, 2018
498ee97
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
kdinev Dec 3, 2018
723df73
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
tachojelev Dec 4, 2018
d97403b
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
kdinev Dec 4, 2018
5109a5a
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
kdinev Dec 5, 2018
c84b14d
Merge branch '6.2.x' into rkolev/toolbar-template-6.2.x
rmkrmk Dec 6, 2018
989a900
chore(toolbar): removing info regarding 6.2.1 #2983
Dec 6, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
@extend %igx-grid-toolbar__title !optional;
}

@include e(custom-content){
@extend %igx-grid-toolbar__custom-content !optional;
}

@include e(actions){
@extend %igx-grid-toolbar__actions !optional;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@
@include ellipsis();
}

%igx-grid-toolbar__custom-content {
display: flex;
flex-flow: row wrap;
}

%igx-grid-toolbar__actions {
display: flex;
align-items: center;
Expand Down
11 changes: 11 additions & 0 deletions projects/igniteui-angular/src/lib/grids/grid-base.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import { IDisplayDensityOptions, DisplayDensityToken, DisplayDensityBase } from
import { IgxGridRowComponent } from './grid';
import { IgxFilteringService } from './filtering/grid-filtering.service';
import { IgxGridFilteringCellComponent } from './filtering/grid-filtering-cell.component';
import { IgxGridToolbarCustomContentDirective } from './grid-toolbar.component';

const MINIMUM_COLUMN_WIDTH = 136;

Expand Down Expand Up @@ -1232,6 +1233,16 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
@ViewChild('scrollContainer', { read: IgxGridForOfDirective })
public parentVirtDir: IgxGridForOfDirective<any>;

/**
* Returns the template which will be used by the toolbar to show custom content.
* ```typescript
* let customContentTemplate = this.grid.toolbarCustomContentTemplate;
* ```
* @memberof IgxGridBaseComponent
*/
@ContentChild(IgxGridToolbarCustomContentDirective, { read: IgxGridToolbarCustomContentDirective })
public toolbarCustomContentTemplate: IgxGridToolbarCustomContentDirective;

/**
* @hidden
*/
Expand Down
3 changes: 3 additions & 0 deletions projects/igniteui-angular/src/lib/grids/grid-common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
IgxRowEditTabStopDirective
} from './grid.rowEdit.directive';
import { IgxGridNavigationService } from './grid-navigation.service';
import { IgxGridToolbarCustomContentDirective } from './grid-toolbar.component';

@NgModule({
declarations: [
Expand All @@ -64,6 +65,7 @@ import { IgxGridNavigationService } from './grid-navigation.service';
IgxGridHeaderComponent,
IgxGridSummaryComponent,
IgxGridToolbarComponent,
IgxGridToolbarCustomContentDirective,
IgxCellFooterTemplateDirective,
IgxCellHeaderTemplateDirective,
IgxCellEditorTemplateDirective,
Expand Down Expand Up @@ -95,6 +97,7 @@ import { IgxGridNavigationService } from './grid-navigation.service';
IgxGridHeaderComponent,
IgxGridSummaryComponent,
IgxGridToolbarComponent,
IgxGridToolbarCustomContentDirective,
IgxCellFooterTemplateDirective,
IgxCellHeaderTemplateDirective,
IgxCellEditorTemplateDirective,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{{ getTitle() }}
</span>

<div class="igx-grid-toolbar__custom-content" *ngIf="customContentTemplate != null">
<ng-container *ngTemplateOutlet="customContentTemplate; context: context">
</ng-container>
</div>

<div class="igx-grid-toolbar__actions">
<div *ngIf="grid.columnHiding">
<button igxButton="flat" #columnHidingButton name="btnColumnHiding" igxButton igxRipple
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import {
ChangeDetectorRef,
Component,
Directive,
HostBinding,
Input,
Optional,
ViewChild,
Inject
Inject,
TemplateRef
} from '@angular/core';

import { IDisplayDensityOptions, DisplayDensityToken, DisplayDensityBase } from '../core/displayDensity';
Expand Down Expand Up @@ -350,4 +352,40 @@ export class IgxGridToolbarComponent extends DisplayDensityBase {
this._overlaySettings.outlet = this.grid.outletDirective;
this.columnPinningDropdown.toggle(this._overlaySettings);
}

/**
* Returns the `context` object which represents the `template context` binding into the
* `toolbar custom container` by providing references to the parent IgxGird and the toolbar itself.
* ```typescript
* let context = this.igxGrid.toolbar.context;
* ```
*/
public get context(): any {
return {
// $implicit: this
grid: this.grid,
toolbar: this
};
}

/** @hidden */
public get customContentTemplate(): TemplateRef<any> {
if (this.grid != null && this.grid.toolbarCustomContentTemplate != null) {
return this.grid.toolbarCustomContentTemplate.template;
} else {
return null;
}
}
}

/**
* The IgxGridToolbarCustomContentDirective directive is used to mark an 'ng-template' (with
* the 'igxToolbarCustomContent' selector) defined in the IgxGrid which is used to provide
* custom content for cener part of the IgxGridToolbar.
*/
@Directive({
selector: '[igxToolbarCustomContent]'
})
export class IgxGridToolbarCustomContentDirective {
constructor(public template: TemplateRef<any>) { }
}
Loading