ngx-core-components 0.0.3

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.
Files changed (31) hide show
  1. package/README.md +158 -0
  2. package/fesm2022/ngx-core-components.mjs +3588 -0
  3. package/fesm2022/ngx-core-components.mjs.map +1 -0
  4. package/index.d.ts +5 -0
  5. package/lib/charts/bar-chart/bar-chart.component.d.ts +44 -0
  6. package/lib/charts/line-chart/line-chart.component.d.ts +45 -0
  7. package/lib/charts/pie-chart/pie-chart.component.d.ts +53 -0
  8. package/lib/charts/shared/chart-utils.d.ts +19 -0
  9. package/lib/charts/sparkline/sparkline.component.d.ts +26 -0
  10. package/lib/data-grid/data-grid.component.d.ts +61 -0
  11. package/lib/gantt-chart/gantt-chart.component.d.ts +81 -0
  12. package/lib/gantt-chart/models/gantt-config.model.d.ts +25 -0
  13. package/lib/gantt-chart/models/gantt-dependency.model.d.ts +13 -0
  14. package/lib/gantt-chart/models/gantt-event.model.d.ts +21 -0
  15. package/lib/gantt-chart/models/gantt-task.model.d.ts +14 -0
  16. package/lib/gantt-chart/models/index.d.ts +4 -0
  17. package/lib/gantt-chart/services/gantt-keyboard.service.d.ts +12 -0
  18. package/lib/gantt-chart/services/gantt-layout.service.d.ts +14 -0
  19. package/lib/gantt-chart/services/gantt-scale.service.d.ts +10 -0
  20. package/lib/gantt-chart/utils/date-utils.d.ts +18 -0
  21. package/lib/gantt-chart/utils/svg-utils.d.ts +8 -0
  22. package/lib/inputs/date-picker/date-picker.component.d.ts +35 -0
  23. package/lib/inputs/dropdown/dropdown.component.d.ts +30 -0
  24. package/lib/inputs/multi-select/multi-select.component.d.ts +32 -0
  25. package/lib/inputs/textbox/textbox.component.d.ts +19 -0
  26. package/lib/list-view/list-view.component.d.ts +29 -0
  27. package/lib/tooltip/popover.component.d.ts +12 -0
  28. package/lib/tooltip/tooltip.directive.d.ts +15 -0
  29. package/lib/tree-view/tree-view.component.d.ts +40 -0
  30. package/package.json +46 -0
  31. package/public-api.d.ts +25 -0
