mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
moebius#342: Columns are not sorted correctly (Natural Sort algorithm)
Issue #31 https://github.com/MoonchildProductions/moebius/pull/342
This commit is contained in:
parent
6d865bfda3
commit
8a1405d8b9
8 changed files with 218 additions and 35 deletions
|
|
@ -8,6 +8,8 @@ loader.lazyRequireGetter(this, "setNamedTimeout",
|
|||
"devtools/client/shared/widgets/view-helpers", true);
|
||||
loader.lazyRequireGetter(this, "clearNamedTimeout",
|
||||
"devtools/client/shared/widgets/view-helpers", true);
|
||||
loader.lazyRequireGetter(this, "naturalSortCaseInsensitive",
|
||||
"devtools/client/shared/natural-sort", true);
|
||||
const {KeyCodes} = require("devtools/client/shared/keycodes");
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
|
@ -1283,11 +1285,11 @@ Column.prototype = {
|
|||
let index;
|
||||
if (this.sorted == 1) {
|
||||
index = this.cells.findIndex(element => {
|
||||
return value < element.value;
|
||||
return naturalSortCaseInsensitive(value, element.value) === -1;
|
||||
});
|
||||
} else {
|
||||
index = this.cells.findIndex(element => {
|
||||
return value > element.value;
|
||||
return naturalSortCaseInsensitive(value, element.value) === 1;
|
||||
});
|
||||
}
|
||||
index = index >= 0 ? index : this.cells.length;
|
||||
|
|
@ -1415,7 +1417,7 @@ Column.prototype = {
|
|||
a[this.id].textContent : a[this.id];
|
||||
let val2 = (b[this.id] instanceof Node) ?
|
||||
b[this.id].textContent : b[this.id];
|
||||
return val1 > val2;
|
||||
return naturalSortCaseInsensitive(val1, val2);
|
||||
});
|
||||
} else if (this.sorted > 1) {
|
||||
items.sort((a, b) => {
|
||||
|
|
@ -1423,7 +1425,7 @@ Column.prototype = {
|
|||
a[this.id].textContent : a[this.id];
|
||||
let val2 = (b[this.id] instanceof Node) ?
|
||||
b[this.id].textContent : b[this.id];
|
||||
return val2 > val1;
|
||||
return naturalSortCaseInsensitive(val2, val1);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue