ngx-core-components 0.0.6 → 0.0.8
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 +1 -1
- package/charts/index.d.ts +5 -0
- package/charts/public-api.d.ts +11 -0
- package/dialog/dialog-container.component.d.ts +24 -0
- package/dialog/dialog.service.d.ts +37 -0
- package/dialog/index.d.ts +5 -0
- package/dialog/public-api.d.ts +3 -0
- package/fesm2022/ngx-core-components-charts.mjs +2313 -0
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -0
- package/fesm2022/ngx-core-components-dialog.mjs +168 -0
- package/fesm2022/ngx-core-components-dialog.mjs.map +1 -0
- package/fesm2022/ngx-core-components-grid.mjs +335 -0
- package/fesm2022/ngx-core-components-grid.mjs.map +1 -0
- package/fesm2022/ngx-core-components-inputs.mjs +1320 -0
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -0
- package/fesm2022/ngx-core-components-views.mjs +357 -0
- package/fesm2022/ngx-core-components-views.mjs.map +1 -0
- package/fesm2022/ngx-core-components.mjs +11 -3689
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/grid/index.d.ts +5 -0
- package/grid/public-api.d.ts +2 -0
- package/inputs/autocomplete/autocomplete.component.d.ts +35 -0
- package/inputs/checkbox/checkbox.component.d.ts +21 -0
- package/{lib/inputs → inputs}/date-picker/date-picker.component.d.ts +11 -1
- package/{lib/inputs → inputs}/dropdown/dropdown.component.d.ts +11 -1
- package/inputs/index.d.ts +5 -0
- package/{lib/inputs → inputs}/multi-select/multi-select.component.d.ts +11 -1
- package/inputs/public-api.d.ts +9 -0
- package/inputs/radio/radio-group.component.d.ts +28 -0
- package/{lib/inputs → inputs}/textbox/textbox.component.d.ts +12 -1
- package/lib/tooltip/popover.component.d.ts +1 -1
- package/package.json +23 -3
- package/public-api.d.ts +29 -22
- package/views/index.d.ts +5 -0
- package/views/public-api.d.ts +4 -0
- /package/{lib/charts → charts}/bar-chart/bar-chart.component.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/gantt-chart.component.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/gantt-config.model.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/gantt-dependency.model.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/gantt-event.model.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/gantt-task.model.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/models/index.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/services/gantt-keyboard.service.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/services/gantt-layout.service.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/services/gantt-scale.service.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/utils/date-utils.d.ts +0 -0
- /package/{lib → charts}/gantt-chart/utils/svg-utils.d.ts +0 -0
- /package/{lib/charts → charts}/line-chart/line-chart.component.d.ts +0 -0
- /package/{lib/charts → charts}/pie-chart/pie-chart.component.d.ts +0 -0
- /package/{lib/charts → charts}/shared/chart-utils.d.ts +0 -0
- /package/{lib/charts → charts}/sparkline/sparkline.component.d.ts +0 -0
- /package/{lib → grid}/data-grid/data-grid.component.d.ts +0 -0
- /package/{lib → views}/list-view/list-view.component.d.ts +0 -0
- /package/{lib → views}/tree-view/tree-view.component.d.ts +0 -0
|
@@ -0,0 +1,2313 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, signal, computed, viewChild, ChangeDetectionStrategy, Component, Injectable, output, inject } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
// Shared chart utilities and constants
|
|
5
|
+
const CHART_COLORS = [
|
|
6
|
+
'#4a90d9', '#ff6358', '#27ae60', '#f39c12', '#8e44ad',
|
|
7
|
+
'#1abc9c', '#e74c3c', '#3498db', '#2ecc71', '#e67e22',
|
|
8
|
+
];
|
|
9
|
+
/** Map a value [min..max] → [rangeMin..rangeMax] */
|
|
10
|
+
function scale(value, min, max, rangeMin, rangeMax) {
|
|
11
|
+
if (max === min)
|
|
12
|
+
return rangeMin;
|
|
13
|
+
return rangeMin + ((value - min) / (max - min)) * (rangeMax - rangeMin);
|
|
14
|
+
}
|
|
15
|
+
/** Compute nice axis ticks for a range */
|
|
16
|
+
function niceTicks(min, max, count = 5) {
|
|
17
|
+
if (min === max)
|
|
18
|
+
return [min];
|
|
19
|
+
const range = max - min;
|
|
20
|
+
const step = niceStep(range / count);
|
|
21
|
+
const start = Math.floor(min / step) * step;
|
|
22
|
+
const ticks = [];
|
|
23
|
+
for (let v = start; v <= max + step * 0.01; v += step) {
|
|
24
|
+
ticks.push(parseFloat(v.toFixed(10)));
|
|
25
|
+
}
|
|
26
|
+
return ticks;
|
|
27
|
+
}
|
|
28
|
+
function niceStep(step) {
|
|
29
|
+
const mag = Math.pow(10, Math.floor(Math.log10(step)));
|
|
30
|
+
const frac = step / mag;
|
|
31
|
+
if (frac < 1.5)
|
|
32
|
+
return mag;
|
|
33
|
+
if (frac < 3)
|
|
34
|
+
return 2 * mag;
|
|
35
|
+
if (frac < 7)
|
|
36
|
+
return 5 * mag;
|
|
37
|
+
return 10 * mag;
|
|
38
|
+
}
|
|
39
|
+
/** Smooth bezier path through points */
|
|
40
|
+
function smoothPath(points) {
|
|
41
|
+
if (points.length < 2)
|
|
42
|
+
return '';
|
|
43
|
+
let d = `M ${points[0][0]} ${points[0][1]}`;
|
|
44
|
+
for (let i = 1; i < points.length; i++) {
|
|
45
|
+
const prev = points[i - 1];
|
|
46
|
+
const curr = points[i];
|
|
47
|
+
const cpx = (prev[0] + curr[0]) / 2;
|
|
48
|
+
d += ` C ${cpx} ${prev[1]}, ${cpx} ${curr[1]}, ${curr[0]} ${curr[1]}`;
|
|
49
|
+
}
|
|
50
|
+
return d;
|
|
51
|
+
}
|
|
52
|
+
/** Format number for display */
|
|
53
|
+
function fmtNum(n) {
|
|
54
|
+
if (Math.abs(n) >= 1_000_000)
|
|
55
|
+
return (n / 1_000_000).toFixed(1) + 'M';
|
|
56
|
+
if (Math.abs(n) >= 1_000)
|
|
57
|
+
return (n / 1_000).toFixed(1) + 'K';
|
|
58
|
+
return n % 1 === 0 ? n.toString() : n.toFixed(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
class BarChartComponent {
|
|
62
|
+
PAD_LEFT = 48;
|
|
63
|
+
PAD_TOP = 12;
|
|
64
|
+
PAD_RIGHT = 16;
|
|
65
|
+
PAD_BOTTOM = 32;
|
|
66
|
+
series = input([]);
|
|
67
|
+
categories = input([]);
|
|
68
|
+
height = input(260);
|
|
69
|
+
showGrid = input(true);
|
|
70
|
+
showLabels = input(false);
|
|
71
|
+
showLegend = input(true);
|
|
72
|
+
colors = input(CHART_COLORS);
|
|
73
|
+
tooltip = signal(null);
|
|
74
|
+
chartHeight = computed(() => this.height());
|
|
75
|
+
svgEl = viewChild('svgEl');
|
|
76
|
+
innerW = computed(() => 600 - this.PAD_LEFT - this.PAD_RIGHT);
|
|
77
|
+
innerH = computed(() => this.chartHeight() - this.PAD_TOP - this.PAD_BOTTOM);
|
|
78
|
+
allValues = computed(() => this.series().flatMap(s => s.data.filter(v => v != null)));
|
|
79
|
+
yMin = computed(() => Math.min(0, ...this.allValues()));
|
|
80
|
+
yMax = computed(() => Math.max(1, ...this.allValues()));
|
|
81
|
+
yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
|
|
82
|
+
yPos(v) {
|
|
83
|
+
return scale(v, this.yMin(), this.yMax(), this.innerH(), 0);
|
|
84
|
+
}
|
|
85
|
+
barY(v) { return Math.min(this.yPos(0), this.yPos(v)); }
|
|
86
|
+
barH(v) { return Math.abs(this.yPos(0) - this.yPos(v)); }
|
|
87
|
+
groupW = computed(() => this.categories().length > 0 ? this.innerW() / this.categories().length : 0);
|
|
88
|
+
singleBarWidth = computed(() => {
|
|
89
|
+
const n = this.series().length || 1;
|
|
90
|
+
return Math.max(4, (this.groupW() - 8) / n);
|
|
91
|
+
});
|
|
92
|
+
catMidX(i) { return i * this.groupW() + this.groupW() / 2; }
|
|
93
|
+
barX(ci, si) {
|
|
94
|
+
const n = this.series().length;
|
|
95
|
+
const gx = ci * this.groupW() + 4;
|
|
96
|
+
return gx + si * this.singleBarWidth();
|
|
97
|
+
}
|
|
98
|
+
seriesColor(i) { return this.colors()[i % this.colors().length]; }
|
|
99
|
+
barColor(si, s) { return s.color || this.seriesColor(si); }
|
|
100
|
+
onBarHover(event, seriesName, cat, value) {
|
|
101
|
+
const rect = event.target.closest('.ngx-bar-chart').getBoundingClientRect();
|
|
102
|
+
const el = event.target.closest('.ngx-bar-chart');
|
|
103
|
+
const elRect = el.getBoundingClientRect();
|
|
104
|
+
this.tooltip.set({
|
|
105
|
+
x: event.clientX - elRect.left,
|
|
106
|
+
y: event.clientY - elRect.top,
|
|
107
|
+
cat, series: seriesName, value,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
onMouseMove(event) { }
|
|
111
|
+
fmtNum = fmtNum;
|
|
112
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: BarChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
113
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: BarChartComponent, isStandalone: true, selector: "ngx-bar-chart", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "svgEl", first: true, predicate: ["svgEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
114
|
+
<div class="ngx-bar-chart">
|
|
115
|
+
<!-- Legend -->
|
|
116
|
+
@if (showLegend()) {
|
|
117
|
+
<div class="chart-legend">
|
|
118
|
+
@for (s of series(); track s.name; let i = $index) {
|
|
119
|
+
<span class="legend-item">
|
|
120
|
+
<span class="legend-dot" [style.background]="seriesColor(i)"></span>
|
|
121
|
+
{{ s.name }}
|
|
122
|
+
</span>
|
|
123
|
+
}
|
|
124
|
+
</div>
|
|
125
|
+
}
|
|
126
|
+
<!-- SVG Chart -->
|
|
127
|
+
<svg
|
|
128
|
+
[attr.width]="'100%'"
|
|
129
|
+
[attr.height]="chartHeight()"
|
|
130
|
+
class="chart-svg"
|
|
131
|
+
(mousemove)="onMouseMove($event)"
|
|
132
|
+
(mouseleave)="tooltip.set(null)"
|
|
133
|
+
>
|
|
134
|
+
<g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
|
|
135
|
+
|
|
136
|
+
<!-- Y axis grid lines + labels -->
|
|
137
|
+
@for (tick of yTicks(); track tick) {
|
|
138
|
+
<g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
|
|
139
|
+
@if (showGrid()) {
|
|
140
|
+
<line
|
|
141
|
+
[attr.x1]="0" [attr.x2]="innerW()"
|
|
142
|
+
stroke="var(--ngx-chart-grid, #ebedf0)" stroke-dasharray="3,3"
|
|
143
|
+
/>
|
|
144
|
+
}
|
|
145
|
+
<text x="-8" dy="4" class="axis-label" text-anchor="end">{{ fmtNum(tick) }}</text>
|
|
146
|
+
</g>
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
<!-- X axis category labels -->
|
|
150
|
+
@for (cat of categories(); track cat; let i = $index) {
|
|
151
|
+
<text
|
|
152
|
+
[attr.x]="catMidX(i)"
|
|
153
|
+
[attr.y]="innerH() + 16"
|
|
154
|
+
class="axis-label"
|
|
155
|
+
text-anchor="middle"
|
|
156
|
+
>{{ cat }}</text>
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
<!-- Bars -->
|
|
160
|
+
@for (s of series(); track s.name; let si = $index) {
|
|
161
|
+
@for (v of s.data; track $index; let ci = $index) {
|
|
162
|
+
@if (v !== null && v !== undefined) {
|
|
163
|
+
<rect
|
|
164
|
+
[attr.x]="barX(ci, si)"
|
|
165
|
+
[attr.y]="barY(v)"
|
|
166
|
+
[attr.width]="singleBarWidth()"
|
|
167
|
+
[attr.height]="barH(v)"
|
|
168
|
+
[attr.fill]="barColor(si, s)"
|
|
169
|
+
[attr.rx]="3"
|
|
170
|
+
class="bar-rect"
|
|
171
|
+
(mouseenter)="onBarHover($event, s.name, categories()[ci], v)"
|
|
172
|
+
/>
|
|
173
|
+
@if (showLabels()) {
|
|
174
|
+
<text
|
|
175
|
+
[attr.x]="barX(ci, si) + singleBarWidth() / 2"
|
|
176
|
+
[attr.y]="barY(v) - 4"
|
|
177
|
+
class="bar-label"
|
|
178
|
+
text-anchor="middle"
|
|
179
|
+
>{{ fmtNum(v) }}</text>
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
<!-- Axes -->
|
|
186
|
+
<line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
187
|
+
<line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
188
|
+
</g>
|
|
189
|
+
</svg>
|
|
190
|
+
|
|
191
|
+
<!-- Tooltip -->
|
|
192
|
+
@if (tooltip(); as t) {
|
|
193
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
194
|
+
<strong>{{ t.cat }}</strong><br/>
|
|
195
|
+
{{ t.series }}: {{ fmtNum(t.value) }}
|
|
196
|
+
</div>
|
|
197
|
+
}
|
|
198
|
+
</div>
|
|
199
|
+
`, isInline: true, styles: [":host{display:block}.ngx-bar-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-legend{display:flex;gap:16px;padding:0 0 8px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text, #6c757d)}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.chart-svg{display:block;overflow:visible}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d)}.bar-rect{cursor:pointer;transition:opacity .15s}.bar-rect:hover{opacity:.8}.bar-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%);background:var(--ngx-chart-tooltip-bg, #343a40);color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;white-space:nowrap;margin-top:-8px;box-shadow:0 2px 8px #0003}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
200
|
+
}
|
|
201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: BarChartComponent, decorators: [{
|
|
202
|
+
type: Component,
|
|
203
|
+
args: [{ selector: 'ngx-bar-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
204
|
+
<div class="ngx-bar-chart">
|
|
205
|
+
<!-- Legend -->
|
|
206
|
+
@if (showLegend()) {
|
|
207
|
+
<div class="chart-legend">
|
|
208
|
+
@for (s of series(); track s.name; let i = $index) {
|
|
209
|
+
<span class="legend-item">
|
|
210
|
+
<span class="legend-dot" [style.background]="seriesColor(i)"></span>
|
|
211
|
+
{{ s.name }}
|
|
212
|
+
</span>
|
|
213
|
+
}
|
|
214
|
+
</div>
|
|
215
|
+
}
|
|
216
|
+
<!-- SVG Chart -->
|
|
217
|
+
<svg
|
|
218
|
+
[attr.width]="'100%'"
|
|
219
|
+
[attr.height]="chartHeight()"
|
|
220
|
+
class="chart-svg"
|
|
221
|
+
(mousemove)="onMouseMove($event)"
|
|
222
|
+
(mouseleave)="tooltip.set(null)"
|
|
223
|
+
>
|
|
224
|
+
<g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
|
|
225
|
+
|
|
226
|
+
<!-- Y axis grid lines + labels -->
|
|
227
|
+
@for (tick of yTicks(); track tick) {
|
|
228
|
+
<g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
|
|
229
|
+
@if (showGrid()) {
|
|
230
|
+
<line
|
|
231
|
+
[attr.x1]="0" [attr.x2]="innerW()"
|
|
232
|
+
stroke="var(--ngx-chart-grid, #ebedf0)" stroke-dasharray="3,3"
|
|
233
|
+
/>
|
|
234
|
+
}
|
|
235
|
+
<text x="-8" dy="4" class="axis-label" text-anchor="end">{{ fmtNum(tick) }}</text>
|
|
236
|
+
</g>
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
<!-- X axis category labels -->
|
|
240
|
+
@for (cat of categories(); track cat; let i = $index) {
|
|
241
|
+
<text
|
|
242
|
+
[attr.x]="catMidX(i)"
|
|
243
|
+
[attr.y]="innerH() + 16"
|
|
244
|
+
class="axis-label"
|
|
245
|
+
text-anchor="middle"
|
|
246
|
+
>{{ cat }}</text>
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
<!-- Bars -->
|
|
250
|
+
@for (s of series(); track s.name; let si = $index) {
|
|
251
|
+
@for (v of s.data; track $index; let ci = $index) {
|
|
252
|
+
@if (v !== null && v !== undefined) {
|
|
253
|
+
<rect
|
|
254
|
+
[attr.x]="barX(ci, si)"
|
|
255
|
+
[attr.y]="barY(v)"
|
|
256
|
+
[attr.width]="singleBarWidth()"
|
|
257
|
+
[attr.height]="barH(v)"
|
|
258
|
+
[attr.fill]="barColor(si, s)"
|
|
259
|
+
[attr.rx]="3"
|
|
260
|
+
class="bar-rect"
|
|
261
|
+
(mouseenter)="onBarHover($event, s.name, categories()[ci], v)"
|
|
262
|
+
/>
|
|
263
|
+
@if (showLabels()) {
|
|
264
|
+
<text
|
|
265
|
+
[attr.x]="barX(ci, si) + singleBarWidth() / 2"
|
|
266
|
+
[attr.y]="barY(v) - 4"
|
|
267
|
+
class="bar-label"
|
|
268
|
+
text-anchor="middle"
|
|
269
|
+
>{{ fmtNum(v) }}</text>
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
<!-- Axes -->
|
|
276
|
+
<line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
277
|
+
<line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
278
|
+
</g>
|
|
279
|
+
</svg>
|
|
280
|
+
|
|
281
|
+
<!-- Tooltip -->
|
|
282
|
+
@if (tooltip(); as t) {
|
|
283
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
284
|
+
<strong>{{ t.cat }}</strong><br/>
|
|
285
|
+
{{ t.series }}: {{ fmtNum(t.value) }}
|
|
286
|
+
</div>
|
|
287
|
+
}
|
|
288
|
+
</div>
|
|
289
|
+
`, styles: [":host{display:block}.ngx-bar-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-legend{display:flex;gap:16px;padding:0 0 8px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text, #6c757d)}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.chart-svg{display:block;overflow:visible}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d)}.bar-rect{cursor:pointer;transition:opacity .15s}.bar-rect:hover{opacity:.8}.bar-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%);background:var(--ngx-chart-tooltip-bg, #343a40);color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;white-space:nowrap;margin-top:-8px;box-shadow:0 2px 8px #0003}\n"] }]
|
|
290
|
+
}] });
|
|
291
|
+
|
|
292
|
+
class LineChartComponent {
|
|
293
|
+
PAD_LEFT = 48;
|
|
294
|
+
PAD_TOP = 12;
|
|
295
|
+
PAD_RIGHT = 16;
|
|
296
|
+
PAD_BOTTOM = 32;
|
|
297
|
+
series = input([]);
|
|
298
|
+
categories = input([]);
|
|
299
|
+
height = input(260);
|
|
300
|
+
showGrid = input(true);
|
|
301
|
+
showArea = input(false);
|
|
302
|
+
showMarkers = input(true);
|
|
303
|
+
showLegend = input(true);
|
|
304
|
+
colors = input(CHART_COLORS);
|
|
305
|
+
crosshair = signal(null);
|
|
306
|
+
tooltip = signal(null);
|
|
307
|
+
chartHeight = computed(() => this.height());
|
|
308
|
+
innerW = computed(() => 600 - this.PAD_LEFT - this.PAD_RIGHT);
|
|
309
|
+
innerH = computed(() => this.chartHeight() - this.PAD_TOP - this.PAD_BOTTOM);
|
|
310
|
+
allValues = computed(() => this.series().flatMap(s => s.data));
|
|
311
|
+
yMin = computed(() => Math.min(0, ...this.allValues()));
|
|
312
|
+
yMax = computed(() => Math.max(1, ...this.allValues()));
|
|
313
|
+
yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
|
|
314
|
+
yPos(v) { return scale(v, this.yMin(), this.yMax(), this.innerH(), 0); }
|
|
315
|
+
xPos(i) {
|
|
316
|
+
const n = this.categories().length;
|
|
317
|
+
return n <= 1 ? this.innerW() / 2 : scale(i, 0, n - 1, 0, this.innerW());
|
|
318
|
+
}
|
|
319
|
+
seriesColor(i, s) { return s.color || this.colors()[i % this.colors().length]; }
|
|
320
|
+
linePath(s) {
|
|
321
|
+
const pts = s.data.map((v, i) => [this.xPos(i), this.yPos(v)]);
|
|
322
|
+
return smoothPath(pts);
|
|
323
|
+
}
|
|
324
|
+
areaPath(s) {
|
|
325
|
+
const pts = s.data.map((v, i) => [this.xPos(i), this.yPos(v)]);
|
|
326
|
+
const line = smoothPath(pts);
|
|
327
|
+
const last = pts[pts.length - 1];
|
|
328
|
+
const first = pts[0];
|
|
329
|
+
return line + ` L ${last[0]} ${this.innerH()} L ${first[0]} ${this.innerH()} Z`;
|
|
330
|
+
}
|
|
331
|
+
onMouseMove(event) {
|
|
332
|
+
const el = event.currentTarget;
|
|
333
|
+
const rect = el.getBoundingClientRect();
|
|
334
|
+
const mx = event.clientX - rect.left - this.PAD_LEFT;
|
|
335
|
+
const cats = this.categories();
|
|
336
|
+
if (cats.length === 0)
|
|
337
|
+
return;
|
|
338
|
+
const idx = Math.round(scale(mx, 0, this.innerW(), 0, cats.length - 1));
|
|
339
|
+
const ci = Math.max(0, Math.min(cats.length - 1, idx));
|
|
340
|
+
this.crosshair.set({ x: this.xPos(ci) });
|
|
341
|
+
const rows = this.series().map((s, si) => ({
|
|
342
|
+
name: s.name,
|
|
343
|
+
value: s.data[ci] ?? 0,
|
|
344
|
+
color: this.seriesColor(si, s),
|
|
345
|
+
}));
|
|
346
|
+
this.tooltip.set({
|
|
347
|
+
x: event.clientX - rect.left,
|
|
348
|
+
y: event.clientY - rect.top,
|
|
349
|
+
cat: cats[ci],
|
|
350
|
+
rows,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
fmtNum = fmtNum;
|
|
354
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: LineChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
355
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: LineChartComponent, isStandalone: true, selector: "ngx-line-chart", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showArea: { classPropertyName: "showArea", publicName: "showArea", isSignal: true, isRequired: false, transformFunction: null }, showMarkers: { classPropertyName: "showMarkers", publicName: "showMarkers", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
356
|
+
<div class="ngx-line-chart" (mousemove)="onMouseMove($event)" (mouseleave)="crosshair.set(null)">
|
|
357
|
+
@if (showLegend()) {
|
|
358
|
+
<div class="chart-legend">
|
|
359
|
+
@for (s of series(); track s.name; let i = $index) {
|
|
360
|
+
<span class="legend-item">
|
|
361
|
+
<span class="legend-line" [style.background]="seriesColor(i, s)"></span>
|
|
362
|
+
{{ s.name }}
|
|
363
|
+
</span>
|
|
364
|
+
}
|
|
365
|
+
</div>
|
|
366
|
+
}
|
|
367
|
+
<svg [attr.width]="'100%'" [attr.height]="chartHeight()" class="chart-svg">
|
|
368
|
+
<defs>
|
|
369
|
+
@for (s of series(); track s.name; let i = $index) {
|
|
370
|
+
<linearGradient [attr.id]="'area-grad-' + i" x1="0" y1="0" x2="0" y2="1">
|
|
371
|
+
<stop offset="0%" [attr.stop-color]="seriesColor(i, s)" stop-opacity="0.3"/>
|
|
372
|
+
<stop offset="100%" [attr.stop-color]="seriesColor(i, s)" stop-opacity="0.02"/>
|
|
373
|
+
</linearGradient>
|
|
374
|
+
}
|
|
375
|
+
</defs>
|
|
376
|
+
<g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
|
|
377
|
+
|
|
378
|
+
@for (tick of yTicks(); track tick) {
|
|
379
|
+
<g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
|
|
380
|
+
@if (showGrid()) {
|
|
381
|
+
<line [attr.x1]="0" [attr.x2]="innerW()" stroke="var(--ngx-chart-grid,#ebedf0)" stroke-dasharray="3,3"/>
|
|
382
|
+
}
|
|
383
|
+
<text x="-8" dy="4" class="axis-label" text-anchor="end">{{ fmtNum(tick) }}</text>
|
|
384
|
+
</g>
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
@for (cat of categories(); track cat; let i = $index) {
|
|
388
|
+
<text [attr.x]="xPos(i)" [attr.y]="innerH() + 16" class="axis-label" text-anchor="middle">{{ cat }}</text>
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
@for (s of series(); track s.name; let si = $index) {
|
|
392
|
+
@if (showArea()) {
|
|
393
|
+
<path
|
|
394
|
+
[attr.d]="areaPath(s)"
|
|
395
|
+
[attr.fill]="'url(#area-grad-' + si + ')'"
|
|
396
|
+
stroke="none"
|
|
397
|
+
/>
|
|
398
|
+
}
|
|
399
|
+
<path
|
|
400
|
+
[attr.d]="linePath(s)"
|
|
401
|
+
[attr.stroke]="seriesColor(si, s)"
|
|
402
|
+
fill="none"
|
|
403
|
+
stroke-width="2.5"
|
|
404
|
+
stroke-linejoin="round"
|
|
405
|
+
stroke-linecap="round"
|
|
406
|
+
/>
|
|
407
|
+
@if (showMarkers()) {
|
|
408
|
+
@for (v of s.data; track $index; let ci = $index) {
|
|
409
|
+
<circle
|
|
410
|
+
[attr.cx]="xPos(ci)"
|
|
411
|
+
[attr.cy]="yPos(v)"
|
|
412
|
+
r="4"
|
|
413
|
+
[attr.fill]="seriesColor(si, s)"
|
|
414
|
+
stroke="#fff"
|
|
415
|
+
stroke-width="2"
|
|
416
|
+
/>
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
<!-- Crosshair -->
|
|
422
|
+
@if (crosshair(); as ch) {
|
|
423
|
+
<line [attr.x1]="ch.x" [attr.x2]="ch.x" y1="0" [attr.y2]="innerH()"
|
|
424
|
+
stroke="var(--ngx-chart-axis,#ced4da)" stroke-dasharray="4,3"/>
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
<line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
|
|
428
|
+
<line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
|
|
429
|
+
</g>
|
|
430
|
+
</svg>
|
|
431
|
+
|
|
432
|
+
@if (tooltip(); as t) {
|
|
433
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
434
|
+
<div class="tt-cat">{{ t.cat }}</div>
|
|
435
|
+
@for (row of t.rows; track row.name) {
|
|
436
|
+
<div class="tt-row">
|
|
437
|
+
<span class="tt-dot" [style.background]="row.color"></span>
|
|
438
|
+
{{ row.name }}: <strong>{{ fmtNum(row.value) }}</strong>
|
|
439
|
+
</div>
|
|
440
|
+
}
|
|
441
|
+
</div>
|
|
442
|
+
}
|
|
443
|
+
</div>
|
|
444
|
+
`, isInline: true, styles: [":host{display:block}.ngx-line-chart{position:relative;background:var(--ngx-chart-bg, #fff)}.chart-legend{display:flex;gap:16px;padding:0 0 8px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text,#6c757d)}.legend-line{width:20px;height:3px;border-radius:2px;display:inline-block}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text,#6c757d)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg,#343a40);color:#fff;padding:8px 12px;border-radius:4px;font-size:12px;white-space:nowrap;box-shadow:0 2px 8px #0003}.tt-cat{font-weight:600;margin-bottom:4px}.tt-row{display:flex;align-items:center;gap:6px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
445
|
+
}
|
|
446
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: LineChartComponent, decorators: [{
|
|
447
|
+
type: Component,
|
|
448
|
+
args: [{ selector: 'ngx-line-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
449
|
+
<div class="ngx-line-chart" (mousemove)="onMouseMove($event)" (mouseleave)="crosshair.set(null)">
|
|
450
|
+
@if (showLegend()) {
|
|
451
|
+
<div class="chart-legend">
|
|
452
|
+
@for (s of series(); track s.name; let i = $index) {
|
|
453
|
+
<span class="legend-item">
|
|
454
|
+
<span class="legend-line" [style.background]="seriesColor(i, s)"></span>
|
|
455
|
+
{{ s.name }}
|
|
456
|
+
</span>
|
|
457
|
+
}
|
|
458
|
+
</div>
|
|
459
|
+
}
|
|
460
|
+
<svg [attr.width]="'100%'" [attr.height]="chartHeight()" class="chart-svg">
|
|
461
|
+
<defs>
|
|
462
|
+
@for (s of series(); track s.name; let i = $index) {
|
|
463
|
+
<linearGradient [attr.id]="'area-grad-' + i" x1="0" y1="0" x2="0" y2="1">
|
|
464
|
+
<stop offset="0%" [attr.stop-color]="seriesColor(i, s)" stop-opacity="0.3"/>
|
|
465
|
+
<stop offset="100%" [attr.stop-color]="seriesColor(i, s)" stop-opacity="0.02"/>
|
|
466
|
+
</linearGradient>
|
|
467
|
+
}
|
|
468
|
+
</defs>
|
|
469
|
+
<g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
|
|
470
|
+
|
|
471
|
+
@for (tick of yTicks(); track tick) {
|
|
472
|
+
<g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
|
|
473
|
+
@if (showGrid()) {
|
|
474
|
+
<line [attr.x1]="0" [attr.x2]="innerW()" stroke="var(--ngx-chart-grid,#ebedf0)" stroke-dasharray="3,3"/>
|
|
475
|
+
}
|
|
476
|
+
<text x="-8" dy="4" class="axis-label" text-anchor="end">{{ fmtNum(tick) }}</text>
|
|
477
|
+
</g>
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
@for (cat of categories(); track cat; let i = $index) {
|
|
481
|
+
<text [attr.x]="xPos(i)" [attr.y]="innerH() + 16" class="axis-label" text-anchor="middle">{{ cat }}</text>
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
@for (s of series(); track s.name; let si = $index) {
|
|
485
|
+
@if (showArea()) {
|
|
486
|
+
<path
|
|
487
|
+
[attr.d]="areaPath(s)"
|
|
488
|
+
[attr.fill]="'url(#area-grad-' + si + ')'"
|
|
489
|
+
stroke="none"
|
|
490
|
+
/>
|
|
491
|
+
}
|
|
492
|
+
<path
|
|
493
|
+
[attr.d]="linePath(s)"
|
|
494
|
+
[attr.stroke]="seriesColor(si, s)"
|
|
495
|
+
fill="none"
|
|
496
|
+
stroke-width="2.5"
|
|
497
|
+
stroke-linejoin="round"
|
|
498
|
+
stroke-linecap="round"
|
|
499
|
+
/>
|
|
500
|
+
@if (showMarkers()) {
|
|
501
|
+
@for (v of s.data; track $index; let ci = $index) {
|
|
502
|
+
<circle
|
|
503
|
+
[attr.cx]="xPos(ci)"
|
|
504
|
+
[attr.cy]="yPos(v)"
|
|
505
|
+
r="4"
|
|
506
|
+
[attr.fill]="seriesColor(si, s)"
|
|
507
|
+
stroke="#fff"
|
|
508
|
+
stroke-width="2"
|
|
509
|
+
/>
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
<!-- Crosshair -->
|
|
515
|
+
@if (crosshair(); as ch) {
|
|
516
|
+
<line [attr.x1]="ch.x" [attr.x2]="ch.x" y1="0" [attr.y2]="innerH()"
|
|
517
|
+
stroke="var(--ngx-chart-axis,#ced4da)" stroke-dasharray="4,3"/>
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
<line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
|
|
521
|
+
<line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
|
|
522
|
+
</g>
|
|
523
|
+
</svg>
|
|
524
|
+
|
|
525
|
+
@if (tooltip(); as t) {
|
|
526
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
527
|
+
<div class="tt-cat">{{ t.cat }}</div>
|
|
528
|
+
@for (row of t.rows; track row.name) {
|
|
529
|
+
<div class="tt-row">
|
|
530
|
+
<span class="tt-dot" [style.background]="row.color"></span>
|
|
531
|
+
{{ row.name }}: <strong>{{ fmtNum(row.value) }}</strong>
|
|
532
|
+
</div>
|
|
533
|
+
}
|
|
534
|
+
</div>
|
|
535
|
+
}
|
|
536
|
+
</div>
|
|
537
|
+
`, styles: [":host{display:block}.ngx-line-chart{position:relative;background:var(--ngx-chart-bg, #fff)}.chart-legend{display:flex;gap:16px;padding:0 0 8px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text,#6c757d)}.legend-line{width:20px;height:3px;border-radius:2px;display:inline-block}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text,#6c757d)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg,#343a40);color:#fff;padding:8px 12px;border-radius:4px;font-size:12px;white-space:nowrap;box-shadow:0 2px 8px #0003}.tt-cat{font-weight:600;margin-bottom:4px}.tt-row{display:flex;align-items:center;gap:6px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}\n"] }]
|
|
538
|
+
}] });
|
|
539
|
+
|
|
540
|
+
class PieChartComponent {
|
|
541
|
+
data = input([]);
|
|
542
|
+
mode = input('pie');
|
|
543
|
+
donutHoleSize = input(0.55);
|
|
544
|
+
height = input(240);
|
|
545
|
+
showLegend = input(true);
|
|
546
|
+
showLabels = input(true);
|
|
547
|
+
colors = input(CHART_COLORS);
|
|
548
|
+
centerTitle = input('Total');
|
|
549
|
+
colors$ = this.colors;
|
|
550
|
+
hovered = signal(-1);
|
|
551
|
+
tooltip = signal(null);
|
|
552
|
+
svgSize = computed(() => this.height());
|
|
553
|
+
cx = computed(() => this.svgSize() / 2);
|
|
554
|
+
cy = computed(() => this.svgSize() / 2);
|
|
555
|
+
radius = computed(() => this.svgSize() / 2 - 10);
|
|
556
|
+
holeR = computed(() => this.radius() * this.donutHoleSize());
|
|
557
|
+
centerValue = computed(() => {
|
|
558
|
+
const total = this.data().reduce((s, d) => s + d.value, 0);
|
|
559
|
+
return fmtNum(total);
|
|
560
|
+
});
|
|
561
|
+
slices = computed(() => {
|
|
562
|
+
const d = this.data();
|
|
563
|
+
const total = d.reduce((s, x) => s + x.value, 0) || 1;
|
|
564
|
+
let start = -Math.PI / 2;
|
|
565
|
+
return d.map((item, i) => {
|
|
566
|
+
const frac = item.value / total;
|
|
567
|
+
const angle = frac * Math.PI * 2;
|
|
568
|
+
const end = start + angle;
|
|
569
|
+
const mid = start + angle / 2;
|
|
570
|
+
const r = this.radius();
|
|
571
|
+
const path = this.arcPath(start, end, r);
|
|
572
|
+
start = end;
|
|
573
|
+
return {
|
|
574
|
+
index: i,
|
|
575
|
+
label: item.label,
|
|
576
|
+
value: item.value,
|
|
577
|
+
pct: Math.round(frac * 100),
|
|
578
|
+
color: item.color || this.colors()[i % this.colors().length],
|
|
579
|
+
path,
|
|
580
|
+
midAngle: mid,
|
|
581
|
+
};
|
|
582
|
+
});
|
|
583
|
+
});
|
|
584
|
+
arcPath(startAngle, endAngle, r) {
|
|
585
|
+
const x1 = Math.cos(startAngle) * r;
|
|
586
|
+
const y1 = Math.sin(startAngle) * r;
|
|
587
|
+
const x2 = Math.cos(endAngle) * r;
|
|
588
|
+
const y2 = Math.sin(endAngle) * r;
|
|
589
|
+
const large = endAngle - startAngle > Math.PI ? 1 : 0;
|
|
590
|
+
return `M 0 0 L ${x1} ${y1} A ${r} ${r} 0 ${large} 1 ${x2} ${y2} Z`;
|
|
591
|
+
}
|
|
592
|
+
labelX(s) { return Math.cos(s.midAngle) * this.radius() * 0.7; }
|
|
593
|
+
labelY(s) { return Math.sin(s.midAngle) * this.radius() * 0.7; }
|
|
594
|
+
onSliceHover(event, slice) {
|
|
595
|
+
const el = event.currentTarget.closest('.ngx-pie-chart');
|
|
596
|
+
const rect = el.getBoundingClientRect();
|
|
597
|
+
this.tooltip.set({
|
|
598
|
+
x: event.clientX - rect.left,
|
|
599
|
+
y: event.clientY - rect.top,
|
|
600
|
+
...slice,
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
fmtNum = fmtNum;
|
|
604
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
605
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: PieChartComponent, isStandalone: true, selector: "ngx-pie-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, donutHoleSize: { classPropertyName: "donutHoleSize", publicName: "donutHoleSize", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, centerTitle: { classPropertyName: "centerTitle", publicName: "centerTitle", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
606
|
+
<div class="ngx-pie-chart">
|
|
607
|
+
<div class="chart-body">
|
|
608
|
+
<svg class="chart-svg" [attr.width]="svgSize()" [attr.height]="svgSize()">
|
|
609
|
+
<g [attr.transform]="'translate(' + cx() + ',' + cy() + ')'">
|
|
610
|
+
@for (slice of slices(); track slice.index) {
|
|
611
|
+
<path
|
|
612
|
+
[attr.d]="slice.path"
|
|
613
|
+
[attr.fill]="slice.color"
|
|
614
|
+
[attr.stroke]="'#fff'"
|
|
615
|
+
stroke-width="2"
|
|
616
|
+
class="pie-slice"
|
|
617
|
+
[class.hovered]="hovered() === slice.index"
|
|
618
|
+
(mouseenter)="hovered.set(slice.index); onSliceHover($event, slice)"
|
|
619
|
+
(mouseleave)="hovered.set(-1); tooltip.set(null)"
|
|
620
|
+
/>
|
|
621
|
+
@if (showLabels() && slice.midAngle !== null) {
|
|
622
|
+
<text
|
|
623
|
+
[attr.x]="labelX(slice)"
|
|
624
|
+
[attr.y]="labelY(slice)"
|
|
625
|
+
text-anchor="middle"
|
|
626
|
+
dominant-baseline="middle"
|
|
627
|
+
class="slice-label"
|
|
628
|
+
>{{ slice.pct }}%</text>
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
<!-- Donut hole -->
|
|
632
|
+
@if (mode() === 'donut') {
|
|
633
|
+
<circle [attr.r]="holeR()" fill="var(--ngx-chart-bg,#fff)"/>
|
|
634
|
+
<text class="donut-center-text" text-anchor="middle" dy="-8">{{ centerTitle() }}</text>
|
|
635
|
+
<text class="donut-center-value" text-anchor="middle" dy="14">{{ centerValue() }}</text>
|
|
636
|
+
}
|
|
637
|
+
</g>
|
|
638
|
+
</svg>
|
|
639
|
+
|
|
640
|
+
@if (showLegend()) {
|
|
641
|
+
<div class="chart-legend">
|
|
642
|
+
@for (slice of slices(); track slice.index) {
|
|
643
|
+
<div class="legend-item" (mouseenter)="hovered.set(slice.index)" (mouseleave)="hovered.set(-1)">
|
|
644
|
+
<span class="legend-dot" [style.background]="slice.color"></span>
|
|
645
|
+
<span class="legend-label">{{ slice.label }}</span>
|
|
646
|
+
<span class="legend-pct">{{ slice.pct }}%</span>
|
|
647
|
+
</div>
|
|
648
|
+
}
|
|
649
|
+
</div>
|
|
650
|
+
}
|
|
651
|
+
</div>
|
|
652
|
+
|
|
653
|
+
@if (tooltip(); as t) {
|
|
654
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
655
|
+
<span class="tt-dot" [style.background]="t.color"></span>
|
|
656
|
+
<strong>{{ t.label }}</strong>: {{ fmtNum(t.value) }} ({{ t.pct }}%)
|
|
657
|
+
</div>
|
|
658
|
+
}
|
|
659
|
+
</div>
|
|
660
|
+
`, isInline: true, styles: [":host{display:block}.ngx-pie-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-body{display:flex;align-items:center;gap:24px;flex-wrap:wrap}.chart-svg{display:block;overflow:visible;flex-shrink:0}.pie-slice{cursor:pointer;transition:transform .15s,opacity .15s;transform-origin:center}.pie-slice.hovered{transform:scale(1.03);opacity:.9}.slice-label{font-size:11px;fill:#fff;font-weight:600;pointer-events:none}.donut-center-text{font-size:12px;fill:var(--ngx-chart-axis-text,#6c757d)}.donut-center-value{font-size:20px;font-weight:700;fill:var(--ngx-chart-text,#212529)}.chart-legend{display:flex;flex-direction:column;gap:6px}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;padding:2px 4px;border-radius:3px}.legend-item:hover{background:var(--ngx-chart-grid,#f1f3f5)}.legend-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0}.legend-label{flex:1;color:var(--ngx-chart-axis-text,#6c757d)}.legend-pct{font-weight:600;color:var(--ngx-chart-text,#212529)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg,#343a40);color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;white-space:nowrap;display:flex;align-items:center;gap:6px}.tt-dot{width:8px;height:8px;border-radius:50%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
661
|
+
}
|
|
662
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PieChartComponent, decorators: [{
|
|
663
|
+
type: Component,
|
|
664
|
+
args: [{ selector: 'ngx-pie-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
665
|
+
<div class="ngx-pie-chart">
|
|
666
|
+
<div class="chart-body">
|
|
667
|
+
<svg class="chart-svg" [attr.width]="svgSize()" [attr.height]="svgSize()">
|
|
668
|
+
<g [attr.transform]="'translate(' + cx() + ',' + cy() + ')'">
|
|
669
|
+
@for (slice of slices(); track slice.index) {
|
|
670
|
+
<path
|
|
671
|
+
[attr.d]="slice.path"
|
|
672
|
+
[attr.fill]="slice.color"
|
|
673
|
+
[attr.stroke]="'#fff'"
|
|
674
|
+
stroke-width="2"
|
|
675
|
+
class="pie-slice"
|
|
676
|
+
[class.hovered]="hovered() === slice.index"
|
|
677
|
+
(mouseenter)="hovered.set(slice.index); onSliceHover($event, slice)"
|
|
678
|
+
(mouseleave)="hovered.set(-1); tooltip.set(null)"
|
|
679
|
+
/>
|
|
680
|
+
@if (showLabels() && slice.midAngle !== null) {
|
|
681
|
+
<text
|
|
682
|
+
[attr.x]="labelX(slice)"
|
|
683
|
+
[attr.y]="labelY(slice)"
|
|
684
|
+
text-anchor="middle"
|
|
685
|
+
dominant-baseline="middle"
|
|
686
|
+
class="slice-label"
|
|
687
|
+
>{{ slice.pct }}%</text>
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
<!-- Donut hole -->
|
|
691
|
+
@if (mode() === 'donut') {
|
|
692
|
+
<circle [attr.r]="holeR()" fill="var(--ngx-chart-bg,#fff)"/>
|
|
693
|
+
<text class="donut-center-text" text-anchor="middle" dy="-8">{{ centerTitle() }}</text>
|
|
694
|
+
<text class="donut-center-value" text-anchor="middle" dy="14">{{ centerValue() }}</text>
|
|
695
|
+
}
|
|
696
|
+
</g>
|
|
697
|
+
</svg>
|
|
698
|
+
|
|
699
|
+
@if (showLegend()) {
|
|
700
|
+
<div class="chart-legend">
|
|
701
|
+
@for (slice of slices(); track slice.index) {
|
|
702
|
+
<div class="legend-item" (mouseenter)="hovered.set(slice.index)" (mouseleave)="hovered.set(-1)">
|
|
703
|
+
<span class="legend-dot" [style.background]="slice.color"></span>
|
|
704
|
+
<span class="legend-label">{{ slice.label }}</span>
|
|
705
|
+
<span class="legend-pct">{{ slice.pct }}%</span>
|
|
706
|
+
</div>
|
|
707
|
+
}
|
|
708
|
+
</div>
|
|
709
|
+
}
|
|
710
|
+
</div>
|
|
711
|
+
|
|
712
|
+
@if (tooltip(); as t) {
|
|
713
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
714
|
+
<span class="tt-dot" [style.background]="t.color"></span>
|
|
715
|
+
<strong>{{ t.label }}</strong>: {{ fmtNum(t.value) }} ({{ t.pct }}%)
|
|
716
|
+
</div>
|
|
717
|
+
}
|
|
718
|
+
</div>
|
|
719
|
+
`, styles: [":host{display:block}.ngx-pie-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-body{display:flex;align-items:center;gap:24px;flex-wrap:wrap}.chart-svg{display:block;overflow:visible;flex-shrink:0}.pie-slice{cursor:pointer;transition:transform .15s,opacity .15s;transform-origin:center}.pie-slice.hovered{transform:scale(1.03);opacity:.9}.slice-label{font-size:11px;fill:#fff;font-weight:600;pointer-events:none}.donut-center-text{font-size:12px;fill:var(--ngx-chart-axis-text,#6c757d)}.donut-center-value{font-size:20px;font-weight:700;fill:var(--ngx-chart-text,#212529)}.chart-legend{display:flex;flex-direction:column;gap:6px}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;padding:2px 4px;border-radius:3px}.legend-item:hover{background:var(--ngx-chart-grid,#f1f3f5)}.legend-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0}.legend-label{flex:1;color:var(--ngx-chart-axis-text,#6c757d)}.legend-pct{font-weight:600;color:var(--ngx-chart-text,#212529)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg,#343a40);color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;white-space:nowrap;display:flex;align-items:center;gap:6px}.tt-dot{width:8px;height:8px;border-radius:50%}\n"] }]
|
|
720
|
+
}] });
|
|
721
|
+
|
|
722
|
+
class SparklineComponent {
|
|
723
|
+
data = input([]);
|
|
724
|
+
type = input('line');
|
|
725
|
+
color = input(CHART_COLORS[0]);
|
|
726
|
+
width = input(120);
|
|
727
|
+
height = input(36);
|
|
728
|
+
PAD = 2;
|
|
729
|
+
w = computed(() => this.width() - this.PAD * 2);
|
|
730
|
+
h = computed(() => this.height() - this.PAD * 2);
|
|
731
|
+
yMin = computed(() => Math.min(...this.data(), 0));
|
|
732
|
+
yMax = computed(() => Math.max(...this.data(), 1));
|
|
733
|
+
pts = computed(() => {
|
|
734
|
+
const d = this.data();
|
|
735
|
+
const n = d.length;
|
|
736
|
+
if (n === 0)
|
|
737
|
+
return [];
|
|
738
|
+
return d.map((v, i) => [
|
|
739
|
+
this.PAD + scale(i, 0, Math.max(n - 1, 1), 0, this.w()),
|
|
740
|
+
this.PAD + scale(v, this.yMin(), this.yMax(), this.h(), 0),
|
|
741
|
+
]);
|
|
742
|
+
});
|
|
743
|
+
linePath = computed(() => smoothPath(this.pts()));
|
|
744
|
+
areaPath = computed(() => {
|
|
745
|
+
const pts = this.pts();
|
|
746
|
+
if (pts.length < 2)
|
|
747
|
+
return '';
|
|
748
|
+
const line = smoothPath(pts);
|
|
749
|
+
const last = pts[pts.length - 1];
|
|
750
|
+
const first = pts[0];
|
|
751
|
+
const bottom = this.PAD + this.h();
|
|
752
|
+
return line + ` L ${last[0]} ${bottom} L ${first[0]} ${bottom} Z`;
|
|
753
|
+
});
|
|
754
|
+
areaFill = computed(() => this.color() + '22');
|
|
755
|
+
endPoint = computed(() => {
|
|
756
|
+
const pts = this.pts();
|
|
757
|
+
return pts.length > 0 ? pts[pts.length - 1] : null;
|
|
758
|
+
});
|
|
759
|
+
barItems = computed(() => {
|
|
760
|
+
const d = this.data();
|
|
761
|
+
const n = d.length;
|
|
762
|
+
if (n === 0)
|
|
763
|
+
return [];
|
|
764
|
+
const bw = Math.max(2, this.w() / n - 1);
|
|
765
|
+
const zero = this.PAD + scale(0, this.yMin(), this.yMax(), this.h(), 0);
|
|
766
|
+
return d.map((v, i) => {
|
|
767
|
+
const x = this.PAD + scale(i, 0, Math.max(n - 1, 1), 0, this.w()) - bw / 2;
|
|
768
|
+
const y = this.PAD + scale(v, this.yMin(), this.yMax(), this.h(), 0);
|
|
769
|
+
return { x, y, w: bw, h: Math.abs(zero - y) };
|
|
770
|
+
});
|
|
771
|
+
});
|
|
772
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SparklineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
773
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: SparklineComponent, isStandalone: true, selector: "ngx-sparkline", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
774
|
+
<svg
|
|
775
|
+
[attr.width]="width()"
|
|
776
|
+
[attr.height]="height()"
|
|
777
|
+
class="ngx-sparkline"
|
|
778
|
+
[attr.aria-label]="'Sparkline'"
|
|
779
|
+
>
|
|
780
|
+
@if (type() === 'line' || type() === 'area') {
|
|
781
|
+
@if (type() === 'area') {
|
|
782
|
+
<path [attr.d]="areaPath()" [attr.fill]="areaFill()" stroke="none"/>
|
|
783
|
+
}
|
|
784
|
+
<path
|
|
785
|
+
[attr.d]="linePath()"
|
|
786
|
+
[attr.stroke]="color()"
|
|
787
|
+
fill="none"
|
|
788
|
+
stroke-width="2"
|
|
789
|
+
stroke-linejoin="round"
|
|
790
|
+
stroke-linecap="round"
|
|
791
|
+
/>
|
|
792
|
+
<!-- End dot -->
|
|
793
|
+
@if (endPoint(); as ep) {
|
|
794
|
+
<circle [attr.cx]="ep[0]" [attr.cy]="ep[1]" r="3" [attr.fill]="color()"/>
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
@if (type() === 'bar') {
|
|
798
|
+
@for (item of barItems(); track $index) {
|
|
799
|
+
<rect
|
|
800
|
+
[attr.x]="item.x"
|
|
801
|
+
[attr.y]="item.y"
|
|
802
|
+
[attr.width]="item.w"
|
|
803
|
+
[attr.height]="item.h"
|
|
804
|
+
[attr.fill]="color()"
|
|
805
|
+
[attr.rx]="1"
|
|
806
|
+
opacity="0.85"
|
|
807
|
+
/>
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
</svg>
|
|
811
|
+
`, isInline: true, styles: [":host{display:inline-block}.ngx-sparkline{display:block}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
812
|
+
}
|
|
813
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SparklineComponent, decorators: [{
|
|
814
|
+
type: Component,
|
|
815
|
+
args: [{ selector: 'ngx-sparkline', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
816
|
+
<svg
|
|
817
|
+
[attr.width]="width()"
|
|
818
|
+
[attr.height]="height()"
|
|
819
|
+
class="ngx-sparkline"
|
|
820
|
+
[attr.aria-label]="'Sparkline'"
|
|
821
|
+
>
|
|
822
|
+
@if (type() === 'line' || type() === 'area') {
|
|
823
|
+
@if (type() === 'area') {
|
|
824
|
+
<path [attr.d]="areaPath()" [attr.fill]="areaFill()" stroke="none"/>
|
|
825
|
+
}
|
|
826
|
+
<path
|
|
827
|
+
[attr.d]="linePath()"
|
|
828
|
+
[attr.stroke]="color()"
|
|
829
|
+
fill="none"
|
|
830
|
+
stroke-width="2"
|
|
831
|
+
stroke-linejoin="round"
|
|
832
|
+
stroke-linecap="round"
|
|
833
|
+
/>
|
|
834
|
+
<!-- End dot -->
|
|
835
|
+
@if (endPoint(); as ep) {
|
|
836
|
+
<circle [attr.cx]="ep[0]" [attr.cy]="ep[1]" r="3" [attr.fill]="color()"/>
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
@if (type() === 'bar') {
|
|
840
|
+
@for (item of barItems(); track $index) {
|
|
841
|
+
<rect
|
|
842
|
+
[attr.x]="item.x"
|
|
843
|
+
[attr.y]="item.y"
|
|
844
|
+
[attr.width]="item.w"
|
|
845
|
+
[attr.height]="item.h"
|
|
846
|
+
[attr.fill]="color()"
|
|
847
|
+
[attr.rx]="1"
|
|
848
|
+
opacity="0.85"
|
|
849
|
+
/>
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
</svg>
|
|
853
|
+
`, styles: [":host{display:inline-block}.ngx-sparkline{display:block}\n"] }]
|
|
854
|
+
}] });
|
|
855
|
+
|
|
856
|
+
var DependencyType;
|
|
857
|
+
(function (DependencyType) {
|
|
858
|
+
DependencyType["FinishToStart"] = "FS";
|
|
859
|
+
DependencyType["StartToStart"] = "SS";
|
|
860
|
+
DependencyType["FinishToFinish"] = "FF";
|
|
861
|
+
DependencyType["StartToFinish"] = "SF";
|
|
862
|
+
})(DependencyType || (DependencyType = {}));
|
|
863
|
+
|
|
864
|
+
var ZoomLevel;
|
|
865
|
+
(function (ZoomLevel) {
|
|
866
|
+
ZoomLevel["Day"] = "day";
|
|
867
|
+
ZoomLevel["Week"] = "week";
|
|
868
|
+
ZoomLevel["Month"] = "month";
|
|
869
|
+
})(ZoomLevel || (ZoomLevel = {}));
|
|
870
|
+
const DEFAULT_GANTT_CONFIG = {
|
|
871
|
+
zoomLevel: ZoomLevel.Day,
|
|
872
|
+
rowHeight: 40,
|
|
873
|
+
columnWidth: 40,
|
|
874
|
+
sidebarColumns: [{ field: 'name', header: 'Task Name', width: 200 }],
|
|
875
|
+
sidebarWidth: 280,
|
|
876
|
+
showTodayMarker: true,
|
|
877
|
+
showGrid: true,
|
|
878
|
+
collapsible: true,
|
|
879
|
+
headerHeight: 60,
|
|
880
|
+
snapTo: 'day',
|
|
881
|
+
locale: 'en-US',
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
function addDays(date, days) {
|
|
885
|
+
const result = new Date(date);
|
|
886
|
+
result.setDate(result.getDate() + days);
|
|
887
|
+
return result;
|
|
888
|
+
}
|
|
889
|
+
function diffDays(a, b) {
|
|
890
|
+
const msPerDay = 86400000;
|
|
891
|
+
return Math.round((a.getTime() - b.getTime()) / msPerDay);
|
|
892
|
+
}
|
|
893
|
+
function startOfDay(date) {
|
|
894
|
+
const result = new Date(date);
|
|
895
|
+
result.setHours(0, 0, 0, 0);
|
|
896
|
+
return result;
|
|
897
|
+
}
|
|
898
|
+
function startOfWeek(date, weekStartsOn = 1) {
|
|
899
|
+
const result = startOfDay(date);
|
|
900
|
+
const day = result.getDay();
|
|
901
|
+
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
902
|
+
result.setDate(result.getDate() - diff);
|
|
903
|
+
return result;
|
|
904
|
+
}
|
|
905
|
+
function startOfMonth(date) {
|
|
906
|
+
const result = new Date(date);
|
|
907
|
+
result.setDate(1);
|
|
908
|
+
result.setHours(0, 0, 0, 0);
|
|
909
|
+
return result;
|
|
910
|
+
}
|
|
911
|
+
function addMonths(date, months) {
|
|
912
|
+
const result = new Date(date);
|
|
913
|
+
result.setMonth(result.getMonth() + months);
|
|
914
|
+
return result;
|
|
915
|
+
}
|
|
916
|
+
function addWeeks(date, weeks) {
|
|
917
|
+
return addDays(date, weeks * 7);
|
|
918
|
+
}
|
|
919
|
+
function isWeekend(date) {
|
|
920
|
+
const day = date.getDay();
|
|
921
|
+
return day === 0 || day === 6;
|
|
922
|
+
}
|
|
923
|
+
function getDateRange(tasks) {
|
|
924
|
+
if (tasks.length === 0) {
|
|
925
|
+
const today = startOfDay(new Date());
|
|
926
|
+
return { start: today, end: addDays(today, 30) };
|
|
927
|
+
}
|
|
928
|
+
let min = tasks[0].start.getTime();
|
|
929
|
+
let max = tasks[0].end.getTime();
|
|
930
|
+
for (const t of tasks) {
|
|
931
|
+
if (t.start.getTime() < min)
|
|
932
|
+
min = t.start.getTime();
|
|
933
|
+
if (t.end.getTime() > max)
|
|
934
|
+
max = t.end.getTime();
|
|
935
|
+
}
|
|
936
|
+
return { start: addDays(new Date(min), -2), end: addDays(new Date(max), 2) };
|
|
937
|
+
}
|
|
938
|
+
function getColumnDates(start, end, zoom) {
|
|
939
|
+
const dates = [];
|
|
940
|
+
let current;
|
|
941
|
+
switch (zoom) {
|
|
942
|
+
case ZoomLevel.Day:
|
|
943
|
+
current = startOfDay(start);
|
|
944
|
+
while (current <= end) {
|
|
945
|
+
dates.push(new Date(current));
|
|
946
|
+
current = addDays(current, 1);
|
|
947
|
+
}
|
|
948
|
+
break;
|
|
949
|
+
case ZoomLevel.Week:
|
|
950
|
+
current = startOfWeek(start);
|
|
951
|
+
while (current <= end) {
|
|
952
|
+
dates.push(new Date(current));
|
|
953
|
+
current = addWeeks(current, 1);
|
|
954
|
+
}
|
|
955
|
+
break;
|
|
956
|
+
case ZoomLevel.Month:
|
|
957
|
+
current = startOfMonth(start);
|
|
958
|
+
while (current <= end) {
|
|
959
|
+
dates.push(new Date(current));
|
|
960
|
+
current = addMonths(current, 1);
|
|
961
|
+
}
|
|
962
|
+
break;
|
|
963
|
+
}
|
|
964
|
+
return dates;
|
|
965
|
+
}
|
|
966
|
+
function snapToDay(date) {
|
|
967
|
+
const result = startOfDay(date);
|
|
968
|
+
if (date.getHours() >= 12) {
|
|
969
|
+
return addDays(result, 1);
|
|
970
|
+
}
|
|
971
|
+
return result;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
class GanttScaleService {
|
|
975
|
+
dateToX(date, startDate, columnWidth, zoomLevel) {
|
|
976
|
+
switch (zoomLevel) {
|
|
977
|
+
case ZoomLevel.Day:
|
|
978
|
+
return diffDays(startOfDay(date), startOfDay(startDate)) * columnWidth;
|
|
979
|
+
case ZoomLevel.Week: {
|
|
980
|
+
const totalDays = diffDays(date, startOfWeek(startDate));
|
|
981
|
+
return (totalDays / 7) * columnWidth;
|
|
982
|
+
}
|
|
983
|
+
case ZoomLevel.Month: {
|
|
984
|
+
const start = startOfMonth(startDate);
|
|
985
|
+
const months = (date.getFullYear() - start.getFullYear()) * 12 +
|
|
986
|
+
(date.getMonth() - start.getMonth());
|
|
987
|
+
const dayInMonth = date.getDate() - 1;
|
|
988
|
+
const daysInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
989
|
+
return (months + dayInMonth / daysInMonth) * columnWidth;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
xToDate(x, startDate, columnWidth, zoomLevel) {
|
|
994
|
+
switch (zoomLevel) {
|
|
995
|
+
case ZoomLevel.Day: {
|
|
996
|
+
const days = x / columnWidth;
|
|
997
|
+
return addDays(startOfDay(startDate), Math.round(days));
|
|
998
|
+
}
|
|
999
|
+
case ZoomLevel.Week: {
|
|
1000
|
+
const weeks = x / columnWidth;
|
|
1001
|
+
return addDays(startOfWeek(startDate), Math.round(weeks * 7));
|
|
1002
|
+
}
|
|
1003
|
+
case ZoomLevel.Month: {
|
|
1004
|
+
const months = x / columnWidth;
|
|
1005
|
+
const start = startOfMonth(startDate);
|
|
1006
|
+
const result = new Date(start);
|
|
1007
|
+
result.setMonth(result.getMonth() + Math.floor(months));
|
|
1008
|
+
const fraction = months - Math.floor(months);
|
|
1009
|
+
const daysInMonth = new Date(result.getFullYear(), result.getMonth() + 1, 0).getDate();
|
|
1010
|
+
result.setDate(1 + Math.round(fraction * daysInMonth));
|
|
1011
|
+
return result;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
snapDate(date, snapTo) {
|
|
1016
|
+
switch (snapTo) {
|
|
1017
|
+
case 'day':
|
|
1018
|
+
return snapToDay(date);
|
|
1019
|
+
case 'hour': {
|
|
1020
|
+
const result = new Date(date);
|
|
1021
|
+
result.setMinutes(0, 0, 0);
|
|
1022
|
+
return result;
|
|
1023
|
+
}
|
|
1024
|
+
default:
|
|
1025
|
+
return date;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
getBarWidth(start, end, startDate, columnWidth, zoomLevel) {
|
|
1029
|
+
const x1 = this.dateToX(start, startDate, columnWidth, zoomLevel);
|
|
1030
|
+
const x2 = this.dateToX(end, startDate, columnWidth, zoomLevel);
|
|
1031
|
+
return Math.max(x2 - x1, 4);
|
|
1032
|
+
}
|
|
1033
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttScaleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1034
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttScaleService });
|
|
1035
|
+
}
|
|
1036
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttScaleService, decorators: [{
|
|
1037
|
+
type: Injectable
|
|
1038
|
+
}] });
|
|
1039
|
+
|
|
1040
|
+
class GanttLayoutService {
|
|
1041
|
+
flattenTasks(tasks) {
|
|
1042
|
+
const childrenMap = new Map();
|
|
1043
|
+
for (const task of tasks) {
|
|
1044
|
+
const parentId = task.parentId;
|
|
1045
|
+
if (!childrenMap.has(parentId)) {
|
|
1046
|
+
childrenMap.set(parentId, []);
|
|
1047
|
+
}
|
|
1048
|
+
childrenMap.get(parentId).push(task);
|
|
1049
|
+
}
|
|
1050
|
+
const rows = [];
|
|
1051
|
+
let rowIndex = 0;
|
|
1052
|
+
const traverse = (parentId, depth, parentVisible) => {
|
|
1053
|
+
const children = childrenMap.get(parentId) || [];
|
|
1054
|
+
// Group children by rowId, preserving original order for primary tasks.
|
|
1055
|
+
const rowGroups = [];
|
|
1056
|
+
const rowIdToGroup = new Map();
|
|
1057
|
+
for (const task of children) {
|
|
1058
|
+
if (task.rowId) {
|
|
1059
|
+
const existing = rowIdToGroup.get(task.rowId);
|
|
1060
|
+
if (existing) {
|
|
1061
|
+
existing.extra.push(task);
|
|
1062
|
+
}
|
|
1063
|
+
else {
|
|
1064
|
+
const group = { primary: task, extra: [] };
|
|
1065
|
+
rowGroups.push(group);
|
|
1066
|
+
rowIdToGroup.set(task.rowId, group);
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
else {
|
|
1070
|
+
rowGroups.push({ primary: task, extra: [] });
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
for (const { primary: task, extra: extraTasks } of rowGroups) {
|
|
1074
|
+
const hasChildren = childrenMap.has(task.id) && childrenMap.get(task.id).length > 0;
|
|
1075
|
+
const isVisible = parentVisible;
|
|
1076
|
+
rows.push({ task, extraTasks, depth, rowIndex: isVisible ? rowIndex : -1, hasChildren, isVisible });
|
|
1077
|
+
if (isVisible)
|
|
1078
|
+
rowIndex++;
|
|
1079
|
+
const childVisible = isVisible && !task.collapsed;
|
|
1080
|
+
traverse(task.id, depth + 1, childVisible);
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
traverse(null, 0, true);
|
|
1084
|
+
return rows;
|
|
1085
|
+
}
|
|
1086
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttLayoutService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1087
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttLayoutService });
|
|
1088
|
+
}
|
|
1089
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttLayoutService, decorators: [{
|
|
1090
|
+
type: Injectable
|
|
1091
|
+
}] });
|
|
1092
|
+
|
|
1093
|
+
class GanttKeyboardService {
|
|
1094
|
+
focusedTaskId = signal(null);
|
|
1095
|
+
focusTask(taskId) {
|
|
1096
|
+
this.focusedTaskId.set(taskId);
|
|
1097
|
+
}
|
|
1098
|
+
clearFocus() {
|
|
1099
|
+
this.focusedTaskId.set(null);
|
|
1100
|
+
}
|
|
1101
|
+
handleKeyDown(event, visibleTaskIds, callbacks) {
|
|
1102
|
+
const currentId = this.focusedTaskId();
|
|
1103
|
+
const currentIndex = currentId ? visibleTaskIds.indexOf(currentId) : -1;
|
|
1104
|
+
switch (event.key) {
|
|
1105
|
+
case 'ArrowDown':
|
|
1106
|
+
event.preventDefault();
|
|
1107
|
+
if (currentIndex < visibleTaskIds.length - 1) {
|
|
1108
|
+
this.focusTask(visibleTaskIds[currentIndex + 1]);
|
|
1109
|
+
}
|
|
1110
|
+
break;
|
|
1111
|
+
case 'ArrowUp':
|
|
1112
|
+
event.preventDefault();
|
|
1113
|
+
if (currentIndex > 0) {
|
|
1114
|
+
this.focusTask(visibleTaskIds[currentIndex - 1]);
|
|
1115
|
+
}
|
|
1116
|
+
break;
|
|
1117
|
+
case 'Enter':
|
|
1118
|
+
case ' ':
|
|
1119
|
+
event.preventDefault();
|
|
1120
|
+
if (currentId && callbacks.onSelect) {
|
|
1121
|
+
callbacks.onSelect(currentId);
|
|
1122
|
+
}
|
|
1123
|
+
break;
|
|
1124
|
+
case 'Escape':
|
|
1125
|
+
this.clearFocus();
|
|
1126
|
+
callbacks.onEscape?.();
|
|
1127
|
+
break;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttKeyboardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1131
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttKeyboardService });
|
|
1132
|
+
}
|
|
1133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttKeyboardService, decorators: [{
|
|
1134
|
+
type: Injectable
|
|
1135
|
+
}] });
|
|
1136
|
+
|
|
1137
|
+
function computeDependencyPath(from, to, type, offset = 12) {
|
|
1138
|
+
let startX;
|
|
1139
|
+
let startY;
|
|
1140
|
+
let endX;
|
|
1141
|
+
let endY;
|
|
1142
|
+
switch (type) {
|
|
1143
|
+
case DependencyType.FinishToStart:
|
|
1144
|
+
startX = from.x + from.width;
|
|
1145
|
+
startY = from.y + from.height / 2;
|
|
1146
|
+
endX = to.x;
|
|
1147
|
+
endY = to.y + to.height / 2;
|
|
1148
|
+
break;
|
|
1149
|
+
case DependencyType.StartToStart:
|
|
1150
|
+
startX = from.x;
|
|
1151
|
+
startY = from.y + from.height / 2;
|
|
1152
|
+
endX = to.x;
|
|
1153
|
+
endY = to.y + to.height / 2;
|
|
1154
|
+
break;
|
|
1155
|
+
case DependencyType.FinishToFinish:
|
|
1156
|
+
startX = from.x + from.width;
|
|
1157
|
+
startY = from.y + from.height / 2;
|
|
1158
|
+
endX = to.x + to.width;
|
|
1159
|
+
endY = to.y + to.height / 2;
|
|
1160
|
+
break;
|
|
1161
|
+
case DependencyType.StartToFinish:
|
|
1162
|
+
startX = from.x;
|
|
1163
|
+
startY = from.y + from.height / 2;
|
|
1164
|
+
endX = to.x + to.width;
|
|
1165
|
+
endY = to.y + to.height / 2;
|
|
1166
|
+
break;
|
|
1167
|
+
}
|
|
1168
|
+
const midX = startX + offset;
|
|
1169
|
+
if (type === DependencyType.FinishToStart && endX > startX + offset * 2) {
|
|
1170
|
+
const mx = (startX + endX) / 2;
|
|
1171
|
+
return `M ${startX} ${startY} H ${mx} V ${endY} H ${endX}`;
|
|
1172
|
+
}
|
|
1173
|
+
return `M ${startX} ${startY} H ${midX} V ${endY} H ${endX}`;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
class GanttChartComponent {
|
|
1177
|
+
// Inputs
|
|
1178
|
+
tasks = input.required();
|
|
1179
|
+
dependencies = input([]);
|
|
1180
|
+
config = input({});
|
|
1181
|
+
// Outputs
|
|
1182
|
+
taskChange = output();
|
|
1183
|
+
taskClick = output();
|
|
1184
|
+
taskDblClick = output();
|
|
1185
|
+
dependencyClick = output();
|
|
1186
|
+
scroll = output();
|
|
1187
|
+
zoomChange = output();
|
|
1188
|
+
// Services
|
|
1189
|
+
scaleService = inject(GanttScaleService);
|
|
1190
|
+
layoutService = inject(GanttLayoutService);
|
|
1191
|
+
keyboardService = inject(GanttKeyboardService);
|
|
1192
|
+
// View children
|
|
1193
|
+
timelineContent = viewChild('timelineContent');
|
|
1194
|
+
treelistContent = viewChild('treelistContent');
|
|
1195
|
+
// Internal state
|
|
1196
|
+
internalCollapsed = signal(new Map());
|
|
1197
|
+
hoveredTaskId = signal(null);
|
|
1198
|
+
selectedTaskId = signal(null);
|
|
1199
|
+
scrollLeft = signal(0);
|
|
1200
|
+
scrollTop_ = signal(0);
|
|
1201
|
+
sidebarWidthOverride = signal(null);
|
|
1202
|
+
// Tooltip state
|
|
1203
|
+
tooltipTask = signal(null);
|
|
1204
|
+
tooltipX = signal(0);
|
|
1205
|
+
tooltipY = signal(0);
|
|
1206
|
+
// Row tooltip state (for sidebar multi-task rows)
|
|
1207
|
+
rowTooltipData = signal(null);
|
|
1208
|
+
rowTooltipX = signal(0);
|
|
1209
|
+
rowTooltipY = signal(0);
|
|
1210
|
+
// Merged config
|
|
1211
|
+
mergedConfig = computed(() => {
|
|
1212
|
+
const base = { ...DEFAULT_GANTT_CONFIG, ...this.config() };
|
|
1213
|
+
const sbOverride = this.sidebarWidthOverride();
|
|
1214
|
+
if (sbOverride !== null) {
|
|
1215
|
+
base.sidebarWidth = sbOverride;
|
|
1216
|
+
}
|
|
1217
|
+
return base;
|
|
1218
|
+
});
|
|
1219
|
+
// Tasks with collapse applied
|
|
1220
|
+
effectiveTasks = computed(() => {
|
|
1221
|
+
const collapsed = this.internalCollapsed();
|
|
1222
|
+
return this.tasks().map(t => ({
|
|
1223
|
+
...t,
|
|
1224
|
+
collapsed: collapsed.has(t.id) ? collapsed.get(t.id) : t.collapsed,
|
|
1225
|
+
}));
|
|
1226
|
+
});
|
|
1227
|
+
// Flat row list
|
|
1228
|
+
flatRows = computed(() => this.layoutService.flattenTasks(this.effectiveTasks()));
|
|
1229
|
+
visibleRows = computed(() => this.flatRows().filter(r => r.isVisible));
|
|
1230
|
+
// Date range
|
|
1231
|
+
dateRange = computed(() => getDateRange(this.tasks()));
|
|
1232
|
+
columnDates = computed(() => getColumnDates(this.dateRange().start, this.dateRange().end, this.mergedConfig().zoomLevel));
|
|
1233
|
+
// Dimensions
|
|
1234
|
+
totalWidth = computed(() => this.columnDates().length * this.mergedConfig().columnWidth);
|
|
1235
|
+
totalHeight = computed(() => this.visibleRows().length * this.mergedConfig().rowHeight);
|
|
1236
|
+
// Header columns with labels
|
|
1237
|
+
headerColumns = computed(() => {
|
|
1238
|
+
const cfg = this.mergedConfig();
|
|
1239
|
+
const today = startOfDay(new Date());
|
|
1240
|
+
return this.columnDates().map((date, i) => {
|
|
1241
|
+
const isWknd = isWeekend(date);
|
|
1242
|
+
const isToday = date.getTime() === today.getTime();
|
|
1243
|
+
return {
|
|
1244
|
+
x: i * cfg.columnWidth,
|
|
1245
|
+
width: cfg.columnWidth,
|
|
1246
|
+
date,
|
|
1247
|
+
label: this.getSecondaryLabel(date, cfg.zoomLevel, cfg.locale),
|
|
1248
|
+
isWeekend: isWknd,
|
|
1249
|
+
isToday,
|
|
1250
|
+
};
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
// Primary header groups
|
|
1254
|
+
primaryHeaderGroups = computed(() => {
|
|
1255
|
+
const cfg = this.mergedConfig();
|
|
1256
|
+
const dates = this.columnDates();
|
|
1257
|
+
if (dates.length === 0)
|
|
1258
|
+
return [];
|
|
1259
|
+
const groups = [];
|
|
1260
|
+
let currentLabel = this.getPrimaryLabel(dates[0], cfg.zoomLevel, cfg.locale);
|
|
1261
|
+
let startIdx = 0;
|
|
1262
|
+
for (let i = 1; i <= dates.length; i++) {
|
|
1263
|
+
const label = i < dates.length ? this.getPrimaryLabel(dates[i], cfg.zoomLevel, cfg.locale) : '';
|
|
1264
|
+
if (label !== currentLabel || i === dates.length) {
|
|
1265
|
+
groups.push({
|
|
1266
|
+
x: startIdx * cfg.columnWidth,
|
|
1267
|
+
width: (i - startIdx) * cfg.columnWidth,
|
|
1268
|
+
label: currentLabel,
|
|
1269
|
+
});
|
|
1270
|
+
currentLabel = label;
|
|
1271
|
+
startIdx = i;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
return groups;
|
|
1275
|
+
});
|
|
1276
|
+
// Today X
|
|
1277
|
+
todayX = computed(() => {
|
|
1278
|
+
const today = startOfDay(new Date());
|
|
1279
|
+
const range = this.dateRange();
|
|
1280
|
+
if (today < range.start || today > range.end)
|
|
1281
|
+
return null;
|
|
1282
|
+
const cfg = this.mergedConfig();
|
|
1283
|
+
return this.scaleService.dateToX(today, range.start, cfg.columnWidth, cfg.zoomLevel);
|
|
1284
|
+
});
|
|
1285
|
+
// Task bar geometries (div positioning)
|
|
1286
|
+
taskBars = computed(() => {
|
|
1287
|
+
const cfg = this.mergedConfig();
|
|
1288
|
+
const range = this.dateRange();
|
|
1289
|
+
const barHeight = 24; // default
|
|
1290
|
+
const makeBar = (task, top, rowIndex, isSummary, primaryTaskId) => ({
|
|
1291
|
+
task,
|
|
1292
|
+
left: this.scaleService.dateToX(task.start, range.start, cfg.columnWidth, cfg.zoomLevel),
|
|
1293
|
+
width: task.isMilestone
|
|
1294
|
+
? 0
|
|
1295
|
+
: this.scaleService.getBarWidth(task.start, task.end, range.start, cfg.columnWidth, cfg.zoomLevel),
|
|
1296
|
+
top,
|
|
1297
|
+
isSummary,
|
|
1298
|
+
barHeight,
|
|
1299
|
+
rowIndex,
|
|
1300
|
+
primaryTaskId,
|
|
1301
|
+
});
|
|
1302
|
+
const bars = [];
|
|
1303
|
+
this.visibleRows().forEach((row, idx) => {
|
|
1304
|
+
const top = idx * cfg.rowHeight;
|
|
1305
|
+
const isSummary = row.hasChildren && !row.task.isMilestone;
|
|
1306
|
+
bars.push(makeBar(row.task, top, idx, isSummary, row.task.id));
|
|
1307
|
+
for (const extra of row.extraTasks) {
|
|
1308
|
+
bars.push(makeBar(extra, top, idx, false, row.task.id));
|
|
1309
|
+
}
|
|
1310
|
+
});
|
|
1311
|
+
return bars;
|
|
1312
|
+
});
|
|
1313
|
+
// Dependency paths
|
|
1314
|
+
dependencyPaths = computed(() => {
|
|
1315
|
+
const bars = this.taskBars();
|
|
1316
|
+
const cfg = this.mergedConfig();
|
|
1317
|
+
const barMap = new Map(bars.map(b => [b.task.id, b]));
|
|
1318
|
+
return this.dependencies()
|
|
1319
|
+
.filter(dep => barMap.has(dep.fromId) && barMap.has(dep.toId))
|
|
1320
|
+
.map(dep => {
|
|
1321
|
+
const from = barMap.get(dep.fromId);
|
|
1322
|
+
const to = barMap.get(dep.toId);
|
|
1323
|
+
const barH = from.isSummary ? 10 : 24;
|
|
1324
|
+
const fromCenterY = from.top + cfg.rowHeight / 2;
|
|
1325
|
+
const toCenterY = to.top + cfg.rowHeight / 2;
|
|
1326
|
+
const fromRect = { x: from.left, y: fromCenterY - barH / 2, width: from.width || 16, height: barH };
|
|
1327
|
+
const toRect = { x: to.left, y: toCenterY - (to.isSummary ? 5 : 12), width: to.width || 16, height: to.isSummary ? 10 : 24 };
|
|
1328
|
+
return {
|
|
1329
|
+
dependency: dep,
|
|
1330
|
+
path: computeDependencyPath(fromRect, toRect, dep.type),
|
|
1331
|
+
key: dep.fromId + '-' + dep.toId,
|
|
1332
|
+
};
|
|
1333
|
+
});
|
|
1334
|
+
});
|
|
1335
|
+
// Timeline scroll handler — syncs treelist scroll & header position
|
|
1336
|
+
onTimelineScroll() {
|
|
1337
|
+
const el = this.timelineContent()?.nativeElement;
|
|
1338
|
+
if (!el)
|
|
1339
|
+
return;
|
|
1340
|
+
this.scrollLeft.set(el.scrollLeft);
|
|
1341
|
+
this.scrollTop_.set(el.scrollTop);
|
|
1342
|
+
// Sync treelist vertical scroll
|
|
1343
|
+
const treeEl = this.treelistContent()?.nativeElement;
|
|
1344
|
+
if (treeEl)
|
|
1345
|
+
treeEl.scrollTop = el.scrollTop;
|
|
1346
|
+
}
|
|
1347
|
+
// Splitbar resize
|
|
1348
|
+
onSplitBarDown(event) {
|
|
1349
|
+
event.preventDefault();
|
|
1350
|
+
const startX = event.clientX;
|
|
1351
|
+
const startWidth = this.mergedConfig().sidebarWidth;
|
|
1352
|
+
const onMove = (e) => {
|
|
1353
|
+
const delta = e.clientX - startX;
|
|
1354
|
+
const newWidth = Math.max(150, Math.min(600, startWidth + delta));
|
|
1355
|
+
this.sidebarWidthOverride.set(newWidth);
|
|
1356
|
+
};
|
|
1357
|
+
const onUp = () => {
|
|
1358
|
+
document.removeEventListener('pointermove', onMove);
|
|
1359
|
+
document.removeEventListener('pointerup', onUp);
|
|
1360
|
+
};
|
|
1361
|
+
document.addEventListener('pointermove', onMove);
|
|
1362
|
+
document.addEventListener('pointerup', onUp);
|
|
1363
|
+
}
|
|
1364
|
+
// Task bar drag (move/resize)
|
|
1365
|
+
onBarPointerDown(event, task, mode) {
|
|
1366
|
+
if (task.draggable === false)
|
|
1367
|
+
return;
|
|
1368
|
+
event.preventDefault();
|
|
1369
|
+
event.stopPropagation();
|
|
1370
|
+
const startX = event.clientX;
|
|
1371
|
+
const cfg = this.mergedConfig();
|
|
1372
|
+
const range = this.dateRange();
|
|
1373
|
+
const barEl = event.target.closest('.k-task');
|
|
1374
|
+
if (!barEl)
|
|
1375
|
+
return;
|
|
1376
|
+
const origLeft = parseFloat(barEl.style.left) || 0;
|
|
1377
|
+
const origWidth = parseFloat(barEl.style.width) || barEl.offsetWidth;
|
|
1378
|
+
barEl.style.cursor = mode === 'move' ? 'grabbing' : 'col-resize';
|
|
1379
|
+
barEl.style.zIndex = '10';
|
|
1380
|
+
barEl.style.opacity = '0.85';
|
|
1381
|
+
const onMove = (e) => {
|
|
1382
|
+
const deltaX = e.clientX - startX;
|
|
1383
|
+
if (mode === 'move') {
|
|
1384
|
+
barEl.style.left = (origLeft + deltaX) + 'px';
|
|
1385
|
+
}
|
|
1386
|
+
else if (mode === 'resize-right') {
|
|
1387
|
+
barEl.style.width = Math.max(10, origWidth + deltaX) + 'px';
|
|
1388
|
+
}
|
|
1389
|
+
else {
|
|
1390
|
+
const newLeft = origLeft + deltaX;
|
|
1391
|
+
const newWidth = origWidth - deltaX;
|
|
1392
|
+
if (newWidth > 10) {
|
|
1393
|
+
barEl.style.left = newLeft + 'px';
|
|
1394
|
+
barEl.style.width = newWidth + 'px';
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
const onUp = (e) => {
|
|
1399
|
+
document.removeEventListener('pointermove', onMove);
|
|
1400
|
+
document.removeEventListener('pointerup', onUp);
|
|
1401
|
+
barEl.style.cursor = '';
|
|
1402
|
+
barEl.style.zIndex = '';
|
|
1403
|
+
barEl.style.opacity = '';
|
|
1404
|
+
const deltaX = e.clientX - startX;
|
|
1405
|
+
if (Math.abs(deltaX) < 2)
|
|
1406
|
+
return; // ignore tiny movements
|
|
1407
|
+
const pxPerMs = cfg.columnWidth / this.getMsPerUnit(cfg.zoomLevel);
|
|
1408
|
+
const deltaMs = deltaX / pxPerMs;
|
|
1409
|
+
const previousStart = task.start;
|
|
1410
|
+
const previousEnd = task.end;
|
|
1411
|
+
let newStart;
|
|
1412
|
+
let newEnd;
|
|
1413
|
+
if (mode === 'move') {
|
|
1414
|
+
newStart = new Date(previousStart.getTime() + deltaMs);
|
|
1415
|
+
newEnd = new Date(previousEnd.getTime() + deltaMs);
|
|
1416
|
+
}
|
|
1417
|
+
else if (mode === 'resize-right') {
|
|
1418
|
+
newStart = previousStart;
|
|
1419
|
+
newEnd = new Date(previousEnd.getTime() + deltaMs);
|
|
1420
|
+
}
|
|
1421
|
+
else {
|
|
1422
|
+
newStart = new Date(previousStart.getTime() + deltaMs);
|
|
1423
|
+
newEnd = previousEnd;
|
|
1424
|
+
}
|
|
1425
|
+
if (cfg.snapTo === 'day') {
|
|
1426
|
+
newStart = this.scaleService.snapDate(newStart, 'day');
|
|
1427
|
+
newEnd = this.scaleService.snapDate(newEnd, 'day');
|
|
1428
|
+
}
|
|
1429
|
+
if (newEnd <= newStart) {
|
|
1430
|
+
newEnd = addDays(newStart, 1);
|
|
1431
|
+
}
|
|
1432
|
+
this.taskChange.emit({
|
|
1433
|
+
task: { ...task, start: newStart, end: newEnd },
|
|
1434
|
+
previousStart,
|
|
1435
|
+
previousEnd,
|
|
1436
|
+
});
|
|
1437
|
+
};
|
|
1438
|
+
document.addEventListener('pointermove', onMove);
|
|
1439
|
+
document.addEventListener('pointerup', onUp);
|
|
1440
|
+
}
|
|
1441
|
+
// Row click
|
|
1442
|
+
onRowClick(task, event) {
|
|
1443
|
+
this.selectedTaskId.set(task.id);
|
|
1444
|
+
this.keyboardService.focusTask(task.id);
|
|
1445
|
+
this.taskClick.emit({ task, originalEvent: event });
|
|
1446
|
+
}
|
|
1447
|
+
// Task bar click
|
|
1448
|
+
onTaskBarClick(task, event) {
|
|
1449
|
+
event.stopPropagation();
|
|
1450
|
+
this.selectedTaskId.set(task.id);
|
|
1451
|
+
this.keyboardService.focusTask(task.id);
|
|
1452
|
+
this.taskClick.emit({ task, originalEvent: event });
|
|
1453
|
+
}
|
|
1454
|
+
onTaskBarDblClick(task, event) {
|
|
1455
|
+
event.stopPropagation();
|
|
1456
|
+
this.taskDblClick.emit({ task, originalEvent: event });
|
|
1457
|
+
}
|
|
1458
|
+
onDependencyClick(dep, event) {
|
|
1459
|
+
this.dependencyClick.emit({ dependency: dep, originalEvent: event });
|
|
1460
|
+
}
|
|
1461
|
+
onToggleCollapse(taskId) {
|
|
1462
|
+
const current = new Map(this.internalCollapsed());
|
|
1463
|
+
const task = this.tasks().find(t => t.id === taskId);
|
|
1464
|
+
if (!task)
|
|
1465
|
+
return;
|
|
1466
|
+
const isCollapsed = current.has(taskId) ? current.get(taskId) : task.collapsed;
|
|
1467
|
+
current.set(taskId, !isCollapsed);
|
|
1468
|
+
this.internalCollapsed.set(current);
|
|
1469
|
+
}
|
|
1470
|
+
onKeyDown(event) {
|
|
1471
|
+
const ids = this.visibleRows().map(r => r.task.id);
|
|
1472
|
+
this.keyboardService.handleKeyDown(event, ids, {
|
|
1473
|
+
onSelect: (taskId) => {
|
|
1474
|
+
const task = this.tasks().find(t => t.id === taskId);
|
|
1475
|
+
if (task) {
|
|
1476
|
+
this.selectedTaskId.set(taskId);
|
|
1477
|
+
this.taskClick.emit({ task, originalEvent: event });
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
onEscape: () => {
|
|
1481
|
+
this.selectedTaskId.set(null);
|
|
1482
|
+
},
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
// Public API
|
|
1486
|
+
scrollToDate(date) {
|
|
1487
|
+
const cfg = this.mergedConfig();
|
|
1488
|
+
const range = this.dateRange();
|
|
1489
|
+
const x = this.scaleService.dateToX(date, range.start, cfg.columnWidth, cfg.zoomLevel);
|
|
1490
|
+
const el = this.timelineContent()?.nativeElement;
|
|
1491
|
+
if (el)
|
|
1492
|
+
el.scrollLeft = x;
|
|
1493
|
+
}
|
|
1494
|
+
scrollToTask(taskId) {
|
|
1495
|
+
const row = this.visibleRows().find(r => r.task.id === taskId);
|
|
1496
|
+
if (!row)
|
|
1497
|
+
return;
|
|
1498
|
+
const y = row.rowIndex * this.mergedConfig().rowHeight;
|
|
1499
|
+
const el = this.timelineContent()?.nativeElement;
|
|
1500
|
+
if (el)
|
|
1501
|
+
el.scrollTop = y;
|
|
1502
|
+
}
|
|
1503
|
+
expandAll() {
|
|
1504
|
+
const map = new Map();
|
|
1505
|
+
this.tasks().forEach(t => map.set(t.id, false));
|
|
1506
|
+
this.internalCollapsed.set(map);
|
|
1507
|
+
}
|
|
1508
|
+
collapseAll() {
|
|
1509
|
+
const rows = this.flatRows();
|
|
1510
|
+
const map = new Map();
|
|
1511
|
+
rows.filter(r => r.hasChildren).forEach(r => map.set(r.task.id, true));
|
|
1512
|
+
this.internalCollapsed.set(map);
|
|
1513
|
+
}
|
|
1514
|
+
// Helpers
|
|
1515
|
+
formatDateShort(date) {
|
|
1516
|
+
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
|
1517
|
+
}
|
|
1518
|
+
formatDateFull(date) {
|
|
1519
|
+
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
|
|
1520
|
+
}
|
|
1521
|
+
showTooltip(task, event) {
|
|
1522
|
+
this.tooltipTask.set(task);
|
|
1523
|
+
const OFFSET = 14;
|
|
1524
|
+
const TOOLTIP_W = 220;
|
|
1525
|
+
const TOOLTIP_H = 100;
|
|
1526
|
+
const flipCoord = (cursor, size, viewport) => cursor + OFFSET + size > viewport ? cursor - size - OFFSET : cursor + OFFSET;
|
|
1527
|
+
this.tooltipX.set(flipCoord(event.clientX, TOOLTIP_W, window.innerWidth));
|
|
1528
|
+
this.tooltipY.set(flipCoord(event.clientY, TOOLTIP_H, window.innerHeight));
|
|
1529
|
+
}
|
|
1530
|
+
hideTooltip() {
|
|
1531
|
+
this.tooltipTask.set(null);
|
|
1532
|
+
}
|
|
1533
|
+
// Multi-task row helpers
|
|
1534
|
+
getRowStart(row) {
|
|
1535
|
+
if (row.extraTasks.length === 0)
|
|
1536
|
+
return row.task.start;
|
|
1537
|
+
const times = [row.task.start, ...row.extraTasks.map(t => t.start)].map(d => d.getTime());
|
|
1538
|
+
return new Date(Math.min(...times));
|
|
1539
|
+
}
|
|
1540
|
+
getRowEnd(row) {
|
|
1541
|
+
if (row.extraTasks.length === 0)
|
|
1542
|
+
return row.task.end;
|
|
1543
|
+
const times = [row.task.end, ...row.extraTasks.map(t => t.end)].map(d => d.getTime());
|
|
1544
|
+
return new Date(Math.max(...times));
|
|
1545
|
+
}
|
|
1546
|
+
getRowAvgProgress(row) {
|
|
1547
|
+
const all = [row.task, ...row.extraTasks];
|
|
1548
|
+
return Math.round(all.reduce((sum, t) => sum + t.progress, 0) / all.length);
|
|
1549
|
+
}
|
|
1550
|
+
getRowProgressTitle(row) {
|
|
1551
|
+
const all = [row.task, ...row.extraTasks];
|
|
1552
|
+
return all.map(t => `${t.name}: ${t.progress}%`).join(', ');
|
|
1553
|
+
}
|
|
1554
|
+
getMetaEntries(meta) {
|
|
1555
|
+
if (!meta)
|
|
1556
|
+
return [];
|
|
1557
|
+
return Object.entries(meta).map(([key, value]) => ({
|
|
1558
|
+
// Convert camelCase keys like "assignee" → "Assignee", "apiURL" → "Api URL"
|
|
1559
|
+
key: key
|
|
1560
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
|
|
1561
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
1562
|
+
.replace(/^./, c => c.toUpperCase()),
|
|
1563
|
+
value: String(value),
|
|
1564
|
+
}));
|
|
1565
|
+
}
|
|
1566
|
+
showRowTooltip(row, event) {
|
|
1567
|
+
const allTasks = [row.task, ...row.extraTasks];
|
|
1568
|
+
this.rowTooltipData.set({ allTasks });
|
|
1569
|
+
this.positionRowTooltip(event);
|
|
1570
|
+
}
|
|
1571
|
+
updateRowTooltip(event) {
|
|
1572
|
+
if (this.rowTooltipData()) {
|
|
1573
|
+
this.positionRowTooltip(event);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
hideRowTooltip() {
|
|
1577
|
+
this.rowTooltipData.set(null);
|
|
1578
|
+
}
|
|
1579
|
+
positionRowTooltip(event) {
|
|
1580
|
+
const OFFSET = 14;
|
|
1581
|
+
const TOOLTIP_W = 260;
|
|
1582
|
+
const TOOLTIP_H = 120;
|
|
1583
|
+
const flipCoord = (cursor, size, viewport) => cursor + OFFSET + size > viewport ? cursor - size - OFFSET : cursor + OFFSET;
|
|
1584
|
+
this.rowTooltipX.set(flipCoord(event.clientX, TOOLTIP_W, window.innerWidth));
|
|
1585
|
+
this.rowTooltipY.set(flipCoord(event.clientY, TOOLTIP_H, window.innerHeight));
|
|
1586
|
+
}
|
|
1587
|
+
getPrimaryLabel(date, zoom, locale) {
|
|
1588
|
+
switch (zoom) {
|
|
1589
|
+
case ZoomLevel.Day:
|
|
1590
|
+
case ZoomLevel.Week:
|
|
1591
|
+
return date.toLocaleDateString(locale, { month: 'long', year: 'numeric' });
|
|
1592
|
+
case ZoomLevel.Month:
|
|
1593
|
+
return date.getFullYear().toString();
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
getSecondaryLabel(date, zoom, locale) {
|
|
1597
|
+
switch (zoom) {
|
|
1598
|
+
case ZoomLevel.Day: {
|
|
1599
|
+
const day = date.getDate();
|
|
1600
|
+
const weekday = date.toLocaleDateString(locale, { weekday: 'narrow' });
|
|
1601
|
+
return `${weekday} ${day}`;
|
|
1602
|
+
}
|
|
1603
|
+
case ZoomLevel.Week: {
|
|
1604
|
+
const oneJan = new Date(date.getFullYear(), 0, 1);
|
|
1605
|
+
const weekNum = Math.ceil(((date.getTime() - oneJan.getTime()) / 86400000 + oneJan.getDay() + 1) / 7);
|
|
1606
|
+
return `W${weekNum}`;
|
|
1607
|
+
}
|
|
1608
|
+
case ZoomLevel.Month:
|
|
1609
|
+
return date.toLocaleDateString(locale, { month: 'short' });
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
getMsPerUnit(zoom) {
|
|
1613
|
+
switch (zoom) {
|
|
1614
|
+
case ZoomLevel.Day: return 86400000;
|
|
1615
|
+
case ZoomLevel.Week: return 604800000;
|
|
1616
|
+
case ZoomLevel.Month: return 2592000000;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1620
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: GanttChartComponent, isStandalone: true, selector: "ngx-gantt-chart", inputs: { tasks: { classPropertyName: "tasks", publicName: "tasks", isSignal: true, isRequired: true, transformFunction: null }, dependencies: { classPropertyName: "dependencies", publicName: "dependencies", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { taskChange: "taskChange", taskClick: "taskClick", taskDblClick: "taskDblClick", dependencyClick: "dependencyClick", scroll: "scroll", zoomChange: "zoomChange" }, providers: [
|
|
1621
|
+
GanttScaleService,
|
|
1622
|
+
GanttLayoutService,
|
|
1623
|
+
GanttKeyboardService,
|
|
1624
|
+
], viewQueries: [{ propertyName: "timelineContent", first: true, predicate: ["timelineContent"], descendants: true, isSignal: true }, { propertyName: "treelistContent", first: true, predicate: ["treelistContent"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1625
|
+
<div class="k-gantt" [class.k-gantt-dark]="false" (keydown)="onKeyDown($event)">
|
|
1626
|
+
|
|
1627
|
+
<!-- ===== TREELIST (Left Panel) ===== -->
|
|
1628
|
+
<div class="k-gantt-treelist" [style.width.px]="mergedConfig().sidebarWidth">
|
|
1629
|
+
<!-- Treelist Header -->
|
|
1630
|
+
<div class="k-treelist-header" [style.height.px]="mergedConfig().headerHeight">
|
|
1631
|
+
<table class="k-treelist-header-table">
|
|
1632
|
+
<colgroup>
|
|
1633
|
+
<col [style.width.px]="mergedConfig().sidebarWidth - 220"/>
|
|
1634
|
+
<col style="width: 80px"/>
|
|
1635
|
+
<col style="width: 80px"/>
|
|
1636
|
+
<col style="width: 60px"/>
|
|
1637
|
+
</colgroup>
|
|
1638
|
+
<thead>
|
|
1639
|
+
<tr>
|
|
1640
|
+
<th class="k-header-cell">Task Name</th>
|
|
1641
|
+
<th class="k-header-cell">Start</th>
|
|
1642
|
+
<th class="k-header-cell">End</th>
|
|
1643
|
+
<th class="k-header-cell">%</th>
|
|
1644
|
+
</tr>
|
|
1645
|
+
</thead>
|
|
1646
|
+
</table>
|
|
1647
|
+
</div>
|
|
1648
|
+
|
|
1649
|
+
<!-- Treelist Body -->
|
|
1650
|
+
<div class="k-treelist-content" #treelistContent>
|
|
1651
|
+
<table class="k-treelist-table">
|
|
1652
|
+
<colgroup>
|
|
1653
|
+
<col [style.width.px]="mergedConfig().sidebarWidth - 220"/>
|
|
1654
|
+
<col style="width: 80px"/>
|
|
1655
|
+
<col style="width: 80px"/>
|
|
1656
|
+
<col style="width: 60px"/>
|
|
1657
|
+
</colgroup>
|
|
1658
|
+
<tbody>
|
|
1659
|
+
@for (row of visibleRows(); track row.task.id; let i = $index) {
|
|
1660
|
+
<tr
|
|
1661
|
+
class="k-treelist-row"
|
|
1662
|
+
[style.height.px]="mergedConfig().rowHeight"
|
|
1663
|
+
[class.k-alt]="i % 2 === 1"
|
|
1664
|
+
[class.k-selected]="selectedTaskId() === row.task.id"
|
|
1665
|
+
[class.k-hover]="hoveredTaskId() === row.task.id"
|
|
1666
|
+
(mouseenter)="hoveredTaskId.set(row.task.id)"
|
|
1667
|
+
(mouseleave)="hoveredTaskId.set(null)"
|
|
1668
|
+
(click)="onRowClick(row.task, $event)"
|
|
1669
|
+
>
|
|
1670
|
+
<td class="k-treelist-cell k-name-cell"
|
|
1671
|
+
(mouseenter)="row.extraTasks.length > 0 ? showRowTooltip(row, $event) : null"
|
|
1672
|
+
(mousemove)="row.extraTasks.length > 0 ? updateRowTooltip($event) : null"
|
|
1673
|
+
(mouseleave)="row.extraTasks.length > 0 ? hideRowTooltip() : null"
|
|
1674
|
+
>
|
|
1675
|
+
<span class="k-indent" [style.width.px]="row.depth * 20"></span>
|
|
1676
|
+
@if (row.hasChildren && mergedConfig().collapsible) {
|
|
1677
|
+
<button
|
|
1678
|
+
class="k-collapse-btn"
|
|
1679
|
+
(click)="onToggleCollapse(row.task.id); $event.stopPropagation()"
|
|
1680
|
+
[attr.aria-expanded]="!row.task.collapsed"
|
|
1681
|
+
>
|
|
1682
|
+
<span class="k-icon" [class.k-collapsed]="row.task.collapsed">▼</span>
|
|
1683
|
+
</button>
|
|
1684
|
+
} @else {
|
|
1685
|
+
<span class="k-collapse-spacer"></span>
|
|
1686
|
+
}
|
|
1687
|
+
@if (row.task.isMilestone) {
|
|
1688
|
+
<span class="k-milestone-icon">◆</span>
|
|
1689
|
+
}
|
|
1690
|
+
<div class="k-name-wrapper">
|
|
1691
|
+
<span class="k-task-name" [class.k-summary-name]="row.hasChildren" [title]="row.task.name">
|
|
1692
|
+
{{ row.task.name }}
|
|
1693
|
+
</span>
|
|
1694
|
+
@if (row.extraTasks.length > 0) {
|
|
1695
|
+
<div class="k-extra-tasks-chips">
|
|
1696
|
+
@for (extra of row.extraTasks; track extra.id) {
|
|
1697
|
+
<span
|
|
1698
|
+
class="k-extra-task-chip"
|
|
1699
|
+
[style.background]="extra.color || '#6c757d'"
|
|
1700
|
+
[title]="extra.name"
|
|
1701
|
+
>{{ extra.name.length > 14 ? extra.name.slice(0, 14) + '…' : extra.name }}</span>
|
|
1702
|
+
}
|
|
1703
|
+
</div>
|
|
1704
|
+
}
|
|
1705
|
+
</div>
|
|
1706
|
+
</td>
|
|
1707
|
+
<td class="k-treelist-cell k-date-cell">{{ formatDateShort(getRowStart(row)) }}</td>
|
|
1708
|
+
<td class="k-treelist-cell k-date-cell">{{ formatDateShort(getRowEnd(row)) }}</td>
|
|
1709
|
+
<td class="k-treelist-cell k-pct-cell">
|
|
1710
|
+
@if (row.extraTasks.length > 0) {
|
|
1711
|
+
<span class="k-multi-pct" [title]="getRowProgressTitle(row)">~{{ getRowAvgProgress(row) }}%</span>
|
|
1712
|
+
} @else {
|
|
1713
|
+
{{ row.task.progress }}%
|
|
1714
|
+
}
|
|
1715
|
+
</td>
|
|
1716
|
+
</tr>
|
|
1717
|
+
}
|
|
1718
|
+
</tbody>
|
|
1719
|
+
</table>
|
|
1720
|
+
</div>
|
|
1721
|
+
</div>
|
|
1722
|
+
|
|
1723
|
+
<!-- ===== SPLITBAR ===== -->
|
|
1724
|
+
<div class="k-splitbar" (pointerdown)="onSplitBarDown($event)">
|
|
1725
|
+
<span class="k-splitbar-icon">⋮</span>
|
|
1726
|
+
</div>
|
|
1727
|
+
|
|
1728
|
+
<!-- ===== TIMELINE (Right Panel) ===== -->
|
|
1729
|
+
<div class="k-gantt-timeline">
|
|
1730
|
+
<!-- Timeline Header -->
|
|
1731
|
+
<div class="k-timeline-header" [style.height.px]="mergedConfig().headerHeight">
|
|
1732
|
+
<div class="k-timeline-header-wrap" [style.width.px]="totalWidth()" [style.margin-left.px]="-(scrollLeft())">
|
|
1733
|
+
<!-- Primary header row (months/years) -->
|
|
1734
|
+
<div class="k-header-row k-header-primary">
|
|
1735
|
+
@for (group of primaryHeaderGroups(); track group.label + group.x) {
|
|
1736
|
+
<div
|
|
1737
|
+
class="k-header-group-cell"
|
|
1738
|
+
[style.left.px]="group.x"
|
|
1739
|
+
[style.width.px]="group.width"
|
|
1740
|
+
>
|
|
1741
|
+
{{ group.label }}
|
|
1742
|
+
</div>
|
|
1743
|
+
}
|
|
1744
|
+
</div>
|
|
1745
|
+
<!-- Secondary header row (days/weeks/months) -->
|
|
1746
|
+
<div class="k-header-row k-header-secondary">
|
|
1747
|
+
@for (col of headerColumns(); track col.x) {
|
|
1748
|
+
<div
|
|
1749
|
+
class="k-header-tick-cell"
|
|
1750
|
+
[style.left.px]="col.x"
|
|
1751
|
+
[style.width.px]="col.width"
|
|
1752
|
+
[class.k-weekend]="col.isWeekend"
|
|
1753
|
+
[class.k-today-header]="col.isToday"
|
|
1754
|
+
>
|
|
1755
|
+
{{ col.label }}
|
|
1756
|
+
</div>
|
|
1757
|
+
}
|
|
1758
|
+
</div>
|
|
1759
|
+
</div>
|
|
1760
|
+
</div>
|
|
1761
|
+
|
|
1762
|
+
<!-- Timeline Content (Scrollable) -->
|
|
1763
|
+
<div class="k-timeline-content" #timelineContent (scroll)="onTimelineScroll()">
|
|
1764
|
+
<div class="k-timeline-canvas" [style.width.px]="totalWidth()" [style.height.px]="totalHeight()">
|
|
1765
|
+
|
|
1766
|
+
<!-- Background rows (alternating + hover) -->
|
|
1767
|
+
<div class="k-gantt-rows">
|
|
1768
|
+
@for (row of visibleRows(); track row.task.id; let i = $index) {
|
|
1769
|
+
<div
|
|
1770
|
+
class="k-gantt-row"
|
|
1771
|
+
[style.top.px]="i * mergedConfig().rowHeight"
|
|
1772
|
+
[style.height.px]="mergedConfig().rowHeight"
|
|
1773
|
+
[class.k-alt]="i % 2 === 1"
|
|
1774
|
+
[class.k-hover]="hoveredTaskId() === row.task.id"
|
|
1775
|
+
[class.k-selected]="selectedTaskId() === row.task.id"
|
|
1776
|
+
(mouseenter)="hoveredTaskId.set(row.task.id)"
|
|
1777
|
+
(mouseleave)="hoveredTaskId.set(null)"
|
|
1778
|
+
>
|
|
1779
|
+
</div>
|
|
1780
|
+
}
|
|
1781
|
+
</div>
|
|
1782
|
+
|
|
1783
|
+
<!-- Vertical column lines -->
|
|
1784
|
+
<div class="k-gantt-columns">
|
|
1785
|
+
@for (col of headerColumns(); track col.x) {
|
|
1786
|
+
<div
|
|
1787
|
+
class="k-gantt-column"
|
|
1788
|
+
[style.left.px]="col.x"
|
|
1789
|
+
[style.width.px]="col.width"
|
|
1790
|
+
[style.height.px]="totalHeight()"
|
|
1791
|
+
[class.k-weekend-col]="col.isWeekend"
|
|
1792
|
+
>
|
|
1793
|
+
</div>
|
|
1794
|
+
}
|
|
1795
|
+
</div>
|
|
1796
|
+
|
|
1797
|
+
<!-- Today marker -->
|
|
1798
|
+
@if (mergedConfig().showTodayMarker && todayX() !== null) {
|
|
1799
|
+
<div
|
|
1800
|
+
class="k-today-marker"
|
|
1801
|
+
[style.left.px]="todayX()"
|
|
1802
|
+
[style.height.px]="totalHeight()"
|
|
1803
|
+
>
|
|
1804
|
+
<div class="k-today-indicator"></div>
|
|
1805
|
+
</div>
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
<!-- Task bars layer -->
|
|
1809
|
+
<div class="k-gantt-tasks">
|
|
1810
|
+
@for (bar of taskBars(); track bar.task.id) {
|
|
1811
|
+
<div
|
|
1812
|
+
class="k-task-wrap"
|
|
1813
|
+
[style.top.px]="bar.top"
|
|
1814
|
+
[style.height.px]="mergedConfig().rowHeight"
|
|
1815
|
+
>
|
|
1816
|
+
@if (bar.task.isMilestone) {
|
|
1817
|
+
<!-- Milestone diamond -->
|
|
1818
|
+
<div
|
|
1819
|
+
class="k-milestone"
|
|
1820
|
+
[style.left.px]="bar.left - 8"
|
|
1821
|
+
[class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
|
|
1822
|
+
[class.k-selected]="selectedTaskId() === bar.task.id"
|
|
1823
|
+
(mouseenter)="hoveredTaskId.set(bar.primaryTaskId); showTooltip(bar.task, $event)"
|
|
1824
|
+
(mouseleave)="hoveredTaskId.set(null); hideTooltip()"
|
|
1825
|
+
(click)="onTaskBarClick(bar.task, $event)"
|
|
1826
|
+
(dblclick)="onTaskBarDblClick(bar.task, $event)"
|
|
1827
|
+
tabindex="0"
|
|
1828
|
+
[attr.aria-label]="'Milestone: ' + bar.task.name"
|
|
1829
|
+
>
|
|
1830
|
+
<div class="k-milestone-diamond" [style.background]="bar.task.color || null"></div>
|
|
1831
|
+
</div>
|
|
1832
|
+
} @else if (bar.isSummary) {
|
|
1833
|
+
<!-- Summary bar (parent task) -->
|
|
1834
|
+
<div
|
|
1835
|
+
class="k-task-summary"
|
|
1836
|
+
[style.left.px]="bar.left"
|
|
1837
|
+
[style.width.px]="bar.width"
|
|
1838
|
+
[class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
|
|
1839
|
+
[class.k-selected]="selectedTaskId() === bar.task.id"
|
|
1840
|
+
(mouseenter)="hoveredTaskId.set(bar.primaryTaskId); showTooltip(bar.task, $event)"
|
|
1841
|
+
(mouseleave)="hoveredTaskId.set(null); hideTooltip()"
|
|
1842
|
+
(click)="onTaskBarClick(bar.task, $event)"
|
|
1843
|
+
(dblclick)="onTaskBarDblClick(bar.task, $event)"
|
|
1844
|
+
tabindex="0"
|
|
1845
|
+
[attr.aria-label]="bar.task.name + ' - ' + bar.task.progress + '% complete'"
|
|
1846
|
+
>
|
|
1847
|
+
<div class="k-summary-bar">
|
|
1848
|
+
<div class="k-summary-progress" [style.width.%]="bar.task.progress"></div>
|
|
1849
|
+
</div>
|
|
1850
|
+
<div class="k-summary-left-cap"></div>
|
|
1851
|
+
<div class="k-summary-right-cap"></div>
|
|
1852
|
+
</div>
|
|
1853
|
+
} @else {
|
|
1854
|
+
<!-- Regular task bar -->
|
|
1855
|
+
<div
|
|
1856
|
+
class="k-task"
|
|
1857
|
+
[style.left.px]="bar.left"
|
|
1858
|
+
[style.width.px]="bar.width"
|
|
1859
|
+
[style.background]="bar.task.color || null"
|
|
1860
|
+
[class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
|
|
1861
|
+
[class.k-selected]="selectedTaskId() === bar.task.id"
|
|
1862
|
+
(mouseenter)="hoveredTaskId.set(bar.primaryTaskId); showTooltip(bar.task, $event)"
|
|
1863
|
+
(mouseleave)="hoveredTaskId.set(null); hideTooltip()"
|
|
1864
|
+
(pointerdown)="onBarPointerDown($event, bar.task, 'move')"
|
|
1865
|
+
(click)="onTaskBarClick(bar.task, $event)"
|
|
1866
|
+
(dblclick)="onTaskBarDblClick(bar.task, $event)"
|
|
1867
|
+
tabindex="0"
|
|
1868
|
+
role="img"
|
|
1869
|
+
[attr.aria-label]="bar.task.name + ' - ' + bar.task.progress + '% complete'"
|
|
1870
|
+
>
|
|
1871
|
+
<!-- Progress fill -->
|
|
1872
|
+
<div class="k-task-progress" [style.width.%]="bar.task.progress">
|
|
1873
|
+
<div class="k-task-progress-inner"></div>
|
|
1874
|
+
</div>
|
|
1875
|
+
<!-- Task text -->
|
|
1876
|
+
<span class="k-task-text">{{ bar.task.name }}</span>
|
|
1877
|
+
<!-- Resize handles -->
|
|
1878
|
+
@if (bar.task.draggable !== false) {
|
|
1879
|
+
<div class="k-resize-handle k-resize-w" (pointerdown)="onBarPointerDown($event, bar.task, 'resize-left')"></div>
|
|
1880
|
+
<div class="k-resize-handle k-resize-e" (pointerdown)="onBarPointerDown($event, bar.task, 'resize-right')"></div>
|
|
1881
|
+
}
|
|
1882
|
+
</div>
|
|
1883
|
+
}
|
|
1884
|
+
</div>
|
|
1885
|
+
}
|
|
1886
|
+
</div>
|
|
1887
|
+
|
|
1888
|
+
<!-- Dependency arrows (SVG overlay) -->
|
|
1889
|
+
<svg class="k-gantt-dependencies" [attr.width]="totalWidth()" [attr.height]="totalHeight()">
|
|
1890
|
+
<defs>
|
|
1891
|
+
<marker id="k-arrowhead" markerWidth="10" markerHeight="7" refX="10" refY="3.5" orient="auto">
|
|
1892
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="var(--ngx-gantt-arrow-color, #ff6358)"/>
|
|
1893
|
+
</marker>
|
|
1894
|
+
</defs>
|
|
1895
|
+
@for (dep of dependencyPaths(); track dep.key) {
|
|
1896
|
+
<path
|
|
1897
|
+
class="k-dep-line"
|
|
1898
|
+
[attr.d]="dep.path"
|
|
1899
|
+
[attr.stroke]="dep.dependency.color || null"
|
|
1900
|
+
marker-end="url(#k-arrowhead)"
|
|
1901
|
+
(click)="onDependencyClick(dep.dependency, $event)"
|
|
1902
|
+
/>
|
|
1903
|
+
}
|
|
1904
|
+
</svg>
|
|
1905
|
+
|
|
1906
|
+
</div>
|
|
1907
|
+
</div>
|
|
1908
|
+
</div>
|
|
1909
|
+
</div>
|
|
1910
|
+
|
|
1911
|
+
<!-- ===== TASK TOOLTIP ===== -->
|
|
1912
|
+
@if (tooltipTask()) {
|
|
1913
|
+
<div
|
|
1914
|
+
class="k-bar-tooltip"
|
|
1915
|
+
[style.left.px]="tooltipX()"
|
|
1916
|
+
[style.top.px]="tooltipY()"
|
|
1917
|
+
>
|
|
1918
|
+
<div class="k-bar-tooltip-title">{{ tooltipTask()!.name }}</div>
|
|
1919
|
+
<div class="k-bar-tooltip-row">
|
|
1920
|
+
<span class="k-bar-tooltip-label">Start</span>
|
|
1921
|
+
<span class="k-bar-tooltip-value">{{ formatDateFull(tooltipTask()!.start) }}</span>
|
|
1922
|
+
</div>
|
|
1923
|
+
<div class="k-bar-tooltip-row">
|
|
1924
|
+
<span class="k-bar-tooltip-label">End</span>
|
|
1925
|
+
<span class="k-bar-tooltip-value">{{ formatDateFull(tooltipTask()!.end) }}</span>
|
|
1926
|
+
</div>
|
|
1927
|
+
<div class="k-bar-tooltip-row">
|
|
1928
|
+
<span class="k-bar-tooltip-label">Progress</span>
|
|
1929
|
+
<span class="k-bar-tooltip-value">{{ tooltipTask()!.progress }}%</span>
|
|
1930
|
+
</div>
|
|
1931
|
+
@for (entry of getMetaEntries(tooltipTask()!.meta); track entry.key) {
|
|
1932
|
+
<div class="k-bar-tooltip-row">
|
|
1933
|
+
<span class="k-bar-tooltip-label">{{ entry.key }}</span>
|
|
1934
|
+
<span class="k-bar-tooltip-value">{{ entry.value }}</span>
|
|
1935
|
+
</div>
|
|
1936
|
+
}
|
|
1937
|
+
</div>
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
<!-- ===== ROW TOOLTIP (multi-task rows) ===== -->
|
|
1941
|
+
@if (rowTooltipData()) {
|
|
1942
|
+
<div
|
|
1943
|
+
class="k-bar-tooltip k-row-tooltip"
|
|
1944
|
+
[style.left.px]="rowTooltipX()"
|
|
1945
|
+
[style.top.px]="rowTooltipY()"
|
|
1946
|
+
>
|
|
1947
|
+
<div class="k-bar-tooltip-title">Tasks in this row</div>
|
|
1948
|
+
@for (t of rowTooltipData()!.allTasks; track t.id) {
|
|
1949
|
+
<div class="k-row-tooltip-task">
|
|
1950
|
+
<span class="k-row-tooltip-dot" [style.background]="t.color || '#4a90d9'"></span>
|
|
1951
|
+
<span class="k-row-tooltip-name">{{ t.name }}</span>
|
|
1952
|
+
<span class="k-bar-tooltip-label">{{ formatDateShort(t.start) }}–{{ formatDateShort(t.end) }}</span>
|
|
1953
|
+
<span class="k-bar-tooltip-value">{{ t.progress }}%</span>
|
|
1954
|
+
</div>
|
|
1955
|
+
}
|
|
1956
|
+
</div>
|
|
1957
|
+
}
|
|
1958
|
+
`, isInline: true, styles: [":host{display:block}.k-gantt{display:flex;height:100%;width:100%;background:var(--ngx-gantt-bg, #ffffff);border:1px solid var(--ngx-gantt-border, #dee2e6);border-radius:4px;font-family:var(--ngx-gantt-font, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif);font-size:var(--ngx-gantt-font-size, 13px);color:var(--ngx-gantt-text, #212529);overflow:hidden;position:relative}.k-gantt-treelist{display:flex;flex-direction:column;flex-shrink:0;border-right:1px solid var(--ngx-gantt-border, #dee2e6);overflow:hidden;background:var(--ngx-gantt-bg, #ffffff)}.k-treelist-header{flex-shrink:0;background:var(--ngx-gantt-header-bg, #f1f3f5);border-bottom:1px solid var(--ngx-gantt-border, #dee2e6);overflow:hidden;display:flex;align-items:flex-end}.k-treelist-header-table,.k-treelist-table{width:100%;border-collapse:collapse;table-layout:fixed}.k-header-cell{padding:8px;text-align:left;font-size:var(--ngx-gantt-header-font-size, 12px);font-weight:600;color:var(--ngx-gantt-header-text, #495057);border-right:1px solid var(--ngx-gantt-border, #dee2e6);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.k-header-cell:last-child{border-right:none;text-align:center}.k-treelist-content{flex:1;overflow-y:auto;overflow-x:hidden}.k-treelist-row{cursor:default;border-bottom:1px solid var(--ngx-gantt-grid-line, #ebedf0)}.k-treelist-row.k-alt{background:var(--ngx-gantt-alt-bg, #f8f9fa)}.k-treelist-row.k-hover{background:var(--ngx-gantt-hover-bg, #e8f0fe)!important}.k-treelist-row.k-selected{background:var(--ngx-gantt-selected-bg, #d0e1f9)!important}.k-treelist-cell{padding:0 8px;height:100%;vertical-align:middle;border-right:1px solid var(--ngx-gantt-grid-line, #ebedf0);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.k-treelist-cell:last-child{border-right:none}.k-name-cell{display:flex;align-items:center;gap:0}.k-indent{display:inline-block;flex-shrink:0}.k-name-wrapper{display:flex;flex-direction:column;min-width:0;justify-content:center;gap:2px;overflow:hidden}.k-extra-tasks-chips{display:flex;flex-wrap:wrap;gap:3px}.k-extra-task-chip{display:inline-flex;align-items:center;padding:0 5px;height:14px;border-radius:7px;font-size:10px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:110px;opacity:.9;font-weight:500;letter-spacing:.01em}.k-multi-pct{cursor:help}.k-collapse-btn{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;background:none;border:none;cursor:pointer;padding:0;color:var(--ngx-gantt-text-secondary, #6c757d);border-radius:3px}.k-collapse-btn:hover{background:var(--ngx-gantt-border, #dee2e6)}.k-icon{font-size:8px;transition:transform .15s ease;display:inline-block}.k-icon.k-collapsed{transform:rotate(-90deg)}.k-collapse-spacer{display:inline-block;width:20px;flex-shrink:0}.k-milestone-icon{color:var(--ngx-gantt-milestone-color, #e74c3c);margin-right:4px;font-size:10px;flex-shrink:0}.k-task-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.k-summary-name{font-weight:600}.k-date-cell{font-size:11px;color:var(--ngx-gantt-text-secondary, #6c757d);text-align:center}.k-pct-cell{font-size:11px;text-align:center;font-weight:500}.k-splitbar{width:7px;flex-shrink:0;background:var(--ngx-gantt-header-bg, #f1f3f5);border-left:1px solid var(--ngx-gantt-border, #dee2e6);border-right:1px solid var(--ngx-gantt-border, #dee2e6);cursor:col-resize;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;z-index:2}.k-splitbar:hover{background:var(--ngx-gantt-border, #dee2e6)}.k-splitbar-icon{color:var(--ngx-gantt-text-secondary, #6c757d);font-size:14px;line-height:1}.k-gantt-timeline{flex:1;min-width:0;display:flex;flex-direction:column;overflow:hidden}.k-timeline-header{flex-shrink:0;overflow:hidden;background:var(--ngx-gantt-header-bg, #f1f3f5);border-bottom:1px solid var(--ngx-gantt-border, #dee2e6)}.k-timeline-header-wrap{position:relative;display:flex;flex-direction:column;height:100%}.k-header-row{position:relative;flex:1}.k-header-primary{border-bottom:1px solid var(--ngx-gantt-border, #dee2e6)}.k-header-group-cell{position:absolute;top:0;height:100%;display:flex;align-items:center;justify-content:center;font-size:var(--ngx-gantt-header-font-size, 12px);font-weight:600;color:var(--ngx-gantt-header-text, #495057);border-right:1px solid var(--ngx-gantt-border, #dee2e6);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 4px;box-sizing:border-box}.k-header-tick-cell{position:absolute;top:0;height:100%;display:flex;align-items:center;justify-content:center;font-size:11px;color:var(--ngx-gantt-text-secondary, #6c757d);border-right:1px solid var(--ngx-gantt-grid-line, #ebedf0);white-space:nowrap;box-sizing:border-box}.k-header-tick-cell.k-weekend{background:var(--ngx-gantt-weekend-bg, rgba(0,0,0,.02));color:#adb5bd}.k-header-tick-cell.k-today-header{color:var(--ngx-gantt-today-color, #ff6358);font-weight:700}.k-timeline-content{flex:1;overflow:auto}.k-timeline-canvas{position:relative}.k-gantt-rows{position:absolute;top:0;left:0;right:0}.k-gantt-row{position:absolute;left:0;right:0;border-bottom:1px solid var(--ngx-gantt-grid-line, #ebedf0)}.k-gantt-row.k-alt{background:var(--ngx-gantt-alt-bg, #f8f9fa)}.k-gantt-row.k-hover{background:var(--ngx-gantt-hover-bg, #e8f0fe)!important}.k-gantt-row.k-selected{background:var(--ngx-gantt-selected-bg, #d0e1f9)!important}.k-gantt-columns{position:absolute;top:0;left:0}.k-gantt-column{position:absolute;top:0;border-right:1px solid var(--ngx-gantt-grid-line, #ebedf0);box-sizing:border-box}.k-gantt-column.k-weekend-col{background:var(--ngx-gantt-weekend-bg, rgba(0,0,0,.02))}.k-today-marker{position:absolute;top:0;width:2px;background:var(--ngx-gantt-today-color, #ff6358);z-index:3;pointer-events:none}.k-today-indicator{position:absolute;top:-1px;left:-5px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid var(--ngx-gantt-today-color, #ff6358)}.k-gantt-tasks{position:absolute;top:0;left:0;z-index:2}.k-task-wrap{position:absolute;left:0;right:0;display:flex;align-items:center;pointer-events:none}.k-task{position:absolute;height:var(--ngx-gantt-bar-height, 24px);background:var(--ngx-gantt-bar-bg, #4a90d9);border-radius:4px;cursor:grab;pointer-events:all;display:flex;align-items:center;overflow:hidden;box-shadow:0 1px 3px #0000001f,0 1px 2px #0000000f;transition:box-shadow .15s ease;-webkit-user-select:none;user-select:none}.k-task:hover{box-shadow:0 3px 8px #0000002e,0 1px 3px #0000001a}.k-task:active{cursor:grabbing}.k-task.k-focused{outline:2px solid var(--ngx-gantt-focus-ring, #4a90d9);outline-offset:2px}.k-task.k-selected{outline:2px solid var(--ngx-gantt-focus-ring, #4a90d9);outline-offset:1px}.k-task-progress{position:absolute;top:0;left:0;height:100%;overflow:hidden;border-radius:4px 0 0 4px}.k-task-progress-inner{width:10000px;height:100%;background:var(--ngx-gantt-bar-progress-bg, #2d6cb4)}.k-task-text{position:relative;z-index:1;padding:0 8px;color:var(--ngx-gantt-bar-text, #ffffff);font-size:12px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 1px 1px rgba(0,0,0,.15)}.k-resize-handle{position:absolute;top:0;width:6px;height:100%;cursor:col-resize;pointer-events:all;z-index:2}.k-resize-w{left:0}.k-resize-e{right:0}.k-resize-handle:hover{background:#ffffff40}.k-task-summary{position:absolute;height:10px;pointer-events:all;cursor:pointer;display:flex;align-items:flex-end}.k-task-summary.k-focused,.k-task-summary.k-selected{outline:2px solid var(--ngx-gantt-focus-ring, #4a90d9);outline-offset:3px;border-radius:2px}.k-summary-bar{position:relative;width:100%;height:6px;background:var(--ngx-gantt-summary-color, #495057);border-radius:0}.k-summary-progress{height:100%;background:#343a40}.k-summary-left-cap,.k-summary-right-cap{position:absolute;bottom:0;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:6px solid var(--ngx-gantt-summary-color, #495057)}.k-summary-left-cap{left:-1px}.k-summary-right-cap{right:-1px}.k-milestone{position:absolute;pointer-events:all;cursor:pointer}.k-milestone.k-focused,.k-milestone.k-selected{outline:2px solid var(--ngx-gantt-focus-ring, #4a90d9);outline-offset:4px;border-radius:2px}.k-milestone-diamond{width:16px;height:16px;background:var(--ngx-gantt-milestone-color, #e74c3c);transform:rotate(45deg);border-radius:2px;box-shadow:0 1px 3px #00000026}.k-gantt-dependencies{position:absolute;top:0;left:0;z-index:1;pointer-events:none}.k-dep-line{fill:none;stroke:var(--ngx-gantt-arrow-color, #ff6358);stroke-width:1.5;pointer-events:stroke;cursor:pointer}.k-dep-line:hover{stroke-width:3}@keyframes k-tooltip-fadein{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.k-bar-tooltip{position:fixed;z-index:9999;background:var(--ngx-gantt-tooltip-bg, #2d3748);color:var(--ngx-gantt-tooltip-text, #ffffff);border-radius:6px;padding:10px 14px;min-width:180px;box-shadow:0 4px 16px #00000038;pointer-events:none;font-size:12px;line-height:1.5;animation:k-tooltip-fadein .15s ease}.k-bar-tooltip-title{font-weight:700;font-size:13px;margin-bottom:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}.k-bar-tooltip-row{display:flex;justify-content:space-between;gap:12px;margin-top:3px}.k-bar-tooltip-label{color:var(--ngx-gantt-tooltip-label, rgba(255,255,255,.65));white-space:nowrap}.k-bar-tooltip-value{font-weight:500;white-space:nowrap}.k-row-tooltip{min-width:240px}.k-row-tooltip-task{display:flex;align-items:center;gap:6px;margin-top:5px;padding-top:5px;border-top:1px solid rgba(255,255,255,.12)}.k-row-tooltip-task:first-of-type{border-top:none}.k-row-tooltip-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.k-row-tooltip-name{flex:1;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1959
|
+
}
|
|
1960
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttChartComponent, decorators: [{
|
|
1961
|
+
type: Component,
|
|
1962
|
+
args: [{ selector: 'ngx-gantt-chart', standalone: true, imports: [], providers: [
|
|
1963
|
+
GanttScaleService,
|
|
1964
|
+
GanttLayoutService,
|
|
1965
|
+
GanttKeyboardService,
|
|
1966
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
1967
|
+
<div class="k-gantt" [class.k-gantt-dark]="false" (keydown)="onKeyDown($event)">
|
|
1968
|
+
|
|
1969
|
+
<!-- ===== TREELIST (Left Panel) ===== -->
|
|
1970
|
+
<div class="k-gantt-treelist" [style.width.px]="mergedConfig().sidebarWidth">
|
|
1971
|
+
<!-- Treelist Header -->
|
|
1972
|
+
<div class="k-treelist-header" [style.height.px]="mergedConfig().headerHeight">
|
|
1973
|
+
<table class="k-treelist-header-table">
|
|
1974
|
+
<colgroup>
|
|
1975
|
+
<col [style.width.px]="mergedConfig().sidebarWidth - 220"/>
|
|
1976
|
+
<col style="width: 80px"/>
|
|
1977
|
+
<col style="width: 80px"/>
|
|
1978
|
+
<col style="width: 60px"/>
|
|
1979
|
+
</colgroup>
|
|
1980
|
+
<thead>
|
|
1981
|
+
<tr>
|
|
1982
|
+
<th class="k-header-cell">Task Name</th>
|
|
1983
|
+
<th class="k-header-cell">Start</th>
|
|
1984
|
+
<th class="k-header-cell">End</th>
|
|
1985
|
+
<th class="k-header-cell">%</th>
|
|
1986
|
+
</tr>
|
|
1987
|
+
</thead>
|
|
1988
|
+
</table>
|
|
1989
|
+
</div>
|
|
1990
|
+
|
|
1991
|
+
<!-- Treelist Body -->
|
|
1992
|
+
<div class="k-treelist-content" #treelistContent>
|
|
1993
|
+
<table class="k-treelist-table">
|
|
1994
|
+
<colgroup>
|
|
1995
|
+
<col [style.width.px]="mergedConfig().sidebarWidth - 220"/>
|
|
1996
|
+
<col style="width: 80px"/>
|
|
1997
|
+
<col style="width: 80px"/>
|
|
1998
|
+
<col style="width: 60px"/>
|
|
1999
|
+
</colgroup>
|
|
2000
|
+
<tbody>
|
|
2001
|
+
@for (row of visibleRows(); track row.task.id; let i = $index) {
|
|
2002
|
+
<tr
|
|
2003
|
+
class="k-treelist-row"
|
|
2004
|
+
[style.height.px]="mergedConfig().rowHeight"
|
|
2005
|
+
[class.k-alt]="i % 2 === 1"
|
|
2006
|
+
[class.k-selected]="selectedTaskId() === row.task.id"
|
|
2007
|
+
[class.k-hover]="hoveredTaskId() === row.task.id"
|
|
2008
|
+
(mouseenter)="hoveredTaskId.set(row.task.id)"
|
|
2009
|
+
(mouseleave)="hoveredTaskId.set(null)"
|
|
2010
|
+
(click)="onRowClick(row.task, $event)"
|
|
2011
|
+
>
|
|
2012
|
+
<td class="k-treelist-cell k-name-cell"
|
|
2013
|
+
(mouseenter)="row.extraTasks.length > 0 ? showRowTooltip(row, $event) : null"
|
|
2014
|
+
(mousemove)="row.extraTasks.length > 0 ? updateRowTooltip($event) : null"
|
|
2015
|
+
(mouseleave)="row.extraTasks.length > 0 ? hideRowTooltip() : null"
|
|
2016
|
+
>
|
|
2017
|
+
<span class="k-indent" [style.width.px]="row.depth * 20"></span>
|
|
2018
|
+
@if (row.hasChildren && mergedConfig().collapsible) {
|
|
2019
|
+
<button
|
|
2020
|
+
class="k-collapse-btn"
|
|
2021
|
+
(click)="onToggleCollapse(row.task.id); $event.stopPropagation()"
|
|
2022
|
+
[attr.aria-expanded]="!row.task.collapsed"
|
|
2023
|
+
>
|
|
2024
|
+
<span class="k-icon" [class.k-collapsed]="row.task.collapsed">▼</span>
|
|
2025
|
+
</button>
|
|
2026
|
+
} @else {
|
|
2027
|
+
<span class="k-collapse-spacer"></span>
|
|
2028
|
+
}
|
|
2029
|
+
@if (row.task.isMilestone) {
|
|
2030
|
+
<span class="k-milestone-icon">◆</span>
|
|
2031
|
+
}
|
|
2032
|
+
<div class="k-name-wrapper">
|
|
2033
|
+
<span class="k-task-name" [class.k-summary-name]="row.hasChildren" [title]="row.task.name">
|
|
2034
|
+
{{ row.task.name }}
|
|
2035
|
+
</span>
|
|
2036
|
+
@if (row.extraTasks.length > 0) {
|
|
2037
|
+
<div class="k-extra-tasks-chips">
|
|
2038
|
+
@for (extra of row.extraTasks; track extra.id) {
|
|
2039
|
+
<span
|
|
2040
|
+
class="k-extra-task-chip"
|
|
2041
|
+
[style.background]="extra.color || '#6c757d'"
|
|
2042
|
+
[title]="extra.name"
|
|
2043
|
+
>{{ extra.name.length > 14 ? extra.name.slice(0, 14) + '…' : extra.name }}</span>
|
|
2044
|
+
}
|
|
2045
|
+
</div>
|
|
2046
|
+
}
|
|
2047
|
+
</div>
|
|
2048
|
+
</td>
|
|
2049
|
+
<td class="k-treelist-cell k-date-cell">{{ formatDateShort(getRowStart(row)) }}</td>
|
|
2050
|
+
<td class="k-treelist-cell k-date-cell">{{ formatDateShort(getRowEnd(row)) }}</td>
|
|
2051
|
+
<td class="k-treelist-cell k-pct-cell">
|
|
2052
|
+
@if (row.extraTasks.length > 0) {
|
|
2053
|
+
<span class="k-multi-pct" [title]="getRowProgressTitle(row)">~{{ getRowAvgProgress(row) }}%</span>
|
|
2054
|
+
} @else {
|
|
2055
|
+
{{ row.task.progress }}%
|
|
2056
|
+
}
|
|
2057
|
+
</td>
|
|
2058
|
+
</tr>
|
|
2059
|
+
}
|
|
2060
|
+
</tbody>
|
|
2061
|
+
</table>
|
|
2062
|
+
</div>
|
|
2063
|
+
</div>
|
|
2064
|
+
|
|
2065
|
+
<!-- ===== SPLITBAR ===== -->
|
|
2066
|
+
<div class="k-splitbar" (pointerdown)="onSplitBarDown($event)">
|
|
2067
|
+
<span class="k-splitbar-icon">⋮</span>
|
|
2068
|
+
</div>
|
|
2069
|
+
|
|
2070
|
+
<!-- ===== TIMELINE (Right Panel) ===== -->
|
|
2071
|
+
<div class="k-gantt-timeline">
|
|
2072
|
+
<!-- Timeline Header -->
|
|
2073
|
+
<div class="k-timeline-header" [style.height.px]="mergedConfig().headerHeight">
|
|
2074
|
+
<div class="k-timeline-header-wrap" [style.width.px]="totalWidth()" [style.margin-left.px]="-(scrollLeft())">
|
|
2075
|
+
<!-- Primary header row (months/years) -->
|
|
2076
|
+
<div class="k-header-row k-header-primary">
|
|
2077
|
+
@for (group of primaryHeaderGroups(); track group.label + group.x) {
|
|
2078
|
+
<div
|
|
2079
|
+
class="k-header-group-cell"
|
|
2080
|
+
[style.left.px]="group.x"
|
|
2081
|
+
[style.width.px]="group.width"
|
|
2082
|
+
>
|
|
2083
|
+
{{ group.label }}
|
|
2084
|
+
</div>
|
|
2085
|
+
}
|
|
2086
|
+
</div>
|
|
2087
|
+
<!-- Secondary header row (days/weeks/months) -->
|
|
2088
|
+
<div class="k-header-row k-header-secondary">
|
|
2089
|
+
@for (col of headerColumns(); track col.x) {
|
|
2090
|
+
<div
|
|
2091
|
+
class="k-header-tick-cell"
|
|
2092
|
+
[style.left.px]="col.x"
|
|
2093
|
+
[style.width.px]="col.width"
|
|
2094
|
+
[class.k-weekend]="col.isWeekend"
|
|
2095
|
+
[class.k-today-header]="col.isToday"
|
|
2096
|
+
>
|
|
2097
|
+
{{ col.label }}
|
|
2098
|
+
</div>
|
|
2099
|
+
}
|
|
2100
|
+
</div>
|
|
2101
|
+
</div>
|
|
2102
|
+
</div>
|
|
2103
|
+
|
|
2104
|
+
<!-- Timeline Content (Scrollable) -->
|
|
2105
|
+
<div class="k-timeline-content" #timelineContent (scroll)="onTimelineScroll()">
|
|
2106
|
+
<div class="k-timeline-canvas" [style.width.px]="totalWidth()" [style.height.px]="totalHeight()">
|
|
2107
|
+
|
|
2108
|
+
<!-- Background rows (alternating + hover) -->
|
|
2109
|
+
<div class="k-gantt-rows">
|
|
2110
|
+
@for (row of visibleRows(); track row.task.id; let i = $index) {
|
|
2111
|
+
<div
|
|
2112
|
+
class="k-gantt-row"
|
|
2113
|
+
[style.top.px]="i * mergedConfig().rowHeight"
|
|
2114
|
+
[style.height.px]="mergedConfig().rowHeight"
|
|
2115
|
+
[class.k-alt]="i % 2 === 1"
|
|
2116
|
+
[class.k-hover]="hoveredTaskId() === row.task.id"
|
|
2117
|
+
[class.k-selected]="selectedTaskId() === row.task.id"
|
|
2118
|
+
(mouseenter)="hoveredTaskId.set(row.task.id)"
|
|
2119
|
+
(mouseleave)="hoveredTaskId.set(null)"
|
|
2120
|
+
>
|
|
2121
|
+
</div>
|
|
2122
|
+
}
|
|
2123
|
+
</div>
|
|
2124
|
+
|
|
2125
|
+
<!-- Vertical column lines -->
|
|
2126
|
+
<div class="k-gantt-columns">
|
|
2127
|
+
@for (col of headerColumns(); track col.x) {
|
|
2128
|
+
<div
|
|
2129
|
+
class="k-gantt-column"
|
|
2130
|
+
[style.left.px]="col.x"
|
|
2131
|
+
[style.width.px]="col.width"
|
|
2132
|
+
[style.height.px]="totalHeight()"
|
|
2133
|
+
[class.k-weekend-col]="col.isWeekend"
|
|
2134
|
+
>
|
|
2135
|
+
</div>
|
|
2136
|
+
}
|
|
2137
|
+
</div>
|
|
2138
|
+
|
|
2139
|
+
<!-- Today marker -->
|
|
2140
|
+
@if (mergedConfig().showTodayMarker && todayX() !== null) {
|
|
2141
|
+
<div
|
|
2142
|
+
class="k-today-marker"
|
|
2143
|
+
[style.left.px]="todayX()"
|
|
2144
|
+
[style.height.px]="totalHeight()"
|
|
2145
|
+
>
|
|
2146
|
+
<div class="k-today-indicator"></div>
|
|
2147
|
+
</div>
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
<!-- Task bars layer -->
|
|
2151
|
+
<div class="k-gantt-tasks">
|
|
2152
|
+
@for (bar of taskBars(); track bar.task.id) {
|
|
2153
|
+
<div
|
|
2154
|
+
class="k-task-wrap"
|
|
2155
|
+
[style.top.px]="bar.top"
|
|
2156
|
+
[style.height.px]="mergedConfig().rowHeight"
|
|
2157
|
+
>
|
|
2158
|
+
@if (bar.task.isMilestone) {
|
|
2159
|
+
<!-- Milestone diamond -->
|
|
2160
|
+
<div
|
|
2161
|
+
class="k-milestone"
|
|
2162
|
+
[style.left.px]="bar.left - 8"
|
|
2163
|
+
[class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
|
|
2164
|
+
[class.k-selected]="selectedTaskId() === bar.task.id"
|
|
2165
|
+
(mouseenter)="hoveredTaskId.set(bar.primaryTaskId); showTooltip(bar.task, $event)"
|
|
2166
|
+
(mouseleave)="hoveredTaskId.set(null); hideTooltip()"
|
|
2167
|
+
(click)="onTaskBarClick(bar.task, $event)"
|
|
2168
|
+
(dblclick)="onTaskBarDblClick(bar.task, $event)"
|
|
2169
|
+
tabindex="0"
|
|
2170
|
+
[attr.aria-label]="'Milestone: ' + bar.task.name"
|
|
2171
|
+
>
|
|
2172
|
+
<div class="k-milestone-diamond" [style.background]="bar.task.color || null"></div>
|
|
2173
|
+
</div>
|
|
2174
|
+
} @else if (bar.isSummary) {
|
|
2175
|
+
<!-- Summary bar (parent task) -->
|
|
2176
|
+
<div
|
|
2177
|
+
class="k-task-summary"
|
|
2178
|
+
[style.left.px]="bar.left"
|
|
2179
|
+
[style.width.px]="bar.width"
|
|
2180
|
+
[class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
|
|
2181
|
+
[class.k-selected]="selectedTaskId() === bar.task.id"
|
|
2182
|
+
(mouseenter)="hoveredTaskId.set(bar.primaryTaskId); showTooltip(bar.task, $event)"
|
|
2183
|
+
(mouseleave)="hoveredTaskId.set(null); hideTooltip()"
|
|
2184
|
+
(click)="onTaskBarClick(bar.task, $event)"
|
|
2185
|
+
(dblclick)="onTaskBarDblClick(bar.task, $event)"
|
|
2186
|
+
tabindex="0"
|
|
2187
|
+
[attr.aria-label]="bar.task.name + ' - ' + bar.task.progress + '% complete'"
|
|
2188
|
+
>
|
|
2189
|
+
<div class="k-summary-bar">
|
|
2190
|
+
<div class="k-summary-progress" [style.width.%]="bar.task.progress"></div>
|
|
2191
|
+
</div>
|
|
2192
|
+
<div class="k-summary-left-cap"></div>
|
|
2193
|
+
<div class="k-summary-right-cap"></div>
|
|
2194
|
+
</div>
|
|
2195
|
+
} @else {
|
|
2196
|
+
<!-- Regular task bar -->
|
|
2197
|
+
<div
|
|
2198
|
+
class="k-task"
|
|
2199
|
+
[style.left.px]="bar.left"
|
|
2200
|
+
[style.width.px]="bar.width"
|
|
2201
|
+
[style.background]="bar.task.color || null"
|
|
2202
|
+
[class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
|
|
2203
|
+
[class.k-selected]="selectedTaskId() === bar.task.id"
|
|
2204
|
+
(mouseenter)="hoveredTaskId.set(bar.primaryTaskId); showTooltip(bar.task, $event)"
|
|
2205
|
+
(mouseleave)="hoveredTaskId.set(null); hideTooltip()"
|
|
2206
|
+
(pointerdown)="onBarPointerDown($event, bar.task, 'move')"
|
|
2207
|
+
(click)="onTaskBarClick(bar.task, $event)"
|
|
2208
|
+
(dblclick)="onTaskBarDblClick(bar.task, $event)"
|
|
2209
|
+
tabindex="0"
|
|
2210
|
+
role="img"
|
|
2211
|
+
[attr.aria-label]="bar.task.name + ' - ' + bar.task.progress + '% complete'"
|
|
2212
|
+
>
|
|
2213
|
+
<!-- Progress fill -->
|
|
2214
|
+
<div class="k-task-progress" [style.width.%]="bar.task.progress">
|
|
2215
|
+
<div class="k-task-progress-inner"></div>
|
|
2216
|
+
</div>
|
|
2217
|
+
<!-- Task text -->
|
|
2218
|
+
<span class="k-task-text">{{ bar.task.name }}</span>
|
|
2219
|
+
<!-- Resize handles -->
|
|
2220
|
+
@if (bar.task.draggable !== false) {
|
|
2221
|
+
<div class="k-resize-handle k-resize-w" (pointerdown)="onBarPointerDown($event, bar.task, 'resize-left')"></div>
|
|
2222
|
+
<div class="k-resize-handle k-resize-e" (pointerdown)="onBarPointerDown($event, bar.task, 'resize-right')"></div>
|
|
2223
|
+
}
|
|
2224
|
+
</div>
|
|
2225
|
+
}
|
|
2226
|
+
</div>
|
|
2227
|
+
}
|
|
2228
|
+
</div>
|
|
2229
|
+
|
|
2230
|
+
<!-- Dependency arrows (SVG overlay) -->
|
|
2231
|
+
<svg class="k-gantt-dependencies" [attr.width]="totalWidth()" [attr.height]="totalHeight()">
|
|
2232
|
+
<defs>
|
|
2233
|
+
<marker id="k-arrowhead" markerWidth="10" markerHeight="7" refX="10" refY="3.5" orient="auto">
|
|
2234
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="var(--ngx-gantt-arrow-color, #ff6358)"/>
|
|
2235
|
+
</marker>
|
|
2236
|
+
</defs>
|
|
2237
|
+
@for (dep of dependencyPaths(); track dep.key) {
|
|
2238
|
+
<path
|
|
2239
|
+
class="k-dep-line"
|
|
2240
|
+
[attr.d]="dep.path"
|
|
2241
|
+
[attr.stroke]="dep.dependency.color || null"
|
|
2242
|
+
marker-end="url(#k-arrowhead)"
|
|
2243
|
+
(click)="onDependencyClick(dep.dependency, $event)"
|
|
2244
|
+
/>
|
|
2245
|
+
}
|
|
2246
|
+
</svg>
|
|
2247
|
+
|
|
2248
|
+
</div>
|
|
2249
|
+
</div>
|
|
2250
|
+
</div>
|
|
2251
|
+
</div>
|
|
2252
|
+
|
|
2253
|
+
<!-- ===== TASK TOOLTIP ===== -->
|
|
2254
|
+
@if (tooltipTask()) {
|
|
2255
|
+
<div
|
|
2256
|
+
class="k-bar-tooltip"
|
|
2257
|
+
[style.left.px]="tooltipX()"
|
|
2258
|
+
[style.top.px]="tooltipY()"
|
|
2259
|
+
>
|
|
2260
|
+
<div class="k-bar-tooltip-title">{{ tooltipTask()!.name }}</div>
|
|
2261
|
+
<div class="k-bar-tooltip-row">
|
|
2262
|
+
<span class="k-bar-tooltip-label">Start</span>
|
|
2263
|
+
<span class="k-bar-tooltip-value">{{ formatDateFull(tooltipTask()!.start) }}</span>
|
|
2264
|
+
</div>
|
|
2265
|
+
<div class="k-bar-tooltip-row">
|
|
2266
|
+
<span class="k-bar-tooltip-label">End</span>
|
|
2267
|
+
<span class="k-bar-tooltip-value">{{ formatDateFull(tooltipTask()!.end) }}</span>
|
|
2268
|
+
</div>
|
|
2269
|
+
<div class="k-bar-tooltip-row">
|
|
2270
|
+
<span class="k-bar-tooltip-label">Progress</span>
|
|
2271
|
+
<span class="k-bar-tooltip-value">{{ tooltipTask()!.progress }}%</span>
|
|
2272
|
+
</div>
|
|
2273
|
+
@for (entry of getMetaEntries(tooltipTask()!.meta); track entry.key) {
|
|
2274
|
+
<div class="k-bar-tooltip-row">
|
|
2275
|
+
<span class="k-bar-tooltip-label">{{ entry.key }}</span>
|
|
2276
|
+
<span class="k-bar-tooltip-value">{{ entry.value }}</span>
|
|
2277
|
+
</div>
|
|
2278
|
+
}
|
|
2279
|
+
</div>
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
<!-- ===== ROW TOOLTIP (multi-task rows) ===== -->
|
|
2283
|
+
@if (rowTooltipData()) {
|
|
2284
|
+
<div
|
|
2285
|
+
class="k-bar-tooltip k-row-tooltip"
|
|
2286
|
+
[style.left.px]="rowTooltipX()"
|
|
2287
|
+
[style.top.px]="rowTooltipY()"
|
|
2288
|
+
>
|
|
2289
|
+
<div class="k-bar-tooltip-title">Tasks in this row</div>
|
|
2290
|
+
@for (t of rowTooltipData()!.allTasks; track t.id) {
|
|
2291
|
+
<div class="k-row-tooltip-task">
|
|
2292
|
+
<span class="k-row-tooltip-dot" [style.background]="t.color || '#4a90d9'"></span>
|
|
2293
|
+
<span class="k-row-tooltip-name">{{ t.name }}</span>
|
|
2294
|
+
<span class="k-bar-tooltip-label">{{ formatDateShort(t.start) }}–{{ formatDateShort(t.end) }}</span>
|
|
2295
|
+
<span class="k-bar-tooltip-value">{{ t.progress }}%</span>
|
|
2296
|
+
</div>
|
|
2297
|
+
}
|
|
2298
|
+
</div>
|
|
2299
|
+
}
|
|
2300
|
+
`, styles: [":host{display:block}.k-gantt{display:flex;height:100%;width:100%;background:var(--ngx-gantt-bg, #ffffff);border:1px solid var(--ngx-gantt-border, #dee2e6);border-radius:4px;font-family:var(--ngx-gantt-font, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif);font-size:var(--ngx-gantt-font-size, 13px);color:var(--ngx-gantt-text, #212529);overflow:hidden;position:relative}.k-gantt-treelist{display:flex;flex-direction:column;flex-shrink:0;border-right:1px solid var(--ngx-gantt-border, #dee2e6);overflow:hidden;background:var(--ngx-gantt-bg, #ffffff)}.k-treelist-header{flex-shrink:0;background:var(--ngx-gantt-header-bg, #f1f3f5);border-bottom:1px solid var(--ngx-gantt-border, #dee2e6);overflow:hidden;display:flex;align-items:flex-end}.k-treelist-header-table,.k-treelist-table{width:100%;border-collapse:collapse;table-layout:fixed}.k-header-cell{padding:8px;text-align:left;font-size:var(--ngx-gantt-header-font-size, 12px);font-weight:600;color:var(--ngx-gantt-header-text, #495057);border-right:1px solid var(--ngx-gantt-border, #dee2e6);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.k-header-cell:last-child{border-right:none;text-align:center}.k-treelist-content{flex:1;overflow-y:auto;overflow-x:hidden}.k-treelist-row{cursor:default;border-bottom:1px solid var(--ngx-gantt-grid-line, #ebedf0)}.k-treelist-row.k-alt{background:var(--ngx-gantt-alt-bg, #f8f9fa)}.k-treelist-row.k-hover{background:var(--ngx-gantt-hover-bg, #e8f0fe)!important}.k-treelist-row.k-selected{background:var(--ngx-gantt-selected-bg, #d0e1f9)!important}.k-treelist-cell{padding:0 8px;height:100%;vertical-align:middle;border-right:1px solid var(--ngx-gantt-grid-line, #ebedf0);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.k-treelist-cell:last-child{border-right:none}.k-name-cell{display:flex;align-items:center;gap:0}.k-indent{display:inline-block;flex-shrink:0}.k-name-wrapper{display:flex;flex-direction:column;min-width:0;justify-content:center;gap:2px;overflow:hidden}.k-extra-tasks-chips{display:flex;flex-wrap:wrap;gap:3px}.k-extra-task-chip{display:inline-flex;align-items:center;padding:0 5px;height:14px;border-radius:7px;font-size:10px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:110px;opacity:.9;font-weight:500;letter-spacing:.01em}.k-multi-pct{cursor:help}.k-collapse-btn{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;background:none;border:none;cursor:pointer;padding:0;color:var(--ngx-gantt-text-secondary, #6c757d);border-radius:3px}.k-collapse-btn:hover{background:var(--ngx-gantt-border, #dee2e6)}.k-icon{font-size:8px;transition:transform .15s ease;display:inline-block}.k-icon.k-collapsed{transform:rotate(-90deg)}.k-collapse-spacer{display:inline-block;width:20px;flex-shrink:0}.k-milestone-icon{color:var(--ngx-gantt-milestone-color, #e74c3c);margin-right:4px;font-size:10px;flex-shrink:0}.k-task-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.k-summary-name{font-weight:600}.k-date-cell{font-size:11px;color:var(--ngx-gantt-text-secondary, #6c757d);text-align:center}.k-pct-cell{font-size:11px;text-align:center;font-weight:500}.k-splitbar{width:7px;flex-shrink:0;background:var(--ngx-gantt-header-bg, #f1f3f5);border-left:1px solid var(--ngx-gantt-border, #dee2e6);border-right:1px solid var(--ngx-gantt-border, #dee2e6);cursor:col-resize;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;z-index:2}.k-splitbar:hover{background:var(--ngx-gantt-border, #dee2e6)}.k-splitbar-icon{color:var(--ngx-gantt-text-secondary, #6c757d);font-size:14px;line-height:1}.k-gantt-timeline{flex:1;min-width:0;display:flex;flex-direction:column;overflow:hidden}.k-timeline-header{flex-shrink:0;overflow:hidden;background:var(--ngx-gantt-header-bg, #f1f3f5);border-bottom:1px solid var(--ngx-gantt-border, #dee2e6)}.k-timeline-header-wrap{position:relative;display:flex;flex-direction:column;height:100%}.k-header-row{position:relative;flex:1}.k-header-primary{border-bottom:1px solid var(--ngx-gantt-border, #dee2e6)}.k-header-group-cell{position:absolute;top:0;height:100%;display:flex;align-items:center;justify-content:center;font-size:var(--ngx-gantt-header-font-size, 12px);font-weight:600;color:var(--ngx-gantt-header-text, #495057);border-right:1px solid var(--ngx-gantt-border, #dee2e6);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 4px;box-sizing:border-box}.k-header-tick-cell{position:absolute;top:0;height:100%;display:flex;align-items:center;justify-content:center;font-size:11px;color:var(--ngx-gantt-text-secondary, #6c757d);border-right:1px solid var(--ngx-gantt-grid-line, #ebedf0);white-space:nowrap;box-sizing:border-box}.k-header-tick-cell.k-weekend{background:var(--ngx-gantt-weekend-bg, rgba(0,0,0,.02));color:#adb5bd}.k-header-tick-cell.k-today-header{color:var(--ngx-gantt-today-color, #ff6358);font-weight:700}.k-timeline-content{flex:1;overflow:auto}.k-timeline-canvas{position:relative}.k-gantt-rows{position:absolute;top:0;left:0;right:0}.k-gantt-row{position:absolute;left:0;right:0;border-bottom:1px solid var(--ngx-gantt-grid-line, #ebedf0)}.k-gantt-row.k-alt{background:var(--ngx-gantt-alt-bg, #f8f9fa)}.k-gantt-row.k-hover{background:var(--ngx-gantt-hover-bg, #e8f0fe)!important}.k-gantt-row.k-selected{background:var(--ngx-gantt-selected-bg, #d0e1f9)!important}.k-gantt-columns{position:absolute;top:0;left:0}.k-gantt-column{position:absolute;top:0;border-right:1px solid var(--ngx-gantt-grid-line, #ebedf0);box-sizing:border-box}.k-gantt-column.k-weekend-col{background:var(--ngx-gantt-weekend-bg, rgba(0,0,0,.02))}.k-today-marker{position:absolute;top:0;width:2px;background:var(--ngx-gantt-today-color, #ff6358);z-index:3;pointer-events:none}.k-today-indicator{position:absolute;top:-1px;left:-5px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid var(--ngx-gantt-today-color, #ff6358)}.k-gantt-tasks{position:absolute;top:0;left:0;z-index:2}.k-task-wrap{position:absolute;left:0;right:0;display:flex;align-items:center;pointer-events:none}.k-task{position:absolute;height:var(--ngx-gantt-bar-height, 24px);background:var(--ngx-gantt-bar-bg, #4a90d9);border-radius:4px;cursor:grab;pointer-events:all;display:flex;align-items:center;overflow:hidden;box-shadow:0 1px 3px #0000001f,0 1px 2px #0000000f;transition:box-shadow .15s ease;-webkit-user-select:none;user-select:none}.k-task:hover{box-shadow:0 3px 8px #0000002e,0 1px 3px #0000001a}.k-task:active{cursor:grabbing}.k-task.k-focused{outline:2px solid var(--ngx-gantt-focus-ring, #4a90d9);outline-offset:2px}.k-task.k-selected{outline:2px solid var(--ngx-gantt-focus-ring, #4a90d9);outline-offset:1px}.k-task-progress{position:absolute;top:0;left:0;height:100%;overflow:hidden;border-radius:4px 0 0 4px}.k-task-progress-inner{width:10000px;height:100%;background:var(--ngx-gantt-bar-progress-bg, #2d6cb4)}.k-task-text{position:relative;z-index:1;padding:0 8px;color:var(--ngx-gantt-bar-text, #ffffff);font-size:12px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 1px 1px rgba(0,0,0,.15)}.k-resize-handle{position:absolute;top:0;width:6px;height:100%;cursor:col-resize;pointer-events:all;z-index:2}.k-resize-w{left:0}.k-resize-e{right:0}.k-resize-handle:hover{background:#ffffff40}.k-task-summary{position:absolute;height:10px;pointer-events:all;cursor:pointer;display:flex;align-items:flex-end}.k-task-summary.k-focused,.k-task-summary.k-selected{outline:2px solid var(--ngx-gantt-focus-ring, #4a90d9);outline-offset:3px;border-radius:2px}.k-summary-bar{position:relative;width:100%;height:6px;background:var(--ngx-gantt-summary-color, #495057);border-radius:0}.k-summary-progress{height:100%;background:#343a40}.k-summary-left-cap,.k-summary-right-cap{position:absolute;bottom:0;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:6px solid var(--ngx-gantt-summary-color, #495057)}.k-summary-left-cap{left:-1px}.k-summary-right-cap{right:-1px}.k-milestone{position:absolute;pointer-events:all;cursor:pointer}.k-milestone.k-focused,.k-milestone.k-selected{outline:2px solid var(--ngx-gantt-focus-ring, #4a90d9);outline-offset:4px;border-radius:2px}.k-milestone-diamond{width:16px;height:16px;background:var(--ngx-gantt-milestone-color, #e74c3c);transform:rotate(45deg);border-radius:2px;box-shadow:0 1px 3px #00000026}.k-gantt-dependencies{position:absolute;top:0;left:0;z-index:1;pointer-events:none}.k-dep-line{fill:none;stroke:var(--ngx-gantt-arrow-color, #ff6358);stroke-width:1.5;pointer-events:stroke;cursor:pointer}.k-dep-line:hover{stroke-width:3}@keyframes k-tooltip-fadein{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.k-bar-tooltip{position:fixed;z-index:9999;background:var(--ngx-gantt-tooltip-bg, #2d3748);color:var(--ngx-gantt-tooltip-text, #ffffff);border-radius:6px;padding:10px 14px;min-width:180px;box-shadow:0 4px 16px #00000038;pointer-events:none;font-size:12px;line-height:1.5;animation:k-tooltip-fadein .15s ease}.k-bar-tooltip-title{font-weight:700;font-size:13px;margin-bottom:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}.k-bar-tooltip-row{display:flex;justify-content:space-between;gap:12px;margin-top:3px}.k-bar-tooltip-label{color:var(--ngx-gantt-tooltip-label, rgba(255,255,255,.65));white-space:nowrap}.k-bar-tooltip-value{font-weight:500;white-space:nowrap}.k-row-tooltip{min-width:240px}.k-row-tooltip-task{display:flex;align-items:center;gap:6px;margin-top:5px;padding-top:5px;border-top:1px solid rgba(255,255,255,.12)}.k-row-tooltip-task:first-of-type{border-top:none}.k-row-tooltip-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.k-row-tooltip-name{flex:1;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n"] }]
|
|
2301
|
+
}] });
|
|
2302
|
+
|
|
2303
|
+
/*
|
|
2304
|
+
* Public API Surface — secondary entry point: ngx-core-components/charts
|
|
2305
|
+
*/
|
|
2306
|
+
// Bar / Line / Pie / Sparkline charts
|
|
2307
|
+
|
|
2308
|
+
/**
|
|
2309
|
+
* Generated bundle index. Do not edit.
|
|
2310
|
+
*/
|
|
2311
|
+
|
|
2312
|
+
export { BarChartComponent, CHART_COLORS, DEFAULT_GANTT_CONFIG, DependencyType, GanttChartComponent, GanttScaleService, LineChartComponent, PieChartComponent, SparklineComponent, ZoomLevel, addDays, addMonths, addWeeks, diffDays, getColumnDates, getDateRange, isWeekend, snapToDay, startOfDay, startOfMonth, startOfWeek };
|
|
2313
|
+
//# sourceMappingURL=ngx-core-components-charts.mjs.map
|