@dereekb/dbx-form 13.4.0 → 13.4.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-form",
3
- "version": "13.4.0",
3
+ "version": "13.4.2",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "^21.0.0",
6
6
  "@angular/common": "^21.0.0",
@@ -10,12 +10,12 @@
10
10
  "@angular/material-date-fns-adapter": "^21.0.0",
11
11
  "@angular/platform-browser": "^21.0.0",
12
12
  "@bobbyquantum/ngx-editor": "21.0.0-beta.1",
13
- "@dereekb/date": "13.4.0",
14
- "@dereekb/dbx-core": "13.4.0",
15
- "@dereekb/dbx-web": "13.4.0",
16
- "@dereekb/model": "13.4.0",
17
- "@dereekb/rxjs": "13.4.0",
18
- "@dereekb/util": "13.4.0",
13
+ "@dereekb/date": "13.4.2",
14
+ "@dereekb/dbx-core": "13.4.2",
15
+ "@dereekb/dbx-web": "13.4.2",
16
+ "@dereekb/model": "13.4.2",
17
+ "@dereekb/rxjs": "13.4.2",
18
+ "@dereekb/util": "13.4.2",
19
19
  "@ng-web-apis/geolocation": "^5.1.0",
20
20
  "@ngbracket/ngx-layout": "^21.0.0",
21
21
  "@ngrx/component-store": "^21.0.0",
@@ -184,10 +184,40 @@ interface CalendarScheduleSelectionState extends PartialCalendarScheduleSelectio
184
184
  */
185
185
  readonly initialSelectionState?: Maybe<AllOrNoneSelection>;
186
186
  }
187
+ /**
188
+ * Creates the default initial state for the calendar schedule selection store,
189
+ * using the current system timezone and all days of the week enabled.
190
+ *
191
+ * @returns A fresh CalendarScheduleSelectionState with default values
192
+ */
187
193
  declare function initialCalendarScheduleSelectionState(): CalendarScheduleSelectionState;
194
+ /**
195
+ * Computes the effective min and max date range by combining the filter and the explicit minMaxDateRange constraints.
196
+ *
197
+ * @param x - State containing filter and minMaxDateRange to compute from
198
+ * @returns A partial date range with the effective start and end boundaries
199
+ */
188
200
  declare function calendarScheduleMinAndMaxDateRange(x: Pick<CalendarScheduleSelectionState, 'filter' | 'minMaxDateRange'>): Partial<DateRange>;
201
+ /**
202
+ * Returns the effective minimum date by taking the latest start date between the filter and minMaxDateRange.
203
+ *
204
+ * @param x - State containing filter and minMaxDateRange
205
+ * @returns The latest start date, or undefined if none
206
+ */
189
207
  declare function calendarScheduleMinDate(x: Pick<CalendarScheduleSelectionState, 'filter' | 'minMaxDateRange'>): Maybe<Date>;
208
+ /**
209
+ * Returns the effective maximum date by taking the earliest end date between the filter and minMaxDateRange.
210
+ *
211
+ * @param x - State containing filter and minMaxDateRange
212
+ * @returns The earliest end date, or undefined if none
213
+ */
190
214
  declare function calendarScheduleMaxDate(x: Pick<CalendarScheduleSelectionState, 'filter' | 'minMaxDateRange'>): Maybe<Date>;
215
+ /**
216
+ * Returns whether the filter's start date is being used as the effective start for the selection result computation.
217
+ *
218
+ * @param x - State containing filter and computeSelectionResultRelativeToFilter
219
+ * @returns True if the filter start is being used for the selection result
220
+ */
191
221
  declare function calendarScheduleStartBeingUsedFromFilter(x: Pick<CalendarScheduleSelectionState, 'filter' | 'computeSelectionResultRelativeToFilter'>): boolean | _dereekb_util.MaybeNot;
192
222
  declare class DbxCalendarScheduleSelectionStore extends ComponentStore<CalendarScheduleSelectionState> {
193
223
  constructor();
@@ -282,16 +312,103 @@ declare class DbxCalendarScheduleSelectionStore extends ComponentStore<CalendarS
282
312
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DbxCalendarScheduleSelectionStore, never>;
283
313
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DbxCalendarScheduleSelectionStore>;
284
314
  }
315
+ /**
316
+ * Updates the state with an initial selection (all or none) and applies it when no dates are currently toggled.
317
+ *
318
+ * @param state - The current selection state
319
+ * @param initialSelectionState - The initial selection mode ('all' or 'none')
320
+ * @returns The updated selection state
321
+ */
285
322
  declare function updateStateWithInitialSelectionState(state: CalendarScheduleSelectionState, initialSelectionState: Maybe<AllOrNoneSelection>): CalendarScheduleSelectionState;
323
+ /**
324
+ * Updates the computeSelectionResultRelativeToFilter flag and recalculates the state if the value changed.
325
+ *
326
+ * @param currentState - The current selection state
327
+ * @param computeSelectionResultRelativeToFilter - Whether to compute results relative to the filter
328
+ * @returns The updated selection state
329
+ */
286
330
  declare function updateStateWithComputeSelectionResultRelativeToFilter(currentState: CalendarScheduleSelectionState, computeSelectionResultRelativeToFilter: Maybe<boolean>): CalendarScheduleSelectionState;
331
+ /**
332
+ * Updates the state with date exclusions, converting input dates/ranges to cell indexes and reapplying the filter.
333
+ *
334
+ * @param state - The current selection state
335
+ * @param inputExclusions - Dates, date ranges, or cell indexes to exclude
336
+ * @returns The updated selection state with exclusions applied
337
+ */
287
338
  declare function updateStateWithExclusions(state: CalendarScheduleSelectionState, inputExclusions: Maybe<ArrayOrValue<DateOrDateRangeOrDateCellIndexOrDateCellRange>>): CalendarScheduleSelectionState;
339
+ /**
340
+ * Sets the min/max date range constraint on the state, normalizing start to startOfDay and end to endOfDay.
341
+ *
342
+ * @param state - The current selection state
343
+ * @param minMaxDateRange - The min/max boundary dates to enforce
344
+ * @returns The updated selection state with the boundary applied
345
+ */
288
346
  declare function updateStateWithMinMaxDateRange(state: CalendarScheduleSelectionState, minMaxDateRange: Maybe<Partial<DateRange>>): CalendarScheduleSelectionState;
347
+ /**
348
+ * Applies a date cell schedule filter to the selection state, computing the enabled day function
349
+ * from the filter, exclusions, and min/max date range constraints.
350
+ *
351
+ * @param currentState - The current selection state
352
+ * @param inputFilter - The filter configuration to apply
353
+ * @returns The updated selection state with the filter applied
354
+ */
355
+ /**
356
+ * Applies a date cell schedule filter to the selection state, computing the enabled day function
357
+ * from the filter, exclusions, and min/max date range constraints.
358
+ *
359
+ * @param currentState - The current selection state
360
+ * @param inputFilter - The filter configuration to apply
361
+ * @returns The updated selection state with the filter applied
362
+ */
289
363
  declare function updateStateWithFilter(currentState: CalendarScheduleSelectionState, inputFilter: Maybe<DateCellScheduleDateFilterConfig>): CalendarScheduleSelectionState;
364
+ /**
365
+ * Updates the output timezone and transforms the current selection value to reflect the new timezone.
366
+ *
367
+ * @param state - The current selection state
368
+ * @param timezone - The target timezone string
369
+ * @returns The updated selection state with timezone-adjusted values
370
+ */
290
371
  declare function updateStateWithTimezoneValue(state: CalendarScheduleSelectionState, timezone: Maybe<TimezoneString>): CalendarScheduleSelectionState;
372
+ /**
373
+ * Updates the state from an external date cell schedule range value, converting timezone-aware inputs
374
+ * to system time and synchronizing the internal selection indexes.
375
+ *
376
+ * @param state - The current selection state
377
+ * @param inputChange - The date cell schedule range to apply
378
+ * @returns The updated selection state
379
+ */
291
380
  declare function updateStateWithDateCellScheduleRangeValue(state: CalendarScheduleSelectionState, inputChange: Maybe<FullDateCellScheduleRangeInputDateRange>): CalendarScheduleSelectionState;
381
+ /**
382
+ * Updates the default schedule day codes (used when no explicit schedule days are set) and recalculates allowed days.
383
+ *
384
+ * @param state - The current selection state
385
+ * @param change - The new default schedule day codes
386
+ * @returns The updated selection state
387
+ */
292
388
  declare function updateStateWithChangedDefaultScheduleDays(state: CalendarScheduleSelectionState, change: Maybe<Iterable<DateCellScheduleDayCode>>): CalendarScheduleSelectionState;
389
+ /**
390
+ * Updates the explicit schedule day codes override and recalculates allowed days of the week.
391
+ *
392
+ * @param state - The current selection state
393
+ * @param change - The new schedule day codes, or null/undefined to clear the override
394
+ * @returns The updated selection state
395
+ */
293
396
  declare function updateStateWithChangedScheduleDays(state: CalendarScheduleSelectionState, change: Maybe<Iterable<DateCellScheduleDayCode>>): CalendarScheduleSelectionState;
397
+ /**
398
+ * Switches between single and multiple selection mode, trimming the selection to a single value when switching to single mode.
399
+ *
400
+ * @param state - The current selection state
401
+ * @param selectionMode - The new selection mode
402
+ * @returns The updated selection state
403
+ */
294
404
  declare function updateStateWithSelectionMode(state: CalendarScheduleSelectionState, selectionMode: DbxCalendarScheduleSelectionStoreSelectionMode): CalendarScheduleSelectionState;
405
+ /**
406
+ * Finalizes a schedule days change by recalculating allowed days of the week and updating toggled indexes accordingly.
407
+ *
408
+ * @param previousState - The state before the schedule days change
409
+ * @param nextState - The state with updated schedule day codes
410
+ * @returns The finalized selection state with recalculated allowed days and toggled indexes
411
+ */
295
412
  declare function finalizeUpdateStateWithChangedScheduleDays(previousState: CalendarScheduleSelectionState, nextState: CalendarScheduleSelectionState): CalendarScheduleSelectionState;
296
413
  interface CalendarScheduleSelectionStateDatesChange {
297
414
  reset?: true;
@@ -307,11 +424,59 @@ interface CalendarScheduleSelectionStateDatesChange {
307
424
  */
308
425
  invertSetBehavior?: boolean;
309
426
  }
427
+ /**
428
+ * Applies date changes (toggle, add, remove, set, selectAll, or reset) to the calendar selection state,
429
+ * updating toggled indexes and input start/end accordingly.
430
+ *
431
+ * @param state - The current selection state
432
+ * @param change - The date changes to apply
433
+ * @returns The updated selection state
434
+ */
435
+ /**
436
+ * Applies date changes (toggle, add, remove, set, selectAll, or reset) to the calendar selection state,
437
+ * updating toggled indexes and input start/end accordingly.
438
+ *
439
+ * @param state - The current selection state
440
+ * @param change - The date changes to apply
441
+ * @returns The updated selection state
442
+ */
310
443
  declare function updateStateWithChangedDates(state: CalendarScheduleSelectionState, change: CalendarScheduleSelectionStateDatesChange): CalendarScheduleSelectionState;
444
+ /**
445
+ * Clears all date selections from the state, retaining other configuration like schedule days and filter.
446
+ *
447
+ * @param state - The current selection state
448
+ * @returns The state with all selections cleared
449
+ */
311
450
  declare function noSelectionCalendarScheduleSelectionState(state: CalendarScheduleSelectionState): CalendarScheduleSelectionState;
451
+ /**
452
+ * Updates the selection state with a new start/end date range, retaining toggled indexes within the new range bounds.
453
+ *
454
+ * @param state - The current selection state
455
+ * @param change - The new input start and end dates
456
+ * @returns The updated selection state
457
+ */
312
458
  declare function updateStateWithChangedRange(state: CalendarScheduleSelectionState, change: CalendarScheduleSelectionInputDateRange): CalendarScheduleSelectionState;
459
+ /**
460
+ * Finalizes a partially-built state by recomputing the isEnabledDay function and the current selection value.
461
+ *
462
+ * @param nextState - The partially-built selection state to finalize
463
+ * @returns The finalized selection state
464
+ */
313
465
  declare function finalizeNewCalendarScheduleSelectionState(nextState: Building<CalendarScheduleSelectionState>): CalendarScheduleSelectionState;
466
+ /**
467
+ * Builds a decision function that determines whether a given day index is enabled (selected) in the current state.
468
+ *
469
+ * @param state - The selection state to derive the enabled-day function from
470
+ * @returns A function that returns true if the given day is enabled/selected
471
+ */
314
472
  declare function isEnabledDayInCalendarScheduleSelectionState(state: CalendarScheduleSelectionState): DecisionFunction<DateCellTimingRelativeIndexFactoryInput>;
473
+ /**
474
+ * Computes the output DateCellScheduleDateRange value from the current selection state,
475
+ * applying timezone offsets and filter-relative computations as needed.
476
+ *
477
+ * @param state - The current selection state to compute from
478
+ * @returns The computed selection value, or null if nothing is selected
479
+ */
315
480
  declare function computeScheduleSelectionValue(state: CalendarScheduleSelectionState): Maybe<CalendarScheduleSelectionValue>;
316
481
  /**
317
482
  * The selected date range and the corresponding cell range.
@@ -326,8 +491,27 @@ interface CalendarScheduleSelectionRangeAndExclusion extends DateRange {
326
491
  */
327
492
  excluded: DateCellIndex[];
328
493
  }
494
+ /**
495
+ * Computes the selected date range with its corresponding cell range and all excluded day indexes.
496
+ * Returns null if no days are selected.
497
+ *
498
+ * @param state - The current selection state
499
+ * @returns The range and exclusion data, or null if nothing is selected
500
+ */
329
501
  declare function computeScheduleSelectionRangeAndExclusion(state: CalendarScheduleSelectionState): Maybe<CalendarScheduleSelectionRangeAndExclusion>;
502
+ /**
503
+ * Computes the selected date range (start and end dates) from the current selection state.
504
+ *
505
+ * @param state - The current selection state
506
+ * @returns The selected date range, or undefined if nothing is selected
507
+ */
330
508
  declare function computeCalendarScheduleSelectionRange(state: CalendarScheduleSelectionState): Maybe<DateRange>;
509
+ /**
510
+ * Computes the date cell index range (i, to) that spans all selected and toggled days in the current state.
511
+ *
512
+ * @param state - The current selection state
513
+ * @returns The cell range spanning all selected days, or undefined if nothing is selected
514
+ */
331
515
  declare function computeCalendarScheduleSelectionDateCellRange(state: CalendarScheduleSelectionState): Maybe<DateCellRangeWithRange>;
332
516
 
333
517
  /**
@@ -442,6 +626,12 @@ declare class DbxFormCalendarDateScheduleRangeFieldComponent<T extends DbxFormCa
442
626
 
443
627
  interface DateScheduleRangeFieldConfig extends Omit<LabeledFieldConfig, 'key' | 'placeholder'>, DescriptionFieldConfig, Partial<FieldConfig>, DbxFormCalendarDateCellScheduleRangeFieldProps {
444
628
  }
629
+ /**
630
+ * Creates a Formly field configuration for a date schedule range picker with calendar-based selection.
631
+ *
632
+ * @param config - Optional schedule range field configuration overrides
633
+ * @returns A validated Formly field configuration for date schedule range selection
634
+ */
445
635
  declare function dateScheduleRangeField(config?: DateScheduleRangeFieldConfig): FormlyFieldConfig;
446
636
 
