@dereekb/dbx-form 13.11.14 → 13.11.16
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/fesm2022/dereekb-dbx-form-calendar.mjs +237 -201
- package/fesm2022/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2022/{dereekb-dbx-form-info.wrapper.component-DxmZz3Dw.mjs → dereekb-dbx-form-info.wrapper.component-ChSBMxgm.mjs} +5 -5
- package/fesm2022/dereekb-dbx-form-info.wrapper.component-ChSBMxgm.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-mapbox.mjs +48 -30
- package/fesm2022/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-form-quiz.mjs +34 -33
- package/fesm2022/dereekb-dbx-form-quiz.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-form.mjs +847 -760
- package/fesm2022/dereekb-dbx-form.mjs.map +1 -1
- package/package.json +8 -8
- package/types/dereekb-dbx-form-calendar.d.ts +82 -79
- package/types/dereekb-dbx-form-mapbox.d.ts +22 -20
- package/types/dereekb-dbx-form-quiz.d.ts +11 -14
- package/types/dereekb-dbx-form.d.ts +726 -718
- package/fesm2022/dereekb-dbx-form-info.wrapper.component-DxmZz3Dw.mjs.map +0 -1
|
@@ -31,12 +31,14 @@ import { FormlyModule } from '@ngx-formly/core';
|
|
|
31
31
|
import { DEFAULT_PROPS, DEFAULT_VALIDATION_MESSAGES } from '@ng-forge/dynamic-forms';
|
|
32
32
|
import { setupMetaTracking, resolveValueFieldContext, buildValueFieldInputs } from '@ng-forge/dynamic-forms/integration';
|
|
33
33
|
|
|
34
|
+
/* eslint-disable @typescript-eslint/no-deprecated -- legacy formly calendar factory; references deprecated config interfaces and is itself deprecated in favor of dbxForgeDateScheduleRangeField() */
|
|
34
35
|
/**
|
|
35
36
|
* Creates a Formly field configuration for a date schedule range picker with calendar-based selection.
|
|
36
37
|
*
|
|
38
|
+
* @param config - Optional schedule range field configuration overrides.
|
|
39
|
+
* @returns A validated Formly field configuration for date schedule range selection.
|
|
40
|
+
*
|
|
37
41
|
* @deprecated Use dbxForgeDateScheduleRangeField() from the forge API instead.
|
|
38
|
-
* @param config - Optional schedule range field configuration overrides
|
|
39
|
-
* @returns A validated Formly field configuration for date schedule range selection
|
|
40
42
|
*/
|
|
41
43
|
function dateScheduleRangeField(config = {}) {
|
|
42
44
|
const { key = 'schedule', appearance, hideCustomize, allowTextInput, filter, outputTimezone, initialSelectionState, computeSelectionResultRelativeToFilter, exclusions, defaultScheduleDays, minMaxDateRange, cellContentFactory, dialogContentConfig, customDetailsConfig } = config;
|
|
@@ -103,7 +105,7 @@ const defaultCalendarScheduleSelectionCellContentFactory = (day) => {
|
|
|
103
105
|
* Creates the default initial state for the calendar schedule selection store,
|
|
104
106
|
* using the current system timezone and all days of the week enabled.
|
|
105
107
|
*
|
|
106
|
-
* @returns A fresh CalendarScheduleSelectionState with default values
|
|
108
|
+
* @returns A fresh CalendarScheduleSelectionState with default values.
|
|
107
109
|
*/
|
|
108
110
|
function initialCalendarScheduleSelectionState() {
|
|
109
111
|
const defaultScheduleDays = new Set([DateCellScheduleDayCode.WEEKDAY, DateCellScheduleDayCode.WEEKEND]);
|
|
@@ -154,8 +156,8 @@ function calendarScheduleMinAndMaxDateRangeRelativeToFilter(x) {
|
|
|
154
156
|
/**
|
|
155
157
|
* Computes the effective min and max date range by combining the filter and the explicit minMaxDateRange constraints.
|
|
156
158
|
*
|
|
157
|
-
* @param x - State containing filter and minMaxDateRange to compute from
|
|
158
|
-
* @returns A partial date range with the effective start and end boundaries
|
|
159
|
+
* @param x - State containing filter and minMaxDateRange to compute from.
|
|
160
|
+
* @returns A partial date range with the effective start and end boundaries.
|
|
159
161
|
*/
|
|
160
162
|
function calendarScheduleMinAndMaxDateRange(x) {
|
|
161
163
|
return {
|
|
@@ -166,8 +168,8 @@ function calendarScheduleMinAndMaxDateRange(x) {
|
|
|
166
168
|
/**
|
|
167
169
|
* Returns the effective minimum date by taking the latest start date between the filter and minMaxDateRange.
|
|
168
170
|
*
|
|
169
|
-
* @param x - State containing filter and minMaxDateRange
|
|
170
|
-
* @returns The latest start date, or undefined if none
|
|
171
|
+
* @param x - State containing filter and minMaxDateRange.
|
|
172
|
+
* @returns The latest start date, or undefined if none.
|
|
171
173
|
*/
|
|
172
174
|
function calendarScheduleMinDate(x) {
|
|
173
175
|
return findMaxDate([x.filter?.start, x.minMaxDateRange?.start]);
|
|
@@ -175,8 +177,8 @@ function calendarScheduleMinDate(x) {
|
|
|
175
177
|
/**
|
|
176
178
|
* Returns the effective maximum date by taking the earliest end date between the filter and minMaxDateRange.
|
|
177
179
|
*
|
|
178
|
-
* @param x - State containing filter and minMaxDateRange
|
|
179
|
-
* @returns The earliest end date, or undefined if none
|
|
180
|
+
* @param x - State containing filter and minMaxDateRange.
|
|
181
|
+
* @returns The earliest end date, or undefined if none.
|
|
180
182
|
*/
|
|
181
183
|
function calendarScheduleMaxDate(x) {
|
|
182
184
|
return findMinDate([x.filter?.end, x.minMaxDateRange?.end]);
|
|
@@ -184,8 +186,8 @@ function calendarScheduleMaxDate(x) {
|
|
|
184
186
|
/**
|
|
185
187
|
* Returns whether the filter's start date is being used as the effective start for the selection result computation.
|
|
186
188
|
*
|
|
187
|
-
* @param x - State containing filter and computeSelectionResultRelativeToFilter
|
|
188
|
-
* @returns True if the filter start is being used for the selection result
|
|
189
|
+
* @param x - State containing filter and computeSelectionResultRelativeToFilter.
|
|
190
|
+
* @returns True if the filter start is being used for the selection result.
|
|
189
191
|
*/
|
|
190
192
|
function calendarScheduleStartBeingUsedFromFilter(x) {
|
|
191
193
|
return x.computeSelectionResultRelativeToFilter && x.filter?.start != null; // may be using either
|
|
@@ -330,9 +332,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
330
332
|
/**
|
|
331
333
|
* Updates the state with an initial selection (all or none) and applies it when no dates are currently toggled.
|
|
332
334
|
*
|
|
333
|
-
* @param state - The current selection state
|
|
335
|
+
* @param state - The current selection state.
|
|
334
336
|
* @param initialSelectionState - The initial selection mode ('all' or 'none')
|
|
335
|
-
* @returns The updated selection state
|
|
337
|
+
* @returns The updated selection state.
|
|
336
338
|
*/
|
|
337
339
|
function updateStateWithInitialSelectionState(state, initialSelectionState) {
|
|
338
340
|
const { toggledIndexes } = state;
|
|
@@ -344,9 +346,9 @@ function updateStateWithInitialSelectionState(state, initialSelectionState) {
|
|
|
344
346
|
/**
|
|
345
347
|
* Updates the computeSelectionResultRelativeToFilter flag and recalculates the state if the value changed.
|
|
346
348
|
*
|
|
347
|
-
* @param currentState - The current selection state
|
|
348
|
-
* @param computeSelectionResultRelativeToFilter - Whether to compute results relative to the filter
|
|
349
|
-
* @returns The updated selection state
|
|
349
|
+
* @param currentState - The current selection state.
|
|
350
|
+
* @param computeSelectionResultRelativeToFilter - Whether to compute results relative to the filter.
|
|
351
|
+
* @returns The updated selection state.
|
|
350
352
|
*/
|
|
351
353
|
function updateStateWithComputeSelectionResultRelativeToFilter(currentState, computeSelectionResultRelativeToFilter) {
|
|
352
354
|
let state = { ...currentState, computeSelectionResultRelativeToFilter };
|
|
@@ -358,9 +360,9 @@ function updateStateWithComputeSelectionResultRelativeToFilter(currentState, com
|
|
|
358
360
|
/**
|
|
359
361
|
* Updates the state with date exclusions, converting input dates/ranges to cell indexes and reapplying the filter.
|
|
360
362
|
*
|
|
361
|
-
* @param state - The current selection state
|
|
362
|
-
* @param inputExclusions - Dates, date ranges, or cell indexes to exclude
|
|
363
|
-
* @returns The updated selection state with exclusions applied
|
|
363
|
+
* @param state - The current selection state.
|
|
364
|
+
* @param inputExclusions - Dates, date ranges, or cell indexes to exclude.
|
|
365
|
+
* @returns The updated selection state with exclusions applied.
|
|
364
366
|
*/
|
|
365
367
|
function updateStateWithExclusions(state, inputExclusions) {
|
|
366
368
|
let computedExclusions;
|
|
@@ -375,9 +377,9 @@ function updateStateWithExclusions(state, inputExclusions) {
|
|
|
375
377
|
/**
|
|
376
378
|
* Sets the min/max date range constraint on the state, normalizing start to startOfDay and end to endOfDay.
|
|
377
379
|
*
|
|
378
|
-
* @param state - The current selection state
|
|
379
|
-
* @param minMaxDateRange - The min/max boundary dates to enforce
|
|
380
|
-
* @returns The updated selection state with the boundary applied
|
|
380
|
+
* @param state - The current selection state.
|
|
381
|
+
* @param minMaxDateRange - The min/max boundary dates to enforce.
|
|
382
|
+
* @returns The updated selection state with the boundary applied.
|
|
381
383
|
*/
|
|
382
384
|
function updateStateWithMinMaxDateRange(state, minMaxDateRange) {
|
|
383
385
|
if (minMaxDateRange != null && !isInfiniteDateRange(minMaxDateRange)) {
|
|
@@ -406,9 +408,9 @@ function updateStateWithMinMaxDateRange(state, minMaxDateRange) {
|
|
|
406
408
|
* Applies a date cell schedule filter to the selection state, computing the enabled day function
|
|
407
409
|
* from the filter, exclusions, and min/max date range constraints.
|
|
408
410
|
*
|
|
409
|
-
* @param currentState - The current selection state
|
|
410
|
-
* @param inputFilter - The filter configuration to apply
|
|
411
|
-
* @returns The updated selection state with the filter applied
|
|
411
|
+
* @param currentState - The current selection state.
|
|
412
|
+
* @param inputFilter - The filter configuration to apply.
|
|
413
|
+
* @returns The updated selection state with the filter applied.
|
|
412
414
|
*/
|
|
413
415
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
414
416
|
function updateStateWithFilter(currentState, inputFilter) {
|
|
@@ -529,13 +531,14 @@ function updateStateWithFilter(currentState, inputFilter) {
|
|
|
529
531
|
/**
|
|
530
532
|
* Updates the output timezone and transforms the current selection value to reflect the new timezone.
|
|
531
533
|
*
|
|
532
|
-
* @param state - The current selection state
|
|
533
|
-
* @param timezone - The target timezone string
|
|
534
|
-
* @returns The updated selection state with timezone-adjusted values
|
|
534
|
+
* @param state - The current selection state.
|
|
535
|
+
* @param timezone - The target timezone string.
|
|
536
|
+
* @returns The updated selection state with timezone-adjusted values.
|
|
535
537
|
*/
|
|
536
538
|
function updateStateWithTimezoneValue(state, timezone) {
|
|
537
539
|
const { currentSelectionValue } = state;
|
|
538
540
|
const timezoneNormal = timezone ? dateTimezoneUtcNormal({ timezone }) : undefined;
|
|
541
|
+
let result;
|
|
539
542
|
if (timezoneNormal && currentSelectionValue) {
|
|
540
543
|
// update the selection value to reflect the timezone changes.
|
|
541
544
|
const { dateScheduleRange: currentDateCellScheduleRange } = currentSelectionValue;
|
|
@@ -546,17 +549,20 @@ function updateStateWithTimezoneValue(state, timezone) {
|
|
|
546
549
|
start,
|
|
547
550
|
end
|
|
548
551
|
};
|
|
549
|
-
|
|
552
|
+
result = updateStateWithDateCellScheduleRangeValue({ ...state, outputTimezone: timezone, outputTimezoneNormal: timezoneNormal }, newRange);
|
|
550
553
|
}
|
|
551
|
-
|
|
554
|
+
else {
|
|
555
|
+
result = { ...state, outputTimezone: timezone, outputTimezoneNormal: timezoneNormal }; // no change in value
|
|
556
|
+
}
|
|
557
|
+
return result;
|
|
552
558
|
}
|
|
553
559
|
/**
|
|
554
560
|
* Updates the state from an external date cell schedule range value, converting timezone-aware inputs
|
|
555
561
|
* to system time and synchronizing the internal selection indexes.
|
|
556
562
|
*
|
|
557
|
-
* @param state - The current selection state
|
|
558
|
-
* @param inputChange - The date cell schedule range to apply
|
|
559
|
-
* @returns The updated selection state
|
|
563
|
+
* @param state - The current selection state.
|
|
564
|
+
* @param inputChange - The date cell schedule range to apply.
|
|
565
|
+
* @returns The updated selection state.
|
|
560
566
|
*/
|
|
561
567
|
function updateStateWithDateCellScheduleRangeValue(state, inputChange) {
|
|
562
568
|
const { currentSelectionValue, systemTimezone } = state;
|
|
@@ -585,10 +591,14 @@ function updateStateWithDateCellScheduleRangeValue(state, inputChange) {
|
|
|
585
591
|
};
|
|
586
592
|
}
|
|
587
593
|
const isSameValue = isSameDateCellScheduleDateRange(currentDateCellScheduleRange, change);
|
|
594
|
+
let result;
|
|
588
595
|
if (isSameValue) {
|
|
589
|
-
|
|
596
|
+
result = state;
|
|
590
597
|
}
|
|
591
|
-
if (change
|
|
598
|
+
else if (change == null) {
|
|
599
|
+
result = noSelectionCalendarScheduleSelectionState(state); // clear selection, retain disabled days
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
592
602
|
// After the legacy-restored output anchor, change.ex is already state-anchored
|
|
593
603
|
// (change.start equals state.start for filter-relative outputs), so no offset
|
|
594
604
|
// is applied. inputStart is clamped to state.minMaxDateRange.start when set so
|
|
@@ -597,31 +607,30 @@ function updateStateWithDateCellScheduleRangeValue(state, inputChange) {
|
|
|
597
607
|
const minMaxStart = state.minMaxDateRange?.start;
|
|
598
608
|
const clampedInputStart = minMaxStart && minMaxStart.getTime() > change.start.getTime() ? minMaxStart : change.start;
|
|
599
609
|
const nextState = { ...state, inputStart: clampedInputStart, inputEnd: change.end, toggledIndexes: new Set(change.ex ?? []) };
|
|
600
|
-
|
|
610
|
+
result = updateStateWithChangedScheduleDays(finalizeNewCalendarScheduleSelectionState(nextState), expandDateCellScheduleDayCodes(change.w || '89'));
|
|
601
611
|
}
|
|
602
|
-
return
|
|
612
|
+
return result;
|
|
603
613
|
}
|
|
604
614
|
/**
|
|
605
615
|
* Updates the default schedule day codes (used when no explicit schedule days are set) and recalculates allowed days.
|
|
606
616
|
*
|
|
607
|
-
* @param state - The current selection state
|
|
608
|
-
* @param change - The new default schedule day codes
|
|
609
|
-
* @returns The updated selection state
|
|
617
|
+
* @param state - The current selection state.
|
|
618
|
+
* @param change - The new default schedule day codes.
|
|
619
|
+
* @returns The updated selection state.
|
|
610
620
|
*/
|
|
611
621
|
function updateStateWithChangedDefaultScheduleDays(state, change) {
|
|
612
622
|
const { defaultScheduleDays: currentDefaultScheduleDays } = state;
|
|
613
623
|
const defaultScheduleDays = new Set(change ?? fullWeekDateCellScheduleDayCodes());
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
return finalizeUpdateStateWithChangedScheduleDays(state, { ...state, defaultScheduleDays });
|
|
624
|
+
return dateCellScheduleDayCodesAreSetsEquivalent(defaultScheduleDays, currentDefaultScheduleDays)
|
|
625
|
+
? state // no change
|
|
626
|
+
: finalizeUpdateStateWithChangedScheduleDays(state, { ...state, defaultScheduleDays });
|
|
618
627
|
}
|
|
619
628
|
/**
|
|
620
629
|
* Updates the explicit schedule day codes override and recalculates allowed days of the week.
|
|
621
630
|
*
|
|
622
|
-
* @param state - The current selection state
|
|
623
|
-
* @param change - The new schedule day codes, or null/undefined to clear the override
|
|
624
|
-
* @returns The updated selection state
|
|
631
|
+
* @param state - The current selection state.
|
|
632
|
+
* @param change - The new schedule day codes, or null/undefined to clear the override.
|
|
633
|
+
* @returns The updated selection state.
|
|
625
634
|
*/
|
|
626
635
|
function updateStateWithChangedScheduleDays(state, change) {
|
|
627
636
|
const { scheduleDays: currentScheduleDays } = state;
|
|
@@ -638,51 +647,58 @@ function updateStateWithChangedScheduleDays(state, change) {
|
|
|
638
647
|
else if (currentScheduleDays !== change) {
|
|
639
648
|
newScheduleDays = change ? scheduleDays : null; // set the new one, or clear it
|
|
640
649
|
}
|
|
641
|
-
|
|
642
|
-
return state;
|
|
643
|
-
}
|
|
644
|
-
return finalizeUpdateStateWithChangedScheduleDays(state, { ...state, scheduleDays: newScheduleDays ?? undefined });
|
|
650
|
+
return newScheduleDays === undefined ? state : finalizeUpdateStateWithChangedScheduleDays(state, { ...state, scheduleDays: newScheduleDays ?? undefined });
|
|
645
651
|
}
|
|
646
652
|
/**
|
|
647
653
|
* Switches between single and multiple selection mode, trimming the selection to a single value when switching to single mode.
|
|
648
654
|
*
|
|
649
|
-
* @param state - The current selection state
|
|
650
|
-
* @param selectionMode - The new selection mode
|
|
651
|
-
* @returns The updated selection state
|
|
655
|
+
* @param state - The current selection state.
|
|
656
|
+
* @param selectionMode - The new selection mode.
|
|
657
|
+
* @returns The updated selection state.
|
|
652
658
|
*/
|
|
653
659
|
function updateStateWithSelectionMode(state, selectionMode) {
|
|
654
660
|
const { selectionMode: currentSelectionMode } = state;
|
|
655
|
-
|
|
661
|
+
let result;
|
|
662
|
+
if (currentSelectionMode === selectionMode) {
|
|
663
|
+
result = state;
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
656
666
|
const nextState = { ...state, selectionMode };
|
|
657
667
|
if (selectionMode === 'multiple') {
|
|
658
|
-
|
|
668
|
+
result = nextState;
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
const currentSelectionRange = computeCalendarScheduleSelectionDateCellRange(nextState);
|
|
672
|
+
result = currentSelectionRange ? updateStateWithChangedDates(nextState, { set: [currentSelectionRange.i], invertSetBehavior: true }) : nextState;
|
|
659
673
|
}
|
|
660
|
-
const currentSelectionRange = computeCalendarScheduleSelectionDateCellRange(nextState);
|
|
661
|
-
return currentSelectionRange ? updateStateWithChangedDates(nextState, { set: [currentSelectionRange.i], invertSetBehavior: true }) : nextState;
|
|
662
674
|
}
|
|
663
|
-
return
|
|
675
|
+
return result;
|
|
664
676
|
}
|
|
665
677
|
/**
|
|
666
678
|
* Finalizes a schedule days change by recalculating allowed days of the week and updating toggled indexes accordingly.
|
|
667
679
|
*
|
|
668
|
-
* @param previousState - The state before the schedule days change
|
|
669
|
-
* @param nextState - The state with updated schedule day codes
|
|
670
|
-
* @returns The finalized selection state with recalculated allowed days and toggled indexes
|
|
680
|
+
* @param previousState - The state before the schedule days change.
|
|
681
|
+
* @param nextState - The state with updated schedule day codes.
|
|
682
|
+
* @returns The finalized selection state with recalculated allowed days and toggled indexes.
|
|
671
683
|
*/
|
|
672
684
|
function finalizeUpdateStateWithChangedScheduleDays(previousState, nextState) {
|
|
673
685
|
const previousScheduleDays = previousState.effectiveScheduleDays;
|
|
674
686
|
const nextScheduleDays = nextState.scheduleDays ?? nextState.defaultScheduleDays;
|
|
687
|
+
let result;
|
|
675
688
|
if (dateCellScheduleDayCodesAreSetsEquivalent(nextScheduleDays, previousScheduleDays)) {
|
|
676
|
-
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
689
|
+
result = nextState; // the default or input schedule changed but the schedule is still the same, so no need for an update.
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
const effectiveScheduleDays = new Set(simplifyDateCellScheduleDayCodes(nextScheduleDays));
|
|
693
|
+
const allowedDaysOfWeek = expandDateCellScheduleDayCodesToDayOfWeekSet(nextScheduleDays);
|
|
694
|
+
result = finalizeNewCalendarScheduleSelectionState({
|
|
695
|
+
...nextState,
|
|
696
|
+
// update the effective schedule days and allowed days of week
|
|
697
|
+
effectiveScheduleDays,
|
|
698
|
+
allowedDaysOfWeek
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
return result;
|
|
686
702
|
}
|
|
687
703
|
/**
|
|
688
704
|
* Applies date changes (toggle, add, remove, set, selectAll, or reset) to the calendar selection state,
|
|
@@ -696,9 +712,9 @@ function finalizeUpdateStateWithChangedScheduleDays(previousState, nextState) {
|
|
|
696
712
|
* Applies date changes (toggle, add, remove, set, selectAll, or reset) to the calendar selection state,
|
|
697
713
|
* updating toggled indexes and input start/end accordingly.
|
|
698
714
|
*
|
|
699
|
-
* @param state - The current selection state
|
|
700
|
-
* @param change - The date changes to apply
|
|
701
|
-
* @returns The updated selection state
|
|
715
|
+
* @param state - The current selection state.
|
|
716
|
+
* @param change - The date changes to apply.
|
|
717
|
+
* @returns The updated selection state.
|
|
702
718
|
*/
|
|
703
719
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
704
720
|
function updateStateWithChangedDates(state, change) {
|
|
@@ -830,17 +846,16 @@ function updateStateWithChangedDates(state, change) {
|
|
|
830
846
|
nextState.isEnabledDay = isEnabledDayInCalendarScheduleSelectionState(nextState);
|
|
831
847
|
// Recalculate the range and simplified to exclusions
|
|
832
848
|
const rangeAndExclusion = computeScheduleSelectionRangeAndExclusion(nextState);
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
return noSelectionCalendarScheduleSelectionState(nextState);
|
|
849
|
+
return rangeAndExclusion
|
|
850
|
+
? finalizeNewCalendarScheduleSelectionState({ ...nextState, toggledIndexes: new Set(rangeAndExclusion.excluded), inputStart: rangeAndExclusion.start, inputEnd: rangeAndExclusion.end })
|
|
851
|
+
: // no selected days
|
|
852
|
+
noSelectionCalendarScheduleSelectionState(nextState);
|
|
838
853
|
}
|
|
839
854
|
/**
|
|
840
855
|
* Clears all date selections from the state, retaining other configuration like schedule days and filter.
|
|
841
856
|
*
|
|
842
|
-
* @param state - The current selection state
|
|
843
|
-
* @returns The state with all selections cleared
|
|
857
|
+
* @param state - The current selection state.
|
|
858
|
+
* @returns The state with all selections cleared.
|
|
844
859
|
*/
|
|
845
860
|
function noSelectionCalendarScheduleSelectionState(state) {
|
|
846
861
|
return finalizeNewCalendarScheduleSelectionState({ ...state, toggledIndexes: new Set(), inputStart: null, inputEnd: null });
|
|
@@ -848,9 +863,9 @@ function noSelectionCalendarScheduleSelectionState(state) {
|
|
|
848
863
|
/**
|
|
849
864
|
* Updates the selection state with a new start/end date range, retaining toggled indexes within the new range bounds.
|
|
850
865
|
*
|
|
851
|
-
* @param state - The current selection state
|
|
852
|
-
* @param change - The new input start and end dates
|
|
853
|
-
* @returns The updated selection state
|
|
866
|
+
* @param state - The current selection state.
|
|
867
|
+
* @param change - The new input start and end dates.
|
|
868
|
+
* @returns The updated selection state.
|
|
854
869
|
*/
|
|
855
870
|
function updateStateWithChangedRange(state, change) {
|
|
856
871
|
const { inputStart: currentInputStart, inputEnd: currentInputEnd, indexFactory } = state;
|
|
@@ -858,24 +873,28 @@ function updateStateWithChangedRange(state, change) {
|
|
|
858
873
|
const inputStart = startOfDay(change.inputStart);
|
|
859
874
|
const inputEnd = startOfDay(change.inputEnd); // midnight of the last day
|
|
860
875
|
const isValidRange = minDate != null || maxDate != null ? isDateInDateRangeFunction({ start: minDate ?? undefined, end: maxDate ?? undefined }) : () => true;
|
|
876
|
+
let result;
|
|
861
877
|
if (!isValidRange(inputStart) || !isValidRange(inputEnd) || (isSameDateDay(inputStart, currentInputStart) && isSameDateDay(inputEnd, currentInputEnd))) {
|
|
862
|
-
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
878
|
+
result = state; // if no change, return the current state.
|
|
879
|
+
}
|
|
880
|
+
else {
|
|
881
|
+
// retain all indexes that are within the new range
|
|
882
|
+
const minIndex = indexFactory(inputStart);
|
|
883
|
+
const maxIndex = indexFactory(inputEnd) + 1;
|
|
884
|
+
const currentIndexes = [...state.toggledIndexes];
|
|
885
|
+
const isInCurrentRange = isIndexNumberInIndexRangeFunction({ minIndex, maxIndex });
|
|
886
|
+
const excludedIndexesInNewRange = currentIndexes.filter(isInCurrentRange);
|
|
887
|
+
const toggledIndexes = new Set(excludedIndexesInNewRange);
|
|
888
|
+
const nextState = { ...state, toggledIndexes, inputStart, inputEnd };
|
|
889
|
+
result = finalizeNewCalendarScheduleSelectionState(nextState);
|
|
890
|
+
}
|
|
891
|
+
return result;
|
|
873
892
|
}
|
|
874
893
|
/**
|
|
875
894
|
* Finalizes a partially-built state by recomputing the isEnabledDay function and the current selection value.
|
|
876
895
|
*
|
|
877
|
-
* @param nextState - The partially-built selection state to finalize
|
|
878
|
-
* @returns The finalized selection state
|
|
896
|
+
* @param nextState - The partially-built selection state to finalize.
|
|
897
|
+
* @returns The finalized selection state.
|
|
879
898
|
*/
|
|
880
899
|
function finalizeNewCalendarScheduleSelectionState(nextState) {
|
|
881
900
|
nextState.isEnabledDay = isEnabledDayInCalendarScheduleSelectionState(nextState);
|
|
@@ -885,8 +904,8 @@ function finalizeNewCalendarScheduleSelectionState(nextState) {
|
|
|
885
904
|
/**
|
|
886
905
|
* Builds a decision function that determines whether a given day index is enabled (selected) in the current state.
|
|
887
906
|
*
|
|
888
|
-
* @param state - The selection state to derive the enabled-day function from
|
|
889
|
-
* @returns
|
|
907
|
+
* @param state - The selection state to derive the enabled-day function from.
|
|
908
|
+
* @returns Returns true if the given day is enabled/selected.
|
|
890
909
|
*/
|
|
891
910
|
function isEnabledDayInCalendarScheduleSelectionState(state) {
|
|
892
911
|
const { allowedDaysOfWeek, indexFactory, inputStart, inputEnd, indexDayOfWeek, systemTimezone } = state;
|
|
@@ -910,96 +929,103 @@ function isEnabledDayInCalendarScheduleSelectionState(state) {
|
|
|
910
929
|
* Computes the output DateCellScheduleDateRange value from the current selection state,
|
|
911
930
|
* applying timezone offsets and filter-relative computations as needed.
|
|
912
931
|
*
|
|
913
|
-
* @param state - The current selection state to compute from
|
|
914
|
-
* @returns The computed selection value, or null if nothing is selected
|
|
932
|
+
* @param state - The current selection state to compute from.
|
|
933
|
+
* @returns The computed selection value, or null if nothing is selected.
|
|
915
934
|
*/
|
|
916
935
|
function computeScheduleSelectionValue(state) {
|
|
917
936
|
const { indexFactory: systemIndexFactory, allowedDaysOfWeek, effectiveScheduleDays, indexDayOfWeek, computeSelectionResultRelativeToFilter, filter, systemTimezone } = state;
|
|
918
937
|
let timezone = systemTimezone;
|
|
919
938
|
const rangeAndExclusion = computeScheduleSelectionRangeAndExclusion(state);
|
|
939
|
+
let result;
|
|
920
940
|
if (rangeAndExclusion == null) {
|
|
921
|
-
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
941
|
+
result = null;
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
const { start: rangeStart, end: rangeEnd, excluded: allExcluded, dateCellRange } = rangeAndExclusion;
|
|
945
|
+
let filterOffsetExcludedRange = [];
|
|
946
|
+
let indexOffset = dateCellRange.i;
|
|
947
|
+
let start = rangeStart;
|
|
948
|
+
let end = rangeEnd;
|
|
949
|
+
// If computeSelectionResultRelativeToFilter is true, then we need to offset the values to be relative to that start.
|
|
950
|
+
if (computeSelectionResultRelativeToFilter && filter?.start) {
|
|
951
|
+
start = filter.start; // start at the filter's start date
|
|
952
|
+
let startInSystemTimezone = start;
|
|
953
|
+
if (filter.timezone) {
|
|
954
|
+
timezone = filter.timezone;
|
|
955
|
+
const filterNormal = dateTimezoneUtcNormal(timezone);
|
|
956
|
+
end = filterNormal.startOfDayInTargetTimezone(end);
|
|
957
|
+
startInSystemTimezone = filterNormal.systemDateToTargetDate(start); // convert the start to the system timezone normal for deriving the index
|
|
958
|
+
}
|
|
959
|
+
const rangeStartIndex = systemIndexFactory(rangeStart);
|
|
960
|
+
const startIndex = systemIndexFactory(startInSystemTimezone);
|
|
961
|
+
const filterStartIndexOffset = rangeStartIndex - startIndex;
|
|
962
|
+
filterOffsetExcludedRange = range(0, filterStartIndexOffset);
|
|
963
|
+
indexOffset = indexOffset - filterStartIndexOffset;
|
|
937
964
|
}
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
return {
|
|
967
|
-
dateScheduleRange,
|
|
968
|
-
minMaxRange: { start, end }
|
|
969
|
-
};
|
|
965
|
+
const excluded = computeSelectionResultRelativeToFilter
|
|
966
|
+
? allExcluded.filter((x) => {
|
|
967
|
+
// ???
|
|
968
|
+
return allowedDaysOfWeek.has(indexDayOfWeek(x));
|
|
969
|
+
})
|
|
970
|
+
: allExcluded;
|
|
971
|
+
const offsetExcluded = excluded.map((x) => x - indexOffset); // set to the proper offset
|
|
972
|
+
const ex = [...filterOffsetExcludedRange, ...offsetExcluded];
|
|
973
|
+
const w = dateCellScheduleEncodedWeek(effectiveScheduleDays);
|
|
974
|
+
const d = []; // "included" blocks are never used/calculated.
|
|
975
|
+
// Always ensure the end is after or equal to the start.
|
|
976
|
+
if (isBefore(end, start)) {
|
|
977
|
+
end = start; // end is start
|
|
978
|
+
}
|
|
979
|
+
const dateScheduleRange = {
|
|
980
|
+
timezone,
|
|
981
|
+
start,
|
|
982
|
+
end,
|
|
983
|
+
w,
|
|
984
|
+
d,
|
|
985
|
+
ex
|
|
986
|
+
};
|
|
987
|
+
result = {
|
|
988
|
+
dateScheduleRange,
|
|
989
|
+
minMaxRange: { start, end }
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
return result;
|
|
970
993
|
}
|
|
971
994
|
/**
|
|
972
995
|
* Computes the selected date range with its corresponding cell range and all excluded day indexes.
|
|
973
996
|
* Returns null if no days are selected.
|
|
974
997
|
*
|
|
975
|
-
* @param state - The current selection state
|
|
976
|
-
* @returns The range and exclusion data, or null if nothing is selected
|
|
998
|
+
* @param state - The current selection state.
|
|
999
|
+
* @returns The range and exclusion data, or null if nothing is selected.
|
|
977
1000
|
*/
|
|
978
1001
|
function computeScheduleSelectionRangeAndExclusion(state) {
|
|
979
1002
|
const { start: currentStart, isEnabledDay, isEnabledFilterDay, systemTimezone } = state;
|
|
980
1003
|
const dateFactory = dateCellTimingStartDateFactory({ startsAt: currentStart, timezone: systemTimezone });
|
|
981
1004
|
const dateCellRange = computeCalendarScheduleSelectionDateCellRange(state);
|
|
1005
|
+
let result;
|
|
982
1006
|
if (dateCellRange == null) {
|
|
983
|
-
|
|
1007
|
+
result = null; // returns null if no items are selected.
|
|
1008
|
+
}
|
|
1009
|
+
else {
|
|
1010
|
+
const start = dateFactory(dateCellRange.i);
|
|
1011
|
+
const end = dateFactory(dateCellRange.to);
|
|
1012
|
+
const excluded = range(dateCellRange.i, dateCellRange.to + 1).filter((x) => {
|
|
1013
|
+
return !isEnabledDay(x) || !isEnabledFilterDay(x);
|
|
1014
|
+
});
|
|
1015
|
+
result = {
|
|
1016
|
+
dateCellRange,
|
|
1017
|
+
start,
|
|
1018
|
+
end,
|
|
1019
|
+
excluded
|
|
1020
|
+
};
|
|
984
1021
|
}
|
|
985
|
-
const start = dateFactory(dateCellRange.i);
|
|
986
|
-
const end = dateFactory(dateCellRange.to);
|
|
987
|
-
const excluded = range(dateCellRange.i, dateCellRange.to + 1).filter((x) => {
|
|
988
|
-
return !isEnabledDay(x) || !isEnabledFilterDay(x);
|
|
989
|
-
});
|
|
990
|
-
const result = {
|
|
991
|
-
dateCellRange,
|
|
992
|
-
start,
|
|
993
|
-
end,
|
|
994
|
-
excluded
|
|
995
|
-
};
|
|
996
1022
|
return result;
|
|
997
1023
|
}
|
|
998
1024
|
/**
|
|
999
1025
|
* Computes the selected date range (start and end dates) from the current selection state.
|
|
1000
1026
|
*
|
|
1001
|
-
* @param state - The current selection state
|
|
1002
|
-
* @returns The selected date range, or undefined if nothing is selected
|
|
1027
|
+
* @param state - The current selection state.
|
|
1028
|
+
* @returns The selected date range, or undefined if nothing is selected.
|
|
1003
1029
|
*/
|
|
1004
1030
|
function computeCalendarScheduleSelectionRange(state) {
|
|
1005
1031
|
const dateFactory = dateCellTimingDateFactory({ startsAt: state.start, timezone: state.systemTimezone });
|
|
@@ -1010,8 +1036,8 @@ function computeCalendarScheduleSelectionRange(state) {
|
|
|
1010
1036
|
/**
|
|
1011
1037
|
* Computes the date cell index range (i, to) that spans all selected and toggled days in the current state.
|
|
1012
1038
|
*
|
|
1013
|
-
* @param state - The current selection state
|
|
1014
|
-
* @returns The cell range spanning all selected days, or undefined if nothing is selected
|
|
1039
|
+
* @param state - The current selection state.
|
|
1040
|
+
* @returns The cell range spanning all selected days, or undefined if nothing is selected.
|
|
1015
1041
|
*/
|
|
1016
1042
|
function computeCalendarScheduleSelectionDateCellRange(state) {
|
|
1017
1043
|
const { allowedDaysOfWeek, indexFactory, inputStart, inputEnd, indexDayOfWeek, isEnabledDay, isEnabledFilterDay } = state;
|
|
@@ -1108,7 +1134,7 @@ function provideCalendarScheduleSelectionStoreIfParentIsUnavailable() {
|
|
|
1108
1134
|
*
|
|
1109
1135
|
* This is the forge equivalent of {@link dbxScheduleSelectionCalendarDateDaysFormFields}.
|
|
1110
1136
|
*
|
|
1111
|
-
* @returns A FormConfig with toggle fields for each day of the week
|
|
1137
|
+
* @returns A FormConfig with toggle fields for each day of the week.
|
|
1112
1138
|
*/
|
|
1113
1139
|
function dbxScheduleSelectionCalendarDateDaysForgeFormFields() {
|
|
1114
1140
|
return { fields: dbxScheduleSelectionCalendarDateDaysForgeFormDayFields() };
|
|
@@ -1116,7 +1142,7 @@ function dbxScheduleSelectionCalendarDateDaysForgeFormFields() {
|
|
|
1116
1142
|
/**
|
|
1117
1143
|
* Creates an array of forge toggle field definitions, one for each day of the week, keyed by lowercase day name.
|
|
1118
1144
|
*
|
|
1119
|
-
* @returns
|
|
1145
|
+
* @returns The forge toggle field definitions for each day of the week.
|
|
1120
1146
|
*/
|
|
1121
1147
|
function dbxScheduleSelectionCalendarDateDaysForgeFormDayFields() {
|
|
1122
1148
|
return getDaysOfWeekNames(false).map((dayOfWeekName) => {
|
|
@@ -1257,18 +1283,18 @@ class DbxScheduleSelectionCalendarDateRangeComponent {
|
|
|
1257
1283
|
timezoneSignal = toSignal(this.timezone$);
|
|
1258
1284
|
timezoneReleventDateSignal = toSignal(this.timezoneReleventDate$, { initialValue: new Date() });
|
|
1259
1285
|
isCustomizedSignal = toSignal(this.isCustomized$, { initialValue: false });
|
|
1260
|
-
showCustomLabelSignal = computed(() =>
|
|
1286
|
+
showCustomLabelSignal = computed(() => {
|
|
1287
|
+
const isCustomized = this.isCustomizedSignal();
|
|
1288
|
+
return this.showCustomize() && isCustomized;
|
|
1289
|
+
}, ...(ngDevMode ? [{ debugName: "showCustomLabelSignal" }] : /* istanbul ignore next */ []));
|
|
1261
1290
|
currentErrorMessageSignal = toSignal(this.currentErrorMessage$);
|
|
1262
|
-
datePickerFilterSignal = toSignal(this.datePickerFilter$, { initialValue: (
|
|
1291
|
+
datePickerFilterSignal = toSignal(this.datePickerFilter$, { initialValue: () => true });
|
|
1263
1292
|
_requiredUpdateValidatorsEffect = effect(() => {
|
|
1264
1293
|
const validators = this.required()
|
|
1265
1294
|
? [
|
|
1266
1295
|
(control) => {
|
|
1267
1296
|
const range = control.value;
|
|
1268
|
-
|
|
1269
|
-
return { required: true };
|
|
1270
|
-
}
|
|
1271
|
-
return null;
|
|
1297
|
+
return !range?.start || !range.end ? { required: true } : null;
|
|
1272
1298
|
}
|
|
1273
1299
|
]
|
|
1274
1300
|
: [];
|
|
@@ -1392,12 +1418,16 @@ class DbxScheduleSelectionCalendarDatePopoverButtonComponent {
|
|
|
1392
1418
|
buttonPopoverOrigin = viewChild.required('buttonPopoverOrigin', { read: ElementRef });
|
|
1393
1419
|
disabled$ = this.dbxCalendarScheduleSelectionStore.isViewReadonly$;
|
|
1394
1420
|
buttonText$ = this.dbxCalendarScheduleSelectionStore.currentDateRange$.pipe(map((x) => {
|
|
1421
|
+
let result;
|
|
1395
1422
|
if (x?.start && x.end) {
|
|
1396
1423
|
const startString = formatToMonthDayString(x.start);
|
|
1397
1424
|
const endString = formatToMonthDayString(x.end);
|
|
1398
|
-
|
|
1425
|
+
result = startString === endString ? startString : `${formatToMonthDayString(x.start)} - ${formatToMonthDayString(x.end)}`;
|
|
1426
|
+
}
|
|
1427
|
+
else {
|
|
1428
|
+
result = 'Pick a Date Range';
|
|
1399
1429
|
}
|
|
1400
|
-
return
|
|
1430
|
+
return result;
|
|
1401
1431
|
}), shareReplay(1));
|
|
1402
1432
|
disabledSignal = toSignal(this.disabled$, { initialValue: false });
|
|
1403
1433
|
buttonTextSignal = toSignal(this.buttonText$, { initialValue: 'Pick a Date Range' });
|
|
@@ -1526,8 +1556,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
1526
1556
|
* Creates a factory that produces a beforeMonthViewRender handler for the schedule selection calendar.
|
|
1527
1557
|
* The handler applies CSS classes and metadata to each day cell based on the current selection state.
|
|
1528
1558
|
*
|
|
1529
|
-
* @param inputModifyFn - Optional function to further customize each day cell after default processing
|
|
1530
|
-
* @returns A factory function that accepts a state observable and produces a render handler
|
|
1559
|
+
* @param inputModifyFn - Optional function to further customize each day cell after default processing.
|
|
1560
|
+
* @returns A factory function that accepts a state observable and produces a render handler.
|
|
1531
1561
|
*/
|
|
1532
1562
|
function dbxScheduleSelectionCalendarBeforeMonthViewRenderFactory(inputModifyFn) {
|
|
1533
1563
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -1583,10 +1613,8 @@ class DbxScheduleSelectionCalendarComponent {
|
|
|
1583
1613
|
}), shareReplay(1));
|
|
1584
1614
|
showButtonsOnReadonly$ = this.config$.pipe(map((x) => x?.showButtonsOnReadonly ?? false), distinctUntilChanged(), shareReplay(1));
|
|
1585
1615
|
showButtons$ = this.showButtonsOnReadonly$.pipe(switchMap((x) => {
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
}
|
|
1589
|
-
return this.readonly$.pipe(map((x) => !x));
|
|
1616
|
+
const result = x ? of(true) : this.readonly$.pipe(map((readonly) => !readonly));
|
|
1617
|
+
return result;
|
|
1590
1618
|
}), distinctUntilChanged(), shareReplay(1));
|
|
1591
1619
|
showClearSelectionButton$ = this.config$.pipe(map((config) => config?.showClearSelectionButton ?? true), combineLatestWith(this.showButtons$), map((x) => reduceBooleansWithAnd(x)), distinctUntilChanged(), shareReplay(1));
|
|
1592
1620
|
datePopoverButtonInjectionConfig$ = this.config$.pipe(map((x) => x?.buttonInjectionConfig), switchMapDbxInjectionComponentConfig(DbxScheduleSelectionCalendarDatePopoverButtonComponent), combineLatestWith(this.showButtons$), map(([config, showButton]) => (showButton ? config : undefined)), shareReplay(1));
|
|
@@ -1879,6 +1907,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
1879
1907
|
}]
|
|
1880
1908
|
}] });
|
|
1881
1909
|
|
|
1910
|
+
/* eslint-disable @typescript-eslint/no-deprecated -- legacy NgModule that wraps the deprecated DbxFormCalendarDateScheduleRangeFieldComponent; replacement is provideDbxForgeCalendarFieldDeclarations() */
|
|
1882
1911
|
const importsAndExports$1 = [DbxFormCalendarDateScheduleRangeFieldComponent];
|
|
1883
1912
|
/**
|
|
1884
1913
|
* @deprecated Use provideDbxForgeCalendarFieldDeclarations() instead.
|
|
@@ -1912,8 +1941,8 @@ const FORGE_CALENDAR_DATE_SCHEDULE_RANGE_FIELD_TYPE = 'dbx-forge-calendar-date-s
|
|
|
1912
1941
|
*
|
|
1913
1942
|
* This is the forge equivalent of {@link dateScheduleRangeField}.
|
|
1914
1943
|
*
|
|
1915
|
-
* @param config - Optional schedule range field configuration overrides
|
|
1916
|
-
* @returns A validated forge field definition for date schedule range selection
|
|
1944
|
+
* @param config - Optional schedule range field configuration overrides.
|
|
1945
|
+
* @returns A validated forge field definition for date schedule range selection.
|
|
1917
1946
|
*/
|
|
1918
1947
|
function dbxForgeDateScheduleRangeField(config = {}) {
|
|
1919
1948
|
const { key = 'schedule', label, description, required, readonly: isReadonly, appearance, allowTextInput, hideCustomize, allowCustomizeWithoutDateRange, outputTimezone, defaultScheduleDays, minMaxDateRange, filter, exclusions, dialogContentConfig, computeSelectionResultRelativeToFilter, initialSelectionState, cellContentFactory, customDetailsConfig } = config;
|
|
@@ -1978,14 +2007,14 @@ class DbxForgeCalendarDateScheduleRangeFieldComponent {
|
|
|
1978
2007
|
_filterSub = cleanSubscription();
|
|
1979
2008
|
_exclusionsSub = cleanSubscription();
|
|
1980
2009
|
// Field value signal (double-call pattern: field()() to get FieldState)
|
|
1981
|
-
|
|
2010
|
+
fieldValueSignal = computed(() => {
|
|
1982
2011
|
const state = this.field()?.();
|
|
1983
2012
|
return state?.value?.();
|
|
1984
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
1985
|
-
|
|
2013
|
+
}, ...(ngDevMode ? [{ debugName: "fieldValueSignal" }] : /* istanbul ignore next */ []));
|
|
2014
|
+
isDisabledSignal = computed(() => {
|
|
1986
2015
|
const state = this.field()?.();
|
|
1987
2016
|
return state?.disabled?.() ?? false;
|
|
1988
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
2017
|
+
}, ...(ngDevMode ? [{ debugName: "isDisabledSignal" }] : /* istanbul ignore next */ []));
|
|
1989
2018
|
isRequiredSignal = computed(() => {
|
|
1990
2019
|
const state = this.field()?.();
|
|
1991
2020
|
return state?.required?.() ?? false;
|
|
@@ -1993,17 +2022,18 @@ class DbxForgeCalendarDateScheduleRangeFieldComponent {
|
|
|
1993
2022
|
// Computed props
|
|
1994
2023
|
labelTextSignal = computed(() => this.props()?.label, ...(ngDevMode ? [{ debugName: "labelTextSignal" }] : /* istanbul ignore next */ []));
|
|
1995
2024
|
descriptionSignal = computed(() => this.props()?.description, ...(ngDevMode ? [{ debugName: "descriptionSignal" }] : /* istanbul ignore next */ []));
|
|
1996
|
-
isReadonlyOrDisabledSignal = computed(() =>
|
|
2025
|
+
isReadonlyOrDisabledSignal = computed(() => {
|
|
2026
|
+
const isDisabled = this.isDisabledSignal();
|
|
2027
|
+
return this.props()?.readonly || isDisabled;
|
|
2028
|
+
}, ...(ngDevMode ? [{ debugName: "isReadonlyOrDisabledSignal" }] : /* istanbul ignore next */ []));
|
|
1997
2029
|
openPickerOnTextClickSignal = computed(() => this.props()?.allowTextInput !== true, ...(ngDevMode ? [{ debugName: "openPickerOnTextClickSignal" }] : /* istanbul ignore next */ []));
|
|
1998
2030
|
showCustomizeSignal = computed(() => !this.props()?.hideCustomize, ...(ngDevMode ? [{ debugName: "showCustomizeSignal" }] : /* istanbul ignore next */ []));
|
|
1999
2031
|
dialogContentConfigSignal = computed(() => this.props()?.dialogContentConfig, ...(ngDevMode ? [{ debugName: "dialogContentConfigSignal" }] : /* istanbul ignore next */ []));
|
|
2000
2032
|
customDetailsConfigSignal = computed(() => this.props()?.customDetailsConfig, ...(ngDevMode ? [{ debugName: "customDetailsConfigSignal" }] : /* istanbul ignore next */ []));
|
|
2001
2033
|
allowCustomizeWithoutDateRangeSignal = computed(() => this.props()?.allowCustomizeWithoutDateRange ?? false, ...(ngDevMode ? [{ debugName: "allowCustomizeWithoutDateRangeSignal" }] : /* istanbul ignore next */ []));
|
|
2002
2034
|
disableCustomizeSignal = computed(() => {
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
}
|
|
2006
|
-
return !this.fieldValue();
|
|
2035
|
+
const fieldValue = this.fieldValueSignal();
|
|
2036
|
+
return this.allowCustomizeWithoutDateRangeSignal() ? false : !fieldValue;
|
|
2007
2037
|
}, ...(ngDevMode ? [{ debugName: "disableCustomizeSignal" }] : /* istanbul ignore next */ []));
|
|
2008
2038
|
_setFieldValue(value) {
|
|
2009
2039
|
try {
|
|
@@ -2019,7 +2049,7 @@ class DbxForgeCalendarDateScheduleRangeFieldComponent {
|
|
|
2019
2049
|
constructor() {
|
|
2020
2050
|
setupMetaTracking(this.elementRef, this.meta, { selector: 'dbx-schedule-selection-calendar-date-range' });
|
|
2021
2051
|
// Convert field value to observable for store sync
|
|
2022
|
-
const fieldValue$ = toObservable(this.
|
|
2052
|
+
const fieldValue$ = toObservable(this.fieldValueSignal);
|
|
2023
2053
|
// Sync field value → store (skip initial emission)
|
|
2024
2054
|
this._syncSub.subscription = fieldValue$
|
|
2025
2055
|
.pipe(skip(1), distinctUntilChanged((a, b) => isSameDateCellScheduleDateRange(a, b)))
|
|
@@ -2097,9 +2127,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
2097
2127
|
* Uses the standard buildValueFieldInputs to bridge the ng-forge field definition
|
|
2098
2128
|
* to the component's input signals.
|
|
2099
2129
|
*
|
|
2100
|
-
* @param fieldDef - Field definition configuration
|
|
2101
|
-
* @param fieldDef.key - Form model key for the field
|
|
2102
|
-
* @returns Signal containing a Record of input names to values for ngComponentOutlet
|
|
2130
|
+
* @param fieldDef - Field definition configuration.
|
|
2131
|
+
* @param fieldDef.key - Form model key for the field.
|
|
2132
|
+
* @returns Signal containing a Record of input names to values for ngComponentOutlet.
|
|
2103
2133
|
*/
|
|
2104
2134
|
function calendarDateScheduleRangeFieldMapper(fieldDef) {
|
|
2105
2135
|
const ctx = resolveValueFieldContext();
|
|
@@ -2121,12 +2151,15 @@ var calendar_schedule_forge_field_component = /*#__PURE__*/Object.freeze({
|
|
|
2121
2151
|
calendarDateScheduleRangeFieldMapper: calendarDateScheduleRangeFieldMapper
|
|
2122
2152
|
});
|
|
2123
2153
|
|
|
2154
|
+
/* eslint-disable @typescript-eslint/no-deprecated -- legacy formly day-selection field factory; replacement is dbxScheduleSelectionCalendarDateDaysForgeFormFields() */
|
|
2155
|
+
// COMPAT: Deprecated aliases
|
|
2124
2156
|
/**
|
|
2125
2157
|
* Creates form fields for selecting which days of the week are enabled in a schedule selection calendar,
|
|
2126
2158
|
* wrapped in a responsive flex layout.
|
|
2127
2159
|
*
|
|
2160
|
+
* @returns Array of Formly field configs with toggle fields for each day of the week.
|
|
2161
|
+
*
|
|
2128
2162
|
* @deprecated Use dbxScheduleSelectionCalendarDateDaysForgeFormFields() instead.
|
|
2129
|
-
* @returns An array of Formly field configs with toggle fields for each day of the week
|
|
2130
2163
|
*/
|
|
2131
2164
|
function dbxScheduleSelectionCalendarDateDaysFormFields() {
|
|
2132
2165
|
const fields = dbxScheduleSelectionCalendarDateDaysFormDayFields();
|
|
@@ -2135,8 +2168,9 @@ function dbxScheduleSelectionCalendarDateDaysFormFields() {
|
|
|
2135
2168
|
/**
|
|
2136
2169
|
* Creates an array of toggle field configs, one for each day of the week, keyed by lowercase day name.
|
|
2137
2170
|
*
|
|
2171
|
+
* @returns The toggle Formly field configs for each day of the week.
|
|
2172
|
+
*
|
|
2138
2173
|
* @deprecated Use forge toggle fields directly.
|
|
2139
|
-
* @returns An array of toggle Formly field configs for each day of the week
|
|
2140
2174
|
*/
|
|
2141
2175
|
function dbxScheduleSelectionCalendarDateDaysFormDayFields() {
|
|
2142
2176
|
return getDaysOfWeekNames(false).map((dayOfWeekName) => {
|
|
@@ -2147,6 +2181,7 @@ function dbxScheduleSelectionCalendarDateDaysFormDayFields() {
|
|
|
2147
2181
|
});
|
|
2148
2182
|
}
|
|
2149
2183
|
|
|
2184
|
+
/* eslint-disable @typescript-eslint/no-deprecated -- legacy formly day-selection component; replacement is DbxScheduleSelectionCalendarDateDaysForgeFormComponent */
|
|
2150
2185
|
/**
|
|
2151
2186
|
* @deprecated Use DbxScheduleSelectionCalendarDateDaysForgeFormComponent instead.
|
|
2152
2187
|
*/
|
|
@@ -2167,6 +2202,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
2167
2202
|
}]
|
|
2168
2203
|
}] });
|
|
2169
2204
|
|
|
2205
|
+
/* eslint-disable @typescript-eslint/no-deprecated -- aggregator NgModule for the deprecated DbxFormCalendarModule; replacement is provideDbxForgeCalendarFieldDeclarations() */
|
|
2170
2206
|
const importsAndExports = [
|
|
2171
2207
|
DbxScheduleSelectionCalendarComponent,
|
|
2172
2208
|
DbxScheduleSelectionCalendarDateDaysComponent,
|