@@ -31,6 +31,7 @@ import {
3131import { JsonFormsAngularService , JsonFormsAbstractControl } from '@jsonforms/angular' ;
3232import {
3333 ArrayLayoutProps ,
34+ ArrayTranslations ,
3435 createDefaultValue ,
3536 findUISchema ,
3637 isObjectArrayWithNesting ,
@@ -68,15 +69,15 @@ import {
6869 <span fxFlex></span>
6970 <button
7071 mat-button
71- matTooltip="{{ this .addTooltip }}"
72+ matTooltip="{{ translations .addTooltip }}"
7273 [disabled]="!isEnabled()"
7374 (click)="add()"
74- attr.aria-label="{{ this .addAriaLabel }}"
75+ attr.aria-label="{{ translations .addAriaLabel }}"
7576 >
7677 <mat-icon>add</mat-icon>
7778 </button>
7879 </div>
79- <p *ngIf="noData">{{ this .noDataMessage }}</p>
80+ <p *ngIf="noData">{{ translations .noDataMessage }}</p>
8081 <div
8182 *ngFor="
8283 let item of [].constructor(data);
@@ -97,8 +98,8 @@ import {
9798 mat-button
9899 [disabled]="first"
99100 (click)="up(idx)"
100- attr.aria-label="{{ this .upAriaLabel }}"
101- matTooltip="{{ this.upTooltip }}"
101+ attr.aria-label="{{ translations .upAriaLabel }}"
102+ matTooltip="{{ translations.up }}"
102103 matTooltipPosition="right"
103104 >
104105 <mat-icon>arrow_upward</mat-icon>
@@ -109,8 +110,8 @@ import {
109110 mat-button
110111 [disabled]="last"
111112 (click)="down(idx)"
112- attr.aria-label="{{ this .downAriaLabel }}"
113- matTooltip="{{ this.downTooltip }}"
113+ attr.aria-label="{{ translations .downAriaLabel }}"
114+ matTooltip="{{ translations.down }}"
114115 matTooltipPosition="right"
115116 >
116117 <mat-icon>arrow_downward</mat-icon>
@@ -119,8 +120,8 @@ import {
119120 mat-button
120121 color="warn"
121122 (click)="remove(idx)"
122- attr.aria-label="{{ this .removeAriaLabel }}"
123- matTooltip="{{ this .removeTooltip }}"
123+ attr.aria-label="{{ translations .removeAriaLabel }}"
124+ matTooltip="{{ translations .removeTooltip }}"
124125 matTooltipPosition="right"
125126 >
126127 <mat-icon>delete</mat-icon>
@@ -148,16 +149,8 @@ import {
148149export class ArrayLayoutRenderer
149150 extends JsonFormsAbstractControl < StatePropsOfArrayLayout >
150151 implements OnInit , OnDestroy {
151- addTooltip : string ;
152- addAriaLabel : string ;
153- noDataMessage : string ;
154- removeTooltip : string ;
155- removeAriaLabel : string ;
156- upTooltip : string ;
157- upAriaLabel : string ;
158- downTooltip : string ;
159- downAriaLabel :string ;
160152 noData : boolean ;
153+ translations : ArrayTranslations ;
161154 addItem : ( path : string , value : any ) => ( ) => void ;
162155 moveItemUp : ( path : string , index : number ) => ( ) => void ;
163156 moveItemDown : ( path : string , index : number ) => ( ) => void ;
@@ -196,15 +189,9 @@ export class ArrayLayoutRenderer
196189 this . removeItems = removeItems ;
197190 }
198191 mapAdditionalProps ( props : ArrayLayoutProps ) {
192+ this . translations = props . translations ;
199193 this . noData = ! props . data || props . data === 0 ;
200194 this . uischemas = props . uischemas ;
201- this . addTooltip = `Add to ${ this . label } ` ;
202- this . addAriaLabel = `Add to ${ this . label } button` ;
203- this . upAriaLabel = `Move ${ this . label } up` ;
204- this . downAriaLabel = `Move ${ this . label } down` ;
205- this . removeTooltip = `Delete` ;
206- this . removeAriaLabel = `Delete button` ;
207- this . noDataMessage = `No data` ;
208195 }
209196 getProps ( index : number ) : OwnPropsOfRenderer {
210197 const uischema = findUISchema (
0 commit comments