Add IconPath type (#14420)

* Add IconPath type

* Add ThemedIconPath subtype

* Update type
This commit is contained in:
Charles Gagnon
2021-02-24 12:49:54 -08:00
committed by GitHub
parent 587ac45418
commit 4b40d66bca
11 changed files with 34 additions and 36 deletions

View File

@@ -28,7 +28,7 @@ import { isUndefinedOrNull } from 'vs/base/common/types';
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType, ModelViewAction } from 'sql/platform/dashboard/browser/interfaces';
import { convertSizeToNumber } from 'sql/base/browser/dom';
import { ButtonCellValue, ButtonColumn } from 'sql/base/browser/ui/table/plugins/buttonColumn.plugin';
import { IUserFriendlyIcon, createIconCssClass, getIconKey } from 'sql/workbench/browser/modelComponents/iconUtils';
import { IconPath, createIconCssClass, getIconKey } from 'sql/workbench/browser/modelComponents/iconUtils';
import { HeaderFilter } from 'sql/base/browser/ui/table/plugins/headerFilter.plugin';
import { onUnexpectedError } from 'vs/base/common/errors';
import { ILogService } from 'vs/platform/log/common/log';
@@ -207,7 +207,7 @@ export default class TableComponent extends ComponentBase<azdata.TableComponentP
}
}
private createIconCssClassInternal(icon: IUserFriendlyIcon): string {
private createIconCssClassInternal(icon: IconPath): string {
const iconKey: string = getIconKey(icon);
const iconCssClass = this._iconCssMap[iconKey] ?? createIconCssClass(icon);
if (!this._iconCssMap[iconKey]) {
@@ -430,7 +430,7 @@ export default class TableComponent extends ComponentBase<azdata.TableComponentP
private createButtonPlugin(col: azdata.ButtonColumn) {
let name = col.value;
if (!this._buttonColumns[col.value]) {
const icon = <IUserFriendlyIcon>(col.options ? (<any>col.options).icon : col.icon);
const icon = <IconPath>(col.options ? (<any>col.options).icon : col.icon);
this._buttonColumns[col.value] = new ButtonColumn({
title: col.value,
iconCssClass: icon ? this.createIconCssClassInternal(icon) : undefined,