From 8bb19f3f9d5e1f6b6dbba4173200dea24d9dc1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D0=BE=D0=B2=20=D0=90=D1=80=D1=82?= =?UTF-8?q?=D0=B5=D0=BC?= Date: Sun, 5 Jul 2026 13:46:51 +0300 Subject: [PATCH] =?UTF-8?q?BUR-64=20=D1=81=D0=B8=D0=BD=D1=85=D1=80=D0=BE?= =?UTF-8?q?=D0=BD=D0=B8=D0=B7=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20input=20date?= =?UTF-8?q?/time=20=D0=BF=D0=BE=D0=BB=D0=B5=D0=B9=20=D1=81=20=D0=BC=D0=B0?= =?UTF-8?q?=D1=81=D1=88=D1=82=D0=B0=D0=B1=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/edge-detail/components/ArchiveView.tsx | 10 +++++++++- src/features/history-chart/HistoryChart.tsx | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/features/edge-detail/components/ArchiveView.tsx b/src/features/edge-detail/components/ArchiveView.tsx index 9c5909d..d19bfe6 100644 --- a/src/features/edge-detail/components/ArchiveView.tsx +++ b/src/features/edge-detail/components/ArchiveView.tsx @@ -4,8 +4,9 @@ import { useRef } from 'react'; import { CalendarDays, CalendarClock, Check, ChevronDown, Clock3, DatabaseZap, Search } from 'lucide-react'; import type { CurrentItem } from '../../../entities/current/types'; import { HistoryChart } from '../../../features/history-chart/HistoryChart'; +import type { HistoryZoomRange } from '../../../features/history-chart/chartTypes'; import { RANGE_PRESETS, createRange, type DateRangeState } from '../../../features/history/dateRange'; -import { toIsoFromInput } from '../../../utils/format'; +import { toInputDateTimeValue, toIsoFromInput } from '../../../utils/format'; import type { HistoryGranularity } from '../../../utils/historyGranularity'; type ArchiveViewProps = { @@ -108,6 +109,12 @@ export function ArchiveView({ [rangePart]: updateRangeInputPart(range[rangePart], inputPart, value), }); }; + const updateRangeFromZoom = (nextRange: HistoryZoomRange) => { + onRangeChange({ + from: toInputDateTimeValue(new Date(nextRange.from)), + to: toInputDateTimeValue(new Date(nextRange.to)), + }); + }; return (
@@ -263,6 +270,7 @@ export function ArchiveView({ labelFormat={historyAxis.labelFormat} tags={selectedTags} tagLabels={tagLabels} + onZoomRangeChange={updateRangeFromZoom} /> ) : (
Разверните список показателей и выберите серию для графика
diff --git a/src/features/history-chart/HistoryChart.tsx b/src/features/history-chart/HistoryChart.tsx index dd66c93..45b9e6c 100644 --- a/src/features/history-chart/HistoryChart.tsx +++ b/src/features/history-chart/HistoryChart.tsx @@ -15,6 +15,7 @@ type HistoryChartProps = { tickIntervalMs?: number; to: string; tagLabels?: Record; + onZoomRangeChange?: (range: HistoryZoomRange) => void; }; const ZOOM_REQUEST_DELAY_MS = 350; @@ -95,6 +96,7 @@ export function HistoryChart({ tickIntervalMs, to, tagLabels = {}, + onZoomRangeChange, }: HistoryChartProps) { const [zoomRange, setZoomRange] = useState(() => createInitialZoomRange({ from, granulate, labelFormat, tickIntervalMs, to }), @@ -167,8 +169,9 @@ export function HistoryChart({ zoomTimerRef.current = setTimeout(() => { zoomRangeRef.current = nextRange; setZoomRange(nextRange); + onZoomRangeChange?.(nextRange); }, ZOOM_REQUEST_DELAY_MS); - }, []); + }, [onZoomRangeChange]); return (