Skip to content

Commit ffa87c5

Browse files
committed
fix(grid): Fix grid resource string assigning and summary cell use of old locale method.
1 parent 2336ae1 commit ffa87c5

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

projects/igniteui-angular/src/lib/core/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,8 @@ export function getCurrencyCode(locale: string, overrideCode?: string) {
677677
return currencyCode;
678678
}
679679

680-
export function getCurrencySymbol(currencyCode: string, currencyDisplay?: keyof Intl.NumberFormatOptionsCurrencyDisplayRegistry,locale?: string) {
681-
return getI18nManager().getCurrencySymbol(currencyCode, currencyDisplay, locale);
680+
export function getCurrencySymbol(currencyCode: string, locale?: string, currencyDisplay: keyof Intl.NumberFormatOptionsCurrencyDisplayRegistry = "symbol") {
681+
return getI18nManager().getCurrencySymbol(currencyCode, locale, currencyDisplay);
682682
}
683683

684684
export function getLocaleFirstDayOfWeek(locale?: string) {

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
790790

791791
/** @hidden @internal */
792792
public get currencyCodeSymbol(): string {
793-
return getCurrencySymbol(this.currencyCode, 'symbol', this.grid.locale);
793+
return getCurrencySymbol(this.currencyCode, this.grid.locale);
794794
}
795795

796796
protected _lastSearchInfo: ISearchInfo;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,8 @@ export abstract class IgxGridBaseDirective implements GridType,
18481848
*/
18491849
@Input()
18501850
public set resourceStrings(value: IGridResourceStrings) {
1851-
this._resourceStrings = Object.assign({}, this._resourceStrings, value);
1851+
this._resourceStrings = Object.assign({}, this.resourceStrings, value);
1852+
this.notifyChanges();
18521853
}
18531854

18541855
public get resourceStrings(): IGridResourceStrings {
@@ -3512,7 +3513,7 @@ export abstract class IgxGridBaseDirective implements GridType,
35123513
// Reset currency position because of new locale.
35133514
this._currencyPositionLeft = undefined;
35143515
if (!this._init) {
3515-
this.markForCheck();
3516+
this.notifyChanges();
35163517
}
35173518
});
35183519
}

projects/igniteui-angular/src/lib/grids/summaries/summary-cell.component.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import {
44
IgxSummaryResult
55
} from './grid-summary';
66
import { GridColumnDataType } from '../../data-operations/data-util';
7-
import { getLocaleCurrencySymbol, NgTemplateOutlet } from '@angular/common';
7+
import { NgTemplateOutlet } from '@angular/common';
88
import { ISelectionNode } from '../common/types';
99
import { ColumnType } from '../common/grid.interface';
10-
import { formatCurrency, formatDate, formatNumber, formatPercent, getCurrencyCode, trackByIdentity } from '../../core/utils';
10+
import { formatCurrency, formatDate, formatNumber, formatPercent, getCurrencyCode, getCurrencySymbol, trackByIdentity } from '../../core/utils';
1111

1212
@Component({
1313
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -35,6 +35,12 @@ export class IgxSummaryCellComponent {
3535
@Input()
3636
public summaryTemplate: TemplateRef<any>;
3737

38+
@Input()
39+
public locale;
40+
41+
@Input()
42+
public gridResourceStrings;
43+
3844
/** @hidden */
3945
@Input()
4046
@HostBinding('class.igx-grid-summary--active')
@@ -103,22 +109,22 @@ export class IgxSummaryCellComponent {
103109
* @hidden @internal
104110
*/
105111
public get currencyCode(): string {
106-
return getCurrencyCode(this.grid.locale, this.column.pipeArgs.currencyCode);
112+
return getCurrencyCode(this.locale, this.column.pipeArgs.currencyCode);
107113
}
108114

109115
/**
110116
* @hidden @internal
111117
*/
112118
public get currencySymbol(): string {
113119
return this.column.pipeArgs.display ?
114-
this.column.pipeArgs.display : getLocaleCurrencySymbol(this.grid.locale);
120+
this.column.pipeArgs.display : getCurrencySymbol(getCurrencyCode(this.locale), this.locale);
115121
}
116122

117123
/** cached single summary res after filter resets collection */
118124
protected trackSummaryResult = trackByIdentity;
119125

120126
public translateSummary(summary: IgxSummaryResult): string {
121-
return this.grid.resourceStrings[`igx_grid_summary_${summary.key}`] || summary.label;
127+
return this.gridResourceStrings[`igx_grid_summary_${summary.key}`] || summary.label;
122128
}
123129

124130
/**
@@ -134,7 +140,7 @@ export class IgxSummaryCellComponent {
134140
}
135141

136142
const args = this.column.pipeArgs;
137-
const locale = this.grid.locale;
143+
const locale = this.locale;
138144

139145
if (summary.key === 'count') {
140146
return formatNumber(summary.summaryResult, locale)

projects/igniteui-angular/src/lib/grids/summaries/summary-row.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
[class.igx-grid-summary--empty]="!col.hasSummary"
1818
[class.igx-grid-summary--pinned-last]="col.isLastPinned"
1919
[column]="col"
20+
[locale]="grid.locale"
21+
[gridResourceStrings]="grid.resourceStrings"
2022
[rowIndex]="index"
2123
[firstCellIndentation]="firstCellIndentation"
2224
[summaryResults]="getColumnSummaries(col.field)"
@@ -45,6 +47,8 @@
4547
[class.igx-grid-summary--pinned-first]="col.isFirstPinned"
4648
[class.igx-grid-summary--pinned-last]="col.isLastPinned"
4749
[column]="col"
50+
[locale]="grid.locale"
51+
[gridResourceStrings]="grid.resourceStrings"
4852
[firstCellIndentation]="firstCellIndentation"
4953
[rowIndex]="index"
5054
[summaryResults]="getColumnSummaries(col.field)"

0 commit comments

Comments
 (0)