mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:55:33 +00:00
fix(gantt): improve task bar text (#1696)
* fix: progress value is too large, resulting in incorrect calculation of bar width * style: style improve * style: style improve
This commit is contained in:
parent
74e2811255
commit
d0171b179f
@ -13,6 +13,7 @@ const formatData = (
|
||||
hideChildren: boolean = false,
|
||||
) => {
|
||||
data.forEach((item: any) => {
|
||||
const percent=item[fieldNames.progress] * 100;
|
||||
if (item.children && item.children.length) {
|
||||
tasks.push({
|
||||
start: new Date(item[fieldNames.start]),
|
||||
@ -20,7 +21,7 @@ const formatData = (
|
||||
name: item[fieldNames.title],
|
||||
id: item.id + '',
|
||||
type: 'project',
|
||||
progress: item[fieldNames.progress] * 100 || 0,
|
||||
progress: percent>100?100:percent || 0,
|
||||
hideChildren: hideChildren,
|
||||
project: projectId,
|
||||
color: item.color,
|
||||
@ -33,7 +34,7 @@ const formatData = (
|
||||
name: item[fieldNames.title],
|
||||
id: item.id + '',
|
||||
type: fieldNames.end ? 'task' : 'milestone',
|
||||
progress: item[fieldNames.progress] * 100 || 0,
|
||||
progress: percent>100?100:percent || 0,
|
||||
project: projectId,
|
||||
color: item.color,
|
||||
});
|
||||
|
@ -98,7 +98,7 @@ export const TaskItem: React.FC<TaskItemProps> = (props) => {
|
||||
{taskItem}
|
||||
<text
|
||||
x={isProjectBar ? task.x1 : getX()}
|
||||
y={isProjectBar ? task.y - 8 : task.y + taskHeight * 0.5}
|
||||
y={isProjectBar ? task.y - 8 : isTextInside ? task.y + taskHeight * 0.5 : task.y + taskHeight * 0.65}
|
||||
className={isProjectBar ? cx(projectLabel) : isTextInside ? cx(barLabel) : cx(barLabel) && cx(barLabelOutside)}
|
||||
ref={textRef}
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user