2018-02-19 19:07:19 +01:00
|
|
|
import { FieldType } from "../../enums/fieldType";
|
2021-11-02 23:03:37 +01:00
|
|
|
import { LinkedIdType } from "../../enums/linkedIdType";
|
2022-02-22 15:39:11 +01:00
|
|
|
import { Field } from "../domain/field";
|
2018-01-24 17:33:15 +01:00
|
|
|
|
|
|
|
import { View } from "./view";
|
|
|
|
|
|
|
|
export class FieldView implements View {
|
2019-01-25 15:30:21 +01:00
|
|
|
name: string = null;
|
|
|
|
value: string = null;
|
|
|
|
type: FieldType = null;
|
2022-02-22 15:39:11 +01:00
|
|
|
newField = false; // Marks if the field is new and hasn't been saved
|
|
|
|
showValue = false;
|
2022-02-23 22:18:46 +01:00
|
|
|
showCount = false;
|
2021-11-02 23:03:37 +01:00
|
|
|
linkedId: LinkedIdType = null;
|
2018-01-24 17:33:15 +01:00
|
|
|
|
2018-01-26 04:59:53 +01:00
|
|
|
constructor(f?: Field) {
|
|
|
|
if (!f) {
|
|
|
|
return;
|
2018-01-24 17:33:15 +01:00
|
|
|
}
|
2018-01-25 20:26:09 +01:00
|
|
|
|
2018-01-24 17:33:15 +01:00
|
|
|
this.type = f.type;
|
2021-11-02 23:03:37 +01:00
|
|
|
this.linkedId = f.linkedId;
|
2021-12-16 13:36:21 +01:00
|
|
|
}
|
|
|
|
|
2018-01-25 20:26:09 +01:00
|
|
|
get maskedValue(): string {
|
2018-03-06 14:17:39 +01:00
|
|
|
return this.value != null ? "••••••••" : null;
|
2018-01-25 20:26:09 +01:00
|
|
|
}
|
2018-01-24 17:33:15 +01:00
|
|
|
}
|