UI - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: выравнивание сетки главного Ганта
This commit is contained in:
parent
a9f2c53e89
commit
4fe6d091e0
|
|
@ -184,6 +184,19 @@ const getTimelineTicks = (startDate: Date, endDate: Date, dayWidth: number, step
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getTimelineGridLines = (startDate: Date, endDate: Date, dayWidth: number) => {
|
||||||
|
const days = getDaysBetween(startDate, endDate);
|
||||||
|
|
||||||
|
return Array.from({ length: days + 1 }, (_, index) => {
|
||||||
|
const date = addDays(startDate, index);
|
||||||
|
return {
|
||||||
|
id: date.toISOString(),
|
||||||
|
isMonthStart: date.getDate() === 1,
|
||||||
|
left: index * dayWidth,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const getShortDateLabel = (date: Date, locale: string) =>
|
const getShortDateLabel = (date: Date, locale: string) =>
|
||||||
new Intl.DateTimeFormat(locale || "ru-RU", {
|
new Intl.DateTimeFormat(locale || "ru-RU", {
|
||||||
day: "numeric",
|
day: "numeric",
|
||||||
|
|
@ -204,10 +217,11 @@ const isOverdueItem = (item: TGanttTimelinePreviewItem, today: Date) => {
|
||||||
|
|
||||||
const matchesStatusFilters = (item: TGanttTimelinePreviewItem, activeStatusFilters: TGanttPreviewStatusFilter[]) => {
|
const matchesStatusFilters = (item: TGanttTimelinePreviewItem, activeStatusFilters: TGanttPreviewStatusFilter[]) => {
|
||||||
if (activeStatusFilters.length === 0) return true;
|
if (activeStatusFilters.length === 0) return true;
|
||||||
if (!item.state_group) return false;
|
const stateGroup = item.state_group;
|
||||||
|
if (!stateGroup) return false;
|
||||||
|
|
||||||
return activeStatusFilters.some((filterKey) =>
|
return activeStatusFilters.some((filterKey) =>
|
||||||
GANTT_STATUS_FILTER_OPTIONS.find((option) => option.key === filterKey)?.groups.includes(item.state_group)
|
GANTT_STATUS_FILTER_OPTIONS.find((option) => option.key === filterKey)?.groups.includes(stateGroup)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -304,6 +318,7 @@ export function GanttTimelinePreview(props: TGanttTimelinePreviewProps) {
|
||||||
return {
|
return {
|
||||||
blocks,
|
blocks,
|
||||||
canvasWidth,
|
canvasWidth,
|
||||||
|
gridLines: getTimelineGridLines(startDate, endDate, settings.dayWidth),
|
||||||
ticks: getTimelineTicks(startDate, endDate, settings.dayWidth, settings.tickStepDays, locale),
|
ticks: getTimelineTicks(startDate, endDate, settings.dayWidth, settings.tickStepDays, locale),
|
||||||
todayLabel: getShortDateLabel(today, locale),
|
todayLabel: getShortDateLabel(today, locale),
|
||||||
timelineWidth,
|
timelineWidth,
|
||||||
|
|
@ -517,9 +532,18 @@ export function GanttTimelinePreview(props: TGanttTimelinePreviewProps) {
|
||||||
>
|
>
|
||||||
<div className="nodedc-home-gantt-canvas" style={{ width: `${timeline.canvasWidth}px` }}>
|
<div className="nodedc-home-gantt-canvas" style={{ width: `${timeline.canvasWidth}px` }}>
|
||||||
<div className="nodedc-home-gantt-grid" style={{ width: `${timeline.timelineWidth}px` }} aria-hidden="true">
|
<div className="nodedc-home-gantt-grid" style={{ width: `${timeline.timelineWidth}px` }} aria-hidden="true">
|
||||||
|
{timeline.gridLines.map((line) => (
|
||||||
|
<div
|
||||||
|
key={line.id}
|
||||||
|
className={cn("nodedc-home-gantt-grid-line", {
|
||||||
|
"nodedc-home-gantt-grid-line-major": line.isMonthStart,
|
||||||
|
})}
|
||||||
|
style={{ left: `${line.left}px` }}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
{timeline.ticks.map((tick) => (
|
{timeline.ticks.map((tick) => (
|
||||||
<div key={tick.id} className="nodedc-home-gantt-grid-column" style={{ left: `${tick.left}px` }}>
|
<div key={tick.id} className="nodedc-home-gantt-grid-label" style={{ left: `${tick.left}px` }}>
|
||||||
<span>{tick.label}</span>
|
{tick.label}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<div className="nodedc-home-gantt-today-marker" style={{ left: `${timeline.todayLeft}px` }}>
|
<div className="nodedc-home-gantt-today-marker" style={{ left: `${timeline.todayLeft}px` }}>
|
||||||
|
|
|
||||||
|
|
@ -1893,9 +1893,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 23.5rem;
|
min-height: 23.5rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
background:
|
background: linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 100% 4.2rem;
|
||||||
linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 6rem 100%,
|
|
||||||
linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 100% 4.2rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodedc-home-gantt-floating {
|
.nodedc-home-gantt-floating {
|
||||||
|
|
@ -1917,22 +1915,36 @@
|
||||||
|
|
||||||
.nodedc-home-gantt-grid {
|
.nodedc-home-gantt-grid {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 1rem 1rem 1rem 11.5rem;
|
top: 1rem;
|
||||||
|
bottom: 1rem;
|
||||||
|
left: 12rem;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodedc-home-gantt-grid-column {
|
.nodedc-home-gantt-grid-line {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
width: 1px;
|
||||||
min-height: 22rem;
|
min-height: 22rem;
|
||||||
border-left: 1px solid rgba(255, 255, 255, 0.04);
|
background: rgba(255, 255, 255, 0.045);
|
||||||
|
transform: translateX(-0.5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nodedc-home-gantt-grid-line-major {
|
||||||
|
background: rgba(var(--nodedc-card-active-rgb), 0.14);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nodedc-home-gantt-grid-label {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
padding-left: 0.75rem;
|
padding-left: 0.75rem;
|
||||||
color: var(--text-color-placeholder);
|
color: var(--text-color-placeholder);
|
||||||
font-size: 0.68rem;
|
font-size: 0.68rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
letter-spacing: 0;
|
letter-spacing: 0;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodedc-home-gantt-today-marker {
|
.nodedc-home-gantt-today-marker {
|
||||||
|
|
@ -2094,10 +2106,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodedc-home-gantt-grid {
|
.nodedc-home-gantt-grid {
|
||||||
inset: 1rem 1rem 1rem 9.25rem;
|
left: 11.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodedc-home-gantt-grid-column {
|
.nodedc-home-gantt-grid-label {
|
||||||
padding-left: 0.35rem;
|
padding-left: 0.35rem;
|
||||||
font-size: 0.6rem;
|
font-size: 0.6rem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue