ud-components 0.8.13 → 0.9.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/enums/feature-flag-key.enum.d.ts +2 -1
- package/fesm2022/ud-components.mjs +734 -337
- package/fesm2022/ud-components.mjs.map +1 -1
- package/lib/occupancy-grid/occupancy-grid.component.d.ts +25 -327
- package/lib/occupancy-grid/occupancy-grid.layout.d.ts +20 -4
- package/lib/occupancy-grid/timeline-grid.component.d.ts +357 -0
- package/lib/occupancy-grid/timeline-grid.interface.d.ts +115 -0
- package/lib/occupancy-grid/timeline-grid.layout.d.ts +59 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { DestroyRef } from '@angular/core';
|
|
2
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
3
|
+
import { TimelineBar, TimelineBarClick, TimelineBarCreate, TimelineBarMove, TimelineBarResize, TimelineCellClick, TimelineClosure, TimelineClosureClick, TimelineLane, TimelineLaneDrop, TimelineLegendItem } from './timeline-grid.interface';
|
|
4
|
+
import { BarGeometry } from './occupancy-grid.layout';
|
|
5
|
+
import { TimelineLaneBar, TimelineLaneRow, TimelinePositionedRow, TimelineRow } from './timeline-grid.layout';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare const TIMELINE_GRID_HEADER_HEIGHT = 52;
|
|
8
|
+
export declare const TIMELINE_GRID_DEFAULT_LEGEND: TimelineLegendItem[];
|
|
9
|
+
/**
|
|
10
|
+
* Lanes as rows, days as columns, one bar per occupant (UC-11, made generic in
|
|
11
|
+
* UC-42; `ud-occupancy-grid` is the rooms-and-stays wrapper around it). It
|
|
12
|
+
* never writes anywhere — `lanes` is the only source of truth and this
|
|
13
|
+
* component never mutates it — but it is not inert: a bar's edge can be
|
|
14
|
+
* dragged (or, on a focused bar, Shift + arrow-keyed) to propose a new date,
|
|
15
|
+
* reported via `barResize`; a bar's body can be dragged to a new date, a
|
|
16
|
+
* different lane, or both, reported via `barMove`; an empty stretch can be
|
|
17
|
+
* dragged across to propose a new bar (`barCreate`); something dragged in from
|
|
18
|
+
* outside the grid can be dropped on a lane (`laneDrop`). Every gesture works
|
|
19
|
+
* the same way: report what happened, apply nothing.
|
|
20
|
+
*
|
|
21
|
+
* Inside a lane, overlapping bars are packed into slots (sub-rows); a lane
|
|
22
|
+
* with spare `capacity` also offers one empty slot to create in.
|
|
23
|
+
*
|
|
24
|
+
* Owns its own row virtualization: rows have different heights (one slot per
|
|
25
|
+
* overlapping bar), which the CDK's stable fixed-size strategy cannot do, and
|
|
26
|
+
* the autosize strategy is still experimental. Rows are positioned from a
|
|
27
|
+
* prefix sum of heights and only those intersecting the viewport are rendered.
|
|
28
|
+
*
|
|
29
|
+
* Every date is a YYYY-MM-DD string and every column is computed by
|
|
30
|
+
* local-date.ts; `new Date(string)` is never used, so a column can never be
|
|
31
|
+
* off by one west of Greenwich.
|
|
32
|
+
*/
|
|
33
|
+
export declare class TimelineGridComponent {
|
|
34
|
+
private readonly translate;
|
|
35
|
+
lanes: import("@angular/core").InputSignal<TimelineLane[]>;
|
|
36
|
+
from: import("@angular/core").InputSignal<string>;
|
|
37
|
+
to: import("@angular/core").InputSignal<string>;
|
|
38
|
+
today: import("@angular/core").InputSignal<string | null>;
|
|
39
|
+
dayWidth: import("@angular/core").InputSignal<number>;
|
|
40
|
+
leftColumnWidth: import("@angular/core").InputSignal<number>;
|
|
41
|
+
laneHeight: import("@angular/core").InputSignal<number>;
|
|
42
|
+
loading: import("@angular/core").InputSignal<boolean>;
|
|
43
|
+
/** Days the ‹ / › nav buttons and the ArrowLeft/ArrowRight keys shift the window by. */
|
|
44
|
+
navStepDays: import("@angular/core").InputSignal<number>;
|
|
45
|
+
/**
|
|
46
|
+
* When true, a resize, move or create drag is never allowed to leave two
|
|
47
|
+
* bars in the same lane overlapping in time: a resize clamps at the nearest
|
|
48
|
+
* other bar in the lane (not just its own slot), and a move or create
|
|
49
|
+
* ignores any candidate that would overlap, sticking to the last one that
|
|
50
|
+
* did not. Off by default, because a lane with capacity legitimately holds
|
|
51
|
+
* overlapping bars in different slots.
|
|
52
|
+
*/
|
|
53
|
+
preventOverlap: import("@angular/core").InputSignal<boolean>;
|
|
54
|
+
/** Translation keys for the corner header, the empty state and a lane's aria label (`{{lane}}` and `{{room}}` get the lane label). */
|
|
55
|
+
cornerLabelKey: import("@angular/core").InputSignal<string>;
|
|
56
|
+
emptyLabelKey: import("@angular/core").InputSignal<string>;
|
|
57
|
+
createCellLabelKey: import("@angular/core").InputSignal<string>;
|
|
58
|
+
/** The bar states listed in the legend, and the label each one shows in a bar's tooltip. */
|
|
59
|
+
legend: import("@angular/core").InputSignal<TimelineLegendItem[]>;
|
|
60
|
+
/**
|
|
61
|
+
* What is being dragged in from outside the grid, or null when nothing is.
|
|
62
|
+
* The consumer sets it on its own `dragstart` and clears it on `dragend`:
|
|
63
|
+
* an HTML5 drag's data cannot be read until the drop, so this is how the
|
|
64
|
+
* grid knows, during the drag, which lanes can take it. Lanes only accept a
|
|
65
|
+
* drop while it is set.
|
|
66
|
+
*/
|
|
67
|
+
dragPayload: import("@angular/core").InputSignal<unknown>;
|
|
68
|
+
/** Whether a lane can take `dragPayload`. Lanes that cannot are greyed out while the drag is live. Null = every lane can. */
|
|
69
|
+
canDrop: import("@angular/core").InputSignal<((lane: TimelineLane, payload: unknown) => boolean) | null>;
|
|
70
|
+
barClick: import("@angular/core").OutputEmitterRef<TimelineBarClick>;
|
|
71
|
+
closureClick: import("@angular/core").OutputEmitterRef<TimelineClosureClick>;
|
|
72
|
+
/** The lane's own header cell was clicked. */
|
|
73
|
+
laneClick: import("@angular/core").OutputEmitterRef<TimelineLane>;
|
|
74
|
+
/** An empty day cell was clicked: the lane and the date under the pointer. */
|
|
75
|
+
cellClick: import("@angular/core").OutputEmitterRef<TimelineCellClick>;
|
|
76
|
+
reachedEnd: import("@angular/core").OutputEmitterRef<string>;
|
|
77
|
+
/**
|
|
78
|
+
* The nav buttons or an arrow key asked to move the window. The component
|
|
79
|
+
* does not own `from`/`to`, so it reports the signed day delta — negative
|
|
80
|
+
* for earlier, positive for later. A consumer that wants the shift applied
|
|
81
|
+
* does `from = addDays(from, delta); to = addDays(to, delta)`.
|
|
82
|
+
*/
|
|
83
|
+
windowShift: import("@angular/core").OutputEmitterRef<number>;
|
|
84
|
+
barResize: import("@angular/core").OutputEmitterRef<TimelineBarResize>;
|
|
85
|
+
barMove: import("@angular/core").OutputEmitterRef<TimelineBarMove>;
|
|
86
|
+
barCreate: import("@angular/core").OutputEmitterRef<TimelineBarCreate>;
|
|
87
|
+
laneDrop: import("@angular/core").OutputEmitterRef<TimelineLaneDrop<unknown>>;
|
|
88
|
+
protected readonly headerHeight = 52;
|
|
89
|
+
private readonly scroller;
|
|
90
|
+
private readonly collapsed;
|
|
91
|
+
private readonly scrollTop;
|
|
92
|
+
private readonly viewportHeight;
|
|
93
|
+
private lastEndEmittedFor;
|
|
94
|
+
/**
|
|
95
|
+
* The in-progress edge drag, if any. `geometryOf` and `barTitle` read the
|
|
96
|
+
* preview dates for whichever bar this names so the drag renders live;
|
|
97
|
+
* nothing about `lanes` changes, since the component does not own it. An
|
|
98
|
+
* open-ended bar's end is `OPEN_END` here and null again on the way out.
|
|
99
|
+
*/
|
|
100
|
+
protected readonly resize: import("@angular/core").WritableSignal<{
|
|
101
|
+
lane: TimelineLane;
|
|
102
|
+
bar: TimelineBar;
|
|
103
|
+
edge: "start" | "end";
|
|
104
|
+
previewStart: string;
|
|
105
|
+
previewEnd: string;
|
|
106
|
+
minBound: string | null;
|
|
107
|
+
maxBound: string | null;
|
|
108
|
+
} | null>;
|
|
109
|
+
/** Read-only view of `resize`, for a wrapper that surfaces it (ud-occupancy-grid). */
|
|
110
|
+
readonly activeResize: import("@angular/core").Signal<{
|
|
111
|
+
lane: TimelineLane;
|
|
112
|
+
bar: TimelineBar;
|
|
113
|
+
edge: "start" | "end";
|
|
114
|
+
previewStart: string;
|
|
115
|
+
previewEnd: string;
|
|
116
|
+
minBound: string | null;
|
|
117
|
+
maxBound: string | null;
|
|
118
|
+
} | null>;
|
|
119
|
+
private dragMoveListener;
|
|
120
|
+
private dragUpListener;
|
|
121
|
+
private dragKeyListener;
|
|
122
|
+
/**
|
|
123
|
+
* The in-progress whole-bar drag, if any. `dragging` only flips true once
|
|
124
|
+
* the pointer clears a small threshold, so a plain click still reaches
|
|
125
|
+
* `barClick`. `targetLane` is re-resolved on every mousemove from whatever
|
|
126
|
+
* lane row is under the pointer — see `laneUnderPoint`.
|
|
127
|
+
*/
|
|
128
|
+
protected readonly move: import("@angular/core").WritableSignal<{
|
|
129
|
+
bar: TimelineBar;
|
|
130
|
+
fromLane: TimelineLane;
|
|
131
|
+
startClientX: number;
|
|
132
|
+
startClientY: number;
|
|
133
|
+
originalStartDate: string;
|
|
134
|
+
originalEndDate: string;
|
|
135
|
+
previewStartDate: string;
|
|
136
|
+
previewEndDate: string;
|
|
137
|
+
targetLane: TimelineLane;
|
|
138
|
+
dragging: boolean;
|
|
139
|
+
} | null>;
|
|
140
|
+
private moveMoveListener;
|
|
141
|
+
private moveUpListener;
|
|
142
|
+
private moveKeyListener;
|
|
143
|
+
/**
|
|
144
|
+
* The in-progress drag-to-create, if any. `startDate` is the anchor the
|
|
145
|
+
* drag began from (mouse) or the focused cell it started from (keyboard). A
|
|
146
|
+
* mouse create only commits on mouseup once it clears the click-vs-drag
|
|
147
|
+
* threshold; a keyboard create is live the instant Enter starts it and
|
|
148
|
+
* commits on a second Enter.
|
|
149
|
+
*/
|
|
150
|
+
protected readonly create: import("@angular/core").WritableSignal<{
|
|
151
|
+
lane: TimelineLane;
|
|
152
|
+
slot: number;
|
|
153
|
+
startDate: string;
|
|
154
|
+
startClientX: number;
|
|
155
|
+
previewStart: string;
|
|
156
|
+
previewEnd: string;
|
|
157
|
+
dragging: boolean;
|
|
158
|
+
viaKeyboard: boolean;
|
|
159
|
+
} | null>;
|
|
160
|
+
private createMoveListener;
|
|
161
|
+
private createUpListener;
|
|
162
|
+
private createKeyListener;
|
|
163
|
+
/**
|
|
164
|
+
* The keyboard-focused empty cell, if any. Cleared on blur unless a
|
|
165
|
+
* keyboard create is in progress, so the highlighted cell does not vanish
|
|
166
|
+
* out from under an active gesture.
|
|
167
|
+
*/
|
|
168
|
+
protected readonly laneFocus: import("@angular/core").WritableSignal<{
|
|
169
|
+
laneId: string;
|
|
170
|
+
date: string;
|
|
171
|
+
} | null>;
|
|
172
|
+
/**
|
|
173
|
+
* The day column under the pointer anywhere on the canvas, as an index into
|
|
174
|
+
* days(), or null. Drawn as a full-height band, so together with the row
|
|
175
|
+
* wash the pointer reads as a crosshair: which lane, which day.
|
|
176
|
+
*/
|
|
177
|
+
protected readonly hoverDay: import("@angular/core").WritableSignal<number | null>;
|
|
178
|
+
/**
|
|
179
|
+
* The empty cell the mouse (or an external drag) is over, if any — the
|
|
180
|
+
* pointer equivalent of `laneFocus`. Cleared whenever a create, resize or
|
|
181
|
+
* move is live, so it never competes with that gesture's own preview.
|
|
182
|
+
*/
|
|
183
|
+
protected readonly laneHover: import("@angular/core").WritableSignal<{
|
|
184
|
+
laneId: string;
|
|
185
|
+
date: string;
|
|
186
|
+
slot: number;
|
|
187
|
+
} | null>;
|
|
188
|
+
/** The lane an external drag is currently over. */
|
|
189
|
+
protected readonly dropTarget: import("@angular/core").WritableSignal<string | null>;
|
|
190
|
+
/**
|
|
191
|
+
* The pointer is over a bar or closure. Suppresses the focus-cursor
|
|
192
|
+
* fallback in `laneCursorGeometry`, so a stale keyboard cell does not show
|
|
193
|
+
* up elsewhere while the pointer is on a bar.
|
|
194
|
+
*/
|
|
195
|
+
private readonly pointerOnBar;
|
|
196
|
+
private suppressNextClick;
|
|
197
|
+
private suppressNextClickTimer;
|
|
198
|
+
constructor(translate: TranslateService, destroyRef: DestroyRef);
|
|
199
|
+
protected readonly dayCount: import("@angular/core").Signal<number>;
|
|
200
|
+
protected readonly canvasWidth: import("@angular/core").Signal<number>;
|
|
201
|
+
protected readonly rows: import("@angular/core").Signal<TimelineRow[]>;
|
|
202
|
+
protected readonly positioned: import("@angular/core").Signal<TimelinePositionedRow[]>;
|
|
203
|
+
protected readonly bodyHeight: import("@angular/core").Signal<number>;
|
|
204
|
+
protected readonly visible: import("@angular/core").Signal<TimelinePositionedRow[]>;
|
|
205
|
+
protected readonly days: import("@angular/core").Signal<import("ud-components").DayColumn[]>;
|
|
206
|
+
protected readonly months: import("@angular/core").Signal<import("ud-components").MonthSegment[]>;
|
|
207
|
+
protected readonly weekendOffsetPx: import("@angular/core").Signal<number>;
|
|
208
|
+
protected readonly todayLeft: import("@angular/core").Signal<number | null>;
|
|
209
|
+
private readonly lanesById;
|
|
210
|
+
/**
|
|
211
|
+
* The floating copy of a bar being dragged by its body — null unless a
|
|
212
|
+
* move drag has cleared the click threshold. Positioned in canvas
|
|
213
|
+
* coordinates because a move can target a lane other than the one the drag
|
|
214
|
+
* started in; `positioned()` already has every visible row's pixel `top`.
|
|
215
|
+
*/
|
|
216
|
+
protected readonly moveGhost: import("@angular/core").Signal<{
|
|
217
|
+
left: number;
|
|
218
|
+
top: number;
|
|
219
|
+
width: number;
|
|
220
|
+
height: number;
|
|
221
|
+
label: string;
|
|
222
|
+
state: string;
|
|
223
|
+
openEnded: boolean;
|
|
224
|
+
} | null>;
|
|
225
|
+
/** The in-progress drag-to-create's preview span, once it clears the drag threshold (mouse) or as soon as it starts (keyboard). */
|
|
226
|
+
protected readonly createGhost: import("@angular/core").Signal<{
|
|
227
|
+
left: number;
|
|
228
|
+
top: number;
|
|
229
|
+
width: number;
|
|
230
|
+
height: number;
|
|
231
|
+
} | null>;
|
|
232
|
+
/**
|
|
233
|
+
* The empty cell to outline — the pointer (or external drag) position if
|
|
234
|
+
* there is one, otherwise the keyboard-focused cell — whenever no create
|
|
235
|
+
* gesture is overriding it with its own live preview.
|
|
236
|
+
*/
|
|
237
|
+
protected readonly laneCursorGeometry: import("@angular/core").Signal<{
|
|
238
|
+
left: number;
|
|
239
|
+
top: number;
|
|
240
|
+
width: number;
|
|
241
|
+
height: number;
|
|
242
|
+
} | null>;
|
|
243
|
+
private laneRowOf;
|
|
244
|
+
/** Canvas-coordinate box for a date span in a given lane's row; `slot` picks which of the row's slots it sits in. */
|
|
245
|
+
private ghostGeometry;
|
|
246
|
+
/** Where a keyboard create lands: the lane's free slot when it has one, else slot 0. */
|
|
247
|
+
private createSlot;
|
|
248
|
+
private monthLabels;
|
|
249
|
+
protected geometryOf(bar: TimelineBar): BarGeometry | null;
|
|
250
|
+
/** The in-progress drag's proposed dates for this bar, or null if it is not the one being dragged. */
|
|
251
|
+
private previewDatesOf;
|
|
252
|
+
protected isResizing(barId: string): boolean;
|
|
253
|
+
/** True once a whole-bar drag on this bar has cleared the click threshold — see `move`. */
|
|
254
|
+
protected isBeingMoved(barId: string): boolean;
|
|
255
|
+
/** True while a whole-bar drag, or an accepted external drag, is hovering this lane. */
|
|
256
|
+
protected isMoveTarget(laneId: string): boolean;
|
|
257
|
+
protected closureGeometryOf(closure: TimelineClosure): BarGeometry | null;
|
|
258
|
+
/** Bars on the first day shown (UC-18), for lanes with a capacity; null hides the count. */
|
|
259
|
+
protected takenOn(lane: TimelineLane): number | null;
|
|
260
|
+
protected isCollapsed(key: string): boolean;
|
|
261
|
+
protected toggleGroup(key: string): void;
|
|
262
|
+
protected barTitle(bar: TimelineBar): string;
|
|
263
|
+
protected closureTitle(closure: TimelineClosure): string;
|
|
264
|
+
protected onScroll(): void;
|
|
265
|
+
protected trackRow(_: number, p: TimelinePositionedRow): string;
|
|
266
|
+
protected asLaneRow(row: TimelineRow): TimelineLaneRow;
|
|
267
|
+
/** ‹ / › nav buttons. Emits the signed day delta; see `windowShift`. */
|
|
268
|
+
protected shiftWindow(direction: -1 | 1): void;
|
|
269
|
+
/**
|
|
270
|
+
* ArrowLeft/ArrowRight anywhere in the grid page the window, the same as
|
|
271
|
+
* the nav buttons. Shift+Arrow on a focused bar resizes it instead (bound on
|
|
272
|
+
* the bar itself), so it is declined here.
|
|
273
|
+
*/
|
|
274
|
+
protected onGridKeydown(event: KeyboardEvent): void;
|
|
275
|
+
/**
|
|
276
|
+
* A click inside a lane that landed on neither a bar nor a closure (both
|
|
277
|
+
* stop propagation before this fires) — the lane and the date under the
|
|
278
|
+
* pointer.
|
|
279
|
+
*/
|
|
280
|
+
protected onLaneClick(event: MouseEvent, lane: TimelineLane): void;
|
|
281
|
+
/** The bar's own click handler routes through here so it shares the same post-drag click guard as `onLaneClick`. */
|
|
282
|
+
protected onBarClick(bar: TimelineBar, lane: TimelineLane): void;
|
|
283
|
+
/**
|
|
284
|
+
* Mousedown on a bar's edge handle starts a drag. Listeners go on `window`
|
|
285
|
+
* because the pointer leaves an 8px handle the instant the drag starts;
|
|
286
|
+
* `stopPropagation` keeps this from also reading as a click on the bar or
|
|
287
|
+
* the lane underneath it.
|
|
288
|
+
*/
|
|
289
|
+
protected startResize(event: MouseEvent, lane: TimelineLane, bar: TimelineBar, edge: 'start' | 'end', laneBars: TimelineLaneBar[]): void;
|
|
290
|
+
private onDragMove;
|
|
291
|
+
/** Mouseup (commit) or Escape (cancel). Emits `barResize` only on commit with an actual change. */
|
|
292
|
+
private endResize;
|
|
293
|
+
private removeDragListeners;
|
|
294
|
+
/**
|
|
295
|
+
* Mousedown on a bar's body (never the edge handles — those stop
|
|
296
|
+
* propagation first) arms a possible whole-bar move, but nothing changes
|
|
297
|
+
* until `onBarDragMove` sees the pointer clear a small threshold, so a plain
|
|
298
|
+
* click still reaches `onBarClick`.
|
|
299
|
+
*/
|
|
300
|
+
protected startBarMove(event: MouseEvent, lane: TimelineLane, bar: TimelineBar): void;
|
|
301
|
+
private onBarDragMove;
|
|
302
|
+
/** Mouseup (commit) or Escape (cancel). Emits `barMove` only on commit with an actual change. */
|
|
303
|
+
private endBarMove;
|
|
304
|
+
private removeMoveListeners;
|
|
305
|
+
/**
|
|
306
|
+
* Mousedown on a lane's empty background arms a possible drag-to-create, on
|
|
307
|
+
* the same click-vs-drag threshold as `startBarMove` — a plain click still
|
|
308
|
+
* falls through to `onLaneClick`'s `cellClick`.
|
|
309
|
+
*/
|
|
310
|
+
protected startCreate(event: MouseEvent, lane: TimelineLane, slot?: number): void;
|
|
311
|
+
private onCreateDragMove;
|
|
312
|
+
/** Mouseup (commit) or Escape (cancel), for both the mouse and keyboard paths. Emits `barCreate` only once a drag actually cleared the threshold (or a keyboard create was started) and is committed. */
|
|
313
|
+
private endCreate;
|
|
314
|
+
private removeCreateListeners;
|
|
315
|
+
/**
|
|
316
|
+
* Focus lands on an empty lane — arm a keyboard cursor at today (or the
|
|
317
|
+
* window's first day) unless this lane already has one. Left alone while a
|
|
318
|
+
* keyboard create is in progress, so refocusing mid-gesture cannot reset it.
|
|
319
|
+
*/
|
|
320
|
+
protected onLaneFocus(lane: TimelineLane): void;
|
|
321
|
+
/**
|
|
322
|
+
* The pointer moved over a lane's empty background — update the hover
|
|
323
|
+
* cursor to the date under it. Ignored while a gesture is live, and when
|
|
324
|
+
* the event bubbled up from a bar or closure rather than the background.
|
|
325
|
+
*/
|
|
326
|
+
protected onLaneMouseMove(event: MouseEvent, lane: TimelineLane, slot?: number): void;
|
|
327
|
+
protected onCanvasMouseMove(event: MouseEvent): void;
|
|
328
|
+
protected onLaneMouseLeave(lane: TimelineLane): void;
|
|
329
|
+
protected onLaneBlur(): void;
|
|
330
|
+
private defaultCursorDate;
|
|
331
|
+
/**
|
|
332
|
+
* Keyboard path for drag-to-create: with no create in progress, plain
|
|
333
|
+
* ArrowLeft/ArrowRight move the focused cell one day and Enter/Space marks
|
|
334
|
+
* it as the start; once that create is live, the same arrow keys move the
|
|
335
|
+
* end date, a second Enter commits and Escape cancels.
|
|
336
|
+
*/
|
|
337
|
+
protected onLaneKeydown(event: KeyboardEvent, lane: TimelineLane): void;
|
|
338
|
+
protected canDropOn(lane: TimelineLane): boolean;
|
|
339
|
+
protected isDropDisabled(lane: TimelineLane): boolean;
|
|
340
|
+
/** Accepting the dragover (preventDefault) is what lets the browser drop here at all. */
|
|
341
|
+
protected onLaneDragOver(event: DragEvent, lane: TimelineLane): void;
|
|
342
|
+
protected onLaneDragLeave(event: DragEvent, lane: TimelineLane): void;
|
|
343
|
+
protected onLaneDrop(event: DragEvent, lane: TimelineLane): void;
|
|
344
|
+
/** Whatever lane row (if any) is actually rendered under this point — see `.occ__row--room`'s `data-lane-id`. */
|
|
345
|
+
private laneUnderPoint;
|
|
346
|
+
private armSuppressNextClick;
|
|
347
|
+
private consumeSuppressNextClick;
|
|
348
|
+
private clientXToDate;
|
|
349
|
+
/**
|
|
350
|
+
* The keyboard equivalent of dragging the end edge: Shift+ArrowRight
|
|
351
|
+
* extends by a day, Shift+ArrowLeft shortens by one, each press committing
|
|
352
|
+
* immediately. End edge only; an open-ended bar has none to move.
|
|
353
|
+
*/
|
|
354
|
+
protected onBarKeydownResize(event: KeyboardEvent, lane: TimelineLane, bar: TimelineBar, laneBars: TimelineLaneBar[]): void;
|
|
355
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TimelineGridComponent, never>;
|
|
356
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TimelineGridComponent, "ud-timeline-grid", never, { "lanes": { "alias": "lanes"; "required": false; "isSignal": true; }; "from": { "alias": "from"; "required": true; "isSignal": true; }; "to": { "alias": "to"; "required": true; "isSignal": true; }; "today": { "alias": "today"; "required": false; "isSignal": true; }; "dayWidth": { "alias": "dayWidth"; "required": false; "isSignal": true; }; "leftColumnWidth": { "alias": "leftColumnWidth"; "required": false; "isSignal": true; }; "laneHeight": { "alias": "laneHeight"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "navStepDays": { "alias": "navStepDays"; "required": false; "isSignal": true; }; "preventOverlap": { "alias": "preventOverlap"; "required": false; "isSignal": true; }; "cornerLabelKey": { "alias": "cornerLabelKey"; "required": false; "isSignal": true; }; "emptyLabelKey": { "alias": "emptyLabelKey"; "required": false; "isSignal": true; }; "createCellLabelKey": { "alias": "createCellLabelKey"; "required": false; "isSignal": true; }; "legend": { "alias": "legend"; "required": false; "isSignal": true; }; "dragPayload": { "alias": "dragPayload"; "required": false; "isSignal": true; }; "canDrop": { "alias": "canDrop"; "required": false; "isSignal": true; }; }, { "barClick": "barClick"; "closureClick": "closureClick"; "laneClick": "laneClick"; "cellClick": "cellClick"; "reachedEnd": "reachedEnd"; "windowShift": "windowShift"; "barResize": "barResize"; "barMove": "barMove"; "barCreate": "barCreate"; "laneDrop": "laneDrop"; }, never, never, true, never>;
|
|
357
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generic model behind `ud-timeline-grid`: lanes as rows, days as
|
|
3
|
+
* columns, bars and closures inside each lane. `ud-occupancy-grid` is one
|
|
4
|
+
* consumer (a room is a lane, a stay is a bar); anything else with things
|
|
5
|
+
* occupying slots over date ranges (parking spaces, say) is another.
|
|
6
|
+
*
|
|
7
|
+
* Every date is YYYY-MM-DD. `startDate` is the first day, `endDate` the day
|
|
8
|
+
* after the last one (EXCLUSIVE), same as the occupancy model.
|
|
9
|
+
*/
|
|
10
|
+
export interface TimelineBar {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
startDate: string;
|
|
15
|
+
/** EXCLUSIVE. null = open-ended: drawn to the window edge with an arrow. */
|
|
16
|
+
endDate: string | null;
|
|
17
|
+
continuesBefore: boolean;
|
|
18
|
+
continuesAfter: boolean;
|
|
19
|
+
/** Drives the colour (`data-state`); the built-in ones are tentative, reserved, in_room and history. */
|
|
20
|
+
state: string;
|
|
21
|
+
/** Short text shown at the end of the bar. */
|
|
22
|
+
badge?: string;
|
|
23
|
+
/** Whatever the consumer needs back from an event; never read by the grid. */
|
|
24
|
+
data?: unknown;
|
|
25
|
+
}
|
|
26
|
+
export interface TimelineClosure {
|
|
27
|
+
id: string;
|
|
28
|
+
label: string;
|
|
29
|
+
startDate: string;
|
|
30
|
+
/** EXCLUSIVE. */
|
|
31
|
+
endDate: string;
|
|
32
|
+
continuesBefore: boolean;
|
|
33
|
+
continuesAfter: boolean;
|
|
34
|
+
data?: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface TimelineGroup {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
}
|
|
40
|
+
export interface TimelineLane {
|
|
41
|
+
id: string;
|
|
42
|
+
label: string;
|
|
43
|
+
sublabel?: string;
|
|
44
|
+
/** Lanes are grouped under collapsible headers, in the order their groups first appear. */
|
|
45
|
+
groupId: string;
|
|
46
|
+
groupLabel: string;
|
|
47
|
+
/** Outer groups above `groupId`, outermost first, for nested headers. */
|
|
48
|
+
parentGroups?: TimelineGroup[];
|
|
49
|
+
active: boolean;
|
|
50
|
+
tags?: string[];
|
|
51
|
+
/**
|
|
52
|
+
* How many bars may overlap on one day. When set, the lane shows a
|
|
53
|
+
* taken/capacity count and offers a free sub-lane to create in while it
|
|
54
|
+
* has room; unset means one at a time and no count.
|
|
55
|
+
*/
|
|
56
|
+
capacity?: number;
|
|
57
|
+
bars: TimelineBar[];
|
|
58
|
+
closures: TimelineClosure[];
|
|
59
|
+
data?: unknown;
|
|
60
|
+
}
|
|
61
|
+
export interface TimelineLegendItem {
|
|
62
|
+
state: string;
|
|
63
|
+
/** Translation key for the label. */
|
|
64
|
+
labelKey: string;
|
|
65
|
+
}
|
|
66
|
+
export interface TimelineBarClick {
|
|
67
|
+
bar: TimelineBar;
|
|
68
|
+
lane: TimelineLane;
|
|
69
|
+
}
|
|
70
|
+
export interface TimelineClosureClick {
|
|
71
|
+
closure: TimelineClosure;
|
|
72
|
+
lane: TimelineLane;
|
|
73
|
+
}
|
|
74
|
+
/** An empty day cell was clicked: the lane and the date under the pointer. */
|
|
75
|
+
export interface TimelineCellClick {
|
|
76
|
+
lane: TimelineLane;
|
|
77
|
+
date: string;
|
|
78
|
+
}
|
|
79
|
+
/** A bar's edge was dragged (or Shift + arrow-keyed). Reports the proposal only. */
|
|
80
|
+
export interface TimelineBarResize {
|
|
81
|
+
bar: TimelineBar;
|
|
82
|
+
lane: TimelineLane;
|
|
83
|
+
edge: 'start' | 'end';
|
|
84
|
+
previousStartDate: string;
|
|
85
|
+
previousEndDate: string | null;
|
|
86
|
+
proposedStartDate: string;
|
|
87
|
+
/** Stays null when an open-ended bar's start was dragged. */
|
|
88
|
+
proposedEndDate: string | null;
|
|
89
|
+
}
|
|
90
|
+
/** A whole bar was dragged to other dates, another lane, or both. Reports the proposal only. */
|
|
91
|
+
export interface TimelineBarMove {
|
|
92
|
+
bar: TimelineBar;
|
|
93
|
+
fromLane: TimelineLane;
|
|
94
|
+
toLane: TimelineLane;
|
|
95
|
+
previousStartDate: string;
|
|
96
|
+
previousEndDate: string | null;
|
|
97
|
+
proposedStartDate: string;
|
|
98
|
+
/** Stays null when an open-ended bar is moved. */
|
|
99
|
+
proposedEndDate: string | null;
|
|
100
|
+
}
|
|
101
|
+
/** A new bar's dates were proposed by dragging across empty cells. Reports the proposal only. */
|
|
102
|
+
export interface TimelineBarCreate {
|
|
103
|
+
lane: TimelineLane;
|
|
104
|
+
proposedStartDate: string;
|
|
105
|
+
proposedEndDate: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Something dragged from outside the grid (HTML5 drag and drop) was dropped on
|
|
109
|
+
* a lane. `payload` is the grid's `dragPayload` input at the time of the drop.
|
|
110
|
+
*/
|
|
111
|
+
export interface TimelineLaneDrop<P = unknown> {
|
|
112
|
+
lane: TimelineLane;
|
|
113
|
+
date: string;
|
|
114
|
+
payload: P;
|
|
115
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TimelineBar, TimelineLane } from './timeline-grid.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Stands in for an open-ended bar's end everywhere a date is compared, so the
|
|
4
|
+
* packing, overlap and geometry code never needs a null branch. Never emitted:
|
|
5
|
+
* the component turns it back into null on the way out.
|
|
6
|
+
*/
|
|
7
|
+
export declare const OPEN_END = "9999-12-31";
|
|
8
|
+
export declare function endOf(bar: TimelineBar): string;
|
|
9
|
+
export interface TimelineGroupRow {
|
|
10
|
+
kind: 'group';
|
|
11
|
+
key: string;
|
|
12
|
+
depth: number;
|
|
13
|
+
label: string;
|
|
14
|
+
laneCount: number;
|
|
15
|
+
}
|
|
16
|
+
/** A bar and the slot (sub-row) it is packed into inside its lane. */
|
|
17
|
+
export interface TimelineLaneBar {
|
|
18
|
+
bar: TimelineBar;
|
|
19
|
+
slot: number;
|
|
20
|
+
}
|
|
21
|
+
export interface TimelineLaneRow {
|
|
22
|
+
kind: 'lane';
|
|
23
|
+
key: string;
|
|
24
|
+
lane: TimelineLane;
|
|
25
|
+
slots: number;
|
|
26
|
+
/** The one empty slot a lane with spare capacity offers for a new bar, or null when it has none. */
|
|
27
|
+
freeSlot: number | null;
|
|
28
|
+
bars: TimelineLaneBar[];
|
|
29
|
+
}
|
|
30
|
+
export type TimelineRow = TimelineGroupRow | TimelineLaneRow;
|
|
31
|
+
export interface TimelinePositionedRow {
|
|
32
|
+
row: TimelineRow;
|
|
33
|
+
top: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}
|
|
36
|
+
/** Greedy interval packing. Half-open, so a bar starting the day another ends shares its slot. */
|
|
37
|
+
export declare function packBars(bars: TimelineBar[]): TimelineLaneBar[];
|
|
38
|
+
/**
|
|
39
|
+
* Lanes under their group headers (outer groups first), groups in the order
|
|
40
|
+
* they first appear and lanes in input order. Collapsed groups hide everything
|
|
41
|
+
* below them.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildTimelineRows(lanes: TimelineLane[], collapsed: ReadonlySet<string>): TimelineRow[];
|
|
44
|
+
export declare function positionTimelineRows(rows: TimelineRow[], laneHeight: number): TimelinePositionedRow[];
|
|
45
|
+
/** Bars whose days include `date`. */
|
|
46
|
+
export declare function takenOnLane(lane: TimelineLane, date: string): number;
|
|
47
|
+
/**
|
|
48
|
+
* The nearest neighbouring bar's boundary on the given edge: the limit a drag
|
|
49
|
+
* on that edge must not cross. Same slot only, unless `allSlots`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function neighborBound(laneBars: TimelineLaneBar[], barId: string, edge: 'start' | 'end', allSlots?: boolean): string | null;
|
|
52
|
+
/** Whether `[start, end)` overlaps any OTHER bar in the lane (half-open). */
|
|
53
|
+
export declare function overlapsLane(lane: TimelineLane, barId: string, start: string, end: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The slot a bar over `[start, end)` would sit in: the first one clear of
|
|
56
|
+
* other bars, or just below the last when none is. `ignoreBarId` ('' for a
|
|
57
|
+
* new bar) is not an obstacle.
|
|
58
|
+
*/
|
|
59
|
+
export declare function slotForSpan(row: TimelineLaneRow, start: string, end: string, ignoreBarId: string): number;
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export * from './lib/occupancy-grid/occupancy-grid.component';
|
|
|
16
16
|
export * from './lib/occupancy-grid/occupancy-grid.interface';
|
|
17
17
|
export * from './lib/occupancy-grid/occupancy-grid.layout';
|
|
18
18
|
export * from './lib/occupancy-grid/local-date';
|
|
19
|
+
export * from './lib/occupancy-grid/timeline-grid.component';
|
|
20
|
+
export * from './lib/occupancy-grid/timeline-grid.interface';
|
|
19
21
|
export * from './lib/pill/pill.component';
|
|
20
22
|
export * from './lib/progress-bar/progress-bar.component';
|
|
21
23
|
export * from './lib/sidenav/sidenav.component';
|