From 57c3f169a6e16078166eb2e7192e3bbf9233ea29 Mon Sep 17 00:00:00 2001 From: Eduard Carrerars Date: Thu, 5 Dec 2024 15:56:42 +0100 Subject: [PATCH 1/4] feat(Container): allow loading in Page and Group components --- src/Group.ts | 4 ++-- src/Page.ts | 4 ++-- src/spec/Group.spec.ts | 19 +++++++++++++++++++ src/spec/Page.spec.ts | 19 +++++++++++++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/Group.ts b/src/Group.ts index 1f14575..c792454 100644 --- a/src/Group.ts +++ b/src/Group.ts @@ -1,6 +1,6 @@ -import ContainerWidget from "./ContainerWidget"; +import Spinner from "./Spinner"; -class Group extends ContainerWidget { +class Group extends Spinner { _icon: string | null = null; get icon(): string | null { return this._icon; diff --git a/src/Page.ts b/src/Page.ts index 2fb99b5..2c2f65d 100644 --- a/src/Page.ts +++ b/src/Page.ts @@ -1,6 +1,6 @@ -import ContainerWidget from "./ContainerWidget"; +import Spinner from "./Spinner"; -class Page extends ContainerWidget { +class Page extends Spinner { _icon: string | null = null; get icon(): string | null { return this._icon; diff --git a/src/spec/Group.spec.ts b/src/spec/Group.spec.ts index e3dafb3..91133cc 100644 --- a/src/spec/Group.spec.ts +++ b/src/spec/Group.spec.ts @@ -40,4 +40,23 @@ describe("A Group", () => { const widget = widgetFactory.createWidget("group", props); expect(widget.icon).toEqual("home"); }); + describe("working as a spinner", () => { + it("should be loading false as default", () => { + const widgetFactory = new WidgetFactory(); + const props = { + string: "A group", + }; + const widget = widgetFactory.createWidget("group", props); + expect(widget.loading).toBe(false); + }); + it("should be loading true if set", () => { + const widgetFactory = new WidgetFactory(); + const props = { + string: "A group", + loading: true, + }; + const widget = widgetFactory.createWidget("group", props); + expect(widget.loading).toBe(true); + }); + }); }); diff --git a/src/spec/Page.spec.ts b/src/spec/Page.spec.ts index cb8784f..48f7803 100644 --- a/src/spec/Page.spec.ts +++ b/src/spec/Page.spec.ts @@ -14,4 +14,23 @@ describe("A Page", () => { expect(widget.label).toBe("Page 1"); expect(widget.icon).toBe("home"); }); + describe("working as a Spinner", () => { + it("should have loading to be false by default", () => { + const widgetFactory = new WidgetFactory(); + const props = { + string: "Page 1", + }; + const widget = widgetFactory.createWidget("page", props); + expect(widget.loading).toBe(false); + }); + it("should allow setting loading to true", () => { + const widgetFactory = new WidgetFactory(); + const props = { + string: "Page 1", + loading: true, + }; + const widget = widgetFactory.createWidget("page", props); + expect(widget.loading).toBe(true); + }); + }); }); From 94e61c71dbcb3b6e2a7e3def83c1319a988eb8b6 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 9 Dec 2024 12:31:03 +0000 Subject: [PATCH 2/4] chore(release): 2.21.0 [skip ci] # [2.21.0](https://github.com/gisce/ooui/compare/v2.20.0...v2.21.0) (2024-12-09) ### Features * **Container:** allow loading in Page and Group components ([57c3f16](https://github.com/gisce/ooui/commit/57c3f169a6e16078166eb2e7192e3bbf9233ea29)) --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b06fa47..96212a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gisce/ooui", - "version": "2.20.0", + "version": "2.21.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@gisce/ooui", - "version": "2.20.0", + "version": "2.21.0", "dependencies": { "@gisce/conscheck": "1.0.9", "html-entities": "^2.3.3", diff --git a/package.json b/package.json index 5fd3a93..fda612b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gisce/ooui", - "version": "2.20.0", + "version": "2.21.0", "engines": { "node": "20.5.0" }, From ab18d6ae0eee3053fc6a7b19922bbfb15ff4d218 Mon Sep 17 00:00:00 2001 From: Eduard Carrerars Date: Mon, 9 Dec 2024 17:10:00 +0100 Subject: [PATCH 3/4] feat: move fieldType to widget when we use widgets as fields --- src/Field.ts | 12 ------------ src/Widget.ts | 11 +++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Field.ts b/src/Field.ts index e53e830..fbb2295 100644 --- a/src/Field.ts +++ b/src/Field.ts @@ -117,14 +117,6 @@ class Field extends Widget { this._selectionValues = value; } - /** - * Base type of the field - */ - _fieldType: string = ""; - get fieldType(): string { - return this._fieldType; - } - constructor(props: any) { super(props); @@ -136,10 +128,6 @@ class Field extends Widget { this._id = props.name; } - if (props.type) { - this._fieldType = props.fieldsWidgetType; - } - if (props.activated) { this._activated = props.activated; } diff --git a/src/Widget.ts b/src/Widget.ts index 13fe06d..cbf97b6 100644 --- a/src/Widget.ts +++ b/src/Widget.ts @@ -115,6 +115,14 @@ abstract class Widget { this._isFunction = value; } + /** + * Base type of the field + */ + _fieldType: string = ""; + get fieldType(): string { + return this._fieldType; + } + constructor(props?: any) { this._colspan = Widget._defaultColspan; this._invisible = false; @@ -160,6 +168,9 @@ abstract class Widget { this._domain = replaceEntities(props.domain); } } + if (props.type) { + this._fieldType = props.fieldsWidgetType; + } if (props.widget_props) { if (typeof props.widget_props === "string") { try { From 486ec2dd0260743b93be503bf21e376e4571af53 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 10 Dec 2024 11:42:43 +0000 Subject: [PATCH 4/4] chore(release): 2.22.0 [skip ci] # [2.22.0](https://github.com/gisce/ooui/compare/v2.21.0...v2.22.0) (2024-12-10) ### Features * move fieldType to widget when we use widgets as fields ([ab18d6a](https://github.com/gisce/ooui/commit/ab18d6ae0eee3053fc6a7b19922bbfb15ff4d218)) --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 96212a6..38e1e73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gisce/ooui", - "version": "2.21.0", + "version": "2.22.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@gisce/ooui", - "version": "2.21.0", + "version": "2.22.0", "dependencies": { "@gisce/conscheck": "1.0.9", "html-entities": "^2.3.3", diff --git a/package.json b/package.json index fda612b..9d1a67c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gisce/ooui", - "version": "2.21.0", + "version": "2.22.0", "engines": { "node": "20.5.0" },