mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 01:22:54 +00:00
fix: fix various typos
This commit is contained in:
@@ -77,13 +77,13 @@ export class StringSplitPipe implements PipeTransform {
|
||||
pure: false, // required to update the value when the promise is resolved
|
||||
})
|
||||
export class NumberLocalizedPipe implements PipeTransform, OnDestroy {
|
||||
decialPipe: DecimalPipe;
|
||||
decimalPipe: DecimalPipe;
|
||||
locale: string;
|
||||
onLangChange: Subscription;
|
||||
value: unknown;
|
||||
|
||||
constructor(private readonly translate: TranslateService) {
|
||||
this.decialPipe = new DecimalPipe('de-DE');
|
||||
this.decimalPipe = new DecimalPipe('de-DE');
|
||||
this.locale = translate.currentLang;
|
||||
}
|
||||
|
||||
@@ -124,6 +124,6 @@ export class NumberLocalizedPipe implements PipeTransform, OnDestroy {
|
||||
|
||||
updateValue(value: unknown, digitsInfo?: string | undefined): void {
|
||||
// this.value = this.locale;
|
||||
this.value = this.decialPipe.transform(value, digitsInfo,this.locale);
|
||||
this.value = this.decimalPipe.transform(value, digitsInfo,this.locale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,30 +19,30 @@ import {Injectable} from '@angular/core';
|
||||
|
||||
export abstract class ThingTranslateParser {
|
||||
/**
|
||||
* Gets a value from an object given a keypath
|
||||
* paser.getValueFromKeyPath(anObject, 'property.subarray[42].etc');
|
||||
* Gets a value from an object given a keyPath
|
||||
* parser.getValueFromKeyPath(anObject, 'property.subarray[42].etc');
|
||||
*/
|
||||
abstract getValueFromKeyPath(instance: object, keypath: string): unknown;
|
||||
abstract getValueFromKeyPath(instance: object, keyPath: string): unknown;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ThingTranslateDefaultParser extends ThingTranslateParser {
|
||||
|
||||
getValueFromKeyPath(instance: object, keypath: string): unknown {
|
||||
// keypath = aproperty[0].anotherproperty["arrayproperty"][42].finalproperty
|
||||
let path = keypath.replace(/(?:\"|\')'"/gmi, '.');
|
||||
getValueFromKeyPath(instance: object, keyPath: string): unknown {
|
||||
// keyPath = aproperty[0].anotherproperty["arrayproperty"][42].finalproperty
|
||||
let path = keyPath.replace(/(?:\"|\')'"/gmi, '.');
|
||||
// path = aproperty[0].anotherproperty[.arrayproperty.][42].finalproperty
|
||||
path = path.replace(/(?:\[|\])/gmi, '.');
|
||||
// path = aproperty.0..anotherproperty..arrayproperty...42..finalproperty
|
||||
path = path.replace(/\.{2,}/gmi, '.');
|
||||
// path = aproperty.0.anotherproperty.arrayproperty.42.finalproperty
|
||||
|
||||
const keypathChain = keypath.split('.');
|
||||
const keyPathChain = keyPath.split('.');
|
||||
|
||||
// tslint:disable-next-line: no-any
|
||||
let property = instance as any;
|
||||
|
||||
for(const key of keypathChain) {
|
||||
for(const key of keyPathChain) {
|
||||
property = property[key] ?? undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user