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