apply css style at the right element (#14144)

* apply css style at the right element

* make mergeCss protected
This commit is contained in:
Alan Ren
2021-02-03 10:27:12 -08:00
committed by GitHub
parent b390052c86
commit 52a642f351
26 changed files with 155 additions and 58 deletions

View File

@@ -32,8 +32,8 @@ import { ILogService } from 'vs/platform/log/common/log';
@Component({
selector: 'modelview-inputBox',
template: `
<div [style.display]="getInputBoxDisplay()" #input [style.width]="width" ></div>
<div [style.display]="getTextAreaDisplay()" #textarea [style.width]="width" ></div>
<div #input [ngStyle]="inputBoxCSSStyles"></div>
<div #textarea [ngStyle]="textAreaCSSStyles"></div>
`
})
export default class InputBoxComponent extends ComponentBase<azdata.InputBoxProperties> implements IComponent, OnDestroy, AfterViewInit {
@@ -363,4 +363,18 @@ export default class InputBoxComponent extends ComponentBase<azdata.InputBoxProp
public set validationErrorMessage(newValue: string) {
this.setPropertyFromUI<string>((props, value) => props.validationErrorMessage = value, newValue);
}
public get inputBoxCSSStyles(): azdata.CssStyles {
return this.mergeCss(super.CSSStyles, {
'width': this.getWidth(),
'display': this.getInputBoxDisplay()
});
}
public get textAreaCSSStyles(): azdata.CssStyles {
return this.mergeCss(super.CSSStyles, {
'width': this.getWidth(),
'display': this.getTextAreaDisplay()
});
}
}