Add ability to handle enter key propagation for input model components (#7524)

* Add ability to stop enter key propagation for input model components

* Fix spacing

* onInputEntered -> onEnterKeyPressed
This commit is contained in:
Charles Gagnon
2019-10-07 12:05:43 -07:00
committed by GitHub
parent effa50a9bd
commit 5454917569
7 changed files with 73 additions and 1 deletions

View File

@@ -130,7 +130,18 @@ export class ManageAccessDialog {
rootContainer.addItem(typeContainer, { flex: '0 0 auto' });
const addUserOrGroupInputRow = modelView.modelBuilder.flexContainer().withLayout({ flexFlow: 'row' }).component();
this.addUserOrGroupInput = modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({ inputType: 'text', placeHolder: enterNamePlaceholder, width: 250 }).component();
this.addUserOrGroupInput = modelView.modelBuilder.inputBox()
.withProperties<azdata.InputBoxProperties>(
{
inputType: 'text',
placeHolder: enterNamePlaceholder,
width: 250,
stopEnterPropagation: true
}).component();
this.addUserOrGroupInput.onEnterKeyPressed((value: string) => {
this.hdfsModel.createAndAddAclEntry(value, this.addUserOrGroupSelectedType);
this.addUserOrGroupInput.value = '';
});
const addUserOrGroupButton = modelView.modelBuilder.button().withProperties<azdata.ButtonProperties>({ label: addLabel, width: 75 }).component();
addUserOrGroupButton.onDidClick(() => {
this.hdfsModel.createAndAddAclEntry(this.addUserOrGroupInput.value, this.addUserOrGroupSelectedType);