mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +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 React from 'react';
|
||||||
import { Button } from '@blueprintjs/core';
|
import { Button } from '@blueprintjs/core';
|
||||||
|
|
||||||
import { useAppIntlContext } from 'components/AppIntlProvider';
|
|
||||||
import { FormattedMessage as T, Icon, If } from 'components';
|
import { FormattedMessage as T, Icon, If } from 'components';
|
||||||
|
|
||||||
import { useBalanceSheetContext } from './BalanceSheetProvider';
|
import { useBalanceSheetContext } from './BalanceSheetProvider';
|
||||||
@@ -59,10 +58,8 @@ export const useBalanceSheetColumns = () => {
|
|||||||
balanceSheet: { table },
|
balanceSheet: { table },
|
||||||
} = useBalanceSheetContext();
|
} = useBalanceSheetContext();
|
||||||
|
|
||||||
const { direction } = useAppIntlContext()
|
|
||||||
|
|
||||||
return React.useMemo(
|
return React.useMemo(
|
||||||
() => dynamicColumns(direction, table.columns, table.rows),
|
() => dynamicColumns(table.columns, table.rows),
|
||||||
[direction, table],
|
[table],
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ const getReportColWidth = (data, accessor, headerText) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account name column mapper.
|
* Account name column mapper.
|
||||||
*/
|
*/
|
||||||
const accountNameMapper = R.curry((direction, data, column) => {
|
const accountNameMapper = R.curry((data, column) => {
|
||||||
const accessor = getTableCellValueAccessor(column.cell_index);
|
const accessor = getTableCellValueAccessor(column.cell_index);
|
||||||
const width = getReportColWidth(data, accessor, column.label);
|
const width = getReportColWidth(data, accessor, column.label);
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ const accountNameMapper = R.curry((direction, data, column) => {
|
|||||||
className: column.key,
|
className: column.key,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
width: Math.max(width, 300),
|
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.
|
* Dynamic column mapper.
|
||||||
*/
|
*/
|
||||||
const dynamicColumnMapper = R.curry((direction, data, column) => {
|
const dynamicColumnMapper = R.curry((data, column) => {
|
||||||
const indexTotalMapper = totalMapper(data);
|
const indexTotalMapper = totalMapper(data);
|
||||||
const indexAccountNameMapper = accountNameMapper(direction, data);
|
const indexAccountNameMapper = accountNameMapper(data);
|
||||||
const indexDatePeriodMapper = dateRangeMapper(data);
|
const indexDatePeriodMapper = dateRangeMapper(data);
|
||||||
|
|
||||||
return R.compose(
|
return R.compose(
|
||||||
@@ -327,6 +328,6 @@ const dynamicColumnMapper = R.curry((direction, data, column) => {
|
|||||||
/**
|
/**
|
||||||
* Cash flow dynamic columns.
|
* Cash flow dynamic columns.
|
||||||
*/
|
*/
|
||||||
export const dynamicColumns = (direction, columns, data) => {
|
export const dynamicColumns = (columns, data) => {
|
||||||
return R.map(dynamicColumnMapper(direction, data), columns);
|
return R.map(dynamicColumnMapper(data), columns);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ const totalColumnCompose = R.curry((data, column) => {
|
|||||||
/**
|
/**
|
||||||
* Account name column mapper.
|
* Account name column mapper.
|
||||||
*/
|
*/
|
||||||
const accountNameColumn = R.curry((direction, data, column) => {
|
const accountNameColumn = R.curry((data, column) => {
|
||||||
const accessor = getTableCellValueAccessor(column.cell_index);
|
const accessor = getTableCellValueAccessor(column.cell_index);
|
||||||
const width = getReportColWidth(data, accessor, column.label);
|
const width = getReportColWidth(data, accessor, column.label);
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ const accountNameColumn = R.curry((direction, data, column) => {
|
|||||||
className: column.key,
|
className: column.key,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
width: Math.max(width, 300),
|
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 {} data
|
||||||
* @param {} column
|
* @param {} column
|
||||||
*/
|
*/
|
||||||
const dynamicColumnMapper = R.curry((direction, data, column) => {
|
const dynamicColumnMapper = R.curry((data, column) => {
|
||||||
const indexTotalColumn = totalColumnCompose(data);
|
const indexTotalColumn = totalColumnCompose(data);
|
||||||
const indexAccountNameColumn = accountNameColumn(direction, data);
|
const indexAccountNameColumn = accountNameColumn(data);
|
||||||
const indexDatePeriodMapper = dateRangeColumn(data);
|
const indexDatePeriodMapper = dateRangeColumn(data);
|
||||||
|
|
||||||
return R.compose(
|
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) => {
|
export const dynamicColumns = (columns, data) => {
|
||||||
return R.map(dynamicColumnMapper(direction, data), columns);
|
return R.map(dynamicColumnMapper(data), columns);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,23 +1,19 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { dynamicColumns } from './dynamicColumns';
|
import { dynamicColumns } from './dynamicColumns';
|
||||||
|
|
||||||
import { useProfitLossSheetContext } from './ProfitLossProvider';
|
import { useProfitLossSheetContext } from './ProfitLossProvider';
|
||||||
import { useAppIntlContext } from '../../../components/AppIntlProvider';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the profit/loss table columns.
|
* Retrieves the profit/loss table columns.
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const useProfitLossSheetColumns = () => {
|
export const useProfitLossSheetColumns = () => {
|
||||||
const {
|
const {
|
||||||
profitLossSheet: { table },
|
profitLossSheet: { table },
|
||||||
} = useProfitLossSheetContext();
|
} = useProfitLossSheetContext();
|
||||||
|
|
||||||
const { direction } = useAppIntlContext();
|
|
||||||
|
|
||||||
return React.useMemo(
|
return React.useMemo(
|
||||||
() => dynamicColumns(direction, table.columns, table.rows),
|
() => dynamicColumns(table.columns || [], table.rows || []),
|
||||||
[direction, table],
|
[table],
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user