@mogura/moguchart-core 0.5.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/LICENSE +21 -0
- package/README.en.md +491 -0
- package/README.md +470 -0
- package/dist/components/gantt-bar.d.ts +38 -0
- package/dist/components/gantt-calendar.d.ts +43 -0
- package/dist/components/gantt-chart-dependency-path.d.ts +15 -0
- package/dist/components/gantt-chart-export.d.ts +20 -0
- package/dist/components/gantt-chart-styles.d.ts +11 -0
- package/dist/components/gantt-chart.d.ts +169 -0
- package/dist/components/gantt-row-background.d.ts +21 -0
- package/dist/components/gantt-row.d.ts +53 -0
- package/dist/core/constants.d.ts +14 -0
- package/dist/core/i18n.d.ts +52 -0
- package/dist/core/patterns.d.ts +21 -0
- package/dist/core/theme.d.ts +2 -0
- package/dist/core/types.d.ts +612 -0
- package/dist/core/utils.d.ts +57 -0
- package/dist/favicon.png +0 -0
- package/dist/index.d.ts +7 -0
- package/dist/moguchart-core.mjs +3163 -0
- package/dist/moguchart-core.umd.js +1115 -0
- package/package.json +76 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { GanttChartOption, GanttRow, GanttTask } from '../core/types';
|
|
2
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
3
|
+
import './gantt-calendar';
|
|
4
|
+
import './gantt-row';
|
|
5
|
+
import { type ExportImageOptions } from './gantt-chart-export';
|
|
6
|
+
export declare class GanttChartElement extends LitElement {
|
|
7
|
+
rows: GanttRow[];
|
|
8
|
+
option: GanttChartOption;
|
|
9
|
+
theme: 'light' | 'dark';
|
|
10
|
+
selectedRowIds: string[];
|
|
11
|
+
selectedTaskIds: string[];
|
|
12
|
+
externalDraggingTask: GanttTask | null;
|
|
13
|
+
private selectedRows;
|
|
14
|
+
private selectedTasks;
|
|
15
|
+
private lastClickedRowId;
|
|
16
|
+
private virtualScrollTop;
|
|
17
|
+
private dragTargetRowIndex;
|
|
18
|
+
private draggingTask;
|
|
19
|
+
private draggingTaskIds;
|
|
20
|
+
private multiDragDx;
|
|
21
|
+
private viewportHeight;
|
|
22
|
+
private dragOverlayInfo;
|
|
23
|
+
private calendarHeight;
|
|
24
|
+
private tooltip;
|
|
25
|
+
private dragOverRowId;
|
|
26
|
+
private dragOverPosition;
|
|
27
|
+
private hoverTimer;
|
|
28
|
+
private currentTime;
|
|
29
|
+
private dragPreview;
|
|
30
|
+
private currentRowHeaderWidth;
|
|
31
|
+
private isResizingHeader;
|
|
32
|
+
private hoveredMilestoneId;
|
|
33
|
+
private cursorLineX;
|
|
34
|
+
private connectorDrag;
|
|
35
|
+
private _systemThemeMediaQuery;
|
|
36
|
+
private isExporting;
|
|
37
|
+
private focusedTaskId;
|
|
38
|
+
private focusedRowId;
|
|
39
|
+
private _layoutCache;
|
|
40
|
+
private resizeObserver;
|
|
41
|
+
private _cachedSelectedTaskIds;
|
|
42
|
+
private _cachedSelectedTasksSize;
|
|
43
|
+
private _cachedCurrentOption;
|
|
44
|
+
private _lastOptionRef;
|
|
45
|
+
private _lastLabelWidth;
|
|
46
|
+
private get displayRows();
|
|
47
|
+
static styles: import("lit").CSSResult;
|
|
48
|
+
protected firstUpdated(): void;
|
|
49
|
+
connectedCallback(): void;
|
|
50
|
+
disconnectedCallback(): void;
|
|
51
|
+
private handleSystemThemeChange;
|
|
52
|
+
protected willUpdate(changedProperties: PropertyValues): void;
|
|
53
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
54
|
+
/**
|
|
55
|
+
* ドラッグオーバーレイを直接DOM操作で更新する。
|
|
56
|
+
* @state() を使わないことで、Litの再レンダリングサイクルを回避する。
|
|
57
|
+
*/
|
|
58
|
+
private updateDragOverlay;
|
|
59
|
+
private hideDragOverlay;
|
|
60
|
+
private currentTimeTimer;
|
|
61
|
+
private setupCurrentTimeTimer;
|
|
62
|
+
private stopCurrentTimeTimer;
|
|
63
|
+
private handleHeaderResizeStart;
|
|
64
|
+
private handleScroll;
|
|
65
|
+
private updateScrollTop;
|
|
66
|
+
private handleContainerMouseMove;
|
|
67
|
+
private handleContainerMouseLeave;
|
|
68
|
+
private getDateX;
|
|
69
|
+
private calculateLayout;
|
|
70
|
+
/**
|
|
71
|
+
* 複数バー移動かどうかを判定する。
|
|
72
|
+
* ドラッグ中のバーが選択中バーに含まれ、選択数が2以上の場合にtrue。
|
|
73
|
+
*/
|
|
74
|
+
private isMultiDrag;
|
|
75
|
+
private handleTaskUpdate;
|
|
76
|
+
private handleBarMouseEnter;
|
|
77
|
+
private handleBarMouseLeave;
|
|
78
|
+
private reorderRows;
|
|
79
|
+
private handleContainerDragOver;
|
|
80
|
+
private handleContainerDragLeave;
|
|
81
|
+
private handleContainerDrop;
|
|
82
|
+
private handleExternalTaskDrop;
|
|
83
|
+
private handleRowClicked;
|
|
84
|
+
private handleRowContextMenu;
|
|
85
|
+
private handleContainerClick;
|
|
86
|
+
private handleContainerContextMenu;
|
|
87
|
+
/**
|
|
88
|
+
* クライアント座標から対応する行IDと日付を返す。
|
|
89
|
+
* コンポーネント外部から呼び出すための公開メソッド。
|
|
90
|
+
*/
|
|
91
|
+
hitTest(clientX: number, clientY: number): {
|
|
92
|
+
rowId: string;
|
|
93
|
+
date: Date;
|
|
94
|
+
} | null;
|
|
95
|
+
/**
|
|
96
|
+
* html2canvas を使用してガントチャートを画像としてエクスポートする。
|
|
97
|
+
* (Shadow DOMネイティブ対応版 html2canvas-pro を使用)
|
|
98
|
+
*
|
|
99
|
+
* @param options エクスポートオプション。
|
|
100
|
+
*/
|
|
101
|
+
exportImage(format?: 'png' | 'pdf', options?: ExportImageOptions): Promise<string | Blob>;
|
|
102
|
+
private clearSelection;
|
|
103
|
+
private handleKeyDown;
|
|
104
|
+
/**
|
|
105
|
+
* 水平方向にフォーカスを移動する(同一行内のタスク間、または次/前行へ)
|
|
106
|
+
*/
|
|
107
|
+
private moveFocusHorizontal;
|
|
108
|
+
/**
|
|
109
|
+
* 垂直方向にフォーカスを移動する(行をまたぐ)
|
|
110
|
+
*/
|
|
111
|
+
private moveFocusVertical;
|
|
112
|
+
/**
|
|
113
|
+
* 最初にタスクを持つ行の最初のタスクにフォーカスする
|
|
114
|
+
*/
|
|
115
|
+
private focusFirstAvailableTask;
|
|
116
|
+
/**
|
|
117
|
+
* 現在の行の最初または最後のタスクにフォーカスする
|
|
118
|
+
*/
|
|
119
|
+
private focusFirstOrLastTaskInRow;
|
|
120
|
+
/**
|
|
121
|
+
* フォーカスを設定し、必要に応じてスクロールする
|
|
122
|
+
*/
|
|
123
|
+
private setFocus;
|
|
124
|
+
/**
|
|
125
|
+
* タスクの選択をトグルする(Ctrl/Cmd+Enter)
|
|
126
|
+
*/
|
|
127
|
+
private toggleTaskSelection;
|
|
128
|
+
/**
|
|
129
|
+
* 単一タスクを選択する(Enter/Space)
|
|
130
|
+
*/
|
|
131
|
+
private selectSingleTask;
|
|
132
|
+
/**
|
|
133
|
+
* Shift+矢印キーで選択中タスクを移動する
|
|
134
|
+
*/
|
|
135
|
+
private moveSelectedTasksByKeyboard;
|
|
136
|
+
private handleBarClick;
|
|
137
|
+
private handleBarContextMenu;
|
|
138
|
+
private handleConnectorDragStart;
|
|
139
|
+
private handleConnectorDragMove;
|
|
140
|
+
private handleConnectorDragEnd;
|
|
141
|
+
/**
|
|
142
|
+
* 指定タスクIDのgantt-bar要素にconnectorDropTarget属性をセットする
|
|
143
|
+
*/
|
|
144
|
+
private _setConnectorDropTarget;
|
|
145
|
+
/**
|
|
146
|
+
* 依存関係線がクリックされた時のハンドラ。
|
|
147
|
+
* dependency-removeイベントを発火する。
|
|
148
|
+
* @param targetTaskId 依存を持つタスクのID(矢印の先)
|
|
149
|
+
* @param sourceTaskId 依存元のタスクのID(矢印の根元)
|
|
150
|
+
*/
|
|
151
|
+
private handleDependencyLineClick;
|
|
152
|
+
/**
|
|
153
|
+
* 外部からタスクIDを指定してタスクを選択状態にし、
|
|
154
|
+
* 表示範囲外の場合はスクロールして表示する。
|
|
155
|
+
* @param taskId 選択するタスクのID
|
|
156
|
+
* @returns タスクが見つかり選択できた場合はtrue、見つからなかった場合はfalse
|
|
157
|
+
*/
|
|
158
|
+
selectTask(taskId: string): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* 指定タスクが表示範囲外の場合にスクロールして表示する
|
|
161
|
+
*/
|
|
162
|
+
private scrollToTask;
|
|
163
|
+
render(): import("lit").TemplateResult<1>;
|
|
164
|
+
}
|
|
165
|
+
declare global {
|
|
166
|
+
interface HTMLElementTagNameMap {
|
|
167
|
+
'gantt-chart': GanttChartElement;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import type { GanttChartOption } from '../core/types';
|
|
3
|
+
export declare class GanttRowBackgroundElement extends LitElement {
|
|
4
|
+
option: GanttChartOption;
|
|
5
|
+
theme: 'light' | 'dark';
|
|
6
|
+
rowId: string;
|
|
7
|
+
private get totalDays();
|
|
8
|
+
private _cachedCells;
|
|
9
|
+
private _cachedCellsStartTime;
|
|
10
|
+
private _cachedCellsEndTime;
|
|
11
|
+
private _cachedCellsPxPerDay;
|
|
12
|
+
private _cachedCellsPxPerMonth;
|
|
13
|
+
private _cachedCellsTheme;
|
|
14
|
+
static styles: import("lit").CSSResult;
|
|
15
|
+
render(): import("lit").TemplateResult<1>;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
'gantt-row-background': GanttRowBackgroundElement;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { GanttChartOption, GanttRow, GanttTask, GanttTaskMoveMode } from '../core/types';
|
|
2
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
3
|
+
import './gantt-bar';
|
|
4
|
+
import './gantt-row-background';
|
|
5
|
+
export declare class GanttRowElement extends LitElement {
|
|
6
|
+
row: GanttRow;
|
|
7
|
+
option: GanttChartOption;
|
|
8
|
+
isDragTarget: boolean;
|
|
9
|
+
draggingTask: {
|
|
10
|
+
id: string;
|
|
11
|
+
start: Date;
|
|
12
|
+
end: Date;
|
|
13
|
+
name?: string;
|
|
14
|
+
currentStart?: Date;
|
|
15
|
+
currentEnd?: Date;
|
|
16
|
+
mode?: GanttTaskMoveMode;
|
|
17
|
+
} | null;
|
|
18
|
+
draggingTaskIds: string[];
|
|
19
|
+
multiDragDx: number;
|
|
20
|
+
externalDragTask: {
|
|
21
|
+
task: GanttTask;
|
|
22
|
+
currentStart: Date;
|
|
23
|
+
currentEnd: Date;
|
|
24
|
+
} | null;
|
|
25
|
+
theme: 'light' | 'dark';
|
|
26
|
+
isSelected: boolean;
|
|
27
|
+
dropPosition: 'top' | 'bottom' | null;
|
|
28
|
+
selectedTaskIds: string[];
|
|
29
|
+
focusedTaskId: string | null;
|
|
30
|
+
isExporting: boolean;
|
|
31
|
+
private _cachedMonthGridLines;
|
|
32
|
+
private _cachedMonthGridStartTime;
|
|
33
|
+
private _cachedMonthGridEndTime;
|
|
34
|
+
private _cachedMonthGridPxPerDay;
|
|
35
|
+
private _cachedMonthGridPxPerMonth;
|
|
36
|
+
private getDateX;
|
|
37
|
+
/**
|
|
38
|
+
* マーカーのSVGパスを生成する
|
|
39
|
+
*/
|
|
40
|
+
private getMarkerPath;
|
|
41
|
+
static styles: import("lit").CSSResult;
|
|
42
|
+
private handleDragStart;
|
|
43
|
+
private handleHeaderClick;
|
|
44
|
+
private handleHeaderContextMenu;
|
|
45
|
+
private handleHeaderDblClick;
|
|
46
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
47
|
+
render(): import("lit").TemplateResult<1>;
|
|
48
|
+
}
|
|
49
|
+
declare global {
|
|
50
|
+
interface HTMLElementTagNameMap {
|
|
51
|
+
'gantt-row': GanttRowElement;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const DEFAULT_ROW_HEADER_WIDTH = 150;
|
|
2
|
+
export declare const DEFAULT_MONTH_FORMAT = "YYYY\u5E74M\u6708";
|
|
3
|
+
export declare const DEFAULT_BAR_HEIGHT = 28;
|
|
4
|
+
export declare const DEFAULT_BAR_MARGIN = 4;
|
|
5
|
+
export declare const DEFAULT_BAR_CORNER_RADIUS = 4;
|
|
6
|
+
export declare const DEFAULT_COLOR: {
|
|
7
|
+
BAR: string;
|
|
8
|
+
LABEL_BACKGROUND: string;
|
|
9
|
+
SATURDAY: string;
|
|
10
|
+
SUNDAY: string;
|
|
11
|
+
HOLIDAY: string;
|
|
12
|
+
BORDER: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const DEFAULT_BAR_COLOR: string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* moguchart-coreのロケール定義インターフェース。
|
|
3
|
+
* 新しい言語を追加するには、このインターフェースに準拠したオブジェクトを作成し、
|
|
4
|
+
* GanttChartOption.locale に渡してください。
|
|
5
|
+
*/
|
|
6
|
+
export interface MoguchartLocale {
|
|
7
|
+
/** デフォルトの月表示フォーマット (dayjs互換フォーマット文字列) */
|
|
8
|
+
monthFormat: string;
|
|
9
|
+
/** 月単位モードの月表示フォーマット (dayjs互換フォーマット文字列、例: 'M月' / 'MMM') */
|
|
10
|
+
monthRowFormat: string;
|
|
11
|
+
/** 日付のフォーマット関数 (例: "2024/1/15" / "1/15/2024") */
|
|
12
|
+
dateFormat: (date: Date) => string;
|
|
13
|
+
/** 時間単位モードの日付フォーマット関数 */
|
|
14
|
+
timeUnitDateFormat: (date: Date) => string;
|
|
15
|
+
/** 日時のフォーマット関数(時刻が00:00でない場合に使用) */
|
|
16
|
+
dateTimeFormat: (date: Date) => string;
|
|
17
|
+
/** 年月のみのフォーマット関数 (月単位モードのツールチップ・ドラッグオーバーレイで使用) */
|
|
18
|
+
yearMonthFormat: (date: Date) => string;
|
|
19
|
+
/** 期間フォーマット */
|
|
20
|
+
duration: {
|
|
21
|
+
/** 日数のフォーマット (例: 3 → "3日" / "3 days") */
|
|
22
|
+
days: (n: number) => string;
|
|
23
|
+
/** 時間のフォーマット (例: 2 → "2時間" / "2 hours") */
|
|
24
|
+
hours: (n: number) => string;
|
|
25
|
+
/** 分のフォーマット (例: 30 → "30分" / "30 minutes") */
|
|
26
|
+
minutes: (n: number) => string;
|
|
27
|
+
/** 期間がゼロの場合の表示 */
|
|
28
|
+
zero: string;
|
|
29
|
+
};
|
|
30
|
+
/** ツールチップのデフォルト文字列 */
|
|
31
|
+
tooltip: {
|
|
32
|
+
/** 所要日数の表示 (例: 5 → "所要日数: 5日" / "Duration: 5 days") */
|
|
33
|
+
duration: (days: number) => string;
|
|
34
|
+
};
|
|
35
|
+
/** ドラッグオーバーレイの文字列 */
|
|
36
|
+
dragOverlay: {
|
|
37
|
+
/** タイトル未設定時のフォールバック */
|
|
38
|
+
noTitle: string;
|
|
39
|
+
/** 移動先の表示 (例: "移動先: Row1" / "Move to: Row1") */
|
|
40
|
+
moveTo: (name: string) => string;
|
|
41
|
+
/** 複数タスク移動中の表示 (例: "3件のタスクを移動中" / "Moving 3 tasks") */
|
|
42
|
+
movingTasks: (count: number) => string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 日本語ロケール (デフォルト)
|
|
47
|
+
*/
|
|
48
|
+
export declare const jaLocale: MoguchartLocale;
|
|
49
|
+
/**
|
|
50
|
+
* 英語ロケール
|
|
51
|
+
*/
|
|
52
|
+
export declare const enLocale: MoguchartLocale;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GanttTaskPattern, BarPattern } from './types';
|
|
2
|
+
export declare const ALL_BAR_PATTERNS: BarPattern[];
|
|
3
|
+
export declare const PATTERN_DIAGONAL_STRIPE: GanttTaskPattern;
|
|
4
|
+
export declare const PATTERN_DIAGONAL_STRIPE_REVERSE: GanttTaskPattern;
|
|
5
|
+
export declare const PATTERN_VERTICAL_STRIPE: GanttTaskPattern;
|
|
6
|
+
export declare const PATTERN_HORIZONTAL_STRIPE: GanttTaskPattern;
|
|
7
|
+
export declare const PATTERN_CHECKERBOARD: GanttTaskPattern;
|
|
8
|
+
export declare const PATTERN_DOTS: GanttTaskPattern;
|
|
9
|
+
export declare const PATTERN_TRIANGLE: GanttTaskPattern;
|
|
10
|
+
export declare const PATTERN_CIRCLE: GanttTaskPattern;
|
|
11
|
+
export declare const PATTERN_GRID: GanttTaskPattern;
|
|
12
|
+
export declare const PATTERN_DIAGONAL_GRID: GanttTaskPattern;
|
|
13
|
+
export declare const PATTERN_STRIPE_THIN: GanttTaskPattern;
|
|
14
|
+
export declare const PATTERN_STRIPE_THICK: GanttTaskPattern;
|
|
15
|
+
export declare const PATTERN_DOTS_DENSE: GanttTaskPattern;
|
|
16
|
+
/**
|
|
17
|
+
* GanttTaskPattern からCSSのbackground-imageスタイル文字列を生成します。
|
|
18
|
+
* @param pattern パターン設定
|
|
19
|
+
* @returns CSS文字列
|
|
20
|
+
*/
|
|
21
|
+
export declare function getPatternStyle(pattern?: GanttTaskPattern): string;
|