447
637
  declare class DbxFormDateScheduleRangeFieldModule {
@@ -479,6 +669,13 @@ interface DbxScheduleSelectionCalendarComponentConfig {
479
669
  type DbxScheduleSelectionCalendarBeforeMonthViewRenderModifyDayFunction = (viewDay: CalendarMonthViewDay<CalendarScheduleSelectionMetadata>, state: CalendarScheduleSelectionState) => void;
480
670
  type DbxScheduleSelectionCalendarBeforeMonthViewRenderFunction = (renderEvent: CalendarMonthViewBeforeRenderEvent) => void;
481
671
  type DbxScheduleSelectionCalendarBeforeMonthViewRenderFunctionFactory = (state: Observable<CalendarScheduleSelectionState>) => DbxScheduleSelectionCalendarBeforeMonthViewRenderFunction;
672
+ /**
673
+ * Creates a factory that produces a beforeMonthViewRender handler for the schedule selection calendar.
674
+ * The handler applies CSS classes and metadata to each day cell based on the current selection state.
675
+ *
676
+ * @param inputModifyFn - Optional function to further customize each day cell after default processing
677
+ * @returns A factory function that accepts a state observable and produces a render handler
678
+ */
482
679
  declare function dbxScheduleSelectionCalendarBeforeMonthViewRenderFactory(inputModifyFn?: Maybe<DbxScheduleSelectionCalendarBeforeMonthViewRenderModifyDayFunction>): DbxScheduleSelectionCalendarBeforeMonthViewRenderFunctionFactory;
483
680
  declare class DbxScheduleSelectionCalendarComponent<T> implements OnInit, OnDestroy {
484
681
  readonly calendarStore: DbxCalendarStore<T>;
@@ -670,7 +867,18 @@ declare class DbxFormCalendarModule {
670
867
  static ɵinj: _angular_core.ɵɵInjectorDeclaration<DbxFormCalendarModule>;
671
868
  }
672
869
 
870
+ /**
871
+ * Creates form fields for selecting which days of the week are enabled in a schedule selection calendar,
872
+ * wrapped in a responsive flex layout.
873
+ *
874
+ * @returns An array of Formly field configs with toggle fields for each day of the week
875
+ */
673
876
  declare function dbxScheduleSelectionCalendarDateDaysFormFields(): _ngx_formly_core.FormlyFieldConfig<i13.DbxFlexWrapperConfig>[];
877
+ /**
878
+ * Creates an array of toggle field configs, one for each day of the week, keyed by lowercase day name.
879
+ *
880
+ * @returns An array of toggle Formly field configs for each day of the week
881
+ */
674
882
  declare function dbxScheduleSelectionCalendarDateDaysFormDayFields(): _ngx_formly_core.FormlyFieldConfig<_ngx_formly_core.FormlyFieldProps & {
675
883
  [additionalProperties: string]: any;
676
884
  }>[];
@@ -120,6 +120,12 @@ declare class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLatLngCom
120
120
 
121
121
  interface MapboxLatLngFieldConfig extends Omit<LabeledFieldConfig, 'key'>, DescriptionFieldConfig, Partial<FieldConfig>, Pick<DbxFormMapboxLatLngComponentFieldProps, 'showMap' | 'zoom' | 'latLngConfig' | 'recenterTime' | 'setCenterOnLocationSet' | 'showCenterButton' | 'selectLocationOnMapDrag' | 'selectLocationOnMapClick' | 'markerConfig'> {
122
122
  }
123
+ /**
124
+ * Creates a Formly field configuration for a Mapbox-powered latitude/longitude picker with optional map display.
125
+ *
126
+ * @param config - Optional field configuration overrides
127
+ * @returns A validated Formly field configuration for the Mapbox lat/lng picker
128
+ */
123
129
  declare function mapboxLatLngField(config?: MapboxLatLngFieldConfig): FormlyFieldConfig;
124
130
 
125
131
  declare class DbxFormMapboxLatLngFieldMarkerComponent {
@@ -198,6 +204,12 @@ declare class DbxFormMapboxZoomFieldComponent<T extends DbxFormMapboxZoomCompone
198
204
 
199
205
  interface MapboxZoomFieldConfig extends Omit<LabeledFieldConfig, 'key'>, DescriptionFieldConfig, Partial<FieldConfig>, Pick<DbxFormMapboxZoomComponentFieldProps, 'showMap' | 'center' | 'minZoom' | 'maxZoom' | 'zoomStep'> {
200
206
  }
207
+ /**
208
+ * Creates a Formly field configuration for a Mapbox-powered zoom level picker with optional map preview.
209
+ *
210
+ * @param config - Optional field configuration overrides
211
+ * @returns A validated Formly field configuration for the Mapbox zoom picker
212
+ */
201
213
  declare function mapboxZoomField(config?: MapboxZoomFieldConfig): FormlyFieldConfig;
202
214
 
203
215
  declare class DbxFormMapboxZoomModule {
@@ -216,6 +216,9 @@ declare class QuizStore extends ComponentStore<QuizStoreState> {
216
216
  /**
217
217
  * Returns a reactive observable of the answer for a given question, looked up by id, index, or the current question.
218
218
  *
219
+ * @param lookupInput - Lookup criteria specifying which question's answer to retrieve
220
+ * @returns An observable that emits the current answer for the specified question, or undefined if not answered
221
+ *
219
222
  * @example
220
223
  * ```ts
221
224
  * // By current question:
@@ -223,6 +226,8 @@ declare class QuizStore extends ComponentStore<QuizStoreState> {
223
226
  * // By question id:
224
227
  * store.answerForQuestion({ id: 'q1' }).subscribe(answer => console.log(answer));
225
228
  * ```
229
+ *
230
+ * @param lookupInput - Lookup criteria specifying which question's answer to retrieve
226
231
  */
227
232
  answerForQuestion(lookupInput: ObservableOrValue<QuizStoreAnswerLookupInput>): Observable<Maybe<QuizAnswer>>;
228
233
  readonly startQuiz: () => void;
@@ -281,6 +286,8 @@ declare abstract class QuizQuestionAccessor<T = unknown> {
281
286
  /**
282
287
  * Provides QuizQuestionAccessor bound to the current question in QuizStore.
283
288
  *
289
+ * @returns An Angular provider that binds QuizQuestionAccessor to the current quiz question
290
+ *
284
291
  * @usage
285
292
  * ```typescript
286
293
  * @Component({
@@ -643,21 +650,31 @@ declare class DbxQuizScoreComponent {
643
650
  /**
644
651
  * Creates a Likert scale question config with agreement prompt (Strongly Disagree to Strongly Agree).
645
652
  *
653
+ * @param text - The statement to rate agreement on
654
+ * @returns A quiz question config with an agreement-based prompt and guidance text
655
+ *
646
656
  * @example
647
657
  * ```ts
648
658
  * instance.config.set(quizAgreementPrompt('I feel confident leading under pressure.'));
649
659
  * // { prompt: 'Please rate how much you agree...', text: '...', guidance: '1 = Strongly Disagree, 5 = Strongly Agree' }
650
660
  * ```
661
+ *
662
+ * @param text - The statement to rate agreement on
651
663
  */
652
664
  declare function quizAgreementPrompt(text: string): QuizQuestionTextComponentConfig;
653
665
  /**
654
666
  * Creates a Likert scale question config with frequency prompt (Never to Always).
655
667
  *
668
+ * @param text - The statement to rate frequency on
669
+ * @returns A quiz question config with a frequency-based prompt and guidance text
670
+ *
656
671
  * @example
657
672
  * ```ts
658
673
  * instance.config.set(quizFrequencyPrompt('I break vague direction into first steps.'));
659
674
  * // { prompt: 'Please rate how much you agree...', text: '...', guidance: '1 = Never, 5 = Always' }
660
675
  * ```
676
+ *
677
+ * @param text - The statement to rate frequency on
661
678
  */
662
679
  declare function quizFrequencyPrompt(text: string): QuizQuestionTextComponentConfig;
663
680