Skip to content

Commit

Permalink
Update to v1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kid1194 committed Dec 20, 2022
1 parent f325d32 commit 5b8efba
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion frappe_better_list_view/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# Licence: Please refer to LICENSE file


__version__ = "1.3.0"
__version__ = "1.3.1"
28 changes: 14 additions & 14 deletions frappe_better_list_view/public/js/better_list_view.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
*/


frappe.provide('frappe.views');

frappe.views.ListView = class ListView extends frappe.views.ListView {
get_args() {
let args = super.get_args();
var args = super.get_args();
if (!args.doctype || args.doctype !== this.doctype) {
frappe.throw(__('ListView invalid super args.'));
return args;
}
if (
$.isArray(this.settings.query_fields)
&& this.settings.query_fields.length
Expand All @@ -37,9 +39,9 @@ frappe.views.ListView = class ListView extends frappe.views.ListView {
let sign = '=',
value = cond;
if ($.isArray(cond)) {
let len = cond.length;
if (len < 2) return null;
let i = 0;
let len = cond.length,
i = 0;
if (len < 2) return;
if (len > 2) column = cond[i++];
sign = cond[i++];
value = cond[i++];
Expand All @@ -52,9 +54,8 @@ frappe.views.ListView = class ListView extends frappe.views.ListView {
this.settings.query_filters[key],
key
);
if (cond && args.filters.indexOf(cond) < 0) {
if (cond && args.filters.indexOf(cond) < 0)
args.filters.push(cond);
}
}
}
if (cint(this.settings.page_length)) {
Expand All @@ -68,16 +69,15 @@ frappe.views.ListView = class ListView extends frappe.views.ListView {
}
if (!this._parsed_list && $.isFunction(this.settings.parser)) {
var me = this;
let renderer = function() {
if (me._parsed_list) return;
me._parsed_list = 1;
me.render_list();
};
(new Promise(function(resolve, reject) {
try {
me.settings.parser(me.data, resolve);
} catch(e) { reject(e); }
})).catch(renderer).finally(renderer);
})).finally(function() {
if (me._parsed_list) return;
me._parsed_list = 1;
me.render_list();
});
return;
}
super.render_list();
Expand Down
29 changes: 14 additions & 15 deletions frappe_better_list_view/public/js/better_list_view_v12.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
*/


frappe.provide('frappe.views');

frappe.views.ListView = class ListView extends frappe.views.ListView {
get_args() {
var args = super.get_args();
if (!args.doctype || args.doctype !== this.doctype) {
frappe.throw(__('Invalid list args.'));
return args;
}
if (
$.isArray(this.settings.query_fields)
&& this.settings.query_fields.length
Expand All @@ -20,9 +22,8 @@ frappe.views.ListView = class ListView extends frappe.views.ListView {
this.settings.query_fields[i],
this.doctype
);
if (args.fields.indexOf(field) < 0) {
if (args.fields.indexOf(field) < 0)
args.fields.push(field);
}
}
}
if (
Expand All @@ -38,9 +39,9 @@ frappe.views.ListView = class ListView extends frappe.views.ListView {
let sign = '=',
value = cond;
if ($.isArray(cond)) {
let len = cond.length;
if (len < 2) return null;
let i = 0;
let len = cond.length,
i = 0;
if (len < 2) return;
if (len > 2) column = cond[i++];
sign = cond[i++];
value = cond[i++];
Expand All @@ -53,9 +54,8 @@ frappe.views.ListView = class ListView extends frappe.views.ListView {
this.settings.query_filters[key],
key
);
if (cond && args.filters.indexOf(cond) < 0) {
if (cond && args.filters.indexOf(cond) < 0)
args.filters.push(cond);
}
}
}
if (cint(this.settings.page_length)) {
Expand All @@ -69,16 +69,15 @@ frappe.views.ListView = class ListView extends frappe.views.ListView {
}
if (!this._parsed_list && $.isFunction(this.settings.parser)) {
var me = this;
let renderer = function() {
if (me._parsed_list) return;
me._parsed_list = 1;
me.render();
};
(new Promise(function(resolve, reject) {
try {
me.settings.parser(me.data, resolve);
} catch(e) { reject(e); }
})).catch(renderer).finally(renderer);
})).finally(function() {
if (me._parsed_list) return;
me._parsed_list = 1;
me.render();
});
return;
}
super.render();
Expand Down

0 comments on commit 5b8efba

Please sign in to comment.