From e36a24b9d0914ffea35868e7966f8c8fe067a90d Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 8 Jan 2025 02:42:42 +0300 Subject: [PATCH] feat(editable cell): Add focus and blur handling for EditableCell suggestions -Added on_focus and on_blur props to the EditableCell component to handle focus and blur events. --- src/components/editable_cell.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/editable_cell.rs b/src/components/editable_cell.rs index 04592cc..45e75e0 100644 --- a/src/components/editable_cell.rs +++ b/src/components/editable_cell.rs @@ -9,6 +9,8 @@ pub fn EditableCell( key: Arc, focused_cell: ReadSignal>, set_focused_cell: WriteSignal>, + on_focus: Option>, + on_blur: Option>, ) -> impl IntoView { let input_ref = create_node_ref::(); let (local_value, set_local_value) = create_signal(value.clone()); @@ -33,6 +35,9 @@ pub fn EditableCell( move |_| { log!("Focus gained for key: {}", key); set_focused_cell.set(Some(key.to_string())); + if let Some(on_focus) = &on_focus { + on_focus.call(()); + } } }; @@ -40,6 +45,9 @@ pub fn EditableCell( log!("Focus lost"); set_focused_cell.set(None); commit_input(); + if let Some(on_blur) = &on_blur { + on_blur.call(()); + } }; // Update input field value when focused cell changes