diff --git a/components/lib/organizationchart/OrganizationChartNode.js b/components/lib/organizationchart/OrganizationChartNode.js index cabae9d251..14c1904c06 100644 --- a/components/lib/organizationchart/OrganizationChartNode.js +++ b/components/lib/organizationchart/OrganizationChartNode.js @@ -72,46 +72,40 @@ export const OrganizationChartNode = React.memo((props) => { return null; } - const rows = chunkArray(node.children, MAX_CHILDREN_PER_ROW); - - return rows.map((row, rowIndex) => { - const colspan = row.length * 2; - - const nodesProps = mergeProps( - { - className: cx('nodes'), - style: { visibility } - }, - _ptm('nodes') - ); + const nodesProps = mergeProps( + { + className: cx('nodes'), + style: { visibility } + }, + _ptm('nodes') + ); - const nodeCellProps = mergeProps( - { - colSpan: '2' - }, - _ptm('nodeCell') - ); + const nodeCellProps = mergeProps( + { + colSpan: '2' + }, + _ptm('nodeCell') + ); - return ( - - {row.map((child, index) => ( - - - - ))} - - ); - }); + return ( + + {row.map((child, index) => ( + + + + ))} + + ); }; const createLinesMiddle = (row) => { @@ -119,46 +113,42 @@ export const OrganizationChartNode = React.memo((props) => { return null; } - const rows = chunkArray(node.children, MAX_CHILDREN_PER_ROW); - - return rows.map((row, rowIndex) => { - const nodeChildLength = row.length; + const nodeChildLength = row.length; - const linesProps = mergeProps( - { - className: cx('lines'), - style: { visibility } - }, - _ptm('lines') - ); + const linesProps = mergeProps( + { + className: cx('lines'), + style: { visibility } + }, + _ptm('lines') + ); - return ( - - {row.map((_, index) => { - const lineLeftProps = mergeProps( - { - className: cx('lineLeft', { index }) - }, - getNodePTOptions(index !== 0, 'lineLeft') - ); - - const lineRightProps = mergeProps( - { - className: cx('lineRight', { index, nodeChildLength }) - }, - getNodePTOptions(index !== nodeChildLength - 1, 'lineRight') - ); - - return ( - -   -   - - ); - })} - - ); - }); + return ( + + {row.map((_, index) => { + const lineLeftProps = mergeProps( + { + className: cx('lineLeft', { index }) + }, + getNodePTOptions(index !== 0, 'lineLeft') + ); + + const lineRightProps = mergeProps( + { + className: cx('lineRight', { index, nodeChildLength }) + }, + getNodePTOptions(index !== nodeChildLength - 1, 'lineRight') + ); + + return ( + +   +   + + ); + })} + + ); }; const createLinesDown = (row) => { @@ -166,41 +156,37 @@ export const OrganizationChartNode = React.memo((props) => { return null; } - const rows = chunkArray(node.children, MAX_CHILDREN_PER_ROW); - - return rows.map((row, rowIndex) => { - const colspan = row.length * 2; + const colspan = row.length * 2; - const linesProps = mergeProps( - { - className: cx('lines'), - style: { visibility } - }, - _ptm('lines') - ); + const linesProps = mergeProps( + { + className: cx('lines'), + style: { visibility } + }, + _ptm('lines') + ); - const lineCellProps = mergeProps( - { - colSpan: colspan - }, - _ptm('lineCell') - ); + const lineCellProps = mergeProps( + { + colSpan: colspan + }, + _ptm('lineCell') + ); - const lineDownProps = mergeProps( - { - className: cx('lineDown') - }, - _ptm('lineDown') - ); + const lineDownProps = mergeProps( + { + className: cx('lineDown') + }, + _ptm('lineDown') + ); - return ( - - -
- - - ); - }); + return ( + + +
+ + + ); }; const createToggler = () => {