Remove Jquery references (#1461)

* modify key codes

* formatting

* change string event type

* code clean up
This commit is contained in:
Anthony Dresser
2018-05-23 10:59:28 -07:00
committed by GitHub
parent 259306a8db
commit 04ec9caad1
3 changed files with 14 additions and 11 deletions

View File

@@ -205,11 +205,11 @@ export class FirewallRuleDialog extends Modal {
this._register(this._themeService.onDidColorThemeChange(e => this.updateTheme(e))); this._register(this._themeService.onDidColorThemeChange(e => this.updateTheme(e)));
this.updateTheme(this._themeService.getColorTheme()); this.updateTheme(this._themeService.getColorTheme());
jQuery(this._IPAddressInput).on('click', () => { $(this._IPAddressInput).on(DOM.EventType.CLICK, () => {
this.onFirewallRuleOptionSelected(true); this.onFirewallRuleOptionSelected(true);
}); });
jQuery(this._subnetIPRangeInput).on('click', () => { $(this._subnetIPRangeInput).on(DOM.EventType.CLICK, () => {
this.onFirewallRuleOptionSelected(false); this.onFirewallRuleOptionSelected(false);
}); });
} }

View File

@@ -14,6 +14,7 @@ import 'vs/css!./media/editData';
import { ElementRef, ChangeDetectorRef, OnInit, OnDestroy, Component, Inject, forwardRef, EventEmitter } from '@angular/core'; import { ElementRef, ChangeDetectorRef, OnInit, OnDestroy, Component, Inject, forwardRef, EventEmitter } from '@angular/core';
import { IGridDataRow, VirtualizedCollection } from 'angular2-slickgrid'; import { IGridDataRow, VirtualizedCollection } from 'angular2-slickgrid';
import { IGridDataSet } from 'sql/parts/grid/common/interfaces'; import { IGridDataSet } from 'sql/parts/grid/common/interfaces';
import * as Services from 'sql/parts/grid/services/sharedServices'; import * as Services from 'sql/parts/grid/services/sharedServices';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService'; import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
@@ -22,8 +23,11 @@ import { GridParentComponent } from 'sql/parts/grid/views/gridParentComponent';
import { EditDataGridActionProvider } from 'sql/parts/grid/views/editData/editDataGridActions'; import { EditDataGridActionProvider } from 'sql/parts/grid/views/editData/editDataGridActions';
import { error } from 'sql/base/common/log'; import { error } from 'sql/base/common/log';
import { clone } from 'sql/base/common/objects'; import { clone } from 'sql/base/common/objects';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity'; import Severity from 'vs/base/common/severity';
import { KeyCode } from 'vs/base/common/keyCodes';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
export const EDITDATA_SELECTOR: string = 'editdata-component'; export const EDITDATA_SELECTOR: string = 'editdata-component';
@@ -408,12 +412,12 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
}, self.scrollTimeOutTime); }, self.scrollTimeOutTime);
} }
protected tryHandleKeyEvent(e): boolean { protected tryHandleKeyEvent(e: StandardKeyboardEvent): boolean {
let handled: boolean = false; let handled: boolean = false;
// If the esc key was pressed while in a create session // If the esc key was pressed while in a create session
let currentNewRowIndex = this.dataSet.totalRows - 2; let currentNewRowIndex = this.dataSet.totalRows - 2;
if (e.keyCode === jQuery.ui.keyCode.ESCAPE && this.newRowVisible && this.currentCell.row === currentNewRowIndex) { if (e.keyCode === KeyCode.Escape && this.newRowVisible && this.currentCell.row === currentNewRowIndex) {
// revert our last new row // revert our last new row
this.removingNewRow = true; this.removingNewRow = true;
@@ -423,7 +427,7 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
this.newRowVisible = false; this.newRowVisible = false;
}); });
handled = true; handled = true;
} else if (e.keyCode === jQuery.ui.keyCode.ESCAPE) { } else if (e.keyCode === KeyCode.Escape) {
this.currentEditCellValue = null; this.currentEditCellValue = null;
this.onRevertRow()(this.currentCell.row); this.onRevertRow()(this.currentCell.row);
handled = true; handled = true;

View File

@@ -35,6 +35,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { AutoColumnSize } from 'sql/base/browser/ui/table/plugins/autoSizeColumns.plugin'; import { AutoColumnSize } from 'sql/base/browser/ui/table/plugins/autoSizeColumns.plugin';
import { DragCellSelectionModel } from 'sql/base/browser/ui/table/plugins/dragCellSelectionModel.plugin'; import { DragCellSelectionModel } from 'sql/base/browser/ui/table/plugins/dragCellSelectionModel.plugin';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
export abstract class GridParentComponent { export abstract class GridParentComponent {
// CONSTANTS // CONSTANTS
@@ -289,7 +290,7 @@ export abstract class GridParentComponent {
protected goToNextGrid() { protected goToNextGrid() {
if (this.renderedDataSets.length > 0) { if (this.renderedDataSets.length > 0) {
let next = this.activeGrid + 1; let next = this.activeGrid + 1;
if (next >= this.renderedDataSets.length) { if (next >= this.renderedDataSets.length) {
next = 0; next = 0;
} }
@@ -567,9 +568,7 @@ export abstract class GridParentComponent {
} }
keyEvent(e: KeyboardEvent): void { keyEvent(e: KeyboardEvent): void {
let self = this; if (this.tryHandleKeyEvent(new StandardKeyboardEvent(e))) {
let handled = self.tryHandleKeyEvent(e);
if (handled) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
} }
@@ -582,12 +581,12 @@ export abstract class GridParentComponent {
* *
* @protected * @protected
* @abstract * @abstract
* @param {any} e * @param {StandardKeyboardEvent} e
* @returns {boolean} * @returns {boolean}
* *
* @memberOf GridParentComponent * @memberOf GridParentComponent
*/ */
protected abstract tryHandleKeyEvent(e): boolean; protected abstract tryHandleKeyEvent(e: StandardKeyboardEvent): boolean;
resizeGrids(): void { resizeGrids(): void {
const self = this; const self = this;