fix: Number compare
- 006 will match abc006 - 1230 will match 1,230 (formatted), 1230 and abc1230
This commit is contained in:
parent
bbca6d8f60
commit
1a0eba65a0
@ -111,12 +111,12 @@ function getFilterMethod(filter) {
|
|||||||
containsNumber(keyword, cells) {
|
containsNumber(keyword, cells) {
|
||||||
return cells
|
return cells
|
||||||
.filter(cell => {
|
.filter(cell => {
|
||||||
let hay = numberCompareValue(cell);
|
let number = parseFloat(keyword, 10);
|
||||||
if (isNaN(hay)) {
|
let string = keyword;
|
||||||
hay = stringCompareValue(cell);
|
let hayNumber = numberCompareValue(cell);
|
||||||
}
|
let hayString = stringCompareValue(cell);
|
||||||
const needle = keyword;
|
|
||||||
return !needle || hay.toString().includes(needle);
|
return number === hayNumber || hayString.includes(string);
|
||||||
})
|
})
|
||||||
.map(cell => cell.rowIndex);
|
.map(cell => cell.rowIndex);
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ function guessFilter(keyword = '') {
|
|||||||
if (isNumber(compareString)) {
|
if (isNumber(compareString)) {
|
||||||
return {
|
return {
|
||||||
type: 'containsNumber',
|
type: 'containsNumber',
|
||||||
text: parseFloat(keyword, 10)
|
text: compareString
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user