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

Update Angular and Blazor label provider directives to match nimble-components #1927

Merged
merged 15 commits into from
Mar 13, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@ export class NimbleLabelProviderCoreWithDefaultsDirective {
this.elementRef.nativeElement.popupDismiss = $localize`:Nimble popup - dismiss|:Close`;
this.elementRef.nativeElement.numericDecrement = $localize`:Nimble numeric - decrement|:Decrement`;
this.elementRef.nativeElement.numericIncrement = $localize`:Nimble numeric - increment|:Increment`;
this.elementRef.nativeElement.errorIcon = $localize`:Nimble icon - error|:Error`;
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
this.elementRef.nativeElement.warningIcon = $localize`:Nimble icon - warning|:Warning`;
this.elementRef.nativeElement.informationIcon = $localize`:Nimble icon - information|:Information`;
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
this.elementRef.nativeElement.filterSearch = $localize`:Nimble select - search items|:Search`;
this.elementRef.nativeElement.filterNoResults = $localize`:Nimble select - no items|:No items found`;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,44 @@ export class NimbleLabelProviderCoreDirective {
@Input('numeric-increment') public set numericIncrement(value: string | undefined) {
this.renderer.setProperty(this.elementRef.nativeElement, 'numericIncrement', value);
}

public get errorIcon(): string | undefined {
return this.elementRef.nativeElement.errorIcon;
}

@Input('error-icon') public set errorIcon(value: string | undefined) {
this.renderer.setProperty(this.elementRef.nativeElement, 'errorIcon', value);
}

public get warningIcon(): string | undefined {
return this.elementRef.nativeElement.warningIcon;
}

@Input('warning-icon') public set warningIcon(value: string | undefined) {
this.renderer.setProperty(this.elementRef.nativeElement, 'warningIcon', value);
}

public get informationIcon(): string | undefined {
return this.elementRef.nativeElement.informationIcon;
}

@Input('information-icon') public set informationIcon(value: string | undefined) {
this.renderer.setProperty(this.elementRef.nativeElement, 'informationIcon', value);
}

public get filterSearch(): string | undefined {
return this.elementRef.nativeElement.filterSearch;
}

@Input('filter-search') public set filterSearch(value: string | undefined) {
this.renderer.setProperty(this.elementRef.nativeElement, 'filterSearch', value);
}

public get filterNoResults(): string | undefined {
return this.elementRef.nativeElement.filterNoResults;
}

@Input('filter-no-results') public set filterNoResults(value: string | undefined) {
this.renderer.setProperty(this.elementRef.nativeElement, 'filterNoResults', value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ describe('Nimble LabelProviderCore withDefaults directive', () => {
loadTranslations({
[computeMsgId('Close', 'Nimble popup - dismiss')]: 'Translated close',
[computeMsgId('Decrement', 'Nimble numeric - decrement')]: 'Translated decrement',
[computeMsgId('Increment', 'Nimble numeric - increment')]: 'Translated increment'
[computeMsgId('Increment', 'Nimble numeric - increment')]: 'Translated increment',
[computeMsgId('Error', 'Nimble icon - error')]: 'Translated error',
[computeMsgId('Warning', 'Nimble icon - warning')]: 'Translated warning',
[computeMsgId('Information', 'Nimble icon - information')]: 'Translated information',
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
[computeMsgId('Search', 'Nimble select - search items')]: 'Translated search',
[computeMsgId('No items found', 'Nimble select - no items')]: 'Translated no items found'
});
const fixture = TestBed.createComponent(TestHostComponent);
const testHostComponent = fixture.componentInstance;
Expand All @@ -42,5 +47,10 @@ describe('Nimble LabelProviderCore withDefaults directive', () => {
expect(labelProvider.popupDismiss).toBe('Translated close');
expect(labelProvider.numericDecrement).toBe('Translated decrement');
expect(labelProvider.numericIncrement).toBe('Translated increment');
expect(labelProvider.errorIcon).toBe('Translated error');
expect(labelProvider.warningIcon).toBe('Translated warning');
expect(labelProvider.informationIcon).toBe('Translated information');
expect(labelProvider.filterSearch).toBe('Translated search');
expect(labelProvider.filterNoResults).toBe('Translated no items found');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class NimbleLabelProviderTableWithDefaultsDirective {
public constructor(protected readonly renderer: Renderer2, protected readonly elementRef: ElementRef<LabelProviderTable>) {
this.elementRef.nativeElement.groupCollapse = $localize`:Nimble table - collapse group|:Collapse group`;
this.elementRef.nativeElement.groupExpand = $localize`:Nimble table - expand group|:Expand group`;
this.elementRef.nativeElement.rowCollapse = $localize`:Nimble table - collapse row|:Collapse row`;
this.elementRef.nativeElement.rowExpand = $localize`:Nimble table - expand row|:Expand row`;
this.elementRef.nativeElement.collapseAll = $localize`:Nimble table - collapse all|:Collapse all`;
this.elementRef.nativeElement.cellActionMenu = $localize`:Nimble table - cell action menu|:Options`;
this.elementRef.nativeElement.columnHeaderGrouped = $localize`:Nimble table - column header grouped|:Grouped`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ export class NimbleLabelProviderTableDirective {
this.renderer.setProperty(this.elementRef.nativeElement, 'groupExpand', value);
}

public get rowCollapse(): string | undefined {
return this.elementRef.nativeElement.rowCollapse;
}

@Input('row-collapse') public set rowCollapse(value: string | undefined) {
this.renderer.setProperty(this.elementRef.nativeElement, 'rowCollapse', value);
}

public get rowExpand(): string | undefined {
return this.elementRef.nativeElement.rowExpand;
}

@Input('row-expand') public set rowExpand(value: string | undefined) {
this.renderer.setProperty(this.elementRef.nativeElement, 'rowExpand', value);
}

public get collapseAll(): string | undefined {
return this.elementRef.nativeElement.collapseAll;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ describe('Nimble LabelProviderTable withDefaults directive', () => {
loadTranslations({
[computeMsgId('Collapse group', 'Nimble table - collapse group')]: 'Translated collapse group',
[computeMsgId('Expand group', 'Nimble table - expand group')]: 'Translated expand group',
[computeMsgId('Collapse row', 'Nimble table - collapse row')]: 'Translated collapse row',
[computeMsgId('Expand row', 'Nimble table - expand row')]: 'Translated expand row',
[computeMsgId('Collapse all', 'Nimble table - collapse all')]: 'Translated collapse all',
[computeMsgId('Options', 'Nimble table - cell action menu')]: 'Translated options',
[computeMsgId('Grouped', 'Nimble table - column header grouped')]: 'Translated grouped',
Expand All @@ -50,6 +52,8 @@ describe('Nimble LabelProviderTable withDefaults directive', () => {
it('applies translated values for each label', () => {
expect(labelProvider.groupCollapse).toBe('Translated collapse group');
expect(labelProvider.groupExpand).toBe('Translated expand group');
expect(labelProvider.rowCollapse).toBe('Translated collapse row');
expect(labelProvider.rowExpand).toBe('Translated expand row');
expect(labelProvider.collapseAll).toBe('Translated collapse all');
expect(labelProvider.cellActionMenu).toBe('Translated options');
expect(labelProvider.columnHeaderGrouped).toBe('Translated grouped');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Update default values in label provider directives",
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
"packageName": "@ni/nimble-angular",
"email": "jattasNI@users.noreply.github.com",
"dependentChangeType": "patch"
}
Loading