@levelcaptech/gantt-task-react-custom 0.1.0 → 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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -1,4 +1,24 @@
1
1
  /// <reference types="react" />
2
+ import { TaskProcessOption, TaskStatusOption } from "../constants/taskOptions";
3
+ export declare type TaskProcess = TaskProcessOption;
4
+ export declare type TaskStatus = TaskStatusOption;
5
+ export declare type EffortUnit = "MH" | "MD" | "MM";
6
+ export declare type VisibleField = "name" | "start" | "end" | "process" | "assignee" | "plannedStart" | "plannedEnd" | "plannedEffort" | "actualEffort" | "status";
7
+ export declare type CellCommitTrigger = "enter";
8
+ export declare type CellCommitPayload = {
9
+ rowId: string;
10
+ columnId: VisibleField;
11
+ value: string;
12
+ trigger: CellCommitTrigger;
13
+ };
14
+ export declare type ColumnState = {
15
+ id: VisibleField;
16
+ label: string;
17
+ width: number;
18
+ minWidth: number;
19
+ visible: boolean;
20
+ };
21
+ export declare type ColumnsState = ColumnState[];
2
22
  export declare enum ViewMode {
3
23
  Hour = "Hour",
4
24
  QuarterDay = "Quarter Day",
@@ -32,6 +52,13 @@ export interface Task {
32
52
  dependencies?: string[];
33
53
  hideChildren?: boolean;
34
54
  displayOrder?: number;
55
+ process?: TaskProcess;
56
+ assignee?: string;
57
+ plannedStart?: Date;
58
+ plannedEnd?: Date;
59
+ plannedEffort?: number;
60
+ actualEffort?: number;
61
+ status?: TaskStatus;
35
62
  }
36
63
  export interface EventOption {
37
64
  /**
@@ -66,6 +93,53 @@ export interface EventOption {
66
93
  * Invokes on expander on task list
67
94
  */
68
95
  onExpanderClick?: (task: Task) => void;
96
+ /**
97
+ * Invokes when task list fields are updated (process, status, planned dates, assignee, effort).
98
+ */
99
+ onTaskUpdate?: (taskId: string, updatedFields: Partial<Task>) => void;
100
+ /**
101
+ * Invokes when a task list cell edit is committed.
102
+ * Notification only; the library does not update tasks or UI.
103
+ * Host must validate/persist, update tasks, and pass new props for rerender.
104
+ */
105
+ onCellCommit?: (payload: CellCommitPayload) => Promise<void>;
106
+ }
107
+ export interface CalendarConfig {
108
+ /**
109
+ * Locale for date formatting. Defaults to "ja" for Japanese.
110
+ */
111
+ locale?: string;
112
+ /**
113
+ * Date format identifier. Currently supports "MM/dd(EEE)" for Japanese calendar display.
114
+ * This is a legacy identifier and not interpreted as a date-fns format string.
115
+ */
116
+ dateFormat?: string;
117
+ /**
118
+ * Enable Japanese holidays as non-working days. Defaults to true.
119
+ */
120
+ enableJPHoliday?: boolean;
121
+ /**
122
+ * Highlight non-working days with gray background. Defaults to true.
123
+ */
124
+ highlightNonWorkingDays?: boolean;
125
+ /**
126
+ * Treat Saturday as a working day. Defaults to false.
127
+ */
128
+ workOnSaturday?: boolean;
129
+ /**
130
+ * Additional holidays in ISO-like date string format.
131
+ * Year must be 4 digits; month and day may be 1–2 digits and are zero-padded internally
132
+ * (e.g. "2024-1-5" is normalized to "2024-01-05").
133
+ * These dates will be treated as non-working days.
134
+ */
135
+ extraHolidays?: string[];
136
+ /**
137
+ * Special working days in ISO-like date string format.
138
+ * Year must be 4 digits; month and day may be 1–2 digits and are zero-padded internally
139
+ * (e.g. "2024-1-5" is normalized to "2024-01-05").
140
+ * These dates override weekends, holidays, and extraHolidays.
141
+ */
142
+ extraWorkingDays?: string[];
69
143
  }
70
144
  export interface DisplayOption {
71
145
  viewMode?: ViewMode;
@@ -76,6 +150,12 @@ export interface DisplayOption {
76
150
  */
77
151
  locale?: string;
78
152
  rtl?: boolean;
153
+ /**
154
+ * Calendar configuration for working day calculation and date display.
155
+ * If not specified, no calendar customization is applied and
156
+ * Japanese holiday/highlight features remain disabled (opt-in behavior).
157
+ */
158
+ calendar?: CalendarConfig;
79
159
  }
80
160
  export interface StylingOption {
81
161
  headerHeight?: number;
@@ -105,23 +185,31 @@ export interface StylingOption {
105
185
  arrowColor?: string;
106
186
  arrowIndent?: number;
107
187
  todayColor?: string;
188
+ visibleFields?: VisibleField[];
189
+ effortDisplayUnit?: EffortUnit;
190
+ enableColumnDrag?: boolean;
108
191
  TooltipContent?: React.FC<{
109
192
  task: Task;
110
193
  fontSize: string;
111
194
  fontFamily: string;
195
+ effortDisplayUnit?: EffortUnit;
112
196
  }>;
113
197
  TaskListHeader?: React.FC<{
114
198
  headerHeight: number;
115
199
  rowWidth: string;
116
200
  fontFamily: string;
117
201
  fontSize: string;
202
+ visibleFields: VisibleField[];
203
+ columnsState?: ColumnsState;
204
+ setColumnsState?: React.Dispatch<React.SetStateAction<ColumnsState>>;
205
+ enableColumnDrag?: boolean;
118
206
  }>;
119
207
  TaskListTable?: React.FC<{
120
208
  rowHeight: number;
121
209
  rowWidth: string;
122
210
  fontFamily: string;
123
211
  fontSize: string;
124
- locale: string;
212
+ locale?: string;
125
213
  tasks: Task[];
126
214
  selectedTaskId: string;
127
215
  /**
@@ -129,6 +217,10 @@ export interface StylingOption {
129
217
  */
130
218
  setSelectedTask: (taskId: string) => void;
131
219
  onExpanderClick: (task: Task) => void;
220
+ visibleFields: VisibleField[];
221
+ onUpdateTask?: (taskId: string, updatedFields: Partial<Task>) => void;
222
+ effortDisplayUnit: EffortUnit;
223
+ columnsState?: ColumnsState;
132
224
  }>;
133
225
  }
134
226
  export interface GanttProps extends EventOption, DisplayOption, StylingOption {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levelcaptech/gantt-task-react-custom",
3
- "version": "0.1.0",
3
+ "version": "0.4.2",
4
4
  "description": "Interactive Gantt Chart for React with TypeScript.",
5
5
  "author": "LevelCapTech <levelcaptech@gmail.com>",
6
6
  "homepage": "https://github.com/LevelCapTech/gantt-task-react-custom",
@@ -27,9 +27,19 @@
27
27
  "react-gantt",
28
28
  "task"
29
29
  ],
30
+ "microbundle": {
31
+ "external": [
32
+ "react",
33
+ "react-dom",
34
+ "react/jsx-runtime",
35
+ "react/jsx-dev-runtime",
36
+ "@dnd-kit/core",
37
+ "@dnd-kit/utilities"
38
+ ]
39
+ },
30
40
  "scripts": {
31
- "build": "microbundle-crl --no-compress --format modern,cjs",
32
- "start": "microbundle-crl watch --no-compress --format modern,cjs",
41
+ "build": "microbundle-crl --no-compress --format modern,cjs --tsconfig tsconfig.build.json",
42
+ "start": "microbundle-crl watch --no-compress --format modern,cjs --tsconfig tsconfig.build.json",
33
43
  "prepare": "run-s build",
34
44
  "test": "run-s test:unit test:lint test:build",
35
45
  "test:build": "run-s build",
@@ -40,12 +50,21 @@
40
50
  "deploy": "gh-pages -d example/build"
41
51
  },
42
52
  "peerDependencies": {
43
- "react": "^18.0.0"
53
+ "@dnd-kit/core": "^6.3.1",
54
+ "@dnd-kit/sortable": "^7.0.0",
55
+ "@dnd-kit/utilities": "^3.2.2",
56
+ "react": "^18.0.0",
57
+ "react-dom": "^18.0.0"
44
58
  },
45
59
  "devDependencies": {
60
+ "@babel/plugin-proposal-unicode-property-regex": "^7.18.6",
61
+ "@dnd-kit/core": "^6.3.1",
62
+ "@dnd-kit/sortable": "^7.0.0",
63
+ "@dnd-kit/utilities": "^3.2.2",
46
64
  "@testing-library/jest-dom": "^5.16.4",
47
65
  "@testing-library/react": "^13.3.0",
48
66
  "@testing-library/user-event": "^14.2.1",
67
+ "@types/classnames": "^2.3.0",
49
68
  "@types/jest": "^27.5.1",
50
69
  "@types/node": "^15.0.1",
51
70
  "@types/react": "^18.0.5",
@@ -59,8 +78,6 @@
59
78
  "postcss-normalize": "^10.0.1",
60
79
  "postcss-preset-env": "^7.6.0",
61
80
  "prettier": "^2.7.1",
62
- "react": "^18.2.0",
63
- "react-dom": "^18.2.0",
64
81
  "react-scripts": "^5.0.1",
65
82
  "typescript": "^4.7.4"
66
83
  },