Skip to content

Commit

Permalink
Merge pull request #1274 from VisActor/1269-bug-pivot-tree-indent-inv…
Browse files Browse the repository at this point in the history
…alid

1269 bug pivot tree indent invalid
  • Loading branch information
fangsmile authored Mar 13, 2024
2 parents 04923cd + d4d5bcb commit 5767744
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: pivot tree mode when use headerIcon the indent value invalid #1269\n\n",
"type": "none",
"packageName": "@visactor/vtable"
}
],
"packageName": "@visactor/vtable",
"email": "[email protected]"
}
9 changes: 7 additions & 2 deletions packages/vtable/src/scenegraph/utils/text-icon-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,15 @@ export function createCellContent(
_contentOffset = -table.theme._contentOffset;
}
}
const hierarchyOffset = range
? getHierarchyOffset(range.start.col, range.start.row, table)
: getHierarchyOffset(cellGroup.col, cellGroup.row, table);
const text = convertInternal(textStr).replace(/\r?\n/g, '\n').replace(/\r/g, '\n').split('\n');
const attribute = {
text: text.length === 1 ? text[0] : text,
maxLineWidth: autoColWidth ? Infinity : cellWidth - (padding[1] + padding[3]) - leftIconWidth - rightIconWidth,
maxLineWidth: autoColWidth
? Infinity
: cellWidth - (padding[1] + padding[3]) - leftIconWidth - rightIconWidth - hierarchyOffset,
// fill: true,
// textAlign: 'left',
textBaseline: 'top',
Expand All @@ -213,7 +218,7 @@ export function createCellContent(
lineClamp,
wordBreak: 'break-word',
whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal',
dx: _contentOffset
dx: _contentOffset + (!contentLeftIcons.length && !contentRightIcons.length ? hierarchyOffset : 0)
};
const wrapText = new Text(cellTheme.text ? (Object.assign({}, cellTheme.text, attribute) as any) : attribute);
wrapText.name = 'text';
Expand Down

0 comments on commit 5767744

Please sign in to comment.