From ac342520b9a507767b13331b8bb220b1d663b902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Gu=CC=88ell=20Segarra?= Date: Tue, 9 Jul 2024 09:00:49 +0200 Subject: [PATCH] fix: many2many has the same widget class than one2many --- src/Many2many.ts | 62 -------------------------------------------- src/WidgetFactory.ts | 5 +--- src/index.ts | 2 -- 3 files changed, 1 insertion(+), 68 deletions(-) delete mode 100644 src/Many2many.ts diff --git a/src/Many2many.ts b/src/Many2many.ts deleted file mode 100644 index 38f991a..0000000 --- a/src/Many2many.ts +++ /dev/null @@ -1,62 +0,0 @@ -import Field from "./Field"; - -/** - * A Many2many relationship field - */ -class Many2many extends Field { - /** - * Field size - */ - _size: number = 150; - get size(): number { - return this._size; - } - - set size(value: number) { - this._size = value; - } - - /** - * Relation - */ - _relation: string = ""; - get relation(): string { - return this._relation; - } - - set relation(value: string) { - this._relation = value; - } - - /** - * Must expand widget - */ - _mustExpand: boolean = false; - get mustExpand(): boolean { - return this._mustExpand; - } - - set mustExpand(value: boolean) { - this._mustExpand = value; - } - - constructor(props: any) { - super(props); - - if (props) { - if (props.size) { - this._size = props.size; - } - - if (props.relation) { - this._relation = props.relation; - } - - if (!props.colspan) { - this._mustExpand = true; - } - } - } -} - -export default Many2many; diff --git a/src/WidgetFactory.ts b/src/WidgetFactory.ts index 02e0f5c..97a01c4 100644 --- a/src/WidgetFactory.ts +++ b/src/WidgetFactory.ts @@ -18,7 +18,6 @@ import HTMLPreview from "./HTMLPreview"; import ProgressBar from "./ProgressBar"; import Date from "./Date"; import DateTime from "./DateTime"; -import Many2many from "./Many2many"; import One2many from "./One2many"; import NewLine from "./NewLine"; import Separator from "./Separator"; @@ -98,12 +97,10 @@ class WidgetFactory { case "progressbar": this._widgetClass = ProgressBar; break; - case "many2many": - this._widgetClass = Many2many; - break; case "markdown": this._widgetClass = Markdown; break; + case "many2many": case "one2many": case "one2many_list": this._widgetClass = One2many; diff --git a/src/index.ts b/src/index.ts index 405e434..0c7e432 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,6 @@ import FloatTime from "./FloatTime"; import ProgressBar from "./ProgressBar"; import Date from "./Date"; import DateTime from "./DateTime"; -import Many2many from "./Many2many"; import Markdown from "./Markdown"; import One2many from "./One2many"; import SearchFilter, { SearchFieldTypes } from "./SearchFilter"; @@ -85,7 +84,6 @@ export { HTMLPreview, Date, DateTime, - Many2many, SearchFilter, Container, ContainerWidget,