Fix blur
This commit is contained in:
parent
97325d72ef
commit
285ca9e97e
@ -325,10 +325,15 @@ fn resolve_page(url: Url) -> Option<Page> {
|
|||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn render() {
|
pub fn render() {
|
||||||
console_error_panic_hook::set_once();
|
|
||||||
|
|
||||||
let app = seed::App::start("app", init, update, view);
|
let app = seed::App::start("app", init, update, view);
|
||||||
wasm_logger::init(wasm_logger::Config::default());
|
wasm_logger::init(if cfg!(debug_assertions) {
|
||||||
|
console_error_panic_hook::set_once();
|
||||||
|
wasm_logger::Config::default()
|
||||||
|
} else {
|
||||||
|
wasm_logger::Config::new(log::Level::Error)
|
||||||
|
.message_on_new_line()
|
||||||
|
.module_prefix("jirs")
|
||||||
|
});
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
crate::shared::on_event::keydown(move |ev| {
|
crate::shared::on_event::keydown(move |ev| {
|
||||||
|
72
web/src/pages/project_settings_page/events.rs
Normal file
72
web/src/pages/project_settings_page/events.rs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
use jirs_data::IssueStatusId;
|
||||||
|
use seed::prelude::*;
|
||||||
|
|
||||||
|
type EvHandler = EventHandler<crate::Msg>;
|
||||||
|
|
||||||
|
pub fn on_submit_create_column() -> EvHandler {
|
||||||
|
ev(Ev::Submit, move |ev| {
|
||||||
|
ev.prevent_default();
|
||||||
|
ev.stop_propagation();
|
||||||
|
Some(crate::Msg::PageChanged(
|
||||||
|
crate::PageChanged::ProjectSettings(crate::ProjectPageChange::SubmitIssueStatusForm),
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn on_drag_start_start_drag_column(issue_status_id: IssueStatusId) -> EvHandler {
|
||||||
|
drag_ev(Ev::DragStart, move |_| {
|
||||||
|
crate::Msg::PageChanged(crate::PageChanged::ProjectSettings(
|
||||||
|
crate::ProjectPageChange::ColumnDragStarted(issue_status_id),
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn on_drag_end_stop_drag_column(issue_status_id: IssueStatusId) -> EvHandler {
|
||||||
|
drag_ev(Ev::DragEnd, move |_| {
|
||||||
|
Some(crate::Msg::PageChanged(
|
||||||
|
crate::PageChanged::ProjectSettings(crate::ProjectPageChange::ColumnDragStopped(
|
||||||
|
issue_status_id,
|
||||||
|
)),
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn on_drag_over_exchange_position(issue_status_id: IssueStatusId) -> EvHandler {
|
||||||
|
drag_ev(Ev::DragOver, move |ev| {
|
||||||
|
ev.prevent_default();
|
||||||
|
ev.stop_propagation();
|
||||||
|
Some(crate::Msg::PageChanged(
|
||||||
|
crate::PageChanged::ProjectSettings(crate::ProjectPageChange::ColumnExchangePosition(
|
||||||
|
issue_status_id,
|
||||||
|
)),
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn on_drag_leave_leave_drag_column(issue_status_id: IssueStatusId) -> EvHandler {
|
||||||
|
drag_ev(Ev::DragLeave, move |_| {
|
||||||
|
Some(crate::Msg::PageChanged(
|
||||||
|
crate::PageChanged::ProjectSettings(crate::ProjectPageChange::ColumnDragLeave(
|
||||||
|
issue_status_id,
|
||||||
|
)),
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn on_click_edit_column(issue_status_id: IssueStatusId) -> EvHandler {
|
||||||
|
mouse_ev(Ev::Click, move |_| {
|
||||||
|
crate::Msg::PageChanged(crate::PageChanged::ProjectSettings(
|
||||||
|
crate::ProjectPageChange::EditIssueStatusName(Some(issue_status_id)),
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn on_click_delete_column(issue_status_id: IssueStatusId) -> EvHandler {
|
||||||
|
mouse_ev(Ev::Click, move |ev| {
|
||||||
|
ev.prevent_default();
|
||||||
|
ev.stop_propagation();
|
||||||
|
crate::Msg::ModalOpened(crate::ModalType::DeleteIssueStatusModal(Some(
|
||||||
|
issue_status_id,
|
||||||
|
)))
|
||||||
|
})
|
||||||
|
}
|
@ -2,6 +2,7 @@ pub use model::*;
|
|||||||
pub use update::*;
|
pub use update::*;
|
||||||
pub use view::*;
|
pub use view::*;
|
||||||
|
|
||||||
|
mod events;
|
||||||
mod model;
|
mod model;
|
||||||
mod update;
|
mod update;
|
||||||
mod view;
|
mod view;
|
||||||
|
@ -15,7 +15,7 @@ use crate::components::styled_select::{SelectVariant, StyledSelect};
|
|||||||
use crate::components::styled_select_child::StyledSelectOption;
|
use crate::components::styled_select_child::StyledSelectOption;
|
||||||
use crate::components::styled_textarea::StyledTextarea;
|
use crate::components::styled_textarea::StyledTextarea;
|
||||||
use crate::model::{self, ModalType, Model, PageContent};
|
use crate::model::{self, ModalType, Model, PageContent};
|
||||||
use crate::pages::project_settings_page::ProjectSettingsPage;
|
use crate::pages::project_settings_page::{events, ProjectSettingsPage};
|
||||||
use crate::shared::inner_layout;
|
use crate::shared::inner_layout;
|
||||||
use crate::{FieldId, Msg, PageChanged, ProjectFieldId, ProjectPageChange};
|
use crate::{FieldId, Msg, PageChanged, ProjectFieldId, ProjectPageChange};
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ pub fn view(model: &model::Model) -> Node<Msg> {
|
|||||||
|
|
||||||
let category_field = category_field(page);
|
let category_field = category_field(page);
|
||||||
|
|
||||||
let time_tracking_field = time_tracking_select(&page);
|
let time_tracking_field = time_tracking_select(page);
|
||||||
|
|
||||||
let columns_field = columns_section(model, page);
|
let columns_field = columns_section(model, page);
|
||||||
|
|
||||||
@ -252,18 +252,12 @@ fn add_column(page: &ProjectSettingsPage, column_style: &str) -> Node<Msg> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if page.edit_column_id == Some(0) {
|
if page.edit_column_id == Some(0) {
|
||||||
let blur = ev("focusout", |_| {
|
/*let blur = ev("focusout", |_| {
|
||||||
Msg::PageChanged(PageChanged::ProjectSettings(
|
Msg::PageChanged(PageChanged::ProjectSettings(
|
||||||
ProjectPageChange::EditIssueStatusName(None),
|
ProjectPageChange::EditIssueStatusName(None),
|
||||||
))
|
))
|
||||||
});
|
});*/
|
||||||
let on_submit = ev(Ev::Submit, move |ev| {
|
let on_submit = events::on_submit_create_column();
|
||||||
ev.prevent_default();
|
|
||||||
ev.stop_propagation();
|
|
||||||
Some(Msg::PageChanged(PageChanged::ProjectSettings(
|
|
||||||
ProjectPageChange::SubmitIssueStatusForm,
|
|
||||||
)))
|
|
||||||
});
|
|
||||||
|
|
||||||
let input = StyledInput {
|
let input = StyledInput {
|
||||||
value: page.name.value.as_str(),
|
value: page.name.value.as_str(),
|
||||||
@ -271,7 +265,7 @@ fn add_column(page: &ProjectSettingsPage, column_style: &str) -> Node<Msg> {
|
|||||||
auto_focus: true,
|
auto_focus: true,
|
||||||
variant: InputVariant::Primary,
|
variant: InputVariant::Primary,
|
||||||
id: Some(FieldId::ProjectSettings(ProjectFieldId::IssueStatusName)),
|
id: Some(FieldId::ProjectSettings(ProjectFieldId::IssueStatusName)),
|
||||||
input_handlers: vec![blur],
|
input_handlers: vec![/*blur*/],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
.render();
|
.render();
|
||||||
@ -299,17 +293,17 @@ fn column_preview(
|
|||||||
column_style: &str,
|
column_style: &str,
|
||||||
) -> Node<Msg> {
|
) -> Node<Msg> {
|
||||||
if page.edit_column_id == Some(is.id) {
|
if page.edit_column_id == Some(is.id) {
|
||||||
let blur = ev("focusout", |_| {
|
// let blur = ev("focusout", |_| {
|
||||||
Msg::PageChanged(PageChanged::ProjectSettings(
|
// Msg::PageChanged(PageChanged::ProjectSettings(
|
||||||
ProjectPageChange::EditIssueStatusName(None),
|
// ProjectPageChange::EditIssueStatusName(None),
|
||||||
))
|
// ))
|
||||||
});
|
// });
|
||||||
let input = StyledInput {
|
let input = StyledInput {
|
||||||
value: page.name.value.as_str(),
|
value: page.name.value.as_str(),
|
||||||
valid: page.name.is_valid(),
|
valid: page.name.is_valid(),
|
||||||
variant: InputVariant::Primary,
|
variant: InputVariant::Primary,
|
||||||
auto_focus: true,
|
auto_focus: true,
|
||||||
input_handlers: vec![blur],
|
input_handlers: vec![/*blur*/],
|
||||||
id: Some(FieldId::ProjectSettings(ProjectFieldId::IssueStatusName)),
|
id: Some(FieldId::ProjectSettings(ProjectFieldId::IssueStatusName)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
@ -328,46 +322,19 @@ fn show_column_preview(
|
|||||||
column_style: &str,
|
column_style: &str,
|
||||||
) -> Node<Msg> {
|
) -> Node<Msg> {
|
||||||
let id = is.id;
|
let id = is.id;
|
||||||
let drag_started = drag_ev(Ev::DragStart, move |_| {
|
let drag_started = events::on_drag_start_start_drag_column(is.id);
|
||||||
Some(Msg::PageChanged(PageChanged::ProjectSettings(
|
let drag_stopped = events::on_drag_end_stop_drag_column(is.id);
|
||||||
ProjectPageChange::ColumnDragStarted(id),
|
let drag_over_handler = events::on_drag_over_exchange_position(is.id);
|
||||||
)))
|
let drag_out = events::on_drag_leave_leave_drag_column(is.id);
|
||||||
});
|
let on_edit = events::on_click_edit_column(is.id);
|
||||||
let drag_stopped = drag_ev(Ev::DragEnd, move |_| {
|
|
||||||
Some(Msg::PageChanged(PageChanged::ProjectSettings(
|
|
||||||
ProjectPageChange::ColumnDragStopped(id),
|
|
||||||
)))
|
|
||||||
});
|
|
||||||
let drag_over_handler = drag_ev(Ev::DragOver, move |ev| {
|
|
||||||
ev.prevent_default();
|
|
||||||
ev.stop_propagation();
|
|
||||||
Some(Msg::PageChanged(PageChanged::ProjectSettings(
|
|
||||||
ProjectPageChange::ColumnExchangePosition(id),
|
|
||||||
)))
|
|
||||||
});
|
|
||||||
let drag_out = drag_ev(Ev::DragLeave, move |_| {
|
|
||||||
Some(Msg::PageChanged(PageChanged::ProjectSettings(
|
|
||||||
ProjectPageChange::ColumnDragLeave(id),
|
|
||||||
)))
|
|
||||||
});
|
|
||||||
|
|
||||||
let on_edit = mouse_ev(Ev::Click, move |_| {
|
|
||||||
Msg::PageChanged(PageChanged::ProjectSettings(
|
|
||||||
ProjectPageChange::EditIssueStatusName(Some(id)),
|
|
||||||
))
|
|
||||||
});
|
|
||||||
let issue_count_in_column = per_column_issue_count.get(&id).cloned().unwrap_or_default();
|
let issue_count_in_column = per_column_issue_count.get(&id).cloned().unwrap_or_default();
|
||||||
let delete_row = if issue_count_in_column == 0 {
|
let delete_row = if issue_count_in_column == 0 {
|
||||||
let on_delete = mouse_ev(Ev::Click, move |ev| {
|
|
||||||
ev.prevent_default();
|
|
||||||
ev.stop_propagation();
|
|
||||||
Msg::ModalOpened(ModalType::DeleteIssueStatusModal(Some(id)))
|
|
||||||
});
|
|
||||||
let delete = StyledButton {
|
let delete = StyledButton {
|
||||||
variant: ButtonVariant::Primary,
|
variant: ButtonVariant::Primary,
|
||||||
class_list: "removeColumn",
|
class_list: "removeColumn",
|
||||||
icon: Some(StyledIcon::from(Icon::Trash).render()),
|
icon: Some(StyledIcon::from(Icon::Trash).render()),
|
||||||
on_click: Some(on_delete),
|
on_click: Some(events::on_click_delete_column(is.id)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
.render();
|
.render();
|
||||||
|
Loading…
Reference in New Issue
Block a user