Solved some problems with the excel of master statistical

This commit is contained in:
Tiago Ribeiro
2024-09-10 12:00:14 +01:00
parent 33a46c227b
commit 2a10933206
8 changed files with 448 additions and 522 deletions

View File

@@ -1,4 +1,3 @@
/*fields example = [
['id'],
['companyInformation', 'companyInformation', 'name']
@@ -13,17 +12,18 @@ const getFieldValue = (fields: string[], data: any): string => {
};
export const search = (text: string, fields: string[][], rows: any[]) => {
const searchText = text.toLowerCase();
return rows.filter((row) => {
return fields.some((fieldsKeys) => {
const value = getFieldValue(fieldsKeys, row);
if (typeof value === "string") {
return value.toLowerCase().includes(searchText);
}
const searchText = text.toLowerCase();
return rows.filter((row) => {
return fields.some((fieldsKeys) => {
const value = getFieldValue(fieldsKeys, row);
if (typeof value === "string") {
console.log(value, searchText, value.toLowerCase().includes(searchText));
return value.toLowerCase().includes(searchText);
}
if (typeof value === "number") {
return (value as Number).toString().includes(searchText);
}
});
});
}
if (typeof value === "number") {
return (value as Number).toString().includes(searchText);
}
});
});
};