Skip to content

Commit 0b84199

Browse files
authored
Merge branch 'master' into pivot-grid-master
2 parents b302703 + 4d3309c commit 0b84199

File tree

9 files changed

+116
-22
lines changed

9 files changed

+116
-22
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
npm run test:lib
4242
npm run test:styles
4343
npm run test:schematics
44+
npm run test:i18n
4445
env:
4546
NODE_OPTIONS: --max_old_space_size=4096
4647
- name: Build i18n & validate output

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ All notable changes for each version of this project will be documented in this
3535
- `IgxColumnActionsComponent`
3636
- **Breaking Change** - The following input has been removed
3737
- Input `columns`. Use `igxGrid` `columns` input instead.
38+
39+
## 12.2.3
40+
41+
### General
42+
- **Breaking Change** - `IgxPercentSummaryOperand` and `IgxCurrencySummaryOperand` have been removed and `IgxNumberSummaryOperand` should be used instead. If you have used the percent or currency summary operands to extend a custom summary operand from them, then change the custom operand to extend from the number summary operand.
43+
3844
## 12.2.1
3945

4046
### New Features
@@ -3659,4 +3665,4 @@ export class IgxCustomFilteringOperand extends IgxFilteringOperand {
36593665
- `IgxDraggableDirective` moved inside `../directives/dragdrop/` folder
36603666
- `IgxRippleDirective` moved inside `../directives/ripple/` folder
36613667
- Folder `"./navigation/nav-service"` renamed to `"./navigation/nav.service"`
3662-
3668+

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"test:lib:watch": "ng test igniteui-angular --karma-config=./projects/igniteui-angular/karma.watch.conf.js",
2424
"test:schematics": "ts-node --project projects/igniteui-angular/migrations/tsconfig.json ./node_modules/jasmine/bin/jasmine.js ./projects/igniteui-angular/migrations/**/*.spec.ts ./projects/igniteui-angular/schematics/**/*.spec.ts",
2525
"test:styles": "ts-node --skip-project ./node_modules/jasmine/bin/jasmine.js ./projects/igniteui-angular/src/lib/core/styles/spec/tests.ts",
26+
"test:i18n": "ts-node --skip-project ./projects/igniteui-angular/src/lib/core/i18n/tests/tests.ts",
2627
"build:lib": "ng build igniteui-angular --configuration production && gulp buildStyle",
2728
"build:style": "gulp buildStyle",
2829
"build:migration": "gulp copyMigrations && tsc --listEmittedFiles --project ./projects/igniteui-angular/migrations/tsconfig.json",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import * as fs from 'fs';
2+
import * as path from 'path';
3+
4+
const i18nProductPath = path.join(__dirname, '../');
5+
const i18nLanguagesPath = path.join(__dirname, '../../../../../../igniteui-angular-i18n/src/i18n');
6+
const errors = [];
7+
8+
class i18nTests {
9+
public runTests(): void {
10+
this.i18nFilesMatchForAllLanguages();
11+
}
12+
13+
public getDirectories = srcPath => fs.readdirSync(srcPath).filter(file => fs.statSync(path.join(srcPath, file)).isDirectory());
14+
public getFiles = srcPath => fs.readdirSync(srcPath).filter(file => fs.statSync(path.join(srcPath, file)).isFile());
15+
16+
public i18nFilesMatchForAllLanguages(): void {
17+
this.getDirectories(i18nLanguagesPath).forEach(dir => {
18+
const curDirPath = path.join(i18nLanguagesPath, dir);
19+
if (this.getFiles(curDirPath).length !== this.getFiles(i18nProductPath).length) {
20+
errors.push(`Not all i18n component files that are available for localization have matching files for ${dir} language.
21+
Check and add the appropriate resource strings with EN translation and mark the PR as 'pending localization'`
22+
);
23+
}
24+
});
25+
if (errors.length > 0) {
26+
throw errors;
27+
}
28+
}
29+
}
30+
31+
new i18nTests().runTests();

projects/igniteui-angular/src/lib/core/styles/components/slider/_slider-theme.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@
340340
width: 100%;
341341
height: rem($slider-track-height);
342342
background-size: 100% em($slider-track-height);
343-
background-color: --var($theme, 'track-step-color');
344343
opacity: .85;
345344
transition: opacity .2s $ease-out-quad;
346345
z-index: 1;

projects/igniteui-angular/src/lib/grids/common/events.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export interface IRowToggleEventArgs extends IBaseEventArgs {
163163
/**
164164
* Event emitted when a row's pin state changes.
165165
*/
166-
export interface IPinRowEventArgs extends IBaseEventArgs {
166+
export interface IPinRowEventArgs extends IBaseEventArgs, CancelableEventArgs {
167167
/**
168168
* The ID of the row, that was pinned/unpinned.
169169
* ID is either the primaryKey value or the data record instance.
@@ -172,7 +172,7 @@ export interface IPinRowEventArgs extends IBaseEventArgs {
172172
row?: RowType;
173173
/** The index at which to pin the row in the pinned rows collection. */
174174
insertAtIndex?: number;
175-
/** Whether or noy the row is pinned or unpinned. */
175+
/** Whether or not the row is pinned or unpinned. */
176176
readonly isPinned: boolean;
177177
}
178178

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4655,10 +4655,15 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
46554655
insertAtIndex: index,
46564656
isPinned: true,
46574657
rowID,
4658-
row
4658+
row,
4659+
cancel: false
46594660
};
46604661
this.rowPinning.emit(eventArgs);
46614662

4663+
if (eventArgs.cancel) {
4664+
return;
4665+
}
4666+
46624667
this.crudService.endEdit(false);
46634668

46644669
const insertIndex = typeof eventArgs.insertAtIndex === 'number' ? eventArgs.insertAtIndex : this._pinnedRecordIDs.length;
@@ -4691,10 +4696,15 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
46914696
const eventArgs: IPinRowEventArgs = {
46924697
isPinned: false,
46934698
rowID,
4694-
row
4699+
row,
4700+
cancel: false
46954701
};
46964702
this.rowPinning.emit(eventArgs);
46974703

4704+
if (eventArgs.cancel) {
4705+
return;
4706+
}
4707+
46984708
this.crudService.endEdit(false);
46994709
this._pinnedRecordIDs.splice(index, 1);
47004710
this.pipeTrigger++;

projects/igniteui-angular/src/lib/grids/grid/grid-row-pinning.spec.ts

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TestBed, fakeAsync, tick } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
44
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
55
import { IgxGridComponent } from './grid.component';
6-
import { IgxGridModule } from './public_api';
6+
import { IgxGridModule, IPinRowEventArgs } from './public_api';
77
import { configureTestSuite } from '../../test-utils/configure-suite';
88
import { ColumnPinningPosition, RowPinningPosition } from '../common/enums';
99
import { IPinningConfig } from '../grid.common';
@@ -164,7 +164,8 @@ describe('Row Pinning #grid', () => {
164164
rowID,
165165
insertAtIndex: 0,
166166
isPinned: true,
167-
row
167+
row,
168+
cancel: false
168169
});
169170

170171
row = grid.getRowByIndex(0);
@@ -190,7 +191,8 @@ describe('Row Pinning #grid', () => {
190191
rowID,
191192
insertAtIndex: 0,
192193
isPinned: true,
193-
row
194+
row,
195+
cancel: false
194196
});
195197

196198
row.unpin();
@@ -200,6 +202,62 @@ describe('Row Pinning #grid', () => {
200202
expect(grid.rowPinned.emit).toHaveBeenCalledTimes(2);
201203
});
202204

205+
it(`Should be able to cancel rowPinning on pin/unpin event.`, () => {
206+
spyOn(grid.rowPinning, 'emit').and.callThrough();
207+
let sub = grid.rowPinning.subscribe((e: IPinRowEventArgs) => {
208+
e.cancel = true;
209+
});
210+
211+
const row = grid.getRowByIndex(0);
212+
const rowID = row.key;
213+
expect(row.pinned).toBeFalsy();
214+
215+
row.pin();
216+
fix.detectChanges();
217+
218+
expect(grid.rowPinning.emit).toHaveBeenCalledTimes(1);
219+
expect(grid.rowPinning.emit).toHaveBeenCalledWith({
220+
insertAtIndex: 0,
221+
isPinned: true,
222+
rowID,
223+
row,
224+
cancel: true
225+
});
226+
expect(row.pinned).toBeFalsy();
227+
228+
sub.unsubscribe();
229+
230+
row.pin();
231+
fix.detectChanges();
232+
233+
expect(grid.rowPinning.emit).toHaveBeenCalledTimes(2);
234+
expect(grid.rowPinning.emit).toHaveBeenCalledWith({
235+
insertAtIndex: 0,
236+
isPinned: true,
237+
rowID,
238+
row,
239+
cancel: false
240+
});
241+
expect(row.pinned).toBe(true);
242+
243+
sub = grid.rowPinning.subscribe((e: IPinRowEventArgs) => {
244+
e.cancel = true;
245+
});
246+
247+
row.unpin();
248+
fix.detectChanges();
249+
250+
expect(grid.rowPinning.emit).toHaveBeenCalledTimes(3);
251+
expect(grid.rowPinning.emit).toHaveBeenCalledWith({
252+
isPinned: false,
253+
rowID,
254+
row,
255+
cancel: true
256+
});
257+
expect(row.pinned).toBe(true);
258+
sub.unsubscribe();
259+
});
260+
203261
it('should pin/unpin via grid API methods.', () => {
204262
// pin 2nd row
205263
grid.pinRow(fix.componentInstance.data[1]);

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import {
66
Inject,
77
Input,
88
OnDestroy,
9-
OnInit,
109
Optional
1110
} from '@angular/core';
12-
import { first } from 'rxjs/operators';
1311
import { Subscription } from 'rxjs';
1412
import { IDisplayDensityOptions, DisplayDensityToken, DisplayDensityBase } from '../../core/displayDensity';
1513
import { IgxIconService } from '../../icon/public_api';
@@ -30,7 +28,7 @@ import { GridType } from '../common/grid.interface';
3028
selector: 'igx-grid-toolbar',
3129
templateUrl: './grid-toolbar.component.html'
3230
})
33-
export class IgxGridToolbarComponent extends DisplayDensityBase implements OnInit, OnDestroy {
31+
export class IgxGridToolbarComponent extends DisplayDensityBase implements OnDestroy {
3432

3533
/**
3634
* When enabled, shows the indeterminate progress bar.
@@ -106,10 +104,6 @@ export class IgxGridToolbarComponent extends DisplayDensityBase implements OnIni
106104
return this.displayDensity === 'compact';
107105
}
108106

109-
/** @hidden @internal */
110-
@HostBinding('style.max-width.px')
111-
@HostBinding('style.flex-basis.px')
112-
public width = null;
113107

114108
protected _grid: IgxGridBaseDirective;
115109
protected sub: Subscription;
@@ -125,12 +119,6 @@ export class IgxGridToolbarComponent extends DisplayDensityBase implements OnIni
125119
this.iconService.addSvgIconFromText(unpinLeft.name, unpinLeft.value, 'imx-icons');
126120
}
127121

128-
/** @hidden @internal */
129-
public ngOnInit() {
130-
this.grid.rendered$.pipe(first()).subscribe(() => this.width = this.grid.outerWidth);
131-
this.sub = this.grid.resizeNotify.subscribe(() => this.width = this.grid.outerWidth);
132-
}
133-
134122
/** @hidden @internal */
135123
public ngOnDestroy() {
136124
this.sub?.unsubscribe();

0 commit comments

Comments
 (0)