From 1b4d75bfd0fc913255a63f4241166541b4891a1d Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Tue, 25 Mar 2025 13:52:26 +0100 Subject: [PATCH] fix: update value direct from control #302 --- development/issues/closed/302.html | 31 +++++++++++++++++++++++++++++ development/issues/closed/302.mjs | 25 +++++++++++++++++++++++ source/components/form/login.mjs | 3 ++- source/components/form/password.mjs | 6 ++---- 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 development/issues/closed/302.html create mode 100644 development/issues/closed/302.mjs diff --git a/development/issues/closed/302.html b/development/issues/closed/302.html new file mode 100644 index 00000000..ffa5e623 --- /dev/null +++ b/development/issues/closed/302.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> + <title>passwort update value issue #302</title> + <script src="./302.mjs" type="module"></script> +</head> +<body> + <h1>passwort update value issue #302</h1> + <p></p> + <ul> + <li><a href="https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/302">Issue #302</a></li> + <li><a href="/">Back to overview</a></li> + </ul> + <main> + + <!-- Write your code here --> + + + <monster-login + data-monster-option-fetch-login-url="/issue-299/login" + data-monster-option-fetch-digits-url="/issue-299/digits" + data-monster-option-fetch-secondfactor-url="/issue-299/secondFactorDigits" + data-monster-option-fetch-forgotpassword-url="/issue-299/forgot-password" + + id="password"></monster-login> + + </main> +</body> +</html> diff --git a/development/issues/closed/302.mjs b/development/issues/closed/302.mjs new file mode 100644 index 00000000..0e98d4eb --- /dev/null +++ b/development/issues/closed/302.mjs @@ -0,0 +1,25 @@ +/** + * @file development/issues/open/302.mjs + * @url https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/302 + * @description passwort update value issue + * @issue 302 + */ + +import "../../../source/components/style/property.pcss"; +import "../../../source/components/style/link.pcss"; +import "../../../source/components/style/color.pcss"; +import "../../../source/components/style/theme.pcss"; +import "../../../source/components/style/normalize.pcss"; +import "../../../source/components/style/typography.pcss"; +import "../../../source/components/form/login.mjs"; + + +customElements.whenDefined("monster-password").then(() => { + const elem = document.getElementById("password"); + elem.focus() + elem.addEventListener("keydown", (event) => { + if (event.key === "Enter") { + console.log("Enter key pressed: ", elem.value); + } + }); +}) diff --git a/source/components/form/login.mjs b/source/components/form/login.mjs index ce35c5aa..202ce593 100644 --- a/source/components/form/login.mjs +++ b/source/components/form/login.mjs @@ -487,7 +487,7 @@ function getTranslations() { case "hi": return { - username: "उपयो¤—कर नम य ई-मल", + username: "उपयो\A4\97कर नम य ई-मल", password: "पसवर", login: "लग इन कर", forgotPasswordLink: "पसवर à¤à¤² गà¤?", @@ -1082,6 +1082,7 @@ function initEventHandler() { const username = this.shadowRoot.querySelector( "input[name='username']", ).value; + const password = this.shadowRoot.querySelector("monster-password").value; let missingBits = 0; diff --git a/source/components/form/password.mjs b/source/components/form/password.mjs index da92cf09..2735828d 100644 --- a/source/components/form/password.mjs +++ b/source/components/form/password.mjs @@ -90,9 +90,7 @@ class Password extends CustomControl { * @return {string} */ get value() { - const obj = this.getInternalUpdateCloneData(); - this.value = obj.value; - return obj.value; + return this[inputElementSymbol].value; } /** @@ -101,6 +99,7 @@ class Password extends CustomControl { */ set value(value) { this.setOption("value", value); + this[inputElementSymbol].value=value; this.setFormValue(value); } @@ -262,7 +261,6 @@ function getTemplate() { inputmode path:inputmode, aria-required path:aria.required, aria-placeholder path:aria.placeholder" - data-monster-bind="path:value" > <svg viewBox="0 0 16 16" data-monster-role="visible-icon" class="hidden"> -- GitLab