@svar-ui/gantt-store 2.2.1 → 2.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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/DataStore.d.ts +1 -0
- package/dist/types/columns.d.ts +3 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/normalizeDates.d.ts +3 -3
- package/dist/types/scales.d.ts +8 -8
- package/dist/types/time.d.ts +2 -3
- package/dist/types/types.d.ts +97 -103
- package/package.json +1 -1
package/dist/types/columns.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function normalizeColumns(columns:
|
|
3
|
-
export declare const defaultColumns:
|
|
1
|
+
import type { IGanttColumn } from "./types";
|
|
2
|
+
export declare function normalizeColumns(columns: IGanttColumn[]): IGanttColumn[];
|
|
3
|
+
export declare const defaultColumns: IGanttColumn[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export { defaultEditorItems } from "./editorItems";
|
|
|
9
9
|
export { defaultColumns } from "./columns";
|
|
10
10
|
export { defaultTaskTypes } from "./taskTypes";
|
|
11
11
|
export { normalizeDates } from "./normalizeDates";
|
|
12
|
-
export type { TID, ITask, ILink, IZoomConfig,
|
|
12
|
+
export type { TID, IApi, ITask, ILink, IConfig, IZoomConfig, IGanttColumn, TMethodsConfig, IGanttTask, } from "./types";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ITask } from "./types";
|
|
2
|
-
export declare function prepareTask(currentTask: Partial<ITask>, task: Partial<ITask>, unit:
|
|
3
|
-
export declare function normalizeDates(task: Partial<ITask>, unit:
|
|
1
|
+
import type { ITask, TDurationUnit } from "./types";
|
|
2
|
+
export declare function prepareTask(currentTask: Partial<ITask>, task: Partial<ITask>, unit: TDurationUnit): void;
|
|
3
|
+
export declare function normalizeDates(task: Partial<ITask>, unit: TDurationUnit, edit?: boolean, key?: string): void;
|
|
4
4
|
export declare function getFields(isBaseline: boolean): string[];
|
package/dist/types/scales.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IScaleConfig, GanttScaleData, IZoomConfig, TLengthUnit } from "./types";
|
|
2
2
|
import type GanttDataTree from "./GanttDataTree";
|
|
3
|
-
export declare function getMinUnit(scales:
|
|
3
|
+
export declare function getMinUnit(scales: IScaleConfig[]): IScaleConfig;
|
|
4
4
|
export declare const units: string[];
|
|
5
5
|
export declare function calcScales(prevStart: Date, prevEnd: Date, autoScale: boolean, minUnit?: string, tasks?: GanttDataTree): {
|
|
6
6
|
_start: Date;
|
|
7
7
|
_end: Date;
|
|
8
8
|
};
|
|
9
|
-
export declare function resetScales(start: Date, end: Date, lengthUnit:
|
|
10
|
-
export declare function normalizeZoom(zoom: boolean | IZoomConfig, scales:
|
|
9
|
+
export declare function resetScales(start: Date, end: Date, lengthUnit: TLengthUnit, width: number, height: number, scales: IScaleConfig[]): GanttScaleData | null;
|
|
10
|
+
export declare function normalizeZoom(zoom: boolean | IZoomConfig, scales: IScaleConfig[], cellWidth: number): {
|
|
11
11
|
_zoom: IZoomConfig;
|
|
12
|
-
scales:
|
|
12
|
+
scales: IScaleConfig[];
|
|
13
13
|
cellWidth: number;
|
|
14
14
|
};
|
|
15
|
-
export declare function zoomScale(zoom: IZoomConfig, step: number, level: number, nextUnit: any, lengthUnit:
|
|
16
|
-
scales:
|
|
15
|
+
export declare function zoomScale(zoom: IZoomConfig, step: number, level: number, nextUnit: any, lengthUnit: TLengthUnit, scales: IScaleConfig[], cellWidth: number): {
|
|
16
|
+
scales: IScaleConfig[];
|
|
17
17
|
cellWidth: number;
|
|
18
|
-
lengthUnit:
|
|
18
|
+
lengthUnit: TLengthUnit;
|
|
19
19
|
zoom: IZoomConfig;
|
|
20
20
|
};
|
package/dist/types/time.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { format } from "date-fns";
|
|
2
|
+
import type { GanttScaleUnit } from "./types";
|
|
2
3
|
export declare function getSmallerUnitCount(unit: string, lengthUnit: string, date?: Date): number;
|
|
3
4
|
export declare function isCorrectLengthUnit(minUnit: string, lengthUnit: string): boolean;
|
|
4
5
|
export declare function getDiffer(unit: string): {
|
|
@@ -10,7 +11,5 @@ export declare function getAdder(unit: string): {
|
|
|
10
11
|
export declare function getUnitStart(unit: string, date: Date): Date;
|
|
11
12
|
export declare function getUnitEnd(unit: string, date: Date): Date;
|
|
12
13
|
export declare function isSameUnit(unit: string, a: Date, b: Date): boolean;
|
|
13
|
-
export declare function registerScaleUnit(unit: string, config:
|
|
14
|
-
[name: string]: any;
|
|
15
|
-
}): void;
|
|
14
|
+
export declare function registerScaleUnit(unit: string, config: GanttScaleUnit): void;
|
|
16
15
|
export { format };
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { IDataMethodsConfig } from "./DataStore";
|
|
2
|
-
import type { DataArray, TID } from "@wx/lib-state";
|
|
2
|
+
import type { DataArray, TID, IEventBus, IPublicWritable, IEventConfig } from "@wx/lib-state";
|
|
3
3
|
import type GanttDataTree from "./GanttDataTree";
|
|
4
|
+
import type DataStore from "./DataStore";
|
|
5
|
+
import type { IApi as ITableApi, IColumn } from "@wx/grid-store";
|
|
4
6
|
export type TMethodsConfig = IDataMethodsConfig;
|
|
5
7
|
export type { GanttDataTree, TID };
|
|
6
8
|
export interface IActionConfig<T = any> {
|
|
@@ -8,27 +10,22 @@ export interface IActionConfig<T = any> {
|
|
|
8
10
|
noSave?: boolean;
|
|
9
11
|
}
|
|
10
12
|
export type TLinkType = "s2s" | "s2e" | "e2s" | "e2e";
|
|
11
|
-
export type TTaskType = "task" | "summary" | "milestone";
|
|
12
|
-
export type
|
|
13
|
-
export
|
|
14
|
-
type: TEditorType;
|
|
15
|
-
config?: {
|
|
16
|
-
template?: (v: any) => string;
|
|
17
|
-
cell?: any;
|
|
18
|
-
options?: any[];
|
|
19
|
-
buttons?: boolean | string[];
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export type TEditorHandler = (row?: ITask, column?: any) => TEditorType | IColumnEditor | null;
|
|
13
|
+
export type TTaskType = "task" | "summary" | "milestone" | string;
|
|
14
|
+
export type TLengthUnit = "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year" | string;
|
|
15
|
+
export type TDurationUnit = "day" | "hour";
|
|
23
16
|
export interface ILink {
|
|
24
|
-
id
|
|
17
|
+
id?: TID;
|
|
25
18
|
type: TLinkType;
|
|
26
19
|
source: TID;
|
|
27
20
|
target: TID;
|
|
28
21
|
}
|
|
22
|
+
export interface IGanttLink extends ILink {
|
|
23
|
+
id: TID;
|
|
24
|
+
$p: string;
|
|
25
|
+
}
|
|
29
26
|
export interface ITask {
|
|
30
27
|
start?: Date;
|
|
31
|
-
id
|
|
28
|
+
id?: TID;
|
|
32
29
|
end?: Date;
|
|
33
30
|
duration?: number;
|
|
34
31
|
data?: ITask[];
|
|
@@ -45,10 +42,20 @@ export interface ITask {
|
|
|
45
42
|
[key: string]: any;
|
|
46
43
|
}
|
|
47
44
|
export interface IParsedTask extends ITask {
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
id: TID;
|
|
46
|
+
parent?: TID;
|
|
47
|
+
data?: IParsedTask[];
|
|
50
48
|
$level: number;
|
|
51
49
|
}
|
|
50
|
+
export interface IGanttTask extends IParsedTask {
|
|
51
|
+
$x: number;
|
|
52
|
+
$y: number;
|
|
53
|
+
$h: number;
|
|
54
|
+
$w: number;
|
|
55
|
+
$x_base?: number;
|
|
56
|
+
$w_base?: number;
|
|
57
|
+
$reorder?: boolean;
|
|
58
|
+
}
|
|
52
59
|
export type TDispatch = <A extends keyof TMethodsConfig>(action: A, data: TMethodsConfig[A]) => void;
|
|
53
60
|
export interface IMethodsHash {
|
|
54
61
|
[key: string]: any;
|
|
@@ -64,7 +71,7 @@ export interface IVisibleArea {
|
|
|
64
71
|
end: number;
|
|
65
72
|
}
|
|
66
73
|
export interface IZoomConfig {
|
|
67
|
-
level
|
|
74
|
+
level?: number;
|
|
68
75
|
minCellWidth?: number;
|
|
69
76
|
maxCellWidth?: number;
|
|
70
77
|
levels?: Array<IScaleLevel>;
|
|
@@ -72,7 +79,7 @@ export interface IZoomConfig {
|
|
|
72
79
|
export interface IScaleLevel {
|
|
73
80
|
minCellWidth: number;
|
|
74
81
|
maxCellWidth: number;
|
|
75
|
-
scales:
|
|
82
|
+
scales: IScaleConfig[];
|
|
76
83
|
}
|
|
77
84
|
export interface IMarker {
|
|
78
85
|
start: Date;
|
|
@@ -80,77 +87,57 @@ export interface IMarker {
|
|
|
80
87
|
css?: string;
|
|
81
88
|
left?: number;
|
|
82
89
|
}
|
|
83
|
-
export interface
|
|
90
|
+
export interface IConfig {
|
|
91
|
+
tasks?: ITask[];
|
|
92
|
+
links?: any[];
|
|
93
|
+
taskTypes?: ITaskType[];
|
|
84
94
|
selected?: TID[];
|
|
85
95
|
activeTask?: TID;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
start
|
|
89
|
-
end
|
|
90
|
-
lengthUnit
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
scales?: IScaleConfig[];
|
|
97
|
+
columns?: IGanttColumn[];
|
|
98
|
+
start?: Date;
|
|
99
|
+
end?: Date;
|
|
100
|
+
lengthUnit?: TLengthUnit;
|
|
101
|
+
durationUnit?: TDurationUnit;
|
|
102
|
+
cellWidth?: number;
|
|
103
|
+
cellHeight?: number;
|
|
104
|
+
scaleHeight?: number;
|
|
105
|
+
zoom?: boolean | IZoomConfig;
|
|
106
|
+
autoScale?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface IProConfig extends IConfig {
|
|
109
|
+
unscheduledTasks?: boolean;
|
|
110
|
+
baselines?: boolean;
|
|
111
|
+
markers?: IMarker[];
|
|
112
|
+
}
|
|
113
|
+
export interface IDataConfig extends IProConfig {
|
|
96
114
|
scrollLeft: number;
|
|
97
115
|
scrollTop: number;
|
|
98
116
|
area: IVisibleArea;
|
|
99
|
-
taskTypes?: ITaskType[];
|
|
100
|
-
baselines?: boolean;
|
|
101
|
-
zoom: boolean | IZoomConfig;
|
|
102
|
-
highlightTime?: (date: Date, unit: "day" | "hour") => string;
|
|
103
117
|
_cellWidth?: number;
|
|
104
118
|
_sort?: TSort[];
|
|
105
|
-
autoScale?: boolean;
|
|
106
|
-
unscheduledTasks?: boolean;
|
|
107
|
-
markers?: IMarker[];
|
|
108
|
-
durationUnit: "day" | "hour";
|
|
109
119
|
_scrollTask?: TScrollTask;
|
|
110
120
|
}
|
|
111
|
-
export interface IData {
|
|
112
|
-
|
|
113
|
-
_selected: ITask[];
|
|
114
|
-
activeTask: TID;
|
|
115
|
-
_activeTask: ITask;
|
|
121
|
+
export interface IData extends Omit<IDataConfig, "tasks" | "links"> {
|
|
122
|
+
zoom?: IZoomConfig;
|
|
116
123
|
tasks: GanttDataTree;
|
|
117
|
-
_tasks: IParsedTask[];
|
|
118
124
|
links: DataArray<ILink>;
|
|
125
|
+
_tasks: IParsedTask[];
|
|
119
126
|
_links: IGanttLink[];
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
_end
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
cellHeight: number;
|
|
127
|
-
scaleHeight: number;
|
|
128
|
-
scales: GanttScale[];
|
|
129
|
-
_scales: GanttScaleData;
|
|
130
|
-
columns: GanttColumn[];
|
|
131
|
-
scrollTop: number;
|
|
132
|
-
scrollLeft: number;
|
|
133
|
-
area: IVisibleArea;
|
|
134
|
-
taskTypes?: ITaskType[];
|
|
135
|
-
baselines?: boolean;
|
|
136
|
-
zoom: IZoomConfig;
|
|
137
|
-
highlightTime?: (date: Date, unit: "day" | "hour") => string;
|
|
138
|
-
_cellWidth?: number;
|
|
139
|
-
_sort?: TSort[];
|
|
127
|
+
_selected?: ITask[];
|
|
128
|
+
_activeTask?: ITask;
|
|
129
|
+
_start?: Date;
|
|
130
|
+
_end?: Date;
|
|
131
|
+
_scales?: GanttScaleData;
|
|
132
|
+
_markers?: IMarker[];
|
|
140
133
|
_scaleDate?: Date;
|
|
141
134
|
_zoomOffset?: number;
|
|
142
|
-
autoScale?: boolean;
|
|
143
|
-
markers?: IMarker[];
|
|
144
|
-
_markers?: IMarker[];
|
|
145
|
-
unscheduledTasks?: boolean;
|
|
146
|
-
durationUnit: "day" | "hour";
|
|
147
|
-
_scrollTask?: TScrollTask;
|
|
148
135
|
}
|
|
149
136
|
export interface DataHash {
|
|
150
137
|
[key: string]: any;
|
|
151
138
|
}
|
|
152
|
-
export type
|
|
153
|
-
unit:
|
|
139
|
+
export type IScaleConfig = {
|
|
140
|
+
unit: TLengthUnit;
|
|
154
141
|
step: number;
|
|
155
142
|
format?: {
|
|
156
143
|
(date: Date, next?: Date): string;
|
|
@@ -175,49 +162,39 @@ export type GanttScaleData = {
|
|
|
175
162
|
height: number;
|
|
176
163
|
start: Date;
|
|
177
164
|
end: Date;
|
|
178
|
-
lengthUnit:
|
|
165
|
+
lengthUnit: TLengthUnit;
|
|
179
166
|
minUnit: string;
|
|
180
167
|
lengthUnitWidth: number;
|
|
181
168
|
diff: {
|
|
182
|
-
(a: Date, b: Date, lengthUnit?:
|
|
169
|
+
(a: Date, b: Date, lengthUnit?: TLengthUnit, unitSize?: boolean): number;
|
|
183
170
|
};
|
|
184
171
|
};
|
|
185
|
-
export type
|
|
172
|
+
export type GanttScaleUnit = {
|
|
173
|
+
start: (date: Date) => Date;
|
|
174
|
+
end: (date: Date) => Date;
|
|
175
|
+
isSame: (date1: Date, date2: Date) => boolean;
|
|
176
|
+
add: (date: Date, num: number) => Date;
|
|
177
|
+
diff?: (date1: Date, date2: Date) => number;
|
|
178
|
+
smallerCount?: {
|
|
179
|
+
[key: TLengthUnit]: number | ((date: Date) => number);
|
|
180
|
+
};
|
|
181
|
+
biggerCount?: {
|
|
182
|
+
[key: TLengthUnit]: number | ((date: Date) => number);
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
export type IGanttColumn = {
|
|
186
186
|
width?: number;
|
|
187
187
|
align?: "left" | "right" | "center";
|
|
188
188
|
flexgrow?: number;
|
|
189
189
|
resize?: boolean;
|
|
190
|
-
header
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
text: string;
|
|
194
|
-
};
|
|
195
|
-
id: string;
|
|
196
|
-
action?: string;
|
|
197
|
-
template?: {
|
|
198
|
-
(b: any, row: any): string;
|
|
199
|
-
};
|
|
190
|
+
header?: IColumn["header"];
|
|
191
|
+
id?: string;
|
|
192
|
+
template?: IColumn["template"];
|
|
200
193
|
sort?: boolean;
|
|
201
194
|
cell?: any;
|
|
202
|
-
editor?:
|
|
203
|
-
options?:
|
|
195
|
+
editor?: IColumn["editor"];
|
|
196
|
+
options?: IColumn["options"];
|
|
204
197
|
};
|
|
205
|
-
export interface IGanttTask extends IParsedTask {
|
|
206
|
-
end: Date;
|
|
207
|
-
duration: number;
|
|
208
|
-
unscheduled?: boolean;
|
|
209
|
-
$x: number;
|
|
210
|
-
$y: number;
|
|
211
|
-
$h: number;
|
|
212
|
-
$w: number;
|
|
213
|
-
$x_base?: number;
|
|
214
|
-
$w_base?: number;
|
|
215
|
-
$reorder?: boolean;
|
|
216
|
-
}
|
|
217
|
-
export interface IGanttLink extends ILink {
|
|
218
|
-
id: TID;
|
|
219
|
-
$p: string;
|
|
220
|
-
}
|
|
221
198
|
export type TCommonShape = {
|
|
222
199
|
id?: TID;
|
|
223
200
|
key: string;
|
|
@@ -273,3 +250,20 @@ export type TScrollTask = {
|
|
|
273
250
|
id: TID;
|
|
274
251
|
mode?: "x" | "y" | "xy" | boolean;
|
|
275
252
|
};
|
|
253
|
+
export interface IApi {
|
|
254
|
+
exec: <A extends keyof TMethodsConfig | (string & {})>(action: A, params?: A extends keyof TMethodsConfig ? TMethodsConfig[A] : any) => Promise<any>;
|
|
255
|
+
on: <A extends keyof TMethodsConfig | (string & {})>(action: A, callback: (config: A extends keyof TMethodsConfig ? TMethodsConfig[A] : any) => any, config?: IEventConfig) => void;
|
|
256
|
+
intercept: <A extends keyof TMethodsConfig | (string & {})>(action: A, callback: (config: A extends keyof TMethodsConfig ? TMethodsConfig[A] : any) => any, config?: IEventConfig) => void;
|
|
257
|
+
detach: (tag: IEventConfig["tag"]) => void;
|
|
258
|
+
getState: () => IData;
|
|
259
|
+
getReactiveState: () => {
|
|
260
|
+
[Key in keyof IData]: IPublicWritable<IData[Key]>;
|
|
261
|
+
};
|
|
262
|
+
setNext: (ev: IEventBus<TMethodsConfig>) => void;
|
|
263
|
+
getStores: () => {
|
|
264
|
+
data: DataStore;
|
|
265
|
+
};
|
|
266
|
+
getTable: (waitRender?: boolean) => Promise<ITableApi> | ITableApi;
|
|
267
|
+
getTask: (id: TID) => ITask;
|
|
268
|
+
serialize: () => ITask[];
|
|
269
|
+
}
|