From: Hannes Laimer <h.laimer@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>,
Yew framework devel list at Proxmox <yew-devel@lists.proxmox.com>
Subject: Re: [yew-devel] [PATCH yew-widget-toolkit v2 1/2] number: add tooltip to number field
Date: Thu, 9 Oct 2025 13:54:05 +0200 [thread overview]
Message-ID: <c85f5679-894d-496c-818e-b5328e7aa602@proxmox.com> (raw)
In-Reply-To: <39601a36-7960-496d-bd74-9f5559d75074@proxmox.com>
On 10/9/25 13:51, Dominik Csapak wrote:
>
>
> On 10/9/25 1:24 PM, Hannes Laimer wrote:
>> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
>> ---
>> src/widget/form/number.rs | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/src/widget/form/number.rs b/src/widget/form/number.rs
>> index 80f7f6c..ad1a3cd 100644
>> --- a/src/widget/form/number.rs
>> +++ b/src/widget/form/number.rs
>> @@ -368,6 +368,11 @@ pub struct Number<T: NumberTypeInfo> {
>> #[builder_cb(IntoEventCallback, into_event_callback, (String,
>> Option<T>))]
>> #[prop_or_default]
>> pub on_input: Option<Callback<(String, Option<T>)>>,
>> +
>> + /// The tooltip.
>> + #[prop_or_default]
>> + #[builder(IntoPropValue, into_prop_value)]
>> + pub tip: Option<AttrValue>,
>> }
>> impl<T: NumberTypeInfo> Default for Number<T> {
>
>
> please correct me if I'm wrong, but just adding the tip to the
> properties alone wouldn't do anything on its own.
>
> You have to at least use it in the 'view' method, e.g. like this:
>
Yes, that hunk slipped into the second patch
pub enum Msg {
@@ -711,8 +765,15 @@ impl<T: NumberTypeInfo> ManagedField for
NumberField<T> {
),
);
- if let Err(msg) = &validation_result {
- input_container.set_tip(msg.clone())
+ match validation_result {
+ Err(msg) => input_container.set_tip(msg.clone()),
+ Ok(_) => {
+ if let Some(tip) = &props.tip {
+ if !disabled {
+ input_container.set_tip(tip.clone())
+ }
+ }
+ }
}
But I'll send another version anyway, since, as Dietmar mentioned, we
don't really want to depend on proxmox-schema here.
>
> ---
> let mut input_container: Tooltip = Tooltip::empty()
> .with_std_props(&props.std_props)
> .listeners(list: &props.listeners)
> .tip(props.tip.clone())
> ---
_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel
next prev parent reply other threads:[~2025-10-09 11:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 11:25 [yew-devel] [PATCH yew-widget-toolkit v2 0/2] use Schema to populate field properties Hannes Laimer
2025-10-09 11:25 ` [yew-devel] [PATCH yew-widget-toolkit v2 1/2] number: add tooltip to number field Hannes Laimer
2025-10-09 11:51 ` Dominik Csapak
2025-10-09 11:54 ` Hannes Laimer [this message]
2025-10-09 11:25 ` [yew-devel] [PATCH yew-widget-toolkit v2 2/2] form: add schema() builder funtion to checkbox, number and field Hannes Laimer
2025-10-09 11:30 ` [yew-devel] [PATCH yew-widget-toolkit v2 0/2] use Schema to populate field properties Dietmar Maurer
2025-10-09 13:32 ` [yew-devel] superseded: " Hannes Laimer
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=c85f5679-894d-496c-818e-b5328e7aa602@proxmox.com \
--to=h.laimer@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=yew-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