This commit is contained in:
2026-07-25 23:08:19 -04:00
parent 5cef8b1ca6
commit d90c0b040d
2 changed files with 29 additions and 12 deletions
+23 -10
View File
@@ -6,7 +6,7 @@ use http::StatusCode;
use iced::alignment::Horizontal;
use iced::widget::button::Style;
use iced::widget::grid::Sizing;
use iced::widget::{button, center, column, combo_box, container, grid, mouse_area, opaque, pick_list, row, scrollable, space, stack, table, text, text_input, toggler};
use iced::widget::{button, center, column, combo_box, container, grid, mouse_area, opaque, operation, pick_list, row, scrollable, space, stack, table, text, text_input, toggler};
use iced::window::Settings;
use iced::{Background, Color, Element, Length, Subscription, Task, color, window};
use iced::widget::text::Wrapping;
@@ -392,7 +392,7 @@ impl Publisher {
query: String::new(),
results: Vec::new(),
});
task = window_task.map(|_| Message::None);
task = window_task.then(|_| operation::focus("query"));
}
if let Some(selected_entity_class) = selected_entity_class {
@@ -680,14 +680,26 @@ impl Publisher {
})
.unwrap_or(Horizontal::Left);
let object_input_base = iri_input(&self.curie_helper, "Object", Some(&base), value.as_str())
.on_shift_click(Message::NavigateToObject(key));
let object_input = if self.ontology.is_read_only(triple.as_ref()) {
object_input_base
// If the datatype is something, then it's not a named node, and we should use a plain
// text_input as opposed to an iri_input.
let object_input: Element<Message> = if term.datatype().is_some() {
let base = text_input("Object", value.as_str());
if self.ontology.is_read_only(triple.as_ref()) {
base.into()
} else {
base.on_input(move |value| Message::ObjectUpdated(key, value)).into()
}
} else {
object_input_base.align_x(value_alignment)
.on_input(move |value| Message::ObjectUpdated(key, value))
.on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Object(key)))
let base = iri_input(&self.curie_helper, "Object", Some(&base), value.as_str())
.on_shift_click(Message::NavigateToObject(key));
if self.ontology.is_read_only(triple.as_ref()) {
base.into()
} else {
base.align_x(value_alignment)
.on_input(move |value| Message::ObjectUpdated(key, value))
.on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Object(key)))
.into()
}
};
let selected_datatype = term.datatype()
@@ -781,7 +793,8 @@ impl Publisher {
&& search_state.window_id == window
{
let search_input =
text_input("Query", &search_state.query).on_input(Message::QueryUpdated);
text_input("Query", &search_state.query).on_input(Message::QueryUpdated)
.id("query");
let entities = self.ontology
.searchable_classes(&*language::ENGLISH_OR_UNTAGGED)