/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { escape } from 'sql/base/common/strings'; /** * Definition for column with icon on the left of text. */ export interface TextWithIconColumnDefinition extends Slick.Column { iconCssClassField?: string; } export interface TextWithIconColumnOptions { iconCssClassField?: string; field?: string; width?: number; id?: string; resizable?: boolean; name?: string; } export class TextWithIconColumn { private _definition: TextWithIconColumnDefinition; constructor(options: TextWithIconColumnOptions) { this._definition = { id: options.id, field: options.field, resizable: options.resizable, formatter: this.formatter, width: options.width, name: options.name, iconCssClassField: options.iconCssClassField, cssClass: 'slick-icon-cell' }; } private formatter(row: number, cell: number, value: any, columnDef: Slick.Column, dataContext: T): string { const iconColumn = columnDef as TextWithIconColumnDefinition; return `
${escape(value)}
`; } public get definition(): TextWithIconColumnDefinition { return this._definition; } }