@brickclay-org/ui 0.1.24 → 0.1.25

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/index.d.ts CHANGED
@@ -26,10 +26,28 @@ declare class BrickclayLib {
26
26
  static ɵcmp: i0.ɵɵComponentDeclaration<BrickclayLib, "lib-brickclay-lib", never, {}, {}, never, never, true, never>;
27
27
  }
28
28
 
29
+ interface CalendarRange {
30
+ start: Date;
31
+ end: Date;
32
+ }
33
+ interface CustomRangesConfig {
34
+ customRanges?: Record<string, CalendarRange>;
35
+ rangeOrder: string[];
36
+ }
29
37
  declare class BkCalendarManagerService {
30
38
  private calendarInstances;
31
39
  private closeAllSubject;
32
40
  closeAll$: rxjs.Observable<void>;
41
+ customRanges: Record<string, CalendarRange>;
42
+ rangeOrder: string[];
43
+ constructor();
44
+ /**
45
+ * Returns service-defined custom ranges and their display order.
46
+ * Used when the calendar does not pass customRanges via @Input().
47
+ */
48
+ getCustomRanges(): CustomRangesConfig;
49
+ initializeDefaultRanges(): void;
50
+ addDays(date: Date, days: number): Date;
33
51
  /**
34
52
  * Register a calendar instance with its close function
35
53
  */
@@ -47,10 +65,6 @@ declare class BkCalendarManagerService {
47
65
  static ɵprov: i0.ɵɵInjectableDeclaration<BkCalendarManagerService>;
48
66
  }
49
67
 
50
- interface CalendarRange {
51
- start: Date;
52
- end: Date;
53
- }
54
68
  declare class CalendarSelection {
55
69
  startDate: string | null;
56
70
  endDate: string | null;
@@ -73,6 +87,8 @@ declare class BkCustomCalendar implements OnInit, OnDestroy, OnChanges, ControlV
73
87
  customRangeDirection: boolean;
74
88
  lockStartDate: boolean;
75
89
  position: 'center' | 'left' | 'right';
90
+ /** Vertical placement relative to the input. Takes precedence over {@link drop} for default bottom placement. */
91
+ popupPosition: 'top' | 'bottom';
76
92
  drop: 'up' | 'down';
77
93
  dualCalendar: boolean;
78
94
  showRanges: boolean;
@@ -80,6 +96,8 @@ declare class BkCustomCalendar implements OnInit, OnDestroy, OnChanges, ControlV
80
96
  clearableTime: boolean;
81
97
  enableSeconds: boolean;
82
98
  customRanges?: Record<string, CalendarRange>;
99
+ /** Column headers for weekdays; index 0 is the first column. Default Monday–Sunday. */
100
+ weekDayLabels: string[];
83
101
  multiDateSelection: boolean;
84
102
  maxDate?: Date;
85
103
  minDate?: Date;
@@ -92,12 +110,15 @@ declare class BkCustomCalendar implements OnInit, OnDestroy, OnChanges, ControlV
92
110
  errorMessage: string;
93
111
  selected: EventEmitter<CalendarSelection>;
94
112
  inputWrapper: ElementRef<HTMLDivElement>;
113
+ calendarPopupRef?: ElementRef<HTMLDivElement>;
95
114
  /** Used when appendToBody is true to position the popup in viewport coordinates */
96
115
  dropdownStyle: {
97
116
  top?: string;
98
117
  bottom?: string;
99
118
  left?: string;
100
119
  };
120
+ /** Resolved after layout; used for CSS `drop-up` and appendToBody positioning with viewport flip */
121
+ popupPlacementAbove: boolean;
101
122
  opened: EventEmitter<void>;
102
123
  closed: EventEmitter<void>;
103
124
  showCancelApply: boolean;
@@ -175,13 +196,23 @@ declare class BkCustomCalendar implements OnInit, OnDestroy, OnChanges, ControlV
175
196
  closePickerCounter: {
176
197
  [key: string]: number;
177
198
  };
178
- defaultRanges: Record<string, CalendarRange>;
179
199
  activeRange: string | null;
180
200
  rangeOrder: string[];
201
+ /** Keyboard roving focus for date grid (local date, midnight) */
202
+ keyboardFocusDate: Date | null;
181
203
  private unregisterFn?;
182
204
  private closeAllSubscription?;
183
205
  private closeFn?;
184
206
  constructor(calendarManager: BkCalendarManagerService);
207
+ /** Weekday headers; falls back to Mon–Sun if the input is not length 7. */
208
+ get resolvedWeekDayLabels(): string[];
209
+ /** When dual range mode, Apply is blocked until both endpoints exist. */
210
+ get isDualRangeApplyBlocked(): boolean;
211
+ /** User preference before viewport adjustment (legacy `drop` still applies when `popupPosition` is `bottom`). */
212
+ private preferPopupAbove;
213
+ private resolveCustomRangesFromInputsOrService;
214
+ private labelToJsWeekday;
215
+ private getWeekStartDayIndex;
185
216
  writeValue(value: CalendarSelection | null): void;
186
217
  registerOnChange(fn: (value: CalendarSelection | null) => void): void;
187
218
  registerOnTouched(fn: () => void): void;
@@ -198,13 +229,37 @@ declare class BkCustomCalendar implements OnInit, OnDestroy, OnChanges, ControlV
198
229
  onWindowEvents(): void;
199
230
  ngOnInit(): void;
200
231
  ngOnChanges(changes: SimpleChanges): void;
232
+ private regenerateCalendarsForWeekStart;
201
233
  ngOnDestroy(): void;
202
234
  checkAndSetActiveRange(): void;
203
- initializeDefaultRanges(): void;
204
235
  initializeTimeFromDate(date: Date, isStart: boolean): void;
205
236
  toggle(): void;
206
237
  /** Update popup position when appendToBody is true (fixed positioning relative to viewport). */
207
238
  updatePosition(): void;
239
+ /** Non–append-to-body: set `popupPlacementAbove` for CSS `drop-up` with viewport flip. */
240
+ refreshPopupPlacement(): void;
241
+ private computePlacementAbove;
242
+ /** Normalize to local midnight and clamp to min/max selectable day. */
243
+ private clampCalendarDayToSelectableRange;
244
+ private initKeyboardFocus;
245
+ /**
246
+ * After clearing values, drop stale keyboard highlight (was last start/end) and reset the
247
+ * visible month(s) to today (clamped). Move DOM focus to the popup when open, else the input.
248
+ */
249
+ private resetCalendarFocusAfterClear;
250
+ private scheduleDomFocusAfterClear;
251
+ private ensureKeyboardFocusVisible;
252
+ private moveKeyboardFocus;
253
+ /**
254
+ * When focus is inside a real control (button, link, field), do not intercept keys here.
255
+ * Otherwise this handler's preventDefault (Enter/Space) blocks native button activation and
256
+ * bubbled Enter still runs applyKeyboardSelection — breaking keyboard parity with click.
257
+ */
258
+ private isKeyboardEventFromInteractiveDescendant;
259
+ onCalendarPopupKeydown(event: KeyboardEvent): void;
260
+ private applyKeyboardSelection;
261
+ isKeyboardFocusedCell(year: number, month: number, day: number): boolean;
262
+ onRangeButtonKeydown(event: KeyboardEvent, rangeKey: string): void;
208
263
  close(): void;
209
264
  onDateHover(day: number | null, fromRight?: boolean): void;
210
265
  onDateLeave(): void;
@@ -275,7 +330,7 @@ declare class BkCustomCalendar implements OnInit, OnDestroy, OnChanges, ControlV
275
330
  private parseDateString;
276
331
  formatDateToString(date: Date): string;
277
332
  static ɵfac: i0.ɵɵFactoryDeclaration<BkCustomCalendar, never>;
278
- static ɵcmp: i0.ɵɵComponentDeclaration<BkCustomCalendar, "bk-custom-calendar", never, { "enableTimepicker": { "alias": "enableTimepicker"; "required": false; }; "autoApply": { "alias": "autoApply"; "required": false; }; "closeOnAutoApply": { "alias": "closeOnAutoApply"; "required": false; }; "showCancel": { "alias": "showCancel"; "required": false; }; "linkedCalendars": { "alias": "linkedCalendars"; "required": false; }; "singleDatePicker": { "alias": "singleDatePicker"; "required": false; }; "showWeekNumbers": { "alias": "showWeekNumbers"; "required": false; }; "showISOWeekNumbers": { "alias": "showISOWeekNumbers"; "required": false; }; "customRangeDirection": { "alias": "customRangeDirection"; "required": false; }; "lockStartDate": { "alias": "lockStartDate"; "required": false; }; "position": { "alias": "position"; "required": false; }; "drop": { "alias": "drop"; "required": false; }; "dualCalendar": { "alias": "dualCalendar"; "required": false; }; "showRanges": { "alias": "showRanges"; "required": false; }; "timeFormat": { "alias": "timeFormat"; "required": false; }; "clearableTime": { "alias": "clearableTime"; "required": false; }; "enableSeconds": { "alias": "enableSeconds"; "required": false; }; "customRanges": { "alias": "customRanges"; "required": false; }; "multiDateSelection": { "alias": "multiDateSelection"; "required": false; }; "maxDate": { "alias": "maxDate"; "required": false; }; "minDate": { "alias": "minDate"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "opens": { "alias": "opens"; "required": false; }; "inline": { "alias": "inline"; "required": false; }; "appendToBody": { "alias": "appendToBody"; "required": false; }; "isDisplayCrossIcon": { "alias": "isDisplayCrossIcon"; "required": false; }; "hasError": { "alias": "hasError"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "showCancelApply": { "alias": "showCancelApply"; "required": false; }; "selectedValue": { "alias": "selectedValue"; "required": false; }; "displayFormat": { "alias": "displayFormat"; "required": false; }; "required": { "alias": "required"; "required": false; }; }, { "selected": "selected"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
333
+ static ɵcmp: i0.ɵɵComponentDeclaration<BkCustomCalendar, "bk-custom-calendar", never, { "enableTimepicker": { "alias": "enableTimepicker"; "required": false; }; "autoApply": { "alias": "autoApply"; "required": false; }; "closeOnAutoApply": { "alias": "closeOnAutoApply"; "required": false; }; "showCancel": { "alias": "showCancel"; "required": false; }; "linkedCalendars": { "alias": "linkedCalendars"; "required": false; }; "singleDatePicker": { "alias": "singleDatePicker"; "required": false; }; "showWeekNumbers": { "alias": "showWeekNumbers"; "required": false; }; "showISOWeekNumbers": { "alias": "showISOWeekNumbers"; "required": false; }; "customRangeDirection": { "alias": "customRangeDirection"; "required": false; }; "lockStartDate": { "alias": "lockStartDate"; "required": false; }; "position": { "alias": "position"; "required": false; }; "popupPosition": { "alias": "popupPosition"; "required": false; }; "drop": { "alias": "drop"; "required": false; }; "dualCalendar": { "alias": "dualCalendar"; "required": false; }; "showRanges": { "alias": "showRanges"; "required": false; }; "timeFormat": { "alias": "timeFormat"; "required": false; }; "clearableTime": { "alias": "clearableTime"; "required": false; }; "enableSeconds": { "alias": "enableSeconds"; "required": false; }; "customRanges": { "alias": "customRanges"; "required": false; }; "weekDayLabels": { "alias": "weekDayLabels"; "required": false; }; "multiDateSelection": { "alias": "multiDateSelection"; "required": false; }; "maxDate": { "alias": "maxDate"; "required": false; }; "minDate": { "alias": "minDate"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "opens": { "alias": "opens"; "required": false; }; "inline": { "alias": "inline"; "required": false; }; "appendToBody": { "alias": "appendToBody"; "required": false; }; "isDisplayCrossIcon": { "alias": "isDisplayCrossIcon"; "required": false; }; "hasError": { "alias": "hasError"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "showCancelApply": { "alias": "showCancelApply"; "required": false; }; "selectedValue": { "alias": "selectedValue"; "required": false; }; "displayFormat": { "alias": "displayFormat"; "required": false; }; "required": { "alias": "required"; "required": false; }; "rangeOrder": { "alias": "rangeOrder"; "required": false; }; }, { "selected": "selected"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
279
334
  }
280
335
 
281
336
  interface TimeConfiguration {
@@ -2167,4 +2222,4 @@ declare class BkLoader {
2167
2222
  }
2168
2223
 
2169
2224
  export { BKTooltipDirective, BK_DEFAULT_DIALOG_CONFIG, BK_DIALOG_DATA, BK_DIALOG_GLOBAL_CONFIG, BkAvatar, BkAvatarUploader, BkBadge, BkButton, BkButtonGroup, BkCalendarManagerService, BkCheckbox, BkColumnFilterService, BkColumnSelect, BkCustomCalendar, BkDialogActions, BkDialogClose, BkDialogContent, BkDialogModule, BkDialogRef, BkDialogService, BkDialogTitle, BkFileCard, BkFilePicker, BkGrid, BkHierarchicalSelect, BkIconButton, BkInput, BkInputChips, BkLoader, BkPagination, BkPill, BkRadioButton, BkScheduledDatePicker, BkSelect, BkSpinner, BkTabs, BkTextarea, BkTimePicker, BkToastr, BkToastrService, BkToggle, BkValidator, BrickclayIcons, BrickclayLib, CalendarModule, CalendarSelection, ColumnFilterOption, getDialogBackdropAnimation, getDialogPanelAnimation };
2170
- export type { AvatarFallback, AvatarSize, AvatarVariant, BadgeColor, BadgeSize, BadgeVariant, BkAnimationKeyframes, BkAvatarFallback, BkAvatarSize, BkDialogAnimation, BkDialogConfig, BkDialogPosition, BkInputAutoCapitalize, BkInputAutoComplete, BkInputMode, BkInputType, BkLoaderVariant, BkPageSize, BkTextAreaAutoCapitalize, BkTextAreaAutoComplete, BkTextAreaInputMode, ButtonSize, ButtonVariant, CalendarRange, CountryOption, DotPosition, DotStatus, FileState, GroupItem, GroupMode, HierarchicalNode, IconButtonSize, IconButtonVariant, IconOrientation, PillColor, PillSize, PillVariant, ScheduledDateSelection, SortDirection, SpinnerSize, TabIconDirection, TabItem, TableAction, TableBadge, TableColumn, TableIcon, TimeConfiguration, ToastConfig, ToastMessage, ToastMethodOptions, ToastPosition, ToastSeverity };
2225
+ export type { AvatarFallback, AvatarSize, AvatarVariant, BadgeColor, BadgeSize, BadgeVariant, BkAnimationKeyframes, BkAvatarFallback, BkAvatarSize, BkDialogAnimation, BkDialogConfig, BkDialogPosition, BkInputAutoCapitalize, BkInputAutoComplete, BkInputMode, BkInputType, BkLoaderVariant, BkPageSize, BkTextAreaAutoCapitalize, BkTextAreaAutoComplete, BkTextAreaInputMode, ButtonSize, ButtonVariant, CalendarRange, CountryOption, CustomRangesConfig, DotPosition, DotStatus, FileState, GroupItem, GroupMode, HierarchicalNode, IconButtonSize, IconButtonVariant, IconOrientation, PillColor, PillSize, PillVariant, ScheduledDateSelection, SortDirection, SpinnerSize, TabIconDirection, TabItem, TableAction, TableBadge, TableColumn, TableIcon, TimeConfiguration, ToastConfig, ToastMessage, ToastMethodOptions, ToastPosition, ToastSeverity };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brickclay-org/ui",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "ng-add": {
6
6
  "save": "dependencies"