public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH yew-widget-toolkit 1/1] form context: add method to check dirtiness of single fields
Date: Wed, 26 Nov 2025 14:51:12 +0100	[thread overview]
Message-ID: <20251126135114.235158-2-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251126135114.235158-1-s.sterz@proxmox.com>

this allows checking whether a specific field has been updated or not
instead of only checking for the whole form.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 src/widget/form/context.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/widget/form/context.rs b/src/widget/form/context.rs
index 85de6734..8bdf5789 100644
--- a/src/widget/form/context.rs
+++ b/src/widget/form/context.rs
@@ -690,6 +690,17 @@ impl FormContextState {
         self.version += 1;
     }

+    /// Check if the field identified by `name` has been changed.
+    ///
+    /// If the there is no field with `name`, `None` will be returned.
+    pub fn is_field_dirty(&self, name: impl IntoPropValue<AttrValue>) -> Option<bool> {
+        let name = name.into_prop_value();
+        self.fields
+            .iter()
+            .find(|(_key, f)| &f.name == &name)
+            .map(|(_key, f)| f.is_dirty())
+    }
+
     pub fn is_dirty(&self) -> bool {
         for (_name, group) in self.groups.clone().iter() {
             if group.radio_count > 0 && group.default != group.value {
--
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  reply	other threads:[~2025-11-26 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 13:51 [pdm-devel] [PATCH yew-comp/yew-widget-toolkit 0/2] fix user self-editing Shannon Sterz
2025-11-26 13:51 ` Shannon Sterz [this message]
2025-11-26 13:51 ` [pdm-devel] [PATCH yew-comp 1/1] user panel: update user expiration only if it changed Shannon Sterz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251126135114.235158-2-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal