@dereekb/dbx-form 9.24.43 → 9.24.45
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/esm2020/calendar/lib/calendar.schedule.selection.toggle.button.component.mjs +2 -2
- package/esm2020/lib/formly/field/selection/pickable/pickable.list.field.component.mjs +1 -1
- package/esm2020/lib/formly/field/value/date/fixeddaterange.field.component.mjs +46 -4
- package/fesm2015/dereekb-dbx-form-calendar.mjs +1 -1
- package/fesm2015/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2015/dereekb-dbx-form.mjs +47 -5
- package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form-calendar.mjs +1 -1
- package/fesm2020/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form.mjs +46 -5
- package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
- package/lib/formly/field/selection/pickable/pickable.list.field.component.d.ts +1 -1
- package/lib/formly/field/value/date/fixeddaterange.field.component.d.ts +6 -1
- package/mapbox/package.json +4 -4
- package/package.json +4 -4
|
@@ -9,7 +9,7 @@ import * as i2 from '@dereekb/dbx-core';
|
|
|
9
9
|
import { AbstractSubscriptionDirective, safeDetectChanges, DbxInjectionComponentModule, DbxDatePipeModule, mergeDbxInjectionComponentConfigs, tapDetectChanges, DbxValuePipeModule } from '@dereekb/dbx-core';
|
|
10
10
|
import * as i2$1 from '@dereekb/dbx-web';
|
|
11
11
|
import { DbxActionTransitionSafetyDirective, DbxTextModule, DbxLoadingModule, DbxFlexLayoutModule, DbxSectionLayoutModule, DbxRouterAnchorModule, dbxValueListItemDecisionFunction, DbxButtonModule, DbxListLayoutModule, AbstractDbxSelectionListWrapperDirective, DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE, AbstractDbxSelectionListViewDirective, addConfigToValueListItems, provideDbxListView, AbstractDbxValueListViewItemComponent, DbxActionModule, mapCompactModeObs, DbxBarLayoutModule } from '@dereekb/dbx-web';
|
|
12
|
-
import { isPast, addSeconds, startOfDay, addMinutes, addDays } from 'date-fns';
|
|
12
|
+
import { isPast, addSeconds, startOfDay, addMinutes, addDays, isAfter } from 'date-fns';
|
|
13
13
|
import { BehaviorSubject, switchMap, first, exhaustMap, of, catchError, delay, filter, combineLatest, map, distinctUntilChanged, shareReplay, Subject, tap, takeUntil, EMPTY, mergeMap, startWith, debounceTime, skipWhile, scan, combineLatestWith, throttleTime, interval, merge, timer } from 'rxjs';
|
|
14
14
|
import { LockSet, SubscriptionObject, asObservable, cleanup, loadingStateHasFinishedLoading, switchMapMaybeObs, filterMaybe, switchMapMaybeDefault, SimpleLoadingContext, distinctUntilHasDifferentValues, startWithBeginLoading, mapLoadingStateResults, successResult, ListLoadingStateContextInstance, isListLoadingStateEmpty, LoadingStateContextInstance, loadingStateHasValue, loadingStateIsLoading, beginLoading, mapLoadingStateValueWithOperator, valueFromLoadingState, loadingStateContext, skipFirstMaybe, asObservableFromGetter, asyncPusherCache, scanCount } from '@dereekb/rxjs';
|
|
15
15
|
import * as i1$2 from '@ngx-formly/core';
|
|
@@ -1933,7 +1933,7 @@ class DbxPickableListFieldItemListComponent extends AbstractDbxSelectionListWrap
|
|
|
1933
1933
|
}
|
|
1934
1934
|
}
|
|
1935
1935
|
DbxPickableListFieldItemListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxPickableListFieldItemListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1936
|
-
DbxPickableListFieldItemListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxPickableListFieldItemListComponent, selector: "dbx-form-pickable-item-field-item-list", usesInheritance: true, ngImport: i0, template: "\n<dbx-list [state$]=\"state$\" [config]=\"config$ | async\" [disabled]=\"disabled\" [selectionMode]=\"selectionMode\">\n <ng-content top select=\"[top]\"></ng-content>\n <ng-content bottom select=\"[bottom]\"></ng-content>\n <ng-content empty select=\"[empty]\"></ng-content>\n</dbx-list>\n", isInline: true, dependencies: [{ kind: "component", type: i2$1.DbxListComponent, selector: "dbx-list", inputs: ["padded", "state$", "config", "disabled", "selectionMode"], outputs: ["contentScrolled"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
|
|
1936
|
+
DbxPickableListFieldItemListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxPickableListFieldItemListComponent, selector: "dbx-form-pickable-item-field-item-list", usesInheritance: true, ngImport: i0, template: "\n<dbx-list [state$]=\"state$\" [config]=\"config$ | async\" [disabled]=\"disabled\" [selectionMode]=\"selectionMode\">\n <ng-content top select=\"[top]\"></ng-content>\n <ng-content bottom select=\"[bottom]\"></ng-content>\n <ng-content empty select=\"[empty]\"></ng-content>\n <ng-content emptyLoading select=\"[emptyLoading]\"></ng-content>\n</dbx-list>\n", isInline: true, dependencies: [{ kind: "component", type: i2$1.DbxListComponent, selector: "dbx-list", inputs: ["padded", "state$", "config", "disabled", "selectionMode"], outputs: ["contentScrolled"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
|
|
1937
1937
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxPickableListFieldItemListComponent, decorators: [{
|
|
1938
1938
|
type: Component,
|
|
1939
1939
|
args: [{
|
|
@@ -4321,6 +4321,7 @@ class DbxFixedDateRangeFieldComponent extends FieldType$1 {
|
|
|
4321
4321
|
}
|
|
4322
4322
|
dateRangeSelectionForMode(mode) {
|
|
4323
4323
|
const result = combineLatest([this.dateRangeInput$, this.limitDateTimeInstance$]).pipe(switchMap(([dateRangeInput, limitInstance]) => {
|
|
4324
|
+
const hasDateRangeConfiguration = Boolean(dateRangeInput);
|
|
4324
4325
|
const minMaxClamp = (dateRange) => limitInstance.clampDateRange(dateRange);
|
|
4325
4326
|
if (mode === 'single') {
|
|
4326
4327
|
// only use the start date.
|
|
@@ -4333,6 +4334,7 @@ class DbxFixedDateRangeFieldComponent extends FieldType$1 {
|
|
|
4333
4334
|
// take the first date, then wait unless the date is outside of the range.
|
|
4334
4335
|
return this.selectedDateRange$.pipe(scan((acc, nextDateRange) => {
|
|
4335
4336
|
let result;
|
|
4337
|
+
let pickType = 'start';
|
|
4336
4338
|
if (nextDateRange && nextDateRange.start != null) {
|
|
4337
4339
|
const { start: startOrNextDate, end } = nextDateRange;
|
|
4338
4340
|
const potentialBoundary = dateRange({ ...dateRangeInput, date: startOrNextDate });
|
|
@@ -4348,7 +4350,43 @@ class DbxFixedDateRangeFieldComponent extends FieldType$1 {
|
|
|
4348
4350
|
else {
|
|
4349
4351
|
let range = undefined;
|
|
4350
4352
|
let boundary = potentialBoundary;
|
|
4351
|
-
if (
|
|
4353
|
+
if (mode === 'normal') {
|
|
4354
|
+
if (!hasDateRangeConfiguration) {
|
|
4355
|
+
// if there is no configured range/boundary, then just set the pick type based on the last type
|
|
4356
|
+
boundary = undefined;
|
|
4357
|
+
pickType = acc.lastPickType === 'start' ? 'end' : 'start';
|
|
4358
|
+
}
|
|
4359
|
+
else {
|
|
4360
|
+
// if the pick is outside the boundary, then consider it a start pick type.
|
|
4361
|
+
pickType = acc.lastPickType === 'start' && acc.boundary && isDateInDateRange(startOrNextDate, acc.boundary) ? 'end' : 'start';
|
|
4362
|
+
}
|
|
4363
|
+
// assert the start exists from the previous click, otherwise clear it.
|
|
4364
|
+
if (pickType === 'end') {
|
|
4365
|
+
const lastStart = acc.lastDateRange?.start;
|
|
4366
|
+
if (!lastStart || !isAfter(startOrNextDate, lastStart)) {
|
|
4367
|
+
pickType = 'start';
|
|
4368
|
+
}
|
|
4369
|
+
}
|
|
4370
|
+
// react based on how this
|
|
4371
|
+
switch (pickType) {
|
|
4372
|
+
case 'end':
|
|
4373
|
+
// if we're picking the end then set the range.
|
|
4374
|
+
range = {
|
|
4375
|
+
start: acc.lastDateRange?.start,
|
|
4376
|
+
end: startOrNextDate
|
|
4377
|
+
};
|
|
4378
|
+
boundary = range;
|
|
4379
|
+
break;
|
|
4380
|
+
case 'start':
|
|
4381
|
+
// retain the boundary as potential boundary, and set our new range from the single date.
|
|
4382
|
+
range = {
|
|
4383
|
+
start: startOrNextDate,
|
|
4384
|
+
end: startOrNextDate
|
|
4385
|
+
};
|
|
4386
|
+
break;
|
|
4387
|
+
}
|
|
4388
|
+
}
|
|
4389
|
+
else if (acc.boundary && isDateInDateRange(startOrNextDate, acc.boundary)) {
|
|
4352
4390
|
// if in the date range, uses the pick as the last date.
|
|
4353
4391
|
range = {
|
|
4354
4392
|
start: acc.boundary.start,
|
|
@@ -4366,6 +4404,7 @@ class DbxFixedDateRangeFieldComponent extends FieldType$1 {
|
|
|
4366
4404
|
}
|
|
4367
4405
|
}
|
|
4368
4406
|
else {
|
|
4407
|
+
// retain same boundary
|
|
4369
4408
|
boundary = acc.boundary;
|
|
4370
4409
|
}
|
|
4371
4410
|
}
|
|
@@ -4386,6 +4425,7 @@ class DbxFixedDateRangeFieldComponent extends FieldType$1 {
|
|
|
4386
4425
|
}
|
|
4387
4426
|
if (result) {
|
|
4388
4427
|
result = {
|
|
4428
|
+
lastPickType: pickType,
|
|
4389
4429
|
lastDateRange: result.lastDateRange,
|
|
4390
4430
|
boundary: result.boundary ? minMaxClamp(result.boundary) : undefined,
|
|
4391
4431
|
range: result.range ? minMaxClamp(result.range) : undefined
|
|
@@ -4602,10 +4642,11 @@ class DbxFixedDateRangeFieldSelectionStrategy {
|
|
|
4602
4642
|
return currentRange;
|
|
4603
4643
|
}
|
|
4604
4644
|
createPreview(activeDate, currentRange, event) {
|
|
4605
|
-
|
|
4645
|
+
const { currentSelectionMode } = this.dbxFixedDateRangeFieldComponent;
|
|
4646
|
+
if (activeDate != null && currentSelectionMode !== 'single') {
|
|
4606
4647
|
const latestBoundary = this.dbxFixedDateRangeFieldComponent.latestBoundary;
|
|
4607
4648
|
const date = this.dateFromAdapterDate(activeDate);
|
|
4608
|
-
if (latestBoundary && isDateInDateRange(date, latestBoundary)) {
|
|
4649
|
+
if (latestBoundary && (currentSelectionMode === 'normal' || isDateInDateRange(date, latestBoundary))) {
|
|
4609
4650
|
const exampleDateRange = this._createDateRange(latestBoundary);
|
|
4610
4651
|
return exampleDateRange;
|
|
4611
4652
|
}
|