Skip to content

Commit

Permalink
Merge branch '7.0.x' into rkaraivanov/fix3164-7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kdinev authored Nov 27, 2018
2 parents 69bafab + 68b18e4 commit b191125
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes for each version of this project will be documented in this
- Updated package dependencies to Angular 7 ([#3000](https://github.com/IgniteUI/igniteui-angular/pull/3000))
- Themes: Add dark schemas and mixins (PR [#3025](https://github.com/IgniteUI/igniteui-angular/pull/3025))

## 6.2.2
- `igx-checkbox`:
- Added a new input property - `disableTransitions`. It allows disabling all CSS transitions on the `igx-checkbox` component for performance optimization.

## 6.2.1
### Features
- `igxGrid`, `igxChip`: Add display density DI token to igxGrid and igxChip ([#2804](https://github.com/IgniteUI/igniteui-angular/issues/2804))
Expand Down
3 changes: 2 additions & 1 deletion projects/igniteui-angular/src/lib/checkbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ To disable the ripple effect, do:
| `@Input()` indeterminate | boolean | Specifies the indeterminate state of the checkbox. |
| `@Input()` required | boolean | Specifies the required state of the checkbox. |
| `@Input()` disabled | boolean | Specifies the disabled state of the checkbox. |
| `@Input()` disableRipple | boolean | Specifies the whether the ripple effect should be disabled for the checkbox. |
| `@Input()` disableRipple | boolean | Specifies whether the ripple effect should be disabled for the checkbox. |
| `@Input()` disableTransitions | boolean | Specifies whether CSS transitions should be disabled for the checkbox. |
| `@Input()` labelPosition | string `|` enum LabelPosition | Specifies the position of the text label relative to the checkbox element. |
| `@Input("aria-labelledby")` ariaLabelledBy | string | Specify an external element by id to be used as label for the checkbox. |
| `@Output()` change | EventEmitter<IChangeCheckboxEventArgs> | Emitted when the checkbox checked value changes. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('IgxCheckbox', () => {
CheckboxRequiredComponent,
CheckboxExternalLabelComponent,
CheckboxInvisibleLabelComponent,
CheckboxDisabledTransitionsComponent,
IgxCheckboxComponent
],
imports: [FormsModule, IgxRippleModule]
Expand Down Expand Up @@ -156,6 +157,21 @@ describe('IgxCheckbox', () => {
expect(testInstance.subscribed).toBe(false);
});

it('Should be able to enable/disable CSS transitions', () => {
const fixture = TestBed.createComponent(CheckboxDisabledTransitionsComponent);
const testInstance = fixture.componentInstance;
const checkboxInstance = testInstance.cb;
const checkboxHost = fixture.debugElement.query(By.css('igx-checkbox')).nativeElement;
fixture.detectChanges();

expect(checkboxInstance.disableTransitions).toBe(true);
expect(checkboxHost.classList).toContain('igx-checkbox--plain');

testInstance.cb.disableTransitions = false;
fixture.detectChanges();
expect(checkboxHost.classList).not.toContain('igx-checkbox--plain');
});

it('Required state', () => {
const fixture = TestBed.createComponent(CheckboxRequiredComponent);
const testInstance = fixture.componentInstance;
Expand Down Expand Up @@ -281,3 +297,10 @@ class CheckboxInvisibleLabelComponent {
@ViewChild('cb') public cb: IgxCheckboxComponent;
label = 'Invisible Label';
}

@Component({
template: `<igx-checkbox #cb [disableTransitions]="true"></igx-checkbox>`
})
class CheckboxDisabledTransitionsComponent {
@ViewChild('cb') public cb: IgxCheckboxComponent;
}
13 changes: 13 additions & 0 deletions projects/igniteui-angular/src/lib/checkbox/checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,19 @@ export class IgxCheckboxComponent implements ControlValueAccessor, EditorProvide
*/
@HostBinding('class.igx-checkbox--disabled')
@Input() public disabled = false;
/**
* Sets/gets whether the checkbox should disable all css transitions.
* Default value is `false`.
* ```html
* <igx-checkbox [disableTransitions]="true"></igx-checkbox>
* ```
* ```typescript
* let disableTransitions = this.checkbox.disableTransitions;
* ```
* @memberof IgxCheckboxComponent
*/
@HostBinding('class.igx-checkbox--plain')
@Input() public disableTransitions = false;
/**
*@hidden
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@
}
}

@include m(plain) {
@extend %cbx-display--plain !optional;
}

@include mx(focused, checked) {
@include e(ripple) {
@extend %cbx-ripple--focused !optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@
opacity: .12;
}
}

%cbx-display--plain {
%cbx-composite,
%cbx-composite::after,
%cbx-composite-mark,
%cbx-composite-mark--x {
transition: none;
}
}
}

/// Adds typography styles for the igx-checkbox component.
Expand Down
6 changes: 5 additions & 1 deletion src/app/input/input.sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ <h4 class="form-title igx-typography__overline">Delete Contacts</h4>
<igx-avatar src="assets/images/avatar/22.jpg" roundShape="true"></igx-avatar>
<span class="name">Alicia Keys</span>
</div>
<igx-checkbox [(ngModel)]="user.registered">Value</igx-checkbox>
<igx-checkbox
[(ngModel)]="user.registered"
[disableTransitions]="true">
Value
</igx-checkbox>
</div>

<div class="checkbox-sample">
Expand Down

0 comments on commit b191125

Please sign in to comment.