feat: CellForceWidth component.

This commit is contained in:
a.bouhuolia
2021-11-01 09:34:58 +02:00
parent 613454a862
commit 24bd754c72
8 changed files with 66 additions and 4 deletions

View File

@@ -0,0 +1,29 @@
import React from 'react';
import { get } from 'lodash';
import { getForceWidth } from 'utils';
export function CellForceWidth({
value,
column: { forceWidthAccess },
row: { original },
}) {
const forceWidthValue = forceWidthAccess
? get(original, forceWidthAccess)
: value;
return <ForceWidth forceValue={forceWidthValue}>{value}</ForceWidth>;
}
export function ForceWidth({ children, forceValue }) {
const forceWidthValue = forceValue || children;
return (
<span
className={'force-width'}
style={{ minWidth: getForceWidth(forceWidthValue) }}
>
{children}
</span>
);
}

View File

@@ -0,0 +1,4 @@
export * from './CellForceWidth';