From 51946b9f1da7a647b8c945a522aca94b66c95614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20Juli=C3=A0?= Date: Tue, 12 Nov 2024 12:36:09 +0100 Subject: [PATCH 1/4] feat: add last step property --- src/Steps.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Steps.ts b/src/Steps.ts index 8db5c18..1cf27fb 100644 --- a/src/Steps.ts +++ b/src/Steps.ts @@ -25,6 +25,16 @@ class Steps extends Field { this._errorField = value; } + _lastStep: string | null = null; + + get lastStep(): string | null { + return this._lastStep; + } + + set lastStep(value: string | null) { + this._lastStep = value; + } + constructor(props: any) { super(props); @@ -36,6 +46,9 @@ class Steps extends Field { if (this.parsedWidgetProps.hasOwnProperty("error_field")) { this._errorField = this.parsedWidgetProps.error_field; } + if (this.parsedWidgetProps.hasOwnProperty("last_step")) { + this._lastStep = this.parsedWidgetProps.last_step; + } } } } From f147e1d3c0ed886d96ec0ef025142925da70ea4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20Juli=C3=A0?= Date: Tue, 12 Nov 2024 12:59:09 +0100 Subject: [PATCH 2/4] feat: refactor laststep as boolean --- src/Steps.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Steps.ts b/src/Steps.ts index 1cf27fb..572a637 100644 --- a/src/Steps.ts +++ b/src/Steps.ts @@ -25,13 +25,13 @@ class Steps extends Field { this._errorField = value; } - _lastStep: string | null = null; + _lastStep: boolean | null = true; - get lastStep(): string | null { + get lastStep(): boolean | null { return this._lastStep; } - set lastStep(value: string | null) { + set lastStep(value: boolean | null) { this._lastStep = value; } From a5ab911232c205f3e7fb4d38c71a36b67fb98248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20Juli=C3=A0?= Date: Tue, 12 Nov 2024 12:59:37 +0100 Subject: [PATCH 3/4] test: update tests laststep --- src/spec/Steps.spec.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/spec/Steps.spec.ts b/src/spec/Steps.spec.ts index b215ce5..2389629 100644 --- a/src/spec/Steps.spec.ts +++ b/src/spec/Steps.spec.ts @@ -21,8 +21,17 @@ describe("A Steps widget", () => { expect(widget.errorField).toBe(null); }); + it("should have default lastStep to true", () => { + const widgetFactory = new WidgetFactory(); + const props = { + name: "state", + }; + const widget = widgetFactory.createWidget("steps", props); + + expect(widget.lastStep).toBe(true); + }); - it("should properly set field", () => { + it("should properly set field errorField", () => { const widgetFactory = new WidgetFactory(); const props = { name: "state", @@ -32,4 +41,15 @@ describe("A Steps widget", () => { expect(widget.errorField).toBe("error"); }); + + it("should properly set field lastStep with false", () => { + const widgetFactory = new WidgetFactory(); + const props = { + name: "state", + widget_props: "{'last_step': false}", + }; + const widget = widgetFactory.createWidget("steps", props); + + expect(widget.lastStep).toBe(false); + }); }); From b10cf76dfec0e8fa3bb62f80fd21261625efb054 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 12 Nov 2024 21:43:15 +0000 Subject: [PATCH 4/4] chore(release): 2.16.0 [skip ci] # [2.16.0](https://github.com/gisce/ooui/compare/v2.15.0...v2.16.0) (2024-11-12) ### Features * add last step property ([51946b9](https://github.com/gisce/ooui/commit/51946b9f1da7a647b8c945a522aca94b66c95614)) * refactor laststep as boolean ([f147e1d](https://github.com/gisce/ooui/commit/f147e1d3c0ed886d96ec0ef025142925da70ea4f)) --- 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 cacd833..c4a770b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gisce/ooui", - "version": "2.15.0", + "version": "2.16.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@gisce/ooui", - "version": "2.15.0", + "version": "2.16.0", "dependencies": { "@gisce/conscheck": "1.0.9", "html-entities": "^2.3.3", diff --git a/package.json b/package.json index 424a9ff..68c1265 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gisce/ooui", - "version": "2.15.0", + "version": "2.16.0", "engines": { "node": "20.5.0" },