@svar-ui/gantt-store 2.5.2 → 2.6.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 +19 -9
- package/dist/types/GanttDataTree.d.ts +10 -5
- package/dist/types/helpers/editorItems.d.ts +10 -0
- package/dist/types/helpers/filter.d.ts +3 -0
- package/dist/types/helpers/sort.d.ts +2 -2
- package/dist/types/links.d.ts +1 -1
- package/dist/types/scales.d.ts +4 -3
- package/dist/types/tasks.d.ts +5 -4
- package/dist/types/types.d.ts +40 -8
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Store, EventBus } from "@svar-ui/lib-state";
|
|
2
2
|
import type { TDataConfig, TWritableCreator, TID } from "@svar-ui/lib-state";
|
|
3
3
|
import { HistoryManager } from "./pro/HistoryManager";
|
|
4
|
-
import type { IData, IDataConfig, ITask, TMethodsConfig, ILink, IVisibleArea, IParsedTask,
|
|
4
|
+
import type { IData, IDataConfig, ITask, TMethodsConfig, ILink, IVisibleArea, IParsedTask, IExportConfig, TFilterHandler, TScrollMode } from "./types";
|
|
5
5
|
export default class DataStore extends Store<IData> {
|
|
6
6
|
in: EventBus<TMethodsConfig, keyof TMethodsConfig>;
|
|
7
7
|
private _router;
|
|
@@ -24,6 +24,7 @@ export default class DataStore extends Store<IData> {
|
|
|
24
24
|
private calcScaleDate;
|
|
25
25
|
getNextRow(id: TID): IParsedTask;
|
|
26
26
|
getPrevRow(id: TID): IParsedTask;
|
|
27
|
+
scrollToTask(id: TID, mode: TScrollMode, eventSource?: keyof IDataMethodsConfig): void;
|
|
27
28
|
}
|
|
28
29
|
type CombineTypes<T, N> = {
|
|
29
30
|
[P in keyof T]: T[P] & N;
|
|
@@ -34,7 +35,7 @@ export type IDataMethodsConfig = CombineTypes<{
|
|
|
34
35
|
task: Partial<ITask>;
|
|
35
36
|
target?: TID;
|
|
36
37
|
mode?: "before" | "after" | "child";
|
|
37
|
-
show?:
|
|
38
|
+
show?: TScrollMode;
|
|
38
39
|
select?: boolean;
|
|
39
40
|
eventSource?: string;
|
|
40
41
|
};
|
|
@@ -59,7 +60,9 @@ export type IDataMethodsConfig = CombineTypes<{
|
|
|
59
60
|
id: TID;
|
|
60
61
|
toggle?: boolean;
|
|
61
62
|
range?: boolean;
|
|
62
|
-
|
|
63
|
+
column?: string | boolean;
|
|
64
|
+
show?: TScrollMode;
|
|
65
|
+
focus?: "grid" | "chart";
|
|
63
66
|
};
|
|
64
67
|
["drag-task"]: {
|
|
65
68
|
id: TID;
|
|
@@ -67,7 +70,6 @@ export type IDataMethodsConfig = CombineTypes<{
|
|
|
67
70
|
width?: number;
|
|
68
71
|
left?: number;
|
|
69
72
|
top?: number;
|
|
70
|
-
start?: boolean;
|
|
71
73
|
inProgress?: boolean;
|
|
72
74
|
};
|
|
73
75
|
["copy-task"]: {
|
|
@@ -109,6 +111,8 @@ export type IDataMethodsConfig = CombineTypes<{
|
|
|
109
111
|
["scroll-chart"]: {
|
|
110
112
|
left?: number;
|
|
111
113
|
top?: number;
|
|
114
|
+
date?: Date;
|
|
115
|
+
eventSource?: string;
|
|
112
116
|
};
|
|
113
117
|
["render-data"]: IVisibleArea;
|
|
114
118
|
["request-data"]: {
|
|
@@ -126,21 +130,27 @@ export type IDataMethodsConfig = CombineTypes<{
|
|
|
126
130
|
ratio?: number;
|
|
127
131
|
offset?: number;
|
|
128
132
|
};
|
|
129
|
-
["expand-scale"]: {
|
|
130
|
-
minWidth: number;
|
|
131
|
-
date?: Date;
|
|
132
|
-
offset?: number;
|
|
133
|
-
};
|
|
134
133
|
["sort-tasks"]: {
|
|
135
134
|
key: string;
|
|
136
135
|
order: "asc" | "desc";
|
|
137
136
|
add?: boolean;
|
|
138
137
|
};
|
|
138
|
+
["filter-tasks"]: {
|
|
139
|
+
filter?: TFilterHandler;
|
|
140
|
+
key?: string;
|
|
141
|
+
value?: any;
|
|
142
|
+
open?: boolean;
|
|
143
|
+
};
|
|
139
144
|
["hotkey"]: {
|
|
140
145
|
key: string;
|
|
141
146
|
event: any;
|
|
142
147
|
eventSource?: string;
|
|
143
148
|
};
|
|
149
|
+
["resize-chart"]: {
|
|
150
|
+
width: number;
|
|
151
|
+
height: number;
|
|
152
|
+
scrollSize: number;
|
|
153
|
+
};
|
|
144
154
|
["schedule-tasks"]: {
|
|
145
155
|
id?: TID;
|
|
146
156
|
task?: Partial<ITask>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataTree, TID } from "@svar-ui/lib-state";
|
|
2
|
-
import
|
|
2
|
+
import { ITask, IParsedTask, TSort, TFilterHandler, IGanttColumn } from "./types";
|
|
3
3
|
export default class GanttDataTree extends DataTree<IParsedTask> {
|
|
4
|
-
private
|
|
4
|
+
private _filteredIds;
|
|
5
5
|
constructor(tasks?: Partial<ITask>[]);
|
|
6
6
|
parse(tasks: Partial<ITask>[], parent: TID): void;
|
|
7
7
|
getBranch(id: TID): IParsedTask[];
|
|
@@ -9,11 +9,16 @@ export default class GanttDataTree extends DataTree<IParsedTask> {
|
|
|
9
9
|
getIndexById(id: TID): number;
|
|
10
10
|
add(task: Partial<ITask>, index: number): IParsedTask;
|
|
11
11
|
copy(taskObj: ITask, parent: TID, ind: number): TID[][];
|
|
12
|
+
remove(id: TID): void;
|
|
12
13
|
normalizeTask(task: Partial<ITask>): ITask;
|
|
13
14
|
getSummaryId(id: TID): TID | null;
|
|
14
|
-
getSummaryId(id: TID, all:
|
|
15
|
-
sort(conf: TSort[]): void;
|
|
16
|
-
sortBranch(conf: TSort[], parent
|
|
15
|
+
getSummaryId(id: TID, all: boolean): TID[] | null;
|
|
16
|
+
sort(conf: TSort[], columns: IGanttColumn[]): void;
|
|
17
|
+
sortBranch(conf: TSort[], parent: TID, columns: IGanttColumn[]): void;
|
|
17
18
|
serialize(): Partial<ITask>[];
|
|
18
19
|
clear(): void;
|
|
20
|
+
filterTree(filter?: TFilterHandler, open?: boolean): void;
|
|
21
|
+
toArray(all?: boolean): IParsedTask[];
|
|
22
|
+
isFilteredId(id: TID): boolean;
|
|
23
|
+
hasChildItems(task: Partial<IParsedTask>): boolean;
|
|
19
24
|
}
|
|
@@ -47,6 +47,16 @@ export declare function getEditorItems(config?: IDataConfig): ({
|
|
|
47
47
|
id: any;
|
|
48
48
|
label: string;
|
|
49
49
|
}[];
|
|
50
|
+
} | {
|
|
51
|
+
[x: string]: any;
|
|
52
|
+
id?: import("@svar-ui/lib-state").TID;
|
|
53
|
+
key: string;
|
|
54
|
+
label?: string;
|
|
55
|
+
labelTemplate?: (value: any) => string;
|
|
56
|
+
config?: Record<string, any>;
|
|
57
|
+
isHidden?: (task: Partial<ITask>) => boolean;
|
|
58
|
+
isDisabled?: (task: Partial<ITask>, state: IData) => boolean;
|
|
59
|
+
comp: "checkbox";
|
|
50
60
|
} | {
|
|
51
61
|
[x: string]: any;
|
|
52
62
|
id?: import("@svar-ui/lib-state").TID;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IParsedTask, TFilterHandler, TID } from "../types";
|
|
2
|
+
export declare function filterTask(task: IParsedTask, filter: TFilterHandler, ids: Set<TID>, open?: boolean): boolean;
|
|
3
|
+
export declare function deleteFromFiltered(ids: Set<string | number>, id: TID, branch?: IParsedTask[]): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { IParsedTask, TSort } from "../types";
|
|
2
|
-
export declare function sort(data: IParsedTask[], conf: TSort[]): IParsedTask[];
|
|
1
|
+
import type { IGanttColumn, IParsedTask, TSort } from "../types";
|
|
2
|
+
export declare function sort(data: IParsedTask[], conf: TSort[], columns: IGanttColumn[]): IParsedTask[];
|
package/dist/types/links.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IGanttTask, IGanttLink, ILink } from "./types";
|
|
2
|
-
export declare const updateLink: (link: IGanttLink, startTask: IGanttTask, endTask: IGanttTask,
|
|
2
|
+
export declare const updateLink: (link: IGanttLink, startTask: IGanttTask, endTask: IGanttTask, cellHeight: number) => IGanttLink;
|
|
3
3
|
export declare function placeLink(box: {
|
|
4
4
|
left: number;
|
|
5
5
|
top: number;
|
package/dist/types/scales.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { IScaleConfig, GanttScaleData, IUnitFormats, IZoomConfig, TLengthUnit, IMarker } from "./types";
|
|
1
|
+
import type { IScaleConfig, GanttScaleData, IUnitFormats, IZoomConfig, TLengthUnit, IMarker, IData } from "./types";
|
|
2
2
|
import type GanttDataTree from "./GanttDataTree";
|
|
3
3
|
import { Day } from "date-fns";
|
|
4
4
|
export declare function getMinUnit(scales: IScaleConfig[]): IScaleConfig;
|
|
5
5
|
export declare const units: string[];
|
|
6
|
-
export declare function calcScales(prevStart?: Date, prevEnd?: Date, autoScale?: boolean, minUnit?: string, tasks?: GanttDataTree, markers?: IMarker[]): {
|
|
6
|
+
export declare function calcScales(prevStart?: Date, prevEnd?: Date, autoScale?: boolean, minUnit?: string, tasks?: GanttDataTree, markers?: IMarker[], projectStart?: Date, projectEnd?: Date, baselines?: boolean): {
|
|
7
7
|
_start: Date;
|
|
8
8
|
_end: Date;
|
|
9
9
|
};
|
|
10
|
-
export declare function resetScales(start: Date, end: Date, lengthUnit: TLengthUnit, width: number, height: number, _weekStart: Day, scales: IScaleConfig[]): GanttScaleData | null;
|
|
10
|
+
export declare function resetScales(start: Date, end: Date, lengthUnit: TLengthUnit, width: number, height: number, _weekStart: Day, scales: IScaleConfig[], minLength: number): GanttScaleData | null;
|
|
11
11
|
export declare function normalizeZoom(zoom: boolean | IZoomConfig, unitFormats: IUnitFormats, scales: IScaleConfig[], cellWidth: number): {
|
|
12
12
|
zoom: IZoomConfig;
|
|
13
13
|
scales: IScaleConfig[];
|
|
@@ -19,3 +19,4 @@ export declare function zoomScale(zoom: IZoomConfig, step: number, level: number
|
|
|
19
19
|
lengthUnit: TLengthUnit;
|
|
20
20
|
zoom: IZoomConfig;
|
|
21
21
|
};
|
|
22
|
+
export declare function expandScale(minWidth: number, state: Partial<IData>): Partial<IData>;
|
package/dist/types/tasks.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IGanttTask, IParsedTask, GanttDataTree, ITask,
|
|
2
|
-
export declare
|
|
3
|
-
export declare function
|
|
1
|
+
import { IGanttTask, IParsedTask, GanttDataTree, ITask, IDataHash, IData } from "./types";
|
|
2
|
+
export declare const heightAdjustment = 7;
|
|
3
|
+
export declare function dragSummaryKids(task: IParsedTask, dx: number, rollups: boolean): void;
|
|
4
|
+
export declare function dragSummary(tasks: GanttDataTree, task: IParsedTask): void;
|
|
4
5
|
export declare function setSummaryDates(task: ITask, tasks?: Partial<ITask>[]): ITask;
|
|
5
|
-
export declare function updateTask(t: IGanttTask, i: number, state: Partial<IData>): IGanttTask;
|
|
6
|
+
export declare function updateTask(t: IGanttTask, i: number | null, state: Partial<IData>): IGanttTask;
|
|
6
7
|
export declare function isSegmentMoveAllowed(task: IGanttTask, moveOptions: IDataHash): boolean;
|
|
7
8
|
export declare function extendDragOptions(task: ITask, options: IDataHash): void;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { DataArray, TID, IEventBus, IPublicWritable, IEventConfig } from "@
|
|
|
3
3
|
import type GanttDataTree from "./GanttDataTree";
|
|
4
4
|
import { Day } from "date-fns";
|
|
5
5
|
import type DataStore from "./DataStore";
|
|
6
|
-
import type { IApi as ITableApi, IColumn } from "@svar-ui/grid-store";
|
|
6
|
+
import type { IApi as ITableApi, IColumn, IFilterValues } from "@svar-ui/grid-store";
|
|
7
|
+
import { TaskSlackInfo } from "@svar-ui/lib-schedule";
|
|
7
8
|
export type TMethodsConfig = IDataMethodsConfig;
|
|
8
9
|
export type { GanttDataTree, TID };
|
|
9
10
|
export interface IExportConfig {
|
|
@@ -66,7 +67,7 @@ export interface IGanttLink extends ILink {
|
|
|
66
67
|
id: TID;
|
|
67
68
|
$p: string;
|
|
68
69
|
$pl: number;
|
|
69
|
-
|
|
70
|
+
critical?: boolean;
|
|
70
71
|
}
|
|
71
72
|
export interface ITask {
|
|
72
73
|
start?: Date;
|
|
@@ -77,6 +78,7 @@ export interface ITask {
|
|
|
77
78
|
base_start?: Date;
|
|
78
79
|
base_end?: Date;
|
|
79
80
|
base_duration?: number;
|
|
81
|
+
rollup?: boolean;
|
|
80
82
|
open?: boolean;
|
|
81
83
|
text?: string;
|
|
82
84
|
details?: string;
|
|
@@ -100,8 +102,16 @@ export interface IGanttTask extends IParsedTask {
|
|
|
100
102
|
$w: number;
|
|
101
103
|
$x_base?: number;
|
|
102
104
|
$w_base?: number;
|
|
105
|
+
$x_rollup?: number;
|
|
106
|
+
$h_rollup?: number;
|
|
107
|
+
$y_rollup_relative?: number;
|
|
108
|
+
$w_rollup?: number;
|
|
103
109
|
$reorder?: boolean;
|
|
104
|
-
|
|
110
|
+
critical?: boolean;
|
|
111
|
+
slack?: TaskSlackInfo;
|
|
112
|
+
$visibleSlack?: number;
|
|
113
|
+
$x_slack?: number;
|
|
114
|
+
$w_slack?: number;
|
|
105
115
|
}
|
|
106
116
|
export type TDispatch = <A extends keyof TMethodsConfig>(action: A, data: TMethodsConfig[A]) => void;
|
|
107
117
|
export interface IMethodsHash {
|
|
@@ -203,6 +213,9 @@ export interface IConfig {
|
|
|
203
213
|
undo?: boolean;
|
|
204
214
|
unscheduledTasks?: boolean;
|
|
205
215
|
baselines?: boolean;
|
|
216
|
+
rollups?: {
|
|
217
|
+
type: "all" | "closest";
|
|
218
|
+
};
|
|
206
219
|
markers?: IMarker[];
|
|
207
220
|
criticalPath?: ICriticalPathConfig;
|
|
208
221
|
projectStart?: Date;
|
|
@@ -210,23 +223,32 @@ export interface IConfig {
|
|
|
210
223
|
calendar?: Calendar;
|
|
211
224
|
splitTasks?: boolean;
|
|
212
225
|
summary?: ISummaryConfig;
|
|
226
|
+
slack?: boolean;
|
|
213
227
|
}
|
|
214
228
|
export interface IDataConfig extends IConfig {
|
|
215
229
|
scrollLeft: number;
|
|
216
230
|
scrollTop: number;
|
|
217
231
|
area: IVisibleArea;
|
|
218
232
|
history?: IHistory;
|
|
233
|
+
filterValues?: IFilterValues;
|
|
234
|
+
focusTask?: TFocusTask;
|
|
219
235
|
_cellWidth?: number;
|
|
220
236
|
_sort?: TSort[];
|
|
221
|
-
_scrollTask?: TScrollTask;
|
|
222
237
|
_weekStart?: Day;
|
|
223
238
|
_markers?: IMarker[];
|
|
239
|
+
_isFiltered?: boolean;
|
|
240
|
+
_chartWidth?: number;
|
|
241
|
+
_chartHeight?: number;
|
|
242
|
+
_scrollSize?: number;
|
|
224
243
|
}
|
|
225
244
|
export interface IData extends Omit<IDataConfig, "tasks" | "links"> {
|
|
226
245
|
zoom?: IZoomConfig;
|
|
227
246
|
tasks: GanttDataTree;
|
|
228
247
|
links: DataArray<ILink>;
|
|
229
248
|
_tasks: IParsedTask[];
|
|
249
|
+
_rollups: {
|
|
250
|
+
[key: TID]: Array<ITask>;
|
|
251
|
+
};
|
|
230
252
|
_links: IGanttLink[];
|
|
231
253
|
_selected?: ITask[];
|
|
232
254
|
_activeTask?: ITask;
|
|
@@ -236,7 +258,11 @@ export interface IData extends Omit<IDataConfig, "tasks" | "links"> {
|
|
|
236
258
|
_scaleDate?: Date;
|
|
237
259
|
_zoomOffset?: number;
|
|
238
260
|
_weekStart?: Day;
|
|
239
|
-
|
|
261
|
+
_isFiltered?: boolean;
|
|
262
|
+
_headerLength?: number;
|
|
263
|
+
_chartWidth?: number;
|
|
264
|
+
_chartHeight?: number;
|
|
265
|
+
_scrollSize?: number;
|
|
240
266
|
}
|
|
241
267
|
export interface IDataHash<T = any> {
|
|
242
268
|
[key: string]: T;
|
|
@@ -300,6 +326,7 @@ export type IGanttColumn = {
|
|
|
300
326
|
cell?: any;
|
|
301
327
|
editor?: IColumn["editor"];
|
|
302
328
|
options?: IColumn["options"];
|
|
329
|
+
getter?: (obj: IDataHash) => any;
|
|
303
330
|
};
|
|
304
331
|
export type TCommonShape = {
|
|
305
332
|
id?: TID;
|
|
@@ -331,6 +358,9 @@ export type TComboFieldShape = TCommonShape & {
|
|
|
331
358
|
label: string;
|
|
332
359
|
}[];
|
|
333
360
|
};
|
|
361
|
+
export type TCheckboxShape = TCommonShape & {
|
|
362
|
+
comp: "checkbox";
|
|
363
|
+
};
|
|
334
364
|
export type TSliderShape = TCommonShape & {
|
|
335
365
|
comp: "slider";
|
|
336
366
|
};
|
|
@@ -344,7 +374,7 @@ export type ILinksShape = TCommonShape & {
|
|
|
344
374
|
export type ITwoStateShape = TCommonShape & {
|
|
345
375
|
comp: "twostate";
|
|
346
376
|
};
|
|
347
|
-
export type TEditorItem = TTextFieldShape | TCounterShape | TComboFieldShape | TSliderShape | TDateFieldShape | TRadioShape | ILinksShape | ITwoStateShape;
|
|
377
|
+
export type TEditorItem = TTextFieldShape | TCounterShape | TComboFieldShape | TSliderShape | TDateFieldShape | TRadioShape | ILinksShape | ITwoStateShape | TCheckboxShape;
|
|
348
378
|
export type ITaskType = {
|
|
349
379
|
id: TID;
|
|
350
380
|
label: string;
|
|
@@ -354,9 +384,11 @@ export type TSort = {
|
|
|
354
384
|
order?: "asc" | "desc";
|
|
355
385
|
};
|
|
356
386
|
export type TSortValue = string | number | Date;
|
|
357
|
-
export type
|
|
387
|
+
export type TFilterHandler = (task: any) => boolean;
|
|
388
|
+
export type TScrollMode = "x" | "y" | "xy" | boolean;
|
|
389
|
+
export type TFocusTask = {
|
|
358
390
|
id: TID;
|
|
359
|
-
|
|
391
|
+
column?: boolean;
|
|
360
392
|
};
|
|
361
393
|
export interface IApi {
|
|
362
394
|
exec: <A extends keyof TMethodsConfig | (string & {})>(action: A, params?: A extends keyof TMethodsConfig ? TMethodsConfig[A] : any) => Promise<any>;
|