add required indicator (#16777)

This commit is contained in:
Alan Ren
2021-08-16 10:48:23 -07:00
committed by GitHub
parent 2e2e6e2767
commit 560a8b7c9b
3 changed files with 39 additions and 63 deletions

View File

@@ -24,7 +24,8 @@ export interface IInputOptions extends vsIInputBoxOptions {
* to run the base VS Input Box validation logic. See validate() override
* for more info.
*/
requireForceValidations?: boolean
requireForceValidations?: boolean;
required?: boolean;
}
export class InputBox extends vsInputBox {
@@ -60,6 +61,7 @@ export class InputBox extends vsInputBox {
if (_sqlOptions && _sqlOptions.type === 'textarea') {
this._isTextAreaInput = true;
}
this.required = !!this._sqlOptions.required;
}
public override style(styles: IInputBoxStyles): void {
@@ -123,6 +125,14 @@ export class InputBox extends vsInputBox {
return !this.inputElement.hasAttribute('disabled');
}
public get required(): boolean {
return this.inputElement.required;
}
public set required(v: boolean) {
this.inputElement.required = v;
}
public get hideErrors(): boolean {
return this._hideErrors;
}