@fatcore/gantt-lite 1.0.1 → 1.0.2
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/README.md +9 -12
- package/fatcore-gantt-lite-1.0.0.tgz +0 -0
- package/fatcore-gantt-lite-1.0.2.tgz +0 -0
- package/fesm2022/fatcore-gantt-lite.mjs +774 -0
- package/fesm2022/fatcore-gantt-lite.mjs.map +1 -0
- package/fesm2022/gantt-lite.mjs +774 -0
- package/fesm2022/gantt-lite.mjs.map +1 -0
- package/gantt-lite-1.0.2.tgz +0 -0
- package/index.d.ts +180 -0
- package/package.json +17 -41
- package/.editorconfig +0 -16
- package/.vscode/extensions.json +0 -4
- package/.vscode/launch.json +0 -20
- package/.vscode/tasks.json +0 -42
- package/angular.json +0 -165
- package/my-workspace-0.0.0.tgz +0 -0
- package/projects/gantt-lite/README.md +0 -24
- package/projects/gantt-lite/ng-package.json +0 -7
- package/projects/gantt-lite/package.json +0 -10
- package/projects/gantt-lite/src/gantt-lite.module.ts +0 -10
- package/projects/gantt-lite/src/lib/gantt-lite-base.ts +0 -300
- package/projects/gantt-lite/src/lib/gantt-lite.component.html +0 -128
- package/projects/gantt-lite/src/lib/gantt-lite.component.scss +0 -323
- package/projects/gantt-lite/src/lib/gantt-lite.component.ts +0 -391
- package/projects/gantt-lite/src/lib/gantt-lite.helper.ts +0 -124
- package/projects/gantt-lite/src/lib/gantt-lite.model.ts +0 -56
- package/projects/gantt-lite/src/public-api.ts +0 -5
- package/projects/gantt-lite/tsconfig.lib.json +0 -14
- package/projects/gantt-lite/tsconfig.lib.prod.json +0 -10
- package/projects/gantt-lite/tsconfig.spec.json +0 -14
- package/tsconfig.json +0 -37
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { DateMode } from "./gantt-lite.model";
|
|
2
|
-
|
|
3
|
-
export class SlotIndexToDateLabelConverter {
|
|
4
|
-
private timeFormatter!: Intl.DateTimeFormat;
|
|
5
|
-
private dayFormatter!: Intl.DateTimeFormat;
|
|
6
|
-
constructor(
|
|
7
|
-
private dateMode: DateMode,
|
|
8
|
-
private originDate: number,
|
|
9
|
-
private slotSeconds: number,
|
|
10
|
-
private hasNegativeDependencySpace: boolean
|
|
11
|
-
) {
|
|
12
|
-
this.initFormatters();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
private initFormatters(): void {
|
|
16
|
-
this.timeFormatter = new Intl.DateTimeFormat([], {
|
|
17
|
-
timeZone: this.dateMode === 'utc' ? 'UTC' : undefined,
|
|
18
|
-
day: '2-digit',
|
|
19
|
-
month: '2-digit',
|
|
20
|
-
year: 'numeric',
|
|
21
|
-
hour: '2-digit',
|
|
22
|
-
minute: '2-digit',
|
|
23
|
-
hour12: false
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
this.dayFormatter = new Intl.DateTimeFormat([], {
|
|
27
|
-
timeZone: this.dateMode === 'utc' ? 'UTC' : undefined,
|
|
28
|
-
day: '2-digit',
|
|
29
|
-
month: '2-digit',
|
|
30
|
-
year: 'numeric'
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private get slotMs(): number {
|
|
35
|
-
return this.slotSeconds * 1000;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
private indexToDate(index: number): Date {
|
|
39
|
-
const realIndex = this.hasNegativeDependencySpace && index > 0 ? index - 1 : index;
|
|
40
|
-
return new Date(this.originDate + realIndex * this.slotMs);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public getLabelCalendar(index: number, scale: string): string {
|
|
44
|
-
if (this.hasNegativeDependencySpace && index === 0) {
|
|
45
|
-
return 'N/A';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const date = this.indexToDate(index);
|
|
49
|
-
switch (scale) {
|
|
50
|
-
case '1m':
|
|
51
|
-
case '10m':
|
|
52
|
-
case '30m':
|
|
53
|
-
case 'hour':
|
|
54
|
-
case '6 hours':
|
|
55
|
-
case '12 hours':
|
|
56
|
-
return this.formatTime(date);
|
|
57
|
-
case 'day':
|
|
58
|
-
return this.formatDay(date);
|
|
59
|
-
case 'week':
|
|
60
|
-
return this.formatRange(date, 7);
|
|
61
|
-
case 'month':
|
|
62
|
-
return this.formatMonthRange(date);
|
|
63
|
-
case 'year':
|
|
64
|
-
return this.formatYearRange(date);
|
|
65
|
-
default:
|
|
66
|
-
return '';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public getLabelDuration(index: number, scale: string): string {
|
|
71
|
-
if (index === -1) {
|
|
72
|
-
return 'N/A';
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
switch (scale) {
|
|
76
|
-
case '1m':
|
|
77
|
-
return `${index * 1}m`;
|
|
78
|
-
case '10m':
|
|
79
|
-
return `${index * 10}m`;
|
|
80
|
-
case '30m':
|
|
81
|
-
return `${index * 30}m`;
|
|
82
|
-
case 'hour':
|
|
83
|
-
return `${index}h`;
|
|
84
|
-
case '6 hours':
|
|
85
|
-
return `${index * 6}h`;
|
|
86
|
-
case '12 hours':
|
|
87
|
-
return `${index * 12}h`;
|
|
88
|
-
case 'day':
|
|
89
|
-
return `${index}D`;
|
|
90
|
-
case 'week':
|
|
91
|
-
return `${index * 7}D - ${index * 7 + 7}D`;
|
|
92
|
-
case 'month':
|
|
93
|
-
return `${index * 30}D - ${index * 30 + 30}D`;
|
|
94
|
-
case 'year':
|
|
95
|
-
return `${index * 365}D - ${index * 365 + 365}D`;
|
|
96
|
-
default:
|
|
97
|
-
return '';
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
private formatTime(date: Date): string {
|
|
102
|
-
return this.timeFormatter.format(date);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
private formatDay(date: Date): string {
|
|
106
|
-
return this.dayFormatter.format(date);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
private formatRange(start: Date, days: number): string {
|
|
110
|
-
const end = new Date(start);
|
|
111
|
-
end.setDate(end.getDate() + days);
|
|
112
|
-
return `${start.toLocaleDateString()} - ${end.toLocaleDateString()}`;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private formatMonthRange(start: Date): string {
|
|
116
|
-
const date = new Date(start);
|
|
117
|
-
date.setDate(1);
|
|
118
|
-
return date.toLocaleDateString();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
private formatYearRange(start: Date): string {
|
|
122
|
-
return `${start.toLocaleDateString()}`;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export interface GanttTask {
|
|
2
|
-
id: string;
|
|
3
|
-
label: string;
|
|
4
|
-
start: Date | number;
|
|
5
|
-
end: Date | number;
|
|
6
|
-
// rendering model (PRIMARY)
|
|
7
|
-
startSlot?: number;
|
|
8
|
-
endSlot?: number;
|
|
9
|
-
row: number;
|
|
10
|
-
dependencies: string[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface GanttData extends GanttTask {
|
|
14
|
-
// dynamic custom fields
|
|
15
|
-
fields?: Record<string, any>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type GanttScale = '1m' | '10m' | '30m' | 'hour' | '6 hours' | '12 hours' | 'day' | 'week' | 'month' | 'year';
|
|
19
|
-
export interface TimelineSlot {
|
|
20
|
-
index: number;
|
|
21
|
-
x: number;
|
|
22
|
-
width: number;
|
|
23
|
-
label?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface DependencyPath {
|
|
27
|
-
from: string;
|
|
28
|
-
to: string;
|
|
29
|
-
id: string;
|
|
30
|
-
path: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface ScaleConfig {
|
|
34
|
-
secondes: number;
|
|
35
|
-
px: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type DataType = 'duration' | 'calendar';
|
|
39
|
-
export type DateMode = 'utc' | 'local';
|
|
40
|
-
export type GanttTaskView = GanttTask & {
|
|
41
|
-
x: number;
|
|
42
|
-
y: number;
|
|
43
|
-
width: number;
|
|
44
|
-
height: number;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export interface GanttColumn {
|
|
48
|
-
id: string;
|
|
49
|
-
title: string;
|
|
50
|
-
width?: number;
|
|
51
|
-
showInGrid?: boolean;
|
|
52
|
-
showInTooltip?: boolean;
|
|
53
|
-
hidden?: () => boolean;
|
|
54
|
-
// built-in field or custom field
|
|
55
|
-
valueGetter?: (task: GanttData) => any;
|
|
56
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/lib",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"inlineSources": true,
|
|
9
|
-
"types": []
|
|
10
|
-
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
"**/*.spec.ts"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/spec",
|
|
6
|
-
"types": [
|
|
7
|
-
"jasmine"
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
"include": [
|
|
11
|
-
"**/*.spec.ts",
|
|
12
|
-
"**/*.d.ts"
|
|
13
|
-
]
|
|
14
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"compileOnSave": false,
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "./dist/out-tsc",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"noImplicitOverride": true,
|
|
8
|
-
"paths": {
|
|
9
|
-
"gantt-lite": [
|
|
10
|
-
"./dist/gantt-lite"
|
|
11
|
-
]
|
|
12
|
-
},
|
|
13
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
14
|
-
"noImplicitReturns": true,
|
|
15
|
-
"noFallthroughCasesInSwitch": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"esModuleInterop": true,
|
|
18
|
-
"sourceMap": true,
|
|
19
|
-
"declaration": false,
|
|
20
|
-
"experimentalDecorators": true,
|
|
21
|
-
"moduleResolution": "bundler",
|
|
22
|
-
"importHelpers": true,
|
|
23
|
-
"target": "ES2022",
|
|
24
|
-
"module": "ES2022",
|
|
25
|
-
"useDefineForClassFields": false,
|
|
26
|
-
"lib": [
|
|
27
|
-
"ES2022",
|
|
28
|
-
"dom"
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
"angularCompilerOptions": {
|
|
32
|
-
"enableI18nLegacyMessageIdFormat": false,
|
|
33
|
-
"strictInjectionParameters": true,
|
|
34
|
-
"strictInputAccessModifiers": true,
|
|
35
|
-
"strictTemplates": true
|
|
36
|
-
}
|
|
37
|
-
}
|