mask field

This commit is contained in:
Kyle Spearrin 2018-03-06 08:17:39 -05:00
parent 145188c005
commit a3beb04f7e
1 changed files with 2 additions and 21 deletions

View File

@ -6,13 +6,9 @@ import { Field } from '../domain/field';
export class FieldView implements View {
name: string;
value: string;
type: FieldType;
// tslint:disable
private _value: string;
private _maskedValue: string;
// tslint:enable
constructor(f?: Field) {
if (!f) {
return;
@ -21,22 +17,7 @@ export class FieldView implements View {
this.type = f.type;
}
get value(): string {
return this._value;
}
set value(value: string) {
this._value = value;
this._maskedValue = null;
}
get maskedValue(): string {
if (this._maskedValue == null && this.value != null) {
this._maskedValue = '';
for (let i = 0; i < this.value.length; i++) {
this._maskedValue += '•';
}
}
return this._maskedValue;
return this.value != null ? '••••••••' : null;
}
}