@baishuyun/ui-base 6.3.2 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Amap/AmapProvider/index.js +3 -3
- package/dist/Amap/{AmapProvider-CTn2CH8s.js → AmapProvider-By5tTMAj.js} +1 -1
- package/dist/Amap/index.js +3 -3
- package/dist/Calendar/{AllDaySection-DS0Frx1p.js → AllDaySection-DwQz-p7a.js} +3 -3
- package/dist/Calendar/{Calendar-BIjk9zys.js → Calendar-CuBzeTkR.js} +84 -95
- package/dist/Calendar/{CurrentTimeIndicator-DaIywtIA.js → CurrentTimeIndicator-CUeblc9r.js} +2 -2
- package/dist/Calendar/{EventCard-D_VeOVDQ.js → EventCard-DRJrT_AG.js} +2 -2
- package/dist/Calendar/{TimeAxis-gKb8dTwY.js → TimeAxis-cK2_3FeM.js} +1 -1
- package/dist/Calendar/{TimeGrid-D8Du5vFP.js → TimeGrid-B8lvUb1W.js} +2 -2
- package/dist/Calendar/index.js +15 -16
- package/dist/Calendar/{layout-DvWx_7gn.js → layout-CaPxiRd-.js} +94 -96
- package/dist/Calendar/subcomponents/AllDaySection/index.js +8 -0
- package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +5 -0
- package/dist/Calendar/subcomponents/EventCard/index.js +6 -0
- package/dist/Calendar/subcomponents/TimeAxis/index.js +4 -0
- package/dist/Calendar/subcomponents/TimeGrid/index.js +4 -0
- package/dist/Calendar/{style-hCRKx3m1.js → theme-BzNDRi0U.js} +19 -3
- package/dist/Calendar/utils/index.js +37 -41
- package/dist/Calendar/utils/layout/index.js +2 -2
- package/dist/Calendar/utils/theme/index.js +2 -0
- package/dist/ColorPicker/{ColorPicker-BNPxmfw_.js → ColorPicker-By-Y8Tyz.js} +3 -3
- package/dist/ColorPicker/index.js +4 -4
- package/dist/ConfigProvider/index.js +2 -2
- package/dist/DatePicker/DatePicker-B6ZFxTt6.js +114 -0
- package/dist/DatePicker/{DatePickerPanel-BaVC1tq2.js → DatePickerPanel-HoxXteK0.js} +13 -12
- package/dist/DatePicker/{ensureDayjsPlugins-DZjJnZgo.js → ensureDayjsPlugins-C3aqki6i.js} +3 -4
- package/dist/DatePicker/index.js +5 -5
- package/dist/DropDown/{DropDown-m3HT_eex.js → DropDown-C5H9UObs.js} +3 -3
- package/dist/DropDown/index.js +4 -4
- package/dist/Editor/{Buttons-BB3xV8ku.js → Buttons-B8_yDqF5.js} +3 -3
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +7 -7
- package/dist/Editor/index.js +7 -7
- package/dist/Gantt/GanttChart/index.js +15 -0
- package/dist/Gantt/GanttChart-DpmbH0GI.js +1965 -0
- package/dist/Gantt/GanttHighlightContext-AIpN3-af.js +12 -0
- package/dist/Gantt/GanttTable/index.js +10 -0
- package/dist/Gantt/GanttTable-DSTq5XmX.js +83 -0
- package/dist/Gantt/GanttToolBar/index.js +11 -0
- package/dist/Gantt/GanttToolBar-fCAi-4zZ.js +91 -0
- package/dist/Gantt/collapseKeys-BWMH5k37.js +156 -0
- package/dist/Gantt/columnResize-By_1E48E.js +46 -0
- package/dist/Gantt/constants-_vMvDXFh.js +40 -0
- package/dist/Gantt/highlightTarget-DmzCIiQb.js +25 -0
- package/dist/Gantt/index.js +374 -0
- package/dist/Gantt/timelineViewConfig-DshzoBp7.js +118 -0
- package/dist/Gantt/utils/index.js +6 -0
- package/dist/Select/{Select-Dz_xr4my.js → Select-Gkywa_sm.js} +140 -134
- package/dist/Select/{SelectInputSearch-GHYAmQ3A.js → SelectInputSearch-DXPTGSc2.js} +1 -1
- package/dist/Select/index.js +4 -4
- package/dist/Table/Table-DVTq4n2V.js +544 -0
- package/dist/Table/constants-CKqc9Os_.js +25 -0
- package/dist/Table/hooks/index.js +2 -0
- package/dist/Table/hooks-CJ2CnSep.js +108 -0
- package/dist/Table/index.js +7 -0
- package/dist/Table/processRowspan-BCzfI5un.js +144 -0
- package/dist/Table/utils/index.js +2 -0
- package/dist/Tabs/{Tabs-CPRNkfMo.js → Tabs-DVQcB3YG.js} +1 -1
- package/dist/Tabs/index.js +1 -1
- package/dist/Tooltip/Tooltip-DW_XP13m.js +171 -0
- package/dist/Tooltip/index.js +1 -1
- package/dist/animations/index.d.ts +2 -2
- package/dist/components/Amap/__tests__/helpers.d.ts +6 -0
- package/dist/components/Calendar/__tests__/helpers/testFormatMessage.d.ts +1 -1
- package/dist/components/Calendar/context/CalendarContext.d.ts +2 -1
- package/dist/components/Calendar/index.d.ts +2 -2
- package/dist/components/Calendar/{shared → subcomponents}/AllDaySection/AllDaySection.d.ts +1 -1
- package/dist/components/Calendar/subcomponents/DayView/DayView.d.ts +3 -0
- package/dist/components/Calendar/{shared → subcomponents}/EventCard/EventCard.d.ts +1 -1
- package/dist/components/Calendar/{panels/MonthPanel → subcomponents}/MonthCell/MonthCellPopover/MonthCellPopover.d.ts +1 -1
- package/dist/components/Calendar/subcomponents/MonthView/MonthView.d.ts +3 -0
- package/dist/components/Calendar/{panels/WeekPanel → subcomponents}/WeekAllDaySection/WeekAllDaySection.d.ts +1 -1
- package/dist/components/Calendar/{panels/MonthPanel → subcomponents}/WeekEventLayer/MoreButton.d.ts +1 -1
- package/dist/components/Calendar/{panels/MonthPanel → subcomponents}/WeekEventLayer/WeekEventLayer.d.ts +1 -1
- package/dist/components/Calendar/subcomponents/WeekView/WeekView.d.ts +3 -0
- package/dist/components/Calendar/utils/dateUtils.d.ts +2 -1
- package/dist/components/Calendar/utils/eventUtils.d.ts +1 -1
- package/dist/components/Calendar/utils/layout/dayLayoutAlgorithm.d.ts +1 -1
- package/dist/components/Calendar/utils/localeKey.d.ts +2 -0
- package/dist/components/Calendar/utils/normalizeData.d.ts +1 -1
- package/dist/components/Calendar/{style → utils/theme}/index.d.ts +1 -0
- package/dist/components/Calendar/{adapters → utils/theme}/platformTheme.d.ts +1 -1
- package/dist/components/Calendar/{style → utils/theme}/resolveCalendarThemeVars.d.ts +1 -1
- package/dist/components/Calendar/{style → utils/theme}/resolveSubcomponentThemes.d.ts +3 -3
- package/dist/components/Calendar/utils/weekTimedLayout.d.ts +1 -1
- package/dist/components/DatePicker/__tests__/DatePicker.getPopupContainer.test.d.ts +1 -0
- package/dist/components/DatePicker/interface.d.ts +5 -0
- package/dist/components/Gantt/Gantt.d.ts +11 -0
- package/dist/components/Gantt/GanttChart/GanttBarTooltip/GanttBarTooltip.d.ts +3 -0
- package/dist/components/Gantt/GanttChart/GanttChart.d.ts +8 -0
- package/dist/components/Gantt/GanttChart/GanttChartCanvas.d.ts +4 -0
- package/dist/components/Gantt/GanttChart/GanttChartCanvasBackground.d.ts +4 -0
- package/dist/components/Gantt/GanttChart/GanttInteractionContext.d.ts +4 -0
- package/dist/components/Gantt/GanttChart/GanttSummaryBar/GanttSummaryBar.d.ts +4 -0
- package/dist/components/Gantt/GanttChart/GanttTaskBar/GanttTaskBar.d.ts +4 -0
- package/dist/components/Gantt/GanttChart/GanttTaskBar/useTaskBarPointer.d.ts +9 -0
- package/dist/components/Gantt/GanttChart/GanttTimelineContext.d.ts +4 -0
- package/dist/components/Gantt/GanttChart/GanttTimelineHeader/GanttTimelineHeader.d.ts +4 -0
- package/dist/components/Gantt/GanttChart/OffscreenTaskIndicators/OffscreenTaskIndicators.d.ts +4 -0
- package/dist/components/Gantt/GanttChart/TodayIndicator/TodayIndicator.d.ts +3 -0
- package/dist/components/Gantt/GanttChart/hooks/__tests__/timelineFocus.contract.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/hooks/__tests__/useGanttColumnVirtual.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/hooks/useBarTooltipHover.d.ts +19 -0
- package/dist/components/Gantt/GanttChart/hooks/useEdgeScroll.d.ts +7 -0
- package/dist/components/Gantt/GanttChart/hooks/useGanttColumnVirtual.d.ts +21 -0
- package/dist/components/Gantt/GanttChart/hooks/useGanttDrag.d.ts +15 -0
- package/dist/components/Gantt/GanttChart/hooks/useGanttRowVirtualScroll.d.ts +12 -0
- package/dist/components/Gantt/GanttChart/hooks/useGanttScrollbars.d.ts +2 -0
- package/dist/components/Gantt/GanttChart/hooks/useNormalizedItems.d.ts +11 -0
- package/dist/components/Gantt/GanttChart/hooks/useOffscreenIndicators.d.ts +11 -0
- package/dist/components/Gantt/GanttChart/hooks/useRowHoverHighlight.d.ts +10 -0
- package/dist/components/Gantt/GanttChart/hooks/useTimelineViewportController.d.ts +24 -0
- package/dist/components/Gantt/GanttChart/hooks/useTodayMs.d.ts +4 -0
- package/dist/components/Gantt/GanttChart/index.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/__tests__/dateRangeNormalizer.subday.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/__tests__/dragEngine.quarterMonth.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/__tests__/dragEngine.subday.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/__tests__/headerBuilder.quarterMonth.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/__tests__/headerBuilder.subday.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/__tests__/quarterMonthScale.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/__tests__/subdayScale.contract.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/__tests__/timelineViewConfig.test.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/buildSummaryBarTooltipContent.d.ts +6 -0
- package/dist/components/Gantt/GanttChart/utils/constants.d.ts +93 -0
- package/dist/components/Gantt/GanttChart/utils/dateRangeNormalizer.d.ts +18 -0
- package/dist/components/Gantt/GanttChart/utils/dragEngine.d.ts +60 -0
- package/dist/components/Gantt/GanttChart/utils/headerBuilder.d.ts +14 -0
- package/dist/components/Gantt/GanttChart/utils/quarterMonthScale.d.ts +8 -0
- package/dist/components/Gantt/GanttChart/utils/taskBarUtils.d.ts +3 -0
- package/dist/components/Gantt/GanttChart/utils/timeScale.d.ts +35 -0
- package/dist/components/Gantt/GanttChart/utils/timelineFocus.d.ts +42 -0
- package/dist/components/Gantt/GanttChart/utils/timelineMarkers.d.ts +1 -0
- package/dist/components/Gantt/GanttChart/utils/timelineViewConfig.d.ts +106 -0
- package/dist/components/Gantt/GanttChart/utils/timezoneUtils.d.ts +11 -0
- package/dist/components/Gantt/GanttHighlightContext.d.ts +3 -0
- package/dist/components/Gantt/GanttResizeIndicator.d.ts +3 -0
- package/dist/components/Gantt/GanttTable/GanttTable.d.ts +7 -0
- package/dist/components/Gantt/GanttTable/hooks/useGanttTableHighlightDomSync.d.ts +2 -0
- package/dist/components/Gantt/GanttTable/hooks/useGanttTableLinkedScroll.d.ts +7 -0
- package/dist/components/Gantt/GanttTable/index.d.ts +1 -0
- package/dist/components/Gantt/GanttTable/utils/mapGanttColumns.d.ts +13 -0
- package/dist/components/Gantt/GanttToolBar/GanttToolBar.d.ts +3 -0
- package/dist/components/Gantt/GanttToolBar/index.d.ts +1 -0
- package/dist/components/Gantt/__tests__/Gantt.contract.test.d.ts +0 -0
- package/dist/components/Gantt/__tests__/Gantt.grouped.contract.test.d.ts +0 -0
- package/dist/components/Gantt/__tests__/GanttChart.contract.test.d.ts +0 -0
- package/dist/components/Gantt/__tests__/GanttSummaryBar.tooltip.test.d.ts +1 -0
- package/dist/components/Gantt/__tests__/GanttToolBar.test.d.ts +1 -0
- package/dist/components/Gantt/__tests__/filterItemsByCollapse.test.d.ts +1 -0
- package/dist/components/Gantt/__tests__/helpers/ganttDomSetup.d.ts +1 -0
- package/dist/components/Gantt/__tests__/helpers/ganttTestFixtures.d.ts +7 -0
- package/dist/components/Gantt/__tests__/helpers/ganttTestMocks.d.ts +8 -0
- package/dist/components/Gantt/__tests__/helpers/renderWithLocale.d.ts +3 -0
- package/dist/components/Gantt/__tests__/helpers/testFormatMessage.d.ts +2 -0
- package/dist/components/Gantt/__tests__/interface.contract.types.test.d.ts +1 -0
- package/dist/components/Gantt/__tests__/timezoneUtils.test.d.ts +1 -0
- package/dist/components/Gantt/__tests__/useBarTooltipHover.test.d.ts +1 -0
- package/dist/components/Gantt/__tests__/useGanttHighlight.test.d.ts +1 -0
- package/dist/components/Gantt/__tests__/useTaskBarPointer.test.d.ts +1 -0
- package/dist/components/Gantt/hooks/useGanttCollapseState.d.ts +6 -0
- package/dist/components/Gantt/hooks/useGanttHighlight.d.ts +10 -0
- package/dist/components/Gantt/hooks/useGanttLayout.d.ts +7 -0
- package/dist/components/Gantt/hooks/useLinkedVerticalScroll.d.ts +6 -0
- package/dist/components/Gantt/index.d.ts +9 -0
- package/dist/components/Gantt/interface.d.ts +140 -0
- package/dist/components/Gantt/internal/GanttLayout.d.ts +8 -0
- package/dist/components/Gantt/internal/GanttTableShell.d.ts +3 -0
- package/dist/components/Gantt/types.internal.d.ts +313 -0
- package/dist/components/Gantt/utils/collapseKeys.d.ts +4 -0
- package/dist/components/Gantt/utils/columnResize.d.ts +19 -0
- package/dist/components/Gantt/utils/constants.d.ts +4 -0
- package/dist/components/Gantt/utils/filterItemsByCollapse.d.ts +9 -0
- package/dist/components/Gantt/utils/highlightTarget.d.ts +13 -0
- package/dist/components/Gantt/utils/index.d.ts +8 -0
- package/dist/components/Gantt/utils/localeKey.d.ts +2 -0
- package/dist/components/Gantt/utils/tableWidthStorage.d.ts +3 -0
- package/dist/components/Select/__tests__/Select.getPopupContainer.test.d.ts +1 -0
- package/dist/components/Select/interface.d.ts +4 -0
- package/dist/components/Table/Table.d.ts +4 -0
- package/dist/components/Table/__tests__/HeaderCell.test.d.ts +1 -0
- package/dist/components/Table/__tests__/TableBody.test.d.ts +1 -0
- package/dist/components/Table/__tests__/processRowspan.test.d.ts +1 -0
- package/dist/components/Table/components/HeaderCell.d.ts +16 -0
- package/dist/components/Table/components/TableBody.d.ts +45 -0
- package/dist/components/Table/components/TableFooter.d.ts +18 -0
- package/dist/components/Table/components/TableHeader.d.ts +14 -0
- package/dist/components/Table/constants.d.ts +29 -0
- package/dist/components/Table/hooks/index.d.ts +2 -0
- package/dist/components/Table/hooks/useColumnResize.d.ts +11 -0
- package/dist/components/Table/hooks/useTableVirtual.d.ts +19 -0
- package/dist/components/Table/index.d.ts +9 -0
- package/dist/components/Table/interface.d.ts +114 -0
- package/dist/components/Table/utils/flattenColumns.d.ts +17 -0
- package/dist/components/Table/utils/index.d.ts +3 -0
- package/dist/components/Table/utils/processRowspan.d.ts +16 -0
- package/dist/components/Table/utils/tableUtils.d.ts +22 -0
- package/dist/components/Tooltip/Tooltip.type.d.ts +2 -0
- package/dist/components/index.d.ts +4 -2
- package/dist/hooks/useLatchedPopupPortalRoot.d.ts +11 -0
- package/dist/index.js +24 -23
- package/dist/locale/lang/en-US.json.d.ts +63 -0
- package/dist/locale/lang/zh-CN.json.d.ts +63 -0
- package/dist/locale/lang/zh-TW.json.d.ts +63 -0
- package/dist/style.css +1 -1
- package/dist/vendors/{ConfigProvider-DCm-93oJ.js → ConfigProvider-BRfJ7gWc.js} +123 -1
- package/dist/vendors/{LocaleContext-CRlzP8UO.js → LocaleContext-BJdHS0sH.js} +61 -0
- package/dist/vendors/{animations-BmT0HT5q.js → animations-BeI8JZp1.js} +7 -3
- package/dist/vendors/{useFloatingOverlay-uxlI1G-V.js → useFloatingOverlay-3KB88hpZ.js} +1 -0
- package/dist/vendors/{useLocale-D9kAzQlB.js → useLocale-BTz4slNW.js} +1 -1
- package/dist/vitest-matchers.d.ts +1 -0
- package/package.json +3 -2
- package/dist/Calendar/adapters/index.js +0 -2
- package/dist/Calendar/adapters-zYR7CgzD.js +0 -20
- package/dist/Calendar/shared/AllDaySection/index.js +0 -8
- package/dist/Calendar/shared/CurrentTimeIndicator/index.js +0 -5
- package/dist/Calendar/shared/EventCard/index.js +0 -6
- package/dist/Calendar/shared/TimeAxis/index.js +0 -4
- package/dist/Calendar/shared/TimeGrid/index.js +0 -4
- package/dist/Calendar/style/index.js +0 -2
- package/dist/DatePicker/DatePicker-B2skjsiQ.js +0 -91
- package/dist/Tooltip/Tooltip-RkD8fs0B.js +0 -169
- package/dist/components/Calendar/adapters/index.d.ts +0 -1
- package/dist/components/Calendar/panels/DayPanel/DayPanel.d.ts +0 -3
- package/dist/components/Calendar/panels/MonthPanel/MonthPanel.d.ts +0 -3
- package/dist/components/Calendar/panels/WeekPanel/WeekPanel.d.ts +0 -3
- /package/dist/components/Calendar/{shared → subcomponents}/AllDaySection/index.d.ts +0 -0
- /package/dist/components/Calendar/{Header → subcomponents}/CalendarHeader/CalendarHeader.d.ts +0 -0
- /package/dist/components/Calendar/{Header → subcomponents}/CalendarHeaderLeft/CalendarHeaderLeft.d.ts +0 -0
- /package/dist/components/Calendar/{shared → subcomponents}/CurrentTimeIndicator/CurrentTimeIndicator.d.ts +0 -0
- /package/dist/components/Calendar/{shared → subcomponents}/CurrentTimeIndicator/index.d.ts +0 -0
- /package/dist/components/Calendar/{Header → subcomponents}/DateDisplay/DateDisplay.d.ts +0 -0
- /package/dist/components/Calendar/{Header → subcomponents}/DateDisplay/__tests__/DateDisplay.weekPicker.test.d.ts +0 -0
- /package/dist/components/Calendar/{panels/DayPanel → subcomponents/DayView}/__tests__/CalendarDay.dayFilter.test.d.ts +0 -0
- /package/dist/components/Calendar/{shared → subcomponents}/EventCard/__tests__/EventCard.tooltip.test.d.ts +0 -0
- /package/dist/components/Calendar/{shared → subcomponents}/EventCard/index.d.ts +0 -0
- /package/dist/components/Calendar/{panels/MonthPanel → subcomponents}/MonthCell/MonthCell.d.ts +0 -0
- /package/dist/components/Calendar/{panels/MonthPanel → subcomponents}/MonthHeader/MonthHeader.d.ts +0 -0
- /package/dist/components/Calendar/{Header → subcomponents}/NavButton/NavButton.d.ts +0 -0
- /package/dist/components/Calendar/{shared → subcomponents}/TimeAxis/TimeAxis.d.ts +0 -0
- /package/dist/components/Calendar/{shared → subcomponents}/TimeAxis/index.d.ts +0 -0
- /package/dist/components/Calendar/{shared → subcomponents}/TimeGrid/TimeGrid.d.ts +0 -0
- /package/dist/components/Calendar/{shared → subcomponents}/TimeGrid/index.d.ts +0 -0
- /package/dist/components/Calendar/{Header → subcomponents}/TodayButton/TodayButton.d.ts +0 -0
- /package/dist/components/Calendar/{panels/WeekPanel → subcomponents}/WeekHeader/WeekHeader.d.ts +0 -0
- /package/dist/components/Calendar/{internalTypes.d.ts → types.internal.d.ts} +0 -0
- /package/dist/components/Calendar/{adapters → utils/theme}/__tests__/platformTheme.test.d.ts +0 -0
- /package/dist/components/Calendar/{style → utils/theme}/__tests__/resolveCalendarThemeVars.test.d.ts +0 -0
- /package/dist/components/Calendar/{style → utils/theme}/__tests__/resolveScheduleColorVars.test.d.ts +0 -0
- /package/dist/components/Calendar/{style → utils/theme}/__tests__/resolveSubcomponentThemes.test.d.ts +0 -0
- /package/dist/components/Calendar/{style → utils/theme}/resolveScheduleColorVars.d.ts +0 -0
|
@@ -0,0 +1,1965 @@
|
|
|
1
|
+
import { t as e } from "../vendors/useLocale-BTz4slNW.js";
|
|
2
|
+
import { t } from "../Tooltip/Tooltip-DW_XP13m.js";
|
|
3
|
+
import { _ as n, a as r, f as i, h as a, i as o, n as s, o as c, p as l, r as u } from "./constants-_vMvDXFh.js";
|
|
4
|
+
import { t as d } from "./GanttHighlightContext-AIpN3-af.js";
|
|
5
|
+
import { n as f, r as p } from "./highlightTarget-DmzCIiQb.js";
|
|
6
|
+
import { a as m, d as h, i as g, n as _, r as v, t as y, u as b } from "./timelineViewConfig-DshzoBp7.js";
|
|
7
|
+
import { _ as x, a as S, b as C, c as w, d as T, f as E, g as D, h as O, i as k, l as A, m as j, o as ee, p as te, r as M, s as ne, t as re, u as ie, v as ae, y as N } from "./collapseKeys-BWMH5k37.js";
|
|
8
|
+
import { n as P, t as oe } from "./GanttToolBar-fCAi-4zZ.js";
|
|
9
|
+
import { isFunction as se, isNumber as ce, isString as le } from "lodash-es";
|
|
10
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
11
|
+
import R, { forwardRef as z, memo as B, useCallback as V, useEffect as H, useImperativeHandle as U, useLayoutEffect as W, useMemo as G, useRef as K, useState as q } from "react";
|
|
12
|
+
import J from "clsx";
|
|
13
|
+
import { useDocumentVisibility as Y, useSize as X } from "ahooks";
|
|
14
|
+
import { createContext as Z, useContextSelector as Q } from "use-context-selector";
|
|
15
|
+
import $ from "dayjs";
|
|
16
|
+
import ue from "dayjs/plugin/isoWeek";
|
|
17
|
+
import { useVirtualizer as de } from "@tanstack/react-virtual";
|
|
18
|
+
import fe from "dayjs/plugin/quarterOfYear";
|
|
19
|
+
import { OverlayScrollbars as pe } from "overlayscrollbars";
|
|
20
|
+
//#region src/components/Gantt/GanttChart/utils/dragEngine.ts
|
|
21
|
+
var me = (e) => e?.type === "task" && e?.draggable !== !1 && !e?.invalid, he = {
|
|
22
|
+
canMove: !1,
|
|
23
|
+
canResizeStart: !1,
|
|
24
|
+
canResizeEnd: !1
|
|
25
|
+
}, ge = (e) => !e || e.invalid || e.type === "summary" || e.draggable === !1 ? he : e.dragPermission ? {
|
|
26
|
+
canMove: e.dragPermission.canMove === !0,
|
|
27
|
+
canResizeStart: e.dragPermission.canResizeStart === !0,
|
|
28
|
+
canResizeEnd: e.dragPermission.canResizeEnd === !0
|
|
29
|
+
} : {
|
|
30
|
+
canMove: !0,
|
|
31
|
+
canResizeStart: !0,
|
|
32
|
+
canResizeEnd: !0
|
|
33
|
+
}, _e = (e, t) => me(e) ? e?.dragPermission ? t === "move" ? e.dragPermission.canMove === !0 : t === "resize-start" ? e.dragPermission.canResizeStart === !0 : t === "resize-end" ? e.dragPermission.canResizeEnd === !0 : !1 : !0 : !1, ve = (e, t) => !t || Math.abs(e) < Math.min(5, t) ? 0 : Math.round(e / t), ye = (e, t) => ve(e, t), be = (e, t, n = "round") => {
|
|
34
|
+
if (!t || !Number.isFinite(e)) return e;
|
|
35
|
+
let r = C(e), i = $(r).startOf("day").valueOf(), a = (r - i) / t, o;
|
|
36
|
+
return o = n === "floor" ? Math.floor(a) : n === "ceil" ? Math.ceil(a) : Math.round(a), x(i + o * t);
|
|
37
|
+
}, xe = (e, t, n) => ({
|
|
38
|
+
startMs: e + n,
|
|
39
|
+
endMs: t + n
|
|
40
|
+
}), Se = ({ startMs: e, endMs: t, deltaMs: n, edge: r, minDurationMs: i }) => {
|
|
41
|
+
if (r === "start") {
|
|
42
|
+
let r = t - i;
|
|
43
|
+
return {
|
|
44
|
+
startMs: Math.min(e + n, r),
|
|
45
|
+
endMs: t
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
let a = e + i;
|
|
49
|
+
return {
|
|
50
|
+
startMs: e,
|
|
51
|
+
endMs: Math.max(t + n, a)
|
|
52
|
+
};
|
|
53
|
+
}, Ce = (e, t, n, r) => {
|
|
54
|
+
let i = e.originStartMs, o = e.originEndMs;
|
|
55
|
+
if (e.dragMode === "move") {
|
|
56
|
+
let s = be(n.timeAtX(e.originLeftPx + t), r, "round"), c = Math.round((s - e.originStartMs) / a) * a;
|
|
57
|
+
i = e.originStartMs + c, o = e.originEndMs + c;
|
|
58
|
+
} else if (e.dragMode === "resize-start") i = be(n.timeAtX(e.originLeftPx + t), r, "round"), o = e.originEndMs, o - i < r && (i = o - r);
|
|
59
|
+
else {
|
|
60
|
+
let a = n.toX(e.originEndMs);
|
|
61
|
+
o = be(n.timeAtX(a + t), r, "round"), i = e.originStartMs, o - i < r && (o = i + r);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
deltaUnits: e.dragMode === "resize-end" ? Math.round((o - e.originEndMs) / r) : Math.round((i - e.originStartMs) / r),
|
|
65
|
+
previewStartMs: i,
|
|
66
|
+
previewEndMs: o,
|
|
67
|
+
previewLeftPx: n.toX(i)
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
function we(e) {
|
|
71
|
+
let t = {
|
|
72
|
+
taskId: String(e.item.id),
|
|
73
|
+
newStart: e.startMs,
|
|
74
|
+
newEnd: e.endMs,
|
|
75
|
+
deltaMs: e.deltaMs,
|
|
76
|
+
snapUnitMs: e.snapUnitMs,
|
|
77
|
+
changeType: e.changeType,
|
|
78
|
+
viewMode: e.viewMode
|
|
79
|
+
};
|
|
80
|
+
if (h(e.viewMode)) return {
|
|
81
|
+
taskId: t.taskId,
|
|
82
|
+
newStart: t.newStart,
|
|
83
|
+
newEnd: t.newEnd,
|
|
84
|
+
deltaMs: t.deltaMs,
|
|
85
|
+
snapUnitMs: t.snapUnitMs,
|
|
86
|
+
changeType: t.changeType,
|
|
87
|
+
viewMode: e.viewMode
|
|
88
|
+
};
|
|
89
|
+
let n = e;
|
|
90
|
+
return {
|
|
91
|
+
taskId: t.taskId,
|
|
92
|
+
newStart: t.newStart,
|
|
93
|
+
newEnd: t.newEnd,
|
|
94
|
+
deltaMs: t.deltaMs,
|
|
95
|
+
snapUnitMs: t.snapUnitMs,
|
|
96
|
+
changeType: t.changeType,
|
|
97
|
+
viewMode: n.viewMode,
|
|
98
|
+
deltaDays: n.deltaDays
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
var Te = (e) => e && se(e.then) ? e : Promise.resolve(e);
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/components/Gantt/GanttChart/hooks/useEdgeScroll.tsx
|
|
104
|
+
function Ee(e, t) {
|
|
105
|
+
let n = K(null), r = K(0), i = K(0), a = V(() => {
|
|
106
|
+
n.current !== null && (cancelAnimationFrame(n.current), n.current = null), r.current = 0, i.current = 0;
|
|
107
|
+
}, []);
|
|
108
|
+
H(() => () => {
|
|
109
|
+
n.current !== null && cancelAnimationFrame(n.current);
|
|
110
|
+
}, []);
|
|
111
|
+
let o = V(() => {
|
|
112
|
+
if (n.current !== null) return;
|
|
113
|
+
let a = () => {
|
|
114
|
+
let o = e.current, s = r.current;
|
|
115
|
+
if (!o || s === 0) {
|
|
116
|
+
n.current = null;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
let c = o.scrollLeft, l = o.scrollWidth - o.clientWidth, u = Math.max(0, Math.min(l, c + s));
|
|
120
|
+
o.scrollLeft = u;
|
|
121
|
+
let d = u - c;
|
|
122
|
+
i.current += d, d !== 0 && t?.current?.(), n.current = requestAnimationFrame(a);
|
|
123
|
+
};
|
|
124
|
+
n.current = requestAnimationFrame(a);
|
|
125
|
+
}, [e, t]);
|
|
126
|
+
return {
|
|
127
|
+
scrollCompensation: i,
|
|
128
|
+
startEdgeDetection: V((t) => {
|
|
129
|
+
let i = e.current;
|
|
130
|
+
if (!i) return;
|
|
131
|
+
let a = i.getBoundingClientRect(), s = t - a.left, c = a.right - t;
|
|
132
|
+
s < 60 && s >= 0 ? (r.current = -(2 + 8 * (1 - s / 60)), o()) : c < 60 && c >= 0 ? (r.current = 2 + 8 * (1 - c / 60), o()) : (r.current = 0, n.current !== null && (cancelAnimationFrame(n.current), n.current = null));
|
|
133
|
+
}, [e, o]),
|
|
134
|
+
stopEdgeScroll: a
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/components/Gantt/GanttChart/hooks/useGanttDrag.tsx
|
|
139
|
+
function De({ pixelsPerDay: e, viewMode: t, timelineCoords: i, onTaskTimeChange: s, containerRef: l }) {
|
|
140
|
+
let u = h(t), d = m(t), f = d / a * e, p = K(i);
|
|
141
|
+
p.current = i;
|
|
142
|
+
let [g, _] = q({}), [v, y] = q(null), b = K(null), x = K({
|
|
143
|
+
shouldSuppressClick: !1,
|
|
144
|
+
at: 0
|
|
145
|
+
}), S = K(0), C = K(null), { scrollCompensation: w, startEdgeDetection: T, stopEdgeScroll: E } = Ee(l ?? { current: null }, C), D = K({});
|
|
146
|
+
H(() => {
|
|
147
|
+
b.current = v;
|
|
148
|
+
}, [v]), H(() => () => {
|
|
149
|
+
for (let e of Object.values(D.current)) e.timeoutId && clearTimeout(e.timeoutId);
|
|
150
|
+
}, []);
|
|
151
|
+
let O = V(() => {
|
|
152
|
+
_((e) => {
|
|
153
|
+
let t = Object.keys(D.current);
|
|
154
|
+
if (t.length === 0) return {};
|
|
155
|
+
let n = {};
|
|
156
|
+
for (let r of t) e[r] && (n[r] = e[r]);
|
|
157
|
+
return Object.keys(n).length === Object.keys(e).length ? e : n;
|
|
158
|
+
}), x.current = {
|
|
159
|
+
shouldSuppressClick: !1,
|
|
160
|
+
at: 0
|
|
161
|
+
};
|
|
162
|
+
}, []), k = V(() => {
|
|
163
|
+
for (let e of Object.values(D.current)) e.timeoutId && clearTimeout(e.timeoutId);
|
|
164
|
+
D.current = {}, _({}), x.current = {
|
|
165
|
+
shouldSuppressClick: !1,
|
|
166
|
+
at: 0
|
|
167
|
+
};
|
|
168
|
+
}, []), A = V((e, t, n, r) => {
|
|
169
|
+
if (!_e(t, r) || t.invalid) return;
|
|
170
|
+
e.preventDefault(), e.stopPropagation();
|
|
171
|
+
let i = {
|
|
172
|
+
taskId: t.id,
|
|
173
|
+
item: t,
|
|
174
|
+
startClientX: e.clientX,
|
|
175
|
+
originLeftPx: n,
|
|
176
|
+
originStartMs: t.startMs ?? 0,
|
|
177
|
+
originEndMs: t.endMs ?? 0,
|
|
178
|
+
deltaUnits: 0,
|
|
179
|
+
dragMode: r,
|
|
180
|
+
previewLeftPx: n,
|
|
181
|
+
previewStartMs: t.startMs ?? 0,
|
|
182
|
+
previewEndMs: t.endMs ?? 0
|
|
183
|
+
};
|
|
184
|
+
x.current = {
|
|
185
|
+
shouldSuppressClick: !1,
|
|
186
|
+
at: 0
|
|
187
|
+
}, b.current = i, y(i);
|
|
188
|
+
}, []), j = V((e, t, n) => {
|
|
189
|
+
A(e, t, n, o);
|
|
190
|
+
}, [A]), ee = V((e, t, n, i) => {
|
|
191
|
+
A(e, t, n, i === "start" ? c : r);
|
|
192
|
+
}, [A]);
|
|
193
|
+
return H(() => {
|
|
194
|
+
if (!v?.taskId) return;
|
|
195
|
+
let e = (e) => {
|
|
196
|
+
let t = b.current;
|
|
197
|
+
if (!t) return;
|
|
198
|
+
let n = e - t.startClientX + w.current;
|
|
199
|
+
if (!u) {
|
|
200
|
+
let e = Ce(t, n, p.current, d);
|
|
201
|
+
if (e.deltaUnits === t.deltaUnits) return;
|
|
202
|
+
let r = {
|
|
203
|
+
...t,
|
|
204
|
+
...e
|
|
205
|
+
};
|
|
206
|
+
b.current = r, y(r);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
let r = ye(n, f);
|
|
210
|
+
if (r === t.deltaUnits) return;
|
|
211
|
+
let i = {
|
|
212
|
+
...t,
|
|
213
|
+
deltaUnits: r
|
|
214
|
+
};
|
|
215
|
+
if (t.dragMode === "move") {
|
|
216
|
+
let e = xe(t.originStartMs, t.originEndMs, r * d);
|
|
217
|
+
i.previewLeftPx = t.originLeftPx + r * f, i.previewStartMs = e.startMs, i.previewEndMs = e.endMs;
|
|
218
|
+
} else {
|
|
219
|
+
let e = Se({
|
|
220
|
+
startMs: t.originStartMs,
|
|
221
|
+
endMs: t.originEndMs,
|
|
222
|
+
deltaMs: r * d,
|
|
223
|
+
edge: t.dragMode === "resize-start" ? "start" : "end",
|
|
224
|
+
minDurationMs: d
|
|
225
|
+
});
|
|
226
|
+
i.previewStartMs = e.startMs, i.previewEndMs = e.endMs;
|
|
227
|
+
}
|
|
228
|
+
let a = Math.round((i.previewStartMs - t.originStartMs) / d), o = {
|
|
229
|
+
...i,
|
|
230
|
+
deltaUnits: t.dragMode === "resize-end" ? Math.round((i.previewEndMs - t.originEndMs) / d) : a
|
|
231
|
+
};
|
|
232
|
+
b.current = o, y(o);
|
|
233
|
+
};
|
|
234
|
+
C.current = () => e(S.current);
|
|
235
|
+
let r = (t) => {
|
|
236
|
+
S.current = t.clientX, T(t.clientX), e(t.clientX);
|
|
237
|
+
}, i = () => {
|
|
238
|
+
E(), C.current = null;
|
|
239
|
+
let e = b.current;
|
|
240
|
+
if (!e) return;
|
|
241
|
+
let r = e.previewStartMs !== e.originStartMs || e.previewEndMs !== e.originEndMs;
|
|
242
|
+
x.current = {
|
|
243
|
+
shouldSuppressClick: r,
|
|
244
|
+
at: Date.now()
|
|
245
|
+
};
|
|
246
|
+
let i = r;
|
|
247
|
+
if (!_e(e.item, e.dragMode) || !i || !s) {
|
|
248
|
+
b.current = null, y(null);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
let o = e.taskId;
|
|
252
|
+
_((t) => ({
|
|
253
|
+
...t,
|
|
254
|
+
[o]: {
|
|
255
|
+
startMs: e.previewStartMs,
|
|
256
|
+
endMs: e.previewEndMs
|
|
257
|
+
}
|
|
258
|
+
})), b.current = null, y(null);
|
|
259
|
+
let c = (D.current[o]?.opId || 0) + 1;
|
|
260
|
+
D.current[o]?.timeoutId && clearTimeout(D.current[o].timeoutId);
|
|
261
|
+
let l = setTimeout(() => {
|
|
262
|
+
D.current[o]?.opId === c && (console.warn(`[GanttDrag] task ${o} op ${c} timed out (${n}ms)`), _((e) => {
|
|
263
|
+
let t = { ...e };
|
|
264
|
+
return delete t[o], t;
|
|
265
|
+
}), delete D.current[o]);
|
|
266
|
+
}, n);
|
|
267
|
+
D.current[o] = {
|
|
268
|
+
opId: c,
|
|
269
|
+
startedAt: Date.now(),
|
|
270
|
+
timeoutId: l
|
|
271
|
+
};
|
|
272
|
+
let f, p;
|
|
273
|
+
if (u) if (e.dragMode === "move") {
|
|
274
|
+
let t = be(e.previewStartMs, d, "round"), n = t - e.previewStartMs;
|
|
275
|
+
f = t, p = e.previewEndMs + n;
|
|
276
|
+
} else e.dragMode === "resize-start" ? (f = be(e.previewStartMs, d, "round"), p = e.previewEndMs) : (f = e.previewStartMs, p = be(e.previewEndMs, d, "round"));
|
|
277
|
+
else {
|
|
278
|
+
let t = Number.isFinite(e.item.rawStartMs) && Number.isFinite(e.item.baseStartMs) && Number.isFinite(e.previewStartMs), n = Number.isFinite(e.item.rawEndMs) && Number.isFinite(e.item.baseEndMs) && Number.isFinite(e.previewEndMs), r = t ? Math.round((e.previewStartMs - (e.item.baseStartMs ?? 0)) / a) : 0, i = n ? Math.round((e.previewEndMs - (e.item.baseEndMs ?? 0)) / a) : 0;
|
|
279
|
+
f = t ? (e.item.rawStartMs ?? 0) + r * a : e.item.rawStartMs ?? 0, p = n ? (e.item.rawEndMs ?? 0) + i * a : e.item.rawEndMs ?? 0;
|
|
280
|
+
}
|
|
281
|
+
let m;
|
|
282
|
+
m = h(t) ? we({
|
|
283
|
+
item: e.item,
|
|
284
|
+
startMs: f,
|
|
285
|
+
endMs: p,
|
|
286
|
+
deltaMs: e.deltaUnits * d,
|
|
287
|
+
snapUnitMs: d,
|
|
288
|
+
changeType: e.dragMode,
|
|
289
|
+
viewMode: t
|
|
290
|
+
}) : we({
|
|
291
|
+
item: e.item,
|
|
292
|
+
startMs: f,
|
|
293
|
+
endMs: p,
|
|
294
|
+
deltaDays: e.deltaUnits,
|
|
295
|
+
deltaMs: e.deltaUnits * d,
|
|
296
|
+
snapUnitMs: d,
|
|
297
|
+
changeType: e.dragMode,
|
|
298
|
+
viewMode: t
|
|
299
|
+
}), Te(s(m)).catch((e) => {
|
|
300
|
+
console.error("[GanttChart] onTaskTimeChange rejected", e), D.current[o]?.opId === c && _((e) => {
|
|
301
|
+
let t = { ...e };
|
|
302
|
+
return delete t[o], t;
|
|
303
|
+
});
|
|
304
|
+
}).finally(() => {
|
|
305
|
+
D.current[o]?.opId === c && (clearTimeout(D.current[o].timeoutId), delete D.current[o]);
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
return document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), () => {
|
|
309
|
+
document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), C.current = null;
|
|
310
|
+
};
|
|
311
|
+
}, [
|
|
312
|
+
v?.taskId,
|
|
313
|
+
u,
|
|
314
|
+
d,
|
|
315
|
+
f,
|
|
316
|
+
s,
|
|
317
|
+
e,
|
|
318
|
+
t,
|
|
319
|
+
T,
|
|
320
|
+
E,
|
|
321
|
+
w
|
|
322
|
+
]), {
|
|
323
|
+
dragState: v,
|
|
324
|
+
committedRangeById: g,
|
|
325
|
+
resetCommittedRanges: O,
|
|
326
|
+
forceResetAllCommittedRanges: k,
|
|
327
|
+
handleTaskMouseDown: j,
|
|
328
|
+
handleResizeMouseDown: ee,
|
|
329
|
+
consumeRecentDragResult: V(() => {
|
|
330
|
+
let { shouldSuppressClick: e, at: t } = x.current;
|
|
331
|
+
return x.current = {
|
|
332
|
+
shouldSuppressClick: !1,
|
|
333
|
+
at: 0
|
|
334
|
+
}, e ? Date.now() - t <= 400 : !1;
|
|
335
|
+
}, [])
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
function Oe(e, t, n) {
|
|
339
|
+
let r = Number(t) > 0 ? Number(t) : 0, i = Number(n) > 0 ? Number(n) : 0, a = Math.max(0, i - r);
|
|
340
|
+
return Number.isFinite(e) ? Math.min(Math.max(0, e), a) : 0;
|
|
341
|
+
}
|
|
342
|
+
function ke({ startMs: e, endMs: t, viewMode: n, viewportWidth: r = 0, pixelsPerDay: i = 1 }) {
|
|
343
|
+
let o = Number(r) > 0 ? Number(r) : 0, s = Number(i) > 0 ? Number(i) : 1;
|
|
344
|
+
if (o <= 0) return S(e, t, n);
|
|
345
|
+
let c = (t - e) / a;
|
|
346
|
+
if (c * s >= o) return {
|
|
347
|
+
startMs: e,
|
|
348
|
+
endMs: t
|
|
349
|
+
};
|
|
350
|
+
let l = Math.ceil(o / s), u = Math.ceil((l - c) / 2) * a;
|
|
351
|
+
return S(e - u, t + u, n);
|
|
352
|
+
}
|
|
353
|
+
function Ae({ startMs: e, endMs: t, anchorMs: n, viewMode: r, viewportWidth: i = 0, pixelsPerDay: o = 1 }) {
|
|
354
|
+
let s = Number(i) > 0 ? Number(i) : 0, c = Number(o) > 0 ? Number(o) : 1, l = e, u = t;
|
|
355
|
+
if (s > 0 && Number.isFinite(n)) {
|
|
356
|
+
let e = (s / 2 + 200) / c * a;
|
|
357
|
+
l = Math.min(l, n - e), u = Math.max(u, n + e);
|
|
358
|
+
}
|
|
359
|
+
let d = S(l, u, r);
|
|
360
|
+
return ke({
|
|
361
|
+
startMs: d.startMs,
|
|
362
|
+
endMs: d.endMs,
|
|
363
|
+
viewMode: r,
|
|
364
|
+
viewportWidth: s,
|
|
365
|
+
pixelsPerDay: c
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
function je({ anchorMs: e, viewMode: t, timeRangeConfig: n, viewportWidth: r = 0, pixelsPerDay: i = 1 }) {
|
|
369
|
+
let a = Number.isFinite(e) ? e : Date.now(), o = ee(n, a);
|
|
370
|
+
return Ae({
|
|
371
|
+
startMs: o.startMs,
|
|
372
|
+
endMs: o.endMs,
|
|
373
|
+
anchorMs: a,
|
|
374
|
+
viewMode: t,
|
|
375
|
+
viewportWidth: r,
|
|
376
|
+
pixelsPerDay: i
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function Me({ anchorMs: e, toX: t, viewportWidth: n, timelineWidth: r }) {
|
|
380
|
+
let i = Number(n) > 0 ? Number(n) : 0;
|
|
381
|
+
if (!Number.isFinite(e) || typeof t != "function" || i <= 0) return 0;
|
|
382
|
+
let a = t(e);
|
|
383
|
+
return Number.isFinite(a) ? Oe(a - i / 2, i, r) : 0;
|
|
384
|
+
}
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/components/Gantt/GanttChart/hooks/useGanttColumnVirtual.ts
|
|
387
|
+
function Ne(e) {
|
|
388
|
+
let t = Number(e);
|
|
389
|
+
return Math.max((Number.isFinite(t) && t > 0 ? t : 0) * 4, 240);
|
|
390
|
+
}
|
|
391
|
+
function Pe(e, t) {
|
|
392
|
+
if (!Array.isArray(e) || e.length === 0) return [];
|
|
393
|
+
let { scrollLeft: n = 0, viewportWidth: r = 0, pixelsPerDay: i } = t || {}, a = Ne(Number(e[0]?.width) > 0 ? Number(e[0].width) : i), o = e[e.length - 1], s = Oe(n, r, Number(o?.left) + Number(o?.width) > 0 ? Number(o.left) + Number(o.width) : 0), c = Math.max(0, s - a), l = s + r + a, u = e.length, d = 0, f = u - 1, p = u;
|
|
394
|
+
for (; d <= f;) {
|
|
395
|
+
let t = d + f >> 1, n = e[t];
|
|
396
|
+
n.left + n.width > c ? (p = t, f = t - 1) : d = t + 1;
|
|
397
|
+
}
|
|
398
|
+
d = 0, f = u - 1;
|
|
399
|
+
let m = -1;
|
|
400
|
+
for (; d <= f;) {
|
|
401
|
+
let t = d + f >> 1;
|
|
402
|
+
e[t].left < l ? (m = t, d = t + 1) : f = t - 1;
|
|
403
|
+
}
|
|
404
|
+
if (p > m) return [];
|
|
405
|
+
let h = [];
|
|
406
|
+
for (let e = p; e <= m; e += 1) h.push({ index: e });
|
|
407
|
+
return h;
|
|
408
|
+
}
|
|
409
|
+
function Fe({ lowerSegments: e, pixelsPerDay: t, scrollLeft: n, viewportWidth: r, showWeekendHighlight: i, timelineStartMs: o, timelineWidth: s, viewMode: c }) {
|
|
410
|
+
return {
|
|
411
|
+
virtualColumns: G(() => Pe(e, {
|
|
412
|
+
scrollLeft: n,
|
|
413
|
+
viewportWidth: r,
|
|
414
|
+
pixelsPerDay: t
|
|
415
|
+
}), [
|
|
416
|
+
e,
|
|
417
|
+
t,
|
|
418
|
+
n,
|
|
419
|
+
r
|
|
420
|
+
]),
|
|
421
|
+
weekendSegments: G(() => {
|
|
422
|
+
if (!i || s <= 0 || c !== "day") return [];
|
|
423
|
+
let e = Math.max(0, n - 120), l = n + r + 120, u = Math.max(0, Math.floor(e / t)), d = Math.ceil(l / t), f = [];
|
|
424
|
+
for (let e = u; e <= d; e += 1) {
|
|
425
|
+
let n = o + e * a, r = ae(n);
|
|
426
|
+
(r === 0 || r === 6) && f.push({
|
|
427
|
+
id: `weekend-${n}`,
|
|
428
|
+
left: e * t,
|
|
429
|
+
width: t
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
return f;
|
|
433
|
+
}, [
|
|
434
|
+
i,
|
|
435
|
+
s,
|
|
436
|
+
n,
|
|
437
|
+
r,
|
|
438
|
+
t,
|
|
439
|
+
o,
|
|
440
|
+
c
|
|
441
|
+
])
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
$.extend(ue), $.extend(fe);
|
|
445
|
+
var Ie = {
|
|
446
|
+
day: {
|
|
447
|
+
amount: 1,
|
|
448
|
+
unit: "day"
|
|
449
|
+
},
|
|
450
|
+
week: {
|
|
451
|
+
amount: 1,
|
|
452
|
+
unit: "week"
|
|
453
|
+
},
|
|
454
|
+
month: {
|
|
455
|
+
amount: 1,
|
|
456
|
+
unit: "month"
|
|
457
|
+
},
|
|
458
|
+
quarter: {
|
|
459
|
+
amount: 1,
|
|
460
|
+
unit: "quarter"
|
|
461
|
+
},
|
|
462
|
+
quarterMonth: {
|
|
463
|
+
amount: 1,
|
|
464
|
+
unit: "month"
|
|
465
|
+
},
|
|
466
|
+
year: {
|
|
467
|
+
amount: 6,
|
|
468
|
+
unit: "month",
|
|
469
|
+
align: (e) => {
|
|
470
|
+
let t = e.month();
|
|
471
|
+
return t !== 0 && t !== 6 ? t < 6 ? e.startOf("year") : e.month(6).startOf("month") : e;
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
halfDay: {
|
|
475
|
+
amount: 12,
|
|
476
|
+
unit: "hour"
|
|
477
|
+
},
|
|
478
|
+
sixHour: {
|
|
479
|
+
amount: 6,
|
|
480
|
+
unit: "hour"
|
|
481
|
+
},
|
|
482
|
+
hour: {
|
|
483
|
+
amount: 1,
|
|
484
|
+
unit: "hour"
|
|
485
|
+
},
|
|
486
|
+
halfHour: {
|
|
487
|
+
amount: 30,
|
|
488
|
+
unit: "minute"
|
|
489
|
+
},
|
|
490
|
+
tenMinute: {
|
|
491
|
+
amount: 10,
|
|
492
|
+
unit: "minute"
|
|
493
|
+
},
|
|
494
|
+
oneMinute: {
|
|
495
|
+
amount: 1,
|
|
496
|
+
unit: "minute"
|
|
497
|
+
}
|
|
498
|
+
}, Le = (e, t, n) => {
|
|
499
|
+
switch (t) {
|
|
500
|
+
case "halfDay": return e.hour() < 12 ? n("header.lower.halfDayAm") : n("header.lower.halfDayPm");
|
|
501
|
+
case "sixHour": {
|
|
502
|
+
let t = e.hour();
|
|
503
|
+
return n("header.lower.sixHourRange", {
|
|
504
|
+
start: t,
|
|
505
|
+
end: t + 6
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
case "hour": return String(e.hour());
|
|
509
|
+
case "halfHour": return e.format("HH:mm");
|
|
510
|
+
case "tenMinute": return String(e.minute());
|
|
511
|
+
case "oneMinute": return e.format("mm");
|
|
512
|
+
default: return e.format("DD");
|
|
513
|
+
}
|
|
514
|
+
}, Re = (e, t, n) => {
|
|
515
|
+
let r = N(e.valueOf());
|
|
516
|
+
switch (t) {
|
|
517
|
+
case "day": return r.format("DD");
|
|
518
|
+
case "week": return n("header.lower.week", { week: r.isoWeek() });
|
|
519
|
+
case "month":
|
|
520
|
+
case "quarterMonth": return O(e.valueOf(), n);
|
|
521
|
+
case "quarter": return n("header.lower.quarter", { quarter: r.quarter() });
|
|
522
|
+
case "year": return r.month() < 6 ? n("firstHalf") : n("secondHalf");
|
|
523
|
+
default: return Le(r, t, n);
|
|
524
|
+
}
|
|
525
|
+
}, ze = (e, t) => {
|
|
526
|
+
let n = N(e.valueOf()), r = y(t).headerLayout;
|
|
527
|
+
return r === "dayNested" ? `day-${n.format("YYYY-MM-DD")}` : r === "hourNested" ? `hour-${n.format("YYYY-MM-DD-HH")}` : r === "quarterNested" ? `quarter-${n.format("YYYY")}-Q${n.quarter()}` : t === "day" || t === "week" ? `month-${n.format("YYYY-MM")}` : `year-${n.format("YYYY")}`;
|
|
528
|
+
}, Be = (e, t, n) => {
|
|
529
|
+
let r = N(e.valueOf()), i = y(t).headerLayout;
|
|
530
|
+
return i === "dayNested" ? n("header.top.monthDay", {
|
|
531
|
+
month: r.month() + 1,
|
|
532
|
+
day: r.date()
|
|
533
|
+
}) : i === "hourNested" ? r.hour() === 0 ? n("header.top.hourWithDate", {
|
|
534
|
+
month: r.month() + 1,
|
|
535
|
+
day: r.date(),
|
|
536
|
+
hour: 0
|
|
537
|
+
}) : n("header.top.hourOnly", { hour: r.hour() }) : i === "quarterNested" ? D(e.valueOf(), n) : t === "day" || t === "week" ? n("header.top.yearMonth", {
|
|
538
|
+
year: r.year(),
|
|
539
|
+
month: r.month() + 1
|
|
540
|
+
}) : n("header.top.year", { year: r.year() });
|
|
541
|
+
}, Ve = (e, t, n, r, i, a, o) => {
|
|
542
|
+
let s = _(r), c = j ?? 100;
|
|
543
|
+
e.push({
|
|
544
|
+
id: `${r}-${t}`,
|
|
545
|
+
startMs: t,
|
|
546
|
+
endMs: n,
|
|
547
|
+
left: s ? e.length * c : te(t, i, a, r),
|
|
548
|
+
width: s ? c : Math.max(1, E(t, n, a, r)),
|
|
549
|
+
label: Re($(t), r, o)
|
|
550
|
+
});
|
|
551
|
+
}, He = ({ viewMode: e, timelineStartMs: t, timelineEndMs: n, pixelsPerDay: r, formatMessage: i }) => {
|
|
552
|
+
let a = [], o = Ie[e] || Ie.day, s = $(C(t));
|
|
553
|
+
_(e) && (s = s.startOf("month"));
|
|
554
|
+
let c = $(C(n));
|
|
555
|
+
for (; s.isBefore(c);) {
|
|
556
|
+
o.align && (s = o.align(s));
|
|
557
|
+
let n = s.add(o.amount, o.unit);
|
|
558
|
+
Ve(a, x(s.valueOf()), x(n.valueOf()), e, t, r, i), s = n;
|
|
559
|
+
}
|
|
560
|
+
return a;
|
|
561
|
+
}, Ue = ({ lowerSegments: e, viewMode: t, formatMessage: n }) => {
|
|
562
|
+
if (!Array.isArray(e) || e.length === 0) return [];
|
|
563
|
+
let r = [], i = null;
|
|
564
|
+
for (let a of e) {
|
|
565
|
+
let e = $(a.startMs), o = ze(e, t);
|
|
566
|
+
if (!i || i.key !== o) {
|
|
567
|
+
i && r.push({
|
|
568
|
+
id: i.key,
|
|
569
|
+
left: i.left,
|
|
570
|
+
width: i.width,
|
|
571
|
+
label: i.label
|
|
572
|
+
}), i = {
|
|
573
|
+
key: o,
|
|
574
|
+
left: a.left,
|
|
575
|
+
width: a.width,
|
|
576
|
+
label: Be(e, t, n)
|
|
577
|
+
};
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
i.width += a.width;
|
|
581
|
+
}
|
|
582
|
+
return i !== null && r.push({
|
|
583
|
+
id: i.key,
|
|
584
|
+
left: i.left,
|
|
585
|
+
width: i.width,
|
|
586
|
+
label: i.label
|
|
587
|
+
}), r;
|
|
588
|
+
}, We = (e) => {
|
|
589
|
+
if (v(e)) {
|
|
590
|
+
let t = g(e);
|
|
591
|
+
return be(Date.now(), t, "floor") + t / 2;
|
|
592
|
+
}
|
|
593
|
+
return T(Date.now()) + a / 2;
|
|
594
|
+
}, Ge = (e, t) => {
|
|
595
|
+
if (v(t)) {
|
|
596
|
+
let n = g(t);
|
|
597
|
+
return be(e, n, "floor") + n + 1;
|
|
598
|
+
}
|
|
599
|
+
return T(e) + a + 1;
|
|
600
|
+
}, Ke = (e) => {
|
|
601
|
+
let [t, n] = q(() => We(e)), r = K(null), i = V(() => {
|
|
602
|
+
r.current &&= (clearTimeout(r.current), null);
|
|
603
|
+
}, []), a = V(() => {
|
|
604
|
+
i();
|
|
605
|
+
let t = Date.now(), o = Ge(t, e);
|
|
606
|
+
r.current = setTimeout(() => {
|
|
607
|
+
n(We(e)), a();
|
|
608
|
+
}, Math.max(1, o - t));
|
|
609
|
+
}, [i, e]);
|
|
610
|
+
H(() => (n(We(e)), a(), i), [
|
|
611
|
+
e,
|
|
612
|
+
a,
|
|
613
|
+
i
|
|
614
|
+
]);
|
|
615
|
+
let o = Y();
|
|
616
|
+
return H(() => {
|
|
617
|
+
o === "visible" && (n(We(e)), a());
|
|
618
|
+
}, [
|
|
619
|
+
o,
|
|
620
|
+
a,
|
|
621
|
+
e
|
|
622
|
+
]), t;
|
|
623
|
+
}, qe = {
|
|
624
|
+
before: 0,
|
|
625
|
+
after: 0
|
|
626
|
+
};
|
|
627
|
+
function Je({ timeRangeConfig: e, pixelsPerDayConfig: t, viewMode: n, contentRef: r, contentSize: i, headerTrackRef: o, formatMessage: s }) {
|
|
628
|
+
let c = A(n, t), u = G(() => ie(n, e), [n, e]), d = i?.width !== null && i?.width !== void 0 && Number(i.width) > 0 ? Number(i.width) : 0, f = K(!1), [p, m] = q(!1), [h, g] = q(d), _ = K(null), v = K(!1), y = K(!1), b = K(!1), x = K(!1), C = K(!1), w = K(null), T = K(null), E = V((e) => {
|
|
629
|
+
let t = T.current;
|
|
630
|
+
if (!t || !e) return !1;
|
|
631
|
+
let n = e.scrollLeft || 0;
|
|
632
|
+
return Math.abs(n - t.targetLeft) > 1;
|
|
633
|
+
}, []), D = V((e) => {
|
|
634
|
+
let t = T.current;
|
|
635
|
+
t && Math.abs(e - t.targetLeft) <= 1 && (T.current = null);
|
|
636
|
+
}, []), O = V((e) => {
|
|
637
|
+
let t = l[n] || l.day;
|
|
638
|
+
e === "left" && !b.current && (b.current = !0, y.current = !1, N((e) => ({
|
|
639
|
+
...e,
|
|
640
|
+
before: e.before + t
|
|
641
|
+
}))), e === "right" && !x.current && (x.current = !0, N((e) => ({
|
|
642
|
+
...e,
|
|
643
|
+
after: e.after + t
|
|
644
|
+
})));
|
|
645
|
+
}, [n]), [k, j] = q(0), ee = K(0), te = K(0), M = K(null), re = V((e) => {
|
|
646
|
+
te.current = e, M.current === null && (M.current = requestAnimationFrame(() => {
|
|
647
|
+
M.current = null;
|
|
648
|
+
let e = te.current;
|
|
649
|
+
j((t) => t === e ? t : e);
|
|
650
|
+
}));
|
|
651
|
+
}, []);
|
|
652
|
+
H(() => () => {
|
|
653
|
+
M.current !== null && cancelAnimationFrame(M.current);
|
|
654
|
+
}, []);
|
|
655
|
+
let [ae, N] = q(qe), [P, oe] = q(null), se = K(n), le = se.current === n, F = le ? ae : qe, I = le ? P : null, L = V(() => {
|
|
656
|
+
let e = _.current;
|
|
657
|
+
return e !== null && Number.isFinite(e) ? e : We(n);
|
|
658
|
+
}, [n]), R = V((e) => {
|
|
659
|
+
Number.isFinite(e) && (_.current = e);
|
|
660
|
+
}, []), z = V((e) => {
|
|
661
|
+
T.current = null;
|
|
662
|
+
let t = je({
|
|
663
|
+
anchorMs: Number.isFinite(e) ? e : L(),
|
|
664
|
+
viewMode: n,
|
|
665
|
+
timeRangeConfig: u,
|
|
666
|
+
viewportWidth: h || 1e3,
|
|
667
|
+
pixelsPerDay: c
|
|
668
|
+
});
|
|
669
|
+
return N(qe), oe(t), v.current = !0, y.current = !0, t;
|
|
670
|
+
}, [
|
|
671
|
+
u,
|
|
672
|
+
c,
|
|
673
|
+
L,
|
|
674
|
+
n,
|
|
675
|
+
h
|
|
676
|
+
]);
|
|
677
|
+
H(() => {
|
|
678
|
+
se.current = n, z(L());
|
|
679
|
+
}, [e?.bufferDaysBefore, e?.bufferDaysAfter]), W(() => {
|
|
680
|
+
let e = i?.width !== null && i?.width !== void 0 && Number(i.width) > 0 ? Number(i.width) : 0, t = r.current?.clientWidth !== null && r.current?.clientWidth !== void 0 && Number(r.current.clientWidth) > 0 ? Number(r.current.clientWidth) : 0, n = e > 0 ? e : f.current ? t : 0;
|
|
681
|
+
n > 0 && n !== h && g(n);
|
|
682
|
+
}, [
|
|
683
|
+
r,
|
|
684
|
+
i?.width,
|
|
685
|
+
h
|
|
686
|
+
]);
|
|
687
|
+
let B = G(() => I || je({
|
|
688
|
+
anchorMs: L(),
|
|
689
|
+
viewMode: n,
|
|
690
|
+
timeRangeConfig: u,
|
|
691
|
+
viewportWidth: h || 1e3,
|
|
692
|
+
pixelsPerDay: c
|
|
693
|
+
}), [
|
|
694
|
+
I,
|
|
695
|
+
u,
|
|
696
|
+
c,
|
|
697
|
+
L,
|
|
698
|
+
n,
|
|
699
|
+
h
|
|
700
|
+
]), { timelineStartMs: U, timelineEndMs: J } = G(() => {
|
|
701
|
+
let e = B.startMs, t = B.endMs, r = S(e - F.before * a, t + F.after * a, n), i = ke({
|
|
702
|
+
startMs: r.startMs,
|
|
703
|
+
endMs: r.endMs,
|
|
704
|
+
viewMode: n,
|
|
705
|
+
viewportWidth: h,
|
|
706
|
+
pixelsPerDay: c
|
|
707
|
+
});
|
|
708
|
+
return {
|
|
709
|
+
timelineStartMs: i.startMs,
|
|
710
|
+
timelineEndMs: i.endMs
|
|
711
|
+
};
|
|
712
|
+
}, [
|
|
713
|
+
B,
|
|
714
|
+
F,
|
|
715
|
+
n,
|
|
716
|
+
h,
|
|
717
|
+
c
|
|
718
|
+
]), Y = G(() => He({
|
|
719
|
+
viewMode: n,
|
|
720
|
+
timelineStartMs: U,
|
|
721
|
+
timelineEndMs: J,
|
|
722
|
+
pixelsPerDay: c,
|
|
723
|
+
formatMessage: s
|
|
724
|
+
}), [
|
|
725
|
+
n,
|
|
726
|
+
U,
|
|
727
|
+
J,
|
|
728
|
+
c,
|
|
729
|
+
s
|
|
730
|
+
]), X = G(() => ne({
|
|
731
|
+
viewMode: n,
|
|
732
|
+
timelineStartMs: U,
|
|
733
|
+
timelineEndMs: J,
|
|
734
|
+
pixelsPerDay: c,
|
|
735
|
+
lowerSegments: Y
|
|
736
|
+
}), [
|
|
737
|
+
n,
|
|
738
|
+
U,
|
|
739
|
+
J,
|
|
740
|
+
c,
|
|
741
|
+
Y
|
|
742
|
+
]), Z = G(() => {
|
|
743
|
+
if (Y.length === 0) return 0;
|
|
744
|
+
let e = Y[Y.length - 1];
|
|
745
|
+
return e.left + e.width;
|
|
746
|
+
}, [Y]);
|
|
747
|
+
W(() => {
|
|
748
|
+
se.current !== n && (se.current = n, z(L()));
|
|
749
|
+
}, [
|
|
750
|
+
n,
|
|
751
|
+
L,
|
|
752
|
+
z
|
|
753
|
+
]);
|
|
754
|
+
let Q = Ke(n), $ = G(() => Z <= 0 ? null : X.toX(Q), [
|
|
755
|
+
Q,
|
|
756
|
+
X,
|
|
757
|
+
Z
|
|
758
|
+
]), ue = V((e) => {
|
|
759
|
+
let t = o?.current;
|
|
760
|
+
t && (t.style.transform = `translateX(${-e}px)`);
|
|
761
|
+
}, [o]), de = V(() => {
|
|
762
|
+
let e = r.current, t = h;
|
|
763
|
+
if (!e || t <= 0 || Z <= 0) return !1;
|
|
764
|
+
let n = Me({
|
|
765
|
+
anchorMs: L(),
|
|
766
|
+
toX: X.toX,
|
|
767
|
+
viewportWidth: t,
|
|
768
|
+
timelineWidth: Z
|
|
769
|
+
});
|
|
770
|
+
return w.current = n, e.scrollLeft = n, ue(n), j(n), ee.current = n, !0;
|
|
771
|
+
}, [
|
|
772
|
+
ue,
|
|
773
|
+
r,
|
|
774
|
+
L,
|
|
775
|
+
X,
|
|
776
|
+
Z,
|
|
777
|
+
h
|
|
778
|
+
]), fe = V((e) => {
|
|
779
|
+
let t = e.currentTarget.scrollLeft, n = h, r = w.current, i = r !== null && Math.abs(t - r) <= 1;
|
|
780
|
+
i ? w.current = null : f.current && (C.current = !0), ue(t);
|
|
781
|
+
let a = t !== ee.current;
|
|
782
|
+
ee.current = t, a && re(t), n > 0 && !i && R(X.timeAtX(t + n / 2)), D(t);
|
|
783
|
+
}, [
|
|
784
|
+
ue,
|
|
785
|
+
X,
|
|
786
|
+
h,
|
|
787
|
+
re,
|
|
788
|
+
R,
|
|
789
|
+
D
|
|
790
|
+
]), pe = V(() => {
|
|
791
|
+
let e = We(n);
|
|
792
|
+
R(e), z(e);
|
|
793
|
+
}, [
|
|
794
|
+
z,
|
|
795
|
+
R,
|
|
796
|
+
n
|
|
797
|
+
]), me = V((e) => {
|
|
798
|
+
let t = r.current, n = ce(e) ? e : e?.targetScrollLeft, i = ce(e) ? null : e?.targetStartMs ?? null;
|
|
799
|
+
if (!t) return;
|
|
800
|
+
let a = h;
|
|
801
|
+
if (i !== null && Number.isFinite(i) && (i < U || i >= J) && i !== null) {
|
|
802
|
+
R(i), b.current = !1, x.current = !1, z(i);
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
if (!Number.isFinite(n)) return;
|
|
806
|
+
let o = Oe(n, a, Z), s = t.scrollLeft || 0, c = a > 0 && Math.abs(o - s) <= a * 1.5 ? "smooth" : "auto";
|
|
807
|
+
c === "smooth" && (T.current = { targetLeft: o }), t.scrollTo({
|
|
808
|
+
left: o,
|
|
809
|
+
behavior: c
|
|
810
|
+
}), a > 0 && R(X.timeAtX(o + a / 2));
|
|
811
|
+
}, [
|
|
812
|
+
r,
|
|
813
|
+
z,
|
|
814
|
+
R,
|
|
815
|
+
X,
|
|
816
|
+
J,
|
|
817
|
+
U,
|
|
818
|
+
Z,
|
|
819
|
+
h
|
|
820
|
+
]);
|
|
821
|
+
H(() => {
|
|
822
|
+
if (!f.current || !h || !Z || v.current || !C.current) return;
|
|
823
|
+
let e = r.current;
|
|
824
|
+
if (E(e)) return;
|
|
825
|
+
e && D(e.scrollLeft || 0);
|
|
826
|
+
let t = k, n = Z - (k + h);
|
|
827
|
+
t >= 0 && t <= 280 && O("left"), n >= 0 && n <= 280 && O("right");
|
|
828
|
+
}, [
|
|
829
|
+
k,
|
|
830
|
+
Z,
|
|
831
|
+
h,
|
|
832
|
+
P,
|
|
833
|
+
r,
|
|
834
|
+
E,
|
|
835
|
+
D,
|
|
836
|
+
O
|
|
837
|
+
]), H(() => {
|
|
838
|
+
b.current = !1, x.current = !1;
|
|
839
|
+
}, [Z]), W(() => {
|
|
840
|
+
if (!(!f.current || _.current === null) && !v.current) {
|
|
841
|
+
if (y.current) {
|
|
842
|
+
y.current = !1;
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
de();
|
|
846
|
+
}
|
|
847
|
+
}, [
|
|
848
|
+
de,
|
|
849
|
+
X,
|
|
850
|
+
Z,
|
|
851
|
+
h,
|
|
852
|
+
P
|
|
853
|
+
]), W(() => {
|
|
854
|
+
v.current && (h <= 0 || Z <= 0 || de() && (v.current = !1, y.current = !1, b.current = !1, x.current = !1, f.current || (f.current = !0, m(!0))));
|
|
855
|
+
}, [
|
|
856
|
+
de,
|
|
857
|
+
Z,
|
|
858
|
+
h,
|
|
859
|
+
P
|
|
860
|
+
]), W(() => {
|
|
861
|
+
if (!f.current && h > 0 && Z > 0) {
|
|
862
|
+
if (Number.isFinite(_.current ?? NaN) || R(We(n)), !P) {
|
|
863
|
+
z(L());
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
v.current = !0, de(), v.current = !1, f.current = !0, m(!0);
|
|
867
|
+
}
|
|
868
|
+
}, [
|
|
869
|
+
de,
|
|
870
|
+
L,
|
|
871
|
+
z,
|
|
872
|
+
R,
|
|
873
|
+
P,
|
|
874
|
+
Z,
|
|
875
|
+
h,
|
|
876
|
+
n
|
|
877
|
+
]);
|
|
878
|
+
let he = V((e) => {
|
|
879
|
+
let t = h;
|
|
880
|
+
t <= 0 || R(X.timeAtX(e + t / 2));
|
|
881
|
+
}, [
|
|
882
|
+
h,
|
|
883
|
+
X,
|
|
884
|
+
R
|
|
885
|
+
]), ge = V(() => {
|
|
886
|
+
let e = r.current;
|
|
887
|
+
if (!e) return;
|
|
888
|
+
let t = h, n = e.scrollLeft || 0, i = Math.max(0, n - t);
|
|
889
|
+
if (Math.abs(i - n) <= 1) {
|
|
890
|
+
T.current = null, i <= 280 && O("left");
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
T.current = { targetLeft: i }, e.scrollTo({
|
|
894
|
+
left: i,
|
|
895
|
+
behavior: "smooth"
|
|
896
|
+
}), he(i);
|
|
897
|
+
}, [
|
|
898
|
+
r,
|
|
899
|
+
h,
|
|
900
|
+
he,
|
|
901
|
+
O
|
|
902
|
+
]), _e = V(() => {
|
|
903
|
+
let e = r.current;
|
|
904
|
+
if (!e) return;
|
|
905
|
+
let t = h, n = e.scrollLeft || 0, i = Math.max(0, Z - t), a = Oe(n + t, t, Z);
|
|
906
|
+
if (Math.abs(a - n) <= 1) {
|
|
907
|
+
T.current = null, a >= i - 1 && O("right");
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
T.current = { targetLeft: a }, e.scrollTo({
|
|
911
|
+
left: a,
|
|
912
|
+
behavior: "smooth"
|
|
913
|
+
}), he(a);
|
|
914
|
+
}, [
|
|
915
|
+
r,
|
|
916
|
+
h,
|
|
917
|
+
Z,
|
|
918
|
+
he,
|
|
919
|
+
O
|
|
920
|
+
]);
|
|
921
|
+
return H(() => {
|
|
922
|
+
let e = r.current;
|
|
923
|
+
if (!e) return;
|
|
924
|
+
let t = () => {
|
|
925
|
+
let t = T.current;
|
|
926
|
+
if (!t) return;
|
|
927
|
+
let n = e.scrollLeft || 0;
|
|
928
|
+
Math.abs(n - t.targetLeft) > 1 || (T.current = null);
|
|
929
|
+
};
|
|
930
|
+
return e.addEventListener("scrollend", t), () => e.removeEventListener("scrollend", t);
|
|
931
|
+
}, [r]), {
|
|
932
|
+
pixelsPerDay: c,
|
|
933
|
+
viewportWidth: h,
|
|
934
|
+
scrollLeft: (!le || v.current) && Z > 0 && h > 0 ? Me({
|
|
935
|
+
anchorMs: L(),
|
|
936
|
+
toX: X.toX,
|
|
937
|
+
viewportWidth: h,
|
|
938
|
+
timelineWidth: Z
|
|
939
|
+
}) : k,
|
|
940
|
+
timelineStartMs: U,
|
|
941
|
+
timelineEndMs: J,
|
|
942
|
+
lowerSegments: Y,
|
|
943
|
+
timelineCoords: X,
|
|
944
|
+
timelineWidth: Z,
|
|
945
|
+
todayCenterMs: Q,
|
|
946
|
+
todayLineLeft: $,
|
|
947
|
+
isInitialLayoutReady: p,
|
|
948
|
+
handleContentScroll: fe,
|
|
949
|
+
handleTodayClick: pe,
|
|
950
|
+
handleOffscreenJump: me,
|
|
951
|
+
handleScrollPrev: ge,
|
|
952
|
+
handleScrollNext: _e
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region src/components/Gantt/GanttChart/hooks/useNormalizedItems.ts
|
|
957
|
+
function Ye({ visibleItems: e, committedRangeById: t = {}, viewMode: n = "day" }) {
|
|
958
|
+
return { normalizedItems: G(() => {
|
|
959
|
+
let r = Array.isArray(e) ? e : [], i = [], a = b(n) ? n : "day";
|
|
960
|
+
for (let e = 0; e < r.length; e++) {
|
|
961
|
+
let n = r[e], o = String(n?.id ?? `row-${e}`), { rawStartMs: s, rawEndMs: c, baseStartMs: l, baseEndMs: u, invalid: d } = M(n?.start, n?.end), f = t[o], p = n?.type === "summary" ? !1 : d, m = k({
|
|
962
|
+
rawStartMs: s,
|
|
963
|
+
rawEndMs: c,
|
|
964
|
+
baseStartMs: l,
|
|
965
|
+
baseEndMs: u
|
|
966
|
+
}, a), h = m.startMs, g = m.endMs;
|
|
967
|
+
if (!p && f?.startMs && f?.endMs) {
|
|
968
|
+
let e = f.startMs, t = f.endMs;
|
|
969
|
+
Number.isFinite(e) && Number.isFinite(t) && t > e && (h = e, g = t);
|
|
970
|
+
}
|
|
971
|
+
i.push({
|
|
972
|
+
...n,
|
|
973
|
+
id: o,
|
|
974
|
+
rowIndex: e,
|
|
975
|
+
parentId: n?.parentId ?? void 0,
|
|
976
|
+
groupKey: n?.groupKey ?? void 0,
|
|
977
|
+
recordId: n?.recordId ?? void 0,
|
|
978
|
+
rawStartMs: s,
|
|
979
|
+
rawEndMs: c,
|
|
980
|
+
baseStartMs: l,
|
|
981
|
+
baseEndMs: u,
|
|
982
|
+
startMs: h,
|
|
983
|
+
endMs: g,
|
|
984
|
+
invalid: p,
|
|
985
|
+
progress: n?.progress === null || n?.progress === void 0 ? null : w(n.progress)
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
return i;
|
|
989
|
+
}, [
|
|
990
|
+
e,
|
|
991
|
+
t,
|
|
992
|
+
n
|
|
993
|
+
]) };
|
|
994
|
+
}
|
|
995
|
+
//#endregion
|
|
996
|
+
//#region src/components/Gantt/GanttChart/hooks/useGanttScrollbars.tsx
|
|
997
|
+
function Xe(e, t) {
|
|
998
|
+
W(() => {
|
|
999
|
+
let n = e.current, r = t.current;
|
|
1000
|
+
if (!n || !r) return;
|
|
1001
|
+
let i = pe({
|
|
1002
|
+
target: n,
|
|
1003
|
+
elements: { viewport: r }
|
|
1004
|
+
}, { scrollbars: {
|
|
1005
|
+
theme: "os-theme-bsy",
|
|
1006
|
+
autoHide: "leave",
|
|
1007
|
+
autoHideDelay: 600,
|
|
1008
|
+
clickScroll: !0
|
|
1009
|
+
} });
|
|
1010
|
+
return () => {
|
|
1011
|
+
i?.destroy();
|
|
1012
|
+
};
|
|
1013
|
+
}, [e, t]);
|
|
1014
|
+
}
|
|
1015
|
+
//#endregion
|
|
1016
|
+
//#region src/components/Gantt/GanttChart/utils/timelineMarkers.ts
|
|
1017
|
+
function Ze(e, t, n) {
|
|
1018
|
+
return !!e && t !== null && Number.isFinite(t) && t >= 0 && t <= n;
|
|
1019
|
+
}
|
|
1020
|
+
var Qe = R.memo(({ timelineWidth: e, viewportWidth: t = 0, scrollLeft: n, trackRef: r, virtualColumns: i, lowerSegments: a, todayLineLeft: o, todayCenterMs: s, showTodayLine: c, viewMode: l, availableModes: u, formatMessage: d, onViewModeChange: f, onTodayClick: p, onScrollPrev: m, onScrollNext: h }) => {
|
|
1021
|
+
let g = G(() => Ue({
|
|
1022
|
+
lowerSegments: a,
|
|
1023
|
+
viewMode: l,
|
|
1024
|
+
formatMessage: d
|
|
1025
|
+
}), [
|
|
1026
|
+
a,
|
|
1027
|
+
l,
|
|
1028
|
+
d
|
|
1029
|
+
]), _ = G(() => {
|
|
1030
|
+
let r = Oe(n, t, e), i = r - 240, a = r + t + 240;
|
|
1031
|
+
return g.filter((e) => e.left < a && e.left + e.width > i);
|
|
1032
|
+
}, [
|
|
1033
|
+
g,
|
|
1034
|
+
n,
|
|
1035
|
+
t,
|
|
1036
|
+
e
|
|
1037
|
+
]), v = G(() => a.length && a.find((e) => s != null && s >= e.startMs && s < e.endMs)?.id || null, [a, s]), y = Ze(c, o, e);
|
|
1038
|
+
return /* @__PURE__ */ L("div", {
|
|
1039
|
+
className: "bsy-gantt-chart__calendar",
|
|
1040
|
+
children: [/* @__PURE__ */ L("div", {
|
|
1041
|
+
ref: r,
|
|
1042
|
+
className: "bsy-gantt-chart__calendar-track",
|
|
1043
|
+
style: { width: e },
|
|
1044
|
+
children: [
|
|
1045
|
+
i.map((e) => {
|
|
1046
|
+
let t = a[e.index];
|
|
1047
|
+
return t ? /* @__PURE__ */ I("div", {
|
|
1048
|
+
className: "bsy-gantt-chart__header-col-line",
|
|
1049
|
+
style: {
|
|
1050
|
+
left: t.left,
|
|
1051
|
+
top: 34,
|
|
1052
|
+
height: 34
|
|
1053
|
+
}
|
|
1054
|
+
}, `header-line-${t.id}`) : null;
|
|
1055
|
+
}),
|
|
1056
|
+
_.map((e) => {
|
|
1057
|
+
let t = Math.max(0, n - e.left);
|
|
1058
|
+
return /* @__PURE__ */ L(R.Fragment, { children: [/* @__PURE__ */ I("div", {
|
|
1059
|
+
className: "bsy-gantt-chart__header-cell bsy-gantt-chart__header-cell--top",
|
|
1060
|
+
style: {
|
|
1061
|
+
left: e.left,
|
|
1062
|
+
width: e.width,
|
|
1063
|
+
height: 34
|
|
1064
|
+
},
|
|
1065
|
+
children: /* @__PURE__ */ I("span", {
|
|
1066
|
+
className: "bsy-gantt-chart__header-cell-sticky-text",
|
|
1067
|
+
style: { transform: `translateX(${t}px)` },
|
|
1068
|
+
children: e.label
|
|
1069
|
+
})
|
|
1070
|
+
}), /* @__PURE__ */ I("div", {
|
|
1071
|
+
className: "bsy-gantt-chart__header-col-line",
|
|
1072
|
+
style: {
|
|
1073
|
+
left: e.left + e.width,
|
|
1074
|
+
top: 0,
|
|
1075
|
+
height: 34
|
|
1076
|
+
}
|
|
1077
|
+
})] }, `top-group-${e.id}`);
|
|
1078
|
+
}),
|
|
1079
|
+
i.map((e) => {
|
|
1080
|
+
let t = a[e.index];
|
|
1081
|
+
return t ? /* @__PURE__ */ I("div", {
|
|
1082
|
+
className: J("bsy-gantt-chart__header-cell", "bsy-gantt-chart__header-cell--bottom", t.id === v && "bsy-gantt-chart__header-cell--bottom-active"),
|
|
1083
|
+
style: {
|
|
1084
|
+
left: t.left,
|
|
1085
|
+
width: t.width,
|
|
1086
|
+
height: 34,
|
|
1087
|
+
top: 34
|
|
1088
|
+
},
|
|
1089
|
+
children: t.label
|
|
1090
|
+
}, t.id) : null;
|
|
1091
|
+
}),
|
|
1092
|
+
y && /* @__PURE__ */ I("span", {
|
|
1093
|
+
className: "bsy-gantt-chart__today-indicator--header-dot",
|
|
1094
|
+
style: { left: o ?? void 0 }
|
|
1095
|
+
})
|
|
1096
|
+
]
|
|
1097
|
+
}), /* @__PURE__ */ I("div", {
|
|
1098
|
+
className: "bsy-gantt-chart__calendar-toolbar",
|
|
1099
|
+
children: /* @__PURE__ */ I(oe, {
|
|
1100
|
+
viewMode: l,
|
|
1101
|
+
availableModes: u,
|
|
1102
|
+
onViewModeChange: f,
|
|
1103
|
+
onTodayClick: p,
|
|
1104
|
+
onScrollPrev: m,
|
|
1105
|
+
onScrollNext: h
|
|
1106
|
+
})
|
|
1107
|
+
})]
|
|
1108
|
+
});
|
|
1109
|
+
});
|
|
1110
|
+
//#endregion
|
|
1111
|
+
//#region src/components/Gantt/GanttChart/hooks/useGanttRowVirtualScroll.ts
|
|
1112
|
+
function $e({ items: e, contentRef: t, safeRowHeight: n, viewportHeight: r, overscan: i = 4 }) {
|
|
1113
|
+
let [a, o] = q(!1), s = de({
|
|
1114
|
+
count: e.length,
|
|
1115
|
+
getScrollElement: () => t.current,
|
|
1116
|
+
estimateSize: () => n,
|
|
1117
|
+
overscan: i,
|
|
1118
|
+
onChange: (e) => {
|
|
1119
|
+
let t = !!e?.isScrolling;
|
|
1120
|
+
o((e) => e === t ? e : t);
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
return {
|
|
1124
|
+
virtualRows: s.getVirtualItems(),
|
|
1125
|
+
canvasHeight: Math.max(s.getTotalSize(), r),
|
|
1126
|
+
isScrolling: a
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
//#endregion
|
|
1130
|
+
//#region src/components/Gantt/GanttChart/hooks/useOffscreenIndicators.ts
|
|
1131
|
+
function et({ virtualRows: e, normalizedItems: t, scrollLeft: n, viewportWidth: r, timelineCoords: i, timelineWidth: a, enabled: o = !0 }) {
|
|
1132
|
+
return G(() => {
|
|
1133
|
+
if (!o || !i || !Array.isArray(e) || !Array.isArray(t) || r <= 0 || a <= r) return [];
|
|
1134
|
+
let s = n, c = n + r, l = [];
|
|
1135
|
+
return e.forEach((e) => {
|
|
1136
|
+
let n = t[e.index];
|
|
1137
|
+
if (!n || n.invalid || n.type === "summary" || n.startMs === null || n.startMs === void 0 || n.endMs === null || n.endMs === void 0) return;
|
|
1138
|
+
let o = i.toX(n.startMs), u = o + i.toWidth(n.startMs, n.endMs) < s, d = o > c;
|
|
1139
|
+
if (!u && !d) return;
|
|
1140
|
+
let f = Oe(o - r / 2, r, a);
|
|
1141
|
+
l.push({
|
|
1142
|
+
rowKey: `offscreen-${n.id}-${e.key}`,
|
|
1143
|
+
rowTop: e.start,
|
|
1144
|
+
rowHeight: e.size,
|
|
1145
|
+
showLeft: u,
|
|
1146
|
+
showRight: d,
|
|
1147
|
+
targetStartMs: n.startMs,
|
|
1148
|
+
targetScrollLeft: f
|
|
1149
|
+
});
|
|
1150
|
+
}), l;
|
|
1151
|
+
}, [
|
|
1152
|
+
e,
|
|
1153
|
+
t,
|
|
1154
|
+
n,
|
|
1155
|
+
r,
|
|
1156
|
+
i,
|
|
1157
|
+
a,
|
|
1158
|
+
o
|
|
1159
|
+
]);
|
|
1160
|
+
}
|
|
1161
|
+
//#endregion
|
|
1162
|
+
//#region src/components/Gantt/GanttChart/hooks/useRowHoverHighlight.ts
|
|
1163
|
+
function tt({ normalizedItems: e, safeRowHeight: t }) {
|
|
1164
|
+
let n = Q(d, (e) => e.setHighlightTarget), r = Q(d, (e) => e.subscribeHighlight), i = Q(d, (e) => e.getIsScrollActive), a = K(null), o = K(null), s = K(null), c = K(!1), l = G(() => {
|
|
1165
|
+
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
1166
|
+
for (; n < e.length;) {
|
|
1167
|
+
let r = e[n]?.parentId;
|
|
1168
|
+
if (r) {
|
|
1169
|
+
let i = n;
|
|
1170
|
+
for (; i < e.length && e[i]?.parentId === r;) i += 1;
|
|
1171
|
+
for (let e = n; e < i; e += 1) t.set(e, {
|
|
1172
|
+
startIndex: n,
|
|
1173
|
+
endIndex: i - 1
|
|
1174
|
+
});
|
|
1175
|
+
n = i;
|
|
1176
|
+
} else t.set(n, null), n += 1;
|
|
1177
|
+
}
|
|
1178
|
+
return t;
|
|
1179
|
+
}, [e]), u = K(l);
|
|
1180
|
+
u.current = l;
|
|
1181
|
+
let m = V((e, n) => {
|
|
1182
|
+
let r = o.current;
|
|
1183
|
+
r && (r.style.top = `${e * t}px`, r.style.height = `${(n - e + 1) * t}px`, r.style.display = "block");
|
|
1184
|
+
}, [t]), h = V(() => {
|
|
1185
|
+
let e = o.current;
|
|
1186
|
+
e && (e.style.display = "none");
|
|
1187
|
+
}, []), g = V((t) => {
|
|
1188
|
+
if (!t) {
|
|
1189
|
+
h();
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
let n = t.type, r = t.id, i = -1, a = -1;
|
|
1193
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
1194
|
+
let o = p(e[t]);
|
|
1195
|
+
o && o.type === n && o.id === r && (i === -1 && (i = t), a = t);
|
|
1196
|
+
}
|
|
1197
|
+
if (i === -1) {
|
|
1198
|
+
h();
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
m(i, a);
|
|
1202
|
+
}, [
|
|
1203
|
+
e,
|
|
1204
|
+
m,
|
|
1205
|
+
h
|
|
1206
|
+
]), _ = V((r) => {
|
|
1207
|
+
if (i?.()) {
|
|
1208
|
+
a.current !== null && (a.current = null, h()), c.current = !1;
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
c.current = !0;
|
|
1212
|
+
let o = r.currentTarget, l = o.getBoundingClientRect(), d = r.clientY - l.top + o.scrollTop, g = Math.floor(d / t);
|
|
1213
|
+
if (g < 0 || g >= e.length) {
|
|
1214
|
+
a.current !== null && (a.current = null, h(), s.current !== null && (s.current = null, n?.(null)));
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
if (a.current !== g) {
|
|
1218
|
+
a.current = g;
|
|
1219
|
+
let t = u.current.get(g);
|
|
1220
|
+
m(t ? t.startIndex : g, t ? t.endIndex : g);
|
|
1221
|
+
let r = p(e[g]);
|
|
1222
|
+
f(s.current, r) || (s.current = r, n?.(r));
|
|
1223
|
+
}
|
|
1224
|
+
}, [
|
|
1225
|
+
t,
|
|
1226
|
+
e,
|
|
1227
|
+
n,
|
|
1228
|
+
m,
|
|
1229
|
+
h,
|
|
1230
|
+
i
|
|
1231
|
+
]), v = V(() => {
|
|
1232
|
+
c.current = !1, a.current = null, h(), s.current !== null && (s.current = null, n?.(null));
|
|
1233
|
+
}, [n, h]);
|
|
1234
|
+
return H(() => {
|
|
1235
|
+
if (r) return r((e, t) => {
|
|
1236
|
+
if (t?.source === "table") {
|
|
1237
|
+
c.current = !1, a.current = null, s.current = e, g(e);
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
c.current || g(e);
|
|
1241
|
+
});
|
|
1242
|
+
}, [r, g]), {
|
|
1243
|
+
hoverBgRef: o,
|
|
1244
|
+
handleContentMouseMove: _,
|
|
1245
|
+
handleContentMouseLeave: v
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
//#endregion
|
|
1249
|
+
//#region src/components/Gantt/GanttChart/GanttInteractionContext.ts
|
|
1250
|
+
var nt = Z({
|
|
1251
|
+
tooltip: null,
|
|
1252
|
+
isScrolling: !1,
|
|
1253
|
+
collapsedKeys: void 0,
|
|
1254
|
+
onBarClick: () => {},
|
|
1255
|
+
onTaskMouseDown: () => {},
|
|
1256
|
+
onResizeMouseDown: () => {}
|
|
1257
|
+
}), rt = (e) => Q(nt, e), it = Z({
|
|
1258
|
+
pixelsPerDay: 1,
|
|
1259
|
+
timelineStartMs: 0,
|
|
1260
|
+
timelineCoords: {
|
|
1261
|
+
toX: () => 0,
|
|
1262
|
+
toWidth: () => 0,
|
|
1263
|
+
timeAtX: () => 0
|
|
1264
|
+
},
|
|
1265
|
+
scrollLeft: 0,
|
|
1266
|
+
viewportWidth: 0,
|
|
1267
|
+
timelineWidth: 0,
|
|
1268
|
+
isInitialLayoutReady: !1
|
|
1269
|
+
}), at = (e) => Q(it, e), ot = (e, t) => {
|
|
1270
|
+
let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
|
|
1271
|
+
return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
|
|
1272
|
+
}, st = (e, t) => {
|
|
1273
|
+
if (!le(e)) return null;
|
|
1274
|
+
let n = e.trim();
|
|
1275
|
+
return i.test(n) ? ot(n, t) : null;
|
|
1276
|
+
}, ct = (e, t = 2.5) => {
|
|
1277
|
+
if (!e || !le(e)) return "#121211";
|
|
1278
|
+
let n, r, i;
|
|
1279
|
+
if (e.startsWith("#")) {
|
|
1280
|
+
let t = e.replace("#", ""), a = t.length === 3 ? [...t].map((e) => e + e) : [
|
|
1281
|
+
t.slice(0, 2),
|
|
1282
|
+
t.slice(2, 4),
|
|
1283
|
+
t.slice(4, 6)
|
|
1284
|
+
];
|
|
1285
|
+
[n, r, i] = a.map((e) => parseInt(e, 16));
|
|
1286
|
+
} else {
|
|
1287
|
+
let t = (e.match(/\d+/g) || []).map(Number);
|
|
1288
|
+
if ([n, r, i] = t.slice(0, 3), n === void 0 || Number.isNaN(n)) return "#121211";
|
|
1289
|
+
}
|
|
1290
|
+
let a = (e) => {
|
|
1291
|
+
let t = e / 255;
|
|
1292
|
+
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
1293
|
+
};
|
|
1294
|
+
return 1.05 / (.2126 * a(n) + .7152 * a(r) + .0722 * a(i) + .05) >= t ? "#ffffff" : "#121211";
|
|
1295
|
+
}, lt, ut = () => {
|
|
1296
|
+
if (lt !== void 0) return lt;
|
|
1297
|
+
try {
|
|
1298
|
+
lt = document.createElement("canvas").getContext("2d");
|
|
1299
|
+
} catch {
|
|
1300
|
+
lt = null;
|
|
1301
|
+
}
|
|
1302
|
+
return lt;
|
|
1303
|
+
}, dt = (e, t = "12px -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, PingFang SC, Noto Sans, Noto Sans CJK SC, Microsoft YaHei, \"微软雅黑\", sans-serif") => {
|
|
1304
|
+
if (!e) return 0;
|
|
1305
|
+
let n = String(e), r = ut();
|
|
1306
|
+
return r ? (r.font = t, r.measureText(n).width + 20) : n.length * 12 + 20;
|
|
1307
|
+
};
|
|
1308
|
+
//#endregion
|
|
1309
|
+
//#region src/components/Gantt/GanttChart/hooks/useBarTooltipHover.ts
|
|
1310
|
+
function ft() {
|
|
1311
|
+
let [e, t] = q(null), n = K("idle"), r = V((e) => {
|
|
1312
|
+
n.current === "frozen" && (n.current = "open");
|
|
1313
|
+
let r = e.currentTarget.getBoundingClientRect();
|
|
1314
|
+
t({
|
|
1315
|
+
x: e.clientX,
|
|
1316
|
+
y: r.y,
|
|
1317
|
+
top: r.top,
|
|
1318
|
+
bottom: r.bottom,
|
|
1319
|
+
height: r.height
|
|
1320
|
+
});
|
|
1321
|
+
}, []), i = V(() => {
|
|
1322
|
+
n.current === "open" ? n.current = "frozen" : t(null);
|
|
1323
|
+
}, []), a = V((e) => {
|
|
1324
|
+
n.current = e ? "open" : "idle", e || t(null);
|
|
1325
|
+
}, []);
|
|
1326
|
+
return {
|
|
1327
|
+
virtualReference: G(() => {
|
|
1328
|
+
if (e) return { getBoundingClientRect: () => ({
|
|
1329
|
+
width: 0,
|
|
1330
|
+
height: e.height,
|
|
1331
|
+
x: e.x,
|
|
1332
|
+
y: e.y,
|
|
1333
|
+
top: e.top,
|
|
1334
|
+
bottom: e.bottom,
|
|
1335
|
+
left: e.x,
|
|
1336
|
+
right: e.x,
|
|
1337
|
+
toJSON: () => ({})
|
|
1338
|
+
}) };
|
|
1339
|
+
}, [e]),
|
|
1340
|
+
handleMouseMove: r,
|
|
1341
|
+
handleMouseLeave: i,
|
|
1342
|
+
handleTooltipVisibleChange: a
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
//#endregion
|
|
1346
|
+
//#region src/components/Gantt/GanttChart/GanttBarTooltip/GanttBarTooltip.tsx
|
|
1347
|
+
var pt = {
|
|
1348
|
+
borderRadius: "10px",
|
|
1349
|
+
padding: 0,
|
|
1350
|
+
backgroundColor: "#fff",
|
|
1351
|
+
boxShadow: "0 0 12px 0 rgba(0, 0, 0, 0.08)"
|
|
1352
|
+
}, mt = ({ item: e, tooltip: n, disabled: r = !1, children: i }) => {
|
|
1353
|
+
let { virtualReference: a, handleMouseMove: o, handleMouseLeave: s, handleTooltipVisibleChange: c } = ft(), l = G(() => r || !n ? null : n(e), [
|
|
1354
|
+
r,
|
|
1355
|
+
n,
|
|
1356
|
+
e
|
|
1357
|
+
]);
|
|
1358
|
+
return l ? /* @__PURE__ */ I(t, {
|
|
1359
|
+
content: l,
|
|
1360
|
+
placement: "bottom",
|
|
1361
|
+
showArrow: !1,
|
|
1362
|
+
hoverDelay: 300,
|
|
1363
|
+
moveToFloatingKeepOpen: !0,
|
|
1364
|
+
widthMode: "manual",
|
|
1365
|
+
maxWidth: 400,
|
|
1366
|
+
offset: 5,
|
|
1367
|
+
virtualReference: a,
|
|
1368
|
+
onVisibleChange: c,
|
|
1369
|
+
style: pt,
|
|
1370
|
+
children: i({
|
|
1371
|
+
onMouseMove: o,
|
|
1372
|
+
onMouseLeave: s
|
|
1373
|
+
})
|
|
1374
|
+
}) : /* @__PURE__ */ I(F, { children: i({
|
|
1375
|
+
onMouseMove: () => {},
|
|
1376
|
+
onMouseLeave: () => {}
|
|
1377
|
+
}) });
|
|
1378
|
+
}, ht = (e, t, n) => ({
|
|
1379
|
+
...e,
|
|
1380
|
+
clientX: t,
|
|
1381
|
+
clientY: n,
|
|
1382
|
+
preventDefault: () => e.preventDefault(),
|
|
1383
|
+
stopPropagation: () => e.stopPropagation()
|
|
1384
|
+
});
|
|
1385
|
+
function gt({ enabled: e, onTaskMouseDown: t, onBarClick: n }) {
|
|
1386
|
+
let r = K(null), i = K(null), a = K(t), o = K(n);
|
|
1387
|
+
H(() => {
|
|
1388
|
+
a.current = t, o.current = n;
|
|
1389
|
+
}, [t, n]);
|
|
1390
|
+
let s = V(() => {
|
|
1391
|
+
r.current = null;
|
|
1392
|
+
let e = i.current;
|
|
1393
|
+
e && (document.removeEventListener("mousemove", e.move), document.removeEventListener("mouseup", e.up), i.current = null);
|
|
1394
|
+
}, []);
|
|
1395
|
+
return H(() => () => s(), [s]), { handlePointerMouseDown: V((t, n, c) => {
|
|
1396
|
+
if (!e) return;
|
|
1397
|
+
s();
|
|
1398
|
+
let l = {
|
|
1399
|
+
item: n,
|
|
1400
|
+
baseLeft: c,
|
|
1401
|
+
startClientX: t.clientX,
|
|
1402
|
+
startClientY: t.clientY,
|
|
1403
|
+
dragStarted: !1
|
|
1404
|
+
};
|
|
1405
|
+
r.current = l;
|
|
1406
|
+
let u = (e) => {
|
|
1407
|
+
if (r.current !== l || l.dragStarted) return;
|
|
1408
|
+
let t = e.clientX - l.startClientX, i = e.clientY - l.startClientY;
|
|
1409
|
+
Math.hypot(t, i) < 5 || (l.dragStarted = !0, s(), a.current?.(ht(e, l.startClientX, l.startClientY), n, c));
|
|
1410
|
+
}, d = (e) => {
|
|
1411
|
+
r.current === l && (s(), l.dragStarted || o.current?.(e, n));
|
|
1412
|
+
};
|
|
1413
|
+
i.current = {
|
|
1414
|
+
move: u,
|
|
1415
|
+
up: d
|
|
1416
|
+
}, document.addEventListener("mousemove", u), document.addEventListener("mouseup", d);
|
|
1417
|
+
}, [e, s]) };
|
|
1418
|
+
}
|
|
1419
|
+
var _t = R.memo(({ item: t, barTop: n, dragTaskId: r, dragPreview: i, dragPermission: a }) => {
|
|
1420
|
+
let { t: o } = e(), s = at((e) => e.timelineCoords), c = rt((e) => e.tooltip), l = rt((e) => e.isScrolling), u = rt((e) => e.onBarClick), d = rt((e) => e.onTaskMouseDown), f = rt((e) => e.onResizeMouseDown), p = l ? null : c, m = r === t.id, h = m && i ? i.previewStartMs : t.startMs, g = m && i ? i.previewEndMs : t.endMs, _ = G(() => {
|
|
1421
|
+
let e = t.color;
|
|
1422
|
+
return {
|
|
1423
|
+
baseColor: e,
|
|
1424
|
+
containerBgColor: st(e, .2) || e,
|
|
1425
|
+
hoverBorderColor: st(e, .5) || "transparent",
|
|
1426
|
+
insideLabelColor: ct(e)
|
|
1427
|
+
};
|
|
1428
|
+
}, [t.color]), v = G(() => {
|
|
1429
|
+
if (h == null || g == null) return {
|
|
1430
|
+
baseLeft: 0,
|
|
1431
|
+
calculatedBarLeft: 0,
|
|
1432
|
+
calculatedBarWidth: 0
|
|
1433
|
+
};
|
|
1434
|
+
let e = s.toX(h);
|
|
1435
|
+
return {
|
|
1436
|
+
baseLeft: m && t.startMs !== null && t.startMs !== void 0 ? s.toX(t.startMs) : e,
|
|
1437
|
+
calculatedBarLeft: e,
|
|
1438
|
+
calculatedBarWidth: s.toWidth(h, g)
|
|
1439
|
+
};
|
|
1440
|
+
}, [
|
|
1441
|
+
t.startMs,
|
|
1442
|
+
h,
|
|
1443
|
+
g,
|
|
1444
|
+
s,
|
|
1445
|
+
m
|
|
1446
|
+
]), { baseColor: y, containerBgColor: b, hoverBorderColor: x, insideLabelColor: S } = _, { baseLeft: C, calculatedBarLeft: w, calculatedBarWidth: T } = v, E = t.progress === null || Number(t.progress) >= 1, D = E ? "100%" : `${Math.max(0, (t.progress ?? 0) * 100)}%`, O = a || he, k = O.canMove, A = t.label ?? "", j = typeof A == "string" ? A : "", ee = T < 40, te = Math.max(0, T - 10), M = G(() => j ? dt(j) : 0, [j]), ne = !!j && M > te, { handlePointerMouseDown: re } = gt({
|
|
1447
|
+
enabled: k,
|
|
1448
|
+
onTaskMouseDown: d,
|
|
1449
|
+
onBarClick: u
|
|
1450
|
+
}), ie = {
|
|
1451
|
+
left: w,
|
|
1452
|
+
top: n,
|
|
1453
|
+
width: `var(--bsy-gantt-bar-actual-width, ${T}px)`,
|
|
1454
|
+
height: 26,
|
|
1455
|
+
background: b,
|
|
1456
|
+
cursor: k ? "move" : "default",
|
|
1457
|
+
"--bsy-gantt-bar-fill-color": y,
|
|
1458
|
+
"--bsy-gantt-bar-hover-border-color": x,
|
|
1459
|
+
"--bsy-gantt-bar-calc-width": `${T}px`,
|
|
1460
|
+
"--bsy-gantt-bar-label-color": S
|
|
1461
|
+
};
|
|
1462
|
+
return /* @__PURE__ */ I(mt, {
|
|
1463
|
+
item: t,
|
|
1464
|
+
tooltip: p,
|
|
1465
|
+
disabled: m,
|
|
1466
|
+
children: ({ onMouseMove: e, onMouseLeave: n }) => /* @__PURE__ */ L("div", {
|
|
1467
|
+
className: J("bsy-gantt-chart__bar", `bsy-gantt-chart__bar--${t.type || "task"}`, {
|
|
1468
|
+
"bsy-gantt-chart__bar--readonly": !k,
|
|
1469
|
+
"bsy-gantt-chart__bar--dragging": m,
|
|
1470
|
+
"bsy-gantt-chart__bar--micro": ee
|
|
1471
|
+
}),
|
|
1472
|
+
style: ie,
|
|
1473
|
+
onMouseDown: (e) => {
|
|
1474
|
+
k && re(e, t, C);
|
|
1475
|
+
},
|
|
1476
|
+
onClick: (e) => {
|
|
1477
|
+
k || u(e, t);
|
|
1478
|
+
},
|
|
1479
|
+
onMouseMove: e,
|
|
1480
|
+
onMouseLeave: n,
|
|
1481
|
+
children: [
|
|
1482
|
+
t.type === "task" ? /* @__PURE__ */ I("div", {
|
|
1483
|
+
className: J("bsy-gantt-chart__bar-progress", { "bsy-gantt-chart__bar-progress--full": E }),
|
|
1484
|
+
style: { width: D }
|
|
1485
|
+
}) : null,
|
|
1486
|
+
/* @__PURE__ */ I("span", {
|
|
1487
|
+
className: J("bsy-gantt-chart__bar-label", { "bsy-gantt-chart__bar-label--hidden": ne }),
|
|
1488
|
+
style: { color: "var(--bsy-gantt-bar-label-color)" },
|
|
1489
|
+
children: A
|
|
1490
|
+
}),
|
|
1491
|
+
ne ? /* @__PURE__ */ I("span", {
|
|
1492
|
+
className: "bsy-gantt-chart__bar-label bsy-gantt-chart__bar-label--outside",
|
|
1493
|
+
style: { color: "#121211" },
|
|
1494
|
+
children: A
|
|
1495
|
+
}) : null,
|
|
1496
|
+
O.canResizeStart || O.canResizeEnd ? /* @__PURE__ */ L(F, { children: [O.canResizeStart ? /* @__PURE__ */ I("button", {
|
|
1497
|
+
type: "button",
|
|
1498
|
+
className: "bsy-gantt-chart__bar-resize-handle bsy-gantt-chart__bar-resize-handle--left",
|
|
1499
|
+
onMouseDown: (e) => f(e, t, w, "start"),
|
|
1500
|
+
"aria-label": o("gantt.timeBegin")
|
|
1501
|
+
}) : null, O.canResizeEnd ? /* @__PURE__ */ I("button", {
|
|
1502
|
+
type: "button",
|
|
1503
|
+
className: "bsy-gantt-chart__bar-resize-handle bsy-gantt-chart__bar-resize-handle--right",
|
|
1504
|
+
onMouseDown: (e) => f(e, t, w, "end"),
|
|
1505
|
+
"aria-label": o("gantt.timeEnd")
|
|
1506
|
+
}) : null] }) : null
|
|
1507
|
+
]
|
|
1508
|
+
}, `bar-${t.id}`)
|
|
1509
|
+
});
|
|
1510
|
+
}, (e, t) => {
|
|
1511
|
+
if (e.barTop !== t.barTop || e.dragTaskId !== t.dragTaskId || e.dragPermission?.canMove !== t.dragPermission?.canMove || e.dragPermission?.canResizeStart !== t.dragPermission?.canResizeStart || e.dragPermission?.canResizeEnd !== t.dragPermission?.canResizeEnd || e.item !== t.item) return !1;
|
|
1512
|
+
let n = e.dragPreview, r = t.dragPreview;
|
|
1513
|
+
return !(n !== r && (!n || !r || n.previewStartMs !== r.previewStartMs || n.previewEndMs !== r.previewEndMs));
|
|
1514
|
+
}), vt = (e) => String(e).padStart(2, "0");
|
|
1515
|
+
function yt(e, t) {
|
|
1516
|
+
if (e == null) return t("summary.empty");
|
|
1517
|
+
let n = N(e);
|
|
1518
|
+
return t("summary.datetime", {
|
|
1519
|
+
year: n.year(),
|
|
1520
|
+
month: vt(n.month() + 1),
|
|
1521
|
+
day: vt(n.date()),
|
|
1522
|
+
hour: vt(n.hour()),
|
|
1523
|
+
minute: vt(n.minute()),
|
|
1524
|
+
second: vt(n.second())
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
function bt(e, t) {
|
|
1528
|
+
let n = ce(e?.progress), r = n ? Math.max(0, Math.min(1, e.progress ?? 0)) : 0, i = yt(e?.rawStartMs, t), a = yt(e?.rawEndMs, t);
|
|
1529
|
+
return /* @__PURE__ */ L("div", {
|
|
1530
|
+
className: "bsy-gantt-summary-tooltip",
|
|
1531
|
+
children: [
|
|
1532
|
+
/* @__PURE__ */ I("p", {
|
|
1533
|
+
className: "bsy-gantt-summary-tooltip__line",
|
|
1534
|
+
children: t("summary.startTime", { datetime: i })
|
|
1535
|
+
}),
|
|
1536
|
+
/* @__PURE__ */ I("p", {
|
|
1537
|
+
className: "bsy-gantt-summary-tooltip__line",
|
|
1538
|
+
children: t("summary.endTime", { datetime: a })
|
|
1539
|
+
}),
|
|
1540
|
+
n ? /* @__PURE__ */ I("p", {
|
|
1541
|
+
className: "bsy-gantt-summary-tooltip__line",
|
|
1542
|
+
children: t("summary.progress", { percent: Math.round(r * 100) })
|
|
1543
|
+
}) : null
|
|
1544
|
+
]
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1547
|
+
//#endregion
|
|
1548
|
+
//#region src/components/Gantt/GanttChart/GanttSummaryBar/GanttSummaryBar.tsx
|
|
1549
|
+
var xt = 24, St = {
|
|
1550
|
+
borderRadius: "6px",
|
|
1551
|
+
padding: 0,
|
|
1552
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
1553
|
+
boxShadow: "none"
|
|
1554
|
+
};
|
|
1555
|
+
function Ct(e, t) {
|
|
1556
|
+
return e == null || e === "__empty__" ? t : e;
|
|
1557
|
+
}
|
|
1558
|
+
var wt = ({ item: n, barTop: r }) => {
|
|
1559
|
+
let { t: i } = e(), a = V((e, t) => i(P(e), t), [i]), o = at((e) => e.timelineCoords), s = rt((e) => e.collapsedKeys), c = rt((e) => e.onBarClick), { virtualReference: l, handleMouseMove: u, handleMouseLeave: d, handleTooltipVisibleChange: f } = ft(), p = ce(n.progress) ? Math.max(0, Math.min(1, n.progress ?? 0)) : 0, m = G(() => bt({
|
|
1560
|
+
rawStartMs: n.rawStartMs,
|
|
1561
|
+
rawEndMs: n.rawEndMs,
|
|
1562
|
+
progress: n.progress
|
|
1563
|
+
}, a), [
|
|
1564
|
+
n.rawStartMs,
|
|
1565
|
+
n.rawEndMs,
|
|
1566
|
+
n.progress,
|
|
1567
|
+
a
|
|
1568
|
+
]), h = G(() => n.startMs === null || n.endMs === null ? null : {
|
|
1569
|
+
barLeft: o.toX(n.startMs),
|
|
1570
|
+
barWidth: o.toWidth(n.startMs, n.endMs),
|
|
1571
|
+
wrapperTop: r + (26 - xt) / 2
|
|
1572
|
+
}, [
|
|
1573
|
+
n.startMs,
|
|
1574
|
+
n.endMs,
|
|
1575
|
+
o,
|
|
1576
|
+
r
|
|
1577
|
+
]);
|
|
1578
|
+
if (!h) return null;
|
|
1579
|
+
let { barLeft: g, barWidth: _, wrapperTop: v } = h, y = `${p * 100}%`, b = Ct(n.label, i("gantt.emptyGroup")), x = re(s, n.groupKey);
|
|
1580
|
+
return /* @__PURE__ */ I(t, {
|
|
1581
|
+
content: m,
|
|
1582
|
+
placement: "bottom-start",
|
|
1583
|
+
showArrow: !1,
|
|
1584
|
+
hoverDelay: 300,
|
|
1585
|
+
moveToFloatingKeepOpen: !1,
|
|
1586
|
+
widthMode: "content",
|
|
1587
|
+
offset: 5,
|
|
1588
|
+
virtualReference: l,
|
|
1589
|
+
onVisibleChange: f,
|
|
1590
|
+
style: St,
|
|
1591
|
+
children: /* @__PURE__ */ L("div", {
|
|
1592
|
+
className: "bsy-gantt-summary-bar",
|
|
1593
|
+
style: {
|
|
1594
|
+
left: g,
|
|
1595
|
+
top: v,
|
|
1596
|
+
width: _
|
|
1597
|
+
},
|
|
1598
|
+
onClick: (e) => c?.(e, n),
|
|
1599
|
+
onMouseMove: u,
|
|
1600
|
+
onMouseLeave: d,
|
|
1601
|
+
children: [/* @__PURE__ */ L("div", {
|
|
1602
|
+
className: "bsy-gantt-summary-bar__label",
|
|
1603
|
+
children: [/* @__PURE__ */ I("i", { className: `icon-new-bsy-xiangxiazhankai1 bsy-gantt-summary-bar__arrow${x ? " bsy-gantt-summary-bar__arrow--collapsed" : ""}` }), /* @__PURE__ */ I("span", {
|
|
1604
|
+
className: "bsy-gantt-summary-bar__label-text",
|
|
1605
|
+
children: b
|
|
1606
|
+
})]
|
|
1607
|
+
}), /* @__PURE__ */ I("div", {
|
|
1608
|
+
className: "bsy-gantt-summary-bar__track",
|
|
1609
|
+
children: /* @__PURE__ */ I("div", {
|
|
1610
|
+
className: "bsy-gantt-summary-bar__progress",
|
|
1611
|
+
style: { width: y }
|
|
1612
|
+
})
|
|
1613
|
+
})]
|
|
1614
|
+
})
|
|
1615
|
+
});
|
|
1616
|
+
};
|
|
1617
|
+
function Tt(e, t) {
|
|
1618
|
+
return e.barTop === t.barTop && e.item === t.item;
|
|
1619
|
+
}
|
|
1620
|
+
var Et = R.memo(wt, Tt), Dt = R.memo(({ indicators: t = [], onJump: n }) => {
|
|
1621
|
+
let { t: r } = e();
|
|
1622
|
+
if (!Array.isArray(t) || t.length === 0) return null;
|
|
1623
|
+
let i = (e, t) => {
|
|
1624
|
+
e.preventDefault(), e.stopPropagation(), n?.({
|
|
1625
|
+
targetScrollLeft: t.targetScrollLeft,
|
|
1626
|
+
targetStartMs: t.targetStartMs
|
|
1627
|
+
});
|
|
1628
|
+
};
|
|
1629
|
+
return /* @__PURE__ */ I(F, { children: t.map((e) => /* @__PURE__ */ I("div", {
|
|
1630
|
+
className: "bsy-gantt-chart__offscreen-row",
|
|
1631
|
+
style: {
|
|
1632
|
+
top: e.rowTop,
|
|
1633
|
+
height: e.rowHeight
|
|
1634
|
+
},
|
|
1635
|
+
children: /* @__PURE__ */ L("div", {
|
|
1636
|
+
className: "bsy-gantt-chart__offscreen-track",
|
|
1637
|
+
children: [e.showLeft ? /* @__PURE__ */ I("button", {
|
|
1638
|
+
type: "button",
|
|
1639
|
+
className: "bsy-gantt-chart__offscreen-btn bsy-gantt-chart__offscreen-btn--left",
|
|
1640
|
+
"aria-label": r("gantt.aria.jumpLeft"),
|
|
1641
|
+
onClick: (t) => i(t, e),
|
|
1642
|
+
children: /* @__PURE__ */ I("i", { className: "icon-new-bsy-left" })
|
|
1643
|
+
}) : null, e.showRight ? /* @__PURE__ */ I("button", {
|
|
1644
|
+
type: "button",
|
|
1645
|
+
className: "bsy-gantt-chart__offscreen-btn bsy-gantt-chart__offscreen-btn--right",
|
|
1646
|
+
"aria-label": r("gantt.aria.jumpRight"),
|
|
1647
|
+
onClick: (t) => i(t, e),
|
|
1648
|
+
children: /* @__PURE__ */ I("i", { className: "icon-new-bsy-arrow-right" })
|
|
1649
|
+
}) : null]
|
|
1650
|
+
})
|
|
1651
|
+
}, e.rowKey)) });
|
|
1652
|
+
}), Ot = ({ left: e, height: t, className: n = "" }) => /* @__PURE__ */ I("div", {
|
|
1653
|
+
className: J("bsy-gantt-chart__today-indicator", n),
|
|
1654
|
+
style: {
|
|
1655
|
+
left: e,
|
|
1656
|
+
height: t
|
|
1657
|
+
},
|
|
1658
|
+
children: /* @__PURE__ */ I("span", { className: "bsy-gantt-chart__today-indicator-line" })
|
|
1659
|
+
}), kt = B(function({ canvasHeight: e, weekendSegments: t, virtualColumns: n, lowerSegments: r, shouldShowTodayMarker: i, todayLineLeft: a }) {
|
|
1660
|
+
return /* @__PURE__ */ L(F, { children: [
|
|
1661
|
+
t.map((t) => /* @__PURE__ */ I("div", {
|
|
1662
|
+
className: "bsy-gantt-chart__weekend-bg",
|
|
1663
|
+
style: {
|
|
1664
|
+
left: t.left,
|
|
1665
|
+
width: t.width,
|
|
1666
|
+
height: e
|
|
1667
|
+
}
|
|
1668
|
+
}, t.id)),
|
|
1669
|
+
n.map((t) => {
|
|
1670
|
+
let n = r[t.index];
|
|
1671
|
+
return n ? /* @__PURE__ */ I("div", {
|
|
1672
|
+
className: "bsy-gantt-chart__col-line",
|
|
1673
|
+
style: {
|
|
1674
|
+
left: n.left,
|
|
1675
|
+
height: e
|
|
1676
|
+
}
|
|
1677
|
+
}, `line-${n.id}`) : null;
|
|
1678
|
+
}),
|
|
1679
|
+
i ? /* @__PURE__ */ I(Ot, {
|
|
1680
|
+
left: a ?? 0,
|
|
1681
|
+
height: e,
|
|
1682
|
+
className: "bsy-gantt-chart__today-indicator--content-line"
|
|
1683
|
+
}) : null
|
|
1684
|
+
] });
|
|
1685
|
+
}), At = ({ virtualRows: e, normalizedItems: t, dragState: n, dragPermissionById: r }) => {
|
|
1686
|
+
let i = n?.taskId ?? null;
|
|
1687
|
+
return e.map((e) => {
|
|
1688
|
+
let a = t[e.index];
|
|
1689
|
+
if (!a || a.invalid) return null;
|
|
1690
|
+
let o = e.start + (e.size - 26) / 2;
|
|
1691
|
+
return a.type === "summary" ? /* @__PURE__ */ I(Et, {
|
|
1692
|
+
item: a,
|
|
1693
|
+
barTop: o
|
|
1694
|
+
}, `summary-${a.id}`) : /* @__PURE__ */ I(_t, {
|
|
1695
|
+
item: a,
|
|
1696
|
+
barTop: o,
|
|
1697
|
+
dragTaskId: i,
|
|
1698
|
+
dragPreview: i === a.id ? n : null,
|
|
1699
|
+
dragPermission: r[a.id]
|
|
1700
|
+
}, `bar-${a.id}`);
|
|
1701
|
+
});
|
|
1702
|
+
}, jt = B(function({ virtualRows: e, normalizedItems: t, dragState: n, dragPermissionById: r, handleOffscreenJump: i, hoverBgRef: a }) {
|
|
1703
|
+
let o = at((e) => e.scrollLeft), s = at((e) => e.viewportWidth), c = at((e) => e.timelineCoords), l = at((e) => e.timelineWidth), u = at((e) => e.isInitialLayoutReady), d = et({
|
|
1704
|
+
virtualRows: e,
|
|
1705
|
+
normalizedItems: t,
|
|
1706
|
+
scrollLeft: o,
|
|
1707
|
+
viewportWidth: s,
|
|
1708
|
+
timelineCoords: c,
|
|
1709
|
+
timelineWidth: l,
|
|
1710
|
+
enabled: u
|
|
1711
|
+
});
|
|
1712
|
+
return /* @__PURE__ */ L(F, { children: [
|
|
1713
|
+
e.map((e) => /* @__PURE__ */ I("div", {
|
|
1714
|
+
className: "bsy-gantt-chart__row-line",
|
|
1715
|
+
style: {
|
|
1716
|
+
top: e.start,
|
|
1717
|
+
height: e.size
|
|
1718
|
+
}
|
|
1719
|
+
}, `row-line-${e.key}`)),
|
|
1720
|
+
/* @__PURE__ */ I("div", {
|
|
1721
|
+
ref: a,
|
|
1722
|
+
className: "bsy-gantt-chart__row-hover-bg",
|
|
1723
|
+
style: { display: "none" }
|
|
1724
|
+
}),
|
|
1725
|
+
u && At({
|
|
1726
|
+
virtualRows: e,
|
|
1727
|
+
normalizedItems: t,
|
|
1728
|
+
dragState: n,
|
|
1729
|
+
dragPermissionById: r
|
|
1730
|
+
}),
|
|
1731
|
+
u ? /* @__PURE__ */ I(Dt, {
|
|
1732
|
+
indicators: d,
|
|
1733
|
+
onJump: i
|
|
1734
|
+
}) : null
|
|
1735
|
+
] });
|
|
1736
|
+
}), Mt = B(function({ contentRef: e, normalizedItems: t, safeRowHeight: n, viewportHeight: r, lowerSegments: i, virtualColumns: a, weekendSegments: o, dragState: s, dragPermissionById: c, tooltip: l, handleTaskMouseDown: u, handleResizeMouseDown: d, handleBarClick: f, collapsedKeys: p, handleOffscreenJump: m, todayLineLeft: h, shouldShowTodayMarker: g }) {
|
|
1737
|
+
let _ = at((e) => e.timelineWidth), { virtualRows: v, canvasHeight: y, isScrolling: b } = $e({
|
|
1738
|
+
items: t,
|
|
1739
|
+
contentRef: e,
|
|
1740
|
+
safeRowHeight: n,
|
|
1741
|
+
viewportHeight: r
|
|
1742
|
+
}), { hoverBgRef: x, handleContentMouseMove: S, handleContentMouseLeave: C } = tt({
|
|
1743
|
+
normalizedItems: t,
|
|
1744
|
+
safeRowHeight: n
|
|
1745
|
+
}), w = G(() => ({
|
|
1746
|
+
width: _,
|
|
1747
|
+
height: y
|
|
1748
|
+
}), [_, y]), T = G(() => ({
|
|
1749
|
+
tooltip: l ?? null,
|
|
1750
|
+
isScrolling: b,
|
|
1751
|
+
collapsedKeys: p,
|
|
1752
|
+
onBarClick: f,
|
|
1753
|
+
onTaskMouseDown: u,
|
|
1754
|
+
onResizeMouseDown: d
|
|
1755
|
+
}), [
|
|
1756
|
+
l,
|
|
1757
|
+
b,
|
|
1758
|
+
p,
|
|
1759
|
+
f,
|
|
1760
|
+
u,
|
|
1761
|
+
d
|
|
1762
|
+
]);
|
|
1763
|
+
return /* @__PURE__ */ L("div", {
|
|
1764
|
+
className: "bsy-gantt-chart__canvas",
|
|
1765
|
+
style: w,
|
|
1766
|
+
onMouseMove: S,
|
|
1767
|
+
onMouseLeave: C,
|
|
1768
|
+
children: [/* @__PURE__ */ I(kt, {
|
|
1769
|
+
canvasHeight: y,
|
|
1770
|
+
weekendSegments: o,
|
|
1771
|
+
virtualColumns: a,
|
|
1772
|
+
lowerSegments: i,
|
|
1773
|
+
shouldShowTodayMarker: g,
|
|
1774
|
+
todayLineLeft: h
|
|
1775
|
+
}), /* @__PURE__ */ I(nt.Provider, {
|
|
1776
|
+
value: T,
|
|
1777
|
+
children: /* @__PURE__ */ I(jt, {
|
|
1778
|
+
virtualRows: v,
|
|
1779
|
+
normalizedItems: t,
|
|
1780
|
+
dragState: s,
|
|
1781
|
+
dragPermissionById: c,
|
|
1782
|
+
handleOffscreenJump: m,
|
|
1783
|
+
hoverBgRef: x
|
|
1784
|
+
})
|
|
1785
|
+
})]
|
|
1786
|
+
});
|
|
1787
|
+
});
|
|
1788
|
+
//#endregion
|
|
1789
|
+
//#region src/components/Gantt/GanttChart/GanttChart.tsx
|
|
1790
|
+
function Nt({ items: t = [], viewMode: n = "day", availableModes: r, onViewModeChange: i, timeRangeConfig: a = u, pixelsPerDayConfig: o = s, onTaskTimeChange: c, onRowClick: l, tooltip: d, verticalScrollController: f, showWeekendHighlight: p = !0, showTodayLine: m = !0, collapsedKeys: h, onToggleCollapse: g }, _) {
|
|
1791
|
+
let { t: v } = e(), y = V((e, t) => v(P(e), t), [v]), b = K(null), x = K(null), S = K(null), C = X(x), w = K(null);
|
|
1792
|
+
Xe(b, x);
|
|
1793
|
+
let { pixelsPerDay: T, viewportWidth: E, scrollLeft: D, timelineStartMs: O, lowerSegments: k, timelineCoords: A, timelineWidth: j, todayCenterMs: ee, todayLineLeft: te, isInitialLayoutReady: M, handleContentScroll: ne, handleTodayClick: re, handleOffscreenJump: ie, handleScrollPrev: ae, handleScrollNext: N } = Je({
|
|
1794
|
+
timeRangeConfig: a,
|
|
1795
|
+
pixelsPerDayConfig: o,
|
|
1796
|
+
viewMode: n,
|
|
1797
|
+
contentRef: x,
|
|
1798
|
+
contentSize: C,
|
|
1799
|
+
headerTrackRef: S,
|
|
1800
|
+
formatMessage: y
|
|
1801
|
+
});
|
|
1802
|
+
U(_, () => ({
|
|
1803
|
+
scrollToToday: re,
|
|
1804
|
+
scrollPrev: ae,
|
|
1805
|
+
scrollNext: N
|
|
1806
|
+
}), [
|
|
1807
|
+
re,
|
|
1808
|
+
ae,
|
|
1809
|
+
N
|
|
1810
|
+
]);
|
|
1811
|
+
let { dragState: oe, committedRangeById: se, resetCommittedRanges: ce, forceResetAllCommittedRanges: le, handleTaskMouseDown: F, handleResizeMouseDown: R, consumeRecentDragResult: z } = De({
|
|
1812
|
+
pixelsPerDay: T,
|
|
1813
|
+
viewMode: n,
|
|
1814
|
+
timelineCoords: A,
|
|
1815
|
+
onTaskTimeChange: c,
|
|
1816
|
+
containerRef: x
|
|
1817
|
+
});
|
|
1818
|
+
H(() => {
|
|
1819
|
+
let e = new Set((t || []).map((e) => String(e?.id ?? ""))), n = w.current, r = !1;
|
|
1820
|
+
if (n) {
|
|
1821
|
+
if (n.size !== e.size) r = !0;
|
|
1822
|
+
else for (let t of n) if (!e.has(t)) {
|
|
1823
|
+
r = !0;
|
|
1824
|
+
break;
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
if (w.current = e, r) {
|
|
1828
|
+
le();
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
ce();
|
|
1832
|
+
}, [
|
|
1833
|
+
t,
|
|
1834
|
+
ce,
|
|
1835
|
+
le
|
|
1836
|
+
]);
|
|
1837
|
+
let { normalizedItems: B } = Ye({
|
|
1838
|
+
visibleItems: t,
|
|
1839
|
+
committedRangeById: se,
|
|
1840
|
+
viewMode: n
|
|
1841
|
+
}), W = G(() => {
|
|
1842
|
+
let e = {};
|
|
1843
|
+
return B.forEach((t) => {
|
|
1844
|
+
e[t.id] = ge(t);
|
|
1845
|
+
}), e;
|
|
1846
|
+
}, [B]), q = V((e, t, n) => {
|
|
1847
|
+
let r = W[t.id];
|
|
1848
|
+
r?.canMove && F(e, {
|
|
1849
|
+
...t,
|
|
1850
|
+
dragPermission: r
|
|
1851
|
+
}, n);
|
|
1852
|
+
}, [W, F]), J = V((e, t, n, r) => {
|
|
1853
|
+
let i = W[t.id];
|
|
1854
|
+
(r === "start" ? i?.canResizeStart : i?.canResizeEnd) && R(e, {
|
|
1855
|
+
...t,
|
|
1856
|
+
dragPermission: i
|
|
1857
|
+
}, n, r);
|
|
1858
|
+
}, [W, R]);
|
|
1859
|
+
H(() => {
|
|
1860
|
+
if (!f || !x.current) return;
|
|
1861
|
+
let e = x.current;
|
|
1862
|
+
return f.registerTimelineScroller({ setScrollTop: (t) => {
|
|
1863
|
+
e.scrollTop = t;
|
|
1864
|
+
} });
|
|
1865
|
+
}, [f]);
|
|
1866
|
+
let Y = C?.height || 0, { virtualColumns: Z, weekendSegments: Q } = Fe({
|
|
1867
|
+
lowerSegments: k,
|
|
1868
|
+
pixelsPerDay: T,
|
|
1869
|
+
scrollLeft: D,
|
|
1870
|
+
viewportWidth: E,
|
|
1871
|
+
showWeekendHighlight: p,
|
|
1872
|
+
timelineStartMs: O,
|
|
1873
|
+
timelineWidth: j,
|
|
1874
|
+
viewMode: n
|
|
1875
|
+
}), $ = Ze(m, te, j), ue = V((e, t) => {
|
|
1876
|
+
if (!(e.target instanceof Element && e.target.closest(".bsy-gantt-chart__bar-resize-handle")) && !z()) {
|
|
1877
|
+
if (t?.type === "summary") {
|
|
1878
|
+
let e = t.groupKey;
|
|
1879
|
+
if (!e || !g) return;
|
|
1880
|
+
g(String(e));
|
|
1881
|
+
return;
|
|
1882
|
+
}
|
|
1883
|
+
l && l(t, t.rowIndex, e);
|
|
1884
|
+
}
|
|
1885
|
+
}, [
|
|
1886
|
+
z,
|
|
1887
|
+
l,
|
|
1888
|
+
g
|
|
1889
|
+
]), de = G(() => ({
|
|
1890
|
+
pixelsPerDay: T,
|
|
1891
|
+
timelineStartMs: O,
|
|
1892
|
+
timelineCoords: A,
|
|
1893
|
+
scrollLeft: D,
|
|
1894
|
+
viewportWidth: E,
|
|
1895
|
+
timelineWidth: j,
|
|
1896
|
+
isInitialLayoutReady: M
|
|
1897
|
+
}), [
|
|
1898
|
+
T,
|
|
1899
|
+
O,
|
|
1900
|
+
A,
|
|
1901
|
+
D,
|
|
1902
|
+
E,
|
|
1903
|
+
j,
|
|
1904
|
+
M
|
|
1905
|
+
]);
|
|
1906
|
+
return /* @__PURE__ */ I(it.Provider, {
|
|
1907
|
+
value: de,
|
|
1908
|
+
children: /* @__PURE__ */ L("div", {
|
|
1909
|
+
className: "bsy-gantt-chart",
|
|
1910
|
+
style: { visibility: M ? "visible" : "hidden" },
|
|
1911
|
+
children: [/* @__PURE__ */ I(Qe, {
|
|
1912
|
+
timelineWidth: j,
|
|
1913
|
+
viewportWidth: E,
|
|
1914
|
+
scrollLeft: D,
|
|
1915
|
+
trackRef: S,
|
|
1916
|
+
virtualColumns: Z,
|
|
1917
|
+
lowerSegments: k,
|
|
1918
|
+
todayLineLeft: te,
|
|
1919
|
+
todayCenterMs: ee,
|
|
1920
|
+
showTodayLine: m,
|
|
1921
|
+
viewMode: n,
|
|
1922
|
+
availableModes: r,
|
|
1923
|
+
formatMessage: y,
|
|
1924
|
+
onViewModeChange: i,
|
|
1925
|
+
onTodayClick: re,
|
|
1926
|
+
onScrollPrev: ae,
|
|
1927
|
+
onScrollNext: N
|
|
1928
|
+
}), /* @__PURE__ */ I("div", {
|
|
1929
|
+
ref: b,
|
|
1930
|
+
className: "bsy-gantt-chart__timeline-host",
|
|
1931
|
+
children: /* @__PURE__ */ I("div", {
|
|
1932
|
+
ref: x,
|
|
1933
|
+
className: "bsy-gantt-chart__timeline-content",
|
|
1934
|
+
role: "region",
|
|
1935
|
+
"aria-label": v("gantt.aria.timeline"),
|
|
1936
|
+
onScroll: (e) => {
|
|
1937
|
+
ne(e), f && f.sync("timeline", e.currentTarget.scrollTop);
|
|
1938
|
+
},
|
|
1939
|
+
children: /* @__PURE__ */ I(Mt, {
|
|
1940
|
+
contentRef: x,
|
|
1941
|
+
normalizedItems: B,
|
|
1942
|
+
safeRowHeight: 34,
|
|
1943
|
+
viewportHeight: Y,
|
|
1944
|
+
lowerSegments: k,
|
|
1945
|
+
virtualColumns: Z,
|
|
1946
|
+
weekendSegments: Q,
|
|
1947
|
+
dragState: oe,
|
|
1948
|
+
dragPermissionById: W,
|
|
1949
|
+
tooltip: d,
|
|
1950
|
+
handleTaskMouseDown: q,
|
|
1951
|
+
handleResizeMouseDown: J,
|
|
1952
|
+
handleBarClick: ue,
|
|
1953
|
+
collapsedKeys: h,
|
|
1954
|
+
handleOffscreenJump: ie,
|
|
1955
|
+
todayLineLeft: te,
|
|
1956
|
+
shouldShowTodayMarker: $
|
|
1957
|
+
})
|
|
1958
|
+
})
|
|
1959
|
+
})]
|
|
1960
|
+
})
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
var Pt = z(Nt);
|
|
1964
|
+
//#endregion
|
|
1965
|
+
export { Pt as t };
|