Skip to content

Commit

Permalink
refactor(module:radio): refactor way to manage radio button style (#8299
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Nicoss54 committed Feb 8, 2024
1 parent 3648747 commit 2eb5cfb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
1 change: 0 additions & 1 deletion components/radio/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

export * from './radio-button.directive';
export * from './radio-group.component';
export * from './radio.component';
export * from './radio.service';
Expand Down
12 changes: 0 additions & 12 deletions components/radio/radio-button.directive.ts

This file was deleted.

5 changes: 2 additions & 3 deletions components/radio/radio.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { FocusMonitor } from '@angular/cdk/a11y';
import { Direction, Directionality } from '@angular/cdk/bidi';
import {
AfterViewInit,
booleanAttribute,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Expand All @@ -29,7 +30,6 @@ import { NzFormStatusService } from 'ng-zorro-antd/core/form';
import { BooleanInput, NzSafeAny, OnChangeType, OnTouchedType } from 'ng-zorro-antd/core/types';
import { InputBoolean } from 'ng-zorro-antd/core/util';

import { NzRadioButtonDirective } from './radio-button.directive';
import { NzRadioService } from './radio.service';

@Component({
Expand Down Expand Up @@ -90,13 +90,13 @@ export class NzRadioComponent implements ControlValueAccessor, AfterViewInit, On
private isNzDisableFirstChange: boolean = true;
isChecked = false;
name: string | null = null;
isRadioButton = !!this.nzRadioButtonDirective;
onChange: OnChangeType = () => {};
onTouched: OnTouchedType = () => {};
@ViewChild('inputElement', { static: true }) inputElement!: ElementRef<HTMLInputElement>;
@Input() nzValue: NzSafeAny | null = null;
@Input() @InputBoolean() nzDisabled = false;
@Input() @InputBoolean() nzAutoFocus = false;
@Input({ alias: 'nz-radio-button', transform: booleanAttribute }) isRadioButton = false;

dir: Direction = 'ltr';

Expand All @@ -115,7 +115,6 @@ export class NzRadioComponent implements ControlValueAccessor, AfterViewInit, On
private focusMonitor: FocusMonitor,
@Optional() private directionality: Directionality,
@Optional() @Inject(NzRadioService) private nzRadioService: NzRadioService | null,
@Optional() @Inject(NzRadioButtonDirective) private nzRadioButtonDirective: NzRadioButtonDirective | null,
@Optional() public nzFormStatusService?: NzFormStatusService
) {}

Expand Down
5 changes: 2 additions & 3 deletions components/radio/radio.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@

import { NgModule } from '@angular/core';

import { NzRadioButtonDirective } from './radio-button.directive';
import { NzRadioGroupComponent } from './radio-group.component';
import { NzRadioComponent } from './radio.component';

@NgModule({
imports: [NzRadioComponent, NzRadioButtonDirective, NzRadioGroupComponent],
exports: [NzRadioComponent, NzRadioButtonDirective, NzRadioGroupComponent]
imports: [NzRadioComponent, NzRadioGroupComponent],
exports: [NzRadioComponent, NzRadioGroupComponent]
})
export class NzRadioModule {}

0 comments on commit 2eb5cfb

Please sign in to comment.