Skip to content

Commit cfffd6f

Browse files
committed
Only remove Total flex when it is the last column and a flex column exists
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
1 parent 16bf662 commit cfffd6f

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/libs/SearchUIUtils.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5768,8 +5768,24 @@ const FLEX_COLUMNS = new Set<string>([
57685768
CONST.SEARCH.TABLE_COLUMNS.TAX_RATE,
57695769
]);
57705770

5771+
const TOTAL_COLUMNS = new Set<string>([
5772+
CONST.SEARCH.TABLE_COLUMNS.TOTAL,
5773+
CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT,
5774+
CONST.SEARCH.TABLE_COLUMNS.TOTAL_PER_ATTENDEE,
5775+
CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT,
5776+
]);
5777+
5778+
/**
5779+
* Returns true when it's safe to remove flex from total columns — i.e., another flex column
5780+
* exists to fill the space, and the total column is the last visible column.
5781+
*/
57715782
function hasFlexColumn(columns?: SearchColumnType[]): boolean {
5772-
return !!columns?.some((col) => FLEX_COLUMNS.has(col));
5783+
if (!columns?.length) {
5784+
return false;
5785+
}
5786+
const lastColumn = columns.at(-1);
5787+
const isTotalLastColumn = !!lastColumn && TOTAL_COLUMNS.has(lastColumn);
5788+
return isTotalLastColumn && columns.some((col) => FLEX_COLUMNS.has(col));
57735789
}
57745790

57755791
export {

0 commit comments

Comments
 (0)