From 35d27b44b77b3a0a988919637e73152151757076 Mon Sep 17 00:00:00 2001 From: Eduard Carrerars Date: Wed, 13 Nov 2024 17:50:24 +0100 Subject: [PATCH] feat(email): add multi email widget --- src/Email.ts | 21 +++++++++++++++++++++ src/WidgetFactory.ts | 3 ++- src/index.ts | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/Email.ts diff --git a/src/Email.ts b/src/Email.ts new file mode 100644 index 0000000..4f52ef0 --- /dev/null +++ b/src/Email.ts @@ -0,0 +1,21 @@ +import Field from "./Field"; + +class Email extends Field { + _multi: boolean = false; + get multi(): boolean { + return this._multi; + } + + set multi(value: boolean) { + this._multi = value; + } + + constructor(props: any) { + super(props); + if (this.parsedWidgetProps.multi) { + this.multi = this.parsedWidgetProps.multi; + } + } +} + +export default Email; diff --git a/src/WidgetFactory.ts b/src/WidgetFactory.ts index 84b0f3e..bf535cd 100644 --- a/src/WidgetFactory.ts +++ b/src/WidgetFactory.ts @@ -39,6 +39,7 @@ import Time from "./Time"; import Alert from "./Alert"; import Comments from "./Comments"; import JSONField from "./JSONField"; +import Email from "./Email"; class WidgetFactory { /** @@ -117,7 +118,7 @@ class WidgetFactory { this._widgetClass = Char; break; case "email": - this._widgetClass = Char; + this._widgetClass = Email; break; case "reference": this._widgetClass = Reference; diff --git a/src/index.ts b/src/index.ts index 78a8620..430083d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,6 +51,7 @@ import HTMLPreview from "./HTMLPreview"; import Alert from "./Alert"; import JSONField from "./JSONField"; import Comments from "./Comments"; +import Email from "./Email"; import { Graph, @@ -138,4 +139,5 @@ export { MinMaxValues, Comments, JSONField, + Email, };