@mogura/moguchart-react 1.3.0 → 1.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/README.ja.md +160 -32
- package/README.md +161 -33
- package/package.json +3 -3
package/README.ja.md
CHANGED
|
@@ -11,7 +11,9 @@ Lit 公式の `@lit/react` をベースに設計されており、Web Components
|
|
|
11
11
|
- ⚛️ **ネイティブな React 開発体験**: JSX で直感的にプロパティ・イベントハンドラーを記述可能
|
|
12
12
|
- 🎯 **完全な型補完**: TypeScript による強力な型推論と自動補完
|
|
13
13
|
- 🔄 **ライフサイクル同期**: React の状態変更(State / Props)と Web Components のレンダリングを自動同期
|
|
14
|
-
- ⚡ **命令的メソッドへのアクセス**: `ref` を介して `chart.use()`, `chart.exportImage()`, `chart.selectTask()` などを直接呼び出し可能
|
|
14
|
+
- ⚡ **命令的メソッドへのアクセス**: `ref` を介して `chart.use()`, `chart.exportImage()`, `chart.exportExcel()`, `chart.selectTask()` などを直接呼び出し可能
|
|
15
|
+
- 🔌 **プラグイン連携**: `@mogura/moguchart-plugin-export` (PNG/PDF) や `@mogura/moguchart-plugin-excel` (Excel) などの公式プラグインをシームレスに利用可能
|
|
16
|
+
- 📈 **予実管理 (Baseline) 対応**: `task.baseline` と `option.baseline` による計画 vs 実績の同時可視化と遅延検知に対応
|
|
15
17
|
- 📦 **Re-export**: `@mogura/moguchart-core` の型定義や定数をすべて再エクスポートしているため、本パッケージのみのインストールで開発可能
|
|
16
18
|
|
|
17
19
|
---
|
|
@@ -126,16 +128,89 @@ export function GanttToolbar() {
|
|
|
126
128
|
<button onClick={() => chartRef.current?.zoomIn()}>ズームイン</button>
|
|
127
129
|
<button onClick={() => chartRef.current?.zoomOut()}>ズームアウト</button>
|
|
128
130
|
<button onClick={() => chartRef.current?.resetZoom()}>ズームリセット</button>
|
|
131
|
+
<button onClick={() => chartRef.current?.scrollToTask('task-1')}>タスクへ移動</button>
|
|
129
132
|
<GanttChart ref={chartRef} rows={[]} />
|
|
130
133
|
</div>
|
|
131
134
|
)
|
|
132
135
|
}
|
|
133
136
|
```
|
|
134
137
|
|
|
138
|
+
### 利用可能な主なメソッド・プロパティ
|
|
139
|
+
|
|
140
|
+
`ref.current` 経由で以下のメソッドを直接呼び出すことができます:
|
|
141
|
+
|
|
142
|
+
- **操作履歴 (Undo / Redo)**: `undo()`, `redo()`, `clearHistory()`, `recordCommand(cmd)`, `canUndo`, `canRedo`
|
|
143
|
+
- **ズーム操作**: `zoomIn()`, `zoomOut()`, `zoomToPercent(percent)`, `zoomToScale(scale)`, `resetZoom()`, `zoomToFit()`, `getZoomPercent()`, `getZoomScale()`
|
|
144
|
+
- **スクロール・選択**: `scrollToTask(taskId)`, `scrollToPosition(pos)`, `resetScroll()`, `selectTask(taskId)`
|
|
145
|
+
- **WBS・折りたたみ**: `toggleRowCollapse(rowId, collapsed?)`, `collapseAll()`, `expandAll()`, `getRowPositions()`
|
|
146
|
+
- **依存関係操作**: `triggerDependencyDelete(sourceTaskId, targetTaskId)`, `selectDependency(...)`, `clearDependencySelection()`
|
|
147
|
+
- **画像・PDFエクスポート**: `exportImage(format, options)`(`@mogura/moguchart-plugin-export` 導入時)
|
|
148
|
+
- **Excelエクスポート**: `exportExcel(options)`(`@mogura/moguchart-plugin-excel` 導入時)
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 予実管理(Baseline / 計画 vs 実績の可視化)
|
|
153
|
+
|
|
154
|
+
タスクに当初計画(`baseline`)を定義し、`option.baseline` を設定することで、計画日程と現在の実績日程を同一レーン上に同時描画・比較できます。遅延タスク(`task.end > baseline.end`)は視覚的にハイライトされ、ツールチップに遅延日数などが自動表示されます。
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import React, { useState } from 'react'
|
|
158
|
+
import {
|
|
159
|
+
GanttChart,
|
|
160
|
+
type GanttRow,
|
|
161
|
+
type GanttChartOption,
|
|
162
|
+
} from '@mogura/moguchart-react'
|
|
163
|
+
|
|
164
|
+
export function BaselineGanttView() {
|
|
165
|
+
const [rows] = useState<GanttRow[]>([
|
|
166
|
+
{
|
|
167
|
+
id: 'row-1',
|
|
168
|
+
name: '開発フェーズ',
|
|
169
|
+
tasks: [
|
|
170
|
+
{
|
|
171
|
+
id: 'task-1',
|
|
172
|
+
name: 'コア機能実装',
|
|
173
|
+
start: new Date('2026-04-05'),
|
|
174
|
+
end: new Date('2026-04-18'), // 当初予定より遅延
|
|
175
|
+
progress: 60,
|
|
176
|
+
baseline: {
|
|
177
|
+
start: new Date('2026-04-01'),
|
|
178
|
+
end: new Date('2026-04-12'),
|
|
179
|
+
progress: 100,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
])
|
|
185
|
+
|
|
186
|
+
const option: GanttChartOption = {
|
|
187
|
+
calendar: {
|
|
188
|
+
start: new Date('2026-04-01'),
|
|
189
|
+
end: new Date('2026-04-30'),
|
|
190
|
+
pxPerDay: 40,
|
|
191
|
+
},
|
|
192
|
+
baseline: {
|
|
193
|
+
visible: true, // ベースライン表示
|
|
194
|
+
position: 'bottom', // 'bottom' (下部) | 'top' (上部) | 'overlay' (重ねて表示)
|
|
195
|
+
highlightDelay: true, // 遅延タスクをハイライト強調
|
|
196
|
+
delayColor: '#EF4444', // 遅延強調アクセント色
|
|
197
|
+
},
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<div style={{ width: '100%', height: '500px' }}>
|
|
202
|
+
<GanttChart rows={rows} option={option} />
|
|
203
|
+
</div>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
135
208
|
---
|
|
136
209
|
|
|
137
210
|
## プラグイン(エクスポート機能)との連携
|
|
138
211
|
|
|
212
|
+
### PNG / PDF エクスポート (`@mogura/moguchart-plugin-export`)
|
|
213
|
+
|
|
139
214
|
PNG や PDF のエクスポートを行う場合は、`@mogura/moguchart-plugin-export` を組み合わせます。
|
|
140
215
|
|
|
141
216
|
```tsx
|
|
@@ -164,9 +239,60 @@ export function ExportableGantt() {
|
|
|
164
239
|
}
|
|
165
240
|
}
|
|
166
241
|
|
|
242
|
+
const handleExportPdf = async () => {
|
|
243
|
+
if (chartRef.current) {
|
|
244
|
+
await chartRef.current.exportImage('pdf', {
|
|
245
|
+
filename: 'my-schedule',
|
|
246
|
+
download: true,
|
|
247
|
+
})
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
167
251
|
return (
|
|
168
252
|
<div>
|
|
169
253
|
<button onClick={handleExportPng}>PNGダウンロード</button>
|
|
254
|
+
<button onClick={handleExportPdf}>PDFダウンロード</button>
|
|
255
|
+
<GanttChart ref={chartRef} rows={[]} option={option} />
|
|
256
|
+
</div>
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Excel (.xlsx) タイムライン工程表エクスポート (`@mogura/moguchart-plugin-excel`)
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
import React, { useRef } from 'react'
|
|
265
|
+
import { GanttChart, type GanttChartElement, type GanttChartOption } from '@mogura/moguchart-react'
|
|
266
|
+
import { excelPlugin } from '@mogura/moguchart-plugin-excel'
|
|
267
|
+
|
|
268
|
+
export function ExcelExportGantt() {
|
|
269
|
+
const chartRef = useRef<GanttChartElement>(null)
|
|
270
|
+
|
|
271
|
+
const option: GanttChartOption = {
|
|
272
|
+
calendar: {
|
|
273
|
+
start: new Date('2026-04-01'),
|
|
274
|
+
end: new Date('2026-04-30'),
|
|
275
|
+
},
|
|
276
|
+
plugins: [excelPlugin({
|
|
277
|
+
defaultFilename: 'プロジェクト工程表.xlsx',
|
|
278
|
+
defaultSheetName: '工程表',
|
|
279
|
+
themeColor: '#3B82F6',
|
|
280
|
+
})],
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const handleExportExcel = async () => {
|
|
284
|
+
if (chartRef.current) {
|
|
285
|
+
await chartRef.current.exportExcel({
|
|
286
|
+
filename: '工程表_最新.xlsx',
|
|
287
|
+
locale: 'ja', // 'ja' | 'en' | 'zh'
|
|
288
|
+
download: true,
|
|
289
|
+
})
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return (
|
|
294
|
+
<div>
|
|
295
|
+
<button onClick={handleExportExcel}>Excel工程表ダウンロード</button>
|
|
170
296
|
<GanttChart ref={chartRef} rows={[]} option={option} />
|
|
171
297
|
</div>
|
|
172
298
|
)
|
|
@@ -177,37 +303,39 @@ export function ExportableGantt() {
|
|
|
177
303
|
|
|
178
304
|
## サポートされているイベント
|
|
179
305
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
|
183
|
-
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
204
|
-
| `
|
|
205
|
-
| `
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
306
|
+
React では標準のイベント Props としてキャメルケース(`onTaskUpdate` 等)で購読できます:
|
|
307
|
+
|
|
308
|
+
| Prop 名 | 説明 | イベント引数型 |
|
|
309
|
+
|---|---|---|
|
|
310
|
+
| `onTaskUpdate` | タスクのドラッグ移動やリサイズ完了時 | `CustomEvent<TaskUpdateEventDetail>` |
|
|
311
|
+
| `onTaskClick` | タスククリック時 | `CustomEvent<TaskClickEventDetail>` |
|
|
312
|
+
| `onTaskDblClick` | タスクダブルクリック時 | `CustomEvent<TaskClickEventDetail>` |
|
|
313
|
+
| `onTaskContextMenu` | タスク右クリック(コンテキストメニュー)時 | `CustomEvent<TaskContextMenuEventDetail>` |
|
|
314
|
+
| `onTaskDelete` | タスク削除時 | `CustomEvent<TaskDeleteEventDetail>` |
|
|
315
|
+
| `onTaskDrop` | タスクを行間等にドロップした時 | `CustomEvent<TaskDropEventDetail>` |
|
|
316
|
+
| `onTaskProgressChange` | 進捗率変更時 | `CustomEvent<TaskProgressChangeEventDetail>` |
|
|
317
|
+
| `onBarHover` | タスクバーホバー時 | `CustomEvent<BarHoverEventDetail>` |
|
|
318
|
+
| `onBarSelectionChange` | タスク選択状態の変更時 | `CustomEvent<BarSelectionChangeEventDetail>` |
|
|
319
|
+
| `onRowHeaderClick` | 行ヘッダークリック時 | `CustomEvent<RowHeaderClickEventDetail>` |
|
|
320
|
+
| `onRowHeaderDblClick` | 行ヘッダーダブルクリック時(`contentTarget` で行名要素を参照可能) | `CustomEvent<RowHeaderDblClickEventDetail>` |
|
|
321
|
+
| `onRowHeaderContextMenu` | 行ヘッダー右クリック時 | `CustomEvent<RowHeaderContextMenuEventDetail>` |
|
|
322
|
+
| `onRowHeaderResize` | 行ヘッダーリサイズ時 | `CustomEvent<RowHeaderResizeEventDetail>` |
|
|
323
|
+
| `onRowReordered` | 行の並び順変更時 | `CustomEvent<RowReorderEventDetail>` |
|
|
324
|
+
| `onRowSelectionChange` | 行選択状態の変更時 | `CustomEvent<RowSelectionChangeEventDetail>` |
|
|
325
|
+
| `onRowToggleCollapse` | 行の開閉時(WBS) | `CustomEvent<RowToggleCollapseEventDetail>` |
|
|
326
|
+
| `onDependencyCreate` | 依存関係(リンク)作成時 | `CustomEvent<DependencyCreateEventDetail>` |
|
|
327
|
+
| `onDependencyClick` | 依存関係クリック時 | `CustomEvent<DependencyClickEventDetail>` |
|
|
328
|
+
| `onDependencySelect` | 依存関係の選択状態変更時(ハイライト・削除ボタン表示) | `CustomEvent<DependencySelectEventDetail>` |
|
|
329
|
+
| `onDependencyDelete` | 依存関係削除時 | `CustomEvent<DependencyDeleteEventDetail>` |
|
|
330
|
+
| `onMarkerDblClick` | マーカーダブルクリック時 | `CustomEvent<MarkerDblClickEventDetail>` |
|
|
331
|
+
| `onMarkerContextMenu` | マーカー右クリック時 | `CustomEvent<MarkerContextMenuEventDetail>` |
|
|
332
|
+
| `onZoomChange` | ズーム倍率変更時 | `CustomEvent<ZoomChangeEventDetail>` |
|
|
333
|
+
| `onCommand` | 操作コマンド実行時(Undo / Redo 対象の操作完了時) | `CustomEvent<CommandEventDetail>` |
|
|
334
|
+
| `onHistoryChange` | 履歴スタック変更時(Undo / Redo 可否状態の更新時) | `CustomEvent<HistoryChangeEventDetail>` |
|
|
335
|
+
| `onMinimapMove` | ミニマップスクロール時 | `CustomEvent<MinimapMoveEventDetail>` |
|
|
336
|
+
| `onMinimapResize` | ミニマップリサイズ時 | `CustomEvent<MinimapResizeEventDetail>` |
|
|
337
|
+
| `onMinimapCollapse` | ミニマップ折りたたみ時 | `CustomEvent<MinimapCollapseEventDetail>` |
|
|
338
|
+
| `onChartContextMenu` | チャート背景右クリック時 | `CustomEvent<ChartContextMenuEventDetail>` |
|
|
211
339
|
|
|
212
340
|
---
|
|
213
341
|
|
package/README.md
CHANGED
|
@@ -13,7 +13,9 @@ Built on top of Lit's official `@lit/react`, it combines the high performance an
|
|
|
13
13
|
- ⚛️ **Native React Experience**: Declarative JSX props and event handlers
|
|
14
14
|
- 🎯 **Full Type Safety**: Complete TypeScript auto-completion for props and events
|
|
15
15
|
- 🔄 **Lifecycle Synchronization**: Automatic synchronization between React state/props and Web Component rendering
|
|
16
|
-
- ⚡ **Imperative API Access**: Directly access methods like `chart.use()`, `chart.exportImage()`, `chart.selectTask()` via `ref`
|
|
16
|
+
- ⚡ **Imperative API Access**: Directly access methods like `chart.use()`, `chart.exportImage()`, `chart.exportExcel()`, `chart.selectTask()` via `ref`
|
|
17
|
+
- 🔌 **Plugin Support**: Seamless integration with `@mogura/moguchart-plugin-export` (PNG/PDF) and `@mogura/moguchart-plugin-excel` (Excel)
|
|
18
|
+
- 📈 **Baseline & Delay Tracking**: Compare planned schedules (`task.baseline`) against actual timelines with automatic delay highlighting and variance tooltips
|
|
17
19
|
- 📦 **Re-exported Types**: Core types, constants, and utilities are all re-exported from this package
|
|
18
20
|
|
|
19
21
|
---
|
|
@@ -128,15 +130,88 @@ export function GanttToolbar() {
|
|
|
128
130
|
<button onClick={() => chartRef.current?.zoomIn()}>Zoom In</button>
|
|
129
131
|
<button onClick={() => chartRef.current?.zoomOut()}>Zoom Out</button>
|
|
130
132
|
<button onClick={() => chartRef.current?.resetZoom()}>Reset Zoom</button>
|
|
133
|
+
<button onClick={() => chartRef.current?.scrollToTask('task-1')}>Scroll to Task</button>
|
|
131
134
|
<GanttChart ref={chartRef} rows={[]} />
|
|
132
135
|
</div>
|
|
133
136
|
)
|
|
134
137
|
}
|
|
135
138
|
```
|
|
136
139
|
|
|
140
|
+
### Available Methods & Properties
|
|
141
|
+
|
|
142
|
+
The following methods can be invoked directly on `ref.current`:
|
|
143
|
+
|
|
144
|
+
- **Operation History (Undo / Redo)**: `undo()`, `redo()`, `clearHistory()`, `recordCommand(cmd)`, `canUndo`, `canRedo`
|
|
145
|
+
- **Zoom Operations**: `zoomIn()`, `zoomOut()`, `zoomToPercent(percent)`, `zoomToScale(scale)`, `resetZoom()`, `zoomToFit()`, `getZoomPercent()`, `getZoomScale()`
|
|
146
|
+
- **Scroll & Selection**: `scrollToTask(taskId)`, `scrollToPosition(pos)`, `resetScroll()`, `selectTask(taskId)`
|
|
147
|
+
- **WBS & Collapse**: `toggleRowCollapse(rowId, collapsed?)`, `collapseAll()`, `expandAll()`, `getRowPositions()`
|
|
148
|
+
- **Dependency Operations**: `triggerDependencyDelete(sourceTaskId, targetTaskId)`, `selectDependency(...)`, `clearDependencySelection()`
|
|
149
|
+
- **Image & PDF Export**: `exportImage(format, options)` (with `@mogura/moguchart-plugin-export`)
|
|
150
|
+
- **Excel Export**: `exportExcel(options)` (with `@mogura/moguchart-plugin-excel`)
|
|
151
|
+
|
|
137
152
|
---
|
|
138
153
|
|
|
139
|
-
##
|
|
154
|
+
## Baseline & Schedule Variance Tracking (Plan vs. Actual)
|
|
155
|
+
|
|
156
|
+
Provide a baseline schedule on tasks (`task.baseline`) and configure `option.baseline` to visually compare planned timelines against current actual progress. Delayed tasks (`task.end > baseline.end`) are automatically highlighted with accent indicator lines and detailed variance tooltips.
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
import React, { useState } from 'react'
|
|
160
|
+
import {
|
|
161
|
+
GanttChart,
|
|
162
|
+
type GanttRow,
|
|
163
|
+
type GanttChartOption,
|
|
164
|
+
} from '@mogura/moguchart-react'
|
|
165
|
+
|
|
166
|
+
export function BaselineGanttView() {
|
|
167
|
+
const [rows] = useState<GanttRow[]>([
|
|
168
|
+
{
|
|
169
|
+
id: 'row-1',
|
|
170
|
+
name: 'Development Phase',
|
|
171
|
+
tasks: [
|
|
172
|
+
{
|
|
173
|
+
id: 'task-1',
|
|
174
|
+
name: 'Core Features',
|
|
175
|
+
start: new Date('2026-04-05'),
|
|
176
|
+
end: new Date('2026-04-18'), // Delayed beyond original plan
|
|
177
|
+
progress: 60,
|
|
178
|
+
baseline: {
|
|
179
|
+
start: new Date('2026-04-01'),
|
|
180
|
+
end: new Date('2026-04-12'),
|
|
181
|
+
progress: 100,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
])
|
|
187
|
+
|
|
188
|
+
const option: GanttChartOption = {
|
|
189
|
+
calendar: {
|
|
190
|
+
start: new Date('2026-04-01'),
|
|
191
|
+
end: new Date('2026-04-30'),
|
|
192
|
+
pxPerDay: 40,
|
|
193
|
+
},
|
|
194
|
+
baseline: {
|
|
195
|
+
visible: true, // Enable baseline rendering
|
|
196
|
+
position: 'bottom', // 'bottom' | 'top' | 'overlay'
|
|
197
|
+
highlightDelay: true, // Visually highlight delayed tasks
|
|
198
|
+
delayColor: '#EF4444', // Custom accent color for delay indicators
|
|
199
|
+
},
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<div style={{ width: '100%', height: '500px' }}>
|
|
204
|
+
<GanttChart rows={rows} option={option} />
|
|
205
|
+
</div>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Using with Plugins (Export, Excel, etc.)
|
|
213
|
+
|
|
214
|
+
### PNG / PDF Export (`@mogura/moguchart-plugin-export`)
|
|
140
215
|
|
|
141
216
|
To export charts as PNG or PDF, pair with `@mogura/moguchart-plugin-export`:
|
|
142
217
|
|
|
@@ -166,9 +241,60 @@ export function ExportableGantt() {
|
|
|
166
241
|
}
|
|
167
242
|
}
|
|
168
243
|
|
|
244
|
+
const handleExportPdf = async () => {
|
|
245
|
+
if (chartRef.current) {
|
|
246
|
+
await chartRef.current.exportImage('pdf', {
|
|
247
|
+
filename: 'my-schedule',
|
|
248
|
+
download: true,
|
|
249
|
+
})
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
169
253
|
return (
|
|
170
254
|
<div>
|
|
171
255
|
<button onClick={handleExportPng}>Download PNG</button>
|
|
256
|
+
<button onClick={handleExportPdf}>Download PDF</button>
|
|
257
|
+
<GanttChart ref={chartRef} rows={[]} option={option} />
|
|
258
|
+
</div>
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Excel (.xlsx) Timeline Spreadsheet Export (`@mogura/moguchart-plugin-excel`)
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
import React, { useRef } from 'react'
|
|
267
|
+
import { GanttChart, type GanttChartElement, type GanttChartOption } from '@mogura/moguchart-react'
|
|
268
|
+
import { excelPlugin } from '@mogura/moguchart-plugin-excel'
|
|
269
|
+
|
|
270
|
+
export function ExcelExportGantt() {
|
|
271
|
+
const chartRef = useRef<GanttChartElement>(null)
|
|
272
|
+
|
|
273
|
+
const option: GanttChartOption = {
|
|
274
|
+
calendar: {
|
|
275
|
+
start: new Date('2026-04-01'),
|
|
276
|
+
end: new Date('2026-04-30'),
|
|
277
|
+
},
|
|
278
|
+
plugins: [excelPlugin({
|
|
279
|
+
defaultFilename: 'project-schedule.xlsx',
|
|
280
|
+
defaultSheetName: 'Schedule',
|
|
281
|
+
themeColor: '#3B82F6',
|
|
282
|
+
})],
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const handleExportExcel = async () => {
|
|
286
|
+
if (chartRef.current) {
|
|
287
|
+
await chartRef.current.exportExcel({
|
|
288
|
+
filename: 'schedule-latest.xlsx',
|
|
289
|
+
locale: 'en', // 'en' | 'ja' | 'zh'
|
|
290
|
+
download: true,
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return (
|
|
296
|
+
<div>
|
|
297
|
+
<button onClick={handleExportExcel}>Download Excel Schedule</button>
|
|
172
298
|
<GanttChart ref={chartRef} rows={[]} option={option} />
|
|
173
299
|
</div>
|
|
174
300
|
)
|
|
@@ -179,37 +305,39 @@ export function ExportableGantt() {
|
|
|
179
305
|
|
|
180
306
|
## Supported Events
|
|
181
307
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
|
185
|
-
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
204
|
-
| `
|
|
205
|
-
| `
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
308
|
+
Events dispatched by `@mogura/moguchart-core` can be listened to via standard camelCase React props:
|
|
309
|
+
|
|
310
|
+
| Prop | Description | Event Argument Type |
|
|
311
|
+
|---|---|---|
|
|
312
|
+
| `onTaskUpdate` | Fired when a task is moved or resized | `CustomEvent<TaskUpdateEventDetail>` |
|
|
313
|
+
| `onTaskClick` | Fired when a task is clicked | `CustomEvent<TaskClickEventDetail>` |
|
|
314
|
+
| `onTaskDblClick` | Fired when a task is double-clicked | `CustomEvent<TaskClickEventDetail>` |
|
|
315
|
+
| `onTaskContextMenu` | Fired on task right-click | `CustomEvent<TaskContextMenuEventDetail>` |
|
|
316
|
+
| `onTaskDelete` | Fired when a task is deleted | `CustomEvent<TaskDeleteEventDetail>` |
|
|
317
|
+
| `onTaskDrop` | Fired when a task is dropped | `CustomEvent<TaskDropEventDetail>` |
|
|
318
|
+
| `onTaskProgressChange` | Fired when task progress percentage changes | `CustomEvent<TaskProgressChangeEventDetail>` |
|
|
319
|
+
| `onBarHover` | Fired when a task bar is hovered | `CustomEvent<BarHoverEventDetail>` |
|
|
320
|
+
| `onBarSelectionChange` | Fired when task bar selection changes | `CustomEvent<BarSelectionChangeEventDetail>` |
|
|
321
|
+
| `onRowHeaderClick` | Fired when a row header is clicked | `CustomEvent<RowHeaderClickEventDetail>` |
|
|
322
|
+
| `onRowHeaderDblClick` | Fired when a row header is double-clicked (`contentTarget` exposes row name container) | `CustomEvent<RowHeaderDblClickEventDetail>` |
|
|
323
|
+
| `onRowHeaderContextMenu` | Fired on row header right-click | `CustomEvent<RowHeaderContextMenuEventDetail>` |
|
|
324
|
+
| `onRowHeaderResize` | Fired when a row header is resized | `CustomEvent<RowHeaderResizeEventDetail>` |
|
|
325
|
+
| `onRowReordered` | Fired when rows are reordered | `CustomEvent<RowReorderEventDetail>` |
|
|
326
|
+
| `onRowSelectionChange` | Fired when row selection changes | `CustomEvent<RowSelectionChangeEventDetail>` |
|
|
327
|
+
| `onRowToggleCollapse` | Fired when a row is expanded or collapsed (WBS) | `CustomEvent<RowToggleCollapseEventDetail>` |
|
|
328
|
+
| `onDependencyCreate` | Fired when a dependency link is created | `CustomEvent<DependencyCreateEventDetail>` |
|
|
329
|
+
| `onDependencyClick` | Fired when a dependency link is clicked | `CustomEvent<DependencyClickEventDetail>` |
|
|
330
|
+
| `onDependencySelect` | Fired when dependency selection changes (highlight / delete button shown) | `CustomEvent<DependencySelectEventDetail>` |
|
|
331
|
+
| `onDependencyDelete` | Fired when a dependency link is deleted | `CustomEvent<DependencyDeleteEventDetail>` |
|
|
332
|
+
| `onMarkerDblClick` | Fired when a marker is double-clicked | `CustomEvent<MarkerDblClickEventDetail>` |
|
|
333
|
+
| `onMarkerContextMenu` | Fired on marker right-click | `CustomEvent<MarkerContextMenuEventDetail>` |
|
|
334
|
+
| `onZoomChange` | Fired when zoom scale changes | `CustomEvent<ZoomChangeEventDetail>` |
|
|
335
|
+
| `onCommand` | Fired when a command is executed (tracked for Undo/Redo) | `CustomEvent<CommandEventDetail>` |
|
|
336
|
+
| `onHistoryChange` | Fired when history stack changes (`canUndo`/`canRedo` updated) | `CustomEvent<HistoryChangeEventDetail>` |
|
|
337
|
+
| `onMinimapMove` | Fired when minimap viewport scrolls | `CustomEvent<MinimapMoveEventDetail>` |
|
|
338
|
+
| `onMinimapResize` | Minimap is resized | `CustomEvent<MinimapResizeEventDetail>` |
|
|
339
|
+
| `onMinimapCollapse` | Minimap is collapsed or expanded | `CustomEvent<MinimapCollapseEventDetail>` |
|
|
340
|
+
| `onChartContextMenu` | Fired on chart background right-click | `CustomEvent<ChartContextMenuEventDetail>` |
|
|
213
341
|
|
|
214
342
|
---
|
|
215
343
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mogura/moguchart-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "React wrapper for @mogura/moguchart-core Gantt chart component",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Murakami Hiroyuki",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": "^18.0.0 || ^19.0.0",
|
|
43
43
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
44
|
-
"@mogura/moguchart-core": "1.
|
|
44
|
+
"@mogura/moguchart-core": "1.4.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@lit/react": "^1.0.8"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"typescript": "^5.9.3",
|
|
58
58
|
"vite": "^8.0.0",
|
|
59
59
|
"vitest": "^3.0.0",
|
|
60
|
-
"@mogura/moguchart-core": "1.
|
|
60
|
+
"@mogura/moguchart-core": "1.4.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "vite build && pnpm exec tsc -p tsconfig.build.json",
|