@svar-ui/gantt-store 2.6.2 → 2.7.1
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/DataStore.d.ts +53 -8
- package/dist/types/columns.d.ts +7 -1
- package/dist/types/helpers/area.d.ts +4 -0
- package/dist/types/helpers/editorItems.d.ts +44 -10
- package/dist/types/helpers/filter.d.ts +1 -0
- package/dist/types/helpers/menuOptions.d.ts +17 -4
- package/dist/types/helpers/sort.d.ts +1 -1
- package/dist/types/helpers/toolbarButtons.d.ts +3 -1
- package/dist/types/index.d.ts +7 -5
- package/dist/types/normalizeDates.d.ts +5 -5
- package/dist/types/scales.d.ts +1 -0
- package/dist/types/schedule-types.d.ts +5 -0
- package/dist/types/time.d.ts +6 -5
- package/dist/types/types.d.ts +142 -31
- package/package.json +2 -2
package/dist/types/types.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ import type GanttDataTree from "./GanttDataTree";
|
|
|
4
4
|
import { Day } from "date-fns";
|
|
5
5
|
import type DataStore from "./DataStore";
|
|
6
6
|
import type { IApi as ITableApi, IColumn, IFilterValues } from "@svar-ui/grid-store";
|
|
7
|
-
import { TaskSlackInfo } from "
|
|
7
|
+
import type { TaskSlackInfo, ICalendarRule, CalendarConfig, ICalendar } from "./schedule-types";
|
|
8
|
+
export type { TaskSlackInfo, ICalendarRule, CalendarConfig, ICalendar };
|
|
9
|
+
import ResourceDataTree from "./pro/ResourceDataTree";
|
|
8
10
|
export type TMethodsConfig = IDataMethodsConfig;
|
|
9
11
|
export type { GanttDataTree, TID };
|
|
10
12
|
export interface IExportConfig {
|
|
@@ -56,6 +58,19 @@ export type TLinkType = "s2s" | "s2e" | "e2s" | "e2e";
|
|
|
56
58
|
export type TTaskType = "task" | "summary" | "milestone" | string;
|
|
57
59
|
export type TLengthUnit = "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year" | string;
|
|
58
60
|
export type TDurationUnit = "day" | "hour";
|
|
61
|
+
export type TSerializeData = {
|
|
62
|
+
tasks: Partial<ITask>[];
|
|
63
|
+
links: ILink[];
|
|
64
|
+
assignments: IAssignment[];
|
|
65
|
+
resources: IParsedResource[];
|
|
66
|
+
tree: GanttDataTree;
|
|
67
|
+
calendars: GanttCalendarConfig[];
|
|
68
|
+
};
|
|
69
|
+
export type TDataName = keyof TSerializeData;
|
|
70
|
+
export type TSortFunction = (a: IDataHash, b: IDataHash) => 1 | -1 | 0;
|
|
71
|
+
export type TDisplayMode = "all" | "grid" | "chart";
|
|
72
|
+
export type TCellBorders = "column" | "full";
|
|
73
|
+
export type TCalendarGetter = (task: Partial<ITask>) => ICalendar | undefined;
|
|
59
74
|
export interface ILink {
|
|
60
75
|
id?: TID;
|
|
61
76
|
type: TLinkType;
|
|
@@ -63,10 +78,70 @@ export interface ILink {
|
|
|
63
78
|
target: TID;
|
|
64
79
|
lag?: number;
|
|
65
80
|
}
|
|
81
|
+
export interface IResource {
|
|
82
|
+
id?: TID;
|
|
83
|
+
name?: string;
|
|
84
|
+
avatar?: string;
|
|
85
|
+
color?: string;
|
|
86
|
+
role?: string;
|
|
87
|
+
calendar?: TID;
|
|
88
|
+
parent?: TID;
|
|
89
|
+
data?: IResource[];
|
|
90
|
+
open?: boolean;
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
}
|
|
93
|
+
export interface IAssignment {
|
|
94
|
+
id?: TID;
|
|
95
|
+
task: TID;
|
|
96
|
+
resource: TID;
|
|
97
|
+
units?: number;
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
}
|
|
100
|
+
export type TResourceAssignment = IAssignment & IResource & {
|
|
101
|
+
assignmentId: TID;
|
|
102
|
+
};
|
|
103
|
+
export interface IDataAssignment {
|
|
104
|
+
byTask: Record<TID, IAssignment[]>;
|
|
105
|
+
byResource: Record<TID, IAssignment[]>;
|
|
106
|
+
}
|
|
107
|
+
export interface IResourceLoad {
|
|
108
|
+
percent: number;
|
|
109
|
+
hours: number;
|
|
110
|
+
}
|
|
111
|
+
export interface IParsedResource extends IResource {
|
|
112
|
+
id: TID;
|
|
113
|
+
parent: TID;
|
|
114
|
+
$level: number;
|
|
115
|
+
data?: IParsedResource[];
|
|
116
|
+
}
|
|
117
|
+
export interface IComputedResource extends IParsedResource {
|
|
118
|
+
data?: IComputedResource[];
|
|
119
|
+
$load: Record<string, IResourceLoad>;
|
|
120
|
+
$total: number;
|
|
121
|
+
$overloaded: boolean;
|
|
122
|
+
$unitLoad?: Record<string, IResourceLoad>;
|
|
123
|
+
}
|
|
124
|
+
export interface IResourceColumn {
|
|
125
|
+
id: string;
|
|
126
|
+
header?: string;
|
|
127
|
+
width?: number;
|
|
128
|
+
flexgrow?: number;
|
|
129
|
+
align?: "left" | "right" | "center";
|
|
130
|
+
resize?: boolean;
|
|
131
|
+
sort?: boolean | TSortFunction;
|
|
132
|
+
cell?: any;
|
|
133
|
+
getter?: (obj: IComputedResource) => any;
|
|
134
|
+
template?: IColumn["template"];
|
|
135
|
+
[key: string]: any;
|
|
136
|
+
}
|
|
66
137
|
export interface IGanttLink extends ILink {
|
|
67
138
|
id: TID;
|
|
68
139
|
$p: string;
|
|
69
140
|
$pl: number;
|
|
141
|
+
$x1: number;
|
|
142
|
+
$x2: number;
|
|
143
|
+
$y1: number;
|
|
144
|
+
$y2: number;
|
|
70
145
|
critical?: boolean;
|
|
71
146
|
}
|
|
72
147
|
export interface ITask {
|
|
@@ -85,6 +160,7 @@ export interface ITask {
|
|
|
85
160
|
progress?: number;
|
|
86
161
|
type?: TTaskType;
|
|
87
162
|
parent?: TID;
|
|
163
|
+
calendar?: TID;
|
|
88
164
|
unscheduled?: boolean;
|
|
89
165
|
segments?: Partial<ITask>[];
|
|
90
166
|
[key: string]: any;
|
|
@@ -94,6 +170,7 @@ export interface IParsedTask extends ITask {
|
|
|
94
170
|
parent: TID;
|
|
95
171
|
data?: IParsedTask[];
|
|
96
172
|
$level: number;
|
|
173
|
+
$wbs?: string;
|
|
97
174
|
}
|
|
98
175
|
export interface IGanttTask extends IParsedTask {
|
|
99
176
|
$x: number;
|
|
@@ -126,6 +203,7 @@ export interface IVisibleArea {
|
|
|
126
203
|
from: number;
|
|
127
204
|
start: number;
|
|
128
205
|
end: number;
|
|
206
|
+
to?: number;
|
|
129
207
|
}
|
|
130
208
|
export interface IZoomConfig {
|
|
131
209
|
level?: number;
|
|
@@ -164,34 +242,23 @@ export interface ISummaryConfig {
|
|
|
164
242
|
autoProgress?: boolean;
|
|
165
243
|
autoConvert?: boolean;
|
|
166
244
|
}
|
|
167
|
-
export interface
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
thursday?: number;
|
|
175
|
-
friday?: number;
|
|
176
|
-
saturday?: number;
|
|
177
|
-
};
|
|
245
|
+
export interface IGroupByConfig {
|
|
246
|
+
field: string;
|
|
247
|
+
taskHierarchy?: boolean;
|
|
248
|
+
resourceHierarchy?: boolean;
|
|
249
|
+
multipleResources?: boolean;
|
|
250
|
+
ungrouped?: false | "top" | "bottom";
|
|
251
|
+
resolver?: (task: ITask) => any;
|
|
178
252
|
}
|
|
179
|
-
export interface
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
clone(config?: ICalendarConfig): Calendar;
|
|
183
|
-
addWorkingDays(start: Date, days: number, excludeEndDate?: boolean): Date | null;
|
|
184
|
-
addWorkingHours(start: Date, hours: number): Date | null;
|
|
185
|
-
getNextWorkingDay(date: Date): Date | null;
|
|
186
|
-
getPreviousWorkingDay(date: Date): Date | null;
|
|
187
|
-
getWorkingDays(start: Date, end: Date, excludeEndDate?: boolean): number;
|
|
188
|
-
getWorkingHours(start: Date, end?: Date, excludeEndDate?: boolean): number;
|
|
189
|
-
setDayHours(date: Date, hours: number): void;
|
|
190
|
-
setRangeHours(start: Date, end: Date, hours: number): void;
|
|
253
|
+
export interface GanttCalendarConfig extends CalendarConfig {
|
|
254
|
+
id: TID;
|
|
255
|
+
css?: string;
|
|
191
256
|
}
|
|
192
257
|
export interface IConfig {
|
|
193
258
|
tasks?: ITask[];
|
|
194
259
|
links?: any[];
|
|
260
|
+
resources?: IResource[];
|
|
261
|
+
assignments?: IAssignment[];
|
|
195
262
|
taskTypes?: ITaskType[];
|
|
196
263
|
selected?: TID[];
|
|
197
264
|
activeTask?: TID | {
|
|
@@ -217,50 +284,75 @@ export interface IConfig {
|
|
|
217
284
|
type: "all" | "closest";
|
|
218
285
|
};
|
|
219
286
|
markers?: IMarker[];
|
|
220
|
-
criticalPath?: ICriticalPathConfig;
|
|
287
|
+
criticalPath?: ICriticalPathConfig | null;
|
|
221
288
|
projectStart?: Date;
|
|
222
289
|
projectEnd?: Date;
|
|
223
|
-
|
|
290
|
+
calendars?: GanttCalendarConfig[];
|
|
291
|
+
calendar?: true | CalendarConfig | TID;
|
|
224
292
|
splitTasks?: boolean;
|
|
225
293
|
summary?: ISummaryConfig;
|
|
226
294
|
slack?: boolean;
|
|
295
|
+
groupBy?: string | IGroupByConfig | null;
|
|
296
|
+
wbs?: boolean;
|
|
297
|
+
highlightTime?: (date: Date, unit: TDurationUnit) => string;
|
|
298
|
+
displayMode?: TDisplayMode;
|
|
299
|
+
gridWidth?: number;
|
|
300
|
+
cellBorders?: TCellBorders;
|
|
227
301
|
}
|
|
228
302
|
export interface IDataConfig extends IConfig {
|
|
229
303
|
scrollLeft: number;
|
|
230
304
|
scrollTop: number;
|
|
231
305
|
area: IVisibleArea;
|
|
306
|
+
xArea: IVisibleArea;
|
|
232
307
|
history?: IHistory;
|
|
233
308
|
filterValues?: IFilterValues;
|
|
234
309
|
focusTask?: TFocusTask;
|
|
235
310
|
_cellWidth?: number;
|
|
236
311
|
_sort?: TSort[];
|
|
312
|
+
_resourceSort?: TSort[];
|
|
237
313
|
_weekStart?: Day;
|
|
238
314
|
_markers?: IMarker[];
|
|
239
315
|
_rollups?: {
|
|
240
316
|
[key: TID]: Array<ITask>;
|
|
241
317
|
};
|
|
318
|
+
_resources?: IComputedResource[];
|
|
242
319
|
_isFiltered?: boolean;
|
|
320
|
+
tree?: [];
|
|
243
321
|
_chartWidth?: number;
|
|
244
322
|
_chartHeight?: number;
|
|
245
323
|
_scrollSize?: number;
|
|
324
|
+
_calendar?: ICalendar;
|
|
325
|
+
_calendars?: Record<TID, ICalendar>;
|
|
326
|
+
_compactMode: boolean;
|
|
327
|
+
_columnsWidth?: number;
|
|
328
|
+
_gridCollapseThreshold?: number;
|
|
246
329
|
}
|
|
247
|
-
export interface IData extends Omit<IDataConfig,
|
|
330
|
+
export interface IData extends Omit<IDataConfig, TDataName | "rollups" | "groupBy"> {
|
|
248
331
|
rollups?: false | {
|
|
249
332
|
type: "all" | "closest";
|
|
250
333
|
};
|
|
251
334
|
zoom?: IZoomConfig;
|
|
252
335
|
tasks: GanttDataTree;
|
|
253
336
|
links: DataArray<ILink>;
|
|
337
|
+
resources?: ResourceDataTree;
|
|
338
|
+
assignments?: DataArray<IAssignment>;
|
|
339
|
+
calendars?: GanttCalendarConfig[];
|
|
340
|
+
tree: GanttDataTree;
|
|
254
341
|
_tasks: IParsedTask[];
|
|
342
|
+
_tasksPatch?: boolean | null;
|
|
255
343
|
_rollups: {
|
|
256
344
|
[key: TID]: Array<ITask>;
|
|
257
345
|
};
|
|
258
346
|
_links: IGanttLink[];
|
|
347
|
+
_linksIndex: Map<number, IGanttLink[]>;
|
|
348
|
+
_visibleLinks: IGanttLink[];
|
|
349
|
+
_assignments?: IDataAssignment;
|
|
259
350
|
_selected?: ITask[];
|
|
260
351
|
_activeTask?: ITask;
|
|
261
352
|
_start?: Date;
|
|
262
353
|
_end?: Date;
|
|
263
354
|
_scales?: GanttScaleData;
|
|
355
|
+
_scaleMinUnit?: TLengthUnit;
|
|
264
356
|
_scaleDate?: Date;
|
|
265
357
|
_zoomOffset?: number;
|
|
266
358
|
_weekStart?: Day;
|
|
@@ -269,6 +361,9 @@ export interface IData extends Omit<IDataConfig, "tasks" | "links" | "rollups">
|
|
|
269
361
|
_chartWidth?: number;
|
|
270
362
|
_chartHeight?: number;
|
|
271
363
|
_scrollSize?: number;
|
|
364
|
+
_columnsWidth?: number;
|
|
365
|
+
groupBy?: IGroupByConfig;
|
|
366
|
+
_gridCollapseThreshold?: number;
|
|
272
367
|
}
|
|
273
368
|
export interface IDataHash<T = any> {
|
|
274
369
|
[key: string]: T;
|
|
@@ -323,12 +418,13 @@ export type IGanttColumn = {
|
|
|
323
418
|
width?: number;
|
|
324
419
|
align?: "left" | "right" | "center";
|
|
325
420
|
flexgrow?: number;
|
|
421
|
+
hidden?: boolean;
|
|
326
422
|
resize?: boolean;
|
|
327
423
|
header?: IColumn["header"];
|
|
328
424
|
id?: string;
|
|
329
425
|
template?: IColumn["template"];
|
|
330
426
|
_template?: IColumn["template"];
|
|
331
|
-
sort?: boolean;
|
|
427
|
+
sort?: boolean | TSortFunction;
|
|
332
428
|
cell?: any;
|
|
333
429
|
editor?: IColumn["editor"];
|
|
334
430
|
options?: IColumn["options"];
|
|
@@ -341,7 +437,7 @@ export type TCommonShape = {
|
|
|
341
437
|
labelTemplate?: (value: any) => string;
|
|
342
438
|
config?: Record<string, any>;
|
|
343
439
|
[key: string]: any;
|
|
344
|
-
isHidden?: (task: Partial<ITask
|
|
440
|
+
isHidden?: (task: Partial<ITask>, state: IData) => boolean;
|
|
345
441
|
isDisabled?: (task: Partial<ITask>, state: IData) => boolean;
|
|
346
442
|
};
|
|
347
443
|
export type TTextFieldShape = TCommonShape & {
|
|
@@ -380,7 +476,16 @@ export type ILinksShape = TCommonShape & {
|
|
|
380
476
|
export type ITwoStateShape = TCommonShape & {
|
|
381
477
|
comp: "twostate";
|
|
382
478
|
};
|
|
383
|
-
export type
|
|
479
|
+
export type IResources = TCommonShape & {
|
|
480
|
+
comp: "resources";
|
|
481
|
+
};
|
|
482
|
+
export type ITabs = TCommonShape & {
|
|
483
|
+
comp: "tabs";
|
|
484
|
+
};
|
|
485
|
+
export type ISegments = TCommonShape & {
|
|
486
|
+
comp: "segments";
|
|
487
|
+
};
|
|
488
|
+
export type TEditorItem = TTextFieldShape | TCounterShape | TComboFieldShape | TSliderShape | TDateFieldShape | TRadioShape | ILinksShape | ITwoStateShape | TCheckboxShape | IResources | ISegments | ITabs;
|
|
384
489
|
export type ITaskType = {
|
|
385
490
|
id: TID;
|
|
386
491
|
label: string;
|
|
@@ -411,5 +516,11 @@ export interface IApi {
|
|
|
411
516
|
};
|
|
412
517
|
getTable: (waitRender?: boolean) => Promise<ITableApi> | ITableApi;
|
|
413
518
|
getTask: (id: TID) => ITask;
|
|
414
|
-
|
|
519
|
+
getResource: (id: TID) => IResource;
|
|
520
|
+
serialize: (config?: {
|
|
521
|
+
data?: keyof TSerializeData;
|
|
522
|
+
}) => TSerializeData[keyof TSerializeData] | null;
|
|
523
|
+
getCalendar: (id?: TID) => ICalendar | undefined;
|
|
524
|
+
getTaskResources: (id: TID) => TResourceAssignment[];
|
|
525
|
+
getResourceTasks: (id: TID) => ITask[];
|
|
415
526
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svar-ui/gantt-store",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Internal state management used by SVAR Gantt component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"date-fns": "3.6.0",
|
|
24
|
-
"@svar-ui/lib-state": "1.9.
|
|
24
|
+
"@svar-ui/lib-state": "1.9.7"
|
|
25
25
|
}
|
|
26
26
|
}
|