import {
  AnalyticalScope, GridCellValueRenderer,
  GridV2Column,
  NotNull
} from "@webbpm/base-package";
import {ICellRendererParams} from "ag-grid-community";

@AnalyticalScope(GridV2Column)
export class ValueWithPrefixRenderer implements GridCellValueRenderer {

  @NotNull()
  public label: string;

  render(params: ICellRendererParams): HTMLElement | string {
    let value = params.valueFormatted ? params.valueFormatted : params.value;
    return value ? `${this.label} ${value}` : value;
  }
}
