@molecule/app-day-timeline-angular 0.0.0-stage → 1.1.0
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/LICENSE +202 -0
- package/README.md +435 -2
- package/dist/day-timeline.component.d.ts +219 -0
- package/dist/day-timeline.component.d.ts.map +1 -0
- package/dist/day-timeline.component.js +568 -0
- package/dist/day-timeline.component.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +74 -4
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DayTimeline component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, TemplateRef } from '@angular/core';
|
|
8
|
+
import { useTranslation } from '@molecule/app-angular';
|
|
9
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
const _forTrack0 = ($index, $item) => $item.id;
|
|
12
|
+
function DayTimeline_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
13
|
+
i0.ɵɵelementStart(0, "div");
|
|
14
|
+
i0.ɵɵtext(1);
|
|
15
|
+
i0.ɵɵelementEnd();
|
|
16
|
+
} if (rf & 2) {
|
|
17
|
+
const hour_r1 = ctx.$implicit;
|
|
18
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
19
|
+
i0.ɵɵstyleMap(ctx_r1.tickStyle(hour_r1));
|
|
20
|
+
i0.ɵɵclassMap(ctx_r1.tickClasses());
|
|
21
|
+
i0.ɵɵattribute("data-axis-tick", hour_r1);
|
|
22
|
+
i0.ɵɵadvance();
|
|
23
|
+
i0.ɵɵtextInterpolate(ctx_r1.tickLabel(hour_r1));
|
|
24
|
+
} }
|
|
25
|
+
function DayTimeline_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
26
|
+
i0.ɵɵelementStart(0, "div", 4);
|
|
27
|
+
i0.ɵɵrepeaterCreate(1, DayTimeline_Conditional_0_For_2_Template, 2, 6, "div", 5, i0.ɵɵrepeaterTrackByIdentity);
|
|
28
|
+
i0.ɵɵelementEnd();
|
|
29
|
+
} if (rf & 2) {
|
|
30
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
31
|
+
i0.ɵɵstyleMap(ctx_r1.axisStyle());
|
|
32
|
+
i0.ɵɵadvance();
|
|
33
|
+
i0.ɵɵrepeater(ctx_r1.ticks());
|
|
34
|
+
} }
|
|
35
|
+
function DayTimeline_For_3_Template(rf, ctx) { if (rf & 1) {
|
|
36
|
+
i0.ɵɵelement(0, "div", 4);
|
|
37
|
+
} if (rf & 2) {
|
|
38
|
+
const hour_r3 = ctx.$implicit;
|
|
39
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
40
|
+
i0.ɵɵstyleMap(ctx_r1.gridlineStyle(hour_r3));
|
|
41
|
+
i0.ɵɵclassMap(ctx_r1.gridlineClasses());
|
|
42
|
+
} }
|
|
43
|
+
function DayTimeline_For_5_Conditional_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
44
|
+
i0.ɵɵelementContainer(0, 10);
|
|
45
|
+
} if (rf & 2) {
|
|
46
|
+
const event_r5 = i0.ɵɵnextContext(2).$implicit;
|
|
47
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
48
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r1.templateOf(event_r5.title));
|
|
49
|
+
} }
|
|
50
|
+
function DayTimeline_For_5_Conditional_1_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
51
|
+
i0.ɵɵtext(0);
|
|
52
|
+
} if (rf & 2) {
|
|
53
|
+
const event_r5 = i0.ɵɵnextContext(2).$implicit;
|
|
54
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
55
|
+
i0.ɵɵtextInterpolate(ctx_r1.textOf(event_r5.title));
|
|
56
|
+
} }
|
|
57
|
+
function DayTimeline_For_5_Conditional_1_Conditional_4_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
58
|
+
i0.ɵɵelementContainer(0, 10);
|
|
59
|
+
} if (rf & 2) {
|
|
60
|
+
const event_r5 = i0.ɵɵnextContext(3).$implicit;
|
|
61
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
62
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r1.templateOf(event_r5.subtitle));
|
|
63
|
+
} }
|
|
64
|
+
function DayTimeline_For_5_Conditional_1_Conditional_4_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
65
|
+
i0.ɵɵtext(0);
|
|
66
|
+
} if (rf & 2) {
|
|
67
|
+
const event_r5 = i0.ɵɵnextContext(3).$implicit;
|
|
68
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
69
|
+
i0.ɵɵtextInterpolate(ctx_r1.textOf(event_r5.subtitle));
|
|
70
|
+
} }
|
|
71
|
+
function DayTimeline_For_5_Conditional_1_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
72
|
+
i0.ɵɵelementStart(0, "div");
|
|
73
|
+
i0.ɵɵconditionalCreate(1, DayTimeline_For_5_Conditional_1_Conditional_4_Conditional_1_Template, 1, 1, "ng-container", 10)(2, DayTimeline_For_5_Conditional_1_Conditional_4_Conditional_2_Template, 1, 1);
|
|
74
|
+
i0.ɵɵelementEnd();
|
|
75
|
+
} if (rf & 2) {
|
|
76
|
+
const event_r5 = i0.ɵɵnextContext(2).$implicit;
|
|
77
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
78
|
+
i0.ɵɵclassMap(ctx_r1.subtitleClasses(event_r5));
|
|
79
|
+
i0.ɵɵadvance();
|
|
80
|
+
i0.ɵɵconditional(ctx_r1.isTemplate(event_r5.subtitle) ? 1 : 2);
|
|
81
|
+
} }
|
|
82
|
+
function DayTimeline_For_5_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
83
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
84
|
+
i0.ɵɵelementStart(0, "button", 9);
|
|
85
|
+
i0.ɵɵlistener("click", function DayTimeline_For_5_Conditional_1_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r4); const event_r5 = i0.ɵɵnextContext().$implicit; const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.handleClick(event_r5, $event)); });
|
|
86
|
+
i0.ɵɵelementStart(1, "div");
|
|
87
|
+
i0.ɵɵconditionalCreate(2, DayTimeline_For_5_Conditional_1_Conditional_2_Template, 1, 1, "ng-container", 10)(3, DayTimeline_For_5_Conditional_1_Conditional_3_Template, 1, 1);
|
|
88
|
+
i0.ɵɵelementEnd();
|
|
89
|
+
i0.ɵɵconditionalCreate(4, DayTimeline_For_5_Conditional_1_Conditional_4_Template, 3, 3, "div", 11);
|
|
90
|
+
i0.ɵɵelementEnd();
|
|
91
|
+
} if (rf & 2) {
|
|
92
|
+
const event_r5 = i0.ɵɵnextContext().$implicit;
|
|
93
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
94
|
+
i0.ɵɵstyleMap(ctx_r1.contentStyle(event_r5));
|
|
95
|
+
i0.ɵɵattribute("aria-label", ctx_r1.eventAria(event_r5));
|
|
96
|
+
i0.ɵɵadvance();
|
|
97
|
+
i0.ɵɵclassMap(ctx_r1.titleClasses());
|
|
98
|
+
i0.ɵɵadvance();
|
|
99
|
+
i0.ɵɵconditional(ctx_r1.isTemplate(event_r5.title) ? 2 : 3);
|
|
100
|
+
i0.ɵɵadvance(2);
|
|
101
|
+
i0.ɵɵconditional(event_r5.subtitle ? 4 : -1);
|
|
102
|
+
} }
|
|
103
|
+
function DayTimeline_For_5_Conditional_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
104
|
+
i0.ɵɵelementContainer(0, 10);
|
|
105
|
+
} if (rf & 2) {
|
|
106
|
+
const event_r5 = i0.ɵɵnextContext(2).$implicit;
|
|
107
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
108
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r1.templateOf(event_r5.title));
|
|
109
|
+
} }
|
|
110
|
+
function DayTimeline_For_5_Conditional_2_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
111
|
+
i0.ɵɵtext(0);
|
|
112
|
+
} if (rf & 2) {
|
|
113
|
+
const event_r5 = i0.ɵɵnextContext(2).$implicit;
|
|
114
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
115
|
+
i0.ɵɵtextInterpolate(ctx_r1.textOf(event_r5.title));
|
|
116
|
+
} }
|
|
117
|
+
function DayTimeline_For_5_Conditional_2_Conditional_4_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
118
|
+
i0.ɵɵelementContainer(0, 10);
|
|
119
|
+
} if (rf & 2) {
|
|
120
|
+
const event_r5 = i0.ɵɵnextContext(3).$implicit;
|
|
121
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
122
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r1.templateOf(event_r5.subtitle));
|
|
123
|
+
} }
|
|
124
|
+
function DayTimeline_For_5_Conditional_2_Conditional_4_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
125
|
+
i0.ɵɵtext(0);
|
|
126
|
+
} if (rf & 2) {
|
|
127
|
+
const event_r5 = i0.ɵɵnextContext(3).$implicit;
|
|
128
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
129
|
+
i0.ɵɵtextInterpolate(ctx_r1.textOf(event_r5.subtitle));
|
|
130
|
+
} }
|
|
131
|
+
function DayTimeline_For_5_Conditional_2_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
132
|
+
i0.ɵɵelementStart(0, "div");
|
|
133
|
+
i0.ɵɵconditionalCreate(1, DayTimeline_For_5_Conditional_2_Conditional_4_Conditional_1_Template, 1, 1, "ng-container", 10)(2, DayTimeline_For_5_Conditional_2_Conditional_4_Conditional_2_Template, 1, 1);
|
|
134
|
+
i0.ɵɵelementEnd();
|
|
135
|
+
} if (rf & 2) {
|
|
136
|
+
const event_r5 = i0.ɵɵnextContext(2).$implicit;
|
|
137
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
138
|
+
i0.ɵɵclassMap(ctx_r1.subtitleClasses(event_r5));
|
|
139
|
+
i0.ɵɵadvance();
|
|
140
|
+
i0.ɵɵconditional(ctx_r1.isTemplate(event_r5.subtitle) ? 1 : 2);
|
|
141
|
+
} }
|
|
142
|
+
function DayTimeline_For_5_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
143
|
+
i0.ɵɵelementStart(0, "div")(1, "div");
|
|
144
|
+
i0.ɵɵconditionalCreate(2, DayTimeline_For_5_Conditional_2_Conditional_2_Template, 1, 1, "ng-container", 10)(3, DayTimeline_For_5_Conditional_2_Conditional_3_Template, 1, 1);
|
|
145
|
+
i0.ɵɵelementEnd();
|
|
146
|
+
i0.ɵɵconditionalCreate(4, DayTimeline_For_5_Conditional_2_Conditional_4_Template, 3, 3, "div", 11);
|
|
147
|
+
i0.ɵɵelementEnd();
|
|
148
|
+
} if (rf & 2) {
|
|
149
|
+
const event_r5 = i0.ɵɵnextContext().$implicit;
|
|
150
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
151
|
+
i0.ɵɵstyleMap(ctx_r1.contentStyle(event_r5));
|
|
152
|
+
i0.ɵɵadvance();
|
|
153
|
+
i0.ɵɵclassMap(ctx_r1.titleClasses());
|
|
154
|
+
i0.ɵɵadvance();
|
|
155
|
+
i0.ɵɵconditional(ctx_r1.isTemplate(event_r5.title) ? 2 : 3);
|
|
156
|
+
i0.ɵɵadvance(2);
|
|
157
|
+
i0.ɵɵconditional(event_r5.subtitle ? 4 : -1);
|
|
158
|
+
} }
|
|
159
|
+
function DayTimeline_For_5_Template(rf, ctx) { if (rf & 1) {
|
|
160
|
+
i0.ɵɵelementStart(0, "div", 6);
|
|
161
|
+
i0.ɵɵconditionalCreate(1, DayTimeline_For_5_Conditional_1_Template, 5, 7, "button", 7)(2, DayTimeline_For_5_Conditional_2_Template, 5, 6, "div", 8);
|
|
162
|
+
i0.ɵɵelementEnd();
|
|
163
|
+
} if (rf & 2) {
|
|
164
|
+
const event_r5 = ctx.$implicit;
|
|
165
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
166
|
+
i0.ɵɵstyleMap(ctx_r1.cardStyle(event_r5));
|
|
167
|
+
i0.ɵɵclassMap(ctx_r1.eventCardClasses(event_r5));
|
|
168
|
+
i0.ɵɵattribute("data-event-id", event_r5.id)("aria-label", ctx_r1.eventAria(event_r5));
|
|
169
|
+
i0.ɵɵadvance();
|
|
170
|
+
i0.ɵɵconditional(event_r5.onClick ? 1 : 2);
|
|
171
|
+
} }
|
|
172
|
+
/**
|
|
173
|
+
* Format a fractional 24h hour as `H AM/PM` (e.g. `9.5` → `9:30 AM`).
|
|
174
|
+
*
|
|
175
|
+
* @param hour - Fractional 24h hour value.
|
|
176
|
+
* @returns A short clock-style label.
|
|
177
|
+
*/
|
|
178
|
+
export function formatHour(hour) {
|
|
179
|
+
const hh = Math.floor(hour);
|
|
180
|
+
const mm = Math.round((hour - hh) * 60);
|
|
181
|
+
const period = hh >= 12 ? 'PM' : 'AM';
|
|
182
|
+
const display = ((hh + 11) % 12) + 1;
|
|
183
|
+
return mm === 0 ? `${display} ${period}` : `${display}:${String(mm).padStart(2, '0')} ${period}`;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* DayTimeline component.
|
|
187
|
+
*
|
|
188
|
+
* Vertical 24h day-of-events timeline. The host IS the root `<div>`
|
|
189
|
+
* (`div[mol-day-timeline]`), matching React's root exactly: `role="list"` +
|
|
190
|
+
* the accessible label on the host, the hour axis, the rail with its
|
|
191
|
+
* gridlines and one absolutely-positioned card per event. Node-valued event
|
|
192
|
+
* fields (`title`, `subtitle`) are `ng-template` references rendered through
|
|
193
|
+
* {@link NgTemplateOutlet}; string / number fields render as text.
|
|
194
|
+
*/
|
|
195
|
+
export class DayTimeline {
|
|
196
|
+
/** Events to render on the timeline. */
|
|
197
|
+
events = [];
|
|
198
|
+
/** First hour rendered (inclusive; defaults to `0` at read time). */
|
|
199
|
+
startHour;
|
|
200
|
+
/** Last hour rendered (exclusive; defaults to `24` at read time). */
|
|
201
|
+
endHour;
|
|
202
|
+
/** Pixel height per hour (defaults to `60` at read time). */
|
|
203
|
+
pxPerHour;
|
|
204
|
+
/** Whether to render the axis tick labels (defaults to `true` at read time). */
|
|
205
|
+
showAxisLabels;
|
|
206
|
+
/** `data-mol-id` attribute for AI-agent selectors. */
|
|
207
|
+
dataMolId;
|
|
208
|
+
/** Extra classes appended via the ClassMap `cn()` helper. */
|
|
209
|
+
className;
|
|
210
|
+
/** The i18n handle (locale-reactive), read in an injection context. */
|
|
211
|
+
i18n = useTranslation();
|
|
212
|
+
/**
|
|
213
|
+
* The current class map.
|
|
214
|
+
* @returns The UIClassMap.
|
|
215
|
+
*/
|
|
216
|
+
cm() {
|
|
217
|
+
return getClassMap();
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Whether the axis tick labels render (React's `showAxisLabels = true`).
|
|
221
|
+
* @returns True when the axis column renders.
|
|
222
|
+
*/
|
|
223
|
+
showAxis() {
|
|
224
|
+
return this.showAxisLabels ?? true;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The viewport's clamped first hour (React: `max(0, min(24, startHour))`).
|
|
228
|
+
* @returns The safe start hour.
|
|
229
|
+
*/
|
|
230
|
+
safeStart() {
|
|
231
|
+
return Math.max(0, Math.min(24, this.startHour ?? 0));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The viewport's clamped last hour (React: at least `startHour + 1`, at most 24).
|
|
235
|
+
* @returns The safe end hour.
|
|
236
|
+
*/
|
|
237
|
+
safeEnd() {
|
|
238
|
+
return Math.max(this.safeStart() + 1, Math.min(24, this.endHour ?? 24));
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The pixel height of one hour (React's `pxPerHour = 60`).
|
|
242
|
+
* @returns The hour height in pixels.
|
|
243
|
+
*/
|
|
244
|
+
hourHeight() {
|
|
245
|
+
return this.pxPerHour ?? 60;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* The axis' total height.
|
|
249
|
+
* @returns The height in pixels.
|
|
250
|
+
*/
|
|
251
|
+
totalHeight() {
|
|
252
|
+
return (this.safeEnd() - this.safeStart()) * this.hourHeight();
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* The hour ticks in the visible window (React pre-builds the same list).
|
|
256
|
+
* @returns The tick hours.
|
|
257
|
+
*/
|
|
258
|
+
ticks() {
|
|
259
|
+
const hours = [];
|
|
260
|
+
for (let hour = Math.ceil(this.safeStart()); hour < this.safeEnd(); hour += 1)
|
|
261
|
+
hours.push(hour);
|
|
262
|
+
return hours;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The wrapper's class list.
|
|
266
|
+
* @returns The class string.
|
|
267
|
+
*/
|
|
268
|
+
classes() {
|
|
269
|
+
return this.cm().cn(this.className);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* The root's accessible label.
|
|
273
|
+
* @returns The translated group label.
|
|
274
|
+
*/
|
|
275
|
+
groupLabel() {
|
|
276
|
+
return this.i18n.t('dayTimeline.group', {}, { defaultValue: 'Day timeline' });
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* The root's inline style — the axis grid has no ClassMap resolver.
|
|
280
|
+
* @returns The CSS text.
|
|
281
|
+
*/
|
|
282
|
+
wrapperStyle() {
|
|
283
|
+
const columns = this.showAxis() ? '64px 1fr' : '1fr';
|
|
284
|
+
return `position: relative; display: grid; grid-template-columns: ${columns}; min-height: ${this.totalHeight()}px`;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The axis column's inline style.
|
|
288
|
+
* @returns The CSS text.
|
|
289
|
+
*/
|
|
290
|
+
axisStyle() {
|
|
291
|
+
return `position: relative; height: ${this.totalHeight()}px`;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The rail's inline style; its divider from the axis labels is a class.
|
|
295
|
+
* @returns The CSS text.
|
|
296
|
+
*/
|
|
297
|
+
railStyle() {
|
|
298
|
+
return `position: relative; height: ${this.totalHeight()}px`;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* The rail's class list: the theme divider from the axis labels, only while
|
|
302
|
+
* the axis shows.
|
|
303
|
+
* @returns The class string.
|
|
304
|
+
*/
|
|
305
|
+
railClasses() {
|
|
306
|
+
return this.showAxis() ? this.cm().borderL : '';
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* A tick label's class list (the small text recipe, muted).
|
|
310
|
+
* @returns The class string.
|
|
311
|
+
*/
|
|
312
|
+
tickClasses() {
|
|
313
|
+
const cm = this.cm();
|
|
314
|
+
return cm.cn(cm.textSize('xs'), cm.textMuted);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* A tick label's inline style.
|
|
318
|
+
* @param hour - The tick's hour.
|
|
319
|
+
* @returns The CSS text.
|
|
320
|
+
*/
|
|
321
|
+
tickStyle(hour) {
|
|
322
|
+
const top = (hour - this.safeStart()) * this.hourHeight();
|
|
323
|
+
return `position: absolute; top: ${top}px; right: 8px; transform: translateY(-50%)`;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* The text a tick label shows.
|
|
327
|
+
* @param hour - The tick's hour.
|
|
328
|
+
* @returns The formatted hour.
|
|
329
|
+
*/
|
|
330
|
+
tickLabel(hour) {
|
|
331
|
+
return formatHour(hour);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* One gridline's class list (the theme's border color as a fill).
|
|
335
|
+
* @returns The class string.
|
|
336
|
+
*/
|
|
337
|
+
gridlineClasses() {
|
|
338
|
+
return this.cm().bgBorder;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* One gridline's inline style.
|
|
342
|
+
* @param hour - The gridline's hour.
|
|
343
|
+
* @returns The CSS text.
|
|
344
|
+
*/
|
|
345
|
+
gridlineStyle(hour) {
|
|
346
|
+
const top = (hour - this.safeStart()) * this.hourHeight();
|
|
347
|
+
return `position: absolute; top: ${top}px; left: 0px; right: 0px; height: 1px`;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* The event card's class list: the accent-card recipe in the event's tone
|
|
351
|
+
* (its own accent color, or the brand primary), over the theme's secondary
|
|
352
|
+
* surface.
|
|
353
|
+
* @param event - The event.
|
|
354
|
+
* @returns The class string.
|
|
355
|
+
*/
|
|
356
|
+
eventCardClasses(event) {
|
|
357
|
+
const cm = this.cm();
|
|
358
|
+
return cm.cn(cm.accentCard({ tone: this.cardTone(event) }), cm.surfaceSecondary);
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* The event's accent-card tone: its own `accentColor` when it has one, the
|
|
362
|
+
* brand primary otherwise.
|
|
363
|
+
* @param event - The event.
|
|
364
|
+
* @returns The recipe tone.
|
|
365
|
+
*/
|
|
366
|
+
cardTone(event) {
|
|
367
|
+
return event.accentColor ? 'custom' : 'primary';
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* The event title's class list.
|
|
371
|
+
* @returns The class string.
|
|
372
|
+
*/
|
|
373
|
+
titleClasses() {
|
|
374
|
+
const cm = this.cm();
|
|
375
|
+
return cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'));
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* The event subtitle's class list (the accent-card label recipe, in the
|
|
379
|
+
* card's tone).
|
|
380
|
+
* @param event - The event.
|
|
381
|
+
* @returns The class string.
|
|
382
|
+
*/
|
|
383
|
+
subtitleClasses(event) {
|
|
384
|
+
return this.cm().accentCardLabel({ tone: this.cardTone(event) });
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* The event's clamped end hour (a 15-minute floor keeps tiny events
|
|
388
|
+
* clickable).
|
|
389
|
+
* @param event - The event.
|
|
390
|
+
* @returns Its clamped end hour.
|
|
391
|
+
*/
|
|
392
|
+
safeEndOf(event) {
|
|
393
|
+
return Math.max(event.endHour, event.startHour + 0.25);
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* The event card's inline style — geometry only; its colors are ClassMap
|
|
397
|
+
* classes.
|
|
398
|
+
* @param event - The event.
|
|
399
|
+
* @returns The CSS text.
|
|
400
|
+
*/
|
|
401
|
+
cardStyle(event) {
|
|
402
|
+
const top = (event.startHour - this.safeStart()) * this.hourHeight();
|
|
403
|
+
const height = Math.max(20, (this.safeEndOf(event) - event.startHour) * this.hourHeight());
|
|
404
|
+
return [
|
|
405
|
+
'position: absolute',
|
|
406
|
+
`top: ${top}px`,
|
|
407
|
+
'left: 6px',
|
|
408
|
+
'right: 6px',
|
|
409
|
+
`height: ${height}px`,
|
|
410
|
+
'border-radius: 6px',
|
|
411
|
+
'overflow: hidden',
|
|
412
|
+
// The event's accent color drives an inset bar, not a border-left.
|
|
413
|
+
// Without it the bar is the brand primary, through the recipe's
|
|
414
|
+
// `primary` tone.
|
|
415
|
+
...(event.accentColor ? [`--mol-accent: ${event.accentColor}`] : []),
|
|
416
|
+
].join('; ');
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* The content block's inline style: it fills the card so the whole surface
|
|
420
|
+
* is the click target, and its 30px left padding keeps the text clear of
|
|
421
|
+
* the accent bar.
|
|
422
|
+
* @param event - The event the block belongs to.
|
|
423
|
+
* @returns The CSS text.
|
|
424
|
+
*/
|
|
425
|
+
contentStyle(event) {
|
|
426
|
+
const parts = [
|
|
427
|
+
'position: absolute',
|
|
428
|
+
'inset: 0px',
|
|
429
|
+
'padding: 0.4rem 0.6rem 0.4rem 30px',
|
|
430
|
+
'font: inherit',
|
|
431
|
+
'color: inherit',
|
|
432
|
+
'text-align: left',
|
|
433
|
+
];
|
|
434
|
+
if (event.onClick)
|
|
435
|
+
parts.push('cursor: pointer', 'background: transparent');
|
|
436
|
+
return parts.join('; ');
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* The event's accessible label, built from React's i18n key and default
|
|
440
|
+
* message (only a plain string title is carried into it).
|
|
441
|
+
* @param event - The event.
|
|
442
|
+
* @returns The aria label.
|
|
443
|
+
*/
|
|
444
|
+
eventAria(event) {
|
|
445
|
+
return this.i18n.t('dayTimeline.event', {
|
|
446
|
+
title: typeof event.title === 'string' ? event.title : '',
|
|
447
|
+
start: formatHour(event.startHour),
|
|
448
|
+
end: formatHour(this.safeEndOf(event)),
|
|
449
|
+
}, { defaultValue: '{{title}} from {{start}} to {{end}}' });
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Calls an event's own click handler with the native event, as React's
|
|
453
|
+
* `onClick={event.onClick}` does.
|
|
454
|
+
* @param event - The event that was clicked.
|
|
455
|
+
* @param native - The click event.
|
|
456
|
+
*/
|
|
457
|
+
handleClick(event, native) {
|
|
458
|
+
const onClick = event.onClick;
|
|
459
|
+
onClick?.(native);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Whether an event field holds a node (an `ng-template` reference) rather
|
|
463
|
+
* than text.
|
|
464
|
+
* @param value - The event field.
|
|
465
|
+
* @returns True when it renders through a template outlet.
|
|
466
|
+
*/
|
|
467
|
+
isTemplate(value) {
|
|
468
|
+
return value instanceof TemplateRef;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Narrows a value to an embedded template.
|
|
472
|
+
* @param value - An event field.
|
|
473
|
+
* @returns The template, or null.
|
|
474
|
+
*/
|
|
475
|
+
templateOf(value) {
|
|
476
|
+
return value instanceof TemplateRef ? value : null;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* The text an event field renders (React renders strings and numbers as
|
|
480
|
+
* text).
|
|
481
|
+
* @param value - The event field.
|
|
482
|
+
* @returns The text, or `''` for a node value.
|
|
483
|
+
*/
|
|
484
|
+
textOf(value) {
|
|
485
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value) : '';
|
|
486
|
+
}
|
|
487
|
+
static ɵfac = function DayTimeline_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DayTimeline)(); };
|
|
488
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DayTimeline, selectors: [["div", "mol-day-timeline", ""]], hostAttrs: ["role", "list"], hostVars: 6, hostBindings: function DayTimeline_HostBindings(rf, ctx) { if (rf & 2) {
|
|
489
|
+
i0.ɵɵattribute("data-mol-id", ctx.dataMolId ?? "day-timeline")("aria-label", ctx.groupLabel());
|
|
490
|
+
i0.ɵɵstyleMap(ctx.wrapperStyle());
|
|
491
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
492
|
+
} }, inputs: { events: "events", startHour: "startHour", endHour: "endHour", pxPerHour: "pxPerHour", showAxisLabels: "showAxisLabels", dataMolId: "dataMolId", className: "className" }, decls: 6, vars: 5, consts: [["aria-hidden", "true", 3, "style"], ["data-mol-id", "day-timeline-rail"], ["aria-hidden", "true", 3, "class", "style"], ["role", "listitem", "data-mol-id", "day-timeline-event", 3, "class", "style"], ["aria-hidden", "true"], [3, "class", "style"], ["role", "listitem", "data-mol-id", "day-timeline-event"], ["type", "button", "data-mol-id", "day-timeline-event-action", 3, "style"], [3, "style"], ["type", "button", "data-mol-id", "day-timeline-event-action", 3, "click"], [3, "ngTemplateOutlet"], [3, "class"]], template: function DayTimeline_Template(rf, ctx) { if (rf & 1) {
|
|
493
|
+
i0.ɵɵconditionalCreate(0, DayTimeline_Conditional_0_Template, 3, 2, "div", 0);
|
|
494
|
+
i0.ɵɵelementStart(1, "div", 1);
|
|
495
|
+
i0.ɵɵrepeaterCreate(2, DayTimeline_For_3_Template, 1, 4, "div", 2, i0.ɵɵrepeaterTrackByIdentity);
|
|
496
|
+
i0.ɵɵrepeaterCreate(4, DayTimeline_For_5_Template, 3, 7, "div", 3, _forTrack0);
|
|
497
|
+
i0.ɵɵelementEnd();
|
|
498
|
+
} if (rf & 2) {
|
|
499
|
+
i0.ɵɵconditional(ctx.showAxis() ? 0 : -1);
|
|
500
|
+
i0.ɵɵadvance();
|
|
501
|
+
i0.ɵɵstyleMap(ctx.railStyle());
|
|
502
|
+
i0.ɵɵclassMap(ctx.railClasses());
|
|
503
|
+
i0.ɵɵadvance();
|
|
504
|
+
i0.ɵɵrepeater(ctx.ticks());
|
|
505
|
+
i0.ɵɵadvance(2);
|
|
506
|
+
i0.ɵɵrepeater(ctx.events);
|
|
507
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
508
|
+
}
|
|
509
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DayTimeline, [{
|
|
510
|
+
type: Component,
|
|
511
|
+
args: [{
|
|
512
|
+
selector: 'div[mol-day-timeline]',
|
|
513
|
+
standalone: true,
|
|
514
|
+
imports: [NgTemplateOutlet],
|
|
515
|
+
inputs: [
|
|
516
|
+
'events',
|
|
517
|
+
'startHour',
|
|
518
|
+
'endHour',
|
|
519
|
+
'pxPerHour',
|
|
520
|
+
'showAxisLabels',
|
|
521
|
+
'dataMolId',
|
|
522
|
+
'className',
|
|
523
|
+
],
|
|
524
|
+
host: {
|
|
525
|
+
role: 'list',
|
|
526
|
+
'[class]': 'classes()',
|
|
527
|
+
'[attr.data-mol-id]': "dataMolId ?? 'day-timeline'",
|
|
528
|
+
'[attr.aria-label]': 'groupLabel()',
|
|
529
|
+
'[style]': 'wrapperStyle()',
|
|
530
|
+
},
|
|
531
|
+
// prettier-ignore
|
|
532
|
+
template: `
|
|
533
|
+
@if (showAxis()) {
|
|
534
|
+
<div aria-hidden="true" [style]="axisStyle()">
|
|
535
|
+
@for (hour of ticks(); track hour) {
|
|
536
|
+
<div [attr.data-axis-tick]="hour" [class]="tickClasses()" [style]="tickStyle(hour)">{{ tickLabel(hour) }}</div>
|
|
537
|
+
}
|
|
538
|
+
</div>
|
|
539
|
+
}
|
|
540
|
+
<div data-mol-id="day-timeline-rail" [class]="railClasses()" [style]="railStyle()">
|
|
541
|
+
@for (hour of ticks(); track hour) {
|
|
542
|
+
<div aria-hidden="true" [class]="gridlineClasses()" [style]="gridlineStyle(hour)"></div>
|
|
543
|
+
}
|
|
544
|
+
@for (event of events; track event.id) {
|
|
545
|
+
<div role="listitem" [attr.data-event-id]="event.id" data-mol-id="day-timeline-event" [attr.aria-label]="eventAria(event)" [class]="eventCardClasses(event)" [style]="cardStyle(event)">
|
|
546
|
+
@if (event.onClick) {
|
|
547
|
+
<button type="button" data-mol-id="day-timeline-event-action" [attr.aria-label]="eventAria(event)" (click)="handleClick(event, $event)" [style]="contentStyle(event)">
|
|
548
|
+
<div [class]="titleClasses()">@if (isTemplate(event.title)) {<ng-container [ngTemplateOutlet]="templateOf(event.title)"></ng-container>}@else {{{ textOf(event.title) }}}</div>
|
|
549
|
+
@if (event.subtitle) {
|
|
550
|
+
<div [class]="subtitleClasses(event)">@if (isTemplate(event.subtitle)) {<ng-container [ngTemplateOutlet]="templateOf(event.subtitle)"></ng-container>}@else {{{ textOf(event.subtitle) }}}</div>
|
|
551
|
+
}
|
|
552
|
+
</button>
|
|
553
|
+
} @else {
|
|
554
|
+
<div [style]="contentStyle(event)">
|
|
555
|
+
<div [class]="titleClasses()">@if (isTemplate(event.title)) {<ng-container [ngTemplateOutlet]="templateOf(event.title)"></ng-container>}@else {{{ textOf(event.title) }}}</div>
|
|
556
|
+
@if (event.subtitle) {
|
|
557
|
+
<div [class]="subtitleClasses(event)">@if (isTemplate(event.subtitle)) {<ng-container [ngTemplateOutlet]="templateOf(event.subtitle)"></ng-container>}@else {{{ textOf(event.subtitle) }}}</div>
|
|
558
|
+
}
|
|
559
|
+
</div>
|
|
560
|
+
}
|
|
561
|
+
</div>
|
|
562
|
+
}
|
|
563
|
+
</div>
|
|
564
|
+
`,
|
|
565
|
+
}]
|
|
566
|
+
}], null, null); })();
|
|
567
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DayTimeline, { className: "DayTimeline", filePath: "day-timeline.component.ts", lineNumber: 95 }); })();
|
|
568
|
+
//# sourceMappingURL=day-timeline.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"day-timeline.component.js","sourceRoot":"","sources":["../src/day-timeline.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;IAqDpC,2BAAoF;IAAA,YAAqB;IAAA,iBAAM;;;;IAArD,wCAAyB;IAAjD,mCAAuB;;IAA2B,cAAqB;IAArB,+CAAqB;;;IAF7G,8BAA8C;IAC5C,8GAEC;IACH,iBAAM;;;IAJkB,iCAAqB;IAC3C,cAEC;IAFD,cAAA,cAAO,CAEN;;;IAKD,yBAAwF;;;;IAApC,4CAA6B;IAAzD,uCAA2B;;;IAMgB,4BAA0E;;;;IAA5D,oEAA4C;;;IAAwB,YAAyB;;;;IAAzB,mDAAyB;;;IAE9F,4BAA6E;;;;IAA/D,uEAA+C;;;IAAwB,YAA4B;;;;IAA5B,sDAA4B;;;IAAzL,2BAAsC;IAAgH,AAAhH,yHAAkC,+EAAqF;IAA6B,iBAAM;;;;IAA3L,+CAAgC;IAAC,cAAoJ;IAApJ,8DAAoJ;;;;IAH9L,iCAAsK;IAAnE,0OAAS,oCAA0B,KAAC;IACrI,2BAA8B;IAA0G,AAA1G,2GAA+B,iEAAkF;IAA0B,iBAAM;IAC/K,kGAAsB;IAGxB,iBAAS;;;;IAL+H,4CAA6B;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C;YACD,8EAkBC;YACH,iBAAM;;YA9BN,yCAMC;YAC4D,cAAqB;YAArB,8BAAqB;YAA7C,gCAAuB;YAC1D,cAEC;YAFD,cAAA,WAAO,CAEN;YACD,eAkBC;YAlBD,yBAkBC;4BAhDK,gBAAgB;;iFAoDf,WAAW;cAvDvB,SAAS;eAAC;gBACT,QAAQ,EAAE,uBAAuB;gBACjC,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,MAAM,EAAE;oBACN,QAAQ;oBACR,WAAW;oBACX,SAAS;oBACT,WAAW;oBACX,gBAAgB;oBAChB,WAAW;oBACX,WAAW;iBACZ;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,MAAM;oBACZ,SAAS,EAAE,WAAW;oBACtB,oBAAoB,EAAE,6BAA6B;oBACnD,mBAAmB,EAAE,cAAc;oBACnC,SAAS,EAAE,gBAAgB;iBAC5B;gBACD,kBAAkB;gBAClB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCT;aACF;;kFACY,WAAW"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular vertical 24h day-of-events timeline — itinerary planner, daily
|
|
3
|
+
* agenda, schedule view. Events are absolutely positioned by start/end hour
|
|
4
|
+
* and scaled by `pxPerHour` (total height = (endHour - startHour) * pxPerHour).
|
|
5
|
+
*
|
|
6
|
+
* Exports `<div mol-day-timeline>` and `formatHour` — the Angular counterpart
|
|
7
|
+
* of `@molecule/app-day-timeline-react`, with the same props (React names) and
|
|
8
|
+
* the same DOM for the same input.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { Component } from '@angular/core'
|
|
13
|
+
* import { DayTimeline } from '@molecule/app-day-timeline-angular'
|
|
14
|
+
*
|
|
15
|
+
* @Component({
|
|
16
|
+
* selector: 'app-trip-day',
|
|
17
|
+
* standalone: true,
|
|
18
|
+
* imports: [DayTimeline],
|
|
19
|
+
* template: `<div mol-day-timeline [startHour]="7" [endHour]="22" [events]="events"></div>`,
|
|
20
|
+
* })
|
|
21
|
+
* export class TripDay {
|
|
22
|
+
* events = [
|
|
23
|
+
* { id: 'flight', title: 'Flight to LAX', startHour: 13, endHour: 16 },
|
|
24
|
+
* { id: 'dinner', title: 'Dinner', startHour: 19, endHour: 20.5 },
|
|
25
|
+
* ]
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* - **No overlap/lane layout.** Events are absolutely positioned across the
|
|
31
|
+
* full rail width, so events with overlapping time ranges render stacked
|
|
32
|
+
* on top of each other. If your data can contain concurrent events,
|
|
33
|
+
* partition them into separate `<DayTimeline>` columns (one per lane or
|
|
34
|
+
* resource) before rendering — the component does not de-conflict.
|
|
35
|
+
* - Bounds are clamped: `startHour` to [0, 24], `endHour` to at least
|
|
36
|
+
* `startHour + 1`; an event shorter than 15 minutes still renders at a
|
|
37
|
+
* 20px minimum height so it stays clickable.
|
|
38
|
+
* - Axis tick labels are formatted by the exported `formatHour()`, which
|
|
39
|
+
* uses English 12-hour "AM/PM" notation. There is currently no prop to
|
|
40
|
+
* localize tick formatting — hide them with `[showAxisLabels]="false"` and
|
|
41
|
+
* render your own axis if you need 24h or localized labels.
|
|
42
|
+
* - Aria labels resolve through `t()` with English fallbacks; the companion
|
|
43
|
+
* locale bond is `@molecule/app-locales-day-timeline`. Requires the app's
|
|
44
|
+
* i18n provider (`useTranslation()` throws without one) and a wired
|
|
45
|
+
* ClassMap bond (standard molecule app setup).
|
|
46
|
+
* - Events with an `onClick` render their content inside a native `<button>`
|
|
47
|
+
* (Enter and Space activate it); events without one are not focusable.
|
|
48
|
+
* - Node-valued event fields (`title`, `subtitle`) are `ng-template`
|
|
49
|
+
* references or plain text, as React's `ReactNode` fields are.
|
|
50
|
+
* - Events are tracked by `id` (`@for (… ; track event.id)`), so a re-passed
|
|
51
|
+
* or re-ordered list keeps each card's DOM the way React's `key` does.
|
|
52
|
+
*
|
|
53
|
+
* @module
|
|
54
|
+
*/
|
|
55
|
+
export * from './day-timeline.component.js';
|
|
56
|
+
export * from './types.js';
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,cAAc,6BAA6B,CAAA;AAC3C,cAAc,YAAY,CAAA"}
|