@vmscloud/moz-ui-gantt-core 0.1.0 → 0.2.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.
@@ -0,0 +1,60 @@
1
+ import { GanttEvents, GanttOptions, GanttRow, GanttRowId } from './types';
2
+ type Task = {
3
+ id: GanttRowId;
4
+ row: GanttRow;
5
+ };
6
+ interface Host {
7
+ element: HTMLElement;
8
+ viewport: HTMLElement;
9
+ options(): GanttOptions;
10
+ rows(): readonly GanttRow[];
11
+ selected(): GanttRowId | null;
12
+ select(id: GanttRowId): void;
13
+ hit(event: MouseEvent): Task | null;
14
+ rowEvent(event: MouseEvent | KeyboardEvent): GanttEvents['rowClick'] | null;
15
+ describe(row: GanttRow): string;
16
+ emit<K extends keyof GanttEvents>(name: K, value: GanttEvents[K]): void;
17
+ zoomIn(): void;
18
+ zoomOut(): void;
19
+ clearSearch(): void;
20
+ }
21
+ /** Canvas hit를 공용 Tooltip/ContextMenu 및 키보드 활성화로 연결한다. */
22
+ export declare class GanttInteractions {
23
+ private host;
24
+ private tooltip;
25
+ private menu;
26
+ private anchor;
27
+ private tooltipHost;
28
+ private menuHost;
29
+ private tooltipId;
30
+ private tooltipTask;
31
+ private tooltipText;
32
+ private overlayScrollState;
33
+ private menuTarget;
34
+ private restoreFocus;
35
+ private destroyed;
36
+ constructor(host: Host);
37
+ private get blocked();
38
+ private milestone;
39
+ private selectedTask;
40
+ private activate;
41
+ private click;
42
+ private doubleClick;
43
+ private contextMenu;
44
+ private pointerMove;
45
+ private pointerLeave;
46
+ private focused;
47
+ private blurred;
48
+ private scrollState;
49
+ private scrolled;
50
+ private showTooltip;
51
+ private overlayStyle;
52
+ private hideTooltip;
53
+ private openMenu;
54
+ private menuKeyDown;
55
+ private closeMenu;
56
+ private keyDown;
57
+ invalidate(): void;
58
+ destroy(): void;
59
+ }
60
+ export {};
@@ -1,4 +1,4 @@
1
- import { GanttOptions, GanttRow, GanttRowId, GanttEvents, SearchState } from './types';
1
+ import { GanttOptions, GanttRow, GanttRowId, GanttEvents, SearchState, GanttDataSource } from './types';
2
2
  import { GanttTaskPatch } from './data/GanttTaskStore';
3
3
  /** Framework-independent Canvas Gantt. No requests, persistence or application services. */
4
4
  export declare class MozGantt {
@@ -16,10 +16,19 @@ export declare class MozGantt {
16
16
  private controls;
17
17
  private input;
18
18
  private destroyed;
19
- private selectedIndex;
19
+ private selectedId;
20
20
  private searchOff;
21
+ private sourceOff;
22
+ private themeObserver;
23
+ private theme;
24
+ private interactions;
25
+ private help;
21
26
  constructor(container: HTMLElement, options: GanttOptions);
22
27
  private createViewer;
28
+ private get labels();
29
+ private layout;
30
+ private timeAxis;
31
+ private appearance;
23
32
  private get blocked();
24
33
  private renderToolbar;
25
34
  private makeStore;
@@ -31,6 +40,10 @@ export declare class MozGantt {
31
40
  setData(data: readonly GanttRow[]): void;
32
41
  /** ID 단위 원자적 추가/수정/삭제. 잘못된 patch는 데이터와 화면을 변경하지 않는다. */
33
42
  applyDataPatch(patch: GanttTaskPatch): void;
43
+ private checkTransaction;
44
+ /** 읽기 전용 소스 미러. 잘못된 갱신은 기존 화면을 유지하고 dataError로 알린다. */
45
+ attachDataSource(source: GanttDataSource): () => void;
46
+ detachDataSource(): void;
34
47
  /** 정규화된 불변 스냅샷. 새로운 options.data 스냅샷은 현재 patch 결과를 대체한다. */
35
48
  getData(): readonly GanttRow[];
36
49
  search(keyword: string): SearchState | null;
@@ -44,8 +57,15 @@ export declare class MozGantt {
44
57
  zoomOut(): void;
45
58
  on<K extends keyof GanttEvents>(event: K, handler: (value: GanttEvents[K]) => void): () => void;
46
59
  scrollToTask(id: GanttRowId): void;
47
- private onClick;
48
- private onKeyDown;
60
+ private hitTask;
61
+ private rowEvent;
62
+ private navigationRows;
63
+ selectTask(id: GanttRowId | null): void;
64
+ private clearSelection;
65
+ getSelectedTask(): {
66
+ id: GanttRowId;
67
+ row: GanttRow;
68
+ } | null;
49
69
  private describeRow;
50
70
  private refreshStatus;
51
71
  destroy(): void;
@@ -1,6 +1,7 @@
1
1
  import { Row, RowId, Pivotor } from './pivotor';
2
2
  export type SearchTextFn = (row: Row) => string | null | undefined;
3
3
  export interface SearchOptions {
4
+ mode?: 'contains' | 'exact';
4
5
  /** 기본 false (case-insensitive). */
5
6
  caseSensitive?: boolean;
6
7
  /** 기본 false. true 면 keyword 를 정규식으로 해석. invalid regex 면 literal substring 으로 fallback. */
@@ -63,6 +64,7 @@ export declare class SearchController {
63
64
  private computeMatches;
64
65
  invalidateRows(ids: Iterable<RowId>): void;
65
66
  resetCache(): void;
67
+ setOptions(options: SearchOptions | undefined): void;
66
68
  /** 현재 검색어를 유지해 재평가하되 사용자의 스크롤 위치를 강제 이동하지 않는다. */
67
69
  refresh(): SearchState | null;
68
70
  private handleDataChanged;
@@ -1,4 +1,5 @@
1
1
  import { ChangeScope, HitResult, PivotBodyRenderer, PivotorHandle, Row, RowId, ViewportContext } from '../pivotor/types';
2
+ import { GanttDependency, GanttTheme } from './features';
2
3
  /** dirty 상태 alias — types.ts 의 ViewportContext.getDirtyState 반환 타입과 동일. */
3
4
  export type DirtyRowState = 'modified' | 'added' | 'removed' | 'reordered' | 'locked';
4
5
  /** paintBar 인자 — pooled (allocation 0/frame). readonly 는 사용자 측면에서의 의미. */
@@ -15,6 +16,10 @@ export interface BarPaintContext {
15
16
  readonly endMs: number;
16
17
  readonly dirtyState: DirtyRowState | null;
17
18
  readonly locked: boolean;
19
+ /** 명시적인 마일스톤은 0기간 일반 작업과 구분한다. */
20
+ readonly milestone: boolean;
21
+ /** overlay 그룹의 1-based 수직 lane. separate 모드는 항상 1이다. */
22
+ readonly level: number;
18
23
  }
19
24
  export type PaintBarFn = (paint: BarPaintContext) => void;
20
25
  /**
@@ -79,6 +84,15 @@ export interface BarPattern {
79
84
  export interface GanttCanvasRendererOptions {
80
85
  startField: string;
81
86
  endField: string;
87
+ milestoneField?: string;
88
+ levelField?: string;
89
+ dirtyField?: string;
90
+ removedField?: string;
91
+ dependencies?: readonly GanttDependency[];
92
+ theme?: Partial<GanttTheme>;
93
+ selectedId?: RowId | null;
94
+ /** 일반 작업의 그리기 preset. 마일스톤의 데이터 의미와는 별개다. */
95
+ barShape?: 'rectangle' | 'rounded' | 'diamond';
82
96
  paintBar?: PaintBarFn;
83
97
  /** default paint 의 bar 라벨 텍스트 결정. paintBar 를 직접 줄 정도는 아니지만 라벨은 바꾸고 싶을 때. */
84
98
  barLabel?: BarLabelFn;
@@ -115,11 +129,15 @@ export declare class GanttCanvasRenderer implements PivotBodyRenderer {
115
129
  private readonly intervalScratch;
116
130
  private readonly overlayIndexes;
117
131
  private overlayIndexRows;
132
+ private theme;
133
+ private levels;
134
+ private dependencyIndex;
135
+ private readonly dependencyScratch;
118
136
  clearTimeCache(): void;
119
137
  invalidateTime(id: RowId): void;
120
138
  invalidateRows(ids: readonly RowId[]): void;
121
139
  /** 표시 설정만 변경하고 시간/행 인덱스와 Canvas 인스턴스를 유지한다. */
122
- updateOptions(patch: Partial<Pick<GanttCanvasRendererOptions, 'barLabel' | 'barColor' | 'paintBar' | 'textCacheCapacity'>>): void;
140
+ updateOptions(patch: Partial<Omit<GanttCanvasRendererOptions, 'startField' | 'endField'>>): void;
123
141
  private canvas;
124
142
  private ctx2d;
125
143
  private dpr;
@@ -140,6 +158,14 @@ export declare class GanttCanvasRenderer implements PivotBodyRenderer {
140
158
  renderViewport(ctx: ViewportContext): void;
141
159
  destroy(): void;
142
160
  onHitTest(x: number, y: number): HitResult | null;
161
+ private rowLevel;
162
+ private levelCount;
163
+ private rowDirtyState;
164
+ private diamond;
165
+ private strokeTask;
166
+ /** 의존선은 전체 task 순회 대신 변경 때 만든 y 구간 인덱스로 viewport 후보만 선택한다. */
167
+ private paintDependencies;
168
+ private buildDependencyIndex;
143
169
  private trimHitRegions;
144
170
  private clearActiveHits;
145
171
  private dropOverlayIndex;
@@ -1,8 +1,8 @@
1
1
  import { PivotConfigInput, Row, PivotorEvents, TimeAxisSpec } from '../pivotor/types';
2
2
  import { Pivotor } from '../pivotor';
3
3
  import { GanttTaskTransaction } from '../data/GanttTaskStore';
4
- import { GanttCanvasRenderer, PaintBarFn, BarLabelFn, BarColorFn } from './GanttCanvasRenderer';
5
- export interface GanttEditorOptions {
4
+ import { GanttCanvasRenderer, GanttCanvasRendererOptions, PaintBarFn, BarLabelFn, BarColorFn } from './GanttCanvasRenderer';
5
+ export interface GanttEditorOptions extends Omit<GanttCanvasRendererOptions, 'startField' | 'endField'> {
6
6
  container: HTMLElement;
7
7
  config: PivotConfigInput;
8
8
  /** 조회 데이터 배열. */
@@ -63,8 +63,8 @@ export declare class GanttEditor {
63
63
  constructor(opts: GanttEditorOptions);
64
64
  /** 입력 상태 변경은 Canvas/배치/스크롤을 유지하고 wheel 구독만 교체한다. */
65
65
  updateZoomOptions(next: Partial<Pick<GanttEditorOptions, 'enableZoom' | 'minPxPerTick' | 'maxPxPerTick' | 'zoomStep'>>): void;
66
- updateAppearance(next: Partial<Pick<GanttEditorOptions, 'barLabel' | 'barColor' | 'paintBar' | 'textCacheCapacity'>>): void;
67
- updateLayout(next: Pick<PivotConfigInput, 'rowFields' | 'rowExpansion'>): void;
66
+ updateAppearance(next: Partial<Omit<GanttCanvasRendererOptions, 'startField' | 'endField'>>): void;
67
+ updateLayout(next: Pick<PivotConfigInput, 'rowFields' | 'rowExpansion' | 'labels' | 'rowHeaderResizable'>): void;
68
68
  updateTimeAxis(timeAxis: TimeAxisSpec): void;
69
69
  applyDataChanges(changes: GanttTaskTransaction): void;
70
70
  get rows(): readonly Row[];
@@ -0,0 +1,34 @@
1
+ import { RowId } from '../pivotor/types';
2
+ /** 조회용 의존 관계. 일정 계산이나 원본 데이터 변경을 수행하지 않는다. */
3
+ export interface GanttDependency {
4
+ id?: RowId;
5
+ from: RowId;
6
+ to: RowId;
7
+ type?: 'finish-start' | 'start-start' | 'finish-finish' | 'start-finish';
8
+ color?: string;
9
+ width?: number;
10
+ dash?: readonly number[];
11
+ }
12
+ /** Canvas에서도 DOM과 같은 테마를 쓰도록 facade가 해석한 색과 글꼴. */
13
+ export interface GanttTheme {
14
+ surface: string;
15
+ header: string;
16
+ text: string;
17
+ border: string;
18
+ accent: string;
19
+ grid: string;
20
+ bar: string;
21
+ barText: string;
22
+ barBorder: string;
23
+ lockedBar: string;
24
+ addedBar: string;
25
+ modifiedBar: string;
26
+ removedBar: string;
27
+ searchMatch: string;
28
+ searchCurrent: string;
29
+ selection: string;
30
+ milestone: string;
31
+ dependency: string;
32
+ font: string;
33
+ }
34
+ export declare const DEFAULT_GANTT_THEME: Readonly<GanttTheme>;