mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add required property to checkbox and set it for deployment dialog (#9392)
This commit is contained in:
@@ -297,7 +297,8 @@ export class ResourceTypePickerDialog extends DialogBase {
|
|||||||
|
|
||||||
private createAgreementCheckbox(agreementInfo: AgreementInfo): azdata.FlexContainer {
|
private createAgreementCheckbox(agreementInfo: AgreementInfo): azdata.FlexContainer {
|
||||||
const checkbox = this._view.modelBuilder.checkBox().withProperties<azdata.CheckBoxProperties>({
|
const checkbox = this._view.modelBuilder.checkBox().withProperties<azdata.CheckBoxProperties>({
|
||||||
ariaLabel: this.getAgreementDisplayText(agreementInfo)
|
ariaLabel: this.getAgreementDisplayText(agreementInfo),
|
||||||
|
required: true
|
||||||
}).component();
|
}).component();
|
||||||
checkbox.checked = false;
|
checkbox.checked = false;
|
||||||
this._toDispose.push(checkbox.onChanged(() => {
|
this._toDispose.push(checkbox.onChanged(() => {
|
||||||
|
|||||||
4
src/sql/azdata.proposed.d.ts
vendored
4
src/sql/azdata.proposed.d.ts
vendored
@@ -202,4 +202,8 @@ declare module 'azdata' {
|
|||||||
export interface InputBoxProperties extends ComponentProperties {
|
export interface InputBoxProperties extends ComponentProperties {
|
||||||
validationErrorMessage?: string;
|
validationErrorMessage?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CheckBoxProperties {
|
||||||
|
required?: boolean;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,14 @@ export class Checkbox extends Widget {
|
|||||||
return this._el.getAttribute('aria-label');
|
return this._el.getAttribute('aria-label');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public set required(val: boolean) {
|
||||||
|
this._el.required = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get required(): boolean {
|
||||||
|
return this._el.required;
|
||||||
|
}
|
||||||
|
|
||||||
public focus(): void {
|
public focus(): void {
|
||||||
this._el.focus();
|
this._el.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ export default class CheckBoxComponent extends ComponentBase implements ICompone
|
|||||||
if (this.ariaLabel) {
|
if (this.ariaLabel) {
|
||||||
this._input.ariaLabel = this.ariaLabel;
|
this._input.ariaLabel = this.ariaLabel;
|
||||||
}
|
}
|
||||||
|
if (this.required) {
|
||||||
|
this._input.required = this.required;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CSS-bound properties
|
// CSS-bound properties
|
||||||
@@ -110,6 +113,14 @@ export default class CheckBoxComponent extends ComponentBase implements ICompone
|
|||||||
this.setPropertyFromUI<azdata.CheckBoxProperties, string>((properties, label) => { properties.label = label; }, newValue);
|
this.setPropertyFromUI<azdata.CheckBoxProperties, string>((properties, label) => { properties.label = label; }, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get required(): boolean {
|
||||||
|
return this.getPropertyOrDefault<azdata.CheckBoxProperties, boolean>((props) => props.required, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public set required(newValue: boolean) {
|
||||||
|
this.setPropertyFromUI<azdata.CheckBoxProperties, boolean>((props, value) => props.required = value, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
public focus(): void {
|
public focus(): void {
|
||||||
this._input.focus();
|
this._input.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user