/*--------------------------------------------------------------------------------------------- * 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'; import { getIconCellValue, IconColumnOptions, TableColumn } from 'sql/base/browser/ui/table/plugins/tableColumn'; export interface TextWithIconColumnOptions extends IconColumnOptions { } export class TextWithIconColumn implements TableColumn { constructor(private options: TextWithIconColumnOptions) { } public get definition(): Slick.Column { return { id: this.options.id || this.options.field, field: this.options.field, resizable: this.options.resizable, formatter: (row: number, cell: number, value: any, columnDef: Slick.Column, dataContext: T): string => { const iconValue = getIconCellValue(this.options, dataContext); const titleValue = escape(iconValue.title ?? ''); return `
${titleValue}
`; }, width: this.options.width, name: this.options.name, cssClass: 'slick-icon-cell', headerCssClass: this.options.headerCssClass }; } }