calendar: Fix duplicate IDs cause click events not respond (#732)

This commit is contained in:
Floyd Wang 2025-03-24 20:01:29 +08:00 committed by GitHub
parent 8a3b858d1a
commit f759cc5023
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -510,7 +510,6 @@ impl Calendar {
fn render_day(
&self,
ix: usize,
d: &NaiveDate,
offset_month: usize,
window: &mut Window,
@ -530,7 +529,7 @@ impl Calendar {
.map_or(false, |disabled| disabled.matched(&date));
self.item_button(
ix,
d.ordinal() as usize,
day.to_string(),
is_active,
is_in_range,
@ -732,9 +731,8 @@ impl Calendar {
)
.children(days.iter().map(|week| {
h_flex().gap_0p5().justify_between().children(
week.iter().enumerate().map(|(ix, d)| {
self.render_day(ix, d, offset_month, window, cx)
}),
week.iter()
.map(|d| self.render_day(d, offset_month, window, cx)),
)
}))
}),