@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
64 lines (63 loc) • 2.77 kB
TypeScript
import { PipeTransform } from '@angular/core';
import * as i0 from "@angular/core";
export declare type EnumLookupType = 'raw' | 'localized';
/**
* Interface defining extended enum functionality
*/
export interface ExtendedEnum {
enumId: string;
values?: Number[];
toLocaleString?: (type: number) => string;
toString?: (type: number) => string;
compare?: (a: number, b: number) => number;
}
/**
* @smeDoc {@label EnumConverterPipe @id smeEnumConverter}
*
* @overview
* @file {@filepath ./examples/enum-converter-overview.md}
*
* @example {@label Example Enum Converter @id enum-converter-example }
* @file {@filename component.html @filepath ./examples/enum-converter-example.component.html}
* @file {@filename component.ts @filepath ./examples/enum-converter-example.component.ts}
*
* @example {@label Example Color Enum Converter @id color-enum-color-converter }
* @file {@filename color.ts @filepath ./examples/enum-converter-example-color.ts}
* @file {@filename color.component.html @filepath ./examples/enum-converter-example-color.component.html}
* @file {@filename color.component.ts @filepath ./examples/enum-converter-example-color.component.ts}
*/
export declare class EnumConverterPipe implements PipeTransform {
private static enums;
/**
* Registers an Extended enum for use with this pipe
*/
static registerEnum(extendedEnum: ExtendedEnum): void;
/**
* Angular pipe transform implementation
* @param value the current value being piped in
* @param lookupMap a map to lookup a relevant string for the current value
*/
transform(value: number, lookupMap: Map<number, string>): string;
/**
* Angular pipe transform implementation
* @param value the current value being piped in
* @param enumId ths id of the extended enum to use for value translation
* @param lookupType the type of lookup to perform using the extended enum
*/
transform(value: number, enumId: string, lookupType: EnumLookupType): string;
/**
* Translates a value using a registered extended enum
* @param value the current value being piped in
* @param enumId ths id of the extended enum to use for value translation
* @param lookupType the type of lookup to perform using the extended enum
*/
private transformEnumId;
/**
* Transforms the pipe value from the provided lookup map
* @param value the piped value
* @param lookupMap the map to lookup the value
*/
private transformLookupMap;
static ɵfac: i0.ɵɵFactoryDeclaration<EnumConverterPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<EnumConverterPipe, "smeEnumConverter", false>;
}