@memberjunction/ng-ui-components 6.2.0-edge.4 → 6.2.0-edge.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/lib/burst-cluster-strip/burst-cluster-strip.component.d.ts +472 -0
- package/dist/lib/burst-cluster-strip/burst-cluster-strip.component.d.ts.map +1 -0
- package/dist/lib/burst-cluster-strip/burst-cluster-strip.component.js +1424 -0
- package/dist/lib/burst-cluster-strip/burst-cluster-strip.component.js.map +1 -0
- package/dist/lib/calendar/calendar-utils.d.ts +6 -1
- package/dist/lib/calendar/calendar-utils.d.ts.map +1 -1
- package/dist/lib/calendar/calendar-utils.js +8 -3
- package/dist/lib/calendar/calendar-utils.js.map +1 -1
- package/dist/lib/dialog/dialog.scss +4 -1
- package/dist/lib/slide-panel/slide-panel.component.js +2 -2
- package/dist/public-api.d.ts +1 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +1 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,1424 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, inject } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
const _forTrack0 = ($index, $item) => $item.Key;
|
|
4
|
+
const _forTrack1 = ($index, $item) => $item.ID;
|
|
5
|
+
function MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
6
|
+
i0.ɵɵdomElement(0, "i", 9);
|
|
7
|
+
} if (rf & 2) {
|
|
8
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
9
|
+
i0.ɵɵclassMap(ctx_r0.TitleIcon);
|
|
10
|
+
} }
|
|
11
|
+
function MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
12
|
+
i0.ɵɵdomElementStart(0, "span", 5);
|
|
13
|
+
i0.ɵɵtext(1);
|
|
14
|
+
i0.ɵɵdomElementEnd();
|
|
15
|
+
} if (rf & 2) {
|
|
16
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
17
|
+
i0.ɵɵadvance();
|
|
18
|
+
i0.ɵɵtextInterpolate1("\u00B7 ", ctx_r0.GranularityLabel);
|
|
19
|
+
} }
|
|
20
|
+
function MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
21
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
22
|
+
i0.ɵɵdomElementStart(0, "button", 10);
|
|
23
|
+
i0.ɵɵdomListener("click", function MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_7_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.OnZoomBackClick($event)); });
|
|
24
|
+
i0.ɵɵdomElement(1, "i", 11);
|
|
25
|
+
i0.ɵɵdomElementStart(2, "span");
|
|
26
|
+
i0.ɵɵtext(3);
|
|
27
|
+
i0.ɵɵdomElementEnd()();
|
|
28
|
+
i0.ɵɵdomElementStart(4, "span", 12);
|
|
29
|
+
i0.ɵɵtext(5);
|
|
30
|
+
i0.ɵɵdomElementEnd();
|
|
31
|
+
} if (rf & 2) {
|
|
32
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
33
|
+
i0.ɵɵadvance(3);
|
|
34
|
+
i0.ɵɵtextInterpolate(ctx_r0.ZoomBackLabel);
|
|
35
|
+
i0.ɵɵadvance(2);
|
|
36
|
+
i0.ɵɵtextInterpolate1(" Viewing ", ctx_r0.ActiveZoomBreadcrumb == null ? null : ctx_r0.ActiveZoomBreadcrumb.Label, " ");
|
|
37
|
+
} }
|
|
38
|
+
function MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
39
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
40
|
+
i0.ɵɵdomElementStart(0, "button", 13);
|
|
41
|
+
i0.ɵɵdomListener("click", function MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_8_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.OnClearSelectionClick($event)); });
|
|
42
|
+
i0.ɵɵdomElementStart(1, "span");
|
|
43
|
+
i0.ɵɵtext(2);
|
|
44
|
+
i0.ɵɵdomElementEnd();
|
|
45
|
+
i0.ɵɵdomElement(3, "i", 14);
|
|
46
|
+
i0.ɵɵdomElementEnd();
|
|
47
|
+
} if (rf & 2) {
|
|
48
|
+
i0.ɵɵadvance(2);
|
|
49
|
+
i0.ɵɵtextInterpolate(ctx);
|
|
50
|
+
} }
|
|
51
|
+
function MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_9_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
52
|
+
i0.ɵɵdomElementStart(0, "span", 15);
|
|
53
|
+
i0.ɵɵdomElement(1, "span", 16);
|
|
54
|
+
i0.ɵɵtext(2);
|
|
55
|
+
i0.ɵɵdomElementEnd();
|
|
56
|
+
} if (rf & 2) {
|
|
57
|
+
const cat_r4 = ctx.$implicit;
|
|
58
|
+
i0.ɵɵadvance();
|
|
59
|
+
i0.ɵɵclassMap(cat_r4.CssModifier ? "mj-burst-legend-dot rc-legend-dot rc-legend-dot--" + cat_r4.CssModifier : "mj-burst-legend-dot rc-legend-dot");
|
|
60
|
+
i0.ɵɵstyleProp("background", cat_r4.Color);
|
|
61
|
+
i0.ɵɵadvance();
|
|
62
|
+
i0.ɵɵtextInterpolate1(" ", cat_r4.Label, " ");
|
|
63
|
+
} }
|
|
64
|
+
function MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
65
|
+
i0.ɵɵdomElementStart(0, "div", 8);
|
|
66
|
+
i0.ɵɵrepeaterCreate(1, MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_9_For_2_Template, 3, 5, "span", 15, _forTrack0);
|
|
67
|
+
i0.ɵɵdomElementEnd();
|
|
68
|
+
} if (rf & 2) {
|
|
69
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
70
|
+
i0.ɵɵadvance();
|
|
71
|
+
i0.ɵɵrepeater(ctx_r0.ResolvedCategories);
|
|
72
|
+
} }
|
|
73
|
+
function MJBurstClusterStripComponent_Conditional_0_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
74
|
+
i0.ɵɵdomElementStart(0, "div", 1)(1, "span", 3);
|
|
75
|
+
i0.ɵɵconditionalCreate(2, MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_2_Template, 1, 2, "i", 4);
|
|
76
|
+
i0.ɵɵdomElementStart(3, "span");
|
|
77
|
+
i0.ɵɵtext(4);
|
|
78
|
+
i0.ɵɵdomElementEnd();
|
|
79
|
+
i0.ɵɵconditionalCreate(5, MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_5_Template, 2, 1, "span", 5);
|
|
80
|
+
i0.ɵɵdomElementEnd();
|
|
81
|
+
i0.ɵɵdomElementStart(6, "div", 6);
|
|
82
|
+
i0.ɵɵconditionalCreate(7, MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_7_Template, 6, 2);
|
|
83
|
+
i0.ɵɵconditionalCreate(8, MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_8_Template, 4, 1, "button", 7);
|
|
84
|
+
i0.ɵɵconditionalCreate(9, MJBurstClusterStripComponent_Conditional_0_Conditional_1_Conditional_9_Template, 3, 0, "div", 8);
|
|
85
|
+
i0.ɵɵdomElementEnd()();
|
|
86
|
+
} if (rf & 2) {
|
|
87
|
+
let tmp_6_0;
|
|
88
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
89
|
+
i0.ɵɵadvance(2);
|
|
90
|
+
i0.ɵɵconditional(ctx_r0.TitleIcon ? 2 : -1);
|
|
91
|
+
i0.ɵɵadvance(2);
|
|
92
|
+
i0.ɵɵtextInterpolate(ctx_r0.Title);
|
|
93
|
+
i0.ɵɵadvance();
|
|
94
|
+
i0.ɵɵconditional(ctx_r0.GranularityLabel ? 5 : -1);
|
|
95
|
+
i0.ɵɵadvance(2);
|
|
96
|
+
i0.ɵɵconditional(ctx_r0.ZoomStack.length > 0 ? 7 : -1);
|
|
97
|
+
i0.ɵɵadvance();
|
|
98
|
+
i0.ɵɵconditional((tmp_6_0 = ctx_r0.SelectedClusterLabel) ? 8 : -1, tmp_6_0);
|
|
99
|
+
i0.ɵɵadvance();
|
|
100
|
+
i0.ɵɵconditional(ctx_r0.ShowLegend && ctx_r0.ResolvedCategories.length > 0 ? 9 : -1);
|
|
101
|
+
} }
|
|
102
|
+
function MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
103
|
+
i0.ɵɵdomElementStart(0, "span", 18);
|
|
104
|
+
i0.ɵɵdomElement(1, "i", 25);
|
|
105
|
+
i0.ɵɵtext(2, " Zoom ");
|
|
106
|
+
i0.ɵɵdomElementEnd();
|
|
107
|
+
} }
|
|
108
|
+
function MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_2_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
109
|
+
const _r7 = i0.ɵɵgetCurrentView();
|
|
110
|
+
i0.ɵɵdomElementStart(0, "span", 28);
|
|
111
|
+
i0.ɵɵdomListener("click", function MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_2_For_2_Template_span_click_0_listener($event) { const pip_r8 = i0.ɵɵrestoreView(_r7).$implicit; const cluster_r6 = i0.ɵɵnextContext(2).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.OnPipClick(pip_r8, cluster_r6, $event)); });
|
|
112
|
+
i0.ɵɵdomElementEnd();
|
|
113
|
+
} if (rf & 2) {
|
|
114
|
+
const pip_r8 = ctx.$implicit;
|
|
115
|
+
i0.ɵɵclassMap(pip_r8.CssModifier ? "mj-burst-pip rc-burst-pip rc-burst-pip--" + pip_r8.CssModifier : "mj-burst-pip rc-burst-pip");
|
|
116
|
+
i0.ɵɵstyleProp("background", pip_r8.Color);
|
|
117
|
+
i0.ɵɵdomProperty("title", pip_r8.Tooltip);
|
|
118
|
+
} }
|
|
119
|
+
function MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_2_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
120
|
+
i0.ɵɵdomElementStart(0, "span", 27);
|
|
121
|
+
i0.ɵɵtext(1);
|
|
122
|
+
i0.ɵɵdomElementEnd();
|
|
123
|
+
} if (rf & 2) {
|
|
124
|
+
const cluster_r6 = i0.ɵɵnextContext(2).$implicit;
|
|
125
|
+
i0.ɵɵadvance();
|
|
126
|
+
i0.ɵɵtextInterpolate1("+", cluster_r6.OverflowPipCount);
|
|
127
|
+
} }
|
|
128
|
+
function MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
129
|
+
i0.ɵɵdomElementStart(0, "div", 19);
|
|
130
|
+
i0.ɵɵrepeaterCreate(1, MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_2_For_2_Template, 1, 5, "span", 26, _forTrack1);
|
|
131
|
+
i0.ɵɵconditionalCreate(3, MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_2_Conditional_3_Template, 2, 1, "span", 27);
|
|
132
|
+
i0.ɵɵdomElementEnd();
|
|
133
|
+
} if (rf & 2) {
|
|
134
|
+
const cluster_r6 = i0.ɵɵnextContext().$implicit;
|
|
135
|
+
i0.ɵɵadvance();
|
|
136
|
+
i0.ɵɵrepeater(cluster_r6.Pips);
|
|
137
|
+
i0.ɵɵadvance(2);
|
|
138
|
+
i0.ɵɵconditional(cluster_r6.OverflowPipCount > 0 ? 3 : -1);
|
|
139
|
+
} }
|
|
140
|
+
function MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_9_For_2_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
141
|
+
i0.ɵɵdomElement(0, "span", 30);
|
|
142
|
+
} if (rf & 2) {
|
|
143
|
+
const share_r9 = i0.ɵɵnextContext().$implicit;
|
|
144
|
+
i0.ɵɵstyleProp("width", share_r9.SharePercent, "%")("background", share_r9.Color);
|
|
145
|
+
} }
|
|
146
|
+
function MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_9_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
147
|
+
i0.ɵɵconditionalCreate(0, MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_9_For_2_Conditional_0_Template, 1, 4, "span", 29);
|
|
148
|
+
} if (rf & 2) {
|
|
149
|
+
const share_r9 = ctx.$implicit;
|
|
150
|
+
i0.ɵɵconditional(share_r9.SharePercent > 0 ? 0 : -1);
|
|
151
|
+
} }
|
|
152
|
+
function MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
153
|
+
i0.ɵɵdomElementStart(0, "div", 23);
|
|
154
|
+
i0.ɵɵrepeaterCreate(1, MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_9_For_2_Template, 1, 1, null, null, _forTrack0);
|
|
155
|
+
i0.ɵɵdomElementEnd();
|
|
156
|
+
} if (rf & 2) {
|
|
157
|
+
const cluster_r6 = i0.ɵɵnextContext().$implicit;
|
|
158
|
+
i0.ɵɵadvance();
|
|
159
|
+
i0.ɵɵrepeater(cluster_r6.CategoryShares);
|
|
160
|
+
} }
|
|
161
|
+
function MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_10_Template(rf, ctx) { if (rf & 1) {
|
|
162
|
+
i0.ɵɵdomElementStart(0, "div", 24);
|
|
163
|
+
i0.ɵɵdomElement(1, "div", 31);
|
|
164
|
+
i0.ɵɵdomElementStart(2, "span", 32);
|
|
165
|
+
i0.ɵɵtext(3);
|
|
166
|
+
i0.ɵɵdomElementEnd()();
|
|
167
|
+
} if (rf & 2) {
|
|
168
|
+
const cluster_r6 = i0.ɵɵnextContext().$implicit;
|
|
169
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
170
|
+
i0.ɵɵattribute("aria-label", cluster_r6.GapAfterLabel + " with no " + ctx_r0.ItemPluralNoun);
|
|
171
|
+
i0.ɵɵadvance(3);
|
|
172
|
+
i0.ɵɵtextInterpolate(cluster_r6.GapAfterLabel);
|
|
173
|
+
} }
|
|
174
|
+
function MJBurstClusterStripComponent_Conditional_0_For_4_Template(rf, ctx) { if (rf & 1) {
|
|
175
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
176
|
+
i0.ɵɵdomElementStart(0, "button", 17);
|
|
177
|
+
i0.ɵɵdomListener("click", function MJBurstClusterStripComponent_Conditional_0_For_4_Template_button_click_0_listener($event) { const cluster_r6 = i0.ɵɵrestoreView(_r5).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.OnClusterClick(cluster_r6, $event)); });
|
|
178
|
+
i0.ɵɵconditionalCreate(1, MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_1_Template, 3, 0, "span", 18);
|
|
179
|
+
i0.ɵɵconditionalCreate(2, MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_2_Template, 4, 1, "div", 19);
|
|
180
|
+
i0.ɵɵdomElementStart(3, "span", 20);
|
|
181
|
+
i0.ɵɵtext(4);
|
|
182
|
+
i0.ɵɵdomElementEnd();
|
|
183
|
+
i0.ɵɵdomElementStart(5, "span", 21);
|
|
184
|
+
i0.ɵɵtext(6);
|
|
185
|
+
i0.ɵɵdomElementEnd();
|
|
186
|
+
i0.ɵɵdomElementStart(7, "span", 22);
|
|
187
|
+
i0.ɵɵtext(8);
|
|
188
|
+
i0.ɵɵdomElementEnd();
|
|
189
|
+
i0.ɵɵconditionalCreate(9, MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_9_Template, 3, 0, "div", 23);
|
|
190
|
+
i0.ɵɵdomElementEnd();
|
|
191
|
+
i0.ɵɵconditionalCreate(10, MJBurstClusterStripComponent_Conditional_0_For_4_Conditional_10_Template, 4, 2, "div", 24);
|
|
192
|
+
} if (rf & 2) {
|
|
193
|
+
const cluster_r6 = ctx.$implicit;
|
|
194
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
195
|
+
i0.ɵɵclassProp("mj-burst-node--selected", ctx_r0.SelectedClusterKey === cluster_r6.Key)("rc-burst-node--selected", ctx_r0.SelectedClusterKey === cluster_r6.Key)("mj-burst-node--era", cluster_r6.IsZoomableEra);
|
|
196
|
+
i0.ɵɵdomProperty("title", cluster_r6.Tooltip);
|
|
197
|
+
i0.ɵɵattribute("aria-pressed", ctx_r0.SelectedClusterKey === cluster_r6.Key)("aria-label", cluster_r6.Tooltip);
|
|
198
|
+
i0.ɵɵadvance();
|
|
199
|
+
i0.ɵɵconditional(cluster_r6.IsZoomableEra && ctx_r0.AllowZoom ? 1 : -1);
|
|
200
|
+
i0.ɵɵadvance();
|
|
201
|
+
i0.ɵɵconditional(ctx_r0.ShowPips ? 2 : -1);
|
|
202
|
+
i0.ɵɵadvance(2);
|
|
203
|
+
i0.ɵɵtextInterpolate2(" ", cluster_r6.TotalCount, " ", cluster_r6.TotalCount === 1 ? ctx_r0.ItemSingularNoun : ctx_r0.ItemPluralNoun, " ");
|
|
204
|
+
i0.ɵɵadvance(2);
|
|
205
|
+
i0.ɵɵtextInterpolate(cluster_r6.Label);
|
|
206
|
+
i0.ɵɵadvance(2);
|
|
207
|
+
i0.ɵɵtextInterpolate(cluster_r6.Subtitle);
|
|
208
|
+
i0.ɵɵadvance();
|
|
209
|
+
i0.ɵɵconditional(ctx_r0.ShowProportionalBar && cluster_r6.CategoryShares.length > 0 ? 9 : -1);
|
|
210
|
+
i0.ɵɵadvance();
|
|
211
|
+
i0.ɵɵconditional(ctx_r0.ShowGapConnectors && cluster_r6.GapAfterLabel ? 10 : -1);
|
|
212
|
+
} }
|
|
213
|
+
function MJBurstClusterStripComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
214
|
+
i0.ɵɵdomElementStart(0, "div", 0);
|
|
215
|
+
i0.ɵɵconditionalCreate(1, MJBurstClusterStripComponent_Conditional_0_Conditional_1_Template, 10, 6, "div", 1);
|
|
216
|
+
i0.ɵɵdomElementStart(2, "div", 2);
|
|
217
|
+
i0.ɵɵrepeaterCreate(3, MJBurstClusterStripComponent_Conditional_0_For_4_Template, 11, 17, null, null, _forTrack0);
|
|
218
|
+
i0.ɵɵdomElementEnd()();
|
|
219
|
+
} if (rf & 2) {
|
|
220
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
221
|
+
i0.ɵɵattribute("aria-label", ctx_r0.AriaLabel || ctx_r0.Title || "Activity timeline");
|
|
222
|
+
i0.ɵɵadvance();
|
|
223
|
+
i0.ɵɵconditional(ctx_r0.ShowHeader ? 1 : -1);
|
|
224
|
+
i0.ɵɵadvance(2);
|
|
225
|
+
i0.ɵɵrepeater(ctx_r0.Clusters);
|
|
226
|
+
} }
|
|
227
|
+
/**
|
|
228
|
+
* Base class for cancellable `<mj-burst-cluster-strip>` `Before*` events.
|
|
229
|
+
* Set `Cancel = true` in an event handler to abort the default action.
|
|
230
|
+
*/
|
|
231
|
+
export class MJCancellableBurstStripEvent {
|
|
232
|
+
/** Set to `true` to cancel the default behavior of this action. */
|
|
233
|
+
Cancel = false;
|
|
234
|
+
}
|
|
235
|
+
/** Cancellable event args emitted before a cluster is selected or deselected. */
|
|
236
|
+
export class MJBeforeBurstClusterSelectEventArgs extends MJCancellableBurstStripEvent {
|
|
237
|
+
Cluster;
|
|
238
|
+
PreviousCluster;
|
|
239
|
+
IsDeselecting;
|
|
240
|
+
Trigger;
|
|
241
|
+
constructor(Cluster, PreviousCluster, IsDeselecting, Trigger) {
|
|
242
|
+
super();
|
|
243
|
+
this.Cluster = Cluster;
|
|
244
|
+
this.PreviousCluster = PreviousCluster;
|
|
245
|
+
this.IsDeselecting = IsDeselecting;
|
|
246
|
+
this.Trigger = Trigger;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/** Event args emitted after a cluster selection changes. */
|
|
250
|
+
export class MJAfterBurstClusterSelectEventArgs {
|
|
251
|
+
Cluster;
|
|
252
|
+
PreviousCluster;
|
|
253
|
+
SelectedIDs;
|
|
254
|
+
SelectedItems;
|
|
255
|
+
Trigger;
|
|
256
|
+
constructor(Cluster, PreviousCluster, SelectedIDs, SelectedItems, Trigger) {
|
|
257
|
+
this.Cluster = Cluster;
|
|
258
|
+
this.PreviousCluster = PreviousCluster;
|
|
259
|
+
this.SelectedIDs = SelectedIDs;
|
|
260
|
+
this.SelectedItems = SelectedItems;
|
|
261
|
+
this.Trigger = Trigger;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/** Cancellable event args emitted before the active cluster selection is cleared. */
|
|
265
|
+
export class MJBeforeBurstSelectionClearEventArgs extends MJCancellableBurstStripEvent {
|
|
266
|
+
PreviousCluster;
|
|
267
|
+
Trigger;
|
|
268
|
+
constructor(PreviousCluster, Trigger) {
|
|
269
|
+
super();
|
|
270
|
+
this.PreviousCluster = PreviousCluster;
|
|
271
|
+
this.Trigger = Trigger;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/** Event args emitted after the active cluster selection is cleared. */
|
|
275
|
+
export class MJAfterBurstSelectionClearEventArgs {
|
|
276
|
+
PreviousCluster;
|
|
277
|
+
Trigger;
|
|
278
|
+
constructor(PreviousCluster, Trigger) {
|
|
279
|
+
this.PreviousCluster = PreviousCluster;
|
|
280
|
+
this.Trigger = Trigger;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/** Cancellable event args emitted before zooming into an era or zooming out. */
|
|
284
|
+
export class MJBeforeBurstZoomChangeEventArgs extends MJCancellableBurstStripEvent {
|
|
285
|
+
Direction;
|
|
286
|
+
TargetCluster;
|
|
287
|
+
TargetResolution;
|
|
288
|
+
NextZoomDepth;
|
|
289
|
+
Trigger;
|
|
290
|
+
constructor(Direction, TargetCluster, TargetResolution, NextZoomDepth, Trigger) {
|
|
291
|
+
super();
|
|
292
|
+
this.Direction = Direction;
|
|
293
|
+
this.TargetCluster = TargetCluster;
|
|
294
|
+
this.TargetResolution = TargetResolution;
|
|
295
|
+
this.NextZoomDepth = NextZoomDepth;
|
|
296
|
+
this.Trigger = Trigger;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/** Event args emitted after a semantic zoom transition completes. */
|
|
300
|
+
export class MJAfterBurstZoomChangeEventArgs {
|
|
301
|
+
Direction;
|
|
302
|
+
ActiveZoomBreadcrumb;
|
|
303
|
+
EffectiveResolution;
|
|
304
|
+
ZoomDepth;
|
|
305
|
+
Clusters;
|
|
306
|
+
Trigger;
|
|
307
|
+
constructor(Direction, ActiveZoomBreadcrumb, EffectiveResolution, ZoomDepth, Clusters, Trigger) {
|
|
308
|
+
this.Direction = Direction;
|
|
309
|
+
this.ActiveZoomBreadcrumb = ActiveZoomBreadcrumb;
|
|
310
|
+
this.EffectiveResolution = EffectiveResolution;
|
|
311
|
+
this.ZoomDepth = ZoomDepth;
|
|
312
|
+
this.Clusters = Clusters;
|
|
313
|
+
this.Trigger = Trigger;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/** Cancellable event args emitted before the component computes clusters from normalized items. */
|
|
317
|
+
export class MJBeforeBurstClustersRebuildEventArgs extends MJCancellableBurstStripEvent {
|
|
318
|
+
Items;
|
|
319
|
+
EffectiveResolution;
|
|
320
|
+
constructor(Items, EffectiveResolution) {
|
|
321
|
+
super();
|
|
322
|
+
this.Items = Items;
|
|
323
|
+
this.EffectiveResolution = EffectiveResolution;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/** Event args emitted after the component finishes computing clusters. */
|
|
327
|
+
export class MJAfterBurstClustersRebuildEventArgs {
|
|
328
|
+
Clusters;
|
|
329
|
+
EffectiveResolution;
|
|
330
|
+
GranularityLabel;
|
|
331
|
+
TotalItemCount;
|
|
332
|
+
constructor(Clusters, EffectiveResolution, GranularityLabel, TotalItemCount) {
|
|
333
|
+
this.Clusters = Clusters;
|
|
334
|
+
this.EffectiveResolution = EffectiveResolution;
|
|
335
|
+
this.GranularityLabel = GranularityLabel;
|
|
336
|
+
this.TotalItemCount = TotalItemCount;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/** Event args emitted when a user clicks an individual event pip inside a cluster. */
|
|
340
|
+
export class MJBurstPipClickEventArgs {
|
|
341
|
+
Pip;
|
|
342
|
+
Cluster;
|
|
343
|
+
OriginalEvent;
|
|
344
|
+
constructor(Pip, Cluster, OriginalEvent) {
|
|
345
|
+
this.Pip = Pip;
|
|
346
|
+
this.Cluster = Cluster;
|
|
347
|
+
this.OriginalEvent = OriginalEvent;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Unified filter event emitted whenever cluster selection or era zoom changes the active subset of items.
|
|
352
|
+
*/
|
|
353
|
+
export class MJBurstFilterChangedEventArgs {
|
|
354
|
+
ActiveCluster;
|
|
355
|
+
ActiveZoomBreadcrumb;
|
|
356
|
+
FilteredIDs;
|
|
357
|
+
FilteredItems;
|
|
358
|
+
ActiveFilterLabel;
|
|
359
|
+
constructor(ActiveCluster, ActiveZoomBreadcrumb,
|
|
360
|
+
/** Set of matching item IDs, or `null` when no cluster/zoom filter is active (all items match). */
|
|
361
|
+
FilteredIDs,
|
|
362
|
+
/** Matching normalized items (all items when no filter is active). */
|
|
363
|
+
FilteredItems,
|
|
364
|
+
/** Human-readable label of the active filter (e.g. `'Oct 15'` or `'2024'`), or `null` when unfiltered. */
|
|
365
|
+
ActiveFilterLabel) {
|
|
366
|
+
this.ActiveCluster = ActiveCluster;
|
|
367
|
+
this.ActiveZoomBreadcrumb = ActiveZoomBreadcrumb;
|
|
368
|
+
this.FilteredIDs = FilteredIDs;
|
|
369
|
+
this.FilteredItems = FilteredItems;
|
|
370
|
+
this.ActiveFilterLabel = ActiveFilterLabel;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const DEFAULT_FALLBACK_COLORS = [
|
|
374
|
+
'var(--mj-brand-primary)',
|
|
375
|
+
'var(--mj-status-success)',
|
|
376
|
+
'#8b5cf6',
|
|
377
|
+
'var(--mj-status-info)',
|
|
378
|
+
'var(--mj-status-warning)',
|
|
379
|
+
'var(--mj-status-error)'
|
|
380
|
+
];
|
|
381
|
+
/**
|
|
382
|
+
* `<mj-burst-cluster-strip>` — General-purpose, domain-agnostic Burst-Aware Cluster Strip for
|
|
383
|
+
* irregular and multi-year time-series data.
|
|
384
|
+
*
|
|
385
|
+
* Instead of dividing wall-clock time into fixed equal width buckets (which produces mostly empty
|
|
386
|
+
* columns when events occur in irregular bursts separated by weeks, months, or years),
|
|
387
|
+
* `<mj-burst-cluster-strip>` groups events into active bursts separated by non-linear quiet-time
|
|
388
|
+
* gap connectors (`⋯ 11 mos quiet ⋯`), and automatically scales to multi-year histories via
|
|
389
|
+
* adaptive era coalescing (`Year` → `Quarter/Month` → `Session Burst`) with semantic Click-to-Zoom!
|
|
390
|
+
*/
|
|
391
|
+
export class MJBurstClusterStripComponent {
|
|
392
|
+
cdr = inject(ChangeDetectorRef);
|
|
393
|
+
// ─── Generic Data Inputs ────────────────────────────────────────────────────
|
|
394
|
+
/**
|
|
395
|
+
* Pre-normalized array of time-series items (`MJBurstClusterItem<T>[]`).
|
|
396
|
+
* Alternatively, pass raw domain objects via `[Data]` + `[FieldMap]` (or `[TimestampField]`, etc.).
|
|
397
|
+
*/
|
|
398
|
+
Items = null;
|
|
399
|
+
/**
|
|
400
|
+
* Optional raw domain array (`T[]`). Mapped into `MJBurstClusterItem<T>[]` via `[FieldMap]`
|
|
401
|
+
* or `[IdField]` / `[TimestampField]` / `[CategoryField]` / `[TooltipField]` / `[WeightField]`.
|
|
402
|
+
*/
|
|
403
|
+
Data = null;
|
|
404
|
+
/**
|
|
405
|
+
* Optional property-name or extractor-function map for `[Data]`.
|
|
406
|
+
*/
|
|
407
|
+
FieldMap = null;
|
|
408
|
+
/** Property name or extractor for `ID` when binding `[Data]`. Defaults to `'ID'`. */
|
|
409
|
+
IdField = 'ID';
|
|
410
|
+
/** Property name or extractor for `Timestamp` when binding `[Data]`. Defaults to `'Timestamp'`. */
|
|
411
|
+
TimestampField = 'Timestamp';
|
|
412
|
+
/** Property name or extractor for `Category` when binding `[Data]`. Defaults to `'Category'`. */
|
|
413
|
+
CategoryField = null;
|
|
414
|
+
/** Property name or extractor for `Tooltip` when binding `[Data]`. */
|
|
415
|
+
TooltipField = null;
|
|
416
|
+
/** Property name or extractor for `Weight` when binding `[Data]`. */
|
|
417
|
+
WeightField = null;
|
|
418
|
+
/**
|
|
419
|
+
* Category definitions controlling pip colors, legend labels, and subtitle phrasing.
|
|
420
|
+
* When omitted, categories are auto-derived from the input items.
|
|
421
|
+
*/
|
|
422
|
+
Categories = null;
|
|
423
|
+
// ─── Grouping, Coalescing & Resolution Inputs ───────────────────────────────
|
|
424
|
+
/**
|
|
425
|
+
* Grouping resolution (`'auto' | 'session' | 'day' | 'week' | 'month' | 'quarter' | 'year'`).
|
|
426
|
+
* Defaults to `'auto'`.
|
|
427
|
+
*/
|
|
428
|
+
Resolution = 'auto';
|
|
429
|
+
/**
|
|
430
|
+
* Strategy when raw session bursts exceed `MaxClusters` in `'auto'` mode:
|
|
431
|
+
* - `'adaptive-era'` (default): Switches to `year` or `quarter`/`month` era nodes when raw bursts exceed
|
|
432
|
+
* `EraZoomThreshold` across multiple years/months, enabling semantic Click-to-Zoom drill-down.
|
|
433
|
+
* - `'merge-closest'`: Always merges the two chronologically closest adjacent bursts down to `MaxClusters`.
|
|
434
|
+
*/
|
|
435
|
+
CoalesceStrategy = 'adaptive-era';
|
|
436
|
+
/**
|
|
437
|
+
* Maximum hours between adjacent events to coalesce into the same session burst (default `6`).
|
|
438
|
+
*/
|
|
439
|
+
SessionGapHours = 6;
|
|
440
|
+
/**
|
|
441
|
+
* Whether events occurring on the same UTC calendar day automatically group into the same session burst (default `true`).
|
|
442
|
+
*/
|
|
443
|
+
GroupSameCalendarDay = true;
|
|
444
|
+
/**
|
|
445
|
+
* Maximum number of session burst cards rendered in the strip before closest-gap coalescing (default `5`).
|
|
446
|
+
*/
|
|
447
|
+
MaxClusters = 5;
|
|
448
|
+
/**
|
|
449
|
+
* Raw session burst threshold above which `'adaptive-era'` switches to multi-month/year era buckets (default `10`).
|
|
450
|
+
*/
|
|
451
|
+
EraZoomThreshold = 10;
|
|
452
|
+
/**
|
|
453
|
+
* Whether clicking a multi-month/year era cluster drills into that era's finer bursts with a breadcrumb (default `true`).
|
|
454
|
+
*/
|
|
455
|
+
AllowZoom = true;
|
|
456
|
+
/**
|
|
457
|
+
* Maximum individual event pips rendered inside a cluster card before `+N` overflow indicator (default `12`).
|
|
458
|
+
*/
|
|
459
|
+
MaxPipsPerCluster = 12;
|
|
460
|
+
/**
|
|
461
|
+
* Minimum quiet time gap in hours required before rendering a quiet-gap connector pill between clusters (default `48`).
|
|
462
|
+
*/
|
|
463
|
+
MinGapQuietHours = 48;
|
|
464
|
+
// ─── Display & Chrome Inputs ────────────────────────────────────────────────
|
|
465
|
+
/** Header title text (default `'Activity Timeline'`). */
|
|
466
|
+
Title = 'Activity Timeline';
|
|
467
|
+
/** Font Awesome icon class rendered next to `Title` (default `'fa-solid fa-wave-square'`). */
|
|
468
|
+
TitleIcon = 'fa-solid fa-wave-square';
|
|
469
|
+
/** Accessible region label override. */
|
|
470
|
+
AriaLabel = null;
|
|
471
|
+
/** Singular noun for event counts on cluster cards (default `'event'`; e.g. `'change'`). */
|
|
472
|
+
ItemSingularNoun = 'event';
|
|
473
|
+
/** Plural noun for event counts on cluster cards (default `'events'`; e.g. `'changes'`). */
|
|
474
|
+
ItemPluralNoun = 'events';
|
|
475
|
+
/** Whether to render the top header bar with title, granularity badge, zoom breadcrumb, and legend (default `true`). */
|
|
476
|
+
ShowHeader = true;
|
|
477
|
+
/** Whether to render the category color legend in the header (default `true`). */
|
|
478
|
+
ShowLegend = true;
|
|
479
|
+
/** Whether to render non-linear quiet-time gap connectors (`⋯ 11 mos quiet ⋯`) between clusters (default `true`). */
|
|
480
|
+
ShowGapConnectors = true;
|
|
481
|
+
/** Whether to render individual event pips inside each cluster card (default `true`). */
|
|
482
|
+
ShowPips = true;
|
|
483
|
+
/** Whether to render a stacked category proportion bar at the bottom of each cluster card (default `false`). */
|
|
484
|
+
ShowProportionalBar = false;
|
|
485
|
+
/** Optional custom subtitle formatter callback for each cluster card. */
|
|
486
|
+
SubtitleFormatter = null;
|
|
487
|
+
/** Currently selected cluster key (supports two-way `[(SelectedClusterKey)]` binding). */
|
|
488
|
+
SelectedClusterKey = null;
|
|
489
|
+
// ─── Outputs (Including Before/After Cancellable Lifecycle Events) ──────────
|
|
490
|
+
/** Emits when `SelectedClusterKey` changes (supports two-way `[(SelectedClusterKey)]`). */
|
|
491
|
+
SelectedClusterKeyChange = new EventEmitter();
|
|
492
|
+
/** Cancellable event emitted before a cluster card is selected or deselected. */
|
|
493
|
+
BeforeClusterSelect = new EventEmitter();
|
|
494
|
+
/** Emitted after a cluster card is selected or deselected. */
|
|
495
|
+
AfterClusterSelect = new EventEmitter();
|
|
496
|
+
/** Cancellable event emitted before the active cluster filter is cleared. */
|
|
497
|
+
BeforeSelectionClear = new EventEmitter();
|
|
498
|
+
/** Emitted after the active cluster filter is cleared. */
|
|
499
|
+
AfterSelectionClear = new EventEmitter();
|
|
500
|
+
/** Cancellable event emitted before zooming into an era node or zooming back out. */
|
|
501
|
+
BeforeZoomChange = new EventEmitter();
|
|
502
|
+
/** Emitted after a semantic zoom transition completes. */
|
|
503
|
+
AfterZoomChange = new EventEmitter();
|
|
504
|
+
/** Cancellable event emitted before clusters are computed from the input items. */
|
|
505
|
+
BeforeClustersRebuild = new EventEmitter();
|
|
506
|
+
/** Emitted after clusters have been computed. */
|
|
507
|
+
AfterClustersRebuild = new EventEmitter();
|
|
508
|
+
/** Emitted when the user clicks an individual event pip inside a cluster card. */
|
|
509
|
+
PipClicked = new EventEmitter();
|
|
510
|
+
/** Unified convenience event emitted whenever cluster selection or era zoom updates the active filtered item set. */
|
|
511
|
+
FilterChanged = new EventEmitter();
|
|
512
|
+
// ─── Public Computed State ──────────────────────────────────────────────────
|
|
513
|
+
/** Computed cluster nodes currently visible in the strip. */
|
|
514
|
+
Clusters = [];
|
|
515
|
+
/** Effective grouping resolution for the current view. */
|
|
516
|
+
EffectiveResolution = 'session';
|
|
517
|
+
/** Human-readable summary of the current strip granularity (e.g. `'3 bursts · 11 mos span'`). */
|
|
518
|
+
GranularityLabel = '';
|
|
519
|
+
/** Resolved category definitions (either from `[Categories]` or auto-discovered from items). */
|
|
520
|
+
ResolvedCategories = [];
|
|
521
|
+
/** Stack of active semantic zoom breadcrumbs when drilling into multi-year/month eras. */
|
|
522
|
+
ZoomStack = [];
|
|
523
|
+
_normalizedItems = [];
|
|
524
|
+
ngOnChanges(changes) {
|
|
525
|
+
const dataChanged = Boolean(changes['Items'] ||
|
|
526
|
+
changes['Data'] ||
|
|
527
|
+
changes['FieldMap'] ||
|
|
528
|
+
changes['IdField'] ||
|
|
529
|
+
changes['TimestampField'] ||
|
|
530
|
+
changes['CategoryField'] ||
|
|
531
|
+
changes['TooltipField'] ||
|
|
532
|
+
changes['WeightField']);
|
|
533
|
+
const configChanged = Boolean(changes['Categories'] ||
|
|
534
|
+
changes['Resolution'] ||
|
|
535
|
+
changes['CoalesceStrategy'] ||
|
|
536
|
+
changes['SessionGapHours'] ||
|
|
537
|
+
changes['GroupSameCalendarDay'] ||
|
|
538
|
+
changes['MaxClusters'] ||
|
|
539
|
+
changes['EraZoomThreshold'] ||
|
|
540
|
+
changes['MaxPipsPerCluster'] ||
|
|
541
|
+
changes['MinGapQuietHours'] ||
|
|
542
|
+
changes['SubtitleFormatter']);
|
|
543
|
+
if (dataChanged) {
|
|
544
|
+
this.ZoomStack = [];
|
|
545
|
+
}
|
|
546
|
+
if (dataChanged || configChanged) {
|
|
547
|
+
this.Rebuild();
|
|
548
|
+
}
|
|
549
|
+
else if (changes['SelectedClusterKey']) {
|
|
550
|
+
this.cdr.markForCheck();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
// ─── Public Imperative Methods ──────────────────────────────────────────────
|
|
554
|
+
/**
|
|
555
|
+
* Recomputes normalized items, category definitions, and burst/era clusters for the current zoom state.
|
|
556
|
+
*/
|
|
557
|
+
Rebuild() {
|
|
558
|
+
this._normalizedItems = this.normalizeSourceItems();
|
|
559
|
+
this.ResolvedCategories = this.resolveCategories(this._normalizedItems);
|
|
560
|
+
this.rebuildClustersInternal();
|
|
561
|
+
this.cdr.markForCheck();
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Programmatically selects a cluster by key (or clears selection when `clusterKey === null`).
|
|
565
|
+
* Fires `BeforeClusterSelect` (cancellable) and `AfterClusterSelect`.
|
|
566
|
+
*/
|
|
567
|
+
SelectCluster(clusterKey, trigger = 'api') {
|
|
568
|
+
if (clusterKey === null) {
|
|
569
|
+
return this.ClearSelection(trigger);
|
|
570
|
+
}
|
|
571
|
+
const target = this.Clusters.find(c => c.Key === clusterKey);
|
|
572
|
+
if (!target || target.TotalCount === 0) {
|
|
573
|
+
return false;
|
|
574
|
+
}
|
|
575
|
+
const prev = this.SelectedCluster;
|
|
576
|
+
const isDeselecting = this.SelectedClusterKey === clusterKey;
|
|
577
|
+
const beforeArgs = new MJBeforeBurstClusterSelectEventArgs(target, prev, isDeselecting, trigger);
|
|
578
|
+
this.BeforeClusterSelect.emit(beforeArgs);
|
|
579
|
+
if (beforeArgs.Cancel) {
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
582
|
+
this.SelectedClusterKey = isDeselecting ? null : clusterKey;
|
|
583
|
+
this.SelectedClusterKeyChange.emit(this.SelectedClusterKey);
|
|
584
|
+
const nextSelected = this.SelectedCluster;
|
|
585
|
+
const afterArgs = new MJAfterBurstClusterSelectEventArgs(nextSelected, prev, nextSelected ? new Set(nextSelected.ItemIDs) : null, nextSelected ? [...nextSelected.Items] : [...this.ActiveScopeItems], trigger);
|
|
586
|
+
this.AfterClusterSelect.emit(afterArgs);
|
|
587
|
+
this.emitFilterChanged();
|
|
588
|
+
this.cdr.markForCheck();
|
|
589
|
+
return true;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Toggles the selection state of the specified cluster key.
|
|
593
|
+
*/
|
|
594
|
+
ToggleCluster(clusterKey, trigger = 'api') {
|
|
595
|
+
return this.SelectCluster(clusterKey, trigger);
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Clears the currently selected cluster filter.
|
|
599
|
+
* Fires `BeforeSelectionClear` (cancellable) and `AfterSelectionClear`.
|
|
600
|
+
*/
|
|
601
|
+
ClearSelection(trigger = 'api') {
|
|
602
|
+
if (!this.SelectedClusterKey) {
|
|
603
|
+
return false;
|
|
604
|
+
}
|
|
605
|
+
const prev = this.SelectedCluster;
|
|
606
|
+
const beforeArgs = new MJBeforeBurstSelectionClearEventArgs(prev, trigger);
|
|
607
|
+
this.BeforeSelectionClear.emit(beforeArgs);
|
|
608
|
+
if (beforeArgs.Cancel) {
|
|
609
|
+
return false;
|
|
610
|
+
}
|
|
611
|
+
this.SelectedClusterKey = null;
|
|
612
|
+
this.SelectedClusterKeyChange.emit(null);
|
|
613
|
+
this.AfterSelectionClear.emit(new MJAfterBurstSelectionClearEventArgs(prev, trigger));
|
|
614
|
+
this.emitFilterChanged();
|
|
615
|
+
this.cdr.markForCheck();
|
|
616
|
+
return true;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Drills down into a multi-month/year era cluster to inspect its inner bursts.
|
|
620
|
+
* Fires `BeforeZoomChange` (cancellable) and `AfterZoomChange`.
|
|
621
|
+
*/
|
|
622
|
+
ZoomIntoCluster(clusterKey, trigger = 'api') {
|
|
623
|
+
if (!this.AllowZoom) {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
const target = this.Clusters.find(c => c.Key === clusterKey);
|
|
627
|
+
if (!target || !target.IsZoomableEra || target.Items.length === 0) {
|
|
628
|
+
return false;
|
|
629
|
+
}
|
|
630
|
+
const nextRes = target.Items.length > this.EraZoomThreshold && (target.EndTime - target.StartTime) > 120 * 86_400_000
|
|
631
|
+
? 'month'
|
|
632
|
+
: 'session';
|
|
633
|
+
const beforeArgs = new MJBeforeBurstZoomChangeEventArgs('in', target, nextRes, this.ZoomStack.length + 1, trigger);
|
|
634
|
+
this.BeforeZoomChange.emit(beforeArgs);
|
|
635
|
+
if (beforeArgs.Cancel) {
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
this.ZoomStack = [
|
|
639
|
+
...this.ZoomStack,
|
|
640
|
+
{
|
|
641
|
+
ClusterKey: target.Key,
|
|
642
|
+
Label: target.Label,
|
|
643
|
+
StartTime: target.StartTime,
|
|
644
|
+
EndTime: target.EndTime,
|
|
645
|
+
Items: [...target.Items],
|
|
646
|
+
Resolution: nextRes
|
|
647
|
+
}
|
|
648
|
+
];
|
|
649
|
+
this.SelectedClusterKey = null;
|
|
650
|
+
this.SelectedClusterKeyChange.emit(null);
|
|
651
|
+
this.rebuildClustersInternal();
|
|
652
|
+
this.AfterZoomChange.emit(new MJAfterBurstZoomChangeEventArgs('in', this.ActiveZoomBreadcrumb, this.EffectiveResolution, this.ZoomStack.length, this.Clusters, trigger));
|
|
653
|
+
this.emitFilterChanged();
|
|
654
|
+
this.cdr.markForCheck();
|
|
655
|
+
return true;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Zooms out one level (or to `targetDepth`, where `0` is the full root timeline).
|
|
659
|
+
* Fires `BeforeZoomChange` (cancellable) and `AfterZoomChange`.
|
|
660
|
+
*/
|
|
661
|
+
ZoomOut(targetDepth = Math.max(0, this.ZoomStack.length - 1), trigger = 'api') {
|
|
662
|
+
if (this.ZoomStack.length === 0) {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
const clampedDepth = Math.max(0, Math.min(targetDepth, this.ZoomStack.length - 1));
|
|
666
|
+
const targetCrumb = clampedDepth > 0 ? this.ZoomStack[clampedDepth - 1] : null;
|
|
667
|
+
const nextRes = targetCrumb
|
|
668
|
+
? targetCrumb.Resolution
|
|
669
|
+
: this.determineEffectiveResolution(this._normalizedItems);
|
|
670
|
+
const beforeArgs = new MJBeforeBurstZoomChangeEventArgs(clampedDepth === 0 ? 'reset' : 'out', null, nextRes, clampedDepth, trigger);
|
|
671
|
+
this.BeforeZoomChange.emit(beforeArgs);
|
|
672
|
+
if (beforeArgs.Cancel) {
|
|
673
|
+
return false;
|
|
674
|
+
}
|
|
675
|
+
this.ZoomStack = this.ZoomStack.slice(0, clampedDepth);
|
|
676
|
+
this.SelectedClusterKey = null;
|
|
677
|
+
this.SelectedClusterKeyChange.emit(null);
|
|
678
|
+
this.rebuildClustersInternal();
|
|
679
|
+
this.AfterZoomChange.emit(new MJAfterBurstZoomChangeEventArgs(clampedDepth === 0 ? 'reset' : 'out', this.ActiveZoomBreadcrumb, this.EffectiveResolution, this.ZoomStack.length, this.Clusters, trigger));
|
|
680
|
+
this.emitFilterChanged();
|
|
681
|
+
this.cdr.markForCheck();
|
|
682
|
+
return true;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Resets the semantic zoom stack all the way back to the root overview.
|
|
686
|
+
*/
|
|
687
|
+
ResetZoom(trigger = 'api') {
|
|
688
|
+
return this.ZoomOut(0, trigger);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Returns the cluster node matching `key`, or `undefined`.
|
|
692
|
+
*/
|
|
693
|
+
GetClusterByKey(key) {
|
|
694
|
+
return this.Clusters.find(c => c.Key === key);
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Returns the set of item IDs matching the active cluster selection (or active zoom era),
|
|
698
|
+
* or `null` when no cluster/zoom filter is active.
|
|
699
|
+
*/
|
|
700
|
+
GetSelectedIDs() {
|
|
701
|
+
const selected = this.SelectedCluster;
|
|
702
|
+
if (selected) {
|
|
703
|
+
return new Set(selected.ItemIDs);
|
|
704
|
+
}
|
|
705
|
+
const zoom = this.ActiveZoomBreadcrumb;
|
|
706
|
+
if (zoom) {
|
|
707
|
+
return new Set(zoom.Items.map(i => i.ID));
|
|
708
|
+
}
|
|
709
|
+
return null;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Returns the normalized `MJBurstClusterItem<T>[]` matching the active cluster/zoom filter
|
|
713
|
+
* (or all items when no filter is active).
|
|
714
|
+
*/
|
|
715
|
+
GetSelectedItems() {
|
|
716
|
+
const selected = this.SelectedCluster;
|
|
717
|
+
if (selected) {
|
|
718
|
+
return [...selected.Items];
|
|
719
|
+
}
|
|
720
|
+
return [...this.ActiveScopeItems];
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Returns the caller's underlying `Data: T` payloads matching the active cluster/zoom filter.
|
|
724
|
+
*/
|
|
725
|
+
GetSelectedData() {
|
|
726
|
+
return this.GetSelectedItems()
|
|
727
|
+
.map(i => i.Data)
|
|
728
|
+
.filter((d) => d !== undefined);
|
|
729
|
+
}
|
|
730
|
+
// ─── Public Getters ─────────────────────────────────────────────────────────
|
|
731
|
+
/** Currently selected cluster node, or `null`. */
|
|
732
|
+
get SelectedCluster() {
|
|
733
|
+
if (!this.SelectedClusterKey)
|
|
734
|
+
return null;
|
|
735
|
+
return this.Clusters.find(c => c.Key === this.SelectedClusterKey) ?? null;
|
|
736
|
+
}
|
|
737
|
+
/** Display label of the currently selected cluster, or `null`. */
|
|
738
|
+
get SelectedClusterLabel() {
|
|
739
|
+
return this.SelectedCluster?.Label ?? null;
|
|
740
|
+
}
|
|
741
|
+
/** Current deepest zoom breadcrumb, or `null` when at root overview. */
|
|
742
|
+
get ActiveZoomBreadcrumb() {
|
|
743
|
+
return this.ZoomStack.length > 0 ? this.ZoomStack[this.ZoomStack.length - 1] : null;
|
|
744
|
+
}
|
|
745
|
+
/** Label for the zoom-out breadcrumb button (e.g. `'All Years (640)'` or parent era label). */
|
|
746
|
+
get ZoomBackLabel() {
|
|
747
|
+
if (this.ZoomStack.length <= 1) {
|
|
748
|
+
return `All (${this._normalizedItems.length})`;
|
|
749
|
+
}
|
|
750
|
+
const parent = this.ZoomStack[this.ZoomStack.length - 2];
|
|
751
|
+
return parent.Label;
|
|
752
|
+
}
|
|
753
|
+
/** Items in the current zoom scope (or all normalized items when at root). */
|
|
754
|
+
get ActiveScopeItems() {
|
|
755
|
+
const crumb = this.ActiveZoomBreadcrumb;
|
|
756
|
+
return crumb ? crumb.Items : this._normalizedItems;
|
|
757
|
+
}
|
|
758
|
+
// ─── Template Event Handlers ────────────────────────────────────────────────
|
|
759
|
+
OnClusterClick(cluster, event) {
|
|
760
|
+
event.stopPropagation();
|
|
761
|
+
if (cluster.IsZoomableEra && this.AllowZoom) {
|
|
762
|
+
this.ZoomIntoCluster(cluster.Key, 'click');
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
this.SelectCluster(cluster.Key, 'click');
|
|
766
|
+
}
|
|
767
|
+
OnClearSelectionClick(event) {
|
|
768
|
+
event.stopPropagation();
|
|
769
|
+
this.ClearSelection('click');
|
|
770
|
+
}
|
|
771
|
+
OnZoomBackClick(event) {
|
|
772
|
+
event.stopPropagation();
|
|
773
|
+
this.ZoomOut(this.ZoomStack.length - 1, 'click');
|
|
774
|
+
}
|
|
775
|
+
OnPipClick(pip, cluster, event) {
|
|
776
|
+
this.PipClicked.emit(new MJBurstPipClickEventArgs(pip, cluster, event));
|
|
777
|
+
}
|
|
778
|
+
// ─── Internal Clustering & Normalization Pipeline ───────────────────────────
|
|
779
|
+
normalizeSourceItems() {
|
|
780
|
+
if (this.Items && this.Items.length > 0) {
|
|
781
|
+
return this.Items
|
|
782
|
+
.map((item, idx) => ({
|
|
783
|
+
ID: String(item.ID ?? `item-${idx}`),
|
|
784
|
+
Timestamp: item.Timestamp,
|
|
785
|
+
Category: item.Category ?? 'default',
|
|
786
|
+
Tooltip: item.Tooltip,
|
|
787
|
+
Weight: item.Weight ?? 1,
|
|
788
|
+
Data: item.Data
|
|
789
|
+
}))
|
|
790
|
+
.filter(item => Number.isFinite(this.toEpochMs(item.Timestamp)))
|
|
791
|
+
.sort((a, b) => this.toEpochMs(a.Timestamp) - this.toEpochMs(b.Timestamp));
|
|
792
|
+
}
|
|
793
|
+
if (!this.Data || this.Data.length === 0) {
|
|
794
|
+
return [];
|
|
795
|
+
}
|
|
796
|
+
const idSpec = this.FieldMap?.ID ?? this.IdField;
|
|
797
|
+
const tsSpec = this.FieldMap?.Timestamp ?? this.TimestampField;
|
|
798
|
+
const catSpec = this.FieldMap?.Category ?? this.CategoryField;
|
|
799
|
+
const tipSpec = this.FieldMap?.Tooltip ?? this.TooltipField;
|
|
800
|
+
const weightSpec = this.FieldMap?.Weight ?? this.WeightField;
|
|
801
|
+
const out = [];
|
|
802
|
+
for (let i = 0; i < this.Data.length; i++) {
|
|
803
|
+
const raw = this.Data[i];
|
|
804
|
+
const tsVal = this.extractField(raw, i, tsSpec);
|
|
805
|
+
const ms = this.toEpochMs(tsVal);
|
|
806
|
+
if (!Number.isFinite(ms))
|
|
807
|
+
continue;
|
|
808
|
+
const idVal = this.extractField(raw, i, idSpec);
|
|
809
|
+
const catVal = catSpec ? this.extractField(raw, i, catSpec) : 'default';
|
|
810
|
+
const tipVal = tipSpec ? this.extractField(raw, i, tipSpec) : undefined;
|
|
811
|
+
const weightVal = weightSpec ? Number(this.extractField(raw, i, weightSpec)) : 1;
|
|
812
|
+
out.push({
|
|
813
|
+
ID: idVal != null && String(idVal).length > 0 ? String(idVal) : `item-${i}`,
|
|
814
|
+
Timestamp: ms,
|
|
815
|
+
Category: catVal != null && String(catVal).length > 0 ? String(catVal) : 'default',
|
|
816
|
+
Tooltip: tipVal != null ? String(tipVal) : undefined,
|
|
817
|
+
Weight: Number.isFinite(weightVal) ? weightVal : 1,
|
|
818
|
+
Data: raw
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
return out.sort((a, b) => this.toEpochMs(a.Timestamp) - this.toEpochMs(b.Timestamp));
|
|
822
|
+
}
|
|
823
|
+
extractField(item, index, spec) {
|
|
824
|
+
if (typeof spec === 'function') {
|
|
825
|
+
return spec(item, index);
|
|
826
|
+
}
|
|
827
|
+
if (item && typeof item === 'object') {
|
|
828
|
+
return item[spec];
|
|
829
|
+
}
|
|
830
|
+
return undefined;
|
|
831
|
+
}
|
|
832
|
+
resolveCategories(items) {
|
|
833
|
+
if (this.Categories && this.Categories.length > 0) {
|
|
834
|
+
return [...this.Categories];
|
|
835
|
+
}
|
|
836
|
+
const seen = new Set();
|
|
837
|
+
const discovered = [];
|
|
838
|
+
for (const item of items) {
|
|
839
|
+
const key = item.Category || 'default';
|
|
840
|
+
if (seen.has(key))
|
|
841
|
+
continue;
|
|
842
|
+
seen.add(key);
|
|
843
|
+
const color = DEFAULT_FALLBACK_COLORS[discovered.length % DEFAULT_FALLBACK_COLORS.length];
|
|
844
|
+
const humanized = key.charAt(0).toUpperCase() + key.slice(1);
|
|
845
|
+
discovered.push({
|
|
846
|
+
Key: key,
|
|
847
|
+
Label: humanized,
|
|
848
|
+
SingularLabel: key.toLowerCase(),
|
|
849
|
+
PluralLabel: `${key.toLowerCase()}s`,
|
|
850
|
+
Color: color,
|
|
851
|
+
CssModifier: key.toLowerCase()
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
return discovered;
|
|
855
|
+
}
|
|
856
|
+
determineEffectiveResolution(items) {
|
|
857
|
+
const activeZoom = this.ActiveZoomBreadcrumb;
|
|
858
|
+
if (activeZoom) {
|
|
859
|
+
return activeZoom.Resolution;
|
|
860
|
+
}
|
|
861
|
+
if (this.Resolution !== 'auto') {
|
|
862
|
+
return this.Resolution;
|
|
863
|
+
}
|
|
864
|
+
if (items.length === 0 || this.CoalesceStrategy === 'merge-closest') {
|
|
865
|
+
return 'session';
|
|
866
|
+
}
|
|
867
|
+
const rawBursts = this.buildInitialSessionClusters(items);
|
|
868
|
+
if (rawBursts.length <= this.EraZoomThreshold) {
|
|
869
|
+
return 'session';
|
|
870
|
+
}
|
|
871
|
+
const minMs = this.toEpochMs(items[0].Timestamp);
|
|
872
|
+
const maxMs = this.toEpochMs(items[items.length - 1].Timestamp);
|
|
873
|
+
const spanDays = (maxMs - minMs) / 86_400_000;
|
|
874
|
+
const startYear = new Date(minMs).getUTCFullYear();
|
|
875
|
+
const endYear = new Date(maxMs).getUTCFullYear();
|
|
876
|
+
if (endYear - startYear >= 2 || spanDays >= 540) {
|
|
877
|
+
return 'year';
|
|
878
|
+
}
|
|
879
|
+
if (spanDays >= 120) {
|
|
880
|
+
return 'month';
|
|
881
|
+
}
|
|
882
|
+
return 'session';
|
|
883
|
+
}
|
|
884
|
+
rebuildClustersInternal() {
|
|
885
|
+
const scopeItems = [...this.ActiveScopeItems];
|
|
886
|
+
if (scopeItems.length === 0) {
|
|
887
|
+
this.Clusters = [];
|
|
888
|
+
this.GranularityLabel = '';
|
|
889
|
+
this.SelectedClusterKey = null;
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
const effectiveRes = this.determineEffectiveResolution(scopeItems);
|
|
893
|
+
const beforeArgs = new MJBeforeBurstClustersRebuildEventArgs(scopeItems, effectiveRes);
|
|
894
|
+
this.BeforeClustersRebuild.emit(beforeArgs);
|
|
895
|
+
if (beforeArgs.Cancel) {
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
const workingItems = beforeArgs.Items;
|
|
899
|
+
this.EffectiveResolution = beforeArgs.EffectiveResolution;
|
|
900
|
+
const rawGroups = this.EffectiveResolution === 'session'
|
|
901
|
+
? this.buildMergedSessionClusters(workingItems)
|
|
902
|
+
: this.buildCalendarResolutionClusters(workingItems, this.EffectiveResolution);
|
|
903
|
+
const minTime = this.toEpochMs(workingItems[0].Timestamp);
|
|
904
|
+
const maxTime = this.toEpochMs(workingItems[workingItems.length - 1].Timestamp);
|
|
905
|
+
const totalSpanMs = Math.max(0, maxTime - minTime);
|
|
906
|
+
const maxCount = Math.max(1, ...rawGroups.map(g => g.items.length));
|
|
907
|
+
const categoryByKey = new Map(this.ResolvedCategories.map(c => [c.Key, c]));
|
|
908
|
+
const isEraMode = this.AllowZoom &&
|
|
909
|
+
(this.EffectiveResolution === 'year' ||
|
|
910
|
+
this.EffectiveResolution === 'quarter' ||
|
|
911
|
+
this.EffectiveResolution === 'month');
|
|
912
|
+
const nodes = rawGroups.map((group, idx) => {
|
|
913
|
+
const categoryCounts = {};
|
|
914
|
+
const itemIds = new Set();
|
|
915
|
+
const pips = [];
|
|
916
|
+
let totalWeight = 0;
|
|
917
|
+
for (const item of group.items) {
|
|
918
|
+
itemIds.add(item.ID);
|
|
919
|
+
const catKey = item.Category || 'default';
|
|
920
|
+
categoryCounts[catKey] = (categoryCounts[catKey] ?? 0) + 1;
|
|
921
|
+
totalWeight += item.Weight ?? 1;
|
|
922
|
+
if (pips.length < this.MaxPipsPerCluster) {
|
|
923
|
+
const catDef = categoryByKey.get(catKey);
|
|
924
|
+
const color = catDef?.Color ?? DEFAULT_FALLBACK_COLORS[0];
|
|
925
|
+
const ms = this.toEpochMs(item.Timestamp);
|
|
926
|
+
const defaultTip = `${catDef?.Label ?? catKey} · ${new Intl.DateTimeFormat('en-US', {
|
|
927
|
+
month: 'short',
|
|
928
|
+
day: 'numeric',
|
|
929
|
+
hour: 'numeric',
|
|
930
|
+
minute: '2-digit'
|
|
931
|
+
}).format(new Date(ms))}`;
|
|
932
|
+
pips.push({
|
|
933
|
+
ID: item.ID,
|
|
934
|
+
Category: catKey,
|
|
935
|
+
Color: color,
|
|
936
|
+
CssModifier: catDef?.CssModifier ?? catKey.toLowerCase(),
|
|
937
|
+
Tooltip: item.Tooltip || defaultTip,
|
|
938
|
+
Item: item
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
const totalCount = group.items.length;
|
|
943
|
+
const label = group.explicitLabel ?? this.formatClusterDateLabel(group.startTime, group.endTime, maxTime, totalSpanMs);
|
|
944
|
+
const nextGroup = idx < rawGroups.length - 1 ? rawGroups[idx + 1] : null;
|
|
945
|
+
const gapAfterMs = nextGroup ? Math.max(0, nextGroup.startTime - group.endTime) : 0;
|
|
946
|
+
const gapAfterLabel = nextGroup ? this.formatQuietGapLabel(gapAfterMs) : null;
|
|
947
|
+
const shares = this.ResolvedCategories.map(cat => {
|
|
948
|
+
const count = categoryCounts[cat.Key] ?? 0;
|
|
949
|
+
return {
|
|
950
|
+
Key: cat.Key,
|
|
951
|
+
Label: cat.Label,
|
|
952
|
+
Color: cat.Color,
|
|
953
|
+
Count: count,
|
|
954
|
+
SharePercent: totalCount > 0 ? Math.round((count / totalCount) * 100) : 0
|
|
955
|
+
};
|
|
956
|
+
});
|
|
957
|
+
const node = {
|
|
958
|
+
Key: group.key ?? `burst-${idx}-${group.startTime}`,
|
|
959
|
+
Label: label,
|
|
960
|
+
Subtitle: '',
|
|
961
|
+
GapAfterLabel: gapAfterLabel,
|
|
962
|
+
GapAfterMs: gapAfterMs,
|
|
963
|
+
Pips: pips,
|
|
964
|
+
OverflowPipCount: Math.max(0, totalCount - pips.length),
|
|
965
|
+
Tooltip: '',
|
|
966
|
+
StartTime: group.startTime,
|
|
967
|
+
EndTime: group.endTime,
|
|
968
|
+
TotalCount: totalCount,
|
|
969
|
+
TotalWeight: totalWeight,
|
|
970
|
+
CategoryCounts: categoryCounts,
|
|
971
|
+
CategoryShares: shares,
|
|
972
|
+
HeightPercent: Math.max(22, Math.round((totalCount / maxCount) * 100)),
|
|
973
|
+
ItemIDs: itemIds,
|
|
974
|
+
Items: group.items,
|
|
975
|
+
IsZoomableEra: isEraMode && totalCount > 1
|
|
976
|
+
};
|
|
977
|
+
node.Subtitle = this.SubtitleFormatter
|
|
978
|
+
? this.SubtitleFormatter(node, this.ResolvedCategories)
|
|
979
|
+
: this.formatDefaultSubtitle(node);
|
|
980
|
+
node.Tooltip = this.formatDefaultTooltip(node);
|
|
981
|
+
return node;
|
|
982
|
+
});
|
|
983
|
+
this.Clusters = nodes;
|
|
984
|
+
const unitPlural = isEraMode ? 'eras' : 'bursts';
|
|
985
|
+
const unitSingular = isEraMode ? 'era' : 'burst';
|
|
986
|
+
this.GranularityLabel =
|
|
987
|
+
nodes.length === 1
|
|
988
|
+
? `1 active ${unitSingular}`
|
|
989
|
+
: `${nodes.length} ${unitPlural} · ${this.formatTotalSpanLabel(totalSpanMs)}`;
|
|
990
|
+
if (this.SelectedClusterKey && !this.Clusters.some(c => c.Key === this.SelectedClusterKey)) {
|
|
991
|
+
this.SelectedClusterKey = null;
|
|
992
|
+
}
|
|
993
|
+
this.AfterClustersRebuild.emit(new MJAfterBurstClustersRebuildEventArgs(this.Clusters, this.EffectiveResolution, this.GranularityLabel, workingItems.length));
|
|
994
|
+
}
|
|
995
|
+
buildInitialSessionClusters(items) {
|
|
996
|
+
const sessionGapThresholdMs = Math.max(0, this.SessionGapHours) * 3_600_000;
|
|
997
|
+
const clusters = [];
|
|
998
|
+
for (const item of items) {
|
|
999
|
+
const t = this.toEpochMs(item.Timestamp);
|
|
1000
|
+
const prev = clusters[clusters.length - 1];
|
|
1001
|
+
if (!prev) {
|
|
1002
|
+
clusters.push({ items: [item], startTime: t, endTime: t });
|
|
1003
|
+
continue;
|
|
1004
|
+
}
|
|
1005
|
+
const prevDate = new Date(prev.endTime);
|
|
1006
|
+
const currDate = new Date(t);
|
|
1007
|
+
const sameDay = this.GroupSameCalendarDay &&
|
|
1008
|
+
prevDate.getUTCFullYear() === currDate.getUTCFullYear() &&
|
|
1009
|
+
prevDate.getUTCMonth() === currDate.getUTCMonth() &&
|
|
1010
|
+
prevDate.getUTCDate() === currDate.getUTCDate();
|
|
1011
|
+
const withinSessionGap = (t - prev.endTime) <= sessionGapThresholdMs;
|
|
1012
|
+
if (sameDay || withinSessionGap) {
|
|
1013
|
+
prev.items.push(item);
|
|
1014
|
+
prev.endTime = t;
|
|
1015
|
+
}
|
|
1016
|
+
else {
|
|
1017
|
+
clusters.push({ items: [item], startTime: t, endTime: t });
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return clusters;
|
|
1021
|
+
}
|
|
1022
|
+
buildMergedSessionClusters(items) {
|
|
1023
|
+
const clusters = this.buildInitialSessionClusters(items);
|
|
1024
|
+
const maxAllowed = Math.max(1, this.MaxClusters);
|
|
1025
|
+
while (clusters.length > maxAllowed) {
|
|
1026
|
+
let minGap = Infinity;
|
|
1027
|
+
let mergeIdx = 0;
|
|
1028
|
+
for (let i = 0; i < clusters.length - 1; i++) {
|
|
1029
|
+
const gap = clusters[i + 1].startTime - clusters[i].endTime;
|
|
1030
|
+
if (gap < minGap) {
|
|
1031
|
+
minGap = gap;
|
|
1032
|
+
mergeIdx = i;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
const left = clusters[mergeIdx];
|
|
1036
|
+
const right = clusters[mergeIdx + 1];
|
|
1037
|
+
clusters.splice(mergeIdx, 2, {
|
|
1038
|
+
items: [...left.items, ...right.items],
|
|
1039
|
+
startTime: left.startTime,
|
|
1040
|
+
endTime: right.endTime
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
return clusters;
|
|
1044
|
+
}
|
|
1045
|
+
buildCalendarResolutionClusters(items, resolution) {
|
|
1046
|
+
const map = new Map();
|
|
1047
|
+
for (const item of items) {
|
|
1048
|
+
const t = this.toEpochMs(item.Timestamp);
|
|
1049
|
+
const d = new Date(t);
|
|
1050
|
+
const year = d.getUTCFullYear();
|
|
1051
|
+
const month = d.getUTCMonth();
|
|
1052
|
+
const date = d.getUTCDate();
|
|
1053
|
+
let bucketKey;
|
|
1054
|
+
let explicitLabel;
|
|
1055
|
+
if (resolution === 'year') {
|
|
1056
|
+
bucketKey = `year-${year}`;
|
|
1057
|
+
explicitLabel = `${year}`;
|
|
1058
|
+
}
|
|
1059
|
+
else if (resolution === 'quarter') {
|
|
1060
|
+
const q = Math.floor(month / 3) + 1;
|
|
1061
|
+
bucketKey = `quarter-${year}-Q${q}`;
|
|
1062
|
+
explicitLabel = `Q${q} '${String(year).slice(-2)}`;
|
|
1063
|
+
}
|
|
1064
|
+
else if (resolution === 'month') {
|
|
1065
|
+
const shortMonth = new Intl.DateTimeFormat('en-US', { month: 'short', timeZone: 'UTC' }).format(d);
|
|
1066
|
+
bucketKey = `month-${year}-${month}`;
|
|
1067
|
+
explicitLabel = `${shortMonth} '${String(year).slice(-2)}`;
|
|
1068
|
+
}
|
|
1069
|
+
else if (resolution === 'week') {
|
|
1070
|
+
const dayOfWeek = d.getUTCDay();
|
|
1071
|
+
const weekStartMs = Date.UTC(year, month, date - dayOfWeek);
|
|
1072
|
+
const ws = new Date(weekStartMs);
|
|
1073
|
+
bucketKey = `week-${ws.getUTCFullYear()}-${ws.getUTCMonth()}-${ws.getUTCDate()}`;
|
|
1074
|
+
explicitLabel = new Intl.DateTimeFormat('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' }).format(ws);
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
bucketKey = `day-${year}-${month}-${date}`;
|
|
1078
|
+
explicitLabel = new Intl.DateTimeFormat('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' }).format(d);
|
|
1079
|
+
}
|
|
1080
|
+
const existing = map.get(bucketKey);
|
|
1081
|
+
if (existing) {
|
|
1082
|
+
existing.items.push(item);
|
|
1083
|
+
if (t < existing.startTime)
|
|
1084
|
+
existing.startTime = t;
|
|
1085
|
+
if (t > existing.endTime)
|
|
1086
|
+
existing.endTime = t;
|
|
1087
|
+
}
|
|
1088
|
+
else {
|
|
1089
|
+
map.set(bucketKey, {
|
|
1090
|
+
key: bucketKey,
|
|
1091
|
+
explicitLabel,
|
|
1092
|
+
items: [item],
|
|
1093
|
+
startTime: t,
|
|
1094
|
+
endTime: t
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return Array.from(map.values());
|
|
1099
|
+
}
|
|
1100
|
+
formatClusterDateLabel(startMs, endMs, latestTimeMs, totalSpanMs) {
|
|
1101
|
+
const dayMs = 86_400_000;
|
|
1102
|
+
const startDate = new Date(startMs);
|
|
1103
|
+
const endDate = new Date(endMs);
|
|
1104
|
+
const now = new Date();
|
|
1105
|
+
const isToday = endDate.getFullYear() === now.getFullYear() &&
|
|
1106
|
+
endDate.getMonth() === now.getMonth() &&
|
|
1107
|
+
endDate.getDate() === now.getDate();
|
|
1108
|
+
const spansMultiYear = totalSpanMs > 365 * dayMs ||
|
|
1109
|
+
startDate.getFullYear() !== new Date(latestTimeMs).getFullYear();
|
|
1110
|
+
const fmtOpts = spansMultiYear
|
|
1111
|
+
? { month: 'short', day: 'numeric', year: '2-digit' }
|
|
1112
|
+
: { month: 'short', day: 'numeric' };
|
|
1113
|
+
const fmt = new Intl.DateTimeFormat('en-US', fmtOpts);
|
|
1114
|
+
const sameDay = startDate.getFullYear() === endDate.getFullYear() &&
|
|
1115
|
+
startDate.getMonth() === endDate.getMonth() &&
|
|
1116
|
+
startDate.getDate() === endDate.getDate();
|
|
1117
|
+
if (sameDay) {
|
|
1118
|
+
return isToday ? 'Today' : fmt.format(startDate);
|
|
1119
|
+
}
|
|
1120
|
+
return `${fmt.format(startDate)} – ${fmt.format(endDate)}`;
|
|
1121
|
+
}
|
|
1122
|
+
formatDefaultSubtitle(node) {
|
|
1123
|
+
if (node.IsZoomableEra && this.AllowZoom) {
|
|
1124
|
+
return 'Click to zoom in';
|
|
1125
|
+
}
|
|
1126
|
+
const createCount = node.CategoryCounts['create'] ?? node.CategoryCounts['Create'] ?? 0;
|
|
1127
|
+
if (node.TotalCount === 1 && createCount === 1) {
|
|
1128
|
+
return 'Initial creation';
|
|
1129
|
+
}
|
|
1130
|
+
const parts = [];
|
|
1131
|
+
for (const cat of this.ResolvedCategories) {
|
|
1132
|
+
const count = node.CategoryCounts[cat.Key] ?? 0;
|
|
1133
|
+
if (count <= 0)
|
|
1134
|
+
continue;
|
|
1135
|
+
const singular = cat.SingularLabel ?? cat.Label.toLowerCase();
|
|
1136
|
+
const plural = cat.PluralLabel ?? `${singular}s`;
|
|
1137
|
+
parts.push(`${count} ${count === 1 ? singular : plural}`);
|
|
1138
|
+
}
|
|
1139
|
+
return parts.join(', ') || `${node.TotalCount} ${node.TotalCount === 1 ? this.ItemSingularNoun : this.ItemPluralNoun}`;
|
|
1140
|
+
}
|
|
1141
|
+
formatDefaultTooltip(node) {
|
|
1142
|
+
const parts = [];
|
|
1143
|
+
for (const cat of this.ResolvedCategories) {
|
|
1144
|
+
const count = node.CategoryCounts[cat.Key] ?? 0;
|
|
1145
|
+
if (count <= 0)
|
|
1146
|
+
continue;
|
|
1147
|
+
const singular = cat.SingularLabel ?? cat.Label.toLowerCase();
|
|
1148
|
+
const plural = cat.PluralLabel ?? `${singular}s`;
|
|
1149
|
+
parts.push(`${count} ${count === 1 ? singular : plural}`);
|
|
1150
|
+
}
|
|
1151
|
+
const detail = parts.length > 0 ? ` (${parts.join(', ')})` : '';
|
|
1152
|
+
const zoomHint = node.IsZoomableEra && this.AllowZoom ? ' — Click to zoom into this period' : '';
|
|
1153
|
+
return `${node.Label}: ${node.TotalCount} ${node.TotalCount === 1 ? this.ItemSingularNoun : this.ItemPluralNoun}${detail}${zoomHint}`;
|
|
1154
|
+
}
|
|
1155
|
+
formatQuietGapLabel(gapMs) {
|
|
1156
|
+
const hourMs = 3_600_000;
|
|
1157
|
+
const dayMs = 24 * hourMs;
|
|
1158
|
+
if (gapMs < Math.max(0, this.MinGapQuietHours) * hourMs) {
|
|
1159
|
+
return null;
|
|
1160
|
+
}
|
|
1161
|
+
const days = Math.round(gapMs / dayMs);
|
|
1162
|
+
if (days >= 365) {
|
|
1163
|
+
const yrs = +(days / 365).toFixed(1);
|
|
1164
|
+
return `${yrs}y quiet`;
|
|
1165
|
+
}
|
|
1166
|
+
if (days >= 45) {
|
|
1167
|
+
const mos = Math.round(days / 30);
|
|
1168
|
+
return `${mos} mos quiet`;
|
|
1169
|
+
}
|
|
1170
|
+
return `${days}d quiet`;
|
|
1171
|
+
}
|
|
1172
|
+
formatTotalSpanLabel(totalSpanMs) {
|
|
1173
|
+
const dayMs = 86_400_000;
|
|
1174
|
+
const days = Math.round(totalSpanMs / dayMs);
|
|
1175
|
+
if (days <= 1)
|
|
1176
|
+
return 'same day';
|
|
1177
|
+
if (days >= 365) {
|
|
1178
|
+
const yrs = +(days / 365).toFixed(1);
|
|
1179
|
+
return `${yrs} yr span`;
|
|
1180
|
+
}
|
|
1181
|
+
if (days >= 45) {
|
|
1182
|
+
const mos = Math.round(days / 30);
|
|
1183
|
+
return `${mos} mos span`;
|
|
1184
|
+
}
|
|
1185
|
+
return `${days}d span`;
|
|
1186
|
+
}
|
|
1187
|
+
toEpochMs(value) {
|
|
1188
|
+
if (typeof value === 'number')
|
|
1189
|
+
return value;
|
|
1190
|
+
if (value instanceof Date)
|
|
1191
|
+
return value.getTime();
|
|
1192
|
+
return new Date(value).getTime();
|
|
1193
|
+
}
|
|
1194
|
+
emitFilterChanged() {
|
|
1195
|
+
const selected = this.SelectedCluster;
|
|
1196
|
+
const zoom = this.ActiveZoomBreadcrumb;
|
|
1197
|
+
const ids = this.GetSelectedIDs();
|
|
1198
|
+
const items = this.GetSelectedItems();
|
|
1199
|
+
const label = selected?.Label ?? zoom?.Label ?? null;
|
|
1200
|
+
this.FilterChanged.emit(new MJBurstFilterChangedEventArgs(selected, zoom, ids, items, label));
|
|
1201
|
+
}
|
|
1202
|
+
static ɵfac = function MJBurstClusterStripComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJBurstClusterStripComponent)(); };
|
|
1203
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJBurstClusterStripComponent, selectors: [["mj-burst-cluster-strip"]], inputs: { Items: "Items", Data: "Data", FieldMap: "FieldMap", IdField: "IdField", TimestampField: "TimestampField", CategoryField: "CategoryField", TooltipField: "TooltipField", WeightField: "WeightField", Categories: "Categories", Resolution: "Resolution", CoalesceStrategy: "CoalesceStrategy", SessionGapHours: "SessionGapHours", GroupSameCalendarDay: "GroupSameCalendarDay", MaxClusters: "MaxClusters", EraZoomThreshold: "EraZoomThreshold", AllowZoom: "AllowZoom", MaxPipsPerCluster: "MaxPipsPerCluster", MinGapQuietHours: "MinGapQuietHours", Title: "Title", TitleIcon: "TitleIcon", AriaLabel: "AriaLabel", ItemSingularNoun: "ItemSingularNoun", ItemPluralNoun: "ItemPluralNoun", ShowHeader: "ShowHeader", ShowLegend: "ShowLegend", ShowGapConnectors: "ShowGapConnectors", ShowPips: "ShowPips", ShowProportionalBar: "ShowProportionalBar", SubtitleFormatter: "SubtitleFormatter", SelectedClusterKey: "SelectedClusterKey" }, outputs: { SelectedClusterKeyChange: "SelectedClusterKeyChange", BeforeClusterSelect: "BeforeClusterSelect", AfterClusterSelect: "AfterClusterSelect", BeforeSelectionClear: "BeforeSelectionClear", AfterSelectionClear: "AfterSelectionClear", BeforeZoomChange: "BeforeZoomChange", AfterZoomChange: "AfterZoomChange", BeforeClustersRebuild: "BeforeClustersRebuild", AfterClustersRebuild: "AfterClustersRebuild", PipClicked: "PipClicked", FilterChanged: "FilterChanged" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [["role", "region", 1, "mj-burst-cluster-strip", "rc-activity-chart"], [1, "mj-burst-header", "rc-activity-chart-header"], [1, "mj-burst-track", "rc-burst-track"], [1, "mj-burst-title", "rc-activity-chart-title"], ["aria-hidden", "true", 3, "class"], [1, "mj-burst-granularity", "rc-activity-chart-granularity"], [1, "mj-burst-meta", "rc-activity-chart-meta"], ["type", "button", "title", "Clear burst filter", 1, "mj-burst-active-pill", "rc-activity-bucket-pill"], [1, "mj-burst-legend", "rc-activity-legend"], ["aria-hidden", "true"], ["type", "button", "title", "Zoom out to full timeline", 1, "mj-burst-zoom-back-pill", 3, "click"], ["aria-hidden", "true", 1, "fa-solid", "fa-arrow-left"], [1, "mj-burst-zoom-crumb"], ["type", "button", "title", "Clear burst filter", 1, "mj-burst-active-pill", "rc-activity-bucket-pill", 3, "click"], ["aria-hidden", "true", 1, "fa-solid", "fa-xmark"], [1, "mj-burst-legend-item", "rc-legend-item"], [1, "mj-burst-legend-dot", "rc-legend-dot"], ["type", "button", 1, "mj-burst-node", "rc-burst-node", 3, "click", "title"], ["aria-hidden", "true", 1, "mj-burst-era-badge"], [1, "mj-burst-pips", "rc-burst-pips"], [1, "mj-burst-count", "rc-burst-count"], [1, "mj-burst-date", "rc-burst-date"], [1, "mj-burst-sub", "rc-burst-sub"], ["aria-hidden", "true", 1, "mj-burst-prop-bar"], [1, "mj-burst-gap-connector", "rc-gap-connector"], [1, "fa-solid", "fa-magnifying-glass-plus"], [1, "mj-burst-pip", "rc-burst-pip", 3, "class", "background", "title"], [1, "mj-burst-pip-overflow", "rc-burst-pip-overflow"], [1, "mj-burst-pip", "rc-burst-pip", 3, "click", "title"], [1, "mj-burst-prop-seg", 3, "width", "background"], [1, "mj-burst-prop-seg"], [1, "mj-burst-gap-line", "rc-gap-line"], [1, "mj-burst-gap-pill", "rc-gap-pill"]], template: function MJBurstClusterStripComponent_Template(rf, ctx) { if (rf & 1) {
|
|
1204
|
+
i0.ɵɵconditionalCreate(0, MJBurstClusterStripComponent_Conditional_0_Template, 5, 2, "div", 0);
|
|
1205
|
+
} if (rf & 2) {
|
|
1206
|
+
i0.ɵɵconditional(ctx.Clusters.length > 0 ? 0 : -1);
|
|
1207
|
+
} }, styles: ["[_nghost-%COMP%] {\n display: block;\n }\n\n .mj-burst-cluster-strip[_ngcontent-%COMP%] {\n padding: 9px 14px 10px;\n background: color-mix(in srgb, var(--mj-bg-surface-sunken) 55%, var(--mj-bg-surface));\n border-bottom: 1px solid var(--mj-border-subtle);\n display: flex;\n flex-direction: column;\n gap: 7px;\n }\n\n .mj-burst-header[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n flex-wrap: wrap;\n }\n\n .mj-burst-title[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--mj-text-secondary);\n }\n\n .mj-burst-title[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n color: var(--mj-brand-primary);\n font-size: 11px;\n }\n\n .mj-burst-granularity[_ngcontent-%COMP%] {\n font-weight: 500;\n text-transform: none;\n letter-spacing: 0;\n color: var(--mj-text-muted);\n }\n\n .mj-burst-meta[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n }\n\n .mj-burst-zoom-back-pill[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 2px 8px;\n border-radius: 999px;\n font-size: 10.5px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n border: 1px solid color-mix(in srgb, var(--mj-brand-primary) 32%, transparent);\n cursor: pointer;\n font-family: inherit;\n transition: background 120ms ease;\n }\n\n .mj-burst-zoom-back-pill[_ngcontent-%COMP%]:hover {\n background: color-mix(in srgb, var(--mj-brand-primary) 20%, var(--mj-bg-surface));\n }\n\n .mj-burst-zoom-crumb[_ngcontent-%COMP%] {\n font-size: 10.5px;\n font-weight: 600;\n color: var(--mj-text-secondary);\n }\n\n .mj-burst-active-pill[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 2px 8px;\n border-radius: 999px;\n font-size: 10px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-brand-primary) 14%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n border: 1px solid color-mix(in srgb, var(--mj-brand-primary) 35%, transparent);\n cursor: pointer;\n font-family: inherit;\n }\n\n .mj-burst-legend[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n font-size: 10px;\n color: var(--mj-text-muted);\n }\n\n .mj-burst-legend-item[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n }\n\n .mj-burst-legend-dot[_ngcontent-%COMP%] {\n width: 7px;\n height: 7px;\n border-radius: 2px;\n display: inline-block;\n }\n\n .mj-burst-track[_ngcontent-%COMP%] {\n display: flex;\n align-items: stretch;\n gap: 4px;\n width: 100%;\n min-height: 64px;\n }\n\n .mj-burst-node[_ngcontent-%COMP%] {\n position: relative;\n flex: 1 1 0;\n min-width: 72px;\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-default);\n border-radius: 8px;\n padding: 6px 8px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n text-align: left;\n cursor: pointer;\n font-family: inherit;\n transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease, transform 120ms ease;\n }\n\n .mj-burst-node[_ngcontent-%COMP%]:hover {\n border-color: color-mix(in srgb, var(--mj-brand-primary) 55%, var(--mj-border-default));\n background: color-mix(in srgb, var(--mj-brand-primary) 4%, var(--mj-bg-surface));\n transform: translateY(-1px);\n }\n\n .mj-burst-node[_ngcontent-%COMP%]:focus-visible {\n outline: 2px solid var(--mj-border-focus);\n outline-offset: 1px;\n }\n\n .mj-burst-node--selected[_ngcontent-%COMP%] {\n border-color: var(--mj-brand-primary);\n background: color-mix(in srgb, var(--mj-brand-primary) 9%, var(--mj-bg-surface));\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 18%, transparent);\n }\n\n .mj-burst-era-badge[_ngcontent-%COMP%] {\n position: absolute;\n top: 5px;\n right: 6px;\n display: inline-flex;\n align-items: center;\n gap: 3px;\n font-size: 9px;\n font-weight: 600;\n color: var(--mj-brand-primary);\n opacity: 0.78;\n }\n\n .mj-burst-node[_ngcontent-%COMP%]:hover .mj-burst-era-badge[_ngcontent-%COMP%] {\n opacity: 1;\n }\n\n .mj-burst-pips[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 3px;\n flex-wrap: wrap;\n margin-bottom: 3px;\n }\n\n .mj-burst-pip[_ngcontent-%COMP%] {\n width: 8px;\n height: 8px;\n border-radius: 2px;\n flex-shrink: 0;\n }\n\n .mj-burst-pip-overflow[_ngcontent-%COMP%] {\n font-size: 9px;\n font-weight: 700;\n color: var(--mj-text-muted);\n padding-left: 2px;\n }\n\n .mj-burst-count[_ngcontent-%COMP%] {\n font-size: 11px;\n font-weight: 700;\n color: var(--mj-text-primary);\n line-height: 1.2;\n }\n\n .mj-burst-date[_ngcontent-%COMP%] {\n font-size: 10.5px;\n font-weight: 600;\n color: var(--mj-text-secondary);\n line-height: 1.2;\n margin-top: 1px;\n }\n\n .mj-burst-sub[_ngcontent-%COMP%] {\n font-size: 9.5px;\n color: var(--mj-text-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-top: 1px;\n }\n\n .mj-burst-prop-bar[_ngcontent-%COMP%] {\n display: flex;\n width: 100%;\n height: 4px;\n border-radius: 999px;\n overflow: hidden;\n margin-top: 4px;\n background: var(--mj-bg-surface-sunken);\n }\n\n .mj-burst-prop-seg[_ngcontent-%COMP%] {\n height: 100%;\n }\n\n .mj-burst-gap-connector[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n min-width: 44px;\n padding: 0 2px;\n position: relative;\n user-select: none;\n flex-shrink: 0;\n }\n\n .mj-burst-gap-line[_ngcontent-%COMP%] {\n width: 100%;\n border-top: 1.5px dashed var(--mj-border-default);\n position: absolute;\n top: 50%;\n left: 0;\n }\n\n .mj-burst-gap-pill[_ngcontent-%COMP%] {\n position: relative;\n z-index: 1;\n background: var(--mj-bg-surface-sunken);\n border: 1px solid var(--mj-border-subtle);\n border-radius: 999px;\n padding: 1px 6px;\n font-size: 9px;\n font-weight: 600;\n color: var(--mj-text-muted);\n white-space: nowrap;\n }"], changeDetection: 0 });
|
|
1208
|
+
}
|
|
1209
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJBurstClusterStripComponent, [{
|
|
1210
|
+
type: Component,
|
|
1211
|
+
args: [{ selector: 'mj-burst-cluster-strip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
1212
|
+
@if (Clusters.length > 0) {
|
|
1213
|
+
<div
|
|
1214
|
+
class="mj-burst-cluster-strip rc-activity-chart"
|
|
1215
|
+
role="region"
|
|
1216
|
+
[attr.aria-label]="AriaLabel || Title || 'Activity timeline'">
|
|
1217
|
+
@if (ShowHeader) {
|
|
1218
|
+
<div class="mj-burst-header rc-activity-chart-header">
|
|
1219
|
+
<span class="mj-burst-title rc-activity-chart-title">
|
|
1220
|
+
@if (TitleIcon) {
|
|
1221
|
+
<i [class]="TitleIcon" aria-hidden="true"></i>
|
|
1222
|
+
}
|
|
1223
|
+
<span>{{ Title }}</span>
|
|
1224
|
+
@if (GranularityLabel) {
|
|
1225
|
+
<span class="mj-burst-granularity rc-activity-chart-granularity">· {{ GranularityLabel }}</span>
|
|
1226
|
+
}
|
|
1227
|
+
</span>
|
|
1228
|
+
|
|
1229
|
+
<div class="mj-burst-meta rc-activity-chart-meta">
|
|
1230
|
+
@if (ZoomStack.length > 0) {
|
|
1231
|
+
<button
|
|
1232
|
+
type="button"
|
|
1233
|
+
class="mj-burst-zoom-back-pill"
|
|
1234
|
+
(click)="OnZoomBackClick($event)"
|
|
1235
|
+
title="Zoom out to full timeline">
|
|
1236
|
+
<i class="fa-solid fa-arrow-left" aria-hidden="true"></i>
|
|
1237
|
+
<span>{{ ZoomBackLabel }}</span>
|
|
1238
|
+
</button>
|
|
1239
|
+
<span class="mj-burst-zoom-crumb">
|
|
1240
|
+
Viewing {{ ActiveZoomBreadcrumb?.Label }}
|
|
1241
|
+
</span>
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
@if (SelectedClusterLabel; as activeLabel) {
|
|
1245
|
+
<button
|
|
1246
|
+
type="button"
|
|
1247
|
+
class="mj-burst-active-pill rc-activity-bucket-pill"
|
|
1248
|
+
(click)="OnClearSelectionClick($event)"
|
|
1249
|
+
title="Clear burst filter">
|
|
1250
|
+
<span>{{ activeLabel }}</span>
|
|
1251
|
+
<i class="fa-solid fa-xmark" aria-hidden="true"></i>
|
|
1252
|
+
</button>
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
@if (ShowLegend && ResolvedCategories.length > 0) {
|
|
1256
|
+
<div class="mj-burst-legend rc-activity-legend">
|
|
1257
|
+
@for (cat of ResolvedCategories; track cat.Key) {
|
|
1258
|
+
<span class="mj-burst-legend-item rc-legend-item">
|
|
1259
|
+
<span
|
|
1260
|
+
class="mj-burst-legend-dot rc-legend-dot"
|
|
1261
|
+
[class]="cat.CssModifier ? 'mj-burst-legend-dot rc-legend-dot rc-legend-dot--' + cat.CssModifier : 'mj-burst-legend-dot rc-legend-dot'"
|
|
1262
|
+
[style.background]="cat.Color"></span>
|
|
1263
|
+
{{ cat.Label }}
|
|
1264
|
+
</span>
|
|
1265
|
+
}
|
|
1266
|
+
</div>
|
|
1267
|
+
}
|
|
1268
|
+
</div>
|
|
1269
|
+
</div>
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
<div class="mj-burst-track rc-burst-track">
|
|
1273
|
+
@for (cluster of Clusters; track cluster.Key) {
|
|
1274
|
+
<button
|
|
1275
|
+
type="button"
|
|
1276
|
+
class="mj-burst-node rc-burst-node"
|
|
1277
|
+
[class.mj-burst-node--selected]="SelectedClusterKey === cluster.Key"
|
|
1278
|
+
[class.rc-burst-node--selected]="SelectedClusterKey === cluster.Key"
|
|
1279
|
+
[class.mj-burst-node--era]="cluster.IsZoomableEra"
|
|
1280
|
+
[attr.aria-pressed]="SelectedClusterKey === cluster.Key"
|
|
1281
|
+
[attr.aria-label]="cluster.Tooltip"
|
|
1282
|
+
[title]="cluster.Tooltip"
|
|
1283
|
+
(click)="OnClusterClick(cluster, $event)">
|
|
1284
|
+
@if (cluster.IsZoomableEra && AllowZoom) {
|
|
1285
|
+
<span class="mj-burst-era-badge" aria-hidden="true">
|
|
1286
|
+
<i class="fa-solid fa-magnifying-glass-plus"></i>
|
|
1287
|
+
Zoom
|
|
1288
|
+
</span>
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
@if (ShowPips) {
|
|
1292
|
+
<div class="mj-burst-pips rc-burst-pips">
|
|
1293
|
+
@for (pip of cluster.Pips; track pip.ID) {
|
|
1294
|
+
<span
|
|
1295
|
+
class="mj-burst-pip rc-burst-pip"
|
|
1296
|
+
[class]="pip.CssModifier ? 'mj-burst-pip rc-burst-pip rc-burst-pip--' + pip.CssModifier : 'mj-burst-pip rc-burst-pip'"
|
|
1297
|
+
[style.background]="pip.Color"
|
|
1298
|
+
[title]="pip.Tooltip"
|
|
1299
|
+
(click)="OnPipClick(pip, cluster, $event)"></span>
|
|
1300
|
+
}
|
|
1301
|
+
@if (cluster.OverflowPipCount > 0) {
|
|
1302
|
+
<span class="mj-burst-pip-overflow rc-burst-pip-overflow">+{{ cluster.OverflowPipCount }}</span>
|
|
1303
|
+
}
|
|
1304
|
+
</div>
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
<span class="mj-burst-count rc-burst-count">
|
|
1308
|
+
{{ cluster.TotalCount }} {{ cluster.TotalCount === 1 ? ItemSingularNoun : ItemPluralNoun }}
|
|
1309
|
+
</span>
|
|
1310
|
+
<span class="mj-burst-date rc-burst-date">{{ cluster.Label }}</span>
|
|
1311
|
+
<span class="mj-burst-sub rc-burst-sub">{{ cluster.Subtitle }}</span>
|
|
1312
|
+
|
|
1313
|
+
@if (ShowProportionalBar && cluster.CategoryShares.length > 0) {
|
|
1314
|
+
<div class="mj-burst-prop-bar" aria-hidden="true">
|
|
1315
|
+
@for (share of cluster.CategoryShares; track share.Key) {
|
|
1316
|
+
@if (share.SharePercent > 0) {
|
|
1317
|
+
<span
|
|
1318
|
+
class="mj-burst-prop-seg"
|
|
1319
|
+
[style.width.%]="share.SharePercent"
|
|
1320
|
+
[style.background]="share.Color"></span>
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
</div>
|
|
1324
|
+
}
|
|
1325
|
+
</button>
|
|
1326
|
+
|
|
1327
|
+
@if (ShowGapConnectors && cluster.GapAfterLabel) {
|
|
1328
|
+
<div
|
|
1329
|
+
class="mj-burst-gap-connector rc-gap-connector"
|
|
1330
|
+
[attr.aria-label]="cluster.GapAfterLabel + ' with no ' + ItemPluralNoun">
|
|
1331
|
+
<div class="mj-burst-gap-line rc-gap-line"></div>
|
|
1332
|
+
<span class="mj-burst-gap-pill rc-gap-pill">{{ cluster.GapAfterLabel }}</span>
|
|
1333
|
+
</div>
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
</div>
|
|
1337
|
+
</div>
|
|
1338
|
+
}
|
|
1339
|
+
`, styles: ["\n :host {\n display: block;\n }\n\n .mj-burst-cluster-strip {\n padding: 9px 14px 10px;\n background: color-mix(in srgb, var(--mj-bg-surface-sunken) 55%, var(--mj-bg-surface));\n border-bottom: 1px solid var(--mj-border-subtle);\n display: flex;\n flex-direction: column;\n gap: 7px;\n }\n\n .mj-burst-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n flex-wrap: wrap;\n }\n\n .mj-burst-title {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--mj-text-secondary);\n }\n\n .mj-burst-title i {\n color: var(--mj-brand-primary);\n font-size: 11px;\n }\n\n .mj-burst-granularity {\n font-weight: 500;\n text-transform: none;\n letter-spacing: 0;\n color: var(--mj-text-muted);\n }\n\n .mj-burst-meta {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n }\n\n .mj-burst-zoom-back-pill {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 2px 8px;\n border-radius: 999px;\n font-size: 10.5px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n border: 1px solid color-mix(in srgb, var(--mj-brand-primary) 32%, transparent);\n cursor: pointer;\n font-family: inherit;\n transition: background 120ms ease;\n }\n\n .mj-burst-zoom-back-pill:hover {\n background: color-mix(in srgb, var(--mj-brand-primary) 20%, var(--mj-bg-surface));\n }\n\n .mj-burst-zoom-crumb {\n font-size: 10.5px;\n font-weight: 600;\n color: var(--mj-text-secondary);\n }\n\n .mj-burst-active-pill {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 2px 8px;\n border-radius: 999px;\n font-size: 10px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-brand-primary) 14%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n border: 1px solid color-mix(in srgb, var(--mj-brand-primary) 35%, transparent);\n cursor: pointer;\n font-family: inherit;\n }\n\n .mj-burst-legend {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n font-size: 10px;\n color: var(--mj-text-muted);\n }\n\n .mj-burst-legend-item {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n }\n\n .mj-burst-legend-dot {\n width: 7px;\n height: 7px;\n border-radius: 2px;\n display: inline-block;\n }\n\n .mj-burst-track {\n display: flex;\n align-items: stretch;\n gap: 4px;\n width: 100%;\n min-height: 64px;\n }\n\n .mj-burst-node {\n position: relative;\n flex: 1 1 0;\n min-width: 72px;\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-default);\n border-radius: 8px;\n padding: 6px 8px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n text-align: left;\n cursor: pointer;\n font-family: inherit;\n transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease, transform 120ms ease;\n }\n\n .mj-burst-node:hover {\n border-color: color-mix(in srgb, var(--mj-brand-primary) 55%, var(--mj-border-default));\n background: color-mix(in srgb, var(--mj-brand-primary) 4%, var(--mj-bg-surface));\n transform: translateY(-1px);\n }\n\n .mj-burst-node:focus-visible {\n outline: 2px solid var(--mj-border-focus);\n outline-offset: 1px;\n }\n\n .mj-burst-node--selected {\n border-color: var(--mj-brand-primary);\n background: color-mix(in srgb, var(--mj-brand-primary) 9%, var(--mj-bg-surface));\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 18%, transparent);\n }\n\n .mj-burst-era-badge {\n position: absolute;\n top: 5px;\n right: 6px;\n display: inline-flex;\n align-items: center;\n gap: 3px;\n font-size: 9px;\n font-weight: 600;\n color: var(--mj-brand-primary);\n opacity: 0.78;\n }\n\n .mj-burst-node:hover .mj-burst-era-badge {\n opacity: 1;\n }\n\n .mj-burst-pips {\n display: flex;\n align-items: center;\n gap: 3px;\n flex-wrap: wrap;\n margin-bottom: 3px;\n }\n\n .mj-burst-pip {\n width: 8px;\n height: 8px;\n border-radius: 2px;\n flex-shrink: 0;\n }\n\n .mj-burst-pip-overflow {\n font-size: 9px;\n font-weight: 700;\n color: var(--mj-text-muted);\n padding-left: 2px;\n }\n\n .mj-burst-count {\n font-size: 11px;\n font-weight: 700;\n color: var(--mj-text-primary);\n line-height: 1.2;\n }\n\n .mj-burst-date {\n font-size: 10.5px;\n font-weight: 600;\n color: var(--mj-text-secondary);\n line-height: 1.2;\n margin-top: 1px;\n }\n\n .mj-burst-sub {\n font-size: 9.5px;\n color: var(--mj-text-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-top: 1px;\n }\n\n .mj-burst-prop-bar {\n display: flex;\n width: 100%;\n height: 4px;\n border-radius: 999px;\n overflow: hidden;\n margin-top: 4px;\n background: var(--mj-bg-surface-sunken);\n }\n\n .mj-burst-prop-seg {\n height: 100%;\n }\n\n .mj-burst-gap-connector {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n min-width: 44px;\n padding: 0 2px;\n position: relative;\n user-select: none;\n flex-shrink: 0;\n }\n\n .mj-burst-gap-line {\n width: 100%;\n border-top: 1.5px dashed var(--mj-border-default);\n position: absolute;\n top: 50%;\n left: 0;\n }\n\n .mj-burst-gap-pill {\n position: relative;\n z-index: 1;\n background: var(--mj-bg-surface-sunken);\n border: 1px solid var(--mj-border-subtle);\n border-radius: 999px;\n padding: 1px 6px;\n font-size: 9px;\n font-weight: 600;\n color: var(--mj-text-muted);\n white-space: nowrap;\n }\n "] }]
|
|
1340
|
+
}], null, { Items: [{
|
|
1341
|
+
type: Input
|
|
1342
|
+
}], Data: [{
|
|
1343
|
+
type: Input
|
|
1344
|
+
}], FieldMap: [{
|
|
1345
|
+
type: Input
|
|
1346
|
+
}], IdField: [{
|
|
1347
|
+
type: Input
|
|
1348
|
+
}], TimestampField: [{
|
|
1349
|
+
type: Input
|
|
1350
|
+
}], CategoryField: [{
|
|
1351
|
+
type: Input
|
|
1352
|
+
}], TooltipField: [{
|
|
1353
|
+
type: Input
|
|
1354
|
+
}], WeightField: [{
|
|
1355
|
+
type: Input
|
|
1356
|
+
}], Categories: [{
|
|
1357
|
+
type: Input
|
|
1358
|
+
}], Resolution: [{
|
|
1359
|
+
type: Input
|
|
1360
|
+
}], CoalesceStrategy: [{
|
|
1361
|
+
type: Input
|
|
1362
|
+
}], SessionGapHours: [{
|
|
1363
|
+
type: Input
|
|
1364
|
+
}], GroupSameCalendarDay: [{
|
|
1365
|
+
type: Input
|
|
1366
|
+
}], MaxClusters: [{
|
|
1367
|
+
type: Input
|
|
1368
|
+
}], EraZoomThreshold: [{
|
|
1369
|
+
type: Input
|
|
1370
|
+
}], AllowZoom: [{
|
|
1371
|
+
type: Input
|
|
1372
|
+
}], MaxPipsPerCluster: [{
|
|
1373
|
+
type: Input
|
|
1374
|
+
}], MinGapQuietHours: [{
|
|
1375
|
+
type: Input
|
|
1376
|
+
}], Title: [{
|
|
1377
|
+
type: Input
|
|
1378
|
+
}], TitleIcon: [{
|
|
1379
|
+
type: Input
|
|
1380
|
+
}], AriaLabel: [{
|
|
1381
|
+
type: Input
|
|
1382
|
+
}], ItemSingularNoun: [{
|
|
1383
|
+
type: Input
|
|
1384
|
+
}], ItemPluralNoun: [{
|
|
1385
|
+
type: Input
|
|
1386
|
+
}], ShowHeader: [{
|
|
1387
|
+
type: Input
|
|
1388
|
+
}], ShowLegend: [{
|
|
1389
|
+
type: Input
|
|
1390
|
+
}], ShowGapConnectors: [{
|
|
1391
|
+
type: Input
|
|
1392
|
+
}], ShowPips: [{
|
|
1393
|
+
type: Input
|
|
1394
|
+
}], ShowProportionalBar: [{
|
|
1395
|
+
type: Input
|
|
1396
|
+
}], SubtitleFormatter: [{
|
|
1397
|
+
type: Input
|
|
1398
|
+
}], SelectedClusterKey: [{
|
|
1399
|
+
type: Input
|
|
1400
|
+
}], SelectedClusterKeyChange: [{
|
|
1401
|
+
type: Output
|
|
1402
|
+
}], BeforeClusterSelect: [{
|
|
1403
|
+
type: Output
|
|
1404
|
+
}], AfterClusterSelect: [{
|
|
1405
|
+
type: Output
|
|
1406
|
+
}], BeforeSelectionClear: [{
|
|
1407
|
+
type: Output
|
|
1408
|
+
}], AfterSelectionClear: [{
|
|
1409
|
+
type: Output
|
|
1410
|
+
}], BeforeZoomChange: [{
|
|
1411
|
+
type: Output
|
|
1412
|
+
}], AfterZoomChange: [{
|
|
1413
|
+
type: Output
|
|
1414
|
+
}], BeforeClustersRebuild: [{
|
|
1415
|
+
type: Output
|
|
1416
|
+
}], AfterClustersRebuild: [{
|
|
1417
|
+
type: Output
|
|
1418
|
+
}], PipClicked: [{
|
|
1419
|
+
type: Output
|
|
1420
|
+
}], FilterChanged: [{
|
|
1421
|
+
type: Output
|
|
1422
|
+
}] }); })();
|
|
1423
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJBurstClusterStripComponent, { className: "MJBurstClusterStripComponent", filePath: "lib/burst-cluster-strip/burst-cluster-strip.component.ts", lineNumber: 720 }); })();
|
|
1424
|
+
//# sourceMappingURL=burst-cluster-strip.component.js.map
|