ud-components 0.5.22 → 0.5.24

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,5 +1,5 @@
1
1
  import { OnDestroy, TemplateRef } from '@angular/core';
2
- import { CalendarMode, CalendarSlot, CalendarUser, CalendarView } from './calendar.interface';
2
+ import { CalendarMode, CalendarSlot, CalendarUser, CalendarView, RescheduleContext } from './calendar.interface';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class CalendarComponent implements OnDestroy {
5
5
  slots: import("@angular/core").InputSignal<CalendarSlot[]>;
@@ -35,6 +35,19 @@ export declare class CalendarComponent implements OnDestroy {
35
35
  * or deep links that should land on a specific day.
36
36
  */
37
37
  defaultDate: import("@angular/core").InputSignal<Date | null>;
38
+ /**
39
+ * When set, the "Add slot" modal flips into reschedule mode:
40
+ * • title becomes "Move appointment"
41
+ * • a lede shows the original time being moved away from
42
+ * • the user picker auto-selects the lone bookable user (or `userId` if
43
+ * provided) so the admin doesn't have to choose from a list of one
44
+ * • Booked defaults to true (a reschedule keeps a booking, not a fresh slot)
45
+ * • the confirm button reads "Reschedule" instead of "Save"
46
+ *
47
+ * The wire-level event is still `slotAdded` — consumers route it to their
48
+ * reschedule API based on their own context (no extra output needed).
49
+ */
50
+ rescheduleContext: import("@angular/core").InputSignal<RescheduleContext | null>;
38
51
  slotAdded: import("@angular/core").OutputEmitterRef<CalendarSlot>;
39
52
  slotUpdated: import("@angular/core").OutputEmitterRef<CalendarSlot>;
40
53
  slotRemoved: import("@angular/core").OutputEmitterRef<string>;
@@ -108,6 +121,12 @@ export declare class CalendarComponent implements OnDestroy {
108
121
  slotTextColor(slot: CalendarSlot): string;
109
122
  slotBorderColor(slot: CalendarSlot): string;
110
123
  formatSlotTime(slot: CalendarSlot): string;
124
+ /**
125
+ * Pretty range like "Mon Jun 8 · 2:00 – 2:30 PM". Used by reschedule-mode's
126
+ * "Moving from …" lede so the admin sees where the appointment is coming
127
+ * from while picking the new time.
128
+ */
129
+ private formatMomentRange;
111
130
  isToday(day: Date): boolean;
112
131
  isCurrentMonth(day: Date): boolean;
113
132
  dayLabel(day: Date): string;
@@ -148,5 +167,5 @@ export declare class CalendarComponent implements OnDestroy {
148
167
  private formatTime;
149
168
  private hexToRgba;
150
169
  static ɵfac: i0.ɵɵFactoryDeclaration<CalendarComponent, never>;
151
- static ɵcmp: i0.ɵɵComponentDeclaration<CalendarComponent, "ud-calendar", never, { "slots": { "alias": "slots"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "defaultView": { "alias": "defaultView"; "required": false; "isSignal": true; }; "slotDuration": { "alias": "slotDuration"; "required": false; "isSignal": true; }; "minHour": { "alias": "minHour"; "required": false; "isSignal": true; }; "maxHour": { "alias": "maxHour"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "bookableUsers": { "alias": "bookableUsers"; "required": false; "isSignal": true; }; "minSlotStart": { "alias": "minSlotStart"; "required": false; "isSignal": true; }; "defaultDate": { "alias": "defaultDate"; "required": false; "isSignal": true; }; }, { "slotAdded": "slotAdded"; "slotUpdated": "slotUpdated"; "slotRemoved": "slotRemoved"; "slotBooked": "slotBooked"; "slotBlocked": "slotBlocked"; }, never, never, true, never>;
170
+ static ɵcmp: i0.ɵɵComponentDeclaration<CalendarComponent, "ud-calendar", never, { "slots": { "alias": "slots"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "defaultView": { "alias": "defaultView"; "required": false; "isSignal": true; }; "slotDuration": { "alias": "slotDuration"; "required": false; "isSignal": true; }; "minHour": { "alias": "minHour"; "required": false; "isSignal": true; }; "maxHour": { "alias": "maxHour"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "bookableUsers": { "alias": "bookableUsers"; "required": false; "isSignal": true; }; "minSlotStart": { "alias": "minSlotStart"; "required": false; "isSignal": true; }; "defaultDate": { "alias": "defaultDate"; "required": false; "isSignal": true; }; "rescheduleContext": { "alias": "rescheduleContext"; "required": false; "isSignal": true; }; }, { "slotAdded": "slotAdded"; "slotUpdated": "slotUpdated"; "slotRemoved": "slotRemoved"; "slotBooked": "slotBooked"; "slotBlocked": "slotBlocked"; }, never, never, true, never>;
152
171
  }
@@ -19,6 +19,34 @@ export interface CalendarUser {
19
19
  }
20
20
  export type CalendarView = 'week' | 'month' | 'day';
21
21
  export type CalendarMode = 'admin' | 'student' | 'readonly';
22
+ /**
23
+ * Context the host supplies when the calendar should be used to *move* an
24
+ * existing booking instead of creating a new one. When set on
25
+ * `<ud-calendar [rescheduleContext]>`, the add-slot modal flips into
26
+ * "move appointment" mode (title, lede, save label, defaults).
27
+ *
28
+ * The component does not call any reschedule API itself — it still emits
29
+ * `slotAdded` with the picked slot and the host decides whether to POST a
30
+ * new booking or PUT a reschedule.
31
+ */
32
+ export interface RescheduleContext {
33
+ /** The current appointment's start, used in the modal's "Moving from …" lede. */
34
+ originalStart: Date;
35
+ /** The current appointment's end — paired with `originalStart` for the label. */
36
+ originalEnd: Date;
37
+ /**
38
+ * Optional id of the user the appointment belongs to. When provided, the
39
+ * add-slot modal pre-selects this user in the `bookableUsers` picker so the
40
+ * admin doesn't have to choose from a list of one.
41
+ */
42
+ userId?: string;
43
+ /**
44
+ * Optional pre-filled value for the modal's Title field. Hosts typically
45
+ * pass something like `"appointment with Alice Chen"` so the admin doesn't
46
+ * retype it when moving an existing booking.
47
+ */
48
+ defaultTitle?: string;
49
+ }
22
50
  /**
23
51
  * Curated slot colours. Assign one to `CalendarSlot.color` for a consistent,
24
52
  * on-brand palette instead of hand-picking hex values — the calendar tints these
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ud-components",
3
- "version": "0.5.22",
3
+ "version": "0.5.24",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": ">=19",
6
6
  "@angular/common": ">=19",