- fix for decimals in tables in appl form;
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { InputNumber } from 'primereact/inputnumber';
|
||||
import parseLocaleNumber from '../../../../../../../helpers/parseLocaleNumber';
|
||||
|
||||
const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) => {
|
||||
const initialValue = getValue();
|
||||
@@ -19,7 +20,7 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table })
|
||||
return (
|
||||
<InputNumber
|
||||
disabled={disabled}
|
||||
value={initialValue}
|
||||
value={parseLocaleNumber(initialValue)}
|
||||
/*onValueChange={(e) => onChange(e.value)}*/
|
||||
onFocus={onFocus}
|
||||
onBlur={(e) => onBlur(e.target.value)}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { head, isEmpty, isNil, pathOr, sum } from 'ramda';
|
||||
// components
|
||||
import DefaultCell from './components/DefaultCell';
|
||||
import LastRowCell from './components/LastRowCell';
|
||||
import parseLocaleNumber from '../../../../../helpers/parseLocaleNumber';
|
||||
|
||||
const RenderTable = ({ tableValue = {}, columnsCfg, lastRowCfg, setTableValueFn, disabled }) => {
|
||||
const rows = pathOr([], ['rows'], tableValue)
|
||||
@@ -28,7 +29,7 @@ const RenderTable = ({ tableValue = {}, columnsCfg, lastRowCfg, setTableValueFn,
|
||||
if (columnCfgData.meta.enableFormula) {
|
||||
const getAllRowsValues = newRowsData.rows
|
||||
.map(row => row[columnId])
|
||||
.map(v => isEmpty(v) || isNil(v) ? 0 : v);
|
||||
.map(v => parseLocaleNumber(v));
|
||||
|
||||
if (cellValue === 'sum') {
|
||||
total = sum(getAllRowsValues);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { head, isEmpty, isNil, sum } from 'ramda';
|
||||
import { head, isNil, sum } from 'ramda';
|
||||
import getNumberFormatted from '../../../../../../../helpers/getNumberFormatted';
|
||||
import parseLocaleNumber from '../../../../../../../helpers/parseLocaleNumber';
|
||||
|
||||
const LastRowCell = ({columnId, lastRowCfg, columnMeta = {}, getColumnDataFn}) => {
|
||||
const cellData = head(lastRowCfg.filter(o => !isNil(o[columnId])));
|
||||
@@ -7,7 +8,7 @@ const LastRowCell = ({columnId, lastRowCfg, columnMeta = {}, getColumnDataFn}) =
|
||||
|
||||
if (columnMeta.enableFormula) {
|
||||
const getAllRowsValues = getColumnDataFn(columnId)
|
||||
.map(v => isEmpty(v) || isNil(v) ? 0 : v);
|
||||
.map(v => parseLocaleNumber(v));
|
||||
|
||||
if (cellValue === 'sum') {
|
||||
cellValue = getNumberFormatted(sum(getAllRowsValues));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { InputNumber } from 'primereact/inputnumber';
|
||||
import parseLocaleNumber from '../../../../../../../helpers/parseLocaleNumber';
|
||||
|
||||
const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) => {
|
||||
const initialValue = getValue();
|
||||
@@ -20,7 +21,7 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table })
|
||||
return (
|
||||
<InputNumber
|
||||
disabled={disabled}
|
||||
value={initialValue}
|
||||
value={parseLocaleNumber(initialValue)}
|
||||
/*onValueChange={(e) => onChange(e.value)}*/
|
||||
onFocus={onFocus}
|
||||
onBlur={(e) => onBlur(e.target.value)}
|
||||
|
||||
Reference in New Issue
Block a user