11import {
22 AsyncPipe ,
3+ isPlatformBrowser ,
34 NgClass ,
45 NgForOf ,
56 NgIf ,
@@ -21,7 +22,9 @@ import {
2122 OnDestroy ,
2223 OnInit ,
2324 Output ,
25+ PLATFORM_ID ,
2426 QueryList ,
27+ Renderer2 ,
2528 SimpleChanges ,
2629 Type ,
2730 ViewChild ,
@@ -42,10 +45,12 @@ import {
4245import {
4346 DYNAMIC_FORM_CONTROL_MAP_FN ,
4447 DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX ,
48+ DynamicFormArrayComponent ,
4549 DynamicFormArrayGroupModel ,
4650 DynamicFormArrayModel ,
4751 DynamicFormComponentService ,
4852 DynamicFormControl ,
53+ DynamicFormControlComponent ,
4954 DynamicFormControlContainerComponent ,
5055 DynamicFormControlEvent ,
5156 DynamicFormControlEventType ,
@@ -108,7 +113,6 @@ import { SubmissionObjectDataService } from '../../../../core/submission/submiss
108113import { paginatedRelationsToItems } from '../../../../item-page/simple/item-types/shared/item-relationships-utils' ;
109114import { SubmissionObjectActionTypes } from '../../../../submission/objects/submission-objects.actions' ;
110115import { SubmissionService } from '../../../../submission/submission.service' ;
111- import { BtnDisabledDirective } from '../../../btn-disabled.directive' ;
112116import {
113117 hasNoValue ,
114118 hasValue ,
@@ -132,6 +136,7 @@ import {
132136} from './existing-metadata-list-element/existing-metadata-list-element.component' ;
133137import { ExistingRelationListElementComponent } from './existing-relation-list-element/existing-relation-list-element.component' ;
134138import { DYNAMIC_FORM_CONTROL_TYPE_CUSTOM_SWITCH } from './models/custom-switch/custom-switch.model' ;
139+ import { DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER } from './models/date-picker/date-picker.model' ;
135140import { DsDynamicLookupRelationModalComponent } from './relation-lookup-modal/dynamic-lookup-relation-modal.component' ;
136141
137142@Component ( {
@@ -151,7 +156,6 @@ import { DsDynamicLookupRelationModalComponent } from './relation-lookup-modal/d
151156 NgbTooltipModule ,
152157 NgTemplateOutlet ,
153158 ExistingRelationListElementComponent ,
154- BtnDisabledDirective ,
155159 ] ,
156160 standalone : true ,
157161} )
@@ -229,6 +233,8 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
229233 @Inject ( APP_CONFIG ) protected appConfig : AppConfig ,
230234 @Inject ( DYNAMIC_FORM_CONTROL_MAP_FN ) protected dynamicFormControlFn : DynamicFormControlMapFn ,
231235 private actions$ : Actions ,
236+ protected renderer : Renderer2 ,
237+ @Inject ( PLATFORM_ID ) protected platformId : string ,
232238 ) {
233239 super ( ref , componentFactoryResolver , layoutService , validationService , dynamicFormComponentService , relationService ) ;
234240 this . fetchThumbnail = this . appConfig . browseBy . showThumbnails ;
@@ -330,6 +336,11 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
330336 return this . model . type === DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX || this . model . type === DYNAMIC_FORM_CONTROL_TYPE_CUSTOM_SWITCH ;
331337 }
332338
339+
340+ get isDateField ( ) : boolean {
341+ return this . model . type === DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER ;
342+ }
343+
333344 ngOnChanges ( changes : SimpleChanges ) {
334345 if ( changes && ! this . isRelationship && hasValue ( this . group . get ( this . model . id ) ) ) {
335346 super . ngOnChanges ( changes ) ;
@@ -351,6 +362,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
351362
352363 ngAfterViewInit ( ) {
353364 this . showErrorMessagesPreviousStage = this . showErrorMessages ;
365+ this . handleAriaLabelForLibraryComponents ( ) ;
354366 }
355367
356368 protected createFormControlComponent ( ) : void {
@@ -522,4 +534,22 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
522534 this . subs . push ( collection$ . subscribe ( ( collection ) => this . collection = collection ) ) ;
523535
524536 }
537+
538+ private handleAriaLabelForLibraryComponents ( ) : void {
539+ if ( ! isPlatformBrowser ( this . platformId ) ) {
540+ return ;
541+ }
542+
543+ if ( ( this . componentRef . instance instanceof DynamicFormControlComponent ) &&
544+ ! ( this . componentRef . instance instanceof DynamicFormArrayComponent ) &&
545+ this . componentRef . location . nativeElement ) {
546+ const inputEl : HTMLElement | null =
547+ this . componentRef . location . nativeElement . querySelector ( 'input,textarea,select,[role="textbox"]' ) ;
548+
549+
550+ if ( inputEl && this . model ?. additional ?. ariaLabel ) {
551+ this . renderer . setAttribute ( inputEl , 'aria-label' , this . model . additional . ariaLabel ) ;
552+ }
553+ }
554+ }
525555}
0 commit comments