From afdef441a581eeae02839f67be9c563cccb26c97 Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Tue, 8 Jul 2025 23:28:07 +0200 Subject: [PATCH] feat: Disable monster issue 280 and update handling for attribute Summary of changes - Updated the HTML for monster issue 280 to reflect its disabled state, ensuring that it informs users of its current unavailability. - Modified the JavaScript logic in the relevant files to support the new disabled attribute, enabling better control over component state. Details: - In `280.html`, the `monster-issue-280` component is now given a `disabled` attribute which will visually signal its inactive status to users. - In `280.mjs`, the commented-out selection of, "disabled," was left as a reminder for possible future enhancements and to signal where the cut-off option merging should lead. - The `customelement.mjs` file's function has been enhanced to check for the `disabled` attribute, thus enabling dynamic updates to the component options based on its state. This ensures the component behaves consistently depending on its attributes. --- development/issues/closed/280.html | 4 +++- development/issues/closed/280.mjs | 2 ++ source/dom/customelement.mjs | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/development/issues/closed/280.html b/development/issues/closed/280.html index 963756d0e..ee5b07807 100644 --- a/development/issues/closed/280.html +++ b/development/issues/closed/280.html @@ -15,7 +15,9 @@ </ul> <main> - <monster-issue-280 id="i280"> </monster-issue-280> + <monster-issue-280 id="i280" + disabled="disabled" + > </monster-issue-280> </main> diff --git a/development/issues/closed/280.mjs b/development/issues/closed/280.mjs index c95f8f2b3..12c480c57 100644 --- a/development/issues/closed/280.mjs +++ b/development/issues/closed/280.mjs @@ -38,6 +38,8 @@ setTimeout(() => { const select = document.getElementById("i280") // console.log(select); + //select.setOption("disabled", true); + select.setOption("test.value", ["826", "752"]); select.getSelect().setOption('mapping.labelTemplate', '${name} (${alpha-2})') diff --git a/source/dom/customelement.mjs b/source/dom/customelement.mjs index 2ef0794ee..960e1f4e1 100644 --- a/source/dom/customelement.mjs +++ b/source/dom/customelement.mjs @@ -1031,6 +1031,13 @@ function getOptionsFromScriptTag() { * @return {object} */ function getOptionsFromAttributes() { + + if(this.hasAttribute(ATTRIBUTE_DISABLED) && this.getAttribute(ATTRIBUTE_DISABLED) !== null) { + this.setOption(ATTRIBUTE_DISABLED, true); + } else { + this.setOption(ATTRIBUTE_DISABLED, undefined); + } + if (this.hasAttribute(ATTRIBUTE_OPTIONS)) { try { return parseOptionsJSON.call(this, this.getAttribute(ATTRIBUTE_OPTIONS)); -- GitLab