Skip to content

Commit a2df096

Browse files
authored
Merge pull request #8549 from IgniteUI/rkaraivanov/toolbar-tweaks
refactor(toolbar): Export toolbar to pubic api
2 parents 7e93477 + dff0a98 commit a2df096

File tree

7 files changed

+26
-6
lines changed

7 files changed

+26
-6
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ All notable changes for each version of this project will be documented in this
1010
### General
1111
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
1212
- Added a new directive for re-templating the Excel style filtering header icon - `IgxExcelStyleHeaderIconDirective`.
13+
- **Breaking Change**
14+
15+
Changed the how the grid toolbar is instantiated in the grids. The
16+
toolbar is now templated rather than being activated through a property on the parent grid. The toolbar features are also exposed as templatable
17+
components and the old properties are deprecated.
18+
19+
Refer to the official documentation for more information.
1320

1421
## 10.2.0
1522

@@ -86,7 +93,7 @@ All notable changes for each version of this project will be documented in this
8693
return result;
8794
}
8895
}
89-
```
96+
```
9097
- A new `pipeArgs` input property is exposed by the `IgxColumnComponent`, which is used to pass arguments to the Angular `DatePipe` and `DecimalPipe`, to format the display for date and numeric columns.
9198
```typescript
9299
- ` IGX_INPUT_GROUP_TYPE` injection token

projects/igniteui-angular/migrations/update-11_0_0/index.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe('Update to 11.0.0', () => {
2323
},
2424
};
2525
const migrationName = 'migration-18';
26+
const warnMsg = `\n<!-- Auto migrated template content. Please, check your bindings! -->\n`;
2627
const stripWhitespaceRe = /\s/g;
2728

2829
const makeTemplate = (name: string) => `/testSrc/appPrefix/component/${name}.component.html`;
@@ -102,6 +103,7 @@ describe('Update to 11.0.0', () => {
102103
).toEqual(`
103104
<igx-grid>
104105
<igx-grid-toolbar>
106+
${warnMsg}
105107
<div></div>
106108
<button></button>
107109
</igx-grid-toolbar>
@@ -147,6 +149,7 @@ describe('Update to 11.0.0', () => {
147149
<igx-column></igx-column>
148150
<igx-row-island>
149151
<igx-grid-toolbar [grid]="sampleGrid" *igxGridToolbar="let sampleGrid" *ngIf="showChildToolbar">
152+
${warnMsg}
150153
<div igxLabel></div>
151154
<button></button>
152155
</igx-grid-toolbar>

projects/igniteui-angular/migrations/update-11_0_0/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default function (): Rule {
1515

1616
const TAGS = ['igx-grid', 'igx-tree-grid', 'igx-hierarchical-grid'];
1717
const prop = ['[showToolbar]', 'showToolbar'];
18+
const warnMsg = `\n<!-- Auto migrated template content. Please, check your bindings! -->\n`;
1819
const changes = new Map<string, FileChange[]>();
1920

2021
const applyChanges = () => {
@@ -53,7 +54,7 @@ export default function (): Rule {
5354
const ngTemplates = findElementNodes([grid], ['ng-template']);
5455
const toolbarTemplate = ngTemplates.filter(template => hasAttribute(template as Element, 'igxToolbarCustomContent'))[0];
5556
if (toolbarTemplate) {
56-
return `\n${serializeNodes((toolbarTemplate as Element).children).join('')}\n`;
57+
return `${warnMsg}\n${serializeNodes((toolbarTemplate as Element).children).join('')}\n`;
5758
}
5859
return '';
5960
};

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
} from '@angular/core';
3232
import ResizeObserver from 'resize-observer-polyfill';
3333
import 'igniteui-trial-watermark';
34-
import { Subject, pipe, fromEvent } from 'rxjs';
34+
import { Subject, pipe, fromEvent, noop } from 'rxjs';
3535
import { takeUntil, first, filter, throttleTime, map, shareReplay } from 'rxjs/operators';
3636
import { cloneArray, flatten, mergeObjects, isIE, compareMaps, resolveNestedPath, isObject } from '../core/utils';
3737
import { DataType } from '../data-operations/data-util';
@@ -3329,7 +3329,8 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
33293329
this.addRowSnackbar.hide();
33303330
});
33313331

3332-
3332+
// Keep the stream open for future subscribers
3333+
this.rendered$.pipe(takeUntil(this.destroy$)).subscribe(noop);
33333334
Promise.resolve().then(() => this.rendered.next(true));
33343335
}
33353336

projects/igniteui-angular/src/lib/grids/public_api.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ export * from './grid-common.module';
1111
export { IColumnVisibilityChangedEventArgs } from './column-actions/column-hiding.directive';
1212
export * from './column-actions/column-actions.module';
1313
export * from './state.directive';
14+
export * from './toolbar/grid-toolbar.component';
15+
export * from './toolbar/common';
16+
export * from './toolbar/grid-toolbar-advanced-filtering.component';
17+
export * from './toolbar/grid-toolbar-exporter.component';
18+
export * from './toolbar/grid-toolbar-hiding.component';
19+
export * from './toolbar/grid-toolbar-pinning.component';

projects/igniteui-angular/src/lib/grids/toolbar/grid-toolbar-exporter.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,17 @@ export class IgxGridToolbarExporterComponent extends BaseToolbarDirective {
134134

135135
this.exportStarted.emit(args);
136136
this.grid.onToolbarExporting.emit(args);
137+
this.isExporting = true;
138+
this.toolbar.showProgress = true;
137139

138140
if (args.cancel) {
139141
return;
140142
}
141143

142-
this.isExporting = true;
143-
144144
exporter.onExportEnded.pipe(first()).subscribe(() => {
145145
this.exportEnded.emit();
146146
this.isExporting = false;
147+
this.toolbar.showProgress = false;
147148
});
148149

149150
exporter.export(this.grid, options);

projects/igniteui-angular/src/lib/grids/toolbar/grid-toolbar.base.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export abstract class BaseToolbarDirective {
4747

4848
constructor(@Host() protected toolbar: IgxGridToolbarComponent) { }
4949

50+
/** @hidden @internal */
5051
public toggle(anchorElement: HTMLElement, toggleRef: IgxToggleDirective, actions?: IgxColumnActionsComponent): void {
5152
if (actions) {
5253
const setHeight = () => actions.columnsAreaMaxHeight = this.columnListHeight ?? `${Math.max(this.grid.calcHeight, 200)}px`;

0 commit comments

Comments
 (0)