@levelcaptech/gantt-task-react-custom 0.4.1 → 0.4.2
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/README.md +64 -9
- package/dist/components/calendar/calendar.d.ts +2 -0
- package/dist/components/grid/grid-body.d.ts +2 -0
- package/dist/helpers/calendar-helper.d.ts +38 -0
- package/dist/helpers/jp-holidays.d.ts +14 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +186 -12
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +186 -12
- package/dist/index.modern.js.map +1 -1
- package/dist/test/calendar-helper.test.d.ts +1 -0
- package/dist/types/public-types.d.ts +43 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,10 @@ https://github.com/MaTeMaTuK/gantt-task-react
|
|
|
18
18
|
npm install @levelcaptech/gantt-task-react-custom
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
## 関連リンク
|
|
22
|
+
|
|
23
|
+
- npm: https://www.npmjs.com/package/@levelcaptech/gantt-task-react-custom
|
|
24
|
+
|
|
21
25
|
## Requirements
|
|
22
26
|
|
|
23
27
|
- React: 18.x(必須)
|
|
@@ -31,7 +35,7 @@ VS Code Dev Containers で npmjs.com への publish を行う環境を用意し
|
|
|
31
35
|
|
|
32
36
|
## 使い方
|
|
33
37
|
|
|
34
|
-
```
|
|
38
|
+
```typescript
|
|
35
39
|
import { Gantt, Task, EventOption, StylingOption, ViewMode, DisplayOption } from '@levelcaptech/gantt-task-react-custom';
|
|
36
40
|
import "@levelcaptech/gantt-task-react-custom/dist/index.css";
|
|
37
41
|
|
|
@@ -53,7 +57,7 @@ let tasks: Task[] = [
|
|
|
53
57
|
|
|
54
58
|
次のアクションを処理できます
|
|
55
59
|
|
|
56
|
-
```
|
|
60
|
+
```typescript
|
|
57
61
|
<Gantt
|
|
58
62
|
tasks={tasks}
|
|
59
63
|
viewMode={view}
|
|
@@ -107,13 +111,64 @@ npm start
|
|
|
107
111
|
|
|
108
112
|
### DisplayOption
|
|
109
113
|
|
|
110
|
-
| パラメーター名 | 型
|
|
111
|
-
| :------------- |
|
|
112
|
-
| viewMode | enum
|
|
113
|
-
| viewDate | date
|
|
114
|
-
| preStepsCount | number
|
|
115
|
-
| locale | string
|
|
116
|
-
| rtl | boolean
|
|
114
|
+
| パラメーター名 | 型 | 説明 |
|
|
115
|
+
| :------------- | :------------------------------ | :---------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| viewMode | enum | 時間スケールを指定します。Hour, Quarter Day, Half Day, Day, Week(ISO-8601 で 1 日目は月曜), Month, QuarterYear, Year。 |
|
|
117
|
+
| viewDate | date | 表示に使用する日時を指定します。 |
|
|
118
|
+
| preStepsCount | number | 最初のタスクの前の空白を指定します。 |
|
|
119
|
+
| locale | string | 月名の言語を指定します。利用可能な形式: ISO 639-2, Java Locale。 |
|
|
120
|
+
| rtl | boolean | rtl モードを設定します。 |
|
|
121
|
+
| calendar | [CalendarConfig](#calendarconfig) | 稼働日計算と日付表示のカレンダー設定を指定します。未指定の場合は従来の動作を維持します(オプトイン式)。 |
|
|
122
|
+
|
|
123
|
+
### CalendarConfig
|
|
124
|
+
|
|
125
|
+
日本カレンダー標準対応およびカスタム稼働日設定を提供します。`calendar` プロパティに設定を渡すことで有効化されます(オプトイン式)。
|
|
126
|
+
|
|
127
|
+
| パラメーター名 | 型 | デフォルト値 | 説明 |
|
|
128
|
+
| :----------------------- | :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------ |
|
|
129
|
+
| locale | string | `"ja"` | 日付フォーマットのロケール。日本語の場合は `"ja"` を指定します。 |
|
|
130
|
+
| dateFormat | string | `"MM/dd(EEE)"` | 日付フォーマット識別子(レガシーフィールド)。現在はレンダリング上は `"MM/dd(EEE)"` 固定で、この値を変更しても表示は変わりません。将来拡張用です。 |
|
|
131
|
+
| enableJPHoliday | boolean | `true` | 日本の祝日を非稼働日として扱うかどうか。`true` で有効化されます。 |
|
|
132
|
+
| highlightNonWorkingDays | boolean | `true` | 非稼働日をグレー背景でハイライト表示するかどうか。 |
|
|
133
|
+
| workOnSaturday | boolean | `false` | 土曜日を稼働日として扱うかどうか。`true` にすると土曜日も稼働日になります。 |
|
|
134
|
+
| extraHolidays | string[] | `[]` | 独自の休業日を日付文字列の配列で指定します。`YYYY-MM-DD` 形式に加えて `YYYY-M-D` のようなゼロパディング無しも受け入れ、内部で正規化されます。 |
|
|
135
|
+
| extraWorkingDays | string[] | `[]` | 特別稼働日を日付文字列の配列で指定します。`YYYY-MM-DD` 形式に加えて `YYYY-M-D` のようなゼロパディング無しも受け入れ、内部で正規化されます。週末・祝日・`extraHolidays` より優先されます。 |
|
|
136
|
+
|
|
137
|
+
#### 使用例
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { Gantt } from '@levelcaptech/gantt-task-react-custom';
|
|
141
|
+
import type { CalendarConfig } from '@levelcaptech/gantt-task-react-custom';
|
|
142
|
+
|
|
143
|
+
const calendarConfig: CalendarConfig = {
|
|
144
|
+
locale: "ja",
|
|
145
|
+
enableJPHoliday: true,
|
|
146
|
+
highlightNonWorkingDays: true,
|
|
147
|
+
workOnSaturday: false,
|
|
148
|
+
extraHolidays: ["2024-12-30", "2024-12-31"], // 年末特別休業
|
|
149
|
+
extraWorkingDays: ["2024-01-08"], // 祝日(成人の日)だが特別稼働日
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
<Gantt
|
|
153
|
+
tasks={tasks}
|
|
154
|
+
calendar={calendarConfig}
|
|
155
|
+
locale="ja-JP"
|
|
156
|
+
/>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### 稼働日判定の優先順位
|
|
160
|
+
|
|
161
|
+
1. **最優先**: `extraWorkingDays` - 指定された日付は必ず稼働日になります
|
|
162
|
+
2. **次**: `extraHolidays` - 指定された日付は非稼働日になります
|
|
163
|
+
3. **標準**: 週末(日曜日、`workOnSaturday` が `false` の場合は土曜日も)と日本の祝日(`enableJPHoliday` が `true` の場合)
|
|
164
|
+
|
|
165
|
+
#### 注意事項
|
|
166
|
+
|
|
167
|
+
- `calendar` プロパティを指定しない場合、カレンダー機能は無効化され、従来の動作を維持します(後方互換性)。
|
|
168
|
+
- 日本の祝日データは 2024-2026 年分がライブラリに静的に含まれています。
|
|
169
|
+
- 無効な ISO 日付文字列は無視され、例外は投げられません。
|
|
170
|
+
- 日付表示は `Intl.DateTimeFormat` を使用して `MM/dd(曜)` 形式で表示されます(日本語ロケール時)。
|
|
171
|
+
|
|
117
172
|
|
|
118
173
|
### StylingOption
|
|
119
174
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ViewMode } from "../../types/public-types";
|
|
3
|
+
import { NormalizedCalendarConfig } from "../../helpers/calendar-helper";
|
|
3
4
|
import { DateSetup } from "../../types/date-setup";
|
|
4
5
|
export declare type CalendarProps = {
|
|
5
6
|
dateSetup: DateSetup;
|
|
@@ -10,5 +11,6 @@ export declare type CalendarProps = {
|
|
|
10
11
|
columnWidth: number;
|
|
11
12
|
fontFamily: string;
|
|
12
13
|
fontSize: string;
|
|
14
|
+
calendarConfig?: NormalizedCalendarConfig;
|
|
13
15
|
};
|
|
14
16
|
export declare const Calendar: React.FC<CalendarProps>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Task } from "../../types/public-types";
|
|
3
|
+
import { NormalizedCalendarConfig } from "../../helpers/calendar-helper";
|
|
3
4
|
export declare type GridBodyProps = {
|
|
4
5
|
tasks: Task[];
|
|
5
6
|
dates: Date[];
|
|
@@ -8,5 +9,6 @@ export declare type GridBodyProps = {
|
|
|
8
9
|
columnWidth: number;
|
|
9
10
|
todayColor: string;
|
|
10
11
|
rtl: boolean;
|
|
12
|
+
calendarConfig?: NormalizedCalendarConfig;
|
|
11
13
|
};
|
|
12
14
|
export declare const GridBody: React.FC<GridBodyProps>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CalendarConfig } from "../types/public-types";
|
|
2
|
+
/**
|
|
3
|
+
* Normalized calendar configuration with default values
|
|
4
|
+
*/
|
|
5
|
+
export interface NormalizedCalendarConfig {
|
|
6
|
+
locale: string;
|
|
7
|
+
dateFormat: string;
|
|
8
|
+
enableJPHoliday: boolean;
|
|
9
|
+
highlightNonWorkingDays: boolean;
|
|
10
|
+
workOnSaturday: boolean;
|
|
11
|
+
extraHolidays: Set<string>;
|
|
12
|
+
extraWorkingDays: Set<string>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Normalize and validate calendar configuration
|
|
16
|
+
*/
|
|
17
|
+
export declare const normalizeCalendarConfig: (config: CalendarConfig) => NormalizedCalendarConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Normalize ISO date string (YYYY-MM-DD) to valid date
|
|
20
|
+
* Returns canonical YYYY-MM-DD format or null if invalid
|
|
21
|
+
*/
|
|
22
|
+
export declare const normalizeISODate: (dateStr: string) => string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Convert Date to ISO date string (YYYY-MM-DD)
|
|
25
|
+
*/
|
|
26
|
+
export declare const toISODateString: (date: Date) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a date is a working day according to calendar configuration
|
|
29
|
+
*/
|
|
30
|
+
export declare const isWorkingDay: (date: Date, config: NormalizedCalendarConfig) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Count working days between two dates (inclusive)
|
|
33
|
+
*/
|
|
34
|
+
export declare const countWorkingDays: (startDate: Date, endDate: Date, config: NormalizedCalendarConfig) => number;
|
|
35
|
+
/**
|
|
36
|
+
* Format date in MM/dd(曜) format using Intl.DateTimeFormat
|
|
37
|
+
*/
|
|
38
|
+
export declare const formatJapaneseDate: (date: Date) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Japanese national holidays data
|
|
3
|
+
* Format: YYYY-MM-DD
|
|
4
|
+
* This data should be updated periodically with new releases
|
|
5
|
+
*/
|
|
6
|
+
export declare const JP_HOLIDAYS: Record<number, string[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Get all Japanese holidays as a Set for fast lookup
|
|
9
|
+
*/
|
|
10
|
+
export declare const getJPHolidaySet: () => Set<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Cached Japanese holidays set for performance
|
|
13
|
+
*/
|
|
14
|
+
export declare const JP_HOLIDAYS_SET: Set<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Gantt } from "./components/gantt/gantt";
|
|
2
2
|
export { ViewMode } from "./types/public-types";
|
|
3
|
-
export type { GanttProps, Task, StylingOption, DisplayOption, EventOption, EffortUnit, VisibleField, TaskProcess, TaskStatus, } from "./types/public-types";
|
|
3
|
+
export type { GanttProps, Task, StylingOption, DisplayOption, EventOption, EffortUnit, VisibleField, TaskProcess, TaskStatus, CalendarConfig, } from "./types/public-types";
|
|
4
4
|
export { TASK_PROCESS_OPTIONS, TASK_STATUS_OPTIONS, TASK_STATUS_BADGE_TEXT, TASK_STATUS_COLORS, } from "./constants/taskOptions";
|
|
5
5
|
export { formatDate, parseDateFromInput, formatEffort, sanitizeEffortInput, normalizeProcess, normalizeStatus, resolveVisibleFields, getStatusColor, getStatusBadgeText, DEFAULT_VISIBLE_FIELDS, } from "./helpers/task-helper";
|
package/dist/index.js
CHANGED
|
@@ -1788,6 +1788,157 @@ var VerticalScroll = function VerticalScroll(_ref) {
|
|
|
1788
1788
|
}));
|
|
1789
1789
|
};
|
|
1790
1790
|
|
|
1791
|
+
var JP_HOLIDAYS = {
|
|
1792
|
+
2024: ["2024-01-01", "2024-01-08", "2024-02-11", "2024-02-12", "2024-02-23", "2024-03-20", "2024-04-29", "2024-05-03", "2024-05-04", "2024-05-05", "2024-05-06", "2024-07-15", "2024-08-11", "2024-08-12", "2024-09-16", "2024-09-22", "2024-09-23", "2024-10-14", "2024-11-03", "2024-11-04", "2024-11-23"],
|
|
1793
|
+
2025: ["2025-01-01", "2025-01-13", "2025-02-11", "2025-02-23", "2025-02-24", "2025-03-20", "2025-04-29", "2025-05-03", "2025-05-04", "2025-05-05", "2025-05-06", "2025-07-21", "2025-08-11", "2025-09-15", "2025-09-23", "2025-10-13", "2025-11-03", "2025-11-23", "2025-11-24"],
|
|
1794
|
+
2026: ["2026-01-01", "2026-01-12", "2026-02-11", "2026-02-23", "2026-03-20", "2026-04-29", "2026-05-03", "2026-05-04", "2026-05-05", "2026-05-06", "2026-07-20", "2026-08-11", "2026-09-21", "2026-09-22", "2026-10-12", "2026-11-03", "2026-11-23"]
|
|
1795
|
+
};
|
|
1796
|
+
var getJPHolidaySet = function getJPHolidaySet() {
|
|
1797
|
+
var holidays = new Set();
|
|
1798
|
+
Object.values(JP_HOLIDAYS).forEach(function (yearHolidays) {
|
|
1799
|
+
yearHolidays.forEach(function (holiday) {
|
|
1800
|
+
return holidays.add(holiday);
|
|
1801
|
+
});
|
|
1802
|
+
});
|
|
1803
|
+
return holidays;
|
|
1804
|
+
};
|
|
1805
|
+
var JP_HOLIDAYS_SET = getJPHolidaySet();
|
|
1806
|
+
|
|
1807
|
+
var emittedWarnings = new Set();
|
|
1808
|
+
var warnOnce = function warnOnce(key, message) {
|
|
1809
|
+
if (!emittedWarnings.has(key) && typeof console !== "undefined") {
|
|
1810
|
+
console.warn(message);
|
|
1811
|
+
emittedWarnings.add(key);
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1814
|
+
var normalizeCalendarConfig = function normalizeCalendarConfig(config) {
|
|
1815
|
+
var _config$locale, _config$enableJPHolid, _config$highlightNonW;
|
|
1816
|
+
var rawLocale = ((_config$locale = config.locale) === null || _config$locale === void 0 ? void 0 : _config$locale.trim()) || "";
|
|
1817
|
+
var locale = rawLocale || "ja";
|
|
1818
|
+
var dateFormat = config.dateFormat || "MM/dd(EEE)";
|
|
1819
|
+
var enableJPHoliday = (_config$enableJPHolid = config.enableJPHoliday) != null ? _config$enableJPHolid : true;
|
|
1820
|
+
var highlightNonWorkingDays = (_config$highlightNonW = config.highlightNonWorkingDays) != null ? _config$highlightNonW : true;
|
|
1821
|
+
var workOnSaturday = config.workOnSaturday === true;
|
|
1822
|
+
var extraHolidays = new Set();
|
|
1823
|
+
if (config.extraHolidays) {
|
|
1824
|
+
config.extraHolidays.forEach(function (dateStr) {
|
|
1825
|
+
var normalized = normalizeISODate(dateStr);
|
|
1826
|
+
if (normalized) {
|
|
1827
|
+
extraHolidays.add(normalized);
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
var extraWorkingDays = new Set();
|
|
1832
|
+
if (config.extraWorkingDays) {
|
|
1833
|
+
config.extraWorkingDays.forEach(function (dateStr) {
|
|
1834
|
+
var normalized = normalizeISODate(dateStr);
|
|
1835
|
+
if (normalized) {
|
|
1836
|
+
extraWorkingDays.add(normalized);
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1840
|
+
if (!locale.toLowerCase().startsWith("ja")) {
|
|
1841
|
+
var localeKey = locale.trim().toLowerCase();
|
|
1842
|
+
warnOnce("gantt-calendar-locale-" + localeKey, "[Gantt Calendar] Non-Japanese locale \"" + locale + "\" specified. " + "Holiday definitions (including Japanese public holidays) are still based on the Japanese calendar.");
|
|
1843
|
+
}
|
|
1844
|
+
if (dateFormat !== "MM/dd(EEE)") {
|
|
1845
|
+
var dateFormatKey = dateFormat.trim().toLowerCase();
|
|
1846
|
+
warnOnce("gantt-calendar-dateFormat-" + dateFormatKey, "[Gantt Calendar] Custom dateFormat \"" + dateFormat + "\" specified. " + "Note: dateFormat is currently a legacy field and does not affect date rendering. " + "The format \"MM/dd(EEE)\" is used internally regardless of this setting.");
|
|
1847
|
+
}
|
|
1848
|
+
return {
|
|
1849
|
+
locale: locale,
|
|
1850
|
+
dateFormat: dateFormat,
|
|
1851
|
+
enableJPHoliday: enableJPHoliday,
|
|
1852
|
+
highlightNonWorkingDays: highlightNonWorkingDays,
|
|
1853
|
+
workOnSaturday: workOnSaturday,
|
|
1854
|
+
extraHolidays: extraHolidays,
|
|
1855
|
+
extraWorkingDays: extraWorkingDays
|
|
1856
|
+
};
|
|
1857
|
+
};
|
|
1858
|
+
var normalizeISODate = function normalizeISODate(dateStr) {
|
|
1859
|
+
try {
|
|
1860
|
+
var trimmed = dateStr.trim();
|
|
1861
|
+
if (!/^\d{4}-\d{1,2}-\d{1,2}$/.test(trimmed)) {
|
|
1862
|
+
return null;
|
|
1863
|
+
}
|
|
1864
|
+
var parts = trimmed.split("-");
|
|
1865
|
+
if (parts.length !== 3) return null;
|
|
1866
|
+
var year = Number(parts[0]);
|
|
1867
|
+
var month = Number(parts[1]);
|
|
1868
|
+
var day = Number(parts[2]);
|
|
1869
|
+
if (isNaN(year) || isNaN(month) || isNaN(day) || month < 1 || month > 12 || day < 1 || day > 31) {
|
|
1870
|
+
return null;
|
|
1871
|
+
}
|
|
1872
|
+
var date = new Date(year, month - 1, day);
|
|
1873
|
+
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {
|
|
1874
|
+
return null;
|
|
1875
|
+
}
|
|
1876
|
+
var paddedMonth = String(month).padStart(2, "0");
|
|
1877
|
+
var paddedDay = String(day).padStart(2, "0");
|
|
1878
|
+
return year + "-" + paddedMonth + "-" + paddedDay;
|
|
1879
|
+
} catch (e) {
|
|
1880
|
+
if (typeof console !== "undefined") {
|
|
1881
|
+
console.warn("[Gantt Calendar] Invalid date string: " + dateStr);
|
|
1882
|
+
}
|
|
1883
|
+
return null;
|
|
1884
|
+
}
|
|
1885
|
+
};
|
|
1886
|
+
var toISODateString = function toISODateString(date) {
|
|
1887
|
+
var year = date.getFullYear();
|
|
1888
|
+
var month = String(date.getMonth() + 1).padStart(2, "0");
|
|
1889
|
+
var day = String(date.getDate()).padStart(2, "0");
|
|
1890
|
+
return year + "-" + month + "-" + day;
|
|
1891
|
+
};
|
|
1892
|
+
var isWorkingDay = function isWorkingDay(date, config) {
|
|
1893
|
+
var dateStr = toISODateString(date);
|
|
1894
|
+
if (config.extraWorkingDays.has(dateStr)) {
|
|
1895
|
+
return true;
|
|
1896
|
+
}
|
|
1897
|
+
if (config.extraHolidays.has(dateStr)) {
|
|
1898
|
+
return false;
|
|
1899
|
+
}
|
|
1900
|
+
var dayOfWeek = date.getDay();
|
|
1901
|
+
if (dayOfWeek === 0) {
|
|
1902
|
+
return false;
|
|
1903
|
+
}
|
|
1904
|
+
if (dayOfWeek === 6 && !config.workOnSaturday) {
|
|
1905
|
+
return false;
|
|
1906
|
+
}
|
|
1907
|
+
if (config.enableJPHoliday) {
|
|
1908
|
+
if (JP_HOLIDAYS_SET.has(dateStr)) {
|
|
1909
|
+
return false;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
return true;
|
|
1913
|
+
};
|
|
1914
|
+
var formatJapaneseDate = function formatJapaneseDate(date) {
|
|
1915
|
+
try {
|
|
1916
|
+
var formatter = new Intl.DateTimeFormat("ja", {
|
|
1917
|
+
month: "2-digit",
|
|
1918
|
+
day: "2-digit",
|
|
1919
|
+
weekday: "short"
|
|
1920
|
+
});
|
|
1921
|
+
var parts = formatter.formatToParts(date);
|
|
1922
|
+
var month = "";
|
|
1923
|
+
var day = "";
|
|
1924
|
+
var weekday = "";
|
|
1925
|
+
parts.forEach(function (part) {
|
|
1926
|
+
if (part.type === "month") {
|
|
1927
|
+
month = part.value;
|
|
1928
|
+
} else if (part.type === "day") {
|
|
1929
|
+
day = part.value;
|
|
1930
|
+
} else if (part.type === "weekday") {
|
|
1931
|
+
weekday = part.value;
|
|
1932
|
+
}
|
|
1933
|
+
});
|
|
1934
|
+
return month + "/" + day + "(" + weekday + ")";
|
|
1935
|
+
} catch (e) {
|
|
1936
|
+
var _month = String(date.getMonth() + 1).padStart(2, "0");
|
|
1937
|
+
var _day = String(date.getDate()).padStart(2, "0");
|
|
1938
|
+
return _month + "/" + _day;
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
|
|
1791
1942
|
var styles$4 = {"gridRow":"_2dZTy","gridRowLine":"_3rUKi","gridTick":"_RuwuK"};
|
|
1792
1943
|
|
|
1793
1944
|
var GridBody = function GridBody(_ref) {
|
|
@@ -1797,7 +1948,8 @@ var GridBody = function GridBody(_ref) {
|
|
|
1797
1948
|
svgWidth = _ref.svgWidth,
|
|
1798
1949
|
columnWidth = _ref.columnWidth,
|
|
1799
1950
|
todayColor = _ref.todayColor,
|
|
1800
|
-
rtl = _ref.rtl
|
|
1951
|
+
rtl = _ref.rtl,
|
|
1952
|
+
calendarConfig = _ref.calendarConfig;
|
|
1801
1953
|
var y = 0;
|
|
1802
1954
|
var gridRows = [];
|
|
1803
1955
|
var rowLines = [React__default.createElement("line", {
|
|
@@ -1831,6 +1983,7 @@ var GridBody = function GridBody(_ref) {
|
|
|
1831
1983
|
var now = new Date();
|
|
1832
1984
|
var tickX = 0;
|
|
1833
1985
|
var ticks = [];
|
|
1986
|
+
var nonWorkingDays = [];
|
|
1834
1987
|
var today = React__default.createElement("rect", null);
|
|
1835
1988
|
for (var i = 0; i < dates.length; i++) {
|
|
1836
1989
|
var date = dates[i];
|
|
@@ -1842,6 +1995,16 @@ var GridBody = function GridBody(_ref) {
|
|
|
1842
1995
|
y2: y,
|
|
1843
1996
|
className: styles$4.gridTick
|
|
1844
1997
|
}));
|
|
1998
|
+
if (calendarConfig && calendarConfig.highlightNonWorkingDays && !isWorkingDay(date, calendarConfig)) {
|
|
1999
|
+
nonWorkingDays.push(React__default.createElement("rect", {
|
|
2000
|
+
key: "non-working-" + date.getTime(),
|
|
2001
|
+
x: tickX,
|
|
2002
|
+
y: 0,
|
|
2003
|
+
width: columnWidth,
|
|
2004
|
+
height: y,
|
|
2005
|
+
fill: "rgba(0, 0, 0, 0.05)"
|
|
2006
|
+
}));
|
|
2007
|
+
}
|
|
1845
2008
|
if (i + 1 !== dates.length && date.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || i !== 0 && i + 1 === dates.length && date.getTime() < now.getTime() && addToDate(date, date.getTime() - dates[i - 1].getTime(), "millisecond").getTime() >= now.getTime()) {
|
|
1846
2009
|
today = React__default.createElement("rect", {
|
|
1847
2010
|
x: tickX,
|
|
@@ -1867,6 +2030,8 @@ var GridBody = function GridBody(_ref) {
|
|
|
1867
2030
|
}, React__default.createElement("g", {
|
|
1868
2031
|
className: "rows"
|
|
1869
2032
|
}, gridRows), React__default.createElement("g", {
|
|
2033
|
+
className: "nonWorkingDays"
|
|
2034
|
+
}, nonWorkingDays), React__default.createElement("g", {
|
|
1870
2035
|
className: "rowLines"
|
|
1871
2036
|
}, rowLines), React__default.createElement("g", {
|
|
1872
2037
|
className: "ticks"
|
|
@@ -1915,7 +2080,9 @@ var Calendar = function Calendar(_ref) {
|
|
|
1915
2080
|
headerHeight = _ref.headerHeight,
|
|
1916
2081
|
columnWidth = _ref.columnWidth,
|
|
1917
2082
|
fontFamily = _ref.fontFamily,
|
|
1918
|
-
fontSize = _ref.fontSize
|
|
2083
|
+
fontSize = _ref.fontSize,
|
|
2084
|
+
calendarConfig = _ref.calendarConfig;
|
|
2085
|
+
var effectiveLocale = (calendarConfig === null || calendarConfig === void 0 ? void 0 : calendarConfig.locale) || locale;
|
|
1919
2086
|
var getCalendarValuesForYear = function getCalendarValuesForYear() {
|
|
1920
2087
|
var topValues = [];
|
|
1921
2088
|
var bottomValues = [];
|
|
@@ -1990,7 +2157,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
1990
2157
|
var topDefaultHeight = headerHeight * 0.5;
|
|
1991
2158
|
for (var i = 0; i < dateSetup.dates.length; i++) {
|
|
1992
2159
|
var date = dateSetup.dates[i];
|
|
1993
|
-
var bottomValue = getLocaleMonth(date,
|
|
2160
|
+
var bottomValue = getLocaleMonth(date, effectiveLocale);
|
|
1994
2161
|
bottomValues.push(React__default.createElement("text", {
|
|
1995
2162
|
key: bottomValue + date.getFullYear(),
|
|
1996
2163
|
y: headerHeight * 0.8,
|
|
@@ -2028,7 +2195,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
2028
2195
|
var date = dates[i];
|
|
2029
2196
|
var topValue = "";
|
|
2030
2197
|
if (i === 0 || date.getMonth() !== dates[i - 1].getMonth()) {
|
|
2031
|
-
topValue = getLocaleMonth(date,
|
|
2198
|
+
topValue = getLocaleMonth(date, effectiveLocale) + ", " + date.getFullYear();
|
|
2032
2199
|
}
|
|
2033
2200
|
var bottomValue = "W" + getWeekNumberISO8601(date);
|
|
2034
2201
|
bottomValues.push(React__default.createElement("text", {
|
|
@@ -2062,7 +2229,8 @@ var Calendar = function Calendar(_ref) {
|
|
|
2062
2229
|
var dates = dateSetup.dates;
|
|
2063
2230
|
for (var i = 0; i < dates.length; i++) {
|
|
2064
2231
|
var date = dates[i];
|
|
2065
|
-
var
|
|
2232
|
+
var useJapaneseFormat = !!calendarConfig && typeof calendarConfig.locale === "string" && calendarConfig.locale.toLowerCase().startsWith("ja");
|
|
2233
|
+
var bottomValue = useJapaneseFormat ? formatJapaneseDate(date) : getLocalDayOfWeek(date, effectiveLocale, "short") + ", " + date.getDate().toString();
|
|
2066
2234
|
bottomValues.push(React__default.createElement("text", {
|
|
2067
2235
|
key: date.getTime(),
|
|
2068
2236
|
y: headerHeight * 0.8,
|
|
@@ -2070,7 +2238,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
2070
2238
|
className: styles$5.calendarBottomText
|
|
2071
2239
|
}, bottomValue));
|
|
2072
2240
|
if (i + 1 !== dates.length && date.getMonth() !== dates[i + 1].getMonth()) {
|
|
2073
|
-
var topValue = getLocaleMonth(date,
|
|
2241
|
+
var topValue = getLocaleMonth(date, effectiveLocale);
|
|
2074
2242
|
topValues.push(React__default.createElement(TopPartOfCalendar, {
|
|
2075
2243
|
key: topValue + date.getFullYear(),
|
|
2076
2244
|
value: topValue,
|
|
@@ -2092,7 +2260,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
2092
2260
|
var dates = dateSetup.dates;
|
|
2093
2261
|
for (var i = 0; i < dates.length; i++) {
|
|
2094
2262
|
var date = dates[i];
|
|
2095
|
-
var bottomValue = getCachedDateTimeFormat(
|
|
2263
|
+
var bottomValue = getCachedDateTimeFormat(effectiveLocale, {
|
|
2096
2264
|
hour: "numeric"
|
|
2097
2265
|
}).format(date);
|
|
2098
2266
|
bottomValues.push(React__default.createElement("text", {
|
|
@@ -2103,7 +2271,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
2103
2271
|
fontFamily: fontFamily
|
|
2104
2272
|
}, bottomValue));
|
|
2105
2273
|
if (i === 0 || date.getDate() !== dates[i - 1].getDate()) {
|
|
2106
|
-
var topValue = getLocalDayOfWeek(date,
|
|
2274
|
+
var topValue = getLocalDayOfWeek(date, effectiveLocale, "short") + ", " + date.getDate() + " " + getLocaleMonth(date, effectiveLocale);
|
|
2107
2275
|
topValues.push(React__default.createElement(TopPartOfCalendar, {
|
|
2108
2276
|
key: topValue + date.getFullYear(),
|
|
2109
2277
|
value: topValue,
|
|
@@ -2124,7 +2292,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
2124
2292
|
var dates = dateSetup.dates;
|
|
2125
2293
|
for (var i = 0; i < dates.length; i++) {
|
|
2126
2294
|
var date = dates[i];
|
|
2127
|
-
var bottomValue = getCachedDateTimeFormat(
|
|
2295
|
+
var bottomValue = getCachedDateTimeFormat(effectiveLocale, {
|
|
2128
2296
|
hour: "numeric"
|
|
2129
2297
|
}).format(date);
|
|
2130
2298
|
bottomValues.push(React__default.createElement("text", {
|
|
@@ -2136,7 +2304,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
2136
2304
|
}, bottomValue));
|
|
2137
2305
|
if (i !== 0 && date.getDate() !== dates[i - 1].getDate()) {
|
|
2138
2306
|
var displayDate = dates[i - 1];
|
|
2139
|
-
var topValue = getLocalDayOfWeek(displayDate,
|
|
2307
|
+
var topValue = getLocalDayOfWeek(displayDate, effectiveLocale, "long") + ", " + displayDate.getDate() + " " + getLocaleMonth(displayDate, effectiveLocale);
|
|
2140
2308
|
var topPosition = (date.getHours() - 24) / 2;
|
|
2141
2309
|
topValues.push(React__default.createElement(TopPartOfCalendar, {
|
|
2142
2310
|
key: topValue + displayDate.getFullYear(),
|
|
@@ -3306,6 +3474,7 @@ var Gantt = function Gantt(_ref) {
|
|
|
3306
3474
|
preStepsCount = _ref$preStepsCount === void 0 ? 1 : _ref$preStepsCount,
|
|
3307
3475
|
_ref$locale = _ref.locale,
|
|
3308
3476
|
locale = _ref$locale === void 0 ? "en-GB" : _ref$locale,
|
|
3477
|
+
calendar = _ref.calendar,
|
|
3309
3478
|
_ref$barFill = _ref.barFill,
|
|
3310
3479
|
barFill = _ref$barFill === void 0 ? 60 : _ref$barFill,
|
|
3311
3480
|
_ref$barCornerRadius = _ref.barCornerRadius,
|
|
@@ -3367,6 +3536,9 @@ var Gantt = function Gantt(_ref) {
|
|
|
3367
3536
|
onExpanderClick = _ref.onExpanderClick,
|
|
3368
3537
|
onTaskUpdate = _ref.onTaskUpdate,
|
|
3369
3538
|
onCellCommit = _ref.onCellCommit;
|
|
3539
|
+
var calendarConfig = React.useMemo(function () {
|
|
3540
|
+
return calendar ? normalizeCalendarConfig(calendar) : undefined;
|
|
3541
|
+
}, [calendar]);
|
|
3370
3542
|
var wrapperRef = React.useRef(null);
|
|
3371
3543
|
var taskListRef = React.useRef(null);
|
|
3372
3544
|
var taskListHeaderRef = React.useRef(null);
|
|
@@ -3780,7 +3952,8 @@ var Gantt = function Gantt(_ref) {
|
|
|
3780
3952
|
rowHeight: rowHeight,
|
|
3781
3953
|
dates: dateSetup.dates,
|
|
3782
3954
|
todayColor: todayColor,
|
|
3783
|
-
rtl: rtl
|
|
3955
|
+
rtl: rtl,
|
|
3956
|
+
calendarConfig: calendarConfig
|
|
3784
3957
|
};
|
|
3785
3958
|
var calendarProps = {
|
|
3786
3959
|
dateSetup: dateSetup,
|
|
@@ -3790,7 +3963,8 @@ var Gantt = function Gantt(_ref) {
|
|
|
3790
3963
|
columnWidth: columnWidth,
|
|
3791
3964
|
fontFamily: fontFamily,
|
|
3792
3965
|
fontSize: fontSize,
|
|
3793
|
-
rtl: rtl
|
|
3966
|
+
rtl: rtl,
|
|
3967
|
+
calendarConfig: calendarConfig
|
|
3794
3968
|
};
|
|
3795
3969
|
var barProps = {
|
|
3796
3970
|
tasks: barTasks,
|