@alauda-fe/common
Version:
Alauda frontend team common codes.
35 lines (34 loc) • 1.74 kB
TypeScript
import { ThemeService } from '@alauda/ui';
import { PipeTransform, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { TranslateService } from '../../translate/public-api';
import * as i0 from "@angular/core";
/**
* 业务中存在需要根据界面语言和主题环境切换而变化的数据
* 通过传入第一个参数为环境变量(theme/locale)的回调函数以实现数据的变化
* 例 fn:(locale:string,prefix:string) => string;
* fn | aclLocaleTrans:prefix
*
* 需要组合多种环境影响的场景可以通过柯里化的方式来使用管道
* 例 fn: (locale:string) => (theme:string) => string;
* fn | aclLocaleTrans | aclThemeTrans
*/
export declare class LocaleTransformPipe<T> implements PipeTransform, OnDestroy {
private readonly translate;
private readonly cdr;
private readonly destroyed$$;
constructor(translate: TranslateService, cdr: ChangeDetectorRef);
ngOnDestroy(): void;
transform(fn: (locale: string, ...params: unknown[]) => T, ...params: unknown[]): T;
static ɵfac: i0.ɵɵFactoryDeclaration<LocaleTransformPipe<any>, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<LocaleTransformPipe<any>, "aclLocaleTrans", false>;
}
export declare class ThemeTransformPipe<T> implements PipeTransform, OnDestroy {
private readonly themeService;
private readonly cdr;
private readonly destroyed$$;
constructor(themeService: ThemeService, cdr: ChangeDetectorRef);
ngOnDestroy(): void;
transform(fn: (theme: string, ...params: unknown[]) => T, ...params: unknown[]): T;
static ɵfac: i0.ɵɵFactoryDeclaration<ThemeTransformPipe<any>, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<ThemeTransformPipe<any>, "aclThemeTrans", false>;
}