ud-components 0.7.0 → 0.7.1

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.
@@ -1,6 +1,6 @@
1
1
  import { DestroyRef } from '@angular/core';
2
2
  import { TranslateService } from '@ngx-translate/core';
3
- import { OccupancyBar, OccupancyBarClick, OccupancyBarMove, OccupancyBarResize, OccupancyCellClick, OccupancyClosure, OccupancyClosureClick, OccupancyRoom } from './occupancy-grid.interface';
3
+ import { OccupancyBar, OccupancyBarClick, OccupancyBarCreate, OccupancyBarMove, OccupancyBarResize, OccupancyCellClick, OccupancyClosure, OccupancyClosureClick, OccupancyRoom } from './occupancy-grid.interface';
4
4
  import { BarGeometry, GridRow, LaneBar, PositionedRow, RoomRow } from './occupancy-grid.layout';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare const OCCUPANCY_GRID_HEADER_HEIGHT = 52;
@@ -74,6 +74,13 @@ export declare class OccupancyGridComponent {
74
74
  * `OccupancyBarMove` — this reports the proposal; it never applies it.
75
75
  */
76
76
  barMove: import("@angular/core").OutputEmitterRef<OccupancyBarMove>;
77
+ /**
78
+ * A new booking's dates were proposed by dragging across empty lane cells,
79
+ * or by the keyboard-driven create flow (see `onLaneKeydown`). See
80
+ * `OccupancyBarCreate` — this reports the proposal; it never creates a bar
81
+ * itself.
82
+ */
83
+ barCreate: import("@angular/core").OutputEmitterRef<OccupancyBarCreate>;
77
84
  protected readonly headerHeight = 52;
78
85
  private readonly scroller;
79
86
  private readonly collapsed;
@@ -123,6 +130,50 @@ export declare class OccupancyGridComponent {
123
130
  private moveMoveListener;
124
131
  private moveUpListener;
125
132
  private moveKeyListener;
133
+ /**
134
+ * The in-progress drag-to-create, if any — null the rest of the time.
135
+ * `startDate` is the anchor the drag began from (mouse) or the focused
136
+ * cell it started from (keyboard); `previewStart`/`previewEnd` are what
137
+ * gets emitted. `viaKeyboard` distinguishes the two sources: a mouse
138
+ * create only commits on mouseup and only once it clears the same
139
+ * click-vs-drag threshold `move` uses, while a keyboard create is live the
140
+ * instant Enter starts it (there is no "release" to wait for) and commits
141
+ * on a second Enter.
142
+ */
143
+ protected readonly create: import("@angular/core").WritableSignal<{
144
+ room: OccupancyRoom;
145
+ startDate: string;
146
+ startClientX: number;
147
+ previewStart: string;
148
+ previewEnd: string;
149
+ dragging: boolean;
150
+ viaKeyboard: boolean;
151
+ } | null>;
152
+ private createMoveListener;
153
+ private createUpListener;
154
+ private createKeyListener;
155
+ /**
156
+ * The keyboard-focused empty cell, if any — a room and a date, tracked so
157
+ * Tab can reach an empty lane and arrow keys have somewhere to move from.
158
+ * Cleared on blur unless a keyboard create (see `create`) is in progress,
159
+ * so the highlighted cell does not vanish out from under an active
160
+ * gesture.
161
+ */
162
+ protected readonly laneFocus: import("@angular/core").WritableSignal<{
163
+ roomId: string;
164
+ date: string;
165
+ } | null>;
166
+ /**
167
+ * The empty cell the mouse is currently over, if any — the pointer
168
+ * equivalent of `laneFocus`, so a mouse user gets the same "here's what
169
+ * you're about to create on" cue a keyboard user gets from Tab. Cleared
170
+ * whenever any gesture (create, resize, or a whole-bar move) is live, so
171
+ * it never competes with that gesture's own preview.
172
+ */
173
+ protected readonly laneHover: import("@angular/core").WritableSignal<{
174
+ roomId: string;
175
+ date: string;
176
+ } | null>;
126
177
  private suppressNextClick;
127
178
  private suppressNextClickTimer;
128
179
  constructor(translate: TranslateService, destroyRef: DestroyRef);
@@ -156,6 +207,26 @@ export declare class OccupancyGridComponent {
156
207
  label: string;
157
208
  state: import("ud-components").OccupancyBarState;
158
209
  } | null>;
210
+ /** The in-progress drag-to-create's preview span, once it clears the drag threshold (mouse) or as soon as it starts (keyboard). */
211
+ protected readonly createGhost: import("@angular/core").Signal<{
212
+ left: number;
213
+ top: number;
214
+ width: number;
215
+ height: number;
216
+ } | null>;
217
+ /**
218
+ * The empty cell to outline — the mouse hover position if the pointer is
219
+ * over one, otherwise the keyboard-focused cell — whenever no create
220
+ * gesture is overriding it with its own live preview.
221
+ */
222
+ protected readonly laneCursorGeometry: import("@angular/core").Signal<{
223
+ left: number;
224
+ top: number;
225
+ width: number;
226
+ height: number;
227
+ } | null>;
228
+ /** Canvas-coordinate box for a date span in a given room's row — shared by `createGhost` and `laneCursorGeometry`. */
229
+ private ghostGeometry;
159
230
  private monthLabels;
160
231
  protected geometryOf(bar: OccupancyBar): BarGeometry | null;
161
232
  /** The in-progress drag's proposed dates for this bar, or null if it is not the one being dragged. */
@@ -216,6 +287,46 @@ export declare class OccupancyGridComponent {
216
287
  /** Mouseup (commit) or Escape (cancel). Emits `barMove` only on commit with an actual change. */
217
288
  private endBarMove;
218
289
  private removeMoveListeners;
290
+ /**
291
+ * Mousedown on a lane's empty background arms a possible drag-to-create,
292
+ * on the same click-vs-drag threshold as `startBarMove` — a plain click
293
+ * still falls through to `onLaneClick`'s `cellClick` unchanged, since
294
+ * `endCreate` only emits once `dragging` has flipped true.
295
+ */
296
+ protected startCreate(event: MouseEvent, room: OccupancyRoom): void;
297
+ private onCreateDragMove;
298
+ /** 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. */
299
+ private endCreate;
300
+ private removeCreateListeners;
301
+ /**
302
+ * Focus lands on an empty lane (Tab, or a mouse click on it) — arm a
303
+ * keyboard cursor at today (or the window's first day, if today is out of
304
+ * view) unless this room already has one. Left alone while a keyboard
305
+ * create is in progress on this lane, so refocusing mid-gesture cannot
306
+ * reset it.
307
+ */
308
+ protected onLaneFocus(room: OccupancyRoom): void;
309
+ /**
310
+ * The pointer moved over a lane's empty background — update the hover
311
+ * cursor to the date under it. Ignored while a create, resize, or
312
+ * whole-bar move is live (that gesture already draws its own preview),
313
+ * and when the event bubbled up from a bar or closure rather than
314
+ * landing on the background itself, so hovering an existing booking does
315
+ * not also outline the empty-cell cursor underneath it.
316
+ */
317
+ protected onLaneMouseMove(event: MouseEvent, room: OccupancyRoom): void;
318
+ protected onLaneMouseLeave(room: OccupancyRoom): void;
319
+ protected onLaneBlur(): void;
320
+ private defaultCursorDate;
321
+ /**
322
+ * Keyboard path for drag-to-create: with no create in progress, plain
323
+ * ArrowLeft/ArrowRight move the focused cell one day and Enter/Space marks
324
+ * it as the start of a new booking; once that create is live, the same
325
+ * arrow keys extend or shorten the departure date (mirroring
326
+ * `onBarKeydownResize`'s departure-only convention) and a second Enter
327
+ * commits, Escape cancels.
328
+ */
329
+ protected onLaneKeydown(event: KeyboardEvent, room: OccupancyRoom): void;
219
330
  /** Whatever room row (if any) is actually rendered under this point — see `.occ__row--room`'s `data-room-id`. */
220
331
  private roomUnderPoint;
221
332
  private armSuppressNextClick;
@@ -232,5 +343,5 @@ export declare class OccupancyGridComponent {
232
343
  */
233
344
  protected onBarKeydownResize(event: KeyboardEvent, room: OccupancyRoom, bar: OccupancyBar, laneBars: LaneBar[]): void;
234
345
  static ɵfac: i0.ɵɵFactoryDeclaration<OccupancyGridComponent, never>;
235
- static ɵcmp: i0.ɵɵComponentDeclaration<OccupancyGridComponent, "ud-occupancy-grid", never, { "rooms": { "alias": "rooms"; "required": false; "isSignal": true; }; "dormName": { "alias": "dormName"; "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; }; }, { "barClick": "barClick"; "closureClick": "closureClick"; "roomClick": "roomClick"; "cellClick": "cellClick"; "reachedEnd": "reachedEnd"; "windowShift": "windowShift"; "barResize": "barResize"; "barMove": "barMove"; }, never, never, true, never>;
346
+ static ɵcmp: i0.ɵɵComponentDeclaration<OccupancyGridComponent, "ud-occupancy-grid", never, { "rooms": { "alias": "rooms"; "required": false; "isSignal": true; }; "dormName": { "alias": "dormName"; "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; }; }, { "barClick": "barClick"; "closureClick": "closureClick"; "roomClick": "roomClick"; "cellClick": "cellClick"; "reachedEnd": "reachedEnd"; "windowShift": "windowShift"; "barResize": "barResize"; "barMove": "barMove"; "barCreate": "barCreate"; }, never, never, true, never>;
236
347
  }
@@ -103,3 +103,15 @@ export interface OccupancyBarMove {
103
103
  proposedStartDate: string;
104
104
  proposedEndDate: string;
105
105
  }
106
+ /**
107
+ * A new booking's dates were proposed by dragging across empty lane cells in
108
+ * a room, or by the keyboard equivalent (Enter marks the start on a focused
109
+ * cell, Left/Right extend the departure date, Enter again commits). Same
110
+ * contract as `OccupancyBarResize`/`OccupancyBarMove`: the component only
111
+ * reports the proposal — it never creates a bar itself.
112
+ */
113
+ export interface OccupancyBarCreate {
114
+ room: OccupancyRoom;
115
+ proposedStartDate: string;
116
+ proposedEndDate: string;
117
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ud-components",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": ">=19",
6
6
  "@angular/common": ">=19",