Revert "Revert "Remove typings and replace missing methods with vscodes (#8217)"" (#8242)

* Revert "Revert "Remove typings and replace missing methods with vscodes (#8217)" (#8240)"

This reverts commit e801a04bcf.

* fix runtime error

* add tests for chartview
This commit is contained in:
Anthony Dresser
2019-11-06 15:00:34 -08:00
committed by GitHub
parent df6b6ded33
commit 564f78b6f6
185 changed files with 670 additions and 43395 deletions

View File

@@ -19,6 +19,8 @@ import { URI } from 'vs/base/common/uri';
import * as nls from 'vs/nls';
import { EventType, addDisposableListener } from 'vs/base/browser/dom';
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { endsWith } from 'vs/base/common/strings';
import { firstIndex } from 'vs/base/common/arrays';
export type IUserFriendlyIcon = string | URI | { light: string | URI; dark: string | URI };
@@ -192,9 +194,9 @@ export abstract class ComponentBase extends Disposable implements IComponent, On
public convertSizeToNumber(size: number | string): number {
if (size && typeof (size) === 'string') {
if (size.toLowerCase().endsWith('px')) {
if (endsWith(size.toLowerCase(), 'px')) {
return +size.replace('px', '');
} else if (size.toLowerCase().endsWith('em')) {
} else if (endsWith(size.toLowerCase(), 'em')) {
return +size.replace('em', '') * 11;
}
} else if (!size) {
@@ -217,7 +219,7 @@ export abstract class ComponentBase extends Disposable implements IComponent, On
return defaultValue;
}
let convertedSize: string = size ? size.toString() : defaultValue;
if (!convertedSize.toLowerCase().endsWith('px') && !convertedSize.toLowerCase().endsWith('%')) {
if (!endsWith(convertedSize.toLowerCase(), 'px') && !endsWith(convertedSize.toLowerCase(), '%')) {
convertedSize = convertedSize + 'px';
}
return convertedSize;
@@ -308,7 +310,7 @@ export abstract class ContainerBase<T> extends ComponentBase {
if (!componentDescriptor) {
return false;
}
let index = this.items.findIndex(item => item.descriptor.id === componentDescriptor.id && item.descriptor.type === componentDescriptor.type);
let index = firstIndex(this.items, item => item.descriptor.id === componentDescriptor.id && item.descriptor.type === componentDescriptor.type);
if (index >= 0) {
this.items.splice(index, 1);
this._changeRef.detectChanges();