From 9afc46f4d3880cb33eb929ff213d500768840b00 Mon Sep 17 00:00:00 2001 From: CodoPixel Date: Wed, 28 Apr 2021 11:40:30 +0200 Subject: [PATCH] fix(): include null items --- CHANGELOG.md | 4 ++++ src/JSPanel.js | 8 +++++--- src/JSPanel.ts | 8 +++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e4b8f9..bdd1dfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.1.3] - April 28, 2021 + +Bug fixes + ## [1.1.2] - April 25, 2021 Bug fixes diff --git a/src/JSPanel.js b/src/JSPanel.js index 4ab38cb..2e1e6ec 100644 --- a/src/JSPanel.js +++ b/src/JSPanel.js @@ -57,15 +57,17 @@ class JSPanel { if (this.options.items) { const container = this._createEl("div", { className: "container-items" }); for (let item of this.options.items) { - const built_item = this._buildItem(item); - container.appendChild(built_item); + if (item) { + const built_item = this._buildItem(item); + container.appendChild(built_item); + } } this.panel.appendChild(container); } else { throw new Error("You need to define items to be displayed in the panel."); } - // + // // events // document.addEventListener("click", (e) => { diff --git a/src/JSPanel.ts b/src/JSPanel.ts index ab6b648..17ac1d9 100644 --- a/src/JSPanel.ts +++ b/src/JSPanel.ts @@ -104,15 +104,17 @@ class JSPanel { if (this.options.items) { const container = this._createEl("div", { className: "container-items" }); for (let item of this.options.items) { - const built_item = this._buildItem(item); - container.appendChild(built_item); + if (item) { + const built_item = this._buildItem(item); + container.appendChild(built_item); + } } this.panel.appendChild(container); } else { throw new Error("You need to define items to be displayed in the panel."); } - // + // // events //