mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add readOnly property to InputBoxComponent (#10687)
This commit is contained in:
@@ -62,7 +62,7 @@ export class InputKeyValue extends KeyValue {
|
|||||||
getValueComponent(modelBuilder: azdata.ModelBuilder): azdata.Component {
|
getValueComponent(modelBuilder: azdata.ModelBuilder): azdata.Component {
|
||||||
const container = modelBuilder.flexContainer().withLayout({ alignItems: 'center' }).component();
|
const container = modelBuilder.flexContainer().withLayout({ alignItems: 'center' }).component();
|
||||||
container.addItem(modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
|
container.addItem(modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
|
||||||
value: this.value // TODO: Add a readOnly property to input boxes
|
value: this.value, readOnly: true
|
||||||
}).component());
|
}).component());
|
||||||
|
|
||||||
const copy = modelBuilder.button().withProperties<azdata.ButtonProperties>({
|
const copy = modelBuilder.button().withProperties<azdata.ButtonProperties>({
|
||||||
|
|||||||
1
src/sql/azdata.proposed.d.ts
vendored
1
src/sql/azdata.proposed.d.ts
vendored
@@ -309,6 +309,7 @@ declare module 'azdata' {
|
|||||||
|
|
||||||
export interface InputBoxProperties extends ComponentProperties {
|
export interface InputBoxProperties extends ComponentProperties {
|
||||||
validationErrorMessage?: string;
|
validationErrorMessage?: string;
|
||||||
|
readOnly?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CheckBoxProperties {
|
export interface CheckBoxProperties {
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ export default class InputBoxComponent extends ComponentBase implements ICompone
|
|||||||
}
|
}
|
||||||
|
|
||||||
input.inputElement.required = this.required;
|
input.inputElement.required = this.required;
|
||||||
|
input.inputElement.readOnly = this.readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CSS-bound properties
|
// CSS-bound properties
|
||||||
@@ -316,6 +317,14 @@ export default class InputBoxComponent extends ComponentBase implements ICompone
|
|||||||
this.setPropertyFromUI<azdata.InputBoxProperties, boolean>((props, value) => props.multiline = value, newValue);
|
this.setPropertyFromUI<azdata.InputBoxProperties, boolean>((props, value) => props.multiline = value, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get readOnly(): boolean {
|
||||||
|
return this.getPropertyOrDefault<azdata.InputBoxProperties, boolean>((props) => props.readOnly, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public set readOnly(newValue: boolean) {
|
||||||
|
this.setPropertyFromUI<azdata.InputBoxProperties, boolean>((props, value) => props.readOnly = value, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
public get required(): boolean {
|
public get required(): boolean {
|
||||||
return this.getPropertyOrDefault<azdata.InputBoxProperties, boolean>((props) => props.required, false);
|
return this.getPropertyOrDefault<azdata.InputBoxProperties, boolean>((props) => props.required, false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user