Fixed #4285 - Locale performance updates with large datasets
parent
961ba354f5
commit
99d77616af
|
@ -2589,7 +2589,7 @@ export default {
|
||||||
let innerHTML = '';
|
let innerHTML = '';
|
||||||
|
|
||||||
if (this.responsiveOptions) {
|
if (this.responsiveOptions) {
|
||||||
let responsiveOptions = [...this.responsiveOptions].filter((o) => !!(o.breakpoint && o.numMonths)).sort((o1, o2) => -1 * o1.breakpoint.localeCompare(o2.breakpoint, undefined, { numeric: true }));
|
let responsiveOptions = [...this.responsiveOptions].filter((o) => !!(o.breakpoint && o.numMonths)).sort((o1, o2) => -1 * new Intl.Collator(undefined, { numeric: true }).compare(o1.breakpoint, o2.breakpoint));
|
||||||
|
|
||||||
for (let i = 0; i < responsiveOptions.length; i++) {
|
for (let i = 0; i < responsiveOptions.length; i++) {
|
||||||
let { breakpoint, numMonths } = responsiveOptions[i];
|
let { breakpoint, numMonths } = responsiveOptions[i];
|
||||||
|
|
|
@ -537,7 +537,7 @@ export default {
|
||||||
if (value1 == null && value2 != null) result = -1;
|
if (value1 == null && value2 != null) result = -1;
|
||||||
else if (value1 != null && value2 == null) result = 1;
|
else if (value1 != null && value2 == null) result = 1;
|
||||||
else if (value1 == null && value2 == null) result = 0;
|
else if (value1 == null && value2 == null) result = 0;
|
||||||
else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, undefined, { numeric: true });
|
else if (typeof value1 === 'string' && typeof value2 === 'string') result = new Intl.Collator(undefined, { numeric: true }).compare(value1, value2);
|
||||||
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
||||||
|
|
||||||
return -1 * result;
|
return -1 * result;
|
||||||
|
|
|
@ -119,7 +119,7 @@ export default {
|
||||||
if (value1 == null && value2 != null) result = -1;
|
if (value1 == null && value2 != null) result = -1;
|
||||||
else if (value1 != null && value2 == null) result = 1;
|
else if (value1 != null && value2 == null) result = 1;
|
||||||
else if (value1 == null && value2 == null) result = 0;
|
else if (value1 == null && value2 == null) result = 0;
|
||||||
else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, undefined, { numeric: true });
|
else if (typeof value1 === 'string' && typeof value2 === 'string') result = new Intl.Collator(undefined, { numeric: true }).compare(value1, value2);
|
||||||
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
||||||
|
|
||||||
return this.sortOrder * result;
|
return this.sortOrder * result;
|
||||||
|
|
|
@ -446,7 +446,7 @@ export default {
|
||||||
if (value1 == null && value2 != null) result = -1;
|
if (value1 == null && value2 != null) result = -1;
|
||||||
else if (value1 != null && value2 == null) result = 1;
|
else if (value1 != null && value2 == null) result = 1;
|
||||||
else if (value1 == null && value2 == null) result = 0;
|
else if (value1 == null && value2 == null) result = 0;
|
||||||
else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, undefined, { numeric: true });
|
else if (typeof value1 === 'string' && typeof value2 === 'string') result = new Intl.Collator(undefined, { numeric: true }).compare(value1, value2);
|
||||||
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
||||||
|
|
||||||
return -1 * result;
|
return -1 * result;
|
||||||
|
|
|
@ -426,7 +426,7 @@ export default {
|
||||||
if (value1 == null && value2 != null) result = -1;
|
if (value1 == null && value2 != null) result = -1;
|
||||||
else if (value1 != null && value2 == null) result = 1;
|
else if (value1 != null && value2 == null) result = 1;
|
||||||
else if (value1 == null && value2 == null) result = 0;
|
else if (value1 == null && value2 == null) result = 0;
|
||||||
else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, undefined, { numeric: true });
|
else if (typeof value1 === 'string' && typeof value2 === 'string') result = new Intl.Collator(undefined, { numeric: true }).compare(value1, value2);
|
||||||
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
||||||
|
|
||||||
return this.d_sortOrder * result;
|
return this.d_sortOrder * result;
|
||||||
|
@ -458,7 +458,8 @@ export default {
|
||||||
if (value1 === value2) {
|
if (value1 === value2) {
|
||||||
return this.d_multiSortMeta.length - 1 > index ? this.multisortField(node1, node2, index + 1) : 0;
|
return this.d_multiSortMeta.length - 1 > index ? this.multisortField(node1, node2, index + 1) : 0;
|
||||||
} else {
|
} else {
|
||||||
if ((typeof value1 === 'string' || value1 instanceof String) && (typeof value2 === 'string' || value2 instanceof String)) return this.d_multiSortMeta[index].order * value1.localeCompare(value2, undefined, { numeric: true });
|
if ((typeof value1 === 'string' || value1 instanceof String) && (typeof value2 === 'string' || value2 instanceof String))
|
||||||
|
return this.d_multiSortMeta[index].order * new Intl.Collator(undefined, { numeric: true }).compare(value1, value2);
|
||||||
else result = value1 < value2 ? -1 : 1;
|
else result = value1 < value2 ? -1 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue