mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 09:35:38 -05:00
Remove typings and replace missing methods with vscodes (#8217)
* remove typings and replace missing methods with vscodes * fix strict-null-checks * fix tests
This commit is contained in:
@@ -18,6 +18,7 @@ import * as types from 'vs/base/common/types';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
|
||||
export interface IPanelOptions {
|
||||
/**
|
||||
@@ -202,7 +203,7 @@ export class PanelComponent extends Disposable {
|
||||
* Select on the next tab
|
||||
*/
|
||||
public selectOnNextTab(): void {
|
||||
let activeIndex = this._tabs.toArray().findIndex(i => i === this._activeTab);
|
||||
let activeIndex = firstIndex(this._tabs.toArray(), i => i === this._activeTab);
|
||||
let nextTabIndex = activeIndex + 1;
|
||||
if (nextTabIndex === this._tabs.length) {
|
||||
nextTabIndex = 0;
|
||||
@@ -211,7 +212,7 @@ export class PanelComponent extends Disposable {
|
||||
}
|
||||
|
||||
private findAndRemoveTabFromMRU(tab: TabComponent): void {
|
||||
let mruIndex = this._mru.findIndex(i => i === tab);
|
||||
let mruIndex = firstIndex(this._mru, i => i === tab);
|
||||
|
||||
if (mruIndex !== -1) {
|
||||
// Remove old index
|
||||
|
||||
@@ -15,6 +15,7 @@ import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import * as map from 'vs/base/common/map';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
|
||||
export interface ITabbedPanelStyles {
|
||||
titleActiveForeground?: Color;
|
||||
@@ -171,11 +172,11 @@ export class TabbedPanel extends Disposable {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
if (event.equals(KeyCode.RightArrow)) {
|
||||
let currentIndex = this._tabOrder.findIndex(x => x === tab.tab.identifier);
|
||||
let currentIndex = firstIndex(this._tabOrder, x => x === tab.tab.identifier);
|
||||
this.focusNextTab(currentIndex + 1);
|
||||
}
|
||||
if (event.equals(KeyCode.LeftArrow)) {
|
||||
let currentIndex = this._tabOrder.findIndex(x => x === tab.tab.identifier);
|
||||
let currentIndex = firstIndex(this._tabOrder, x => x === tab.tab.identifier);
|
||||
this.focusNextTab(currentIndex - 1);
|
||||
}
|
||||
if (event.equals(KeyCode.Tab)) {
|
||||
@@ -191,8 +192,7 @@ export class TabbedPanel extends Disposable {
|
||||
|
||||
const insertBefore = !isUndefinedOrNull(index) ? this.tabList.children.item(index) : undefined;
|
||||
if (insertBefore) {
|
||||
this._tabOrder.copyWithin(index! + 1, index!);
|
||||
this._tabOrder[index!] = tab.tab.identifier;
|
||||
this._tabOrder.splice(index!, 0, tab.tab.identifier);
|
||||
this.tabList.insertBefore(tabHeaderElement, insertBefore);
|
||||
} else {
|
||||
this.tabList.append(tabHeaderElement);
|
||||
@@ -267,7 +267,7 @@ export class TabbedPanel extends Disposable {
|
||||
}
|
||||
actualTab.disposables.dispose();
|
||||
this._tabMap.delete(tab);
|
||||
let index = this._tabOrder.findIndex(t => t === tab);
|
||||
let index = firstIndex(this._tabOrder, t => t === tab);
|
||||
this._tabOrder.splice(index, 1);
|
||||
if (this._shownTabId === tab) {
|
||||
this._shownTabId = undefined;
|
||||
|
||||
Reference in New Issue
Block a user