@svar-ui/gantt-store 2.6.2 → 2.7.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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/DataStore.d.ts +50 -8
- package/dist/types/columns.d.ts +4 -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 +135 -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,6 +78,62 @@ 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;
|
|
@@ -85,6 +156,7 @@ export interface ITask {
|
|
|
85
156
|
progress?: number;
|
|
86
157
|
type?: TTaskType;
|
|
87
158
|
parent?: TID;
|
|
159
|
+
calendar?: TID;
|
|
88
160
|
unscheduled?: boolean;
|
|
89
161
|
segments?: Partial<ITask>[];
|
|
90
162
|
[key: string]: any;
|
|
@@ -94,6 +166,7 @@ export interface IParsedTask extends ITask {
|
|
|
94
166
|
parent: TID;
|
|
95
167
|
data?: IParsedTask[];
|
|
96
168
|
$level: number;
|
|
169
|
+
$wbs?: string;
|
|
97
170
|
}
|
|
98
171
|
export interface IGanttTask extends IParsedTask {
|
|
99
172
|
$x: number;
|
|
@@ -126,6 +199,7 @@ export interface IVisibleArea {
|
|
|
126
199
|
from: number;
|
|
127
200
|
start: number;
|
|
128
201
|
end: number;
|
|
202
|
+
to?: number;
|
|
129
203
|
}
|
|
130
204
|
export interface IZoomConfig {
|
|
131
205
|
level?: number;
|
|
@@ -164,34 +238,23 @@ export interface ISummaryConfig {
|
|
|
164
238
|
autoProgress?: boolean;
|
|
165
239
|
autoConvert?: boolean;
|
|
166
240
|
}
|
|
167
|
-
export interface
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
thursday?: number;
|
|
175
|
-
friday?: number;
|
|
176
|
-
saturday?: number;
|
|
177
|
-
};
|
|
241
|
+
export interface IGroupByConfig {
|
|
242
|
+
field: string;
|
|
243
|
+
taskHierarchy?: boolean;
|
|
244
|
+
resourceHierarchy?: boolean;
|
|
245
|
+
multipleResources?: boolean;
|
|
246
|
+
ungrouped?: false | "top" | "bottom";
|
|
247
|
+
resolver?: (task: ITask) => any;
|
|
178
248
|
}
|
|
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;
|
|
249
|
+
export interface GanttCalendarConfig extends CalendarConfig {
|
|
250
|
+
id: TID;
|
|
251
|
+
css?: string;
|
|
191
252
|
}
|
|
192
253
|
export interface IConfig {
|
|
193
254
|
tasks?: ITask[];
|
|
194
255
|
links?: any[];
|
|
256
|
+
resources?: IResource[];
|
|
257
|
+
assignments?: IAssignment[];
|
|
195
258
|
taskTypes?: ITaskType[];
|
|
196
259
|
selected?: TID[];
|
|
197
260
|
activeTask?: TID | {
|
|
@@ -217,50 +280,73 @@ export interface IConfig {
|
|
|
217
280
|
type: "all" | "closest";
|
|
218
281
|
};
|
|
219
282
|
markers?: IMarker[];
|
|
220
|
-
criticalPath?: ICriticalPathConfig;
|
|
283
|
+
criticalPath?: ICriticalPathConfig | null;
|
|
221
284
|
projectStart?: Date;
|
|
222
285
|
projectEnd?: Date;
|
|
223
|
-
|
|
286
|
+
calendars?: GanttCalendarConfig[];
|
|
287
|
+
calendar?: true | CalendarConfig | TID;
|
|
224
288
|
splitTasks?: boolean;
|
|
225
289
|
summary?: ISummaryConfig;
|
|
226
290
|
slack?: boolean;
|
|
291
|
+
groupBy?: string | IGroupByConfig | null;
|
|
292
|
+
wbs?: boolean;
|
|
293
|
+
highlightTime?: (date: Date, unit: TDurationUnit) => string;
|
|
294
|
+
displayMode?: TDisplayMode;
|
|
295
|
+
gridWidth?: number;
|
|
296
|
+
cellBorders?: TCellBorders;
|
|
227
297
|
}
|
|
228
298
|
export interface IDataConfig extends IConfig {
|
|
229
299
|
scrollLeft: number;
|
|
230
300
|
scrollTop: number;
|
|
231
301
|
area: IVisibleArea;
|
|
302
|
+
xArea: IVisibleArea;
|
|
232
303
|
history?: IHistory;
|
|
233
304
|
filterValues?: IFilterValues;
|
|
234
305
|
focusTask?: TFocusTask;
|
|
235
306
|
_cellWidth?: number;
|
|
236
307
|
_sort?: TSort[];
|
|
308
|
+
_resourceSort?: TSort[];
|
|
237
309
|
_weekStart?: Day;
|
|
238
310
|
_markers?: IMarker[];
|
|
239
311
|
_rollups?: {
|
|
240
312
|
[key: TID]: Array<ITask>;
|
|
241
313
|
};
|
|
314
|
+
_resources?: IComputedResource[];
|
|
242
315
|
_isFiltered?: boolean;
|
|
316
|
+
tree?: [];
|
|
243
317
|
_chartWidth?: number;
|
|
244
318
|
_chartHeight?: number;
|
|
245
319
|
_scrollSize?: number;
|
|
320
|
+
_calendar?: ICalendar;
|
|
321
|
+
_calendars?: Record<TID, ICalendar>;
|
|
322
|
+
_compactMode: boolean;
|
|
323
|
+
_columnsWidth?: number;
|
|
324
|
+
_gridCollapseThreshold?: number;
|
|
246
325
|
}
|
|
247
|
-
export interface IData extends Omit<IDataConfig,
|
|
326
|
+
export interface IData extends Omit<IDataConfig, TDataName | "rollups" | "groupBy"> {
|
|
248
327
|
rollups?: false | {
|
|
249
328
|
type: "all" | "closest";
|
|
250
329
|
};
|
|
251
330
|
zoom?: IZoomConfig;
|
|
252
331
|
tasks: GanttDataTree;
|
|
253
332
|
links: DataArray<ILink>;
|
|
333
|
+
resources?: ResourceDataTree;
|
|
334
|
+
assignments?: DataArray<IAssignment>;
|
|
335
|
+
calendars?: GanttCalendarConfig[];
|
|
336
|
+
tree: GanttDataTree;
|
|
254
337
|
_tasks: IParsedTask[];
|
|
338
|
+
_tasksPatch?: boolean | null;
|
|
255
339
|
_rollups: {
|
|
256
340
|
[key: TID]: Array<ITask>;
|
|
257
341
|
};
|
|
258
342
|
_links: IGanttLink[];
|
|
343
|
+
_assignments?: IDataAssignment;
|
|
259
344
|
_selected?: ITask[];
|
|
260
345
|
_activeTask?: ITask;
|
|
261
346
|
_start?: Date;
|
|
262
347
|
_end?: Date;
|
|
263
348
|
_scales?: GanttScaleData;
|
|
349
|
+
_scaleMinUnit?: TLengthUnit;
|
|
264
350
|
_scaleDate?: Date;
|
|
265
351
|
_zoomOffset?: number;
|
|
266
352
|
_weekStart?: Day;
|
|
@@ -269,6 +355,9 @@ export interface IData extends Omit<IDataConfig, "tasks" | "links" | "rollups">
|
|
|
269
355
|
_chartWidth?: number;
|
|
270
356
|
_chartHeight?: number;
|
|
271
357
|
_scrollSize?: number;
|
|
358
|
+
_columnsWidth?: number;
|
|
359
|
+
groupBy?: IGroupByConfig;
|
|
360
|
+
_gridCollapseThreshold?: number;
|
|
272
361
|
}
|
|
273
362
|
export interface IDataHash<T = any> {
|
|
274
363
|
[key: string]: T;
|
|
@@ -328,7 +417,7 @@ export type IGanttColumn = {
|
|
|
328
417
|
id?: string;
|
|
329
418
|
template?: IColumn["template"];
|
|
330
419
|
_template?: IColumn["template"];
|
|
331
|
-
sort?: boolean;
|
|
420
|
+
sort?: boolean | TSortFunction;
|
|
332
421
|
cell?: any;
|
|
333
422
|
editor?: IColumn["editor"];
|
|
334
423
|
options?: IColumn["options"];
|
|
@@ -341,7 +430,7 @@ export type TCommonShape = {
|
|
|
341
430
|
labelTemplate?: (value: any) => string;
|
|
342
431
|
config?: Record<string, any>;
|
|
343
432
|
[key: string]: any;
|
|
344
|
-
isHidden?: (task: Partial<ITask
|
|
433
|
+
isHidden?: (task: Partial<ITask>, state: IData) => boolean;
|
|
345
434
|
isDisabled?: (task: Partial<ITask>, state: IData) => boolean;
|
|
346
435
|
};
|
|
347
436
|
export type TTextFieldShape = TCommonShape & {
|
|
@@ -380,7 +469,16 @@ export type ILinksShape = TCommonShape & {
|
|
|
380
469
|
export type ITwoStateShape = TCommonShape & {
|
|
381
470
|
comp: "twostate";
|
|
382
471
|
};
|
|
383
|
-
export type
|
|
472
|
+
export type IResources = TCommonShape & {
|
|
473
|
+
comp: "resources";
|
|
474
|
+
};
|
|
475
|
+
export type ITabs = TCommonShape & {
|
|
476
|
+
comp: "tabs";
|
|
477
|
+
};
|
|
478
|
+
export type ISegments = TCommonShape & {
|
|
479
|
+
comp: "segments";
|
|
480
|
+
};
|
|
481
|
+
export type TEditorItem = TTextFieldShape | TCounterShape | TComboFieldShape | TSliderShape | TDateFieldShape | TRadioShape | ILinksShape | ITwoStateShape | TCheckboxShape | IResources | ISegments | ITabs;
|
|
384
482
|
export type ITaskType = {
|
|
385
483
|
id: TID;
|
|
386
484
|
label: string;
|
|
@@ -411,5 +509,11 @@ export interface IApi {
|
|
|
411
509
|
};
|
|
412
510
|
getTable: (waitRender?: boolean) => Promise<ITableApi> | ITableApi;
|
|
413
511
|
getTask: (id: TID) => ITask;
|
|
414
|
-
|
|
512
|
+
getResource: (id: TID) => IResource;
|
|
513
|
+
serialize: (config?: {
|
|
514
|
+
data?: keyof TSerializeData;
|
|
515
|
+
}) => TSerializeData[keyof TSerializeData] | null;
|
|
516
|
+
getCalendar: (id?: TID) => ICalendar | undefined;
|
|
517
|
+
getTaskResources: (id: TID) => TResourceAssignment[];
|
|
518
|
+
getResourceTasks: (id: TID) => ITask[];
|
|
415
519
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svar-ui/gantt-store",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
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
|
}
|