File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
netgrif-components-core/src/lib/data-fields/i18n-field/models
netgrif-components/src/lib/data-fields/boolean-field Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ export class I18nField extends DataField<I18nFieldValue> {
36
36
}
37
37
38
38
private static translationsEquality ( a : I18nFieldValue , b : I18nFieldValue ) : boolean {
39
- const aKeys = Object . keys ( a . translations ) . sort ( ) ;
40
- const bKeys = Object . keys ( b . translations ) . sort ( ) ;
39
+ const aKeys = ! ! a . translations ? Object . keys ( a . translations ) . sort ( ) : [ ] ;
40
+ const bKeys = ! ! b . translations ? Object . keys ( b . translations ) . sort ( ) : [ ] ;
41
41
if ( aKeys . length !== bKeys . length
42
42
|| ! aKeys . every ( ( element , index ) => {
43
43
return element === bKeys [ index ] ;
@@ -166,14 +166,14 @@ export class I18nField extends DataField<I18nFieldValue> {
166
166
private validTranslationRequired ( countries : Array < string > ) : ValidatorFn {
167
167
return ( fc : FormControl ) : { [ key : string ] : any } | null => {
168
168
return countries . every ( languageCode => languageCode in fc . value . translations )
169
- ? ( null ) : ( { translationRequired : true } ) ;
169
+ ? null : ( { translationRequired : true } ) ;
170
170
} ;
171
171
}
172
172
173
173
private validTranslationOnly ( countries : Array < string > ) : ValidatorFn {
174
174
return ( fc : FormControl ) : { [ key : string ] : any } | null => {
175
175
return Object . keys ( fc . value . translations ) . every ( translation => countries . includes ( translation ) )
176
- ? ( null ) : ( { translationOnly : true } ) ;
176
+ ? null : ( { translationOnly : true } ) ;
177
177
} ;
178
178
}
179
179
Original file line number Diff line number Diff line change 12
12
< mat-slide-toggle color ="primary " [formControl] ="formControl ">
13
13
{{createValueLabel()}}
14
14
</ mat-slide-toggle >
15
+ < mat-hint > {{dataField.description}}</ mat-hint >
15
16
< mat-error *ngIf ="dataField.isInvalid(formControl) "> {{getErrorMessage()}}</ mat-error >
16
17
</ div >
17
18
</ ng-template >
Original file line number Diff line number Diff line change
1
+ mat-hint {
2
+ display : block ;
3
+ }
You can’t perform that action at this time.
0 commit comments