@@ -0,0 +1,3588 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, signal, input, output, inject, viewChild, computed, ChangeDetectionStrategy, Component, ElementRef, HostListener, ContentChild, Renderer2, Directive } from '@angular/core';
3
+ import { NgTemplateOutlet } from '@angular/common';
4
+
5
+ var DependencyType;
6
+ (function (DependencyType) {
7
+ DependencyType["FinishToStart"] = "FS";
8
+ DependencyType["StartToStart"] = "SS";
9
+ DependencyType["FinishToFinish"] = "FF";
10
+ DependencyType["StartToFinish"] = "SF";
11
+ })(DependencyType || (DependencyType = {}));
12
+
13
+ var ZoomLevel;
14
+ (function (ZoomLevel) {
15
+ ZoomLevel["Day"] = "day";
16
+ ZoomLevel["Week"] = "week";
17
+ ZoomLevel["Month"] = "month";
18
+ })(ZoomLevel || (ZoomLevel = {}));
19
+ const DEFAULT_GANTT_CONFIG = {
20
+ zoomLevel: ZoomLevel.Day,
21
+ rowHeight: 40,
22
+ columnWidth: 40,
23
+ sidebarColumns: [{ field: 'name', header: 'Task Name', width: 200 }],
24
+ sidebarWidth: 280,
25
+ showTodayMarker: true,
26
+ showGrid: true,
27
+ collapsible: true,
28
+ headerHeight: 60,
29
+ snapTo: 'day',
30
+ locale: 'en-US',
31
+ };
32
+
33
+ function addDays(date, days) {
34
+ const result = new Date(date);
35
+ result.setDate(result.getDate() + days);
36
+ return result;
37
+ }
38
+ function diffDays(a, b) {
39
+ const msPerDay = 86400000;
40
+ return Math.round((a.getTime() - b.getTime()) / msPerDay);
41
+ }
42
+ function startOfDay(date) {
43
+ const result = new Date(date);
44
+ result.setHours(0, 0, 0, 0);
45
+ return result;
46
+ }
47
+ function startOfWeek(date, weekStartsOn = 1) {
48
+ const result = startOfDay(date);
49
+ const day = result.getDay();
50
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
51
+ result.setDate(result.getDate() - diff);
52
+ return result;
53
+ }
54
+ function startOfMonth(date) {
55
+ const result = new Date(date);
56
+ result.setDate(1);
57
+ result.setHours(0, 0, 0, 0);
58
+ return result;
59
+ }
60
+ function addMonths(date, months) {
61
+ const result = new Date(date);
62
+ result.setMonth(result.getMonth() + months);
63
+ return result;
64
+ }
65
+ function addWeeks(date, weeks) {
66
+ return addDays(date, weeks * 7);
67
+ }
68
+ function isWeekend(date) {
69
+ const day = date.getDay();
70
+ return day === 0 || day === 6;
71
+ }
72
+ function getDateRange(tasks) {
73
+ if (tasks.length === 0) {
74
+ const today = startOfDay(new Date());
75
+ return { start: today, end: addDays(today, 30) };
76
+ }
77
+ let min = tasks[0].start.getTime();
78
+ let max = tasks[0].end.getTime();
79
+ for (const t of tasks) {
80
+ if (t.start.getTime() < min)
81
+ min = t.start.getTime();
82
+ if (t.end.getTime() > max)
83
+ max = t.end.getTime();
84
+ }
85
+ return { start: addDays(new Date(min), -2), end: addDays(new Date(max), 2) };
86
+ }
87
+ function getColumnDates(start, end, zoom) {
88
+ const dates = [];
89
+ let current;
90
+ switch (zoom) {
91
+ case ZoomLevel.Day:
92
+ current = startOfDay(start);
93
+ while (current <= end) {
94
+ dates.push(new Date(current));
95
+ current = addDays(current, 1);
96
+ }
97
+ break;
98
+ case ZoomLevel.Week:
99
+ current = startOfWeek(start);
100
+ while (current <= end) {
101
+ dates.push(new Date(current));
102
+ current = addWeeks(current, 1);
103
+ }
104
+ break;
105
+ case ZoomLevel.Month:
106
+ current = startOfMonth(start);
107
+ while (current <= end) {
108
+ dates.push(new Date(current));
109
+ current = addMonths(current, 1);
110
+ }
111
+ break;
112
+ }
113
+ return dates;
114
+ }
115
+ function snapToDay(date) {
116
+ const result = startOfDay(date);
117
+ if (date.getHours() >= 12) {
118
+ return addDays(result, 1);
119
+ }
120
+ return result;
121
+ }
122
+
123
+ class GanttScaleService {
124
+ dateToX(date, startDate, columnWidth, zoomLevel) {
125
+ switch (zoomLevel) {
126
+ case ZoomLevel.Day:
127
+ return diffDays(startOfDay(date), startOfDay(startDate)) * columnWidth;
128
+ case ZoomLevel.Week: {
129
+ const totalDays = diffDays(date, startOfWeek(startDate));
130
+ return (totalDays / 7) * columnWidth;
131
+ }
132
+ case ZoomLevel.Month: {
133
+ const start = startOfMonth(startDate);
134
+ const months = (date.getFullYear() - start.getFullYear()) * 12 +
135
+ (date.getMonth() - start.getMonth());
136
+ const dayInMonth = date.getDate() - 1;
137
+ const daysInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
138
+ return (months + dayInMonth / daysInMonth) * columnWidth;
139
+ }
140
+ }
141
+ }
142
+ xToDate(x, startDate, columnWidth, zoomLevel) {
143
+ switch (zoomLevel) {
144
+ case ZoomLevel.Day: {
145
+ const days = x / columnWidth;
146
+ return addDays(startOfDay(startDate), Math.round(days));
147
+ }
148
+ case ZoomLevel.Week: {
149
+ const weeks = x / columnWidth;
150
+ return addDays(startOfWeek(startDate), Math.round(weeks * 7));
151
+ }
152
+ case ZoomLevel.Month: {
153
+ const months = x / columnWidth;
154
+ const start = startOfMonth(startDate);
155
+ const result = new Date(start);
156
+ result.setMonth(result.getMonth() + Math.floor(months));
157
+ const fraction = months - Math.floor(months);
158
+ const daysInMonth = new Date(result.getFullYear(), result.getMonth() + 1, 0).getDate();
159
+ result.setDate(1 + Math.round(fraction * daysInMonth));
160
+ return result;
161
+ }
162
+ }
163
+ }
164
+ snapDate(date, snapTo) {
165
+ switch (snapTo) {
166
+ case 'day':
167
+ return snapToDay(date);
168
+ case 'hour': {
169
+ const result = new Date(date);
170
+ result.setMinutes(0, 0, 0);
171
+ return result;
172
+ }
173
+ default:
174
+ return date;
175
+ }
176
+ }
177
+ getBarWidth(start, end, startDate, columnWidth, zoomLevel) {
178
+ const x1 = this.dateToX(start, startDate, columnWidth, zoomLevel);
179
+ const x2 = this.dateToX(end, startDate, columnWidth, zoomLevel);
180
+ return Math.max(x2 - x1, 4);
181
+ }
182
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttScaleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
183
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttScaleService });
184
+ }
185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttScaleService, decorators: [{
186
+ type: Injectable
187
+ }] });
188
+
189
+ class GanttLayoutService {
190
+ flattenTasks(tasks) {
191
+ const childrenMap = new Map();
192
+ for (const task of tasks) {
193
+ const parentId = task.parentId;
194
+ if (!childrenMap.has(parentId)) {
195
+ childrenMap.set(parentId, []);
196
+ }
197
+ childrenMap.get(parentId).push(task);
198
+ }
199
+ const rows = [];
200
+ let rowIndex = 0;
201
+ const traverse = (parentId, depth, parentVisible) => {
202
+ const children = childrenMap.get(parentId) || [];
203
+ for (const task of children) {
204
+ const hasChildren = childrenMap.has(task.id) && childrenMap.get(task.id).length > 0;
205
+ const isVisible = parentVisible;
206
+ rows.push({ task, depth, rowIndex: isVisible ? rowIndex : -1, hasChildren, isVisible });
207
+ if (isVisible)
208
+ rowIndex++;
209
+ const childVisible = isVisible && !task.collapsed;
210
+ traverse(task.id, depth + 1, childVisible);
211
+ }
212
+ };
213
+ traverse(null, 0, true);
214
+ return rows;
215
+ }
216
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttLayoutService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
217
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttLayoutService });
218
+ }
219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttLayoutService, decorators: [{
220
+ type: Injectable
221
+ }] });
222
+
223
+ class GanttKeyboardService {
224
+ focusedTaskId = signal(null);
225
+ focusTask(taskId) {
226
+ this.focusedTaskId.set(taskId);
227
+ }
228
+ clearFocus() {
229
+ this.focusedTaskId.set(null);
230
+ }
231
+ handleKeyDown(event, visibleTaskIds, callbacks) {
232
+ const currentId = this.focusedTaskId();
233
+ const currentIndex = currentId ? visibleTaskIds.indexOf(currentId) : -1;
234
+ switch (event.key) {
235
+ case 'ArrowDown':
236
+ event.preventDefault();
237
+ if (currentIndex < visibleTaskIds.length - 1) {
238
+ this.focusTask(visibleTaskIds[currentIndex + 1]);
239
+ }
240
+ break;
241
+ case 'ArrowUp':
242
+ event.preventDefault();
243
+ if (currentIndex > 0) {
244
+ this.focusTask(visibleTaskIds[currentIndex - 1]);
245
+ }
246
+ break;
247
+ case 'Enter':
248
+ case ' ':
249
+ event.preventDefault();
250
+ if (currentId && callbacks.onSelect) {
251
+ callbacks.onSelect(currentId);
252
+ }
253
+ break;
254
+ case 'Escape':
255
+ this.clearFocus();
256
+ callbacks.onEscape?.();
257
+ break;
258
+ }
259
+ }
260
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttKeyboardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
261
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttKeyboardService });
262
+ }
263
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttKeyboardService, decorators: [{
264
+ type: Injectable
265
+ }] });
266
+
267
+ function computeDependencyPath(from, to, type, offset = 12) {
268
+ let startX;
269
+ let startY;
270
+ let endX;
271
+ let endY;
272
+ switch (type) {
273
+ case DependencyType.FinishToStart:
274
+ startX = from.x + from.width;
275
+ startY = from.y + from.height / 2;
276
+ endX = to.x;
277
+ endY = to.y + to.height / 2;
278
+ break;
279
+ case DependencyType.StartToStart:
280
+ startX = from.x;
281
+ startY = from.y + from.height / 2;
282
+ endX = to.x;
283
+ endY = to.y + to.height / 2;
284
+ break;
285
+ case DependencyType.FinishToFinish:
286
+ startX = from.x + from.width;
287
+ startY = from.y + from.height / 2;
288
+ endX = to.x + to.width;
289
+ endY = to.y + to.height / 2;
290
+ break;
291
+ case DependencyType.StartToFinish:
292
+ startX = from.x;
293
+ startY = from.y + from.height / 2;
294
+ endX = to.x + to.width;
295
+ endY = to.y + to.height / 2;
296
+ break;
297
+ }
298
+ const midX = startX + offset;
299
+ if (type === DependencyType.FinishToStart && endX > startX + offset * 2) {
300
+ const mx = (startX + endX) / 2;
301
+ return `M ${startX} ${startY} H ${mx} V ${endY} H ${endX}`;
302
+ }
303
+ return `M ${startX} ${startY} H ${midX} V ${endY} H ${endX}`;
304
+ }
305
+
306
+ class GanttChartComponent {
307
+ // Inputs
308
+ tasks = input.required();
309
+ dependencies = input([]);
310
+ config = input({});
311
+ // Outputs
312
+ taskChange = output();
313
+ taskClick = output();
314
+ taskDblClick = output();
315
+ dependencyClick = output();
316
+ scroll = output();
317
+ zoomChange = output();
318
+ // Services
319
+ scaleService = inject(GanttScaleService);
320
+ layoutService = inject(GanttLayoutService);
321
+ keyboardService = inject(GanttKeyboardService);
322
+ // View children
323
+ timelineContent = viewChild('timelineContent');
324
+ treelistContent = viewChild('treelistContent');
325
+ // Internal state
326
+ internalCollapsed = signal(new Map());
327
+ hoveredTaskId = signal(null);
328
+ selectedTaskId = signal(null);
329
+ scrollLeft = signal(0);
330
+ scrollTop_ = signal(0);
331
+ sidebarWidthOverride = signal(null);
332
+ // Merged config
333
+ mergedConfig = computed(() => {
334
+ const base = { ...DEFAULT_GANTT_CONFIG, ...this.config() };
335
+ const sbOverride = this.sidebarWidthOverride();
336
+ if (sbOverride !== null) {
337
+ base.sidebarWidth = sbOverride;
338
+ }
339
+ return base;
340
+ });
341
+ // Tasks with collapse applied
342
+ effectiveTasks = computed(() => {
343
+ const collapsed = this.internalCollapsed();
344
+ return this.tasks().map(t => ({
345
+ ...t,
346
+ collapsed: collapsed.has(t.id) ? collapsed.get(t.id) : t.collapsed,
347
+ }));
348
+ });
349
+ // Flat row list
350
+ flatRows = computed(() => this.layoutService.flattenTasks(this.effectiveTasks()));
351
+ visibleRows = computed(() => this.flatRows().filter(r => r.isVisible));
352
+ // Date range
353
+ dateRange = computed(() => getDateRange(this.tasks()));
354
+ columnDates = computed(() => getColumnDates(this.dateRange().start, this.dateRange().end, this.mergedConfig().zoomLevel));
355
+ // Dimensions
356
+ totalWidth = computed(() => this.columnDates().length * this.mergedConfig().columnWidth);
357
+ totalHeight = computed(() => this.visibleRows().length * this.mergedConfig().rowHeight);
358
+ // Header columns with labels
359
+ headerColumns = computed(() => {
360
+ const cfg = this.mergedConfig();
361
+ const today = startOfDay(new Date());
362
+ return this.columnDates().map((date, i) => {
363
+ const isWknd = isWeekend(date);
364
+ const isToday = date.getTime() === today.getTime();
365
+ return {
366
+ x: i * cfg.columnWidth,
367
+ width: cfg.columnWidth,
368
+ date,
369
+ label: this.getSecondaryLabel(date, cfg.zoomLevel, cfg.locale),
370
+ isWeekend: isWknd,
371
+ isToday,
372
+ };
373
+ });
374
+ });
375
+ // Primary header groups
376
+ primaryHeaderGroups = computed(() => {
377
+ const cfg = this.mergedConfig();
378
+ const dates = this.columnDates();
379
+ if (dates.length === 0)
380
+ return [];
381
+ const groups = [];
382
+ let currentLabel = this.getPrimaryLabel(dates[0], cfg.zoomLevel, cfg.locale);
383
+ let startIdx = 0;
384
+ for (let i = 1; i <= dates.length; i++) {
385
+ const label = i < dates.length ? this.getPrimaryLabel(dates[i], cfg.zoomLevel, cfg.locale) : '';
386
+ if (label !== currentLabel || i === dates.length) {
387
+ groups.push({
388
+ x: startIdx * cfg.columnWidth,
389
+ width: (i - startIdx) * cfg.columnWidth,
390
+ label: currentLabel,
391
+ });
392
+ currentLabel = label;
393
+ startIdx = i;
394
+ }
395
+ }
396
+ return groups;
397
+ });
398
+ // Today X
399
+ todayX = computed(() => {
400
+ const today = startOfDay(new Date());
401
+ const range = this.dateRange();
402
+ if (today < range.start || today > range.end)
403
+ return null;
404
+ const cfg = this.mergedConfig();
405
+ return this.scaleService.dateToX(today, range.start, cfg.columnWidth, cfg.zoomLevel);
406
+ });
407
+ // Task bar geometries (div positioning)
408
+ taskBars = computed(() => {
409
+ const cfg = this.mergedConfig();
410
+ const range = this.dateRange();
411
+ const barHeight = 24; // default
412
+ const summaryHeight = 10;
413
+ return this.visibleRows().map((row, idx) => {
414
+ const left = this.scaleService.dateToX(row.task.start, range.start, cfg.columnWidth, cfg.zoomLevel);
415
+ const width = row.task.isMilestone
416
+ ? 0
417
+ : this.scaleService.getBarWidth(row.task.start, row.task.end, range.start, cfg.columnWidth, cfg.zoomLevel);
418
+ const top = idx * cfg.rowHeight;
419
+ const isSummary = row.hasChildren && !row.task.isMilestone;
420
+ return { task: row.task, left, width, top, isSummary, barHeight, rowIndex: idx };
421
+ });
422
+ });
423
+ // Dependency paths
424
+ dependencyPaths = computed(() => {
425
+ const bars = this.taskBars();
426
+ const cfg = this.mergedConfig();
427
+ const barMap = new Map(bars.map(b => [b.task.id, b]));
428
+ return this.dependencies()
429
+ .filter(dep => barMap.has(dep.fromId) && barMap.has(dep.toId))
430
+ .map(dep => {
431
+ const from = barMap.get(dep.fromId);
432
+ const to = barMap.get(dep.toId);
433
+ const barH = from.isSummary ? 10 : 24;
434
+ const fromCenterY = from.top + cfg.rowHeight / 2;
435
+ const toCenterY = to.top + cfg.rowHeight / 2;
436
+ const fromRect = { x: from.left, y: fromCenterY - barH / 2, width: from.width || 16, height: barH };
437
+ const toRect = { x: to.left, y: toCenterY - (to.isSummary ? 5 : 12), width: to.width || 16, height: to.isSummary ? 10 : 24 };
438
+ return {
439
+ dependency: dep,
440
+ path: computeDependencyPath(fromRect, toRect, dep.type),
441
+ key: dep.fromId + '-' + dep.toId,
442
+ };
443
+ });
444
+ });
445
+ // Timeline scroll handler — syncs treelist scroll & header position
446
+ onTimelineScroll() {
447
+ const el = this.timelineContent()?.nativeElement;
448
+ if (!el)
449
+ return;
450
+ this.scrollLeft.set(el.scrollLeft);
451
+ this.scrollTop_.set(el.scrollTop);
452
+ // Sync treelist vertical scroll
453
+ const treeEl = this.treelistContent()?.nativeElement;
454
+ if (treeEl)
455
+ treeEl.scrollTop = el.scrollTop;
456
+ }
457
+ // Splitbar resize
458
+ onSplitBarDown(event) {
459
+ event.preventDefault();
460
+ const startX = event.clientX;
461
+ const startWidth = this.mergedConfig().sidebarWidth;
462
+ const onMove = (e) => {
463
+ const delta = e.clientX - startX;
464
+ const newWidth = Math.max(150, Math.min(600, startWidth + delta));
465
+ this.sidebarWidthOverride.set(newWidth);
466
+ };
467
+ const onUp = () => {
468
+ document.removeEventListener('pointermove', onMove);
469
+ document.removeEventListener('pointerup', onUp);
470
+ };
471
+ document.addEventListener('pointermove', onMove);
472
+ document.addEventListener('pointerup', onUp);
473
+ }
474
+ // Task bar drag (move/resize)
475
+ onBarPointerDown(event, task, mode) {
476
+ if (task.draggable === false)
477
+ return;
478
+ event.preventDefault();
479
+ event.stopPropagation();
480
+ const startX = event.clientX;
481
+ const cfg = this.mergedConfig();
482
+ const range = this.dateRange();
483
+ const barEl = event.target.closest('.k-task');
484
+ if (!barEl)
485
+ return;
486
+ const origLeft = parseFloat(barEl.style.left) || 0;
487
+ const origWidth = parseFloat(barEl.style.width) || barEl.offsetWidth;
488
+ barEl.style.cursor = mode === 'move' ? 'grabbing' : 'col-resize';
489
+ barEl.style.zIndex = '10';
490
+ barEl.style.opacity = '0.85';
491
+ const onMove = (e) => {
492
+ const deltaX = e.clientX - startX;
493
+ if (mode === 'move') {
494
+ barEl.style.left = (origLeft + deltaX) + 'px';
495
+ }
496
+ else if (mode === 'resize-right') {
497
+ barEl.style.width = Math.max(10, origWidth + deltaX) + 'px';
498
+ }
499
+ else {
500
+ const newLeft = origLeft + deltaX;
501
+ const newWidth = origWidth - deltaX;
502
+ if (newWidth > 10) {
503
+ barEl.style.left = newLeft + 'px';
504
+ barEl.style.width = newWidth + 'px';
505
+ }
506
+ }
507
+ };
508
+ const onUp = (e) => {
509
+ document.removeEventListener('pointermove', onMove);
510
+ document.removeEventListener('pointerup', onUp);
511
+ barEl.style.cursor = '';
512
+ barEl.style.zIndex = '';
513
+ barEl.style.opacity = '';
514
+ const deltaX = e.clientX - startX;
515
+ if (Math.abs(deltaX) < 2)
516
+ return; // ignore tiny movements
517
+ const pxPerMs = cfg.columnWidth / this.getMsPerUnit(cfg.zoomLevel);
518
+ const deltaMs = deltaX / pxPerMs;
519
+ const previousStart = task.start;
520
+ const previousEnd = task.end;
521
+ let newStart;
522
+ let newEnd;
523
+ if (mode === 'move') {
524
+ newStart = new Date(previousStart.getTime() + deltaMs);
525
+ newEnd = new Date(previousEnd.getTime() + deltaMs);
526
+ }
527
+ else if (mode === 'resize-right') {
528
+ newStart = previousStart;
529
+ newEnd = new Date(previousEnd.getTime() + deltaMs);
530
+ }
531
+ else {
532
+ newStart = new Date(previousStart.getTime() + deltaMs);
533
+ newEnd = previousEnd;
534
+ }
535
+ if (cfg.snapTo === 'day') {
536
+ newStart = this.scaleService.snapDate(newStart, 'day');
537
+ newEnd = this.scaleService.snapDate(newEnd, 'day');
538
+ }
539
+ if (newEnd <= newStart) {
540
+ newEnd = addDays(newStart, 1);
541
+ }
542
+ this.taskChange.emit({
543
+ task: { ...task, start: newStart, end: newEnd },
544
+ previousStart,
545
+ previousEnd,
546
+ });
547
+ };
548
+ document.addEventListener('pointermove', onMove);
549
+ document.addEventListener('pointerup', onUp);
550
+ }
551
+ // Row click
552
+ onRowClick(task, event) {
553
+ this.selectedTaskId.set(task.id);
554
+ this.keyboardService.focusTask(task.id);
555
+ this.taskClick.emit({ task, originalEvent: event });
556
+ }
557
+ // Task bar click
558
+ onTaskBarClick(task, event) {
559
+ event.stopPropagation();
560
+ this.selectedTaskId.set(task.id);
561
+ this.keyboardService.focusTask(task.id);
562
+ this.taskClick.emit({ task, originalEvent: event });
563
+ }
564
+ onTaskBarDblClick(task, event) {
565
+ event.stopPropagation();
566
+ this.taskDblClick.emit({ task, originalEvent: event });
567
+ }
568
+ onDependencyClick(dep, event) {
569
+ this.dependencyClick.emit({ dependency: dep, originalEvent: event });
570
+ }
571
+ onToggleCollapse(taskId) {
572
+ const current = new Map(this.internalCollapsed());
573
+ const task = this.tasks().find(t => t.id === taskId);
574
+ if (!task)
575
+ return;
576
+ const isCollapsed = current.has(taskId) ? current.get(taskId) : task.collapsed;
577
+ current.set(taskId, !isCollapsed);
578
+ this.internalCollapsed.set(current);
579
+ }
580
+ onKeyDown(event) {
581
+ const ids = this.visibleRows().map(r => r.task.id);
582
+ this.keyboardService.handleKeyDown(event, ids, {
583
+ onSelect: (taskId) => {
584
+ const task = this.tasks().find(t => t.id === taskId);
585
+ if (task) {
586
+ this.selectedTaskId.set(taskId);
587
+ this.taskClick.emit({ task, originalEvent: event });
588
+ }
589
+ },
590
+ onEscape: () => {
591
+ this.selectedTaskId.set(null);
592
+ },
593
+ });
594
+ }
595
+ // Public API
596
+ scrollToDate(date) {
597
+ const cfg = this.mergedConfig();
598
+ const range = this.dateRange();
599
+ const x = this.scaleService.dateToX(date, range.start, cfg.columnWidth, cfg.zoomLevel);
600
+ const el = this.timelineContent()?.nativeElement;
601
+ if (el)
602
+ el.scrollLeft = x;
603
+ }
604
+ scrollToTask(taskId) {
605
+ const row = this.visibleRows().find(r => r.task.id === taskId);
606
+ if (!row)
607
+ return;
608
+ const y = row.rowIndex * this.mergedConfig().rowHeight;
609
+ const el = this.timelineContent()?.nativeElement;
610
+ if (el)
611
+ el.scrollTop = y;
612
+ }
613
+ expandAll() {
614
+ const map = new Map();
615
+ this.tasks().forEach(t => map.set(t.id, false));
616
+ this.internalCollapsed.set(map);
617
+ }
618
+ collapseAll() {
619
+ const rows = this.flatRows();
620
+ const map = new Map();
621
+ rows.filter(r => r.hasChildren).forEach(r => map.set(r.task.id, true));
622
+ this.internalCollapsed.set(map);
623
+ }
624
+ // Helpers
625
+ formatDateShort(date) {
626
+ return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
627
+ }
628
+ getPrimaryLabel(date, zoom, locale) {
629
+ switch (zoom) {
630
+ case ZoomLevel.Day:
631
+ case ZoomLevel.Week:
632
+ return date.toLocaleDateString(locale, { month: 'long', year: 'numeric' });
633
+ case ZoomLevel.Month:
634
+ return date.getFullYear().toString();
635
+ }
636
+ }
637
+ getSecondaryLabel(date, zoom, locale) {
638
+ switch (zoom) {
639
+ case ZoomLevel.Day: {
640
+ const day = date.getDate();
641
+ const weekday = date.toLocaleDateString(locale, { weekday: 'narrow' });
642
+ return `${weekday} ${day}`;
643
+ }
644
+ case ZoomLevel.Week: {
645
+ const oneJan = new Date(date.getFullYear(), 0, 1);
646
+ const weekNum = Math.ceil(((date.getTime() - oneJan.getTime()) / 86400000 + oneJan.getDay() + 1) / 7);
647
+ return `W${weekNum}`;
648
+ }
649
+ case ZoomLevel.Month:
650
+ return date.toLocaleDateString(locale, { month: 'short' });
651
+ }
652
+ }
653
+ getMsPerUnit(zoom) {
654
+ switch (zoom) {
655
+ case ZoomLevel.Day: return 86400000;
656
+ case ZoomLevel.Week: return 604800000;
657
+ case ZoomLevel.Month: return 2592000000;
658
+ }
659
+ }
660
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
661
+ 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: [
662
+ GanttScaleService,
663
+ GanttLayoutService,
664
+ GanttKeyboardService,
665
+ ], viewQueries: [{ propertyName: "timelineContent", first: true, predicate: ["timelineContent"], descendants: true, isSignal: true }, { propertyName: "treelistContent", first: true, predicate: ["treelistContent"], descendants: true, isSignal: true }], ngImport: i0, template: `
666
+ <div class="k-gantt" [class.k-gantt-dark]="false" (keydown)="onKeyDown($event)">
667
+
668
+ <!-- ===== TREELIST (Left Panel) ===== -->
669
+ <div class="k-gantt-treelist" [style.width.px]="mergedConfig().sidebarWidth">
670
+ <!-- Treelist Header -->
671
+ <div class="k-treelist-header" [style.height.px]="mergedConfig().headerHeight">
672
+ <table class="k-treelist-header-table">
673
+ <colgroup>
674
+ <col [style.width.px]="mergedConfig().sidebarWidth - 220"/>
675
+ <col style="width: 80px"/>
676
+ <col style="width: 80px"/>
677
+ <col style="width: 60px"/>
678
+ </colgroup>
679
+ <thead>
680
+ <tr>
681
+ <th class="k-header-cell">Task Name</th>
682
+ <th class="k-header-cell">Start</th>
683
+ <th class="k-header-cell">End</th>
684
+ <th class="k-header-cell">%</th>
685
+ </tr>
686
+ </thead>
687
+ </table>
688
+ </div>
689
+
690
+ <!-- Treelist Body -->
691
+ <div class="k-treelist-content" #treelistContent>
692
+ <table class="k-treelist-table">
693
+ <colgroup>
694
+ <col [style.width.px]="mergedConfig().sidebarWidth - 220"/>
695
+ <col style="width: 80px"/>
696
+ <col style="width: 80px"/>
697
+ <col style="width: 60px"/>
698
+ </colgroup>
699
+ <tbody>
700
+ @for (row of visibleRows(); track row.task.id; let i = $index) {
701
+ <tr
702
+ class="k-treelist-row"
703
+ [style.height.px]="mergedConfig().rowHeight"
704
+ [class.k-alt]="i % 2 === 1"
705
+ [class.k-selected]="selectedTaskId() === row.task.id"
706
+ [class.k-hover]="hoveredTaskId() === row.task.id"
707
+ (mouseenter)="hoveredTaskId.set(row.task.id)"
708
+ (mouseleave)="hoveredTaskId.set(null)"
709
+ (click)="onRowClick(row.task, $event)"
710
+ >
711
+ <td class="k-treelist-cell k-name-cell">
712
+ <span class="k-indent" [style.width.px]="row.depth * 20"></span>
713
+ @if (row.hasChildren && mergedConfig().collapsible) {
714
+ <button
715
+ class="k-collapse-btn"
716
+ (click)="onToggleCollapse(row.task.id); $event.stopPropagation()"
717
+ [attr.aria-expanded]="!row.task.collapsed"
718
+ >
719
+ <span class="k-icon" [class.k-collapsed]="row.task.collapsed">&#9660;</span>
720
+ </button>
721
+ } @else {
722
+ <span class="k-collapse-spacer"></span>
723
+ }
724
+ @if (row.task.isMilestone) {
725
+ <span class="k-milestone-icon">&#9670;</span>
726
+ }
727
+ <span class="k-task-name" [class.k-summary-name]="row.hasChildren" [title]="row.task.name">
728
+ {{ row.task.name }}
729
+ </span>
730
+ </td>
731
+ <td class="k-treelist-cell k-date-cell">{{ formatDateShort(row.task.start) }}</td>
732
+ <td class="k-treelist-cell k-date-cell">{{ formatDateShort(row.task.end) }}</td>
733
+ <td class="k-treelist-cell k-pct-cell">{{ row.task.progress }}%</td>
734
+ </tr>
735
+ }
736
+ </tbody>
737
+ </table>
738
+ </div>
739
+ </div>
740
+
741
+ <!-- ===== SPLITBAR ===== -->
742
+ <div class="k-splitbar" (pointerdown)="onSplitBarDown($event)">
743
+ <span class="k-splitbar-icon">&#8942;</span>
744
+ </div>
745
+
746
+ <!-- ===== TIMELINE (Right Panel) ===== -->
747
+ <div class="k-gantt-timeline">
748
+ <!-- Timeline Header -->
749
+ <div class="k-timeline-header" [style.height.px]="mergedConfig().headerHeight">
750
+ <div class="k-timeline-header-wrap" [style.width.px]="totalWidth()" [style.margin-left.px]="-(scrollLeft())">
751
+ <!-- Primary header row (months/years) -->
752
+ <div class="k-header-row k-header-primary">
753
+ @for (group of primaryHeaderGroups(); track group.label + group.x) {
754
+ <div
755
+ class="k-header-group-cell"
756
+ [style.left.px]="group.x"
757
+ [style.width.px]="group.width"
758
+ >
759
+ {{ group.label }}
760
+ </div>
761
+ }
762
+ </div>
763
+ <!-- Secondary header row (days/weeks/months) -->
764
+ <div class="k-header-row k-header-secondary">
765
+ @for (col of headerColumns(); track col.x) {
766
+ <div
767
+ class="k-header-tick-cell"
768
+ [style.left.px]="col.x"
769
+ [style.width.px]="col.width"
770
+ [class.k-weekend]="col.isWeekend"
771
+ [class.k-today-header]="col.isToday"
772
+ >
773
+ {{ col.label }}
774
+ </div>
775
+ }
776
+ </div>
777
+ </div>
778
+ </div>
779
+
780
+ <!-- Timeline Content (Scrollable) -->
781
+ <div class="k-timeline-content" #timelineContent (scroll)="onTimelineScroll()">
782
+ <div class="k-timeline-canvas" [style.width.px]="totalWidth()" [style.height.px]="totalHeight()">
783
+
784
+ <!-- Background rows (alternating + hover) -->
785
+ <div class="k-gantt-rows">
786
+ @for (row of visibleRows(); track row.task.id; let i = $index) {
787
+ <div
788
+ class="k-gantt-row"
789
+ [style.top.px]="i * mergedConfig().rowHeight"
790
+ [style.height.px]="mergedConfig().rowHeight"
791
+ [class.k-alt]="i % 2 === 1"
792
+ [class.k-hover]="hoveredTaskId() === row.task.id"
793
+ [class.k-selected]="selectedTaskId() === row.task.id"
794
+ (mouseenter)="hoveredTaskId.set(row.task.id)"
795
+ (mouseleave)="hoveredTaskId.set(null)"
796
+ >
797
+ </div>
798
+ }
799
+ </div>
800
+
801
+ <!-- Vertical column lines -->
802
+ <div class="k-gantt-columns">
803
+ @for (col of headerColumns(); track col.x) {
804
+ <div
805
+ class="k-gantt-column"
806
+ [style.left.px]="col.x"
807
+ [style.width.px]="col.width"
808
+ [style.height.px]="totalHeight()"
809
+ [class.k-weekend-col]="col.isWeekend"
810
+ >
811
+ </div>
812
+ }
813
+ </div>
814
+
815
+ <!-- Today marker -->
816
+ @if (mergedConfig().showTodayMarker && todayX() !== null) {
817
+ <div
818
+ class="k-today-marker"
819
+ [style.left.px]="todayX()"
820
+ [style.height.px]="totalHeight()"
821
+ >
822
+ <div class="k-today-indicator"></div>
823
+ </div>
824
+ }
825
+
826
+ <!-- Task bars layer -->
827
+ <div class="k-gantt-tasks">
828
+ @for (bar of taskBars(); track bar.task.id) {
829
+ <div
830
+ class="k-task-wrap"
831
+ [style.top.px]="bar.top"
832
+ [style.height.px]="mergedConfig().rowHeight"
833
+ >
834
+ @if (bar.task.isMilestone) {
835
+ <!-- Milestone diamond -->
836
+ <div
837
+ class="k-milestone"
838
+ [style.left.px]="bar.left - 8"
839
+ [class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
840
+ [class.k-selected]="selectedTaskId() === bar.task.id"
841
+ (click)="onTaskBarClick(bar.task, $event)"
842
+ (dblclick)="onTaskBarDblClick(bar.task, $event)"
843
+ tabindex="0"
844
+ [attr.aria-label]="'Milestone: ' + bar.task.name"
845
+ >
846
+ <div class="k-milestone-diamond" [style.background]="bar.task.color || null"></div>
847
+ </div>
848
+ } @else if (bar.isSummary) {
849
+ <!-- Summary bar (parent task) -->
850
+ <div
851
+ class="k-task-summary"
852
+ [style.left.px]="bar.left"
853
+ [style.width.px]="bar.width"
854
+ [class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
855
+ [class.k-selected]="selectedTaskId() === bar.task.id"
856
+ (click)="onTaskBarClick(bar.task, $event)"
857
+ (dblclick)="onTaskBarDblClick(bar.task, $event)"
858
+ tabindex="0"
859
+ [attr.aria-label]="bar.task.name + ' - ' + bar.task.progress + '% complete'"
860
+ >
861
+ <div class="k-summary-bar">
862
+ <div class="k-summary-progress" [style.width.%]="bar.task.progress"></div>
863
+ </div>
864
+ <div class="k-summary-left-cap"></div>
865
+ <div class="k-summary-right-cap"></div>
866
+ </div>
867
+ } @else {
868
+ <!-- Regular task bar -->
869
+ <div
870
+ class="k-task"
871
+ [style.left.px]="bar.left"
872
+ [style.width.px]="bar.width"
873
+ [style.background]="bar.task.color || null"
874
+ [class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
875
+ [class.k-selected]="selectedTaskId() === bar.task.id"
876
+ (pointerdown)="onBarPointerDown($event, bar.task, 'move')"
877
+ (click)="onTaskBarClick(bar.task, $event)"
878
+ (dblclick)="onTaskBarDblClick(bar.task, $event)"
879
+ tabindex="0"
880
+ role="img"
881
+ [attr.aria-label]="bar.task.name + ' - ' + bar.task.progress + '% complete'"
882
+ >
883
+ <!-- Progress fill -->
884
+ <div class="k-task-progress" [style.width.%]="bar.task.progress">
885
+ <div class="k-task-progress-inner"></div>
886
+ </div>
887
+ <!-- Task text -->
888
+ <span class="k-task-text">{{ bar.task.name }}</span>
889
+ <!-- Resize handles -->
890
+ @if (bar.task.draggable !== false) {
891
+ <div class="k-resize-handle k-resize-w" (pointerdown)="onBarPointerDown($event, bar.task, 'resize-left')"></div>
892
+ <div class="k-resize-handle k-resize-e" (pointerdown)="onBarPointerDown($event, bar.task, 'resize-right')"></div>
893
+ }
894
+ </div>
895
+ }
896
+ </div>
897
+ }
898
+ </div>
899
+
900
+ <!-- Dependency arrows (SVG overlay) -->
901
+ <svg class="k-gantt-dependencies" [attr.width]="totalWidth()" [attr.height]="totalHeight()">
902
+ <defs>
903
+ <marker id="k-arrowhead" markerWidth="10" markerHeight="7" refX="10" refY="3.5" orient="auto">
904
+ <polygon points="0 0, 10 3.5, 0 7" fill="var(--ngx-gantt-arrow-color, #ff6358)"/>
905
+ </marker>
906
+ </defs>
907
+ @for (dep of dependencyPaths(); track dep.key) {
908
+ <path
909
+ class="k-dep-line"
910
+ [attr.d]="dep.path"
911
+ [attr.stroke]="dep.dependency.color || null"
912
+ marker-end="url(#k-arrowhead)"
913
+ (click)="onDependencyClick(dep.dependency, $event)"
914
+ />
915
+ }
916
+ </svg>
917
+
918
+ </div>
919
+ </div>
920
+ </div>
921
+ </div>
922
+ `, 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-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}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
923
+ }
924
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GanttChartComponent, decorators: [{
925
+ type: Component,
926
+ args: [{ selector: 'ngx-gantt-chart', standalone: true, imports: [], providers: [
927
+ GanttScaleService,
928
+ GanttLayoutService,
929
+ GanttKeyboardService,
930
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: `
931
+ <div class="k-gantt" [class.k-gantt-dark]="false" (keydown)="onKeyDown($event)">
932
+
933
+ <!-- ===== TREELIST (Left Panel) ===== -->
934
+ <div class="k-gantt-treelist" [style.width.px]="mergedConfig().sidebarWidth">
935
+ <!-- Treelist Header -->
936
+ <div class="k-treelist-header" [style.height.px]="mergedConfig().headerHeight">
937
+ <table class="k-treelist-header-table">
938
+ <colgroup>
939
+ <col [style.width.px]="mergedConfig().sidebarWidth - 220"/>
940
+ <col style="width: 80px"/>
941
+ <col style="width: 80px"/>
942
+ <col style="width: 60px"/>
943
+ </colgroup>
944
+ <thead>
945
+ <tr>
946
+ <th class="k-header-cell">Task Name</th>
947
+ <th class="k-header-cell">Start</th>
948
+ <th class="k-header-cell">End</th>
949
+ <th class="k-header-cell">%</th>
950
+ </tr>
951
+ </thead>
952
+ </table>
953
+ </div>
954
+
955
+ <!-- Treelist Body -->
956
+ <div class="k-treelist-content" #treelistContent>
957
+ <table class="k-treelist-table">
958
+ <colgroup>
959
+ <col [style.width.px]="mergedConfig().sidebarWidth - 220"/>
960
+ <col style="width: 80px"/>
961
+ <col style="width: 80px"/>
962
+ <col style="width: 60px"/>
963
+ </colgroup>
964
+ <tbody>
965
+ @for (row of visibleRows(); track row.task.id; let i = $index) {
966
+ <tr
967
+ class="k-treelist-row"
968
+ [style.height.px]="mergedConfig().rowHeight"
969
+ [class.k-alt]="i % 2 === 1"
970
+ [class.k-selected]="selectedTaskId() === row.task.id"
971
+ [class.k-hover]="hoveredTaskId() === row.task.id"
972
+ (mouseenter)="hoveredTaskId.set(row.task.id)"
973
+ (mouseleave)="hoveredTaskId.set(null)"
974
+ (click)="onRowClick(row.task, $event)"
975
+ >
976
+ <td class="k-treelist-cell k-name-cell">
977
+ <span class="k-indent" [style.width.px]="row.depth * 20"></span>
978
+ @if (row.hasChildren && mergedConfig().collapsible) {
979
+ <button
980
+ class="k-collapse-btn"
981
+ (click)="onToggleCollapse(row.task.id); $event.stopPropagation()"
982
+ [attr.aria-expanded]="!row.task.collapsed"
983
+ >
984
+ <span class="k-icon" [class.k-collapsed]="row.task.collapsed">&#9660;</span>
985
+ </button>
986
+ } @else {
987
+ <span class="k-collapse-spacer"></span>
988
+ }
989
+ @if (row.task.isMilestone) {
990
+ <span class="k-milestone-icon">&#9670;</span>
991
+ }
992
+ <span class="k-task-name" [class.k-summary-name]="row.hasChildren" [title]="row.task.name">
993
+ {{ row.task.name }}
994
+ </span>
995
+ </td>
996
+ <td class="k-treelist-cell k-date-cell">{{ formatDateShort(row.task.start) }}</td>
997
+ <td class="k-treelist-cell k-date-cell">{{ formatDateShort(row.task.end) }}</td>
998
+ <td class="k-treelist-cell k-pct-cell">{{ row.task.progress }}%</td>
999
+ </tr>
1000
+ }
1001
+ </tbody>
1002
+ </table>
1003
+ </div>
1004
+ </div>
1005
+
1006
+ <!-- ===== SPLITBAR ===== -->
1007
+ <div class="k-splitbar" (pointerdown)="onSplitBarDown($event)">
1008
+ <span class="k-splitbar-icon">&#8942;</span>
1009
+ </div>
1010
+
1011
+ <!-- ===== TIMELINE (Right Panel) ===== -->
1012
+ <div class="k-gantt-timeline">
1013
+ <!-- Timeline Header -->
1014
+ <div class="k-timeline-header" [style.height.px]="mergedConfig().headerHeight">
1015
+ <div class="k-timeline-header-wrap" [style.width.px]="totalWidth()" [style.margin-left.px]="-(scrollLeft())">
1016
+ <!-- Primary header row (months/years) -->
1017
+ <div class="k-header-row k-header-primary">
1018
+ @for (group of primaryHeaderGroups(); track group.label + group.x) {
1019
+ <div
1020
+ class="k-header-group-cell"
1021
+ [style.left.px]="group.x"
1022
+ [style.width.px]="group.width"
1023
+ >
1024
+ {{ group.label }}
1025
+ </div>
1026
+ }
1027
+ </div>
1028
+ <!-- Secondary header row (days/weeks/months) -->
1029
+ <div class="k-header-row k-header-secondary">
1030
+ @for (col of headerColumns(); track col.x) {
1031
+ <div
1032
+ class="k-header-tick-cell"
1033
+ [style.left.px]="col.x"
1034
+ [style.width.px]="col.width"
1035
+ [class.k-weekend]="col.isWeekend"
1036
+ [class.k-today-header]="col.isToday"
1037
+ >
1038
+ {{ col.label }}
1039
+ </div>
1040
+ }
1041
+ </div>
1042
+ </div>
1043
+ </div>
1044
+
1045
+ <!-- Timeline Content (Scrollable) -->
1046
+ <div class="k-timeline-content" #timelineContent (scroll)="onTimelineScroll()">
1047
+ <div class="k-timeline-canvas" [style.width.px]="totalWidth()" [style.height.px]="totalHeight()">
1048
+
1049
+ <!-- Background rows (alternating + hover) -->
1050
+ <div class="k-gantt-rows">
1051
+ @for (row of visibleRows(); track row.task.id; let i = $index) {
1052
+ <div
1053
+ class="k-gantt-row"
1054
+ [style.top.px]="i * mergedConfig().rowHeight"
1055
+ [style.height.px]="mergedConfig().rowHeight"
1056
+ [class.k-alt]="i % 2 === 1"
1057
+ [class.k-hover]="hoveredTaskId() === row.task.id"
1058
+ [class.k-selected]="selectedTaskId() === row.task.id"
1059
+ (mouseenter)="hoveredTaskId.set(row.task.id)"
1060
+ (mouseleave)="hoveredTaskId.set(null)"
1061
+ >
1062
+ </div>
1063
+ }
1064
+ </div>
1065
+
1066
+ <!-- Vertical column lines -->
1067
+ <div class="k-gantt-columns">
1068
+ @for (col of headerColumns(); track col.x) {
1069
+ <div
1070
+ class="k-gantt-column"
1071
+ [style.left.px]="col.x"
1072
+ [style.width.px]="col.width"
1073
+ [style.height.px]="totalHeight()"
1074
+ [class.k-weekend-col]="col.isWeekend"
1075
+ >
1076
+ </div>
1077
+ }
1078
+ </div>
1079
+
1080
+ <!-- Today marker -->
1081
+ @if (mergedConfig().showTodayMarker && todayX() !== null) {
1082
+ <div
1083
+ class="k-today-marker"
1084
+ [style.left.px]="todayX()"
1085
+ [style.height.px]="totalHeight()"
1086
+ >
1087
+ <div class="k-today-indicator"></div>
1088
+ </div>
1089
+ }
1090
+
1091
+ <!-- Task bars layer -->
1092
+ <div class="k-gantt-tasks">
1093
+ @for (bar of taskBars(); track bar.task.id) {
1094
+ <div
1095
+ class="k-task-wrap"
1096
+ [style.top.px]="bar.top"
1097
+ [style.height.px]="mergedConfig().rowHeight"
1098
+ >
1099
+ @if (bar.task.isMilestone) {
1100
+ <!-- Milestone diamond -->
1101
+ <div
1102
+ class="k-milestone"
1103
+ [style.left.px]="bar.left - 8"
1104
+ [class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
1105
+ [class.k-selected]="selectedTaskId() === bar.task.id"
1106
+ (click)="onTaskBarClick(bar.task, $event)"
1107
+ (dblclick)="onTaskBarDblClick(bar.task, $event)"
1108
+ tabindex="0"
1109
+ [attr.aria-label]="'Milestone: ' + bar.task.name"
1110
+ >
1111
+ <div class="k-milestone-diamond" [style.background]="bar.task.color || null"></div>
1112
+ </div>
1113
+ } @else if (bar.isSummary) {
1114
+ <!-- Summary bar (parent task) -->
1115
+ <div
1116
+ class="k-task-summary"
1117
+ [style.left.px]="bar.left"
1118
+ [style.width.px]="bar.width"
1119
+ [class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
1120
+ [class.k-selected]="selectedTaskId() === bar.task.id"
1121
+ (click)="onTaskBarClick(bar.task, $event)"
1122
+ (dblclick)="onTaskBarDblClick(bar.task, $event)"
1123
+ tabindex="0"
1124
+ [attr.aria-label]="bar.task.name + ' - ' + bar.task.progress + '% complete'"
1125
+ >
1126
+ <div class="k-summary-bar">
1127
+ <div class="k-summary-progress" [style.width.%]="bar.task.progress"></div>
1128
+ </div>
1129
+ <div class="k-summary-left-cap"></div>
1130
+ <div class="k-summary-right-cap"></div>
1131
+ </div>
1132
+ } @else {
1133
+ <!-- Regular task bar -->
1134
+ <div
1135
+ class="k-task"
1136
+ [style.left.px]="bar.left"
1137
+ [style.width.px]="bar.width"
1138
+ [style.background]="bar.task.color || null"
1139
+ [class.k-focused]="keyboardService.focusedTaskId() === bar.task.id"
1140
+ [class.k-selected]="selectedTaskId() === bar.task.id"
1141
+ (pointerdown)="onBarPointerDown($event, bar.task, 'move')"
1142
+ (click)="onTaskBarClick(bar.task, $event)"
1143
+ (dblclick)="onTaskBarDblClick(bar.task, $event)"
1144
+ tabindex="0"
1145
+ role="img"
1146
+ [attr.aria-label]="bar.task.name + ' - ' + bar.task.progress + '% complete'"
1147
+ >
1148
+ <!-- Progress fill -->
1149
+ <div class="k-task-progress" [style.width.%]="bar.task.progress">
1150
+ <div class="k-task-progress-inner"></div>
1151
+ </div>
1152
+ <!-- Task text -->
1153
+ <span class="k-task-text">{{ bar.task.name }}</span>
1154
+ <!-- Resize handles -->
1155
+ @if (bar.task.draggable !== false) {
1156
+ <div class="k-resize-handle k-resize-w" (pointerdown)="onBarPointerDown($event, bar.task, 'resize-left')"></div>
1157
+ <div class="k-resize-handle k-resize-e" (pointerdown)="onBarPointerDown($event, bar.task, 'resize-right')"></div>
1158
+ }
1159
+ </div>
1160
+ }
1161
+ </div>
1162
+ }
1163
+ </div>
1164
+
1165
+ <!-- Dependency arrows (SVG overlay) -->
1166
+ <svg class="k-gantt-dependencies" [attr.width]="totalWidth()" [attr.height]="totalHeight()">
1167
+ <defs>
1168
+ <marker id="k-arrowhead" markerWidth="10" markerHeight="7" refX="10" refY="3.5" orient="auto">
1169
+ <polygon points="0 0, 10 3.5, 0 7" fill="var(--ngx-gantt-arrow-color, #ff6358)"/>
1170
+ </marker>
1171
+ </defs>
1172
+ @for (dep of dependencyPaths(); track dep.key) {
1173
+ <path
1174
+ class="k-dep-line"
1175
+ [attr.d]="dep.path"
1176
+ [attr.stroke]="dep.dependency.color || null"
1177
+ marker-end="url(#k-arrowhead)"
1178
+ (click)="onDependencyClick(dep.dependency, $event)"
1179
+ />
1180
+ }
1181
+ </svg>
1182
+
1183
+ </div>
1184
+ </div>
1185
+ </div>
1186
+ </div>
1187
+ `, 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-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}\n"] }]
1188
+ }] });
1189
+
1190
+ // Shared chart utilities and constants
1191
+ const CHART_COLORS = [
1192
+ '#4a90d9', '#ff6358', '#27ae60', '#f39c12', '#8e44ad',
1193
+ '#1abc9c', '#e74c3c', '#3498db', '#2ecc71', '#e67e22',
1194
+ ];
1195
+ /** Map a value [min..max] → [rangeMin..rangeMax] */
1196
+ function scale(value, min, max, rangeMin, rangeMax) {
1197
+ if (max === min)
1198
+ return rangeMin;
1199
+ return rangeMin + ((value - min) / (max - min)) * (rangeMax - rangeMin);
1200
+ }
1201
+ /** Compute nice axis ticks for a range */
1202
+ function niceTicks(min, max, count = 5) {
1203
+ if (min === max)
1204
+ return [min];
1205
+ const range = max - min;
1206
+ const step = niceStep(range / count);
1207
+ const start = Math.floor(min / step) * step;
1208
+ const ticks = [];
1209
+ for (let v = start; v <= max + step * 0.01; v += step) {
1210
+ ticks.push(parseFloat(v.toFixed(10)));
1211
+ }
1212
+ return ticks;
1213
+ }
1214
+ function niceStep(step) {
1215
+ const mag = Math.pow(10, Math.floor(Math.log10(step)));
1216
+ const frac = step / mag;
1217
+ if (frac < 1.5)
1218
+ return mag;
1219
+ if (frac < 3)
1220
+ return 2 * mag;
1221
+ if (frac < 7)
1222
+ return 5 * mag;
1223
+ return 10 * mag;
1224
+ }
1225
+ /** Smooth bezier path through points */
1226
+ function smoothPath(points) {
1227
+ if (points.length < 2)
1228
+ return '';
1229
+ let d = `M ${points[0][0]} ${points[0][1]}`;
1230
+ for (let i = 1; i < points.length; i++) {
1231
+ const prev = points[i - 1];
1232
+ const curr = points[i];
1233
+ const cpx = (prev[0] + curr[0]) / 2;
1234
+ d += ` C ${cpx} ${prev[1]}, ${cpx} ${curr[1]}, ${curr[0]} ${curr[1]}`;
1235
+ }
1236
+ return d;
1237
+ }
1238
+ /** Format number for display */
1239
+ function fmtNum(n) {
1240
+ if (Math.abs(n) >= 1_000_000)
1241
+ return (n / 1_000_000).toFixed(1) + 'M';
1242
+ if (Math.abs(n) >= 1_000)
1243
+ return (n / 1_000).toFixed(1) + 'K';
1244
+ return n % 1 === 0 ? n.toString() : n.toFixed(1);
1245
+ }
1246
+
1247
+ class BarChartComponent {
1248
+ PAD_LEFT = 48;
1249
+ PAD_TOP = 12;
1250
+ PAD_RIGHT = 16;
1251
+ PAD_BOTTOM = 32;
1252
+ series = input([]);
1253
+ categories = input([]);
1254
+ height = input(260);
1255
+ showGrid = input(true);
1256
+ showLabels = input(false);
1257
+ showLegend = input(true);
1258
+ colors = input(CHART_COLORS);
1259
+ tooltip = signal(null);
1260
+ chartHeight = computed(() => this.height());
1261
+ svgEl = viewChild('svgEl');
1262
+ innerW = computed(() => 600 - this.PAD_LEFT - this.PAD_RIGHT);
1263
+ innerH = computed(() => this.chartHeight() - this.PAD_TOP - this.PAD_BOTTOM);
1264
+ allValues = computed(() => this.series().flatMap(s => s.data.filter(v => v != null)));
1265
+ yMin = computed(() => Math.min(0, ...this.allValues()));
1266
+ yMax = computed(() => Math.max(1, ...this.allValues()));
1267
+ yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
1268
+ yPos(v) {
1269
+ return scale(v, this.yMin(), this.yMax(), this.innerH(), 0);
1270
+ }
1271
+ barY(v) { return Math.min(this.yPos(0), this.yPos(v)); }
1272
+ barH(v) { return Math.abs(this.yPos(0) - this.yPos(v)); }
1273
+ groupW = computed(() => this.categories().length > 0 ? this.innerW() / this.categories().length : 0);
1274
+ singleBarWidth = computed(() => {
1275
+ const n = this.series().length || 1;
1276
+ return Math.max(4, (this.groupW() - 8) / n);
1277
+ });
1278
+ catMidX(i) { return i * this.groupW() + this.groupW() / 2; }
1279
+ barX(ci, si) {
1280
+ const n = this.series().length;
1281
+ const gx = ci * this.groupW() + 4;
1282
+ return gx + si * this.singleBarWidth();
1283
+ }
1284
+ seriesColor(i) { return this.colors()[i % this.colors().length]; }
1285
+ barColor(si, s) { return s.color || this.seriesColor(si); }
1286
+ onBarHover(event, seriesName, cat, value) {
1287
+ const rect = event.target.closest('.ngx-bar-chart').getBoundingClientRect();
1288
+ const el = event.target.closest('.ngx-bar-chart');
1289
+ const elRect = el.getBoundingClientRect();
1290
+ this.tooltip.set({
1291
+ x: event.clientX - elRect.left,
1292
+ y: event.clientY - elRect.top,
1293
+ cat, series: seriesName, value,
1294
+ });
1295
+ }
1296
+ onMouseMove(event) { }
1297
+ fmtNum = fmtNum;
1298
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: BarChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1299
+ 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: `
1300
+ <div class="ngx-bar-chart">
1301
+ <!-- Legend -->
1302
+ @if (showLegend()) {
1303
+ <div class="chart-legend">
1304
+ @for (s of series(); track s.name; let i = $index) {
1305
+ <span class="legend-item">
1306
+ <span class="legend-dot" [style.background]="seriesColor(i)"></span>
1307
+ {{ s.name }}
1308
+ </span>
1309
+ }
1310
+ </div>
1311
+ }
1312
+ <!-- SVG Chart -->
1313
+ <svg
1314
+ [attr.width]="'100%'"
1315
+ [attr.height]="chartHeight()"
1316
+ class="chart-svg"
1317
+ (mousemove)="onMouseMove($event)"
1318
+ (mouseleave)="tooltip.set(null)"
1319
+ >
1320
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
1321
+
1322
+ <!-- Y axis grid lines + labels -->
1323
+ @for (tick of yTicks(); track tick) {
1324
+ <g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
1325
+ @if (showGrid()) {
1326
+ <line
1327
+ [attr.x1]="0" [attr.x2]="innerW()"
1328
+ stroke="var(--ngx-chart-grid, #ebedf0)" stroke-dasharray="3,3"
1329
+ />
1330
+ }
1331
+ <text x="-8" dy="4" class="axis-label" text-anchor="end">{{ fmtNum(tick) }}</text>
1332
+ </g>
1333
+ }
1334
+
1335
+ <!-- X axis category labels -->
1336
+ @for (cat of categories(); track cat; let i = $index) {
1337
+ <text
1338
+ [attr.x]="catMidX(i)"
1339
+ [attr.y]="innerH() + 16"
1340
+ class="axis-label"
1341
+ text-anchor="middle"
1342
+ >{{ cat }}</text>
1343
+ }
1344
+
1345
+ <!-- Bars -->
1346
+ @for (s of series(); track s.name; let si = $index) {
1347
+ @for (v of s.data; track $index; let ci = $index) {
1348
+ @if (v !== null && v !== undefined) {
1349
+ <rect
1350
+ [attr.x]="barX(ci, si)"
1351
+ [attr.y]="barY(v)"
1352
+ [attr.width]="singleBarWidth()"
1353
+ [attr.height]="barH(v)"
1354
+ [attr.fill]="barColor(si, s)"
1355
+ [attr.rx]="3"
1356
+ class="bar-rect"
1357
+ (mouseenter)="onBarHover($event, s.name, categories()[ci], v)"
1358
+ />
1359
+ @if (showLabels()) {
1360
+ <text
1361
+ [attr.x]="barX(ci, si) + singleBarWidth() / 2"
1362
+ [attr.y]="barY(v) - 4"
1363
+ class="bar-label"
1364
+ text-anchor="middle"
1365
+ >{{ fmtNum(v) }}</text>
1366
+ }
1367
+ }
1368
+ }
1369
+ }
1370
+
1371
+ <!-- Axes -->
1372
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
1373
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
1374
+ </g>
1375
+ </svg>
1376
+
1377
+ <!-- Tooltip -->
1378
+ @if (tooltip(); as t) {
1379
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
1380
+ <strong>{{ t.cat }}</strong><br/>
1381
+ {{ t.series }}: {{ fmtNum(t.value) }}
1382
+ </div>
1383
+ }
1384
+ </div>
1385
+ `, 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 });
1386
+ }
1387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: BarChartComponent, decorators: [{
1388
+ type: Component,
1389
+ args: [{ selector: 'ngx-bar-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
1390
+ <div class="ngx-bar-chart">
1391
+ <!-- Legend -->
1392
+ @if (showLegend()) {
1393
+ <div class="chart-legend">
1394
+ @for (s of series(); track s.name; let i = $index) {
1395
+ <span class="legend-item">
1396
+ <span class="legend-dot" [style.background]="seriesColor(i)"></span>
1397
+ {{ s.name }}
1398
+ </span>
1399
+ }
1400
+ </div>
1401
+ }
1402
+ <!-- SVG Chart -->
1403
+ <svg
1404
+ [attr.width]="'100%'"
1405
+ [attr.height]="chartHeight()"
1406
+ class="chart-svg"
1407
+ (mousemove)="onMouseMove($event)"
1408
+ (mouseleave)="tooltip.set(null)"
1409
+ >
1410
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
1411
+
1412
+ <!-- Y axis grid lines + labels -->
1413
+ @for (tick of yTicks(); track tick) {
1414
+ <g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
1415
+ @if (showGrid()) {
1416
+ <line
1417
+ [attr.x1]="0" [attr.x2]="innerW()"
1418
+ stroke="var(--ngx-chart-grid, #ebedf0)" stroke-dasharray="3,3"
1419
+ />
1420
+ }
1421
+ <text x="-8" dy="4" class="axis-label" text-anchor="end">{{ fmtNum(tick) }}</text>
1422
+ </g>
1423
+ }
1424
+
1425
+ <!-- X axis category labels -->
1426
+ @for (cat of categories(); track cat; let i = $index) {
1427
+ <text
1428
+ [attr.x]="catMidX(i)"
1429
+ [attr.y]="innerH() + 16"
1430
+ class="axis-label"
1431
+ text-anchor="middle"
1432
+ >{{ cat }}</text>
1433
+ }
1434
+
1435
+ <!-- Bars -->
1436
+ @for (s of series(); track s.name; let si = $index) {
1437
+ @for (v of s.data; track $index; let ci = $index) {
1438
+ @if (v !== null && v !== undefined) {
1439
+ <rect
1440
+ [attr.x]="barX(ci, si)"
1441
+ [attr.y]="barY(v)"
1442
+ [attr.width]="singleBarWidth()"
1443
+ [attr.height]="barH(v)"
1444
+ [attr.fill]="barColor(si, s)"
1445
+ [attr.rx]="3"
1446
+ class="bar-rect"
1447
+ (mouseenter)="onBarHover($event, s.name, categories()[ci], v)"
1448
+ />
1449
+ @if (showLabels()) {
1450
+ <text
1451
+ [attr.x]="barX(ci, si) + singleBarWidth() / 2"
1452
+ [attr.y]="barY(v) - 4"
1453
+ class="bar-label"
1454
+ text-anchor="middle"
1455
+ >{{ fmtNum(v) }}</text>
1456
+ }
1457
+ }
1458
+ }
1459
+ }
1460
+
1461
+ <!-- Axes -->
1462
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
1463
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
1464
+ </g>
1465
+ </svg>
1466
+
1467
+ <!-- Tooltip -->
1468
+ @if (tooltip(); as t) {
1469
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
1470
+ <strong>{{ t.cat }}</strong><br/>
1471
+ {{ t.series }}: {{ fmtNum(t.value) }}
1472
+ </div>
1473
+ }
1474
+ </div>
1475
+ `, 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"] }]
1476
+ }] });
1477
+
1478
+ class LineChartComponent {
1479
+ PAD_LEFT = 48;
1480
+ PAD_TOP = 12;
1481
+ PAD_RIGHT = 16;
1482
+ PAD_BOTTOM = 32;
1483
+ series = input([]);
1484
+ categories = input([]);
1485
+ height = input(260);
1486
+ showGrid = input(true);
1487
+ showArea = input(false);
1488
+ showMarkers = input(true);
1489
+ showLegend = input(true);
1490
+ colors = input(CHART_COLORS);
1491
+ crosshair = signal(null);
1492
+ tooltip = signal(null);
1493
+ chartHeight = computed(() => this.height());
1494
+ innerW = computed(() => 600 - this.PAD_LEFT - this.PAD_RIGHT);
1495
+ innerH = computed(() => this.chartHeight() - this.PAD_TOP - this.PAD_BOTTOM);
1496
+ allValues = computed(() => this.series().flatMap(s => s.data));
1497
+ yMin = computed(() => Math.min(0, ...this.allValues()));
1498
+ yMax = computed(() => Math.max(1, ...this.allValues()));
1499
+ yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
1500
+ yPos(v) { return scale(v, this.yMin(), this.yMax(), this.innerH(), 0); }
1501
+ xPos(i) {
1502
+ const n = this.categories().length;
1503
+ return n <= 1 ? this.innerW() / 2 : scale(i, 0, n - 1, 0, this.innerW());
1504
+ }
1505
+ seriesColor(i, s) { return s.color || this.colors()[i % this.colors().length]; }
1506
+ linePath(s) {
1507
+ const pts = s.data.map((v, i) => [this.xPos(i), this.yPos(v)]);
1508
+ return smoothPath(pts);
1509
+ }
1510
+ areaPath(s) {
1511
+ const pts = s.data.map((v, i) => [this.xPos(i), this.yPos(v)]);
1512
+ const line = smoothPath(pts);
1513
+ const last = pts[pts.length - 1];
1514
+ const first = pts[0];
1515
+ return line + ` L ${last[0]} ${this.innerH()} L ${first[0]} ${this.innerH()} Z`;
1516
+ }
1517
+ onMouseMove(event) {
1518
+ const el = event.currentTarget;
1519
+ const rect = el.getBoundingClientRect();
1520
+ const mx = event.clientX - rect.left - this.PAD_LEFT;
1521
+ const cats = this.categories();
1522
+ if (cats.length === 0)
1523
+ return;
1524
+ const idx = Math.round(scale(mx, 0, this.innerW(), 0, cats.length - 1));
1525
+ const ci = Math.max(0, Math.min(cats.length - 1, idx));
1526
+ this.crosshair.set({ x: this.xPos(ci) });
1527
+ const rows = this.series().map((s, si) => ({
1528
+ name: s.name,
1529
+ value: s.data[ci] ?? 0,
1530
+ color: this.seriesColor(si, s),
1531
+ }));
1532
+ this.tooltip.set({
1533
+ x: event.clientX - rect.left,
1534
+ y: event.clientY - rect.top,
1535
+ cat: cats[ci],
1536
+ rows,
1537
+ });
1538
+ }
1539
+ fmtNum = fmtNum;
1540
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: LineChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1541
+ 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: `
1542
+ <div class="ngx-line-chart" (mousemove)="onMouseMove($event)" (mouseleave)="crosshair.set(null)">
1543
+ @if (showLegend()) {
1544
+ <div class="chart-legend">
1545
+ @for (s of series(); track s.name; let i = $index) {
1546
+ <span class="legend-item">
1547
+ <span class="legend-line" [style.background]="seriesColor(i, s)"></span>
1548
+ {{ s.name }}
1549
+ </span>
1550
+ }
1551
+ </div>
1552
+ }
1553
+ <svg [attr.width]="'100%'" [attr.height]="chartHeight()" class="chart-svg">
1554
+ <defs>
1555
+ @for (s of series(); track s.name; let i = $index) {
1556
+ <linearGradient [attr.id]="'area-grad-' + i" x1="0" y1="0" x2="0" y2="1">
1557
+ <stop offset="0%" [attr.stop-color]="seriesColor(i, s)" stop-opacity="0.3"/>
1558
+ <stop offset="100%" [attr.stop-color]="seriesColor(i, s)" stop-opacity="0.02"/>
1559
+ </linearGradient>
1560
+ }
1561
+ </defs>
1562
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
1563
+
1564
+ @for (tick of yTicks(); track tick) {
1565
+ <g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
1566
+ @if (showGrid()) {
1567
+ <line [attr.x1]="0" [attr.x2]="innerW()" stroke="var(--ngx-chart-grid,#ebedf0)" stroke-dasharray="3,3"/>
1568
+ }
1569
+ <text x="-8" dy="4" class="axis-label" text-anchor="end">{{ fmtNum(tick) }}</text>
1570
+ </g>
1571
+ }
1572
+
1573
+ @for (cat of categories(); track cat; let i = $index) {
1574
+ <text [attr.x]="xPos(i)" [attr.y]="innerH() + 16" class="axis-label" text-anchor="middle">{{ cat }}</text>
1575
+ }
1576
+
1577
+ @for (s of series(); track s.name; let si = $index) {
1578
+ @if (showArea()) {
1579
+ <path
1580
+ [attr.d]="areaPath(s)"
1581
+ [attr.fill]="'url(#area-grad-' + si + ')'"
1582
+ stroke="none"
1583
+ />
1584
+ }
1585
+ <path
1586
+ [attr.d]="linePath(s)"
1587
+ [attr.stroke]="seriesColor(si, s)"
1588
+ fill="none"
1589
+ stroke-width="2.5"
1590
+ stroke-linejoin="round"
1591
+ stroke-linecap="round"
1592
+ />
1593
+ @if (showMarkers()) {
1594
+ @for (v of s.data; track $index; let ci = $index) {
1595
+ <circle
1596
+ [attr.cx]="xPos(ci)"
1597
+ [attr.cy]="yPos(v)"
1598
+ r="4"
1599
+ [attr.fill]="seriesColor(si, s)"
1600
+ stroke="#fff"
1601
+ stroke-width="2"
1602
+ />
1603
+ }
1604
+ }
1605
+ }
1606
+
1607
+ <!-- Crosshair -->
1608
+ @if (crosshair(); as ch) {
1609
+ <line [attr.x1]="ch.x" [attr.x2]="ch.x" y1="0" [attr.y2]="innerH()"
1610
+ stroke="var(--ngx-chart-axis,#ced4da)" stroke-dasharray="4,3"/>
1611
+ }
1612
+
1613
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
1614
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
1615
+ </g>
1616
+ </svg>
1617
+
1618
+ @if (tooltip(); as t) {
1619
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
1620
+ <div class="tt-cat">{{ t.cat }}</div>
1621
+ @for (row of t.rows; track row.name) {
1622
+ <div class="tt-row">
1623
+ <span class="tt-dot" [style.background]="row.color"></span>
1624
+ {{ row.name }}: <strong>{{ fmtNum(row.value) }}</strong>
1625
+ </div>
1626
+ }
1627
+ </div>
1628
+ }
1629
+ </div>
1630
+ `, 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 });
1631
+ }
1632
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: LineChartComponent, decorators: [{
1633
+ type: Component,
1634
+ args: [{ selector: 'ngx-line-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
1635
+ <div class="ngx-line-chart" (mousemove)="onMouseMove($event)" (mouseleave)="crosshair.set(null)">
1636
+ @if (showLegend()) {
1637
+ <div class="chart-legend">
1638
+ @for (s of series(); track s.name; let i = $index) {
1639
+ <span class="legend-item">
1640
+ <span class="legend-line" [style.background]="seriesColor(i, s)"></span>
1641
+ {{ s.name }}
1642
+ </span>
1643
+ }
1644
+ </div>
1645
+ }
1646
+ <svg [attr.width]="'100%'" [attr.height]="chartHeight()" class="chart-svg">
1647
+ <defs>
1648
+ @for (s of series(); track s.name; let i = $index) {
1649
+ <linearGradient [attr.id]="'area-grad-' + i" x1="0" y1="0" x2="0" y2="1">
1650
+ <stop offset="0%" [attr.stop-color]="seriesColor(i, s)" stop-opacity="0.3"/>
1651
+ <stop offset="100%" [attr.stop-color]="seriesColor(i, s)" stop-opacity="0.02"/>
1652
+ </linearGradient>
1653
+ }
1654
+ </defs>
1655
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
1656
+
1657
+ @for (tick of yTicks(); track tick) {
1658
+ <g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
1659
+ @if (showGrid()) {
1660
+ <line [attr.x1]="0" [attr.x2]="innerW()" stroke="var(--ngx-chart-grid,#ebedf0)" stroke-dasharray="3,3"/>
1661
+ }
1662
+ <text x="-8" dy="4" class="axis-label" text-anchor="end">{{ fmtNum(tick) }}</text>
1663
+ </g>
1664
+ }
1665
+
1666
+ @for (cat of categories(); track cat; let i = $index) {
1667
+ <text [attr.x]="xPos(i)" [attr.y]="innerH() + 16" class="axis-label" text-anchor="middle">{{ cat }}</text>
1668
+ }
1669
+
1670
+ @for (s of series(); track s.name; let si = $index) {
1671
+ @if (showArea()) {
1672
+ <path
1673
+ [attr.d]="areaPath(s)"
1674
+ [attr.fill]="'url(#area-grad-' + si + ')'"
1675
+ stroke="none"
1676
+ />
1677
+ }
1678
+ <path
1679
+ [attr.d]="linePath(s)"
1680
+ [attr.stroke]="seriesColor(si, s)"
1681
+ fill="none"
1682
+ stroke-width="2.5"
1683
+ stroke-linejoin="round"
1684
+ stroke-linecap="round"
1685
+ />
1686
+ @if (showMarkers()) {
1687
+ @for (v of s.data; track $index; let ci = $index) {
1688
+ <circle
1689
+ [attr.cx]="xPos(ci)"
1690
+ [attr.cy]="yPos(v)"
1691
+ r="4"
1692
+ [attr.fill]="seriesColor(si, s)"
1693
+ stroke="#fff"
1694
+ stroke-width="2"
1695
+ />
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ <!-- Crosshair -->
1701
+ @if (crosshair(); as ch) {
1702
+ <line [attr.x1]="ch.x" [attr.x2]="ch.x" y1="0" [attr.y2]="innerH()"
1703
+ stroke="var(--ngx-chart-axis,#ced4da)" stroke-dasharray="4,3"/>
1704
+ }
1705
+
1706
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
1707
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
1708
+ </g>
1709
+ </svg>
1710
+
1711
+ @if (tooltip(); as t) {
1712
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
1713
+ <div class="tt-cat">{{ t.cat }}</div>
1714
+ @for (row of t.rows; track row.name) {
1715
+ <div class="tt-row">
1716
+ <span class="tt-dot" [style.background]="row.color"></span>
1717
+ {{ row.name }}: <strong>{{ fmtNum(row.value) }}</strong>
1718
+ </div>
1719
+ }
1720
+ </div>
1721
+ }
1722
+ </div>
1723
+ `, 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"] }]
1724
+ }] });
1725
+
1726
+ class PieChartComponent {
1727
+ data = input([]);
1728
+ mode = input('pie');
1729
+ donutHoleSize = input(0.55);
1730
+ height = input(240);
1731
+ showLegend = input(true);
1732
+ showLabels = input(true);
1733
+ colors = input(CHART_COLORS);
1734
+ centerTitle = input('Total');
1735
+ colors$ = this.colors;
1736
+ hovered = signal(-1);
1737
+ tooltip = signal(null);
1738
+ svgSize = computed(() => this.height());
1739
+ cx = computed(() => this.svgSize() / 2);
1740
+ cy = computed(() => this.svgSize() / 2);
1741
+ radius = computed(() => this.svgSize() / 2 - 10);
1742
+ holeR = computed(() => this.radius() * this.donutHoleSize());
1743
+ centerValue = computed(() => {
1744
+ const total = this.data().reduce((s, d) => s + d.value, 0);
1745
+ return fmtNum(total);
1746
+ });
1747
+ slices = computed(() => {
1748
+ const d = this.data();
1749
+ const total = d.reduce((s, x) => s + x.value, 0) || 1;
1750
+ let start = -Math.PI / 2;
1751
+ return d.map((item, i) => {
1752
+ const frac = item.value / total;
1753
+ const angle = frac * Math.PI * 2;
1754
+ const end = start + angle;
1755
+ const mid = start + angle / 2;
1756
+ const r = this.radius();
1757
+ const path = this.arcPath(start, end, r);
1758
+ start = end;
1759
+ return {
1760
+ index: i,
1761
+ label: item.label,
1762
+ value: item.value,
1763
+ pct: Math.round(frac * 100),
1764
+ color: item.color || this.colors()[i % this.colors().length],
1765
+ path,
1766
+ midAngle: mid,
1767
+ };
1768
+ });
1769
+ });
1770
+ arcPath(startAngle, endAngle, r) {
1771
+ const x1 = Math.cos(startAngle) * r;
1772
+ const y1 = Math.sin(startAngle) * r;
1773
+ const x2 = Math.cos(endAngle) * r;
1774
+ const y2 = Math.sin(endAngle) * r;
1775
+ const large = endAngle - startAngle > Math.PI ? 1 : 0;
1776
+ return `M 0 0 L ${x1} ${y1} A ${r} ${r} 0 ${large} 1 ${x2} ${y2} Z`;
1777
+ }
1778
+ labelX(s) { return Math.cos(s.midAngle) * this.radius() * 0.7; }
1779
+ labelY(s) { return Math.sin(s.midAngle) * this.radius() * 0.7; }
1780
+ onSliceHover(event, slice) {
1781
+ const el = event.currentTarget.closest('.ngx-pie-chart');
1782
+ const rect = el.getBoundingClientRect();
1783
+ this.tooltip.set({
1784
+ x: event.clientX - rect.left,
1785
+ y: event.clientY - rect.top,
1786
+ ...slice,
1787
+ });
1788
+ }
1789
+ fmtNum = fmtNum;
1790
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1791
+ 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: `
1792
+ <div class="ngx-pie-chart">
1793
+ <div class="chart-body">
1794
+ <svg class="chart-svg" [attr.width]="svgSize()" [attr.height]="svgSize()">
1795
+ <g [attr.transform]="'translate(' + cx() + ',' + cy() + ')'">
1796
+ @for (slice of slices(); track slice.index) {
1797
+ <path
1798
+ [attr.d]="slice.path"
1799
+ [attr.fill]="slice.color"
1800
+ [attr.stroke]="'#fff'"
1801
+ stroke-width="2"
1802
+ class="pie-slice"
1803
+ [class.hovered]="hovered() === slice.index"
1804
+ (mouseenter)="hovered.set(slice.index); onSliceHover($event, slice)"
1805
+ (mouseleave)="hovered.set(-1); tooltip.set(null)"
1806
+ />
1807
+ @if (showLabels() && slice.midAngle !== null) {
1808
+ <text
1809
+ [attr.x]="labelX(slice)"
1810
+ [attr.y]="labelY(slice)"
1811
+ text-anchor="middle"
1812
+ dominant-baseline="middle"
1813
+ class="slice-label"
1814
+ >{{ slice.pct }}%</text>
1815
+ }
1816
+ }
1817
+ <!-- Donut hole -->
1818
+ @if (mode() === 'donut') {
1819
+ <circle [attr.r]="holeR()" fill="var(--ngx-chart-bg,#fff)"/>
1820
+ <text class="donut-center-text" text-anchor="middle" dy="-8">{{ centerTitle() }}</text>
1821
+ <text class="donut-center-value" text-anchor="middle" dy="14">{{ centerValue() }}</text>
1822
+ }
1823
+ </g>
1824
+ </svg>
1825
+
1826
+ @if (showLegend()) {
1827
+ <div class="chart-legend">
1828
+ @for (slice of slices(); track slice.index) {
1829
+ <div class="legend-item" (mouseenter)="hovered.set(slice.index)" (mouseleave)="hovered.set(-1)">
1830
+ <span class="legend-dot" [style.background]="slice.color"></span>
1831
+ <span class="legend-label">{{ slice.label }}</span>
1832
+ <span class="legend-pct">{{ slice.pct }}%</span>
1833
+ </div>
1834
+ }
1835
+ </div>
1836
+ }
1837
+ </div>
1838
+
1839
+ @if (tooltip(); as t) {
1840
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
1841
+ <span class="tt-dot" [style.background]="t.color"></span>
1842
+ <strong>{{ t.label }}</strong>: {{ fmtNum(t.value) }} ({{ t.pct }}%)
1843
+ </div>
1844
+ }
1845
+ </div>
1846
+ `, 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 });
1847
+ }
1848
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PieChartComponent, decorators: [{
1849
+ type: Component,
1850
+ args: [{ selector: 'ngx-pie-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
1851
+ <div class="ngx-pie-chart">
1852
+ <div class="chart-body">
1853
+ <svg class="chart-svg" [attr.width]="svgSize()" [attr.height]="svgSize()">
1854
+ <g [attr.transform]="'translate(' + cx() + ',' + cy() + ')'">
1855
+ @for (slice of slices(); track slice.index) {
1856
+ <path
1857
+ [attr.d]="slice.path"
1858
+ [attr.fill]="slice.color"
1859
+ [attr.stroke]="'#fff'"
1860
+ stroke-width="2"
1861
+ class="pie-slice"
1862
+ [class.hovered]="hovered() === slice.index"
1863
+ (mouseenter)="hovered.set(slice.index); onSliceHover($event, slice)"
1864
+ (mouseleave)="hovered.set(-1); tooltip.set(null)"
1865
+ />
1866
+ @if (showLabels() && slice.midAngle !== null) {
1867
+ <text
1868
+ [attr.x]="labelX(slice)"
1869
+ [attr.y]="labelY(slice)"
1870
+ text-anchor="middle"
1871
+ dominant-baseline="middle"
1872
+ class="slice-label"
1873
+ >{{ slice.pct }}%</text>
1874
+ }
1875
+ }
1876
+ <!-- Donut hole -->
1877
+ @if (mode() === 'donut') {
1878
+ <circle [attr.r]="holeR()" fill="var(--ngx-chart-bg,#fff)"/>
1879
+ <text class="donut-center-text" text-anchor="middle" dy="-8">{{ centerTitle() }}</text>
1880
+ <text class="donut-center-value" text-anchor="middle" dy="14">{{ centerValue() }}</text>
1881
+ }
1882
+ </g>
1883
+ </svg>
1884
+
1885
+ @if (showLegend()) {
1886
+ <div class="chart-legend">
1887
+ @for (slice of slices(); track slice.index) {
1888
+ <div class="legend-item" (mouseenter)="hovered.set(slice.index)" (mouseleave)="hovered.set(-1)">
1889
+ <span class="legend-dot" [style.background]="slice.color"></span>
1890
+ <span class="legend-label">{{ slice.label }}</span>
1891
+ <span class="legend-pct">{{ slice.pct }}%</span>
1892
+ </div>
1893
+ }
1894
+ </div>
1895
+ }
1896
+ </div>
1897
+
1898
+ @if (tooltip(); as t) {
1899
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
1900
+ <span class="tt-dot" [style.background]="t.color"></span>
1901
+ <strong>{{ t.label }}</strong>: {{ fmtNum(t.value) }} ({{ t.pct }}%)
1902
+ </div>
1903
+ }
1904
+ </div>
1905
+ `, 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"] }]
1906
+ }] });
1907
+
1908
+ class SparklineComponent {
1909
+ data = input([]);
1910
+ type = input('line');
1911
+ color = input(CHART_COLORS[0]);
1912
+ width = input(120);
1913
+ height = input(36);
1914
+ PAD = 2;
1915
+ w = computed(() => this.width() - this.PAD * 2);
1916
+ h = computed(() => this.height() - this.PAD * 2);
1917
+ yMin = computed(() => Math.min(...this.data(), 0));
1918
+ yMax = computed(() => Math.max(...this.data(), 1));
1919
+ pts = computed(() => {
1920
+ const d = this.data();
1921
+ const n = d.length;
1922
+ if (n === 0)
1923
+ return [];
1924
+ return d.map((v, i) => [
1925
+ this.PAD + scale(i, 0, Math.max(n - 1, 1), 0, this.w()),
1926
+ this.PAD + scale(v, this.yMin(), this.yMax(), this.h(), 0),
1927
+ ]);
1928
+ });
1929
+ linePath = computed(() => smoothPath(this.pts()));
1930
+ areaPath = computed(() => {
1931
+ const pts = this.pts();
1932
+ if (pts.length < 2)
1933
+ return '';
1934
+ const line = smoothPath(pts);
1935
+ const last = pts[pts.length - 1];
1936
+ const first = pts[0];
1937
+ const bottom = this.PAD + this.h();
1938
+ return line + ` L ${last[0]} ${bottom} L ${first[0]} ${bottom} Z`;
1939
+ });
1940
+ areaFill = computed(() => this.color() + '22');
1941
+ endPoint = computed(() => {
1942
+ const pts = this.pts();
1943
+ return pts.length > 0 ? pts[pts.length - 1] : null;
1944
+ });
1945
+ barItems = computed(() => {
1946
+ const d = this.data();
1947
+ const n = d.length;
1948
+ if (n === 0)
1949
+ return [];
1950
+ const bw = Math.max(2, this.w() / n - 1);
1951
+ const zero = this.PAD + scale(0, this.yMin(), this.yMax(), this.h(), 0);
1952
+ return d.map((v, i) => {
1953
+ const x = this.PAD + scale(i, 0, Math.max(n - 1, 1), 0, this.w()) - bw / 2;
1954
+ const y = this.PAD + scale(v, this.yMin(), this.yMax(), this.h(), 0);
1955
+ return { x, y, w: bw, h: Math.abs(zero - y) };
1956
+ });
1957
+ });
1958
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SparklineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1959
+ 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: `
1960
+ <svg
1961
+ [attr.width]="width()"
1962
+ [attr.height]="height()"
1963
+ class="ngx-sparkline"
1964
+ [attr.aria-label]="'Sparkline'"
1965
+ >
1966
+ @if (type() === 'line' || type() === 'area') {
1967
+ @if (type() === 'area') {
1968
+ <path [attr.d]="areaPath()" [attr.fill]="areaFill()" stroke="none"/>
1969
+ }
1970
+ <path
1971
+ [attr.d]="linePath()"
1972
+ [attr.stroke]="color()"
1973
+ fill="none"
1974
+ stroke-width="2"
1975
+ stroke-linejoin="round"
1976
+ stroke-linecap="round"
1977
+ />
1978
+ <!-- End dot -->
1979
+ @if (endPoint(); as ep) {
1980
+ <circle [attr.cx]="ep[0]" [attr.cy]="ep[1]" r="3" [attr.fill]="color()"/>
1981
+ }
1982
+ }
1983
+ @if (type() === 'bar') {
1984
+ @for (item of barItems(); track $index) {
1985
+ <rect
1986
+ [attr.x]="item.x"
1987
+ [attr.y]="item.y"
1988
+ [attr.width]="item.w"
1989
+ [attr.height]="item.h"
1990
+ [attr.fill]="color()"
1991
+ [attr.rx]="1"
1992
+ opacity="0.85"
1993
+ />
1994
+ }
1995
+ }
1996
+ </svg>
1997
+ `, isInline: true, styles: [":host{display:inline-block}.ngx-sparkline{display:block}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1998
+ }
1999
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SparklineComponent, decorators: [{
2000
+ type: Component,
2001
+ args: [{ selector: 'ngx-sparkline', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
2002
+ <svg
2003
+ [attr.width]="width()"
2004
+ [attr.height]="height()"
2005
+ class="ngx-sparkline"
2006
+ [attr.aria-label]="'Sparkline'"
2007
+ >
2008
+ @if (type() === 'line' || type() === 'area') {
2009
+ @if (type() === 'area') {
2010
+ <path [attr.d]="areaPath()" [attr.fill]="areaFill()" stroke="none"/>
2011
+ }
2012
+ <path
2013
+ [attr.d]="linePath()"
2014
+ [attr.stroke]="color()"
2015
+ fill="none"
2016
+ stroke-width="2"
2017
+ stroke-linejoin="round"
2018
+ stroke-linecap="round"
2019
+ />
2020
+ <!-- End dot -->
2021
+ @if (endPoint(); as ep) {
2022
+ <circle [attr.cx]="ep[0]" [attr.cy]="ep[1]" r="3" [attr.fill]="color()"/>
2023
+ }
2024
+ }
2025
+ @if (type() === 'bar') {
2026
+ @for (item of barItems(); track $index) {
2027
+ <rect
2028
+ [attr.x]="item.x"
2029
+ [attr.y]="item.y"
2030
+ [attr.width]="item.w"
2031
+ [attr.height]="item.h"
2032
+ [attr.fill]="color()"
2033
+ [attr.rx]="1"
2034
+ opacity="0.85"
2035
+ />
2036
+ }
2037
+ }
2038
+ </svg>
2039
+ `, styles: [":host{display:inline-block}.ngx-sparkline{display:block}\n"] }]
2040
+ }] });
2041
+
2042
+ class TextBoxComponent {
2043
+ value = input('');
2044
+ label = input('');
2045
+ placeholder = input('');
2046
+ type = input('text');
2047
+ disabled = input(false);
2048
+ readonly = input(false);
2049
+ error = input('');
2050
+ hint = input('');
2051
+ valueChange = output();
2052
+ focusChange = output();
2053
+ isFocused = signal(false);
2054
+ onInput(e) {
2055
+ this.valueChange.emit(e.target.value);
2056
+ }
2057
+ onFocus() {
2058
+ this.isFocused.set(true);
2059
+ this.focusChange.emit(true);
2060
+ }
2061
+ onBlur() {
2062
+ this.isFocused.set(false);
2063
+ this.focusChange.emit(false);
2064
+ }
2065
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2066
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TextBoxComponent, isStandalone: true, selector: "ngx-textbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", focusChange: "focusChange" }, ngImport: i0, template: `
2067
+ <div class="ngx-textbox" [class.focused]="isFocused()" [class.has-error]="!!error()" [class.disabled]="disabled()">
2068
+ @if (label()) {
2069
+ <label class="ngx-textbox-label" [class.floating]="isFocused() || !!value()">{{ label() }}</label>
2070
+ }
2071
+ <div class="ngx-textbox-wrap">
2072
+ <input
2073
+ class="ngx-textbox-input"
2074
+ [type]="type()"
2075
+ [value]="value()"
2076
+ [placeholder]="isFocused() || !label() ? placeholder() : ''"
2077
+ [disabled]="disabled()"
2078
+ [readOnly]="readonly()"
2079
+ [attr.aria-invalid]="!!error()"
2080
+ (input)="onInput($event)"
2081
+ (focus)="onFocus()"
2082
+ (blur)="onBlur()"
2083
+ />
2084
+ </div>
2085
+ @if (error()) {
2086
+ <div class="ngx-textbox-error">{{ error() }}</div>
2087
+ } @else if (hint()) {
2088
+ <div class="ngx-textbox-hint">{{ hint() }}</div>
2089
+ }
2090
+ </div>
2091
+ `, isInline: true, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500;transition:all .15s}.ngx-textbox-wrap{position:relative;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 2px #e74c3c2e}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed}.ngx-textbox-input{display:block;width:100%;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2092
+ }
2093
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextBoxComponent, decorators: [{
2094
+ type: Component,
2095
+ args: [{ selector: 'ngx-textbox', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
2096
+ <div class="ngx-textbox" [class.focused]="isFocused()" [class.has-error]="!!error()" [class.disabled]="disabled()">
2097
+ @if (label()) {
2098
+ <label class="ngx-textbox-label" [class.floating]="isFocused() || !!value()">{{ label() }}</label>
2099
+ }
2100
+ <div class="ngx-textbox-wrap">
2101
+ <input
2102
+ class="ngx-textbox-input"
2103
+ [type]="type()"
2104
+ [value]="value()"
2105
+ [placeholder]="isFocused() || !label() ? placeholder() : ''"
2106
+ [disabled]="disabled()"
2107
+ [readOnly]="readonly()"
2108
+ [attr.aria-invalid]="!!error()"
2109
+ (input)="onInput($event)"
2110
+ (focus)="onFocus()"
2111
+ (blur)="onBlur()"
2112
+ />
2113
+ </div>
2114
+ @if (error()) {
2115
+ <div class="ngx-textbox-error">{{ error() }}</div>
2116
+ } @else if (hint()) {
2117
+ <div class="ngx-textbox-hint">{{ hint() }}</div>
2118
+ }
2119
+ </div>
2120
+ `, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500;transition:all .15s}.ngx-textbox-wrap{position:relative;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 2px #e74c3c2e}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed}.ngx-textbox-input{display:block;width:100%;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}\n"] }]
2121
+ }] });
2122
+
2123
+ class DropdownComponent {
2124
+ options = input([]);
2125
+ value = input(null);
2126
+ label = input('');
2127
+ placeholder = input('Select...');
2128
+ disabled = input(false);
2129
+ filterable = input(false);
2130
+ valueChange = output();
2131
+ isOpen = signal(false);
2132
+ filterText = signal('');
2133
+ focusedIndex = signal(-1);
2134
+ el = inject(ElementRef);
2135
+ selectedLabel = computed(() => {
2136
+ const opt = this.options().find(o => o.value === this.value());
2137
+ return opt?.label ?? '';
2138
+ });
2139
+ filteredOptions = computed(() => {
2140
+ const f = this.filterText().toLowerCase();
2141
+ return f ? this.options().filter(o => o.label.toLowerCase().includes(f)) : this.options();
2142
+ });
2143
+ isSelected(opt) { return opt.value === this.value(); }
2144
+ toggle() {
2145
+ if (this.disabled())
2146
+ return;
2147
+ this.isOpen.update(v => !v);
2148
+ if (!this.isOpen())
2149
+ this.filterText.set('');
2150
+ }
2151
+ selectOption(opt) {
2152
+ if (opt.disabled)
2153
+ return;
2154
+ this.valueChange.emit(opt.value);
2155
+ this.isOpen.set(false);
2156
+ this.filterText.set('');
2157
+ }
2158
+ onTriggerKey(e) {
2159
+ if (e.key === 'Enter' || e.key === ' ') {
2160
+ e.preventDefault();
2161
+ this.toggle();
2162
+ }
2163
+ if (e.key === 'Escape')
2164
+ this.isOpen.set(false);
2165
+ if (e.key === 'ArrowDown') {
2166
+ e.preventDefault();
2167
+ if (!this.isOpen())
2168
+ this.isOpen.set(true);
2169
+ else
2170
+ this.moveFocus(1);
2171
+ }
2172
+ if (e.key === 'ArrowUp') {
2173
+ e.preventDefault();
2174
+ this.moveFocus(-1);
2175
+ }
2176
+ }
2177
+ onFilterKey(e) {
2178
+ if (e.key === 'ArrowDown') {
2179
+ e.preventDefault();
2180
+ this.moveFocus(1);
2181
+ }
2182
+ if (e.key === 'ArrowUp') {
2183
+ e.preventDefault();
2184
+ this.moveFocus(-1);
2185
+ }
2186
+ if (e.key === 'Enter') {
2187
+ const opts = this.filteredOptions();
2188
+ const i = this.focusedIndex();
2189
+ if (i >= 0 && i < opts.length)
2190
+ this.selectOption(opts[i]);
2191
+ }
2192
+ if (e.key === 'Escape')
2193
+ this.isOpen.set(false);
2194
+ }
2195
+ moveFocus(delta) {
2196
+ const n = this.filteredOptions().length;
2197
+ this.focusedIndex.update(i => Math.max(0, Math.min(n - 1, i + delta)));
2198
+ }
2199
+ onDocClick(e) {
2200
+ if (!this.el.nativeElement.contains(e.target)) {
2201
+ this.isOpen.set(false);
2202
+ this.filterText.set('');
2203
+ }
2204
+ }
2205
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2206
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DropdownComponent, isStandalone: true, selector: "ngx-dropdown", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocClick($event)" } }, ngImport: i0, template: `
2207
+ <div
2208
+ class="ngx-dropdown"
2209
+ [class.open]="isOpen()"
2210
+ [class.disabled]="disabled()"
2211
+ [attr.aria-expanded]="isOpen()"
2212
+ role="combobox"
2213
+ >
2214
+ @if (label()) {
2215
+ <label class="ngx-dropdown-label">{{ label() }}</label>
2216
+ }
2217
+
2218
+ <!-- Trigger -->
2219
+ <div
2220
+ class="ngx-dropdown-trigger"
2221
+ tabindex="0"
2222
+ (click)="toggle()"
2223
+ (keydown)="onTriggerKey($event)"
2224
+ [attr.aria-label]="selectedLabel() || placeholder()"
2225
+ >
2226
+ <span class="trigger-text" [class.placeholder]="!selectedLabel()">
2227
+ {{ selectedLabel() || placeholder() }}
2228
+ </span>
2229
+ <span class="trigger-arrow" [class.open]="isOpen()">&#9660;</span>
2230
+ </div>
2231
+
2232
+ <!-- Popup -->
2233
+ @if (isOpen()) {
2234
+ <div class="ngx-dropdown-popup" role="listbox">
2235
+ @if (filterable()) {
2236
+ <div class="popup-search">
2237
+ <input
2238
+ #filterInput
2239
+ class="popup-search-input"
2240
+ placeholder="Search..."
2241
+ [value]="filterText()"
2242
+ (input)="filterText.set($any($event.target).value)"
2243
+ (keydown)="onFilterKey($event)"
2244
+ />
2245
+ </div>
2246
+ }
2247
+ <div class="popup-list">
2248
+ @for (opt of filteredOptions(); track opt.value; let i = $index) {
2249
+ <div
2250
+ class="popup-item"
2251
+ [class.selected]="isSelected(opt)"
2252
+ [class.focused]="focusedIndex() === i"
2253
+ [class.disabled]="opt.disabled"
2254
+ role="option"
2255
+ [attr.aria-selected]="isSelected(opt)"
2256
+ (click)="selectOption(opt)"
2257
+ (mouseenter)="focusedIndex.set(i)"
2258
+ >{{ opt.label }}</div>
2259
+ }
2260
+ @if (filteredOptions().length === 0) {
2261
+ <div class="popup-empty">No results</div>
2262
+ }
2263
+ </div>
2264
+ </div>
2265
+ }
2266
+ </div>
2267
+ `, isInline: true, styles: [":host{display:block}.ngx-dropdown{position:relative;font-family:inherit}.ngx-dropdown-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px;transition:border-color .15s,box-shadow .15s}.ngx-dropdown-trigger:hover{border-color:#adb5bd}.open .ngx-dropdown-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ngx-dropdown-trigger{background:#f8f9fa;cursor:not-allowed;color:#adb5bd}.trigger-text{flex:1;color:var(--ngx-input-text, #212529)}.trigger-text.placeholder{color:#adb5bd}.trigger-arrow{font-size:10px;color:#6c757d;transition:transform .15s}.trigger-arrow.open{transform:rotate(180deg)}.ngx-dropdown-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.popup-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.popup-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.popup-list{max-height:240px;overflow-y:auto}.popup-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.popup-item:hover,.popup-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.popup-item.selected{background:var(--ngx-input-selected-bg, #e8f0fe);color:var(--ngx-input-focus, #4a90d9);font-weight:500}.popup-item.disabled{color:#adb5bd;cursor:not-allowed}.popup-item.disabled:hover{background:none}.popup-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2268
+ }
2269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DropdownComponent, decorators: [{
2270
+ type: Component,
2271
+ args: [{ selector: 'ngx-dropdown', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
2272
+ <div
2273
+ class="ngx-dropdown"
2274
+ [class.open]="isOpen()"
2275
+ [class.disabled]="disabled()"
2276
+ [attr.aria-expanded]="isOpen()"
2277
+ role="combobox"
2278
+ >
2279
+ @if (label()) {
2280
+ <label class="ngx-dropdown-label">{{ label() }}</label>
2281
+ }
2282
+
2283
+ <!-- Trigger -->
2284
+ <div
2285
+ class="ngx-dropdown-trigger"
2286
+ tabindex="0"
2287
+ (click)="toggle()"
2288
+ (keydown)="onTriggerKey($event)"
2289
+ [attr.aria-label]="selectedLabel() || placeholder()"
2290
+ >
2291
+ <span class="trigger-text" [class.placeholder]="!selectedLabel()">
2292
+ {{ selectedLabel() || placeholder() }}
2293
+ </span>
2294
+ <span class="trigger-arrow" [class.open]="isOpen()">&#9660;</span>
2295
+ </div>
2296
+
2297
+ <!-- Popup -->
2298
+ @if (isOpen()) {
2299
+ <div class="ngx-dropdown-popup" role="listbox">
2300
+ @if (filterable()) {
2301
+ <div class="popup-search">
2302
+ <input
2303
+ #filterInput
2304
+ class="popup-search-input"
2305
+ placeholder="Search..."
2306
+ [value]="filterText()"
2307
+ (input)="filterText.set($any($event.target).value)"
2308
+ (keydown)="onFilterKey($event)"
2309
+ />
2310
+ </div>
2311
+ }
2312
+ <div class="popup-list">
2313
+ @for (opt of filteredOptions(); track opt.value; let i = $index) {
2314
+ <div
2315
+ class="popup-item"
2316
+ [class.selected]="isSelected(opt)"
2317
+ [class.focused]="focusedIndex() === i"
2318
+ [class.disabled]="opt.disabled"
2319
+ role="option"
2320
+ [attr.aria-selected]="isSelected(opt)"
2321
+ (click)="selectOption(opt)"
2322
+ (mouseenter)="focusedIndex.set(i)"
2323
+ >{{ opt.label }}</div>
2324
+ }
2325
+ @if (filteredOptions().length === 0) {
2326
+ <div class="popup-empty">No results</div>
2327
+ }
2328
+ </div>
2329
+ </div>
2330
+ }
2331
+ </div>
2332
+ `, styles: [":host{display:block}.ngx-dropdown{position:relative;font-family:inherit}.ngx-dropdown-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px;transition:border-color .15s,box-shadow .15s}.ngx-dropdown-trigger:hover{border-color:#adb5bd}.open .ngx-dropdown-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ngx-dropdown-trigger{background:#f8f9fa;cursor:not-allowed;color:#adb5bd}.trigger-text{flex:1;color:var(--ngx-input-text, #212529)}.trigger-text.placeholder{color:#adb5bd}.trigger-arrow{font-size:10px;color:#6c757d;transition:transform .15s}.trigger-arrow.open{transform:rotate(180deg)}.ngx-dropdown-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.popup-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.popup-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.popup-list{max-height:240px;overflow-y:auto}.popup-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.popup-item:hover,.popup-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.popup-item.selected{background:var(--ngx-input-selected-bg, #e8f0fe);color:var(--ngx-input-focus, #4a90d9);font-weight:500}.popup-item.disabled{color:#adb5bd;cursor:not-allowed}.popup-item.disabled:hover{background:none}.popup-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"] }]
2333
+ }], propDecorators: { onDocClick: [{
2334
+ type: HostListener,
2335
+ args: ['document:click', ['$event']]
2336
+ }] } });
2337
+
2338
+ class DatePickerComponent {
2339
+ value = input(null);
2340
+ label = input('');
2341
+ placeholder = input('Select date...');
2342
+ disabled = input(false);
2343
+ min = input(null);
2344
+ max = input(null);
2345
+ format = input('MM/dd/yyyy');
2346
+ valueChange = output();
2347
+ WEEKDAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
2348
+ isOpen = signal(false);
2349
+ viewYear = signal(new Date().getFullYear());
2350
+ viewMonth = signal(new Date().getMonth());
2351
+ el = inject(ElementRef);
2352
+ displayValue = computed(() => {
2353
+ const v = this.value();
2354
+ if (!v)
2355
+ return '';
2356
+ return v.toLocaleDateString('en-US', { month: '2-digit', day: '2-digit', year: 'numeric' });
2357
+ });
2358
+ monthTitle = computed(() => {
2359
+ const d = new Date(this.viewYear(), this.viewMonth(), 1);
2360
+ return d.toLocaleDateString('en-US', { month: 'long', year: 'numeric' });
2361
+ });
2362
+ calendarDays = computed(() => {
2363
+ const y = this.viewYear(), m = this.viewMonth();
2364
+ const first = new Date(y, m, 1);
2365
+ const last = new Date(y, m + 1, 0);
2366
+ const today = new Date();
2367
+ today.setHours(0, 0, 0, 0);
2368
+ const selectedTime = this.value()?.setHours(0, 0, 0, 0) ?? -1;
2369
+ const days = [];
2370
+ // Leading blanks
2371
+ for (let i = 0; i < first.getDay(); i++) {
2372
+ const d = new Date(y, m, -first.getDay() + i + 1);
2373
+ days.push({ date: d, label: d.getDate().toString(), current: false, isToday: false, isSelected: false, disabled: true });
2374
+ }
2375
+ // Days in month
2376
+ for (let d = 1; d <= last.getDate(); d++) {
2377
+ const date = new Date(y, m, d);
2378
+ const isDisabled = (this.min() && date < this.min()) || (this.max() && date > this.max()) || false;
2379
+ days.push({
2380
+ date, label: d.toString(), current: true,
2381
+ isToday: date.getTime() === today.getTime(),
2382
+ isSelected: date.setHours(0, 0, 0, 0) === selectedTime,
2383
+ disabled: isDisabled,
2384
+ });
2385
+ }
2386
+ // Trailing blanks
2387
+ const remaining = 42 - days.length;
2388
+ for (let i = 1; i <= remaining; i++) {
2389
+ const d = new Date(y, m + 1, i);
2390
+ days.push({ date: d, label: i.toString(), current: false, isToday: false, isSelected: false, disabled: true });
2391
+ }
2392
+ return days;
2393
+ });
2394
+ toggle() {
2395
+ if (this.disabled())
2396
+ return;
2397
+ this.isOpen.update(v => !v);
2398
+ if (this.isOpen() && this.value()) {
2399
+ this.viewYear.set(this.value().getFullYear());
2400
+ this.viewMonth.set(this.value().getMonth());
2401
+ }
2402
+ }
2403
+ prevMonth() {
2404
+ if (this.viewMonth() === 0) {
2405
+ this.viewMonth.set(11);
2406
+ this.viewYear.update(y => y - 1);
2407
+ }
2408
+ else
2409
+ this.viewMonth.update(m => m - 1);
2410
+ }
2411
+ nextMonth() {
2412
+ if (this.viewMonth() === 11) {
2413
+ this.viewMonth.set(0);
2414
+ this.viewYear.update(y => y + 1);
2415
+ }
2416
+ else
2417
+ this.viewMonth.update(m => m + 1);
2418
+ }
2419
+ selectDay(date) {
2420
+ if (!date)
2421
+ return;
2422
+ this.valueChange.emit(date);
2423
+ this.isOpen.set(false);
2424
+ }
2425
+ selectToday() { this.selectDay(new Date()); }
2426
+ clearValue() { this.valueChange.emit(null); this.isOpen.set(false); }
2427
+ onDocClick(e) {
2428
+ if (!this.el.nativeElement.contains(e.target))
2429
+ this.isOpen.set(false);
2430
+ }
2431
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2432
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DatePickerComponent, isStandalone: true, selector: "ngx-date-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocClick($event)" } }, ngImport: i0, template: `
2433
+ <div class="ngx-date-picker" [class.open]="isOpen()" [class.disabled]="disabled()">
2434
+ @if (label()) {
2435
+ <label class="dp-label">{{ label() }}</label>
2436
+ }
2437
+ <!-- Input trigger -->
2438
+ <div class="dp-input-wrap" (click)="toggle()">
2439
+ <input
2440
+ class="dp-input"
2441
+ readonly
2442
+ [value]="displayValue()"
2443
+ [placeholder]="placeholder()"
2444
+ [disabled]="disabled()"
2445
+ />
2446
+ <span class="dp-icon">&#128197;</span>
2447
+ </div>
2448
+
2449
+ <!-- Calendar popup -->
2450
+ @if (isOpen()) {
2451
+ <div class="dp-popup" (click)="$event.stopPropagation()">
2452
+ <!-- Month/Year nav -->
2453
+ <div class="dp-nav">
2454
+ <button class="dp-nav-btn" (click)="prevMonth()">&#8249;</button>
2455
+ <span class="dp-nav-title">{{ monthTitle() }}</span>
2456
+ <button class="dp-nav-btn" (click)="nextMonth()">&#8250;</button>
2457
+ </div>
2458
+ <!-- Weekday headers -->
2459
+ <div class="dp-weekdays">
2460
+ @for (d of WEEKDAYS; track d) {
2461
+ <span class="dp-wd">{{ d }}</span>
2462
+ }
2463
+ </div>
2464
+ <!-- Days grid -->
2465
+ <div class="dp-days">
2466
+ @for (day of calendarDays(); track day.date?.getTime() ?? $index) {
2467
+ <button
2468
+ class="dp-day"
2469
+ [class.other-month]="!day.current"
2470
+ [class.today]="day.isToday"
2471
+ [class.selected]="day.isSelected"
2472
+ [class.disabled]="day.disabled"
2473
+ [disabled]="day.disabled || !day.date"
2474
+ (click)="selectDay(day.date)"
2475
+ >{{ day.label }}</button>
2476
+ }
2477
+ </div>
2478
+ <!-- Footer -->
2479
+ <div class="dp-footer">
2480
+ <button class="dp-today-btn" (click)="selectToday()">Today</button>
2481
+ <button class="dp-clear-btn" (click)="clearValue()">Clear</button>
2482
+ </div>
2483
+ </div>
2484
+ }
2485
+ </div>
2486
+ `, isInline: true, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.dp-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;transition:border-color .15s,box-shadow .15s}.dp-input-wrap:hover{border-color:#adb5bd}.open .dp-input-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .dp-input-wrap{background:#f8f9fa;cursor:not-allowed}.dp-input{flex:1;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);cursor:pointer;font-family:inherit}.dp-icon{padding:0 12px;color:#6c757d}.dp-popup{position:absolute;top:calc(100% + 4px);left:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;padding:12px;width:260px}.dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.dp-nav-btn{background:none;border:none;cursor:pointer;font-size:20px;color:#6c757d;padding:2px 8px;border-radius:3px;line-height:1}.dp-nav-btn:hover{background:#f1f3f5}.dp-nav-title{font-size:14px;font-weight:600;color:var(--ngx-input-text, #212529)}.dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:4px}.dp-wd{text-align:center;font-size:11px;color:#adb5bd;font-weight:600;padding:4px 0}.dp-days{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}.dp-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:13px;border:none;background:none;cursor:pointer;border-radius:50%;color:var(--ngx-input-text, #212529);transition:background .1s}.dp-day:hover:not(.disabled):not(.selected){background:#f1f3f5}.dp-day.other-month{color:#ced4da}.dp-day.today{font-weight:700;color:var(--ngx-input-focus, #4a90d9)}.dp-day.selected{background:var(--ngx-input-focus, #4a90d9);color:#fff}.dp-day.disabled{color:#ced4da;cursor:not-allowed}.dp-footer{display:flex;justify-content:space-between;margin-top:8px;padding-top:8px;border-top:1px solid #f1f3f5}.dp-today-btn,.dp-clear-btn{background:none;border:none;cursor:pointer;font-size:12px;color:var(--ngx-input-focus, #4a90d9);padding:4px 8px;border-radius:3px;font-family:inherit}.dp-today-btn:hover,.dp-clear-btn:hover{background:#f1f3f5}.dp-clear-btn{color:#6c757d}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2487
+ }
2488
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DatePickerComponent, decorators: [{
2489
+ type: Component,
2490
+ args: [{ selector: 'ngx-date-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
2491
+ <div class="ngx-date-picker" [class.open]="isOpen()" [class.disabled]="disabled()">
2492
+ @if (label()) {
2493
+ <label class="dp-label">{{ label() }}</label>
2494
+ }
2495
+ <!-- Input trigger -->
2496
+ <div class="dp-input-wrap" (click)="toggle()">
2497
+ <input
2498
+ class="dp-input"
2499
+ readonly
2500
+ [value]="displayValue()"
2501
+ [placeholder]="placeholder()"
2502
+ [disabled]="disabled()"
2503
+ />
2504
+ <span class="dp-icon">&#128197;</span>
2505
+ </div>
2506
+
2507
+ <!-- Calendar popup -->
2508
+ @if (isOpen()) {
2509
+ <div class="dp-popup" (click)="$event.stopPropagation()">
2510
+ <!-- Month/Year nav -->
2511
+ <div class="dp-nav">
2512
+ <button class="dp-nav-btn" (click)="prevMonth()">&#8249;</button>
2513
+ <span class="dp-nav-title">{{ monthTitle() }}</span>
2514
+ <button class="dp-nav-btn" (click)="nextMonth()">&#8250;</button>
2515
+ </div>
2516
+ <!-- Weekday headers -->
2517
+ <div class="dp-weekdays">
2518
+ @for (d of WEEKDAYS; track d) {
2519
+ <span class="dp-wd">{{ d }}</span>
2520
+ }
2521
+ </div>
2522
+ <!-- Days grid -->
2523
+ <div class="dp-days">
2524
+ @for (day of calendarDays(); track day.date?.getTime() ?? $index) {
2525
+ <button
2526
+ class="dp-day"
2527
+ [class.other-month]="!day.current"
2528
+ [class.today]="day.isToday"
2529
+ [class.selected]="day.isSelected"
2530
+ [class.disabled]="day.disabled"
2531
+ [disabled]="day.disabled || !day.date"
2532
+ (click)="selectDay(day.date)"
2533
+ >{{ day.label }}</button>
2534
+ }
2535
+ </div>
2536
+ <!-- Footer -->
2537
+ <div class="dp-footer">
2538
+ <button class="dp-today-btn" (click)="selectToday()">Today</button>
2539
+ <button class="dp-clear-btn" (click)="clearValue()">Clear</button>
2540
+ </div>
2541
+ </div>
2542
+ }
2543
+ </div>
2544
+ `, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.dp-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;transition:border-color .15s,box-shadow .15s}.dp-input-wrap:hover{border-color:#adb5bd}.open .dp-input-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .dp-input-wrap{background:#f8f9fa;cursor:not-allowed}.dp-input{flex:1;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);cursor:pointer;font-family:inherit}.dp-icon{padding:0 12px;color:#6c757d}.dp-popup{position:absolute;top:calc(100% + 4px);left:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;padding:12px;width:260px}.dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.dp-nav-btn{background:none;border:none;cursor:pointer;font-size:20px;color:#6c757d;padding:2px 8px;border-radius:3px;line-height:1}.dp-nav-btn:hover{background:#f1f3f5}.dp-nav-title{font-size:14px;font-weight:600;color:var(--ngx-input-text, #212529)}.dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:4px}.dp-wd{text-align:center;font-size:11px;color:#adb5bd;font-weight:600;padding:4px 0}.dp-days{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}.dp-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:13px;border:none;background:none;cursor:pointer;border-radius:50%;color:var(--ngx-input-text, #212529);transition:background .1s}.dp-day:hover:not(.disabled):not(.selected){background:#f1f3f5}.dp-day.other-month{color:#ced4da}.dp-day.today{font-weight:700;color:var(--ngx-input-focus, #4a90d9)}.dp-day.selected{background:var(--ngx-input-focus, #4a90d9);color:#fff}.dp-day.disabled{color:#ced4da;cursor:not-allowed}.dp-footer{display:flex;justify-content:space-between;margin-top:8px;padding-top:8px;border-top:1px solid #f1f3f5}.dp-today-btn,.dp-clear-btn{background:none;border:none;cursor:pointer;font-size:12px;color:var(--ngx-input-focus, #4a90d9);padding:4px 8px;border-radius:3px;font-family:inherit}.dp-today-btn:hover,.dp-clear-btn:hover{background:#f1f3f5}.dp-clear-btn{color:#6c757d}\n"] }]
2545
+ }], propDecorators: { onDocClick: [{
2546
+ type: HostListener,
2547
+ args: ['document:click', ['$event']]
2548
+ }] } });
2549
+
2550
+ class MultiSelectComponent {
2551
+ options = input([]);
2552
+ values = input([]);
2553
+ label = input('');
2554
+ placeholder = input('Select...');
2555
+ disabled = input(false);
2556
+ filterable = input(false);
2557
+ maxTags = input(Infinity);
2558
+ valuesChange = output();
2559
+ isOpen = signal(false);
2560
+ filterText = signal('');
2561
+ focusedIndex = signal(-1);
2562
+ el = inject(ElementRef);
2563
+ displayValues = computed(() => this.values()
2564
+ .slice(0, this.maxTags() === Infinity ? undefined : this.maxTags())
2565
+ .map(v => ({ value: v, label: this.options().find(o => o.value === v)?.label ?? String(v) })));
2566
+ filteredOptions = computed(() => {
2567
+ const f = this.filterText().toLowerCase();
2568
+ return f ? this.options().filter(o => o.label.toLowerCase().includes(f)) : this.options();
2569
+ });
2570
+ allSelected = computed(() => this.options().every(o => this.values().includes(o.value)));
2571
+ someSelected = computed(() => this.options().some(o => this.values().includes(o.value)));
2572
+ isChecked(opt) { return this.values().includes(opt.value); }
2573
+ toggle() {
2574
+ if (this.disabled())
2575
+ return;
2576
+ this.isOpen.update(v => !v);
2577
+ }
2578
+ toggleOption(opt) {
2579
+ if (opt.disabled)
2580
+ return;
2581
+ const cur = this.values();
2582
+ const next = cur.includes(opt.value) ? cur.filter(v => v !== opt.value) : [...cur, opt.value];
2583
+ this.valuesChange.emit(next);
2584
+ }
2585
+ removeValue(val, e) {
2586
+ e.stopPropagation();
2587
+ this.valuesChange.emit(this.values().filter(v => v !== val));
2588
+ }
2589
+ toggleAll() {
2590
+ if (this.allSelected())
2591
+ this.valuesChange.emit([]);
2592
+ else
2593
+ this.valuesChange.emit(this.options().filter(o => !o.disabled).map(o => o.value));
2594
+ }
2595
+ onTriggerKey(e) {
2596
+ if (e.key === 'Enter' || e.key === ' ') {
2597
+ e.preventDefault();
2598
+ this.toggle();
2599
+ }
2600
+ if (e.key === 'Escape')
2601
+ this.isOpen.set(false);
2602
+ }
2603
+ onDocClick(e) {
2604
+ if (!this.el.nativeElement.contains(e.target)) {
2605
+ this.isOpen.set(false);
2606
+ this.filterText.set('');
2607
+ }
2608
+ }
2609
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: MultiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2610
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: MultiSelectComponent, isStandalone: true, selector: "ngx-multi-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, values: { classPropertyName: "values", publicName: "values", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, maxTags: { classPropertyName: "maxTags", publicName: "maxTags", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valuesChange: "valuesChange" }, host: { listeners: { "document:click": "onDocClick($event)" } }, ngImport: i0, template: `
2611
+ <div class="ngx-multi-select" [class.open]="isOpen()" [class.disabled]="disabled()" role="combobox">
2612
+ @if (label()) {
2613
+ <label class="ms-label">{{ label() }}</label>
2614
+ }
2615
+ <!-- Trigger -->
2616
+ <div class="ms-trigger" tabindex="0" (click)="toggle()" (keydown)="onTriggerKey($event)">
2617
+ <div class="ms-tags">
2618
+ @for (val of displayValues(); track val.value) {
2619
+ <span class="ms-tag">
2620
+ {{ val.label }}
2621
+ <button class="ms-tag-remove" (click)="removeValue(val.value, $event)" [attr.aria-label]="'Remove ' + val.label">&#10005;</button>
2622
+ </span>
2623
+ }
2624
+ @if (displayValues().length === 0) {
2625
+ <span class="ms-placeholder">{{ placeholder() }}</span>
2626
+ }
2627
+ </div>
2628
+ <span class="ms-arrow" [class.open]="isOpen()">&#9660;</span>
2629
+ </div>
2630
+
2631
+ <!-- Popup -->
2632
+ @if (isOpen()) {
2633
+ <div class="ms-popup">
2634
+ @if (filterable()) {
2635
+ <div class="ms-search">
2636
+ <input
2637
+ class="ms-search-input"
2638
+ placeholder="Search..."
2639
+ [value]="filterText()"
2640
+ (input)="filterText.set($any($event.target).value)"
2641
+ (click)="$event.stopPropagation()"
2642
+ />
2643
+ </div>
2644
+ }
2645
+ <div class="ms-list">
2646
+ <!-- Select All -->
2647
+ <label class="ms-item ms-select-all">
2648
+ <input
2649
+ type="checkbox"
2650
+ [checked]="allSelected()"
2651
+ [indeterminate]="someSelected() && !allSelected()"
2652
+ (change)="toggleAll()"
2653
+ />
2654
+ <span>Select All</span>
2655
+ </label>
2656
+ <div class="ms-divider"></div>
2657
+ @for (opt of filteredOptions(); track opt.value; let i = $index) {
2658
+ <label
2659
+ class="ms-item"
2660
+ [class.checked]="isChecked(opt)"
2661
+ [class.disabled]="opt.disabled"
2662
+ [class.focused]="focusedIndex() === i"
2663
+ (mouseenter)="focusedIndex.set(i)"
2664
+ >
2665
+ <input
2666
+ type="checkbox"
2667
+ [checked]="isChecked(opt)"
2668
+ [disabled]="!!opt.disabled"
2669
+ (change)="toggleOption(opt)"
2670
+ (click)="$event.stopPropagation()"
2671
+ />
2672
+ <span>{{ opt.label }}</span>
2673
+ </label>
2674
+ }
2675
+ @if (filteredOptions().length === 0) {
2676
+ <div class="ms-empty">No results</div>
2677
+ }
2678
+ </div>
2679
+ </div>
2680
+ }
2681
+ </div>
2682
+ `, isInline: true, styles: [":host{display:block}.ngx-multi-select{position:relative;font-family:inherit}.ms-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ms-trigger{display:flex;align-items:center;min-height:38px;padding:4px 8px 4px 4px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color .15s,box-shadow .15s}.ms-trigger:hover{border-color:#adb5bd}.open .ms-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ms-trigger{background:#f8f9fa;cursor:not-allowed}.ms-tags{display:flex;flex-wrap:wrap;gap:4px;flex:1;align-items:center}.ms-tag{display:inline-flex;align-items:center;gap:4px;background:var(--ngx-input-tag-bg, #e8f0fe);color:var(--ngx-input-tag-color, #1a73e8);padding:2px 4px 2px 8px;border-radius:3px;font-size:12px}.ms-tag-remove{background:none;border:none;cursor:pointer;padding:0 2px;color:var(--ngx-input-tag-color, #1a73e8);font-size:10px;line-height:1}.ms-placeholder{color:#adb5bd;font-size:14px;padding:0 4px}.ms-arrow{font-size:10px;color:#6c757d;transition:transform .15s;margin-left:auto}.ms-arrow.open{transform:rotate(180deg)}.ms-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.ms-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.ms-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.ms-list{max-height:240px;overflow-y:auto}.ms-item{display:flex;align-items:center;gap:10px;padding:8px 12px;cursor:pointer;font-size:14px;color:var(--ngx-input-text, #212529)}.ms-item:hover,.ms-item.focused{background:#f1f3f5}.ms-item.checked{background:#f0f7ff}.ms-item.disabled{color:#adb5bd;cursor:not-allowed}.ms-item input[type=checkbox]{width:14px;height:14px;cursor:pointer;accent-color:var(--ngx-input-focus, #4a90d9)}.ms-select-all{font-weight:500}.ms-divider{height:1px;background:#eee;margin:2px 0}.ms-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2683
+ }
2684
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: MultiSelectComponent, decorators: [{
2685
+ type: Component,
2686
+ args: [{ selector: 'ngx-multi-select', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
2687
+ <div class="ngx-multi-select" [class.open]="isOpen()" [class.disabled]="disabled()" role="combobox">
2688
+ @if (label()) {
2689
+ <label class="ms-label">{{ label() }}</label>
2690
+ }
2691
+ <!-- Trigger -->
2692
+ <div class="ms-trigger" tabindex="0" (click)="toggle()" (keydown)="onTriggerKey($event)">
2693
+ <div class="ms-tags">
2694
+ @for (val of displayValues(); track val.value) {
2695
+ <span class="ms-tag">
2696
+ {{ val.label }}
2697
+ <button class="ms-tag-remove" (click)="removeValue(val.value, $event)" [attr.aria-label]="'Remove ' + val.label">&#10005;</button>
2698
+ </span>
2699
+ }
2700
+ @if (displayValues().length === 0) {
2701
+ <span class="ms-placeholder">{{ placeholder() }}</span>
2702
+ }
2703
+ </div>
2704
+ <span class="ms-arrow" [class.open]="isOpen()">&#9660;</span>
2705
+ </div>
2706
+
2707
+ <!-- Popup -->
2708
+ @if (isOpen()) {
2709
+ <div class="ms-popup">
2710
+ @if (filterable()) {
2711
+ <div class="ms-search">
2712
+ <input
2713
+ class="ms-search-input"
2714
+ placeholder="Search..."
2715
+ [value]="filterText()"
2716
+ (input)="filterText.set($any($event.target).value)"
2717
+ (click)="$event.stopPropagation()"
2718
+ />
2719
+ </div>
2720
+ }
2721
+ <div class="ms-list">
2722
+ <!-- Select All -->
2723
+ <label class="ms-item ms-select-all">
2724
+ <input
2725
+ type="checkbox"
2726
+ [checked]="allSelected()"
2727
+ [indeterminate]="someSelected() && !allSelected()"
2728
+ (change)="toggleAll()"
2729
+ />
2730
+ <span>Select All</span>
2731
+ </label>
2732
+ <div class="ms-divider"></div>
2733
+ @for (opt of filteredOptions(); track opt.value; let i = $index) {
2734
+ <label
2735
+ class="ms-item"
2736
+ [class.checked]="isChecked(opt)"
2737
+ [class.disabled]="opt.disabled"
2738
+ [class.focused]="focusedIndex() === i"
2739
+ (mouseenter)="focusedIndex.set(i)"
2740
+ >
2741
+ <input
2742
+ type="checkbox"
2743
+ [checked]="isChecked(opt)"
2744
+ [disabled]="!!opt.disabled"
2745
+ (change)="toggleOption(opt)"
2746
+ (click)="$event.stopPropagation()"
2747
+ />
2748
+ <span>{{ opt.label }}</span>
2749
+ </label>
2750
+ }
2751
+ @if (filteredOptions().length === 0) {
2752
+ <div class="ms-empty">No results</div>
2753
+ }
2754
+ </div>
2755
+ </div>
2756
+ }
2757
+ </div>
2758
+ `, styles: [":host{display:block}.ngx-multi-select{position:relative;font-family:inherit}.ms-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ms-trigger{display:flex;align-items:center;min-height:38px;padding:4px 8px 4px 4px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color .15s,box-shadow .15s}.ms-trigger:hover{border-color:#adb5bd}.open .ms-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ms-trigger{background:#f8f9fa;cursor:not-allowed}.ms-tags{display:flex;flex-wrap:wrap;gap:4px;flex:1;align-items:center}.ms-tag{display:inline-flex;align-items:center;gap:4px;background:var(--ngx-input-tag-bg, #e8f0fe);color:var(--ngx-input-tag-color, #1a73e8);padding:2px 4px 2px 8px;border-radius:3px;font-size:12px}.ms-tag-remove{background:none;border:none;cursor:pointer;padding:0 2px;color:var(--ngx-input-tag-color, #1a73e8);font-size:10px;line-height:1}.ms-placeholder{color:#adb5bd;font-size:14px;padding:0 4px}.ms-arrow{font-size:10px;color:#6c757d;transition:transform .15s;margin-left:auto}.ms-arrow.open{transform:rotate(180deg)}.ms-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.ms-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.ms-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.ms-list{max-height:240px;overflow-y:auto}.ms-item{display:flex;align-items:center;gap:10px;padding:8px 12px;cursor:pointer;font-size:14px;color:var(--ngx-input-text, #212529)}.ms-item:hover,.ms-item.focused{background:#f1f3f5}.ms-item.checked{background:#f0f7ff}.ms-item.disabled{color:#adb5bd;cursor:not-allowed}.ms-item input[type=checkbox]{width:14px;height:14px;cursor:pointer;accent-color:var(--ngx-input-focus, #4a90d9)}.ms-select-all{font-weight:500}.ms-divider{height:1px;background:#eee;margin:2px 0}.ms-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"] }]
2759
+ }], propDecorators: { onDocClick: [{
2760
+ type: HostListener,
2761
+ args: ['document:click', ['$event']]
2762
+ }] } });
2763
+
2764
+ class DataGridComponent {
2765
+ data = input([]);
2766
+ columns = input([]);
2767
+ pageSize = input(10);
2768
+ selectable = input(false);
2769
+ striped = input(true);
2770
+ loading = input(false);
2771
+ rowClick = output();
2772
+ selectionChange = output();
2773
+ sortChange = output();
2774
+ pageChange = output();
2775
+ sortState = signal(null);
2776
+ currentPage = signal(1);
2777
+ selectedRows = signal(new Set());
2778
+ filters = signal(new Map());
2779
+ Math = Math;
2780
+ hasFilterableColumns = computed(() => this.columns().some(c => c.filterable));
2781
+ filteredData = computed(() => {
2782
+ let d = this.data();
2783
+ const fs = this.filters();
2784
+ fs.forEach((val, field) => {
2785
+ if (val)
2786
+ d = d.filter(row => String(row[field] ?? '').toLowerCase().includes(val.toLowerCase()));
2787
+ });
2788
+ const s = this.sortState();
2789
+ if (s) {
2790
+ d = [...d].sort((a, b) => {
2791
+ const av = a[s.field];
2792
+ const bv = b[s.field];
2793
+ const cmp = av == null ? -1 : bv == null ? 1 : String(av).localeCompare(String(bv), undefined, { numeric: true });
2794
+ return s.dir === 'asc' ? cmp : -cmp;
2795
+ });
2796
+ }
2797
+ return d;
2798
+ });
2799
+ totalFiltered = computed(() => this.filteredData().length);
2800
+ totalPages = computed(() => Math.max(1, Math.ceil(this.totalFiltered() / this.pageSize())));
2801
+ pagedData = computed(() => {
2802
+ const p = this.currentPage();
2803
+ const sz = this.pageSize();
2804
+ return this.filteredData().slice((p - 1) * sz, p * sz);
2805
+ });
2806
+ pageNumbers = computed(() => {
2807
+ const total = this.totalPages();
2808
+ const cur = this.currentPage();
2809
+ const pages = [];
2810
+ for (let i = Math.max(1, cur - 2); i <= Math.min(total, cur + 2); i++)
2811
+ pages.push(i);
2812
+ return pages;
2813
+ });
2814
+ allSelected = computed(() => this.pagedData().length > 0 && this.pagedData().every(r => this.selectedRows().has(r)));
2815
+ someSelected = computed(() => this.pagedData().some(r => this.selectedRows().has(r)));
2816
+ getFilter(field) { return this.filters().get(field) ?? ''; }
2817
+ setFilter(field, val) {
2818
+ const m = new Map(this.filters());
2819
+ if (val)
2820
+ m.set(field, val);
2821
+ else
2822
+ m.delete(field);
2823
+ this.filters.set(m);
2824
+ this.currentPage.set(1);
2825
+ }
2826
+ onSort(col) {
2827
+ const s = this.sortState();
2828
+ if (s?.field === col.field) {
2829
+ this.sortState.set(s.dir === 'asc' ? { field: col.field, dir: 'desc' } : null);
2830
+ }
2831
+ else {
2832
+ this.sortState.set({ field: col.field, dir: 'asc' });
2833
+ }
2834
+ this.currentPage.set(1);
2835
+ this.sortChange.emit({ sort: this.sortState() });
2836
+ }
2837
+ goPage(p) {
2838
+ this.currentPage.set(p);
2839
+ this.pageChange.emit({ page: p, pageSize: this.pageSize() });
2840
+ }
2841
+ onRowClick(row, index) { this.rowClick.emit({ row, index }); }
2842
+ isRowSelected(row) { return this.selectedRows().has(row); }
2843
+ toggleRow(row) {
2844
+ const s = new Set(this.selectedRows());
2845
+ s.has(row) ? s.delete(row) : s.add(row);
2846
+ this.selectedRows.set(s);
2847
+ this.selectionChange.emit([...s]);
2848
+ }
2849
+ toggleAll() {
2850
+ const cur = this.allSelected();
2851
+ const s = new Set(this.selectedRows());
2852
+ this.pagedData().forEach(r => cur ? s.delete(r) : s.add(r));
2853
+ this.selectedRows.set(s);
2854
+ this.selectionChange.emit([...s]);
2855
+ }
2856
+ getCellValue(row, field) {
2857
+ const val = row[field];
2858
+ return val == null ? '' : String(val);
2859
+ }
2860
+ getKey(row, i) {
2861
+ const r = row;
2862
+ return String(r['id'] ?? r['key'] ?? i);
2863
+ }
2864
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DataGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2865
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DataGridComponent, isStandalone: true, selector: "ngx-data-grid", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, striped: { classPropertyName: "striped", publicName: "striped", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rowClick: "rowClick", selectionChange: "selectionChange", sortChange: "sortChange", pageChange: "pageChange" }, ngImport: i0, template: `
2866
+ <div class="ngx-data-grid" [class.loading]="loading()">
2867
+
2868
+ <!-- Filter row (above table) if any column is filterable -->
2869
+ @if (hasFilterableColumns()) {
2870
+ <div class="grid-filter-bar">
2871
+ @for (col of columns(); track col.field) {
2872
+ @if (col.filterable) {
2873
+ <input
2874
+ class="grid-filter-input"
2875
+ [placeholder]="'Filter ' + col.title"
2876
+ [value]="getFilter(col.field)"
2877
+ (input)="setFilter(col.field, $any($event.target).value)"
2878
+ [style.width.px]="col.width ?? 120"
2879
+ />
2880
+ } @else {
2881
+ <div [style.width.px]="col.width ?? 120" class="grid-filter-spacer"></div>
2882
+ }
2883
+ }
2884
+ </div>
2885
+ }
2886
+
2887
+ <!-- Table -->
2888
+ <div class="grid-table-wrap">
2889
+ <table class="grid-table" [class.striped]="striped()">
2890
+ <thead>
2891
+ <tr>
2892
+ @if (selectable()) {
2893
+ <th class="grid-th grid-th-check" style="width:40px">
2894
+ <input type="checkbox" [checked]="allSelected()" [indeterminate]="someSelected() && !allSelected()" (change)="toggleAll()" />
2895
+ </th>
2896
+ }
2897
+ @for (col of columns(); track col.field) {
2898
+ <th
2899
+ class="grid-th"
2900
+ [style.width.px]="col.width"
2901
+ [class.sortable]="col.sortable"
2902
+ [class.sort-asc]="sortState()?.field === col.field && sortState()?.dir === 'asc'"
2903
+ [class.sort-desc]="sortState()?.field === col.field && sortState()?.dir === 'desc'"
2904
+ (click)="col.sortable ? onSort(col) : null"
2905
+ >
2906
+ <span class="th-text">{{ col.title }}</span>
2907
+ @if (col.sortable) {
2908
+ <span class="sort-icon">
2909
+ @if (sortState()?.field === col.field) {
2910
+ {{ sortState()?.dir === 'asc' ? '↑' : '↓' }}
2911
+ } @else { ↕ }
2912
+ </span>
2913
+ }
2914
+ </th>
2915
+ }
2916
+ </tr>
2917
+ </thead>
2918
+ <tbody>
2919
+ @if (loading()) {
2920
+ <tr>
2921
+ <td [attr.colspan]="columns().length + (selectable() ? 1 : 0)" class="grid-loading-cell">
2922
+ <div class="grid-spinner"></div>
2923
+ </td>
2924
+ </tr>
2925
+ } @else if (pagedData().length === 0) {
2926
+ <tr>
2927
+ <td [attr.colspan]="columns().length + (selectable() ? 1 : 0)" class="grid-empty-cell">No data found.</td>
2928
+ </tr>
2929
+ } @else {
2930
+ @for (row of pagedData(); track getKey(row, $index); let i = $index) {
2931
+ <tr
2932
+ class="grid-row"
2933
+ [class.selected]="isRowSelected(row)"
2934
+ (click)="onRowClick(row, i)"
2935
+ >
2936
+ @if (selectable()) {
2937
+ <td class="grid-td grid-td-check">
2938
+ <input type="checkbox" [checked]="isRowSelected(row)" (change)="toggleRow(row)" (click)="$event.stopPropagation()" />
2939
+ </td>
2940
+ }
2941
+ @for (col of columns(); track col.field) {
2942
+ <td class="grid-td" [style.text-align]="col.align ?? 'left'">
2943
+ {{ getCellValue(row, col.field) }}
2944
+ </td>
2945
+ }
2946
+ </tr>
2947
+ }
2948
+ }
2949
+ </tbody>
2950
+ </table>
2951
+ </div>
2952
+
2953
+ <!-- Pagination -->
2954
+ @if (pagedData().length > 0 || totalFiltered() > 0) {
2955
+ <div class="grid-pagination">
2956
+ <span class="page-info">
2957
+ {{ (currentPage() - 1) * pageSize() + 1 }}–{{ Math.min(currentPage() * pageSize(), totalFiltered()) }}
2958
+ of {{ totalFiltered() }}
2959
+ </span>
2960
+ <div class="page-btns">
2961
+ <button class="page-btn" [disabled]="currentPage() === 1" (click)="goPage(1)">&#171;</button>
2962
+ <button class="page-btn" [disabled]="currentPage() === 1" (click)="goPage(currentPage() - 1)">&#8249;</button>
2963
+ @for (p of pageNumbers(); track p) {
2964
+ <button class="page-btn" [class.active]="p === currentPage()" (click)="goPage(p)">{{ p }}</button>
2965
+ }
2966
+ <button class="page-btn" [disabled]="currentPage() === totalPages()" (click)="goPage(currentPage() + 1)">&#8250;</button>
2967
+ <button class="page-btn" [disabled]="currentPage() === totalPages()" (click)="goPage(totalPages())">&#187;</button>
2968
+ </div>
2969
+ </div>
2970
+ }
2971
+ </div>
2972
+ `, isInline: true, styles: [":host{display:block}.ngx-data-grid{font-family:inherit;border:1px solid var(--ngx-grid-border, #dee2e6);border-radius:var(--ngx-grid-radius, 4px);overflow:hidden;background:var(--ngx-grid-bg, #fff)}.grid-filter-bar{display:flex;gap:8px;padding:8px 12px;background:var(--ngx-grid-header-bg, #f1f3f5);border-bottom:1px solid var(--ngx-grid-border, #dee2e6)}.grid-filter-input{padding:4px 8px;border:1px solid var(--ngx-grid-border, #dee2e6);border-radius:3px;font-size:12px;outline:none;font-family:inherit}.grid-filter-input:focus{border-color:#4a90d9}.grid-filter-spacer{flex-shrink:0}.grid-table-wrap{overflow-x:auto}.grid-table{width:100%;border-collapse:collapse;font-size:13px}.grid-th{padding:10px 12px;text-align:left;font-size:12px;font-weight:600;color:var(--ngx-grid-text-secondary, #6c757d);background:var(--ngx-grid-header-bg, #f1f3f5);border-bottom:2px solid var(--ngx-grid-border, #dee2e6);white-space:nowrap;-webkit-user-select:none;user-select:none}.grid-th.sortable{cursor:pointer}.grid-th.sortable:hover{background:#e9ecef}.grid-th.sort-asc,.grid-th.sort-desc{color:#4a90d9}.th-text{margin-right:4px}.sort-icon{font-size:10px;color:#adb5bd}.sort-asc .sort-icon,.sort-desc .sort-icon{color:#4a90d9}.grid-row{border-bottom:1px solid var(--ngx-grid-border, #dee2e6);cursor:default;transition:background .1s}.grid-row:hover{background:var(--ngx-grid-hover-bg, #f8f9fa)}.grid-row.selected{background:var(--ngx-grid-selected-bg, #e8f0fe)}.grid-table.striped .grid-row:nth-child(2n){background:#f8f9fa}.grid-table.striped .grid-row:nth-child(2n):hover{background:var(--ngx-grid-hover-bg, #f8f9fa)}.grid-table.striped .grid-row.selected{background:var(--ngx-grid-selected-bg, #e8f0fe)!important}.grid-td{padding:9px 12px;color:var(--ngx-grid-text, #212529);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.grid-th-check,.grid-td-check{width:40px!important;text-align:center}.grid-loading-cell,.grid-empty-cell{padding:32px;text-align:center;color:var(--ngx-grid-text-secondary, #6c757d)}.grid-spinner{width:24px;height:24px;border:3px solid #dee2e6;border-top-color:#4a90d9;border-radius:50%;animation:spin .7s linear infinite;margin:0 auto}@keyframes spin{to{transform:rotate(360deg)}}.grid-pagination{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border-top:1px solid var(--ngx-grid-border, #dee2e6);background:var(--ngx-grid-bg, #fff);flex-wrap:wrap;gap:8px}.page-info{font-size:12px;color:var(--ngx-grid-text-secondary, #6c757d)}.page-btns{display:flex;gap:2px}.page-btn{min-width:28px;height:28px;padding:0 6px;font-size:13px;border:1px solid var(--ngx-grid-border, #dee2e6);background:var(--ngx-grid-bg, #fff);border-radius:3px;cursor:pointer;font-family:inherit;color:var(--ngx-grid-text, #212529);transition:background .1s}.page-btn:hover:not(:disabled){background:#f1f3f5}.page-btn.active{background:#4a90d9;color:#fff;border-color:#4a90d9}.page-btn:disabled{opacity:.4;cursor:not-allowed}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2973
+ }
2974
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DataGridComponent, decorators: [{
2975
+ type: Component,
2976
+ args: [{ selector: 'ngx-data-grid', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
2977
+ <div class="ngx-data-grid" [class.loading]="loading()">
2978
+
2979
+ <!-- Filter row (above table) if any column is filterable -->
2980
+ @if (hasFilterableColumns()) {
2981
+ <div class="grid-filter-bar">
2982
+ @for (col of columns(); track col.field) {
2983
+ @if (col.filterable) {
2984
+ <input
2985
+ class="grid-filter-input"
2986
+ [placeholder]="'Filter ' + col.title"
2987
+ [value]="getFilter(col.field)"
2988
+ (input)="setFilter(col.field, $any($event.target).value)"
2989
+ [style.width.px]="col.width ?? 120"
2990
+ />
2991
+ } @else {
2992
+ <div [style.width.px]="col.width ?? 120" class="grid-filter-spacer"></div>
2993
+ }
2994
+ }
2995
+ </div>
2996
+ }
2997
+
2998
+ <!-- Table -->
2999
+ <div class="grid-table-wrap">
3000
+ <table class="grid-table" [class.striped]="striped()">
3001
+ <thead>
3002
+ <tr>
3003
+ @if (selectable()) {
3004
+ <th class="grid-th grid-th-check" style="width:40px">
3005
+ <input type="checkbox" [checked]="allSelected()" [indeterminate]="someSelected() && !allSelected()" (change)="toggleAll()" />
3006
+ </th>
3007
+ }
3008
+ @for (col of columns(); track col.field) {
3009
+ <th
3010
+ class="grid-th"
3011
+ [style.width.px]="col.width"
3012
+ [class.sortable]="col.sortable"
3013
+ [class.sort-asc]="sortState()?.field === col.field && sortState()?.dir === 'asc'"
3014
+ [class.sort-desc]="sortState()?.field === col.field && sortState()?.dir === 'desc'"
3015
+ (click)="col.sortable ? onSort(col) : null"
3016
+ >
3017
+ <span class="th-text">{{ col.title }}</span>
3018
+ @if (col.sortable) {
3019
+ <span class="sort-icon">
3020
+ @if (sortState()?.field === col.field) {
3021
+ {{ sortState()?.dir === 'asc' ? '↑' : '↓' }}
3022
+ } @else { ↕ }
3023
+ </span>
3024
+ }
3025
+ </th>
3026
+ }
3027
+ </tr>
3028
+ </thead>
3029
+ <tbody>
3030
+ @if (loading()) {
3031
+ <tr>
3032
+ <td [attr.colspan]="columns().length + (selectable() ? 1 : 0)" class="grid-loading-cell">
3033
+ <div class="grid-spinner"></div>
3034
+ </td>
3035
+ </tr>
3036
+ } @else if (pagedData().length === 0) {
3037
+ <tr>
3038
+ <td [attr.colspan]="columns().length + (selectable() ? 1 : 0)" class="grid-empty-cell">No data found.</td>
3039
+ </tr>
3040
+ } @else {
3041
+ @for (row of pagedData(); track getKey(row, $index); let i = $index) {
3042
+ <tr
3043
+ class="grid-row"
3044
+ [class.selected]="isRowSelected(row)"
3045
+ (click)="onRowClick(row, i)"
3046
+ >
3047
+ @if (selectable()) {
3048
+ <td class="grid-td grid-td-check">
3049
+ <input type="checkbox" [checked]="isRowSelected(row)" (change)="toggleRow(row)" (click)="$event.stopPropagation()" />
3050
+ </td>
3051
+ }
3052
+ @for (col of columns(); track col.field) {
3053
+ <td class="grid-td" [style.text-align]="col.align ?? 'left'">
3054
+ {{ getCellValue(row, col.field) }}
3055
+ </td>
3056
+ }
3057
+ </tr>
3058
+ }
3059
+ }
3060
+ </tbody>
3061
+ </table>
3062
+ </div>
3063
+
3064
+ <!-- Pagination -->
3065
+ @if (pagedData().length > 0 || totalFiltered() > 0) {
3066
+ <div class="grid-pagination">
3067
+ <span class="page-info">
3068
+ {{ (currentPage() - 1) * pageSize() + 1 }}–{{ Math.min(currentPage() * pageSize(), totalFiltered()) }}
3069
+ of {{ totalFiltered() }}
3070
+ </span>
3071
+ <div class="page-btns">
3072
+ <button class="page-btn" [disabled]="currentPage() === 1" (click)="goPage(1)">&#171;</button>
3073
+ <button class="page-btn" [disabled]="currentPage() === 1" (click)="goPage(currentPage() - 1)">&#8249;</button>
3074
+ @for (p of pageNumbers(); track p) {
3075
+ <button class="page-btn" [class.active]="p === currentPage()" (click)="goPage(p)">{{ p }}</button>
3076
+ }
3077
+ <button class="page-btn" [disabled]="currentPage() === totalPages()" (click)="goPage(currentPage() + 1)">&#8250;</button>
3078
+ <button class="page-btn" [disabled]="currentPage() === totalPages()" (click)="goPage(totalPages())">&#187;</button>
3079
+ </div>
3080
+ </div>
3081
+ }
3082
+ </div>
3083
+ `, styles: [":host{display:block}.ngx-data-grid{font-family:inherit;border:1px solid var(--ngx-grid-border, #dee2e6);border-radius:var(--ngx-grid-radius, 4px);overflow:hidden;background:var(--ngx-grid-bg, #fff)}.grid-filter-bar{display:flex;gap:8px;padding:8px 12px;background:var(--ngx-grid-header-bg, #f1f3f5);border-bottom:1px solid var(--ngx-grid-border, #dee2e6)}.grid-filter-input{padding:4px 8px;border:1px solid var(--ngx-grid-border, #dee2e6);border-radius:3px;font-size:12px;outline:none;font-family:inherit}.grid-filter-input:focus{border-color:#4a90d9}.grid-filter-spacer{flex-shrink:0}.grid-table-wrap{overflow-x:auto}.grid-table{width:100%;border-collapse:collapse;font-size:13px}.grid-th{padding:10px 12px;text-align:left;font-size:12px;font-weight:600;color:var(--ngx-grid-text-secondary, #6c757d);background:var(--ngx-grid-header-bg, #f1f3f5);border-bottom:2px solid var(--ngx-grid-border, #dee2e6);white-space:nowrap;-webkit-user-select:none;user-select:none}.grid-th.sortable{cursor:pointer}.grid-th.sortable:hover{background:#e9ecef}.grid-th.sort-asc,.grid-th.sort-desc{color:#4a90d9}.th-text{margin-right:4px}.sort-icon{font-size:10px;color:#adb5bd}.sort-asc .sort-icon,.sort-desc .sort-icon{color:#4a90d9}.grid-row{border-bottom:1px solid var(--ngx-grid-border, #dee2e6);cursor:default;transition:background .1s}.grid-row:hover{background:var(--ngx-grid-hover-bg, #f8f9fa)}.grid-row.selected{background:var(--ngx-grid-selected-bg, #e8f0fe)}.grid-table.striped .grid-row:nth-child(2n){background:#f8f9fa}.grid-table.striped .grid-row:nth-child(2n):hover{background:var(--ngx-grid-hover-bg, #f8f9fa)}.grid-table.striped .grid-row.selected{background:var(--ngx-grid-selected-bg, #e8f0fe)!important}.grid-td{padding:9px 12px;color:var(--ngx-grid-text, #212529);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.grid-th-check,.grid-td-check{width:40px!important;text-align:center}.grid-loading-cell,.grid-empty-cell{padding:32px;text-align:center;color:var(--ngx-grid-text-secondary, #6c757d)}.grid-spinner{width:24px;height:24px;border:3px solid #dee2e6;border-top-color:#4a90d9;border-radius:50%;animation:spin .7s linear infinite;margin:0 auto}@keyframes spin{to{transform:rotate(360deg)}}.grid-pagination{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border-top:1px solid var(--ngx-grid-border, #dee2e6);background:var(--ngx-grid-bg, #fff);flex-wrap:wrap;gap:8px}.page-info{font-size:12px;color:var(--ngx-grid-text-secondary, #6c757d)}.page-btns{display:flex;gap:2px}.page-btn{min-width:28px;height:28px;padding:0 6px;font-size:13px;border:1px solid var(--ngx-grid-border, #dee2e6);background:var(--ngx-grid-bg, #fff);border-radius:3px;cursor:pointer;font-family:inherit;color:var(--ngx-grid-text, #212529);transition:background .1s}.page-btn:hover:not(:disabled){background:#f1f3f5}.page-btn.active{background:#4a90d9;color:#fff;border-color:#4a90d9}.page-btn:disabled{opacity:.4;cursor:not-allowed}\n"] }]
3084
+ }] });
3085
+
3086
+ class TreeViewComponent {
3087
+ nodes = input([]);
3088
+ selectable = input(true);
3089
+ checkable = input(false);
3090
+ selectedId = input(null);
3091
+ expandedIds = input([]);
3092
+ nodeSelect = output();
3093
+ nodeExpand = output();
3094
+ nodeCollapse = output();
3095
+ checkChange = output();
3096
+ expandedSet = signal(new Set());
3097
+ checkedSet = signal(new Set());
3098
+ focusedId = signal(null);
3099
+ isExpanded(id) { return this.expandedSet().has(id) || this.expandedIds().includes(id); }
3100
+ isChecked(id) { return this.checkedSet().has(id); }
3101
+ hasNodeChildren(node) { return !!(node.children?.length || node.hasChildren); }
3102
+ onNodeClick(node, e) {
3103
+ e.stopPropagation();
3104
+ this.focusedId.set(node.id);
3105
+ if (this.selectable())
3106
+ this.nodeSelect.emit({ node });
3107
+ if (this.hasNodeChildren(node))
3108
+ this.toggleExpand(node, e);
3109
+ }
3110
+ toggleExpand(node, e) {
3111
+ e.stopPropagation();
3112
+ const s = new Set(this.expandedSet());
3113
+ if (s.has(node.id)) {
3114
+ s.delete(node.id);
3115
+ this.nodeCollapse.emit({ node });
3116
+ }
3117
+ else {
3118
+ s.add(node.id);
3119
+ this.nodeExpand.emit({ node });
3120
+ }
3121
+ this.expandedSet.set(s);
3122
+ }
3123
+ onCheck(node) {
3124
+ const s = new Set(this.checkedSet());
3125
+ const checked = !s.has(node.id);
3126
+ checked ? s.add(node.id) : s.delete(node.id);
3127
+ this.checkedSet.set(s);
3128
+ this.checkChange.emit({ node, checked });
3129
+ }
3130
+ onKeyDown(e) {
3131
+ const flat = this.flatVisibleIds();
3132
+ const cur = this.focusedId();
3133
+ const idx = flat.indexOf(cur ?? '');
3134
+ if (e.key === 'ArrowDown') {
3135
+ e.preventDefault();
3136
+ if (idx < flat.length - 1)
3137
+ this.focusedId.set(flat[idx + 1]);
3138
+ }
3139
+ if (e.key === 'ArrowUp') {
3140
+ e.preventDefault();
3141
+ if (idx > 0)
3142
+ this.focusedId.set(flat[idx - 1]);
3143
+ }
3144
+ if (e.key === 'Enter' || e.key === ' ') {
3145
+ if (cur) {
3146
+ const node = this.findNode(cur, this.nodes());
3147
+ if (node)
3148
+ this.nodeSelect.emit({ node });
3149
+ }
3150
+ }
3151
+ }
3152
+ flatVisibleIds() {
3153
+ const ids = [];
3154
+ const collect = (nodes) => {
3155
+ for (const n of nodes) {
3156
+ ids.push(n.id);
3157
+ if (this.isExpanded(n.id) && n.children)
3158
+ collect(n.children);
3159
+ }
3160
+ };
3161
+ collect(this.nodes());
3162
+ return ids;
3163
+ }
3164
+ findNode(id, nodes) {
3165
+ for (const n of nodes) {
3166
+ if (n.id === id)
3167
+ return n;
3168
+ if (n.children) {
3169
+ const found = this.findNode(id, n.children);
3170
+ if (found)
3171
+ return found;
3172
+ }
3173
+ }
3174
+ return null;
3175
+ }
3176
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TreeViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3177
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TreeViewComponent, isStandalone: true, selector: "ngx-tree-view", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, checkable: { classPropertyName: "checkable", publicName: "checkable", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeSelect: "nodeSelect", nodeExpand: "nodeExpand", nodeCollapse: "nodeCollapse", checkChange: "checkChange" }, ngImport: i0, template: `
3178
+ <div class="ngx-tree-view" role="tree" (keydown)="onKeyDown($event)" tabindex="0">
3179
+ @for (node of nodes(); track node.id) {
3180
+ <ng-container *ngTemplateOutlet="nodeTemplate; context: { node: node, depth: 0 }"/>
3181
+ }
3182
+
3183
+ <ng-template #nodeTemplate let-node="node" let-depth="depth">
3184
+ <div
3185
+ class="tree-node"
3186
+ [style.padding-left.px]="depth * 20 + 8"
3187
+ [class.selected]="selectedId() === node.id"
3188
+ [class.focused]="focusedId() === node.id"
3189
+ role="treeitem"
3190
+ [attr.aria-expanded]="isExpanded(node.id)"
3191
+ [attr.aria-selected]="selectedId() === node.id"
3192
+ (click)="onNodeClick(node, $event)"
3193
+ >
3194
+ <!-- Expand/collapse -->
3195
+ @if (hasNodeChildren(node)) {
3196
+ <button
3197
+ class="tree-expand-btn"
3198
+ (click)="toggleExpand(node, $event)"
3199
+ [attr.aria-label]="isExpanded(node.id) ? 'Collapse' : 'Expand'"
3200
+ >
3201
+ <span class="expand-icon" [class.expanded]="isExpanded(node.id)">&#9658;</span>
3202
+ </button>
3203
+ } @else {
3204
+ <span class="tree-leaf-spacer"></span>
3205
+ }
3206
+
3207
+ <!-- Checkbox -->
3208
+ @if (checkable()) {
3209
+ <input
3210
+ type="checkbox"
3211
+ class="tree-checkbox"
3212
+ [checked]="isChecked(node.id)"
3213
+ (change)="onCheck(node)"
3214
+ (click)="$event.stopPropagation()"
3215
+ />
3216
+ }
3217
+
3218
+ <!-- Icon -->
3219
+ @if (node.icon) {
3220
+ <span class="tree-icon">{{ node.icon }}</span>
3221
+ }
3222
+
3223
+ <!-- Label -->
3224
+ <span class="tree-label">{{ node.label }}</span>
3225
+ </div>
3226
+
3227
+ <!-- Children -->
3228
+ @if (isExpanded(node.id) && node.children) {
3229
+ @for (child of node.children; track child.id) {
3230
+ <ng-container *ngTemplateOutlet="nodeTemplate; context: { node: child, depth: depth + 1 }"/>
3231
+ }
3232
+ }
3233
+ </ng-template>
3234
+ </div>
3235
+ `, isInline: true, styles: [":host{display:block}.ngx-tree-view{background:var(--ngx-tree-bg, #fff);border:1px solid var(--ngx-tree-border, #dee2e6);border-radius:var(--ngx-tree-radius, 4px);overflow-y:auto;font-family:inherit;outline:none}.tree-node{display:flex;align-items:center;gap:4px;height:32px;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:3px;margin:1px 4px;transition:background .1s}.tree-node:hover{background:var(--ngx-tree-hover-bg, #f1f3f5)}.tree-node.selected{background:var(--ngx-tree-selected-bg, #e8f0fe);color:var(--ngx-tree-selected-color, #1a73e8)}.tree-node.focused{outline:2px solid rgba(74,144,217,.4);outline-offset:-1px}.tree-expand-btn{width:20px;height:20px;background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:3px;color:var(--ngx-tree-text-secondary, #6c757d)}.tree-expand-btn:hover{background:var(--ngx-tree-border, #dee2e6)}.expand-icon{font-size:9px;transition:transform .15s;display:inline-block}.expand-icon.expanded{transform:rotate(90deg)}.tree-leaf-spacer{width:20px;flex-shrink:0}.tree-checkbox{width:14px;height:14px;cursor:pointer;flex-shrink:0;accent-color:#4a90d9}.tree-icon{font-size:14px;flex-shrink:0}.tree-label{font-size:13px;color:var(--ngx-tree-text, #212529);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.selected .tree-label{color:var(--ngx-tree-selected-color, #1a73e8);font-weight:500}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3236
+ }
3237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TreeViewComponent, decorators: [{
3238
+ type: Component,
3239
+ args: [{ selector: 'ngx-tree-view', standalone: true, imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: `
3240
+ <div class="ngx-tree-view" role="tree" (keydown)="onKeyDown($event)" tabindex="0">
3241
+ @for (node of nodes(); track node.id) {
3242
+ <ng-container *ngTemplateOutlet="nodeTemplate; context: { node: node, depth: 0 }"/>
3243
+ }
3244
+
3245
+ <ng-template #nodeTemplate let-node="node" let-depth="depth">
3246
+ <div
3247
+ class="tree-node"
3248
+ [style.padding-left.px]="depth * 20 + 8"
3249
+ [class.selected]="selectedId() === node.id"
3250
+ [class.focused]="focusedId() === node.id"
3251
+ role="treeitem"
3252
+ [attr.aria-expanded]="isExpanded(node.id)"
3253
+ [attr.aria-selected]="selectedId() === node.id"
3254
+ (click)="onNodeClick(node, $event)"
3255
+ >
3256
+ <!-- Expand/collapse -->
3257
+ @if (hasNodeChildren(node)) {
3258
+ <button
3259
+ class="tree-expand-btn"
3260
+ (click)="toggleExpand(node, $event)"
3261
+ [attr.aria-label]="isExpanded(node.id) ? 'Collapse' : 'Expand'"
3262
+ >
3263
+ <span class="expand-icon" [class.expanded]="isExpanded(node.id)">&#9658;</span>
3264
+ </button>
3265
+ } @else {
3266
+ <span class="tree-leaf-spacer"></span>
3267
+ }
3268
+
3269
+ <!-- Checkbox -->
3270
+ @if (checkable()) {
3271
+ <input
3272
+ type="checkbox"
3273
+ class="tree-checkbox"
3274
+ [checked]="isChecked(node.id)"
3275
+ (change)="onCheck(node)"
3276
+ (click)="$event.stopPropagation()"
3277
+ />
3278
+ }
3279
+
3280
+ <!-- Icon -->
3281
+ @if (node.icon) {
3282
+ <span class="tree-icon">{{ node.icon }}</span>
3283
+ }
3284
+
3285
+ <!-- Label -->
3286
+ <span class="tree-label">{{ node.label }}</span>
3287
+ </div>
3288
+
3289
+ <!-- Children -->
3290
+ @if (isExpanded(node.id) && node.children) {
3291
+ @for (child of node.children; track child.id) {
3292
+ <ng-container *ngTemplateOutlet="nodeTemplate; context: { node: child, depth: depth + 1 }"/>
3293
+ }
3294
+ }
3295
+ </ng-template>
3296
+ </div>
3297
+ `, styles: [":host{display:block}.ngx-tree-view{background:var(--ngx-tree-bg, #fff);border:1px solid var(--ngx-tree-border, #dee2e6);border-radius:var(--ngx-tree-radius, 4px);overflow-y:auto;font-family:inherit;outline:none}.tree-node{display:flex;align-items:center;gap:4px;height:32px;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:3px;margin:1px 4px;transition:background .1s}.tree-node:hover{background:var(--ngx-tree-hover-bg, #f1f3f5)}.tree-node.selected{background:var(--ngx-tree-selected-bg, #e8f0fe);color:var(--ngx-tree-selected-color, #1a73e8)}.tree-node.focused{outline:2px solid rgba(74,144,217,.4);outline-offset:-1px}.tree-expand-btn{width:20px;height:20px;background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:3px;color:var(--ngx-tree-text-secondary, #6c757d)}.tree-expand-btn:hover{background:var(--ngx-tree-border, #dee2e6)}.expand-icon{font-size:9px;transition:transform .15s;display:inline-block}.expand-icon.expanded{transform:rotate(90deg)}.tree-leaf-spacer{width:20px;flex-shrink:0}.tree-checkbox{width:14px;height:14px;cursor:pointer;flex-shrink:0;accent-color:#4a90d9}.tree-icon{font-size:14px;flex-shrink:0}.tree-label{font-size:13px;color:var(--ngx-tree-text, #212529);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.selected .tree-label{color:var(--ngx-tree-selected-color, #1a73e8);font-weight:500}\n"] }]
3298
+ }] });
3299
+
3300
+ class ListViewComponent {
3301
+ items = input([]);
3302
+ selectable = input(true);
3303
+ multiselect = input(false);
3304
+ loading = input(false);
3305
+ labelField = input('label');
3306
+ itemClick = output();
3307
+ selectionChange = output();
3308
+ itemTemplate;
3309
+ selectedItems = signal(new Set());
3310
+ isSelected(item) { return this.selectedItems().has(item); }
3311
+ onItemClick(item, index) {
3312
+ this.itemClick.emit({ item, index });
3313
+ if (!this.selectable())
3314
+ return;
3315
+ const s = new Set(this.selectedItems());
3316
+ if (this.multiselect()) {
3317
+ s.has(item) ? s.delete(item) : s.add(item);
3318
+ }
3319
+ else {
3320
+ if (s.has(item) && s.size === 1)
3321
+ s.clear();
3322
+ else {
3323
+ s.clear();
3324
+ s.add(item);
3325
+ }
3326
+ }
3327
+ this.selectedItems.set(s);
3328
+ this.selectionChange.emit({ selectedItems: [...s] });
3329
+ }
3330
+ getLabel(item) {
3331
+ if (typeof item === 'string' || typeof item === 'number')
3332
+ return String(item);
3333
+ const r = item;
3334
+ return String(r[this.labelField()] ?? r['label'] ?? r['name'] ?? r['title'] ?? JSON.stringify(item));
3335
+ }
3336
+ trackFn(item, index) {
3337
+ if (typeof item === 'object' && item !== null) {
3338
+ const r = item;
3339
+ return String(r['id'] ?? r['key'] ?? index);
3340
+ }
3341
+ return String(index);
3342
+ }
3343
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ListViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3344
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: ListViewComponent, isStandalone: true, selector: "ngx-list-view", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, multiselect: { classPropertyName: "multiselect", publicName: "multiselect", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, labelField: { classPropertyName: "labelField", publicName: "labelField", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick", selectionChange: "selectionChange" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: ["itemTemplate"], descendants: true }], ngImport: i0, template: `
3345
+ <div class="ngx-list-view">
3346
+ <!-- Header slot -->
3347
+ <ng-content select="[listHeader]"/>
3348
+
3349
+ <!-- Loading -->
3350
+ @if (loading()) {
3351
+ <div class="lv-loading">
3352
+ <div class="lv-spinner"></div>
3353
+ <span>Loading...</span>
3354
+ </div>
3355
+ } @else if (items().length === 0) {
3356
+ <div class="lv-empty">No items to display.</div>
3357
+ } @else {
3358
+ <div class="lv-list" role="listbox" [attr.aria-multiselectable]="multiselect()">
3359
+ @for (item of items(); track trackFn(item, $index); let i = $index) {
3360
+ <div
3361
+ class="lv-item"
3362
+ [class.lv-alt]="i % 2 === 1"
3363
+ [class.lv-selected]="isSelected(item)"
3364
+ role="option"
3365
+ [attr.aria-selected]="isSelected(item)"
3366
+ (click)="onItemClick(item, i)"
3367
+ >
3368
+ @if (itemTemplate) {
3369
+ <ng-container *ngTemplateOutlet="itemTemplate; context: { $implicit: item, index: i }"/>
3370
+ } @else {
3371
+ <span class="lv-default-text">{{ getLabel(item) }}</span>
3372
+ }
3373
+ </div>
3374
+ }
3375
+ </div>
3376
+ }
3377
+
3378
+ <!-- Footer slot -->
3379
+ <ng-content select="[listFooter]"/>
3380
+ </div>
3381
+ `, isInline: true, styles: [":host{display:block}.ngx-list-view{border:1px solid var(--ngx-list-border, #dee2e6);border-radius:var(--ngx-list-radius, 4px);background:var(--ngx-list-bg, #fff);overflow:hidden;font-family:inherit}.lv-list{overflow-y:auto}.lv-item{padding:10px 16px;cursor:pointer;border-bottom:1px solid var(--ngx-list-border, #dee2e6);transition:background .1s;color:var(--ngx-list-text, #212529);font-size:13px}.lv-item:last-child{border-bottom:none}.lv-item:hover{background:var(--ngx-list-hover-bg, #f1f3f5)}.lv-item.lv-alt{background:var(--ngx-list-alt-bg, #f8f9fa)}.lv-item.lv-alt:hover{background:var(--ngx-list-hover-bg, #f1f3f5)}.lv-item.lv-selected{background:var(--ngx-list-selected-bg, #e8f0fe);color:var(--ngx-list-selected-color, #1a73e8);font-weight:500}.lv-item.lv-selected:hover{background:var(--ngx-list-selected-bg, #e8f0fe)}.lv-default-text{display:block}.lv-loading,.lv-empty{display:flex;align-items:center;justify-content:center;gap:8px;padding:32px;color:#adb5bd;font-size:13px}.lv-spinner{width:20px;height:20px;border:2px solid #dee2e6;border-top-color:#4a90d9;border-radius:50%;animation:spin .7s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3382
+ }
3383
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ListViewComponent, decorators: [{
3384
+ type: Component,
3385
+ args: [{ selector: 'ngx-list-view', standalone: true, imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: `
3386
+ <div class="ngx-list-view">
3387
+ <!-- Header slot -->
3388
+ <ng-content select="[listHeader]"/>
3389
+
3390
+ <!-- Loading -->
3391
+ @if (loading()) {
3392
+ <div class="lv-loading">
3393
+ <div class="lv-spinner"></div>
3394
+ <span>Loading...</span>
3395
+ </div>
3396
+ } @else if (items().length === 0) {
3397
+ <div class="lv-empty">No items to display.</div>
3398
+ } @else {
3399
+ <div class="lv-list" role="listbox" [attr.aria-multiselectable]="multiselect()">
3400
+ @for (item of items(); track trackFn(item, $index); let i = $index) {
3401
+ <div
3402
+ class="lv-item"
3403
+ [class.lv-alt]="i % 2 === 1"
3404
+ [class.lv-selected]="isSelected(item)"
3405
+ role="option"
3406
+ [attr.aria-selected]="isSelected(item)"
3407
+ (click)="onItemClick(item, i)"
3408
+ >
3409
+ @if (itemTemplate) {
3410
+ <ng-container *ngTemplateOutlet="itemTemplate; context: { $implicit: item, index: i }"/>
3411
+ } @else {
3412
+ <span class="lv-default-text">{{ getLabel(item) }}</span>
3413
+ }
3414
+ </div>
3415
+ }
3416
+ </div>
3417
+ }
3418
+
3419
+ <!-- Footer slot -->
3420
+ <ng-content select="[listFooter]"/>
3421
+ </div>
3422
+ `, styles: [":host{display:block}.ngx-list-view{border:1px solid var(--ngx-list-border, #dee2e6);border-radius:var(--ngx-list-radius, 4px);background:var(--ngx-list-bg, #fff);overflow:hidden;font-family:inherit}.lv-list{overflow-y:auto}.lv-item{padding:10px 16px;cursor:pointer;border-bottom:1px solid var(--ngx-list-border, #dee2e6);transition:background .1s;color:var(--ngx-list-text, #212529);font-size:13px}.lv-item:last-child{border-bottom:none}.lv-item:hover{background:var(--ngx-list-hover-bg, #f1f3f5)}.lv-item.lv-alt{background:var(--ngx-list-alt-bg, #f8f9fa)}.lv-item.lv-alt:hover{background:var(--ngx-list-hover-bg, #f1f3f5)}.lv-item.lv-selected{background:var(--ngx-list-selected-bg, #e8f0fe);color:var(--ngx-list-selected-color, #1a73e8);font-weight:500}.lv-item.lv-selected:hover{background:var(--ngx-list-selected-bg, #e8f0fe)}.lv-default-text{display:block}.lv-loading,.lv-empty{display:flex;align-items:center;justify-content:center;gap:8px;padding:32px;color:#adb5bd;font-size:13px}.lv-spinner{width:20px;height:20px;border:2px solid #dee2e6;border-top-color:#4a90d9;border-radius:50%;animation:spin .7s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}\n"] }]
3423
+ }], propDecorators: { itemTemplate: [{
3424
+ type: ContentChild,
3425
+ args: ['itemTemplate']
3426
+ }] } });
3427
+
3428
+ class TooltipDirective {
3429
+ ngxTooltip = input('');
3430
+ tooltipPosition = input('top');
3431
+ el = inject(ElementRef);
3432
+ renderer = inject(Renderer2);
3433
+ tooltipEl = null;
3434
+ onMouseEnter() {
3435
+ const text = this.ngxTooltip();
3436
+ if (!text)
3437
+ return;
3438
+ this.showTooltip(text);
3439
+ }
3440
+ onMouseLeave() {
3441
+ this.hideTooltip();
3442
+ }
3443
+ showTooltip(text) {
3444
+ this.hideTooltip();
3445
+ const tip = this.renderer.createElement('div');
3446
+ tip.className = 'ngx-tooltip';
3447
+ tip.setAttribute('role', 'tooltip');
3448
+ tip.textContent = text;
3449
+ document.body.appendChild(tip);
3450
+ this.tooltipEl = tip;
3451
+ const rect = this.el.nativeElement.getBoundingClientRect();
3452
+ const tipRect = tip.getBoundingClientRect();
3453
+ const pos = this.tooltipPosition();
3454
+ const scrollX = window.scrollX;
3455
+ const scrollY = window.scrollY;
3456
+ const OFFSET = 8;
3457
+ let top = 0, left = 0;
3458
+ switch (pos) {
3459
+ case 'top':
3460
+ top = rect.top + scrollY - tipRect.height - OFFSET;
3461
+ left = rect.left + scrollX + rect.width / 2 - tipRect.width / 2;
3462
+ break;
3463
+ case 'bottom':
3464
+ top = rect.bottom + scrollY + OFFSET;
3465
+ left = rect.left + scrollX + rect.width / 2 - tipRect.width / 2;
3466
+ break;
3467
+ case 'left':
3468
+ top = rect.top + scrollY + rect.height / 2 - tipRect.height / 2;
3469
+ left = rect.left + scrollX - tipRect.width - OFFSET;
3470
+ break;
3471
+ case 'right':
3472
+ top = rect.top + scrollY + rect.height / 2 - tipRect.height / 2;
3473
+ left = rect.right + scrollX + OFFSET;
3474
+ break;
3475
+ }
3476
+ // Auto-flip if outside viewport
3477
+ if (top < 0)
3478
+ top = rect.bottom + scrollY + OFFSET;
3479
+ if (left < 0)
3480
+ left = 4;
3481
+ if (left + tipRect.width > window.innerWidth)
3482
+ left = window.innerWidth - tipRect.width - 4;
3483
+ tip.style.top = top + 'px';
3484
+ tip.style.left = left + 'px';
3485
+ tip.style.setProperty('--pos', pos);
3486
+ requestAnimationFrame(() => { if (tip)
3487
+ tip.classList.add('visible'); });
3488
+ }
3489
+ hideTooltip() {
3490
+ if (this.tooltipEl) {
3491
+ this.tooltipEl.remove();
3492
+ this.tooltipEl = null;
3493
+ }
3494
+ }
3495
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3496
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.20", type: TooltipDirective, isStandalone: true, selector: "[ngxTooltip]", inputs: { ngxTooltip: { classPropertyName: "ngxTooltip", publicName: "ngxTooltip", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" } }, ngImport: i0 });
3497
+ }
3498
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TooltipDirective, decorators: [{
3499
+ type: Directive,
3500
+ args: [{
3501
+ selector: '[ngxTooltip]',
3502
+ standalone: true,
3503
+ }]
3504
+ }], propDecorators: { onMouseEnter: [{
3505
+ type: HostListener,
3506
+ args: ['mouseenter']
3507
+ }], onMouseLeave: [{
3508
+ type: HostListener,
3509
+ args: ['mouseleave']
3510
+ }] } });
3511
+
3512
+ class PopoverComponent {
3513
+ title = input('');
3514
+ position = input('bottom');
3515
+ isOpen = signal(false);
3516
+ toggle() { this.isOpen.update(v => !v); }
3517
+ close() { this.isOpen.set(false); }
3518
+ el = inject(ElementRef);
3519
+ onDocClick(e) {
3520
+ if (!this.el.nativeElement.contains(e.target))
3521
+ this.isOpen.set(false);
3522
+ }
3523
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3524
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: PopoverComponent, isStandalone: true, selector: "ngx-popover", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:click": "onDocClick($event)" } }, ngImport: i0, template: `
3525
+ <div class="ngx-popover-wrapper">
3526
+ <!-- Trigger slot -->
3527
+ <div class="popover-trigger" (click)="toggle()">
3528
+ <ng-content select="[popoverTrigger]"/>
3529
+ </div>
3530
+
3531
+ <!-- Popup -->
3532
+ @if (isOpen()) {
3533
+ <div class="popover-panel" [class]="'popover-' + position()">
3534
+ @if (title()) {
3535
+ <div class="popover-header">
3536
+ <span class="popover-title">{{ title() }}</span>
3537
+ <button class="popover-close" (click)="close()">&#10005;</button>
3538
+ </div>
3539
+ }
3540
+ <div class="popover-body">
3541
+ <ng-content select="[popoverBody]"/>
3542
+ </div>
3543
+ </div>
3544
+ }
3545
+ </div>
3546
+ `, isInline: true, styles: [":host{display:inline-block}.ngx-popover-wrapper{position:relative;display:inline-block}.popover-trigger{cursor:pointer}.popover-panel{position:absolute;z-index:1000;min-width:200px;max-width:320px;background:var(--ngx-popover-bg, #fff);border:1px solid var(--ngx-popover-border, #dee2e6);border-radius:var(--ngx-popover-radius, 6px);box-shadow:var(--ngx-popover-shadow, 0 4px 16px rgba(0,0,0,.12));animation:fadeIn .12s ease}@keyframes fadeIn{0%{opacity:0;transform:scale(.96)}to{opacity:1;transform:scale(1)}}.popover-bottom{top:calc(100% + 8px);left:50%;transform:translate(-50%)}.popover-top{bottom:calc(100% + 8px);left:50%;transform:translate(-50%)}.popover-right{left:calc(100% + 8px);top:50%;transform:translateY(-50%)}.popover-left{right:calc(100% + 8px);top:50%;transform:translateY(-50%)}.popover-header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px 8px;border-bottom:1px solid var(--ngx-popover-border, #dee2e6)}.popover-title{font-size:14px;font-weight:600;color:#212529}.popover-close{background:none;border:none;cursor:pointer;font-size:12px;color:#6c757d;padding:2px 4px;border-radius:3px}.popover-close:hover{background:#f1f3f5}.popover-body{padding:12px 14px;font-size:13px;color:#495057}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3547
+ }
3548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PopoverComponent, decorators: [{
3549
+ type: Component,
3550
+ args: [{ selector: 'ngx-popover', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
3551
+ <div class="ngx-popover-wrapper">
3552
+ <!-- Trigger slot -->
3553
+ <div class="popover-trigger" (click)="toggle()">
3554
+ <ng-content select="[popoverTrigger]"/>
3555
+ </div>
3556
+
3557
+ <!-- Popup -->
3558
+ @if (isOpen()) {
3559
+ <div class="popover-panel" [class]="'popover-' + position()">
3560
+ @if (title()) {
3561
+ <div class="popover-header">
3562
+ <span class="popover-title">{{ title() }}</span>
3563
+ <button class="popover-close" (click)="close()">&#10005;</button>
3564
+ </div>
3565
+ }
3566
+ <div class="popover-body">
3567
+ <ng-content select="[popoverBody]"/>
3568
+ </div>
3569
+ </div>
3570
+ }
3571
+ </div>
3572
+ `, styles: [":host{display:inline-block}.ngx-popover-wrapper{position:relative;display:inline-block}.popover-trigger{cursor:pointer}.popover-panel{position:absolute;z-index:1000;min-width:200px;max-width:320px;background:var(--ngx-popover-bg, #fff);border:1px solid var(--ngx-popover-border, #dee2e6);border-radius:var(--ngx-popover-radius, 6px);box-shadow:var(--ngx-popover-shadow, 0 4px 16px rgba(0,0,0,.12));animation:fadeIn .12s ease}@keyframes fadeIn{0%{opacity:0;transform:scale(.96)}to{opacity:1;transform:scale(1)}}.popover-bottom{top:calc(100% + 8px);left:50%;transform:translate(-50%)}.popover-top{bottom:calc(100% + 8px);left:50%;transform:translate(-50%)}.popover-right{left:calc(100% + 8px);top:50%;transform:translateY(-50%)}.popover-left{right:calc(100% + 8px);top:50%;transform:translateY(-50%)}.popover-header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px 8px;border-bottom:1px solid var(--ngx-popover-border, #dee2e6)}.popover-title{font-size:14px;font-weight:600;color:#212529}.popover-close{background:none;border:none;cursor:pointer;font-size:12px;color:#6c757d;padding:2px 4px;border-radius:3px}.popover-close:hover{background:#f1f3f5}.popover-body{padding:12px 14px;font-size:13px;color:#495057}\n"] }]
3573
+ }], propDecorators: { onDocClick: [{
3574
+ type: HostListener,
3575
+ args: ['document:click', ['$event']]
3576
+ }] } });
3577
+
3578
+ /*
3579
+ * Public API Surface of ngx-core-components
3580
+ */
3581
+ // ===== Gantt Chart =====
3582
+
3583
+ /**
3584
+ * Generated bundle index. Do not edit.
3585
+ */
3586
+
3587
+ export { BarChartComponent, CHART_COLORS, DEFAULT_GANTT_CONFIG, DataGridComponent, DatePickerComponent, DependencyType, DropdownComponent, GanttChartComponent, GanttScaleService, LineChartComponent, ListViewComponent, MultiSelectComponent, PieChartComponent, PopoverComponent, SparklineComponent, TextBoxComponent, TooltipDirective, TreeViewComponent, ZoomLevel, addDays, addMonths, addWeeks, diffDays, getColumnDates, getDateRange, isWeekend, snapToDay, startOfDay, startOfMonth, startOfWeek };
3588
+ //# sourceMappingURL=ngx-core-components.mjs.map