@vmscloud/moz-ui-gantt-core 0.1.0 → 0.3.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/dist/Interactions.d.ts +105 -0
- package/dist/MozGantt.d.ts +183 -10
- package/dist/SearchController.d.ts +2 -0
- package/dist/gantt/GanttCanvasRenderer.d.ts +166 -8
- package/dist/gantt/GanttColorRules.d.ts +98 -0
- package/dist/gantt/GanttEditor.d.ts +66 -6
- package/dist/gantt/GanttLegend.d.ts +48 -0
- package/dist/gantt/GanttMetrics.d.ts +110 -0
- package/dist/gantt/GanttRowHeaders.d.ts +25 -0
- package/dist/gantt/GanttSelection.d.ts +43 -0
- package/dist/gantt/GanttTimeMarkers.d.ts +48 -0
- package/dist/gantt/TextBitmapCache.d.ts +32 -14
- package/dist/gantt/autoLevel.d.ts +54 -0
- package/dist/gantt/barFields.d.ts +67 -0
- package/dist/gantt/features.d.ts +56 -0
- package/dist/index.cjs +5208 -388
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5203 -383
- package/dist/locale.d.ts +75 -0
- package/dist/pivotor/ColumnAxis.d.ts +3 -0
- package/dist/pivotor/HeaderRenderer.d.ts +28 -3
- package/dist/pivotor/Pivotor.d.ts +32 -2
- package/dist/pivotor/RowAxis.d.ts +19 -1
- package/dist/pivotor/TimeAxisBuilder.d.ts +16 -0
- package/dist/pivotor/internal/timeUnit.d.ts +10 -8
- package/dist/pivotor/internal/timeZone.d.ts +15 -0
- package/dist/pivotor/internal/workingCalendar.d.ts +13 -0
- package/dist/pivotor/types.d.ts +108 -1
- package/dist/style.css +1089 -9
- package/dist/theme.d.ts +17 -0
- package/dist/time.d.ts +17 -0
- package/dist/types.d.ts +390 -5
- package/dist/validate.d.ts +23 -5
- package/dist/viewState.d.ts +52 -0
- package/package.json +2 -2
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GanttTheme } from './gantt/features';
|
|
2
|
+
export declare const themeDefaults: Required<GanttTheme>;
|
|
3
|
+
/** Canvas는 CSS를 상속하지 않으므로 테마 변경 때만 계산된 토큰을 읽는다. */
|
|
4
|
+
export declare class GanttThemeObserver {
|
|
5
|
+
private element;
|
|
6
|
+
private onChange;
|
|
7
|
+
private observer;
|
|
8
|
+
private media;
|
|
9
|
+
private frame;
|
|
10
|
+
private last;
|
|
11
|
+
private overrides;
|
|
12
|
+
constructor(element: HTMLElement, onChange: (theme: Required<GanttTheme>) => void);
|
|
13
|
+
update(overrides?: Partial<GanttTheme>): Required<GanttTheme>;
|
|
14
|
+
private read;
|
|
15
|
+
private schedule;
|
|
16
|
+
destroy(): void;
|
|
17
|
+
}
|
package/dist/time.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TimeCalendar, TimeUnit } from './pivotor/types';
|
|
2
|
+
export interface GanttLocalDateTime {
|
|
3
|
+
year: number;
|
|
4
|
+
month: number;
|
|
5
|
+
day: number;
|
|
6
|
+
hour?: number;
|
|
7
|
+
minute?: number;
|
|
8
|
+
second?: number;
|
|
9
|
+
millisecond?: number;
|
|
10
|
+
}
|
|
11
|
+
export type GanttTimeDisambiguation = 'reject' | 'earlier' | 'later' | 'compatible';
|
|
12
|
+
/** 공장 날짜+시각을 절대 epoch ms로 변환한다. 모호하거나 존재하지 않는 DST 시각은 기본 거부한다. */
|
|
13
|
+
export declare function ganttDateTimeToEpoch(value: GanttLocalDateTime, timeZone?: string, disambiguation?: GanttTimeDisambiguation): number;
|
|
14
|
+
/** 표시 범위를 공장 시간대의 눈금 시작에 맞춘다. 입력·반환 모두 절대 ms다. */
|
|
15
|
+
export declare function floorGanttTime(ms: number, unit: TimeUnit, timeZone?: string, calendar?: Readonly<TimeCalendar>): number;
|
|
16
|
+
/** 현지 눈금을 전진/후진한다. DST가 있는 하루는 23/25시간일 수 있다. */
|
|
17
|
+
export declare function advanceGanttTime(ms: number, unit: TimeUnit, step: number, timeZone?: string, calendar?: Readonly<TimeCalendar>): number;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,13 +1,275 @@
|
|
|
1
|
-
import { Row, RowId, PivotRowField, TimeAxisSpec } from './pivotor/types';
|
|
1
|
+
import { Row, RowId, PivotRowField, TimeAxisSpec, TimeRange, TimeUnit } from './pivotor/types';
|
|
2
2
|
import { BarColorFn, BarLabelFn, PaintBarFn } from './gantt/GanttCanvasRenderer';
|
|
3
|
-
import { SearchState } from './SearchController';
|
|
3
|
+
import { SearchState, SearchOptions } from './SearchController';
|
|
4
|
+
import { GanttDependency, GanttTheme } from './gantt/features';
|
|
5
|
+
import { GanttColorBy, GanttColorRule, GanttLegendOptions } from './gantt/GanttColorRules';
|
|
6
|
+
import { GanttBarFieldInput } from './gantt/barFields';
|
|
7
|
+
import { GanttMessages } from './locale';
|
|
4
8
|
export type GanttRow = Row;
|
|
5
9
|
export type GanttRowId = RowId;
|
|
6
10
|
export type GanttTimeAxis = TimeAxisSpec;
|
|
7
|
-
|
|
11
|
+
/** 행 머리글 장식 글리프. 문자열은 그 열의 모든 그룹 셀에 같은 글리프, `{ field }`는 대표 행의 필드값이다. */
|
|
12
|
+
export type GanttRowIcon = string | {
|
|
13
|
+
readonly field: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 행 머리글 열. icon·subFields는 renderCell이 없는 기본 셀에만 텍스트로 그리며 그룹의 대표 행
|
|
17
|
+
* (현재 데이터 순서에서 그 그룹 경로에 속하는 첫 행)의 값을 읽는다. formatter는 주 제목, cellClass는 셀 바깥 class다.
|
|
18
|
+
*/
|
|
19
|
+
export interface GanttRowField extends PivotRowField {
|
|
20
|
+
/** 주 제목 앞 장식. 접근 가능한 이름에서 빠지며 HTML로 해석하지 않는다. 값이 비면 그리지 않는다. */
|
|
21
|
+
icon?: GanttRowIcon;
|
|
22
|
+
/**
|
|
23
|
+
* 주 제목 아래 한 줄에 선언 순서대로 이어 표시할 대표 행 필드. barFields와 같은 형식이다.
|
|
24
|
+
* 0·false는 표시하고 null·undefined·빈 문자열은 생략한다. 행 높이는 늘리지 않고 넘치면 말줄임한다.
|
|
25
|
+
*/
|
|
26
|
+
subFields?: readonly GanttBarFieldInput[];
|
|
27
|
+
}
|
|
28
|
+
/** rowTooltip.format의 두 번째 인수. field·rowPath는 rowClick과 같고 title은 formatter를 적용한 주 제목이다. */
|
|
29
|
+
export interface GanttRowTooltipContext {
|
|
30
|
+
field: string;
|
|
31
|
+
rowPath: readonly unknown[];
|
|
32
|
+
title: string;
|
|
33
|
+
}
|
|
34
|
+
/** 행 머리글 hover·focus 툴팁. format이 fields보다 우선하며 빈 문자열이면 열지 않는다. */
|
|
35
|
+
export interface GanttRowTooltip {
|
|
36
|
+
/** 대표 행에서 선언 순서대로 `field: 값` 줄을 만든다. */
|
|
37
|
+
fields?: readonly string[];
|
|
38
|
+
format?: (row: GanttRow, context: GanttRowTooltipContext) => string;
|
|
39
|
+
}
|
|
40
|
+
/** epoch ms 구간. endMs는 startMs보다 커야 한다. */
|
|
41
|
+
export type GanttTimeRange = Readonly<TimeRange>;
|
|
42
|
+
export type { TimeUnit as GanttTimeUnit, TimeFormatContext as GanttTimeFormatContext, TimeUnitFormat as GanttTimeUnitFormat, TimeUnitFormatFn as GanttTimeUnitFormatFn } from './pivotor/types';
|
|
43
|
+
/** scrollToTime 정렬. 본문 폭의 0%·50%·100% 위치에 시각을 둔다. */
|
|
44
|
+
export type GanttScrollAlign = 'start' | 'center' | 'end';
|
|
45
|
+
export interface GanttScrollToTimeOptions {
|
|
46
|
+
align?: GanttScrollAlign;
|
|
47
|
+
}
|
|
8
48
|
export type { SearchState, SearchMatch } from './SearchController';
|
|
9
49
|
export type { PaintBarFn, BarLabelFn, BarColorFn, BarPaintContext, BarColors, BarPattern } from './gantt/GanttCanvasRenderer';
|
|
10
|
-
export
|
|
50
|
+
export type { GanttDependency, GanttTheme } from './gantt/features';
|
|
51
|
+
export type { GanttNamedColor, GanttColorValue, GanttColorScalar, GanttColorBy, GanttColorRule, GanttLegendEntry, GanttLegendOptions } from './gantt/GanttColorRules';
|
|
52
|
+
export type { GanttBarField, GanttBarFieldInput } from './gantt/barFields';
|
|
53
|
+
export type { GanttMessages } from './locale';
|
|
54
|
+
export type { SearchOptions } from './SearchController';
|
|
55
|
+
export interface GanttMenuItem {
|
|
56
|
+
id: string;
|
|
57
|
+
label: string;
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** 작업·마일스톤 대상. 기존 메뉴 이벤트의 id/row와 같다. */
|
|
61
|
+
export interface GanttTaskMenuTarget {
|
|
62
|
+
kind: 'task';
|
|
63
|
+
id: GanttRowId;
|
|
64
|
+
row: GanttRow;
|
|
65
|
+
}
|
|
66
|
+
export interface GanttMilestoneMenuTarget {
|
|
67
|
+
kind: 'milestone';
|
|
68
|
+
id: GanttRowId;
|
|
69
|
+
row: GanttRow;
|
|
70
|
+
}
|
|
71
|
+
/** 행 머리글 대상. rowContextMenu와 같은 field/rowPath/ids를 쓴다. */
|
|
72
|
+
export interface GanttRowMenuTarget {
|
|
73
|
+
kind: 'row';
|
|
74
|
+
field: string;
|
|
75
|
+
rowPath: readonly unknown[];
|
|
76
|
+
ids: readonly GanttRowId[];
|
|
77
|
+
}
|
|
78
|
+
/** 막대가 없는 시간 셀 대상. time은 포인터 위치의 epoch ms, rowPath는 그 위치에 표시된 행 경로다. */
|
|
79
|
+
export interface GanttTimeMenuTarget {
|
|
80
|
+
kind: 'time';
|
|
81
|
+
time: number;
|
|
82
|
+
rowPath: readonly unknown[];
|
|
83
|
+
}
|
|
84
|
+
export type GanttMenuTarget = GanttTaskMenuTarget | GanttMilestoneMenuTarget | GanttRowMenuTarget | GanttTimeMenuTarget;
|
|
85
|
+
/** 대상별 동기 메뉴. 빈 배열이면 메뉴를 열지 않는다. */
|
|
86
|
+
export type GanttContextMenuResolver = (target: GanttMenuTarget) => readonly GanttMenuItem[];
|
|
87
|
+
/** 작업·마일스톤에만 여는 기존 고정 메뉴 설정. */
|
|
88
|
+
export type GanttContextMenuItems = boolean | readonly GanttMenuItem[];
|
|
89
|
+
export type GanttContextMenu = GanttContextMenuItems | GanttContextMenuResolver;
|
|
90
|
+
/** 기존 설정의 메뉴 이벤트는 작업 id/row, 함수형 설정은 kind로 구분하는 대상 union을 전달한다. */
|
|
91
|
+
export type GanttMenuEventTarget<Menu extends GanttContextMenu = GanttContextMenuItems> = [
|
|
92
|
+
Menu
|
|
93
|
+
] extends [GanttContextMenuItems] ? {
|
|
94
|
+
id: GanttRowId;
|
|
95
|
+
row: GanttRow;
|
|
96
|
+
} : GanttMenuTarget;
|
|
97
|
+
/**
|
|
98
|
+
* 인라인 `target => items`에 매개변수 타입만 제공하는 문맥 전용 시그니처.
|
|
99
|
+
* 반환이 never라 실제 함수 값은 이 시그니처가 아니라 추론된 Menu로만 받아들여진다.
|
|
100
|
+
*/
|
|
101
|
+
type GanttMenuContextual = (target: GanttMenuTarget) => never;
|
|
102
|
+
/** 생성자와 React/Vue options 입력. contextMenu 값에서 Menu를 추론하며 나머지 필드는 GanttOptions와 같다. */
|
|
103
|
+
export type GanttOptionsInput<Menu extends GanttContextMenu = GanttContextMenuItems> = Omit<GanttOptions, 'contextMenu'> & {
|
|
104
|
+
contextMenu?: Menu | GanttMenuContextual;
|
|
105
|
+
};
|
|
106
|
+
export interface GanttTooltip {
|
|
107
|
+
fields?: readonly string[];
|
|
108
|
+
format?: (row: GanttRow) => string;
|
|
109
|
+
}
|
|
110
|
+
/** 현재 시각 세로선. time을 생략하면 시스템 현재 시각을 1초마다 반영하고, 지정하면 그 시각에 고정한다. */
|
|
111
|
+
export interface GanttNowLine {
|
|
112
|
+
/** epoch ms 또는 시간대가 명시된 ISO 문자열. */
|
|
113
|
+
time?: number | string;
|
|
114
|
+
/** 이 선과 라벨 배경색. theme.nowLine보다 우선한다. */
|
|
115
|
+
color?: string;
|
|
116
|
+
/** 생략하면 messages.now. 빈 문자열은 라벨만 숨긴다. */
|
|
117
|
+
label?: string;
|
|
118
|
+
}
|
|
119
|
+
/** 포인터 위치의 시각 세로선과 플래그. */
|
|
120
|
+
export interface GanttCursorTimeFlag {
|
|
121
|
+
/** 절대 epoch ms를 받아 플래그 문자열을 반환한다. 빈 문자열은 플래그 글자만 숨긴다. */
|
|
122
|
+
format?: (ms: number) => string;
|
|
123
|
+
}
|
|
124
|
+
/** 작업 선택 방식. 기본 single은 기존 한 개 선택, multiple은 Ctrl/Cmd 토글·Shift 범위 선택을 더한다. */
|
|
125
|
+
export type GanttSelectionMode = 'single' | 'multiple';
|
|
126
|
+
/** setSelection 옵션. scroll이 true이면 대표(마지막) 작업으로 scrollToTask와 같이 이동한다. 기본 false. */
|
|
127
|
+
export interface GanttSetSelectionOptions {
|
|
128
|
+
scroll?: boolean;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* selectionChange payload. id/row는 대표 작업(해제 시 둘 다 null)으로, 가장 최근 선택에 추가된 작업이며 ids의 마지막과 같다.
|
|
132
|
+
* single 모드는 정확히 `{ id, row }`이고 multiple 모드만 getSelection()과 같은 순서의 ids와 대응 rows를 더한다.
|
|
133
|
+
*/
|
|
134
|
+
export interface GanttSelectionChange {
|
|
135
|
+
id: GanttRowId | null;
|
|
136
|
+
row: GanttRow | null;
|
|
137
|
+
ids?: readonly GanttRowId[];
|
|
138
|
+
rows?: readonly GanttRow[];
|
|
139
|
+
}
|
|
140
|
+
/** 앱 강조 외곽선. 기본 solid(실선), dashed는 점선이다. */
|
|
141
|
+
export type GanttHighlightStyle = 'solid' | 'dashed';
|
|
142
|
+
/** highlight 두 번째 인수. color를 생략하면 theme.highlight(`--moz-gantt-highlight`)를 쓴다. */
|
|
143
|
+
export interface GanttHighlightOptions {
|
|
144
|
+
style?: GanttHighlightStyle;
|
|
145
|
+
color?: string;
|
|
146
|
+
}
|
|
147
|
+
/** options.highlight 초기 설정·update 값. ids는 highlight(ids, { style, color })와 같다. */
|
|
148
|
+
export interface GanttHighlight extends GanttHighlightOptions {
|
|
149
|
+
ids: readonly GanttRowId[];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 표시 조건. 정규화된 작업 행을 받아 true면 표시, false면 숨긴다. 동기 순수 함수여야 하며 예외나 boolean이 아닌
|
|
153
|
+
* 반환은 오류로 거부되어 상태를 바꾸지 않는다. 규칙 계산과 외부 조건 관리는 앱 책임이다.
|
|
154
|
+
*/
|
|
155
|
+
export type GanttFilter = (row: GanttRow) => boolean;
|
|
156
|
+
/**
|
|
157
|
+
* 행 지표가 계산 중인 행 범위. data는 표시 행(separate는 슬롯 하나의 작업, overlay는 그룹 전체), subtotal은 상위 그룹 소계의
|
|
158
|
+
* 고유 작업이다. rowPath는 rowFields 순서의 그룹 값이며 소계는 그 깊이까지만 담는다. slotIndex는 separate 슬롯 순번(0부터)이다.
|
|
159
|
+
*/
|
|
160
|
+
export interface GanttMetricRowScope {
|
|
161
|
+
readonly type: 'data' | 'subtotal';
|
|
162
|
+
readonly rowPath: readonly unknown[];
|
|
163
|
+
readonly slotIndex: number;
|
|
164
|
+
}
|
|
165
|
+
/** 앱 집계 함수의 입력. 모든 값과 배열은 읽기 전용 스냅샷이다. */
|
|
166
|
+
export interface GanttMetricContext {
|
|
167
|
+
/** 지표 id. */
|
|
168
|
+
readonly metric: string;
|
|
169
|
+
/** header는 표시 중인 전체 작업(필터 통과), row는 rowScope 범위의 작업을 대상으로 한다. */
|
|
170
|
+
readonly kind: 'header' | 'row';
|
|
171
|
+
/** 실제 시간 열의 절대 구간 [startMs, endMs). 화면에 일부만 보이는 열도 전체 구간이다. */
|
|
172
|
+
readonly startMs: number;
|
|
173
|
+
readonly endMs: number;
|
|
174
|
+
/** 달력이 있으면 열 안의 업무 구간들, 없으면 [startMs, endMs) 하나다. */
|
|
175
|
+
readonly segments: readonly GanttTimeRange[];
|
|
176
|
+
/** 현재 줌의 활성 시간 단위. */
|
|
177
|
+
readonly unit: TimeUnit;
|
|
178
|
+
/** 업무 구간과 반열린 구간으로 겹치는 고유 작업(0길이·마일스톤은 시각을 포함하는 열). hideRemovedBars로 숨긴 작업은 빠진다. */
|
|
179
|
+
readonly rows: readonly GanttRow[];
|
|
180
|
+
/** 행 지표의 행 범위. 헤더 지표는 null이다. */
|
|
181
|
+
readonly row: GanttMetricRowScope | null;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* 앱 집계. 동기 순수 함수여야 하며 유한한 number를 반환한다. 예외·NaN·Infinity·Promise 등은 그 구간만 계산 불가로 표시하고
|
|
185
|
+
* metricError로 알린다. 외부 상태가 바뀌면 새 함수 참조로 update한다(같은 참조는 이전 결과를 재사용한다).
|
|
186
|
+
*/
|
|
187
|
+
export type GanttMetricFn = (context: GanttMetricContext) => number;
|
|
188
|
+
/** count는 구간에 걸친 고유 작업 수, sum은 field의 유한한 number 합(누락·null·문자열·NaN·Infinity 제외)이다. */
|
|
189
|
+
export type GanttMetricAggregate = 'count' | 'sum' | GanttMetricFn;
|
|
190
|
+
/** 헤더·행 지표 공통 정의. */
|
|
191
|
+
export interface GanttMetric {
|
|
192
|
+
/** 같은 목록 안에서 고유한 비어 있지 않은 식별자. metricError와 집계 입력의 metric 값이다. */
|
|
193
|
+
id: string;
|
|
194
|
+
/** 화면·접근성 이름. 생략하면 id. HTML로 해석하지 않는다. */
|
|
195
|
+
label?: string;
|
|
196
|
+
/** 기본 count. */
|
|
197
|
+
aggregate?: GanttMetricAggregate;
|
|
198
|
+
/** sum의 대상 필드. aggregate가 'sum'이면 필수다. */
|
|
199
|
+
field?: string;
|
|
200
|
+
/** 값 표시 문자열. 생략하면 locale 숫자 형식. 예외·문자열이 아닌 반환은 그 구간의 계산 불가다. */
|
|
201
|
+
format?: (value: number) => string;
|
|
202
|
+
}
|
|
203
|
+
/** 시간 열 헤더 아래 지표 한 줄. 지표마다 자신의 가시 값과 0을 포함하는 축척으로 막대·선을 그린다. */
|
|
204
|
+
export interface GanttHeaderMetric extends GanttMetric {
|
|
205
|
+
/** 기본 bar. */
|
|
206
|
+
display?: 'bar' | 'line';
|
|
207
|
+
/** 막대·선 색. 생략하면 theme.metricBar·metricLine(`--moz-gantt-metric-bar`·`--moz-gantt-metric-line`). */
|
|
208
|
+
color?: string;
|
|
209
|
+
}
|
|
210
|
+
/** 각 표시 행 아래에 가시 시간 열마다 숫자로 표시하는 지표. */
|
|
211
|
+
export type GanttRowMetric = GanttMetric;
|
|
212
|
+
/** metricError payload. 같은 데이터·정의의 다시 그리기는 다시 알리지 않는다. rowPath는 행 지표일 때만 있다. */
|
|
213
|
+
export interface GanttMetricError {
|
|
214
|
+
metric: string;
|
|
215
|
+
kind: 'header' | 'row';
|
|
216
|
+
startMs: number;
|
|
217
|
+
endMs: number;
|
|
218
|
+
rowPath: readonly unknown[] | null;
|
|
219
|
+
error: unknown;
|
|
220
|
+
}
|
|
221
|
+
/** 보기 상태의 줌. unit은 활성 tick 단위, pxPerTick은 그 단위 한 칸의 CSS px다. */
|
|
222
|
+
export interface GanttViewZoom {
|
|
223
|
+
unit: TimeUnit;
|
|
224
|
+
pxPerTick: number;
|
|
225
|
+
}
|
|
226
|
+
/** 행 머리글 열 하나의 실제 너비(CSS px). field로 현재 rowFields에 대응한다. */
|
|
227
|
+
export interface GanttViewFieldWidth {
|
|
228
|
+
field: string;
|
|
229
|
+
width: number;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 접힌 그룹 하나. fields는 그룹 깊이까지의 rowFields field 이름(바깥→안), path는 같은 길이의 그룹 값이다.
|
|
233
|
+
* 값은 기존 접기와 같은 문자열 표현이며 null·undefined는 빈 문자열이다.
|
|
234
|
+
*/
|
|
235
|
+
export interface GanttViewGroup {
|
|
236
|
+
fields: string[];
|
|
237
|
+
path: string[];
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* getViewState()가 반환하고 setViewState()가 받는 보기 상태. 다른 상태와 공유하지 않는 새 객체이며 JSON으로 왕복할 수 있다.
|
|
241
|
+
* 업무 데이터·필드 매핑·검색·선택·필터·강조·테마·언어·시간축 range/calendar/timeZone은 포함하지 않는다.
|
|
242
|
+
*/
|
|
243
|
+
export interface GanttViewState {
|
|
244
|
+
/** 스키마 버전. 현재 1만 받는다. */
|
|
245
|
+
version: 1;
|
|
246
|
+
zoom: GanttViewZoom;
|
|
247
|
+
/**
|
|
248
|
+
* 본문 왼쪽 끝에 보이는 절대 시각(epoch ms). 왼쪽 끝이 timeAxis.range 밖(range 끝이 단위 경계가 아닐 때 첫·마지막 열의
|
|
249
|
+
* range 바깥 부분)이면 가까운 range 끝이며 그 바깥 위치는 scrollOffset이 담는다. 복원은 현재 range(양 끝 포함) 밖 시각을
|
|
250
|
+
* scrollOffset과 함께 무시한다. 음수 epoch도 유효하다.
|
|
251
|
+
*/
|
|
252
|
+
scrollTime: number;
|
|
253
|
+
/**
|
|
254
|
+
* 왼쪽 끝이 range 밖 부분일 때 range 끝(scrollTime)에서 왼쪽 끝까지의 거리(CSS px, 0 이상). scrollTime이 range 시작이면
|
|
255
|
+
* 그 앞쪽, range 끝이면 그 뒤쪽 거리이며 그 밖에는 0이다. 복원은 scrollTime이 현재 range 시작·끝과 같을 때만 그 바깥쪽으로
|
|
256
|
+
* 적용하고, range가 바뀌어 scrollTime이 range 안쪽이면 쓰지 않는다.
|
|
257
|
+
*/
|
|
258
|
+
scrollOffset: number;
|
|
259
|
+
/** 본문 세로 스크롤 offset(CSS px, 0 이상). */
|
|
260
|
+
scrollTop: number;
|
|
261
|
+
/** 각 행 머리글 열의 실제 너비. 같은 field 이름이 여러 번이면 순서대로 대응한다. */
|
|
262
|
+
rowFieldWidths: GanttViewFieldWidth[];
|
|
263
|
+
/** 접힌 그룹(접힌 부모 아래의 자식 접힘 포함). 목록에 없는 현재 그룹은 펼친다. */
|
|
264
|
+
collapsedGroups: GanttViewGroup[];
|
|
265
|
+
}
|
|
266
|
+
/** 외부 편집기/조회 저장소를 구독하는 읽기 전용 연결. write나 프레임워크 의존성이 없다. */
|
|
267
|
+
export interface GanttDataSource {
|
|
268
|
+
getSnapshot(): readonly GanttRow[];
|
|
269
|
+
subscribe(listener: () => void): () => void;
|
|
270
|
+
}
|
|
271
|
+
/** Menu는 contextMenu 설정에서 추론되며 함수형 설정일 때만 메뉴 이벤트가 대상 union이 된다. */
|
|
272
|
+
export interface GanttOptions<Menu extends GanttContextMenu = GanttContextMenuItems> {
|
|
11
273
|
data?: readonly GanttRow[];
|
|
12
274
|
/** A unique string or finite number per task. Defaults to id. */
|
|
13
275
|
idField?: string;
|
|
@@ -16,11 +278,53 @@ export interface GanttOptions {
|
|
|
16
278
|
labelField?: string;
|
|
17
279
|
rowFields?: GanttRowField[];
|
|
18
280
|
timeAxis: GanttTimeAxis;
|
|
281
|
+
/**
|
|
282
|
+
* 처음 보일 구간. timeAxis.range와의 교집합을 본문 폭에 맞춰 줌·가로 스크롤하며 전체 range는 유지한다.
|
|
283
|
+
* 생성 시와 내용이 달라진 update에서만 한 번 적용하고, `undefined`로 갱신하면 대기 중인 적용만 취소한다.
|
|
284
|
+
*/
|
|
285
|
+
initialRange?: GanttTimeRange;
|
|
19
286
|
rowHeight?: number;
|
|
20
287
|
/** Each task occupies a separate lane by default. */
|
|
21
288
|
rowLayout?: 'separate' | 'overlay';
|
|
22
289
|
searchFields?: readonly string[];
|
|
23
290
|
searchText?: (row: GanttRow) => string;
|
|
291
|
+
searchOptions?: SearchOptions;
|
|
292
|
+
locale?: string;
|
|
293
|
+
messages?: Partial<GanttMessages>;
|
|
294
|
+
theme?: Partial<GanttTheme>;
|
|
295
|
+
milestoneField?: string;
|
|
296
|
+
/** overlay 수동 층 필드(1~100 정수, 없거나 null이면 1층). 비어 있지 않으면 autoLevel보다 우선한다. */
|
|
297
|
+
levelField?: string;
|
|
298
|
+
/**
|
|
299
|
+
* overlay 자동 층 배치. 기본 false이며 `rowLayout: 'overlay'`에서만 작동하고 separate에서는 무시한다.
|
|
300
|
+
* true면 같은 rowFields 그룹 안에서 원본 시간이 겹치는 작업을 다른 층에, 겹치지 않는 작업은 낮은 층을 재사용해
|
|
301
|
+
* 최소 층 수로 배치한다. 양의 길이는 [start, end)라 끝 = 다음 시작이면 같은 층이고, 0기간 작업·마일스톤은 그 시각에
|
|
302
|
+
* 시작·진행 중인 작업과 같은 시각의 점과 충돌하며 그 시각에 끝나는 작업과는 충돌하지 않는다. pixel 폭·마름모 돌출·
|
|
303
|
+
* 사용자 paintBar 그림은 충돌로 보지 않는다. 층 높이는 rowHeight, 그룹 높이는 층 수 × rowHeight이며 100층 상한이 없다.
|
|
304
|
+
* 비어 있지 않은 levelField가 있으면 수동 배치 전체가 우선한다. hideRemovedBars로 숨긴 removed 작업은 층을 차지하지 않는다.
|
|
305
|
+
* 배치는 표시 전용이며 원본 행·getData()·이벤트 row에 필드를 더하지 않는다. false·undefined로 갱신하면 해제한다.
|
|
306
|
+
*/
|
|
307
|
+
autoLevel?: boolean;
|
|
308
|
+
lockedField?: string;
|
|
309
|
+
dirtyField?: string;
|
|
310
|
+
removedField?: string;
|
|
311
|
+
hideRemovedBars?: boolean;
|
|
312
|
+
dependencies?: readonly GanttDependency[];
|
|
313
|
+
tooltip?: boolean | GanttTooltip;
|
|
314
|
+
/**
|
|
315
|
+
* 행 머리글 셀 hover·키보드 focus 툴팁. 기본 꺼짐이며 작업 tooltip과 독립이다.
|
|
316
|
+
* true·빈 객체는 주 제목과 subFields 값을 보여 준다. 소계 라벨처럼 대표 행이 없는 셀에서는 열지 않는다.
|
|
317
|
+
*/
|
|
318
|
+
rowTooltip?: boolean | GanttRowTooltip;
|
|
319
|
+
/** true/배열은 작업·마일스톤 메뉴, 함수는 작업·마일스톤·행 머리글·빈 시간 대상별 메뉴. */
|
|
320
|
+
contextMenu?: Menu;
|
|
321
|
+
/** 행 머리글 경계의 포인터·키보드 너비 조절. */
|
|
322
|
+
splitter?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* 기본 single. multiple은 Ctrl/Cmd 클릭 토글, Shift 클릭 범위(표시 순서), Shift/Ctrl/Cmd 키보드 조합을 더하고
|
|
325
|
+
* selectionChange에 ids/rows를 포함한다. update로 바꾸면 multiple→single은 대표 한 개만 남긴다.
|
|
326
|
+
*/
|
|
327
|
+
selectionMode?: GanttSelectionMode;
|
|
24
328
|
toolbar?: boolean;
|
|
25
329
|
disabled?: boolean;
|
|
26
330
|
loading?: boolean;
|
|
@@ -30,11 +334,45 @@ export interface GanttOptions {
|
|
|
30
334
|
maxPxPerTick?: number;
|
|
31
335
|
zoomStep?: number;
|
|
32
336
|
barLabel?: BarLabelFn;
|
|
337
|
+
/**
|
|
338
|
+
* 막대 안에 지정 순서대로 표시할 필드. 비어 있지 않으면 barLabel 대신 기본 텍스트를 구성하며 paintBar가 우선한다.
|
|
339
|
+
* 막대 폭과 행 높이에 맞춰 한 줄 또는 두 줄로 배치하고 넘치면 말줄임표로 줄인다. 생략·빈 배열은 기존 표시와 같다.
|
|
340
|
+
*/
|
|
341
|
+
barFields?: readonly GanttBarFieldInput[];
|
|
342
|
+
/** fill 우선순위: barColor의 명시 fill → 처음 맞는 colorRules → colorBy → 내장 상태색. */
|
|
33
343
|
barColor?: BarColorFn;
|
|
344
|
+
/** 위에서부터 평가해 처음 맞는 규칙의 색. 결과가 `{ color, name }`이면 범례 항목이 된다. */
|
|
345
|
+
colorRules?: readonly GanttColorRule[];
|
|
346
|
+
/** 맞는 colorRules가 없을 때 필드값을 문자열 키로 조회하는 명시적 매핑. */
|
|
347
|
+
colorBy?: GanttColorBy;
|
|
348
|
+
/** 현재 화면에서 칠한 이름 있는 색의 범례. true는 위쪽·펼침. 기본 꺼짐. paintBar 사용 시 항목을 만들지 않는다. */
|
|
349
|
+
legend?: boolean | GanttLegendOptions;
|
|
34
350
|
paintBar?: PaintBarFn;
|
|
351
|
+
barShape?: 'rectangle' | 'rounded' | 'diamond';
|
|
35
352
|
textCacheCapacity?: number;
|
|
353
|
+
/** 시간축 본문의 현재 시각선. 기본 꺼짐. */
|
|
354
|
+
nowLine?: boolean | GanttNowLine;
|
|
355
|
+
/** 시간축 본문 포인터 위치의 시각선·플래그. 기본 꺼짐. */
|
|
356
|
+
cursorTimeFlag?: boolean | GanttCursorTimeFlag;
|
|
357
|
+
/**
|
|
358
|
+
* 앱이 계산한 작업 강조의 초기값. 값이 바뀐 update에서만 highlight(ids, options)처럼 적용하고 null·undefined는
|
|
359
|
+
* clearHighlight()와 같다. 이후 직접 호출한 highlight/clearHighlight가 최신 상태다.
|
|
360
|
+
*/
|
|
361
|
+
highlight?: GanttHighlight | null;
|
|
362
|
+
/**
|
|
363
|
+
* 표시 조건의 초기값. 함수 참조가 바뀐 update에서만 filter(predicate)처럼 다시 평가하고 null·undefined는 해제한다.
|
|
364
|
+
* 외부 조건만 바뀌면 새 함수를 전달하거나 filter()를 직접 호출한다.
|
|
365
|
+
*/
|
|
366
|
+
filter?: GanttFilter | null;
|
|
367
|
+
/**
|
|
368
|
+
* 시간 열 헤더 아래 지표(지표마다 한 줄, 막대·선). 표시 중인 전체 작업(필터 통과)을 가시 시간 열의 실제 구간별로 집계하며
|
|
369
|
+
* 세로 스크롤·접기·검색과 무관하다. 생략·빈 배열이면 추가 높이와 집계가 없다.
|
|
370
|
+
*/
|
|
371
|
+
headerMetrics?: readonly GanttHeaderMetric[];
|
|
372
|
+
/** 각 표시 행(데이터 행·소계) 아래 가시 시간 열별 숫자. 지표마다 한 줄 높이를 행에 더한다. 생략·빈 배열이면 없다. */
|
|
373
|
+
rowMetrics?: readonly GanttRowMetric[];
|
|
36
374
|
}
|
|
37
|
-
export interface GanttEvents {
|
|
375
|
+
export interface GanttEvents<Menu extends GanttContextMenu = GanttContextMenuItems> {
|
|
38
376
|
search: SearchState | null;
|
|
39
377
|
zoom: {
|
|
40
378
|
pxPerTick: number;
|
|
@@ -44,5 +382,52 @@ export interface GanttEvents {
|
|
|
44
382
|
row: GanttRow;
|
|
45
383
|
event: MouseEvent;
|
|
46
384
|
};
|
|
385
|
+
taskActivate: {
|
|
386
|
+
id: GanttRowId;
|
|
387
|
+
row: GanttRow;
|
|
388
|
+
source: 'pointer' | 'keyboard';
|
|
389
|
+
event: MouseEvent | KeyboardEvent;
|
|
390
|
+
};
|
|
391
|
+
taskDoubleClick: {
|
|
392
|
+
id: GanttRowId;
|
|
393
|
+
row: GanttRow;
|
|
394
|
+
event: MouseEvent;
|
|
395
|
+
};
|
|
396
|
+
milestoneClick: {
|
|
397
|
+
id: GanttRowId;
|
|
398
|
+
row: GanttRow;
|
|
399
|
+
event: MouseEvent | KeyboardEvent;
|
|
400
|
+
};
|
|
401
|
+
milestoneDoubleClick: {
|
|
402
|
+
id: GanttRowId;
|
|
403
|
+
row: GanttRow;
|
|
404
|
+
event: MouseEvent;
|
|
405
|
+
};
|
|
406
|
+
rowClick: {
|
|
407
|
+
field: string;
|
|
408
|
+
rowPath: readonly unknown[];
|
|
409
|
+
ids: readonly GanttRowId[];
|
|
410
|
+
event: MouseEvent | KeyboardEvent;
|
|
411
|
+
};
|
|
412
|
+
rowDoubleClick: GanttEvents['rowClick'];
|
|
413
|
+
taskContextMenu: {
|
|
414
|
+
id: GanttRowId;
|
|
415
|
+
row: GanttRow;
|
|
416
|
+
event: MouseEvent | KeyboardEvent;
|
|
417
|
+
};
|
|
418
|
+
milestoneContextMenu: GanttEvents['taskContextMenu'];
|
|
419
|
+
rowContextMenu: GanttEvents['rowClick'];
|
|
420
|
+
contextMenu: GanttMenuEventTarget<Menu> & {
|
|
421
|
+
event: MouseEvent | KeyboardEvent;
|
|
422
|
+
};
|
|
423
|
+
menuAction: GanttMenuEventTarget<Menu> & {
|
|
424
|
+
action: string;
|
|
425
|
+
event: MouseEvent | KeyboardEvent;
|
|
426
|
+
};
|
|
427
|
+
selectionChange: GanttSelectionChange;
|
|
428
|
+
dataError: {
|
|
429
|
+
error: unknown;
|
|
430
|
+
};
|
|
431
|
+
metricError: GanttMetricError;
|
|
47
432
|
}
|
|
48
433
|
export type { GanttTaskPatch as GanttDataPatch } from './data/GanttTaskStore';
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
import { GanttOptions, GanttRow } from './types';
|
|
1
|
+
import { GanttContextMenu, GanttMenuItem, GanttOptions, GanttRow, GanttRowId, GanttTimeAxis, GanttTimeRange, GanttScrollAlign, GanttHighlightStyle } from './types';
|
|
2
2
|
export declare function toTime(value: unknown): number;
|
|
3
|
-
export declare function validateSettings(options: GanttOptions
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export declare function validateSettings(options: GanttOptions<GanttContextMenu>, timeAxisChanged?: boolean): void;
|
|
4
|
+
/**
|
|
5
|
+
* highlight(ids, options)와 options.highlight가 함께 쓰는 입력 규칙. ids는 비어 있지 않은 문자열·유한 숫자 ID 배열,
|
|
6
|
+
* style은 solid·dashed, color는 비어 있지 않은 문자열이다. 존재 여부는 호출자가 현재 저장소로 거른다.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateHighlight(ids: unknown, options: unknown): GanttHighlightStyle;
|
|
9
|
+
/** filter 입력은 함수 또는 해제(null·undefined)다. */
|
|
10
|
+
export declare function validateFilter(filter: unknown): void;
|
|
11
|
+
/** 고정 메뉴와 함수형 메뉴 반환값에 같은 항목 규칙을 적용한다. */
|
|
12
|
+
export declare function validateMenuItems(items: unknown): readonly GanttMenuItem[];
|
|
13
|
+
/**
|
|
14
|
+
* 실제로 보여 줄 구간 = initialRange ∩ timeAxis.range. 교집합이 없거나 압축 달력에서 업무 시간이 없으면 거부한다.
|
|
15
|
+
* 이미 적용한 initialRange는 이후 timeAxis 갱신 때 다시 검사하지 않는다.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveInitialRange(range: GanttTimeRange, axis: GanttTimeAxis): GanttTimeRange;
|
|
18
|
+
/** scrollToTime 입력. 숫자가 아니면 TypeError, NaN·Infinity·Date 한계 밖이면 RangeError. align 생략·undefined만 center이고 null은 거부한다. */
|
|
19
|
+
export declare function validateScrollTime(ms: unknown, options: unknown): GanttScrollAlign;
|
|
20
|
+
export declare function validateRowSortFields(row: GanttRow, options: Pick<GanttOptions, 'rowFields'>): void;
|
|
21
|
+
export declare function validateDependencies(options: Pick<GanttOptions, 'dependencies'>, hasRow: (id: GanttRowId) => boolean): void;
|
|
22
|
+
/** 입력 행만 정규화한다. patch 검증도 원본 row를 변경하지 않는다. */
|
|
23
|
+
export declare function normalizeRow(row: GanttRow, options: Pick<GanttOptions, 'idField' | 'startField' | 'endField' | 'milestoneField' | 'levelField' | 'dirtyField' | 'removedField' | 'lockedField'>): GanttRow;
|
|
24
|
+
export declare function validateOptions(options: GanttOptions<GanttContextMenu>): GanttRow[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { GanttViewState } from './types';
|
|
2
|
+
import { TimeUnit } from './pivotor/types';
|
|
3
|
+
/** 검증을 마친 보기 상태의 독립 사본. 입력 객체를 붙잡지 않는다. */
|
|
4
|
+
export interface ParsedViewState {
|
|
5
|
+
zoom: {
|
|
6
|
+
unit: TimeUnit;
|
|
7
|
+
pxPerTick: number;
|
|
8
|
+
};
|
|
9
|
+
scrollTime: number;
|
|
10
|
+
scrollOffset: number;
|
|
11
|
+
scrollTop: number;
|
|
12
|
+
widths: Array<{
|
|
13
|
+
field: string;
|
|
14
|
+
width: number;
|
|
15
|
+
}>;
|
|
16
|
+
groups: Array<{
|
|
17
|
+
fields: string[];
|
|
18
|
+
path: string[];
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* setViewState 입력의 형식을 적용 전에 검사하고 사본을 만든다. 구조 누락·잘못된 원시 타입은 TypeError,
|
|
23
|
+
* NaN/Infinity·음수 offset·0 이하 줌/너비·알 수 없는 단위는 RangeError다. 알 수 없는 추가 속성은 무시한다.
|
|
24
|
+
* 현재 데이터·설정과의 불일치(없는 그룹·필드·단위)는 여기서 거르지 않고 적용 단계에서 무시한다.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readViewState(state: unknown): ParsedViewState;
|
|
27
|
+
/** 그룹 접힘 key. RowAxis·HeaderRenderer 와 같은 구분자 결합이다. */
|
|
28
|
+
export declare function groupKey(path: readonly string[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* 저장한 너비를 현재 rowFields 인덱스에 대응한다. 같은 field 이름은 나타난 순서대로 짝지으며 현재 필드에 없는 항목은 버린다.
|
|
31
|
+
*/
|
|
32
|
+
export declare function matchFieldWidths(current: readonly {
|
|
33
|
+
field: string;
|
|
34
|
+
}[], widths: ParsedViewState['widths']): Map<number, number>;
|
|
35
|
+
/** 현재 rowFields 와 경로 문맥(바깥 필드 이름)이 모두 같은 그룹만 [level, key] 로 바꾼다. */
|
|
36
|
+
export declare function matchGroups(current: readonly {
|
|
37
|
+
field: string;
|
|
38
|
+
}[], groups: ParsedViewState['groups']): Array<{
|
|
39
|
+
level: number;
|
|
40
|
+
key: string;
|
|
41
|
+
}>;
|
|
42
|
+
/** getViewState 결과. 매번 새 배열·객체라 반환값을 바꿔도 화면과 다음 호출에 영향이 없다. */
|
|
43
|
+
export declare function createViewState(view: Omit<ParsedViewState, 'widths' | 'groups'> & {
|
|
44
|
+
fields: readonly {
|
|
45
|
+
field: string;
|
|
46
|
+
}[];
|
|
47
|
+
widths: readonly number[];
|
|
48
|
+
groups: ReadonlyArray<{
|
|
49
|
+
level: number;
|
|
50
|
+
path: readonly string[];
|
|
51
|
+
}>;
|
|
52
|
+
}): GanttViewState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vmscloud/moz-ui-gantt-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Planner-based Canvas Gantt core: viewing, search and zoom",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"benchmark": "bun run benchmark.ts"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@vmscloud/moz-ui-components-core": "^0.1.
|
|
38
|
+
"@vmscloud/moz-ui-components-core": "^0.1.69"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"typescript": "^5.3.3",
|