Add width and height properties to checkbox component (#7482)

This commit is contained in:
Charles Gagnon
2019-10-02 16:21:08 -07:00
committed by GitHub
parent e0a867a184
commit 08b78c3ca5
2 changed files with 15 additions and 1 deletions

View File

@@ -100,6 +100,14 @@ export class Checkbox extends Widget {
this.enabled = true; this.enabled = true;
} }
public setHeight(value: string) {
this._el.style.height = value;
}
public setWidth(value: string) {
this._el.style.width = value;
}
public style(styles: ICheckboxStyles): void { public style(styles: ICheckboxStyles): void {
this.disabledCheckboxForeground = styles.disabledCheckboxForeground; this.disabledCheckboxForeground = styles.disabledCheckboxForeground;
this.updateStyle(); this.updateStyle();

View File

@@ -20,7 +20,7 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work
@Component({ @Component({
selector: 'modelview-checkbox', selector: 'modelview-checkbox',
template: ` template: `
<div #input [style.width]="getWidth()"></div> <div #input [style.width]="getWidth()" [style.height]="getHeight()"></div>
` `
}) })
export default class CheckBoxComponent extends ComponentBase implements IComponent, OnDestroy, AfterViewInit { export default class CheckBoxComponent extends ComponentBase implements IComponent, OnDestroy, AfterViewInit {
@@ -82,6 +82,12 @@ export default class CheckBoxComponent extends ComponentBase implements ICompone
} else { } else {
this._input.disable(); this._input.disable();
} }
if (this.width) {
this._input.setWidth(this.convertSize(this.width));
}
if (this.height) {
this._input.setHeight(this.convertSize(this.height));
}
} }
// CSS-bound properties // CSS-bound properties