22 AfterContentInit ,
33 AfterViewInit ,
44 ChangeDetectorRef ,
5- ContentChildren , Directive , DoCheck , EventEmitter , HostBinding , HostListener , Input , OnDestroy , Optional , Output , QueryList , Self , booleanAttribute , AfterViewChecked
5+ ContentChildren , Directive , DoCheck , EventEmitter , HostBinding , HostListener , Input , OnDestroy , Optional , Output , QueryList , Self , booleanAttribute ,
6+ contentChildren
67} from '@angular/core' ;
78import { ControlValueAccessor , NgControl , Validators } from '@angular/forms' ;
89import { fromEvent , noop , Subject } from 'rxjs' ;
@@ -51,7 +52,7 @@ let nextId = 0;
5152 selector : 'igx-radio-group, [igxRadioGroup]' ,
5253 standalone : true
5354} )
54- export class IgxRadioGroupDirective implements AfterContentInit , AfterViewInit , ControlValueAccessor , OnDestroy , DoCheck , AfterViewChecked {
55+ export class IgxRadioGroupDirective implements AfterContentInit , AfterViewInit , ControlValueAccessor , OnDestroy , DoCheck {
5556 /**
5657 * Returns reference to the child radio buttons.
5758 *
@@ -62,6 +63,8 @@ export class IgxRadioGroupDirective implements AfterContentInit, AfterViewInit,
6263 */
6364 @ContentChildren ( IgxRadioComponent , { descendants : true } ) public radioButtons : QueryList < IgxRadioComponent > ;
6465
66+ public RadioBtnSignal = contentChildren ( IgxRadioComponent , { descendants : true } ) ;
67+
6568 /**
6669 * Sets/gets the `value` attribute.
6770 *
@@ -203,7 +206,9 @@ export class IgxRadioGroupDirective implements AfterContentInit, AfterViewInit,
203206 * @internal
204207 */
205208 @HostBinding ( 'class.igx-radio-group--before' )
206- private _labelBefore = false ;
209+ protected get labelBefore ( ) {
210+ return this . RadioBtnSignal ( ) . some ( ( radio ) => radio . labelPosition === 'before' ) ;
211+ }
207212
208213 /**
209214 * A css class applied to the component if all
@@ -213,7 +218,9 @@ export class IgxRadioGroupDirective implements AfterContentInit, AfterViewInit,
213218 * @internal
214219 */
215220 @HostBinding ( 'class.igx-radio-group--disabled' )
216- private _disabled = false ;
221+ protected get disabled ( ) {
222+ return this . RadioBtnSignal ( ) . every ( ( radio ) => radio . disabled ) ;
223+ }
217224
218225 @HostListener ( 'click' , [ '$event' ] )
219226 protected handleClick ( event : MouseEvent ) {
@@ -345,11 +352,6 @@ export class IgxRadioGroupDirective implements AfterContentInit, AfterViewInit,
345352 * @internal
346353 */
347354 private queryChange$ = new Subject < void > ( ) ;
348- /**
349- * @hidden
350- * @internal
351- */
352- private _lastDisabledState = false ;
353355
354356 /**
355357 * @hidden
@@ -373,17 +375,6 @@ export class IgxRadioGroupDirective implements AfterContentInit, AfterViewInit,
373375 }
374376 } ) ;
375377 }
376-
377- this . updateDisabled ( ) ;
378- this . getLabelPosition ( ) ;
379- }
380-
381- /**
382- * @hidden
383- * @internal
384- */
385- public ngAfterViewChecked ( ) {
386- this . updateDisabled ( ) ;
387378 }
388379
389380 /**
@@ -418,37 +409,6 @@ export class IgxRadioGroupDirective implements AfterContentInit, AfterViewInit,
418409 }
419410 }
420411
421- /**
422- * @hidden
423- * @internal
424- */
425- private getDisabled ( ) : boolean {
426- return this . radioButtons ?. toArray ( ) . every ( button => button . disabled ) ;
427- }
428-
429- /**
430- * @hidden
431- * @internal
432- */
433- private updateDisabled ( ) {
434- const allDisabled = this . getDisabled ( ) ;
435-
436- if ( this . _lastDisabledState !== allDisabled ) {
437- this . _lastDisabledState = allDisabled ;
438- setTimeout ( ( ) => {
439- this . _disabled = allDisabled ;
440- } ) ;
441- }
442- }
443-
444- /**
445- * @hidden
446- * @internal
447- */
448- private getLabelPosition ( ) {
449- this . _labelBefore = this . radioButtons ?. some ( button => button . labelPosition === 'before' ) ?? false ;
450- }
451-
452412 /**
453413 * @hidden
454414 * @internal
@@ -481,7 +441,6 @@ export class IgxRadioGroupDirective implements AfterContentInit, AfterViewInit,
481441
482442 public ngDoCheck ( ) : void {
483443 this . _updateTabIndex ( ) ;
484- this . getLabelPosition ( ) ;
485444 }
486445
487446 private _updateTabIndex ( ) {
0 commit comments