Merge pull request #25413 from ankush/fix_time_ctl

fix: wait for datepicker changes to propogate
This commit is contained in:
Ankush Menat 2024-03-14 12:48:34 +05:30 committed by GitHub
commit 3d8e8463a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 8 deletions

View file

@ -93,6 +93,7 @@ frappe.ui.form.ControlDate = class ControlDate extends frappe.ui.form.ControlDat
// so explicitly bind the event
this.datepicker.$datepicker.find('[data-action="today"]').click(() => {
this.datepicker.selectDate(this.get_now_date());
this.datepicker.hide();
});
}
update_datepicker_position() {

View file

@ -603,6 +603,11 @@ class FilterArea {
this.$filter_list_wrapper = this.list_view.$filter_section;
this.trigger_refresh = true;
this.debounced_refresh_list_view = frappe.utils.debounce(
this.refresh_list_view.bind(this),
300
);
this.setup();
}
@ -764,13 +769,13 @@ class FilterArea {
label: "ID",
condition: "like",
fieldname: "name",
onchange: () => this.refresh_list_view(),
onchange: () => this.debounced_refresh_list_view(),
});
}
if (this.list_view.custom_filter_configs) {
this.list_view.custom_filter_configs.forEach((config) => {
config.onchange = () => this.refresh_list_view();
config.onchange = () => this.debounced_refresh_list_view();
});
fields = fields.concat(this.list_view.custom_filter_configs);
@ -827,7 +832,7 @@ class FilterArea {
options: options,
fieldname: df.fieldname,
condition: condition,
onchange: () => this.refresh_list_view(),
onchange: () => this.debounced_refresh_list_view(),
ignore_link_validation: fieldtype === "Dynamic Link",
is_filter: 1,
};
@ -889,7 +894,7 @@ class FilterArea {
filter_button: this.filter_button,
filter_x_button: this.filter_x_button,
default_filters: [],
on_change: () => this.refresh_list_view(),
on_change: () => this.debounced_refresh_list_view(),
});
}

View file

@ -478,6 +478,7 @@ frappe.ui.filter_utils = {
df.description = "";
df.reqd = 0;
df.length = 1000; // this won't be saved, no need to apply 140 character limit here
df.ignore_link_validation = true;
// given

View file

@ -64,10 +64,7 @@ frappe.ui.FilterGroup = class {
set_popover_events() {
$(document.body).on("click", (e) => {
if (this.wrapper && this.wrapper.is(":visible")) {
const in_datepicker =
$(e.target).is(".datepicker--cell") ||
$(e.target).closest(".datepicker--nav-title").length !== 0 ||
$(e.target).parents(".datepicker--nav-action").length !== 0;
const in_datepicker = $(e.target).parents(".datepicker").length;
if (
$(e.target).parents(".filter-popover").length === 0 &&