From f2d4801634c2b71a79a249cd7df5a28d3b9ac06c Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 18 Mar 2022 13:16:43 -0700 Subject: [PATCH] change the trigger of inputbox commit event (#18776) --- .../browser/ui/table/tableCellEditorFactory.ts | 4 +--- src/sql/workbench/browser/designer/designer.ts | 14 +++----------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/sql/base/browser/ui/table/tableCellEditorFactory.ts b/src/sql/base/browser/ui/table/tableCellEditorFactory.ts index 5f2387f276..f9fbf68bc5 100644 --- a/src/sql/base/browser/ui/table/tableCellEditorFactory.ts +++ b/src/sql/base/browser/ui/table/tableCellEditorFactory.ts @@ -10,7 +10,6 @@ import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview import { KeyCode } from 'vs/base/common/keyCodes'; import * as DOM from 'vs/base/browser/dom'; import { Dropdown } from 'sql/base/browser/ui/editableDropdown/browser/dropdown'; -import { debounce } from 'vs/base/common/decorators'; import { Event } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; @@ -69,7 +68,7 @@ export class TableCellEditorFactory { self._options.editorStyler(this._input); this._input.element.style.height = '100%'; this._input.focus(); - this._input.onDidChange(async () => { + this._input.onLoseFocus(async () => { await this.commitEdit(); }); this._register(this._input); @@ -78,7 +77,6 @@ export class TableCellEditorFactory { })); } - @debounce(200) private async commitEdit(): Promise { if (this.isValueChanged()) { const item = this._args.grid.getDataItem(this._args.grid.getActiveCell().row); diff --git a/src/sql/workbench/browser/designer/designer.ts b/src/sql/workbench/browser/designer/designer.ts index 242917ac99..81a0bb48ea 100644 --- a/src/sql/workbench/browser/designer/designer.ts +++ b/src/sql/workbench/browser/designer/designer.ts @@ -45,7 +45,6 @@ import { alert } from 'vs/base/browser/ui/aria/aria'; import { layoutDesignerTable, TableHeaderRowHeight, TableRowHeight } from 'sql/workbench/browser/designer/designerTableUtil'; import { Dropdown, IDropdownStyles } from 'sql/base/browser/ui/editableDropdown/browser/dropdown'; import { IListStyles } from 'vs/base/browser/ui/list/listWidget'; -import { debounce } from 'vs/base/common/decorators'; export interface IDesignerStyle { tabbedPanelStyles?: ITabbedPanelStyles; @@ -723,11 +722,9 @@ export class Designer extends Disposable implements IThemable { ariaLabel: inputProperties.title, type: inputProperties.inputType, }); - input.onDidChange(() => { - // The supress edit processing check is done in the handleEdit method, but since we have debounce operation on input box we - // have to do it here to avoid treating system originated value setting operation as user edits. - if (!this._supressEditProcessing) { - this.handleInputBoxEdit({ type: DesignerEditType.Update, path: propertyPath, value: input.value, source: view }); + input.onLoseFocus((args) => { + if (args.hasChanged) { + this.handleEdit({ type: DesignerEditType.Update, path: propertyPath, value: args.value, source: view }); } }); input.onInputFocus(() => { @@ -944,11 +941,6 @@ export class Designer extends Disposable implements IThemable { return component; } - @debounce(200) - private handleInputBoxEdit(edit: DesignerEdit) { - this.handleEdit(edit); - } - private startLoading(message: string, timeout: number): void { this._loadingTimeoutHandle = setTimeout(() => { this._loadingSpinner.loadingMessage = message;