gantt-lib 0.18.0 → 0.20.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/index.css.map +1 -1
- package/dist/index.d.mts +230 -139
- package/dist/index.d.ts +230 -139
- package/dist/index.js +96 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +94 -30
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +15 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,205 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
2
|
import * as RadixPopover from '@radix-ui/react-popover';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Parse date string as UTC to prevent DST issues
|
|
6
|
+
* @param date - Date string or Date object
|
|
7
|
+
* @returns Date object representing UTC midnight
|
|
8
|
+
* @throws Error if date string is invalid
|
|
9
|
+
*/
|
|
10
|
+
declare const parseUTCDate: (date: string | Date) => Date;
|
|
11
|
+
/**
|
|
12
|
+
* Get all days in the month of given date (UTC)
|
|
13
|
+
* @param date - Reference date (any day in the target month)
|
|
14
|
+
* @returns Array of Date objects for each day in the month
|
|
15
|
+
*/
|
|
16
|
+
declare const getMonthDays: (date: Date | string) => Date[];
|
|
17
|
+
/**
|
|
18
|
+
* Calculate day offset from month start (0-based)
|
|
19
|
+
* @param date - The date to calculate offset for
|
|
20
|
+
* @param monthStart - The start of the month as reference
|
|
21
|
+
* @returns Number of days from month start (negative if date is before month start)
|
|
22
|
+
*/
|
|
23
|
+
declare const getDayOffset: (date: Date, monthStart: Date) => number;
|
|
24
|
+
/**
|
|
25
|
+
* Check if date is today (local timezone comparison)
|
|
26
|
+
* Uses local time to determine today's date boundary so the result matches
|
|
27
|
+
* the user's timezone rather than UTC (prevents off-by-one errors at midnight).
|
|
28
|
+
* @param date - Date to check
|
|
29
|
+
* @returns True if date is today, false otherwise
|
|
30
|
+
*/
|
|
31
|
+
declare const isToday: (date: Date) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Check if date is a weekend day (Saturday or Sunday)
|
|
34
|
+
* @param date - Date to check
|
|
35
|
+
* @returns True if date is Saturday (6) or Sunday (0), false otherwise
|
|
36
|
+
*/
|
|
37
|
+
declare const isWeekend: (date: Date) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Create a UTC-safe key for Set-based date lookup
|
|
40
|
+
* @param date - Date object to create key from
|
|
41
|
+
* @returns String key in "YYYY-M-D" format using UTC date components
|
|
42
|
+
*
|
|
43
|
+
* Example:
|
|
44
|
+
* createDateKey(new Date(Date.UTC(2026, 2, 15))) // "2026-2-15"
|
|
45
|
+
*
|
|
46
|
+
* Note: Uses UTC methods to prevent DST and timezone issues.
|
|
47
|
+
* Month is 0-indexed (0=January, 11=December) per JavaScript Date convention.
|
|
48
|
+
*/
|
|
49
|
+
declare const createDateKey: (date: Date) => string;
|
|
50
|
+
/**
|
|
51
|
+
* Configuration for a single custom day
|
|
52
|
+
*/
|
|
53
|
+
interface CustomDayConfig {
|
|
54
|
+
/** The date to customize */
|
|
55
|
+
date: Date;
|
|
56
|
+
/** Type of day: 'weekend' marks as weekend, 'workday' marks as workday */
|
|
57
|
+
type: 'weekend' | 'workday';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Configuration for custom day predicate
|
|
61
|
+
*/
|
|
62
|
+
interface CustomDayPredicateConfig {
|
|
63
|
+
/** Array of custom day configurations with explicit types */
|
|
64
|
+
customDays?: CustomDayConfig[];
|
|
65
|
+
/** Optional base weekend predicate (checked before customDays overrides) */
|
|
66
|
+
isWeekend?: (date: Date) => boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Create a weekend predicate with unified custom day support
|
|
70
|
+
*
|
|
71
|
+
* Precedence order (highest to lowest):
|
|
72
|
+
* 1. customDays.type='workday' - explicit workday (highest override)
|
|
73
|
+
* 2. customDays.type='weekend' - explicit weekend (override)
|
|
74
|
+
* 3. isWeekend (base predicate) - custom base logic
|
|
75
|
+
* 4. default - Saturday (6) and Sunday (0)
|
|
76
|
+
*
|
|
77
|
+
* @param config - Custom day configuration with array and optional predicate
|
|
78
|
+
* @returns Predicate function (date: Date) => boolean
|
|
79
|
+
*
|
|
80
|
+
* Example:
|
|
81
|
+
* // Simple holidays + working Saturdays
|
|
82
|
+
* const predicate = createCustomDayPredicate({
|
|
83
|
+
* customDays: [
|
|
84
|
+
* { date: new Date(Date.UTC(2026, 2, 15)), type: 'workday' }, // working Saturday
|
|
85
|
+
* { date: new Date(Date.UTC(2026, 0, 1)), type: 'weekend' } // holiday Tuesday
|
|
86
|
+
* ]
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* // 4-day work week + occasional overrides
|
|
90
|
+
* const predicate2 = createCustomDayPredicate({
|
|
91
|
+
* isWeekend: (date) => {
|
|
92
|
+
* const day = date.getUTCDay();
|
|
93
|
+
* return day === 0 || day === 6 || day === 5; // Sun+Sat+Fri
|
|
94
|
+
* },
|
|
95
|
+
* customDays: [
|
|
96
|
+
* { date: new Date(Date.UTC(2026, 2, 10)), type: 'workday' } // working Friday
|
|
97
|
+
* ]
|
|
98
|
+
* });
|
|
99
|
+
*/
|
|
100
|
+
declare const createCustomDayPredicate: (config: CustomDayPredicateConfig) => ((date: Date) => boolean);
|
|
101
|
+
/**
|
|
102
|
+
* Calculate multi-month date range from task dates
|
|
103
|
+
* Expands range to include full months with padding on both ends for drag flexibility
|
|
104
|
+
* Adds 1 month before and 2 months after the task range
|
|
105
|
+
* @param tasks - Array of tasks with startDate and endDate
|
|
106
|
+
* @returns Array of Date objects for all days in the expanded range
|
|
107
|
+
*/
|
|
108
|
+
declare const getMultiMonthDays: (tasks: Array<{
|
|
109
|
+
startDate: string | Date;
|
|
110
|
+
endDate: string | Date;
|
|
111
|
+
}>) => Date[];
|
|
112
|
+
/**
|
|
113
|
+
* Calculate month spans within a date range
|
|
114
|
+
* @param dateRange - Array of Date objects representing the full range
|
|
115
|
+
* @returns Array of month span objects with month, days count, and start index
|
|
116
|
+
*/
|
|
117
|
+
declare const getMonthSpans: (dateRange: Date[]) => Array<{
|
|
118
|
+
month: Date;
|
|
119
|
+
days: number;
|
|
120
|
+
startIndex: number;
|
|
121
|
+
}>;
|
|
122
|
+
/**
|
|
123
|
+
* Format date as DD.MM (e.g., 25.03 for March 25th)
|
|
124
|
+
* @param date - Date to format
|
|
125
|
+
* @returns Formatted date string in DD.MM format
|
|
126
|
+
*/
|
|
127
|
+
declare const formatDateLabel: (date: Date | string) => string;
|
|
128
|
+
/**
|
|
129
|
+
* Return block boundaries for week-view, splitting on month boundaries.
|
|
130
|
+
* Each block represents a column in the week-view header.
|
|
131
|
+
* Blocks are typically 7 days, but split on month boundaries so
|
|
132
|
+
* the first/last block of a month may be smaller.
|
|
133
|
+
*
|
|
134
|
+
* @param days - Array of dates from getMultiMonthDays
|
|
135
|
+
* @returns Array of start dates for each block, with actual block sizes
|
|
136
|
+
*/
|
|
137
|
+
interface WeekBlock {
|
|
138
|
+
/** Start date of this block */
|
|
139
|
+
startDate: Date;
|
|
140
|
+
/** Number of days in this block (≤7, splits on month boundaries) */
|
|
141
|
+
days: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Split the date range into blocks, primarily 7-day weeks,
|
|
145
|
+
* but splitting blocks on month boundaries for accurate month spans.
|
|
146
|
+
*/
|
|
147
|
+
declare const getWeekBlocks: (days: Date[]) => WeekBlock[];
|
|
148
|
+
/**
|
|
149
|
+
* Represents a month span in week-view header row 1.
|
|
150
|
+
* In week-view, the width is calculated from actual day counts,
|
|
151
|
+
* not from a fixed column count.
|
|
152
|
+
*/
|
|
153
|
+
interface WeekSpan {
|
|
154
|
+
/** First day of the calendar month (UTC) */
|
|
155
|
+
month: Date;
|
|
156
|
+
/** Total number of days this month occupies across all blocks */
|
|
157
|
+
days: number;
|
|
158
|
+
/** Start index in the blocks array */
|
|
159
|
+
startIndex: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Calculate month spans based on week-block boundaries.
|
|
163
|
+
* Groups consecutive blocks that belong to the same month.
|
|
164
|
+
*/
|
|
165
|
+
declare const getWeekSpans: (days: Date[]) => WeekSpan[];
|
|
166
|
+
interface MonthBlock {
|
|
167
|
+
/** Первый день месяца (UTC) */
|
|
168
|
+
startDate: Date;
|
|
169
|
+
/** Количество дней в этом месяце внутри dateRange (может быть меньше при обрезке) */
|
|
170
|
+
days: number;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Разбивает dateRange на блоки по месяцам.
|
|
174
|
+
* Каждый блок = один месяц (колонка в строке 2 month-view шапки).
|
|
175
|
+
* Блок на краях может быть неполным если dateRange начинается/заканчивается не с 1-го числа.
|
|
176
|
+
*/
|
|
177
|
+
declare const getMonthBlocks: (days: Date[]) => MonthBlock[];
|
|
178
|
+
interface YearSpan {
|
|
179
|
+
/** 1 января года (UTC) */
|
|
180
|
+
year: Date;
|
|
181
|
+
/** Суммарное кол-во дней этого года внутри dateRange */
|
|
182
|
+
days: number;
|
|
183
|
+
/** Начальный индекс в массиве monthBlocks */
|
|
184
|
+
startIndex: number;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Группирует month-блоки по годам.
|
|
188
|
+
* Используется в строке 1 month-view шапки (year label).
|
|
189
|
+
*/
|
|
190
|
+
declare const getYearSpans: (days: Date[]) => YearSpan[];
|
|
191
|
+
/**
|
|
192
|
+
* Normalize task dates to ensure startDate is always before or equal to endDate.
|
|
193
|
+
* If dates are swapped (endDate < startDate), they are automatically swapped.
|
|
194
|
+
* @param startDate - Task start date (string or Date)
|
|
195
|
+
* @param endDate - Task end date (string or Date)
|
|
196
|
+
* @returns Object with normalized startDate and endDate as ISO date strings (YYYY-MM-DD)
|
|
197
|
+
*/
|
|
198
|
+
declare const normalizeTaskDates: (startDate: string | Date, endDate: string | Date) => {
|
|
199
|
+
startDate: string;
|
|
200
|
+
endDate: string;
|
|
201
|
+
};
|
|
202
|
+
|
|
4
203
|
/**
|
|
5
204
|
* Dependency link types following PM standard
|
|
6
205
|
* - FS (Finish-to-Start): Predecessor must finish before successor starts
|
|
@@ -252,6 +451,10 @@ interface GanttChartProps {
|
|
|
252
451
|
enableAddTask?: boolean;
|
|
253
452
|
/** View mode: 'day' renders one column per day, 'week' renders one column per 7 days, 'month' renders one column per month (default: 'day') */
|
|
254
453
|
viewMode?: 'day' | 'week' | 'month';
|
|
454
|
+
/** Custom day configurations with explicit type (weekend or workday) */
|
|
455
|
+
customDays?: CustomDayConfig[];
|
|
456
|
+
/** Optional base weekend predicate (checked before customDays overrides) */
|
|
457
|
+
isWeekend?: (date: Date) => boolean;
|
|
255
458
|
}
|
|
256
459
|
/**
|
|
257
460
|
* Ref handle type for GanttChart — exposes imperative scroll methods.
|
|
@@ -348,6 +551,8 @@ interface TimeScaleHeaderProps {
|
|
|
348
551
|
headerHeight: number;
|
|
349
552
|
/** View mode: 'day' renders individual day columns, 'week' renders 7-day week columns, 'month' renders one column per month */
|
|
350
553
|
viewMode?: 'day' | 'week' | 'month';
|
|
554
|
+
/** Optional predicate for custom weekend logic (e.g., holidays, shift patterns) */
|
|
555
|
+
isCustomWeekend?: (date: Date) => boolean;
|
|
351
556
|
}
|
|
352
557
|
/**
|
|
353
558
|
* TimeScaleHeader component - displays two-row date headers for the Gantt chart
|
|
@@ -370,6 +575,8 @@ interface GridBackgroundProps {
|
|
|
370
575
|
totalHeight: number;
|
|
371
576
|
/** View mode: 'day' renders per-day lines with weekend blocks, 'week' renders per-week lines only, 'month' renders per-month lines only */
|
|
372
577
|
viewMode?: 'day' | 'week' | 'month';
|
|
578
|
+
/** Optional predicate for custom weekend logic (e.g., holidays, shift patterns) */
|
|
579
|
+
isCustomWeekend?: (date: Date) => boolean;
|
|
373
580
|
}
|
|
374
581
|
/**
|
|
375
582
|
* GridBackground component - renders vertical grid lines and weekend background highlighting
|
|
@@ -463,6 +670,10 @@ interface TaskListProps {
|
|
|
463
670
|
onPromoteTask?: (taskId: string) => void;
|
|
464
671
|
/** Callback when task is demoted (parentId set to previous task) */
|
|
465
672
|
onDemoteTask?: (taskId: string, newParentId: string) => void;
|
|
673
|
+
/** Custom day configurations for date picker */
|
|
674
|
+
customDays?: CustomDayConfig[];
|
|
675
|
+
/** Optional base weekend predicate for date picker */
|
|
676
|
+
isWeekend?: (date: Date) => boolean;
|
|
466
677
|
}
|
|
467
678
|
/**
|
|
468
679
|
* TaskList component - displays tasks in a table format as an overlay
|
|
@@ -537,6 +748,8 @@ interface CalendarProps {
|
|
|
537
748
|
initialDate?: Date;
|
|
538
749
|
mode?: 'single' | 'range';
|
|
539
750
|
disabled?: boolean;
|
|
751
|
+
/** Optional predicate for custom weekend logic (e.g., holidays, shift patterns) */
|
|
752
|
+
isWeekend?: (date: Date) => boolean;
|
|
540
753
|
}
|
|
541
754
|
declare const Calendar: React$1.FC<CalendarProps>;
|
|
542
755
|
|
|
@@ -555,6 +768,8 @@ interface DatePickerProps {
|
|
|
555
768
|
className?: string;
|
|
556
769
|
/** Whether the picker is disabled */
|
|
557
770
|
disabled?: boolean;
|
|
771
|
+
/** Optional predicate for custom weekend logic */
|
|
772
|
+
isWeekend?: (date: Date) => boolean;
|
|
558
773
|
}
|
|
559
774
|
/**
|
|
560
775
|
* DatePicker component — shows formatted date as a button, opens calendar popup on click.
|
|
@@ -638,142 +853,6 @@ interface UseTaskDragReturn {
|
|
|
638
853
|
*/
|
|
639
854
|
declare const useTaskDrag: (options: UseTaskDragOptions) => UseTaskDragReturn;
|
|
640
855
|
|
|
641
|
-
/**
|
|
642
|
-
* Parse date string as UTC to prevent DST issues
|
|
643
|
-
* @param date - Date string or Date object
|
|
644
|
-
* @returns Date object representing UTC midnight
|
|
645
|
-
* @throws Error if date string is invalid
|
|
646
|
-
*/
|
|
647
|
-
declare const parseUTCDate: (date: string | Date) => Date;
|
|
648
|
-
/**
|
|
649
|
-
* Get all days in the month of given date (UTC)
|
|
650
|
-
* @param date - Reference date (any day in the target month)
|
|
651
|
-
* @returns Array of Date objects for each day in the month
|
|
652
|
-
*/
|
|
653
|
-
declare const getMonthDays: (date: Date | string) => Date[];
|
|
654
|
-
/**
|
|
655
|
-
* Calculate day offset from month start (0-based)
|
|
656
|
-
* @param date - The date to calculate offset for
|
|
657
|
-
* @param monthStart - The start of the month as reference
|
|
658
|
-
* @returns Number of days from month start (negative if date is before month start)
|
|
659
|
-
*/
|
|
660
|
-
declare const getDayOffset: (date: Date, monthStart: Date) => number;
|
|
661
|
-
/**
|
|
662
|
-
* Check if date is today (local timezone comparison)
|
|
663
|
-
* Uses local time to determine today's date boundary so the result matches
|
|
664
|
-
* the user's timezone rather than UTC (prevents off-by-one errors at midnight).
|
|
665
|
-
* @param date - Date to check
|
|
666
|
-
* @returns True if date is today, false otherwise
|
|
667
|
-
*/
|
|
668
|
-
declare const isToday: (date: Date) => boolean;
|
|
669
|
-
/**
|
|
670
|
-
* Check if date is a weekend day (Saturday or Sunday)
|
|
671
|
-
* @param date - Date to check
|
|
672
|
-
* @returns True if date is Saturday (6) or Sunday (0), false otherwise
|
|
673
|
-
*/
|
|
674
|
-
declare const isWeekend: (date: Date) => boolean;
|
|
675
|
-
/**
|
|
676
|
-
* Calculate multi-month date range from task dates
|
|
677
|
-
* Expands range to include full months with padding on both ends for drag flexibility
|
|
678
|
-
* Adds 1 month before and 2 months after the task range
|
|
679
|
-
* @param tasks - Array of tasks with startDate and endDate
|
|
680
|
-
* @returns Array of Date objects for all days in the expanded range
|
|
681
|
-
*/
|
|
682
|
-
declare const getMultiMonthDays: (tasks: Array<{
|
|
683
|
-
startDate: string | Date;
|
|
684
|
-
endDate: string | Date;
|
|
685
|
-
}>) => Date[];
|
|
686
|
-
/**
|
|
687
|
-
* Calculate month spans within a date range
|
|
688
|
-
* @param dateRange - Array of Date objects representing the full range
|
|
689
|
-
* @returns Array of month span objects with month, days count, and start index
|
|
690
|
-
*/
|
|
691
|
-
declare const getMonthSpans: (dateRange: Date[]) => Array<{
|
|
692
|
-
month: Date;
|
|
693
|
-
days: number;
|
|
694
|
-
startIndex: number;
|
|
695
|
-
}>;
|
|
696
|
-
/**
|
|
697
|
-
* Format date as DD.MM (e.g., 25.03 for March 25th)
|
|
698
|
-
* @param date - Date to format
|
|
699
|
-
* @returns Formatted date string in DD.MM format
|
|
700
|
-
*/
|
|
701
|
-
declare const formatDateLabel: (date: Date | string) => string;
|
|
702
|
-
/**
|
|
703
|
-
* Return block boundaries for week-view, splitting on month boundaries.
|
|
704
|
-
* Each block represents a column in the week-view header.
|
|
705
|
-
* Blocks are typically 7 days, but split on month boundaries so
|
|
706
|
-
* the first/last block of a month may be smaller.
|
|
707
|
-
*
|
|
708
|
-
* @param days - Array of dates from getMultiMonthDays
|
|
709
|
-
* @returns Array of start dates for each block, with actual block sizes
|
|
710
|
-
*/
|
|
711
|
-
interface WeekBlock {
|
|
712
|
-
/** Start date of this block */
|
|
713
|
-
startDate: Date;
|
|
714
|
-
/** Number of days in this block (≤7, splits on month boundaries) */
|
|
715
|
-
days: number;
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Split the date range into blocks, primarily 7-day weeks,
|
|
719
|
-
* but splitting blocks on month boundaries for accurate month spans.
|
|
720
|
-
*/
|
|
721
|
-
declare const getWeekBlocks: (days: Date[]) => WeekBlock[];
|
|
722
|
-
/**
|
|
723
|
-
* Represents a month span in week-view header row 1.
|
|
724
|
-
* In week-view, the width is calculated from actual day counts,
|
|
725
|
-
* not from a fixed column count.
|
|
726
|
-
*/
|
|
727
|
-
interface WeekSpan {
|
|
728
|
-
/** First day of the calendar month (UTC) */
|
|
729
|
-
month: Date;
|
|
730
|
-
/** Total number of days this month occupies across all blocks */
|
|
731
|
-
days: number;
|
|
732
|
-
/** Start index in the blocks array */
|
|
733
|
-
startIndex: number;
|
|
734
|
-
}
|
|
735
|
-
/**
|
|
736
|
-
* Calculate month spans based on week-block boundaries.
|
|
737
|
-
* Groups consecutive blocks that belong to the same month.
|
|
738
|
-
*/
|
|
739
|
-
declare const getWeekSpans: (days: Date[]) => WeekSpan[];
|
|
740
|
-
interface MonthBlock {
|
|
741
|
-
/** Первый день месяца (UTC) */
|
|
742
|
-
startDate: Date;
|
|
743
|
-
/** Количество дней в этом месяце внутри dateRange (может быть меньше при обрезке) */
|
|
744
|
-
days: number;
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* Разбивает dateRange на блоки по месяцам.
|
|
748
|
-
* Каждый блок = один месяц (колонка в строке 2 month-view шапки).
|
|
749
|
-
* Блок на краях может быть неполным если dateRange начинается/заканчивается не с 1-го числа.
|
|
750
|
-
*/
|
|
751
|
-
declare const getMonthBlocks: (days: Date[]) => MonthBlock[];
|
|
752
|
-
interface YearSpan {
|
|
753
|
-
/** 1 января года (UTC) */
|
|
754
|
-
year: Date;
|
|
755
|
-
/** Суммарное кол-во дней этого года внутри dateRange */
|
|
756
|
-
days: number;
|
|
757
|
-
/** Начальный индекс в массиве monthBlocks */
|
|
758
|
-
startIndex: number;
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* Группирует month-блоки по годам.
|
|
762
|
-
* Используется в строке 1 month-view шапки (year label).
|
|
763
|
-
*/
|
|
764
|
-
declare const getYearSpans: (days: Date[]) => YearSpan[];
|
|
765
|
-
/**
|
|
766
|
-
* Normalize task dates to ensure startDate is always before or equal to endDate.
|
|
767
|
-
* If dates are swapped (endDate < startDate), they are automatically swapped.
|
|
768
|
-
* @param startDate - Task start date (string or Date)
|
|
769
|
-
* @param endDate - Task end date (string or Date)
|
|
770
|
-
* @returns Object with normalized startDate and endDate as ISO date strings (YYYY-MM-DD)
|
|
771
|
-
*/
|
|
772
|
-
declare const normalizeTaskDates: (startDate: string | Date, endDate: string | Date) => {
|
|
773
|
-
startDate: string;
|
|
774
|
-
endDate: string;
|
|
775
|
-
};
|
|
776
|
-
|
|
777
856
|
/**
|
|
778
857
|
* Build adjacency list for dependency graph (task -> successors)
|
|
779
858
|
*/
|
|
@@ -993,9 +1072,21 @@ declare const calculateGridLines: (dateRange: Date[], dayWidth: number) => Array
|
|
|
993
1072
|
* Calculate weekend background blocks for a date range
|
|
994
1073
|
* @param dateRange - Array of Date objects representing the visible range
|
|
995
1074
|
* @param dayWidth - Width of each day column in pixels
|
|
1075
|
+
* @param isCustomWeekend - Optional predicate for custom weekend logic (e.g., holidays, shift patterns)
|
|
996
1076
|
* @returns Array of weekend block objects with left position and width
|
|
997
|
-
|
|
998
|
-
|
|
1077
|
+
*
|
|
1078
|
+
* Example:
|
|
1079
|
+
* // Default behavior (Saturday/Sunday)
|
|
1080
|
+
* calculateWeekendBlocks(dateRange, dayWidth)
|
|
1081
|
+
*
|
|
1082
|
+
* // Custom weekends (holidays, shifted workdays)
|
|
1083
|
+
* const isCustomWeekend = createIsWeekendPredicate({
|
|
1084
|
+
* weekends: [new Date(Date.UTC(2026, 2, 8))], // March 8 holiday
|
|
1085
|
+
* workdays: [new Date(Date.UTC(2026, 2, 15))] // March 15 workday
|
|
1086
|
+
* });
|
|
1087
|
+
* calculateWeekendBlocks(dateRange, dayWidth, isCustomWeekend)
|
|
1088
|
+
*/
|
|
1089
|
+
declare const calculateWeekendBlocks: (dateRange: Date[], dayWidth: number, isCustomWeekend?: (date: Date) => boolean) => Array<{
|
|
999
1090
|
left: number;
|
|
1000
1091
|
width: number;
|
|
1001
1092
|
}>;
|
|
@@ -1107,4 +1198,4 @@ interface VisibleReorderPosition {
|
|
|
1107
1198
|
*/
|
|
1108
1199
|
declare function getVisibleReorderPosition(orderedTasks: TaskLike[], visibleTasks: TaskLike[], movedTaskId: string, originVisibleIndex: number, dropVisibleIndex: number): VisibleReorderPosition | null;
|
|
1109
1200
|
|
|
1110
|
-
export { Button, type ButtonProps, Calendar, type CalendarProps, DatePicker, type DatePickerProps, DragGuideLines, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttDateRange, GridBackground, type GridConfig, type GridLine, Input, type InputProps, type MonthBlock, type MonthSpan, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type Task, type TaskBarGeometry, type TaskDependency, TaskList, type TaskListProps, TaskRow, TimeScaleHeader, TodayIndicator, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WeekendBlock, type YearSpan, buildAdjacencyList, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMonthGridLines, calculateOrthogonalPath, calculateSuccessorDate, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, cascadeByLinks, computeLagFromDates, computeParentDates, computeParentProgress, detectCycles, detectEdgeZone, findParentId, flattenHierarchy, formatDateLabel, getAllDependencyEdges, getChildren, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getSuccessorChain, getTransitiveCascadeChain, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, isTaskParent, isToday, isWeekend, normalizeHierarchyTasks, normalizeTaskDates, parseUTCDate, pixelsToDate, recalculateIncomingLags, removeDependenciesBetweenTasks, universalCascade, useTaskDrag, validateDependencies };
|
|
1201
|
+
export { Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttDateRange, GridBackground, type GridConfig, type GridLine, Input, type InputProps, type MonthBlock, type MonthSpan, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type Task, type TaskBarGeometry, type TaskDependency, TaskList, type TaskListProps, TaskRow, TimeScaleHeader, TodayIndicator, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WeekendBlock, type YearSpan, buildAdjacencyList, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMonthGridLines, calculateOrthogonalPath, calculateSuccessorDate, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, cascadeByLinks, computeLagFromDates, computeParentDates, computeParentProgress, createCustomDayPredicate, createDateKey, detectCycles, detectEdgeZone, findParentId, flattenHierarchy, formatDateLabel, getAllDependencyEdges, getChildren, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getSuccessorChain, getTransitiveCascadeChain, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, isTaskParent, isToday, isWeekend, normalizeHierarchyTasks, normalizeTaskDates, parseUTCDate, pixelsToDate, recalculateIncomingLags, removeDependenciesBetweenTasks, universalCascade, useTaskDrag, validateDependencies };
|