mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
Revert "feat(BS|PL): sticky columns in RTL mode."
This reverts commit 200a59d6da.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Button } from '@blueprintjs/core';
|
||||
|
||||
import { useAppIntlContext } from 'components/AppIntlProvider';
|
||||
import { FormattedMessage as T, Icon, If } from 'components';
|
||||
|
||||
import { useBalanceSheetContext } from './BalanceSheetProvider';
|
||||
@@ -59,10 +58,8 @@ export const useBalanceSheetColumns = () => {
|
||||
balanceSheet: { table },
|
||||
} = useBalanceSheetContext();
|
||||
|
||||
const { direction } = useAppIntlContext()
|
||||
|
||||
return React.useMemo(
|
||||
() => dynamicColumns(direction, table.columns, table.rows),
|
||||
[direction, table],
|
||||
() => dynamicColumns(table.columns, table.rows),
|
||||
[table],
|
||||
);
|
||||
};
|
||||
|
||||
@@ -16,10 +16,11 @@ const getReportColWidth = (data, accessor, headerText) => {
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Account name column mapper.
|
||||
*/
|
||||
const accountNameMapper = R.curry((direction, data, column) => {
|
||||
const accountNameMapper = R.curry((data, column) => {
|
||||
const accessor = getTableCellValueAccessor(column.cell_index);
|
||||
const width = getReportColWidth(data, accessor, column.label);
|
||||
|
||||
@@ -30,7 +31,7 @@ const accountNameMapper = R.curry((direction, data, column) => {
|
||||
className: column.key,
|
||||
textOverview: true,
|
||||
width: Math.max(width, 300),
|
||||
sticky: direction === 'rtl' ? Align.Right : Align.Left,
|
||||
sticky: Align.Left,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -312,9 +313,9 @@ const isMatchesDateRange = (r) => R.match(/^date-range/g, r).length > 0;
|
||||
/**
|
||||
* Dynamic column mapper.
|
||||
*/
|
||||
const dynamicColumnMapper = R.curry((direction, data, column) => {
|
||||
const dynamicColumnMapper = R.curry((data, column) => {
|
||||
const indexTotalMapper = totalMapper(data);
|
||||
const indexAccountNameMapper = accountNameMapper(direction, data);
|
||||
const indexAccountNameMapper = accountNameMapper(data);
|
||||
const indexDatePeriodMapper = dateRangeMapper(data);
|
||||
|
||||
return R.compose(
|
||||
@@ -327,6 +328,6 @@ const dynamicColumnMapper = R.curry((direction, data, column) => {
|
||||
/**
|
||||
* Cash flow dynamic columns.
|
||||
*/
|
||||
export const dynamicColumns = (direction, columns, data) => {
|
||||
return R.map(dynamicColumnMapper(direction, data), columns);
|
||||
export const dynamicColumns = (columns, data) => {
|
||||
return R.map(dynamicColumnMapper(data), columns);
|
||||
};
|
||||
|
||||
@@ -295,7 +295,7 @@ const totalColumnCompose = R.curry((data, column) => {
|
||||
/**
|
||||
* Account name column mapper.
|
||||
*/
|
||||
const accountNameColumn = R.curry((direction, data, column) => {
|
||||
const accountNameColumn = R.curry((data, column) => {
|
||||
const accessor = getTableCellValueAccessor(column.cell_index);
|
||||
const width = getReportColWidth(data, accessor, column.label);
|
||||
|
||||
@@ -306,7 +306,7 @@ const accountNameColumn = R.curry((direction, data, column) => {
|
||||
className: column.key,
|
||||
textOverview: true,
|
||||
width: Math.max(width, 300),
|
||||
sticky: direction === 'rtl' ? Align.Right : Align.Left,
|
||||
sticky: Align.Left,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -360,9 +360,9 @@ const isMatchesDateRange = (r) => R.match(/^date-range/g, r).length > 0;
|
||||
* @param {} data
|
||||
* @param {} column
|
||||
*/
|
||||
const dynamicColumnMapper = R.curry((direction, data, column) => {
|
||||
const dynamicColumnMapper = R.curry((data, column) => {
|
||||
const indexTotalColumn = totalColumnCompose(data);
|
||||
const indexAccountNameColumn = accountNameColumn(direction, data);
|
||||
const indexAccountNameColumn = accountNameColumn(data);
|
||||
const indexDatePeriodMapper = dateRangeColumn(data);
|
||||
|
||||
return R.compose(
|
||||
@@ -373,8 +373,11 @@ const dynamicColumnMapper = R.curry((direction, data, column) => {
|
||||
});
|
||||
|
||||
/**
|
||||
* Retrieves the dynamic columns of profit/loss sheet.
|
||||
*
|
||||
* @param {*} columns
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export const dynamicColumns = (direction, columns, data) => {
|
||||
return R.map(dynamicColumnMapper(direction, data), columns);
|
||||
export const dynamicColumns = (columns, data) => {
|
||||
return R.map(dynamicColumnMapper(data), columns);
|
||||
};
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
import React from 'react';
|
||||
|
||||
import { dynamicColumns } from './dynamicColumns';
|
||||
|
||||
import { useProfitLossSheetContext } from './ProfitLossProvider';
|
||||
import { useAppIntlContext } from '../../../components/AppIntlProvider';
|
||||
|
||||
/**
|
||||
* Retrieves the profit/loss table columns.
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
export const useProfitLossSheetColumns = () => {
|
||||
const {
|
||||
profitLossSheet: { table },
|
||||
} = useProfitLossSheetContext();
|
||||
|
||||
const { direction } = useAppIntlContext();
|
||||
|
||||
return React.useMemo(
|
||||
() => dynamicColumns(direction, table.columns, table.rows),
|
||||
[direction, table],
|
||||
() => dynamicColumns(table.columns || [], table.rows || []),
|
||||
[table],
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user