@dereekb/dbx-form 9.15.6 → 9.15.7
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/lib/formly/field/checklist/checklist.item.field.mjs +3 -3
- package/esm2020/lib/formly/field/field.mjs +19 -3
- package/esm2020/lib/formly/field/selection/pickable/pickable.field.mjs +4 -4
- package/esm2020/lib/formly/field/selection/searchable/searchable.field.mjs +4 -4
- package/esm2020/lib/formly/field/selection/selection.field.mjs +3 -3
- package/esm2020/lib/formly/field/texteditor/texteditor.field.mjs +3 -3
- package/esm2020/lib/formly/field/value/array/array.field.mjs +3 -3
- package/esm2020/lib/formly/field/value/boolean/boolean.field.mjs +4 -4
- package/esm2020/lib/formly/field/value/date/datetime.field.component.mjs +110 -15
- package/esm2020/lib/formly/field/value/date/datetime.field.mjs +32 -6
- package/esm2020/lib/formly/field/value/number/number.field.mjs +19 -4
- package/esm2020/lib/formly/field/value/phone/phone.field.mjs +3 -3
- package/esm2020/lib/formly/field/value/text/text.additional.field.mjs +5 -2
- package/esm2020/lib/formly/field/value/text/text.field.mjs +24 -7
- package/esm2020/lib/formly/field/wrapper/section.wrapper.component.mjs +1 -1
- package/esm2020/lib/formly/field/wrapper/subsection.wrapper.component.mjs +1 -1
- package/esm2020/lib/validator/number.mjs +7 -1
- package/esm2020/mapbox/lib/field/latlng/latlng.field.mjs +3 -3
- package/esm2020/mapbox/lib/field/zoom/zoom.field.mjs +3 -3
- package/fesm2015/dereekb-dbx-form-mapbox.mjs +3 -3
- package/fesm2015/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/fesm2015/dereekb-dbx-form.mjs +195 -39
- package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form-mapbox.mjs +3 -3
- package/fesm2020/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form.mjs +214 -38
- package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
- package/lib/formly/field/field.d.ts +29 -3
- package/lib/formly/field/value/array/array.field.d.ts +6 -0
- package/lib/formly/field/value/date/datetime.field.component.d.ts +45 -3
- package/lib/formly/field/value/date/datetime.field.d.ts +5 -0
- package/lib/formly/field/value/number/number.field.d.ts +4 -2
- package/lib/formly/field/value/text/text.additional.field.d.ts +3 -6
- package/lib/formly/field/value/text/text.field.d.ts +6 -3
- package/lib/formly/field/wrapper/section.wrapper.component.d.ts +1 -2
- package/lib/formly/field/wrapper/subsection.wrapper.component.d.ts +1 -2
- package/lib/formly/field/wrapper/wrapper.d.ts +2 -2
- package/lib/validator/number.d.ts +6 -0
- package/mapbox/esm2020/lib/field/latlng/latlng.field.mjs +3 -3
- package/mapbox/esm2020/lib/field/zoom/zoom.field.mjs +3 -3
- package/mapbox/fesm2015/dereekb-dbx-form-mapbox.mjs +3 -3
- package/mapbox/fesm2015/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/mapbox/fesm2020/dereekb-dbx-form-mapbox.mjs +3 -3
- package/mapbox/fesm2020/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/mapbox/package.json +4 -4
- package/package.json +4 -4
|
@@ -9,9 +9,9 @@ import * as i2 from '@dereekb/dbx-core';
|
|
|
9
9
|
import { AbstractSubscriptionDirective, safeDetectChanges, DbxInjectionComponentModule, DbxDatePipeModule, mergeDbxInjectionComponentConfigs, tapDetectChanges } from '@dereekb/dbx-core';
|
|
10
10
|
import * as i1$1 from '@dereekb/dbx-web';
|
|
11
11
|
import { DbxActionTransitionSafetyDirective, DbxTextModule, DbxLoadingModule, DbxFlexLayoutModule, DbxSectionLayoutModule, DbxRouterAnchorModule, AbstractDbxSelectionListWrapperDirective, DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE, AbstractDbxSelectionListViewDirective, addConfigToValueListItems, provideDbxListView, AbstractDbxValueListViewItemComponent, DbxButtonModule, DbxListLayoutModule, mapCompactModeObs, DbxBarLayoutModule } from '@dereekb/dbx-web';
|
|
12
|
-
import { isPast, addSeconds, isSameMinute, startOfDay, isSameDay, addMinutes } from 'date-fns';
|
|
12
|
+
import { isPast, addSeconds, isSameMinute, startOfDay, isSameDay, addMinutes, addDays } from 'date-fns';
|
|
13
13
|
import { BehaviorSubject, switchMap, first, exhaustMap, of, catchError, delay, filter, combineLatest, map, distinctUntilChanged, mergeMap, shareReplay, startWith, debounceTime, Subject, skipWhile, interval, tap, merge, throttleTime, scan, timer } from 'rxjs';
|
|
14
|
-
import { LockSet, SubscriptionObject, asObservable, loadingStateHasFinishedLoading, switchMapMaybeObs, filterMaybe, switchMapMaybeDefault, SimpleLoadingContext, startWithBeginLoading, mapLoadingStateResults, successResult, ListLoadingStateContextInstance, isListLoadingStateEmpty, LoadingStateContextInstance,
|
|
14
|
+
import { LockSet, SubscriptionObject, asObservable, loadingStateHasFinishedLoading, switchMapMaybeObs, filterMaybe, switchMapMaybeDefault, SimpleLoadingContext, startWithBeginLoading, mapLoadingStateResults, successResult, ListLoadingStateContextInstance, isListLoadingStateEmpty, LoadingStateContextInstance, skipFirstMaybe, asyncPusherCache, scanCount } from '@dereekb/rxjs';
|
|
15
15
|
import * as i1$3 from '@ngx-formly/core';
|
|
16
16
|
import { FieldType, FieldWrapper, FormlyModule, FieldArrayType } from '@ngx-formly/core';
|
|
17
17
|
import * as i3$1 from '@angular/forms';
|
|
@@ -26,7 +26,7 @@ import * as i1$2 from '@angular/material/button';
|
|
|
26
26
|
import { MatButtonModule } from '@angular/material/button';
|
|
27
27
|
import * as i3$3 from '@angular/flex-layout/flex';
|
|
28
28
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
29
|
-
import { objectIsEmpty, mergeObjectsFunction, filterFromPOJOFunction, mergeObjects, filterFromPOJO, asArray, objectHasNoKeys, addPlusPrefixToNumber, convertMaybeToArray, makeValuesGroupMap, findUnique, searchStringFilterFunction, caseInsensitiveFilterByIndexOfDecisionFactory, mergeIntoArray, lastValue, separateValues, arrayToMap, getValueFromGetter, dateFromLogicalDate, WEBSITE_DOMAIN_NAME_REGEX, KeyValueTypleValueFilter, valuesFromPOJO, allObjectsAreEqual, isNumberDivisibleBy, nearestDivisibleValues, US_STATE_CODE_STRING_REGEX, ZIP_CODE_STRING_REGEX, LAT_LNG_PATTERN, capitalizeFirstLetter, BooleanStringKeyArrayUtilityInstance } from '@dereekb/util';
|
|
29
|
+
import { objectIsEmpty, mergeObjectsFunction, filterFromPOJOFunction, mergeObjects, filterFromPOJO, asArray, objectHasNoKeys, addPlusPrefixToNumber, convertMaybeToArray, makeValuesGroupMap, findUnique, searchStringFilterFunction, caseInsensitiveFilterByIndexOfDecisionFactory, mergeIntoArray, lastValue, separateValues, arrayToMap, getValueFromGetter, filterMaybeValues, dateFromLogicalDate, WEBSITE_DOMAIN_NAME_REGEX, KeyValueTypleValueFilter, valuesFromPOJO, allObjectsAreEqual, isNumberDivisibleBy, nearestDivisibleValues, transformNumberFunction, concatArrays, transformStringFunction, US_STATE_CODE_STRING_REGEX, ZIP_CODE_STRING_REGEX, LAT_LNG_PATTERN, capitalizeFirstLetter, BooleanStringKeyArrayUtilityInstance } from '@dereekb/util';
|
|
30
30
|
import * as i2$1 from '@angular/material/slide-toggle';
|
|
31
31
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
32
32
|
import * as i2$2 from '@angular/flex-layout/extended';
|
|
@@ -44,7 +44,7 @@ import { MatListModule } from '@angular/material/list';
|
|
|
44
44
|
import * as i3$4 from '@angular/material/form-field';
|
|
45
45
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
46
46
|
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
47
|
-
import { skipUntilTimeElapsedAfterLastEmission, toJsDate, parseISO8601DayStringToDate, formatToISO8601DayString, formatToISO8601DateString, guessCurrentTimezone, toReadableTimeString, utcDayForDate, readableTimeStringToDate, DateTimeMinuteInstance, toLocalReadableTimeString, allTimezoneInfos, timezoneInfoForSystem, searchTimezoneInfos } from '@dereekb/date';
|
|
47
|
+
import { skipUntilTimeElapsedAfterLastEmission, toJsDate, parseISO8601DayStringToDate, formatToISO8601DayString, formatToISO8601DateString, safeToJsDate, guessCurrentTimezone, toReadableTimeString, utcDayForDate, readableTimeStringToDate, findMinDate, findMaxDate, DateTimeMinuteInstance, toLocalReadableTimeString, allTimezoneInfos, timezoneInfoForSystem, searchTimezoneInfos } from '@dereekb/date';
|
|
48
48
|
import * as i4$4 from 'ngx-editor';
|
|
49
49
|
import { Editor, NgxEditorModule } from 'ngx-editor';
|
|
50
50
|
import * as i4$5 from '@angular/cdk/drag-drop';
|
|
@@ -1163,10 +1163,20 @@ function formlyField(fieldConfig) {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
return fieldConfig;
|
|
1165
1165
|
}
|
|
1166
|
-
|
|
1166
|
+
/**
|
|
1167
|
+
* Creates an object with propers, expressions, and parsers properly configured from the input FieldConfig.
|
|
1168
|
+
*
|
|
1169
|
+
* @param fieldConfig
|
|
1170
|
+
* @param override
|
|
1171
|
+
* @returns
|
|
1172
|
+
*/
|
|
1173
|
+
function propsAndConfigForFieldConfig(fieldConfig, override) {
|
|
1174
|
+
const { expressions, parsers } = fieldConfig;
|
|
1167
1175
|
const props = propsValueForFieldConfig(fieldConfig, override);
|
|
1168
1176
|
return {
|
|
1169
|
-
props
|
|
1177
|
+
props,
|
|
1178
|
+
expressions,
|
|
1179
|
+
parsers
|
|
1170
1180
|
};
|
|
1171
1181
|
}
|
|
1172
1182
|
const partialPotentialFieldConfigKeys = ['label', 'placeholder', 'required', 'readonly', 'description', 'autocomplete'];
|
|
@@ -1238,13 +1248,19 @@ function validatorsForFieldConfig(input) {
|
|
|
1238
1248
|
}
|
|
1239
1249
|
return config;
|
|
1240
1250
|
}
|
|
1251
|
+
/**
|
|
1252
|
+
* MARK: Compat
|
|
1253
|
+
*
|
|
1254
|
+
* @deprecated use propsAndConfigForFieldConfig instead.
|
|
1255
|
+
*/
|
|
1256
|
+
const propsForFieldConfig = propsAndConfigForFieldConfig;
|
|
1241
1257
|
|
|
1242
1258
|
function checklistItemField(config) {
|
|
1243
1259
|
const { key, displayContentObs, componentClass } = config;
|
|
1244
1260
|
const fieldConfig = formlyField({
|
|
1245
1261
|
key,
|
|
1246
1262
|
type: 'checklistitem',
|
|
1247
|
-
...
|
|
1263
|
+
...propsAndConfigForFieldConfig(config, {
|
|
1248
1264
|
displayContentObs,
|
|
1249
1265
|
componentClass
|
|
1250
1266
|
})
|
|
@@ -1867,7 +1883,7 @@ function pickableItemChipField(config) {
|
|
|
1867
1883
|
return formlyField({
|
|
1868
1884
|
key,
|
|
1869
1885
|
type: 'pickablechipfield',
|
|
1870
|
-
...
|
|
1886
|
+
...propsAndConfigForFieldConfig(config, {
|
|
1871
1887
|
...config,
|
|
1872
1888
|
autocomplete: false
|
|
1873
1889
|
})
|
|
@@ -1878,7 +1894,7 @@ function pickableItemListField(config) {
|
|
|
1878
1894
|
return formlyField({
|
|
1879
1895
|
key,
|
|
1880
1896
|
type: 'pickablelistfield',
|
|
1881
|
-
...
|
|
1897
|
+
...propsAndConfigForFieldConfig(config, {
|
|
1882
1898
|
...config,
|
|
1883
1899
|
autocomplete: false
|
|
1884
1900
|
})
|
|
@@ -2300,7 +2316,7 @@ function searchableChipField(config) {
|
|
|
2300
2316
|
return formlyField({
|
|
2301
2317
|
key,
|
|
2302
2318
|
type: 'searchablechipfield',
|
|
2303
|
-
...
|
|
2319
|
+
...propsAndConfigForFieldConfig(config, {
|
|
2304
2320
|
...config,
|
|
2305
2321
|
placeholder: placeholder ?? 'Add...',
|
|
2306
2322
|
autocomplete: false
|
|
@@ -2312,7 +2328,7 @@ function searchableTextField(config) {
|
|
|
2312
2328
|
return formlyField({
|
|
2313
2329
|
key,
|
|
2314
2330
|
type: 'searchabletextfield',
|
|
2315
|
-
...
|
|
2331
|
+
...propsAndConfigForFieldConfig(config, {
|
|
2316
2332
|
...config,
|
|
2317
2333
|
autocomplete: false
|
|
2318
2334
|
})
|
|
@@ -2457,7 +2473,7 @@ function valueSelectionField(config) {
|
|
|
2457
2473
|
return formlyField({
|
|
2458
2474
|
key,
|
|
2459
2475
|
type: native ? 'native-select' : 'select',
|
|
2460
|
-
...
|
|
2476
|
+
...propsAndConfigForFieldConfig(config, {
|
|
2461
2477
|
options: config.options,
|
|
2462
2478
|
multiple: config.multiple ?? false,
|
|
2463
2479
|
...selectAllOptionConfig
|
|
@@ -2610,7 +2626,7 @@ function textEditorField(config) {
|
|
|
2610
2626
|
// Set to trigger value update on blurs with the form. However, the value is set internally too.
|
|
2611
2627
|
updateOn: 'blur'
|
|
2612
2628
|
},
|
|
2613
|
-
...
|
|
2629
|
+
...propsAndConfigForFieldConfig(config, {
|
|
2614
2630
|
minLength,
|
|
2615
2631
|
maxLength
|
|
2616
2632
|
})
|
|
@@ -2792,7 +2808,7 @@ function repeatArrayField(config) {
|
|
|
2792
2808
|
return formlyField({
|
|
2793
2809
|
key,
|
|
2794
2810
|
type: 'repeatarray',
|
|
2795
|
-
...
|
|
2811
|
+
...propsAndConfigForFieldConfig(config, {
|
|
2796
2812
|
maxLength,
|
|
2797
2813
|
labelForField,
|
|
2798
2814
|
addText,
|
|
@@ -2825,7 +2841,7 @@ function toggleField(config) {
|
|
|
2825
2841
|
type: 'toggle',
|
|
2826
2842
|
wrappers: ['autotouch', 'form-field'],
|
|
2827
2843
|
defaultValue: defaultValue ?? false,
|
|
2828
|
-
...
|
|
2844
|
+
...propsAndConfigForFieldConfig(config)
|
|
2829
2845
|
});
|
|
2830
2846
|
}
|
|
2831
2847
|
function checkboxField(config) {
|
|
@@ -2834,7 +2850,7 @@ function checkboxField(config) {
|
|
|
2834
2850
|
key,
|
|
2835
2851
|
type: 'checkbox',
|
|
2836
2852
|
defaultValue: defaultValue ?? false,
|
|
2837
|
-
...
|
|
2853
|
+
...propsAndConfigForFieldConfig(config)
|
|
2838
2854
|
});
|
|
2839
2855
|
}
|
|
2840
2856
|
/*
|
|
@@ -2918,6 +2934,20 @@ function dbxDateTimeOutputValueFactory(mode) {
|
|
|
2918
2934
|
}
|
|
2919
2935
|
return factory;
|
|
2920
2936
|
}
|
|
2937
|
+
function syncConfigValueObs(parseConfigsObs, type) {
|
|
2938
|
+
return parseConfigsObs.pipe(switchMap((x) => {
|
|
2939
|
+
const config = x.find((y) => y.syncType === type);
|
|
2940
|
+
let result;
|
|
2941
|
+
if (config) {
|
|
2942
|
+
const { control } = config;
|
|
2943
|
+
result = control.valueChanges.pipe(startWith(control.value), map(safeToJsDate));
|
|
2944
|
+
}
|
|
2945
|
+
else {
|
|
2946
|
+
result = of(undefined);
|
|
2947
|
+
}
|
|
2948
|
+
return result;
|
|
2949
|
+
}), distinctUntilChanged(), shareReplay(1));
|
|
2950
|
+
}
|
|
2921
2951
|
class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
2922
2952
|
constructor(cdRef) {
|
|
2923
2953
|
super();
|
|
@@ -2947,13 +2977,40 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2947
2977
|
validators: [Validators.pattern(/^(now)$|^([0-9]|(0[0-9])|(1[0-9])|(2[0-3]))(:)?([0-5][0-9])?(\s)?([apAP][Mm])?(\\s)*$/)]
|
|
2948
2978
|
});
|
|
2949
2979
|
this._config = new BehaviorSubject(undefined);
|
|
2980
|
+
this._syncConfigObs = new BehaviorSubject(undefined);
|
|
2950
2981
|
this.fullDay$ = this.fullDayControl$.pipe(switchMap((control) => control.valueChanges.pipe(startWith(control.value))));
|
|
2951
2982
|
this.showTimeInput$ = this.fullDay$.pipe(map((x) => !x && this.timeMode !== DbxDateTimeFieldTimeMode.NONE));
|
|
2952
2983
|
this.showAddTime$ = this.showTimeInput$.pipe(map((x) => !x && this.timeMode === DbxDateTimeFieldTimeMode.OPTIONAL), shareReplay(1));
|
|
2953
2984
|
this.date$ = this.dateInputCtrl.valueChanges.pipe(startWith(this.dateInputCtrl.value), filterMaybe(), shareReplay(1));
|
|
2954
|
-
this.dateValue$ = merge(this.date
|
|
2985
|
+
this.dateValue$ = merge(this.date$, this.value$.pipe(skipFirstMaybe())).pipe(map((x) => (x ? startOfDay(x) : x)), distinctUntilChanged((a, b) => a != null && b != null && isSameDay(a, b)), shareReplay(1));
|
|
2955
2986
|
this.timeInput$ = this._updateTime.pipe(debounceTime(5), map(() => this.timeInputCtrl.value || ''), distinctUntilChanged());
|
|
2956
|
-
this.
|
|
2987
|
+
this.syncConfigObs$ = this._syncConfigObs.pipe(switchMapMaybeDefault(), shareReplay(1));
|
|
2988
|
+
this.parsedSyncConfigs$ = this.syncConfigObs$.pipe(map((x) => {
|
|
2989
|
+
let parsed;
|
|
2990
|
+
if (x) {
|
|
2991
|
+
parsed = filterMaybeValues(asArray(x).map((y) => {
|
|
2992
|
+
const control = this.form.get(y.syncWith);
|
|
2993
|
+
if (control) {
|
|
2994
|
+
return {
|
|
2995
|
+
control,
|
|
2996
|
+
...y
|
|
2997
|
+
};
|
|
2998
|
+
}
|
|
2999
|
+
else {
|
|
3000
|
+
return undefined;
|
|
3001
|
+
}
|
|
3002
|
+
}));
|
|
3003
|
+
}
|
|
3004
|
+
else {
|
|
3005
|
+
parsed = [];
|
|
3006
|
+
}
|
|
3007
|
+
return parsed;
|
|
3008
|
+
}), shareReplay(1));
|
|
3009
|
+
this.syncConfigBeforeValue$ = syncConfigValueObs(this.parsedSyncConfigs$, 'before');
|
|
3010
|
+
this.syncConfigAfterValue$ = syncConfigValueObs(this.parsedSyncConfigs$, 'after');
|
|
3011
|
+
// TODO: Get min/max using the DateTimePickerConfiguration too
|
|
3012
|
+
this.dateInputMin$ = this.syncConfigBeforeValue$;
|
|
3013
|
+
this.dateInputMax$ = this.syncConfigAfterValue$;
|
|
2957
3014
|
this.rawDateTime$ = combineLatest([this.dateValue$, this.timeInput$.pipe(startWith(null)), this.fullDay$]).pipe(map(([date, timeString, fullDay]) => {
|
|
2958
3015
|
let result;
|
|
2959
3016
|
if (date) {
|
|
@@ -2978,7 +3035,24 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2978
3035
|
}
|
|
2979
3036
|
return result;
|
|
2980
3037
|
}), distinctUntilChanged((a, b) => a != null && b != null && isSameMinute(a, b)), shareReplay(1));
|
|
2981
|
-
this.
|
|
3038
|
+
this.config$ = combineLatest([this._config.pipe(switchMapMaybeDefault(), shareReplay(1)), this.dateInputMin$, this.dateInputMax$]).pipe(map(([x, dateInputMin, dateInputMax]) => {
|
|
3039
|
+
let result = x;
|
|
3040
|
+
if (dateInputMin != null || dateInputMax != null) {
|
|
3041
|
+
const { min: limitMin, max: limitMax } = x?.limits ?? {};
|
|
3042
|
+
const min = findMinDate([dateInputMin, limitMin]);
|
|
3043
|
+
const max = findMaxDate([dateInputMax, limitMax]);
|
|
3044
|
+
result = {
|
|
3045
|
+
...x,
|
|
3046
|
+
limits: {
|
|
3047
|
+
...x?.limits,
|
|
3048
|
+
min,
|
|
3049
|
+
max
|
|
3050
|
+
}
|
|
3051
|
+
};
|
|
3052
|
+
}
|
|
3053
|
+
return result;
|
|
3054
|
+
}), distinctUntilChanged(), shareReplay(1));
|
|
3055
|
+
this.timeOutput$ = combineLatest([this.rawDateTime$, this._offset, this.config$]).pipe(throttleTime(40, undefined, { leading: false, trailing: true }), distinctUntilChanged((current, next) => current[0] === next[0] && next[1] === 0), tap(([, stepsOffset]) => (stepsOffset ? this._offset.next(0) : 0)), map(([date, stepsOffset, config]) => {
|
|
2982
3056
|
if (date != null) {
|
|
2983
3057
|
const instance = new DateTimeMinuteInstance({
|
|
2984
3058
|
date,
|
|
@@ -2992,6 +3066,12 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2992
3066
|
return date;
|
|
2993
3067
|
}), distinctUntilChanged((a, b) => a != null && b != null && isSameMinute(a, b)), shareReplay(1));
|
|
2994
3068
|
}
|
|
3069
|
+
get dateLabel() {
|
|
3070
|
+
return this.props.dateLabel ?? 'Date';
|
|
3071
|
+
}
|
|
3072
|
+
get timeLabel() {
|
|
3073
|
+
return this.props.timeLabel ?? 'Time';
|
|
3074
|
+
}
|
|
2995
3075
|
get dateOnly() {
|
|
2996
3076
|
return this.timeMode === DbxDateTimeFieldTimeMode.NONE;
|
|
2997
3077
|
}
|
|
@@ -3019,6 +3099,7 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
3019
3099
|
ngOnInit() {
|
|
3020
3100
|
this._formControlObs.next(this.formControl);
|
|
3021
3101
|
this._config.next(this.dateTimeField.getConfigObs?.());
|
|
3102
|
+
this._syncConfigObs.next(this.dateTimeField.getSyncFieldsObs?.());
|
|
3022
3103
|
const valueFactory = dbxDateTimeOutputValueFactory(this.valueMode);
|
|
3023
3104
|
this._sub.subscription = this.timeOutput$.pipe(skipFirstMaybe()).subscribe((dateValue) => {
|
|
3024
3105
|
const value = valueFactory(dateValue);
|
|
@@ -3076,15 +3157,14 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
3076
3157
|
this._formControlObs.complete();
|
|
3077
3158
|
this._config.complete();
|
|
3078
3159
|
this._updateTime.complete();
|
|
3160
|
+
this._syncConfigObs.complete();
|
|
3079
3161
|
this._sub.destroy();
|
|
3080
3162
|
this._valueSub.destroy();
|
|
3081
3163
|
}
|
|
3082
3164
|
datePicked(event) {
|
|
3083
3165
|
const date = event.value;
|
|
3084
|
-
console.log('date picked?', event);
|
|
3085
3166
|
if (date) {
|
|
3086
|
-
this.
|
|
3087
|
-
this._updateTime.next();
|
|
3167
|
+
this.setDateInputValue(date);
|
|
3088
3168
|
}
|
|
3089
3169
|
}
|
|
3090
3170
|
setLogicalTime(time) {
|
|
@@ -3094,12 +3174,43 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
3094
3174
|
this.setTime(timeString);
|
|
3095
3175
|
}
|
|
3096
3176
|
}
|
|
3177
|
+
setDateInputValue(date) {
|
|
3178
|
+
this.dateInputCtrl.setValue(date);
|
|
3179
|
+
this._updateTime.next();
|
|
3180
|
+
}
|
|
3097
3181
|
setTime(time) {
|
|
3098
3182
|
this.timeInputCtrl.setValue(time);
|
|
3099
3183
|
this._offset.next(0);
|
|
3100
3184
|
this._updateTime.next();
|
|
3101
3185
|
}
|
|
3102
|
-
|
|
3186
|
+
keydownOnDateInput(event) {
|
|
3187
|
+
let direction = 0;
|
|
3188
|
+
switch (event.key?.toLowerCase()) {
|
|
3189
|
+
case 'arrowup':
|
|
3190
|
+
direction = 1;
|
|
3191
|
+
break;
|
|
3192
|
+
case 'arrowdown':
|
|
3193
|
+
direction = -1;
|
|
3194
|
+
break;
|
|
3195
|
+
}
|
|
3196
|
+
let offset = 1;
|
|
3197
|
+
if (event.ctrlKey && event.shiftKey) {
|
|
3198
|
+
offset = 365;
|
|
3199
|
+
}
|
|
3200
|
+
else if (event.ctrlKey) {
|
|
3201
|
+
offset = 30;
|
|
3202
|
+
}
|
|
3203
|
+
else if (event.shiftKey) {
|
|
3204
|
+
offset = 7;
|
|
3205
|
+
}
|
|
3206
|
+
if (direction !== 0) {
|
|
3207
|
+
this.date$.pipe(first()).subscribe((date) => {
|
|
3208
|
+
const newDate = addDays(date, offset * direction);
|
|
3209
|
+
this.setDateInputValue(newDate);
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
keydownOnTimeInput(event) {
|
|
3103
3214
|
let direction = 0;
|
|
3104
3215
|
switch (event.key?.toLowerCase()) {
|
|
3105
3216
|
case 'arrowup':
|
|
@@ -3143,10 +3254,10 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
3143
3254
|
}
|
|
3144
3255
|
}
|
|
3145
3256
|
DbxDateTimeFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxDateTimeFieldComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3146
|
-
DbxDateTimeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxDateTimeFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div class=\"add-time-button-wrapper\" *ngIf=\"showAddTime$ | async\">\n <button mat-button class=\"add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon>\n Add Time\n </button>\n </div>\n </div>\n <div *ngIf=\"!hideDateHint\" class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\">\n <b class=\"dbx-ok\">All Day</b>\n {{
|
|
3257
|
+
DbxDateTimeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxDateTimeFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div class=\"add-time-button-wrapper\" *ngIf=\"showAddTime$ | async\">\n <button mat-button class=\"add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon>\n Add Time\n </button>\n </div>\n </div>\n <div *ngIf=\"!hideDateHint\" class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\">\n <b class=\"dbx-ok\">All Day</b>\n {{ displayValue$ | async | date: 'fullDate' }} ({{ displayValue$ | async | dateDistance }})\n </small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\">\n <b class=\"dbx-ok\">At</b>\n {{ displayValue$ | async | date: 'medium' }} ({{ displayValue$ | async | timeDistance }})\n </ng-container>\n </small>\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button mat-icon-button (click)=\"picker.open()\" [disabled]=\"disabled\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>{{ dateLabel }}</mat-label>\n <input #dateInput matInput [min]=\"dateInputMin$ | async\" [max]=\"dateInputMax$ | async\" [matDatepicker]=\"picker\" (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\" (keydown)=\"keydownOnDateInput($event)\" />\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\" [disabled]=\"disabled\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setLogicalTime('now')\">\n <span>Now</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>{{ timeLabel }}</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\" (keydown)=\"keydownOnTimeInput($event)\" />\n </mat-form-field>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i3$4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i1$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i7.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i8.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i8.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i8.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i3$3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3$3.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i3$3.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i2$2.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "pipe", type: i2.TimeDistancePipe, name: "timeDistance" }, { kind: "pipe", type: i2.DateDistancePipe, name: "dateDistance" }] });
|
|
3147
3258
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxDateTimeFieldComponent, decorators: [{
|
|
3148
3259
|
type: Component,
|
|
3149
|
-
args: [{ template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div class=\"add-time-button-wrapper\" *ngIf=\"showAddTime$ | async\">\n <button mat-button class=\"add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon>\n Add Time\n </button>\n </div>\n </div>\n <div *ngIf=\"!hideDateHint\" class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\">\n <b class=\"dbx-ok\">All Day</b>\n {{
|
|
3260
|
+
args: [{ template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div class=\"add-time-button-wrapper\" *ngIf=\"showAddTime$ | async\">\n <button mat-button class=\"add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon>\n Add Time\n </button>\n </div>\n </div>\n <div *ngIf=\"!hideDateHint\" class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\">\n <b class=\"dbx-ok\">All Day</b>\n {{ displayValue$ | async | date: 'fullDate' }} ({{ displayValue$ | async | dateDistance }})\n </small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\">\n <b class=\"dbx-ok\">At</b>\n {{ displayValue$ | async | date: 'medium' }} ({{ displayValue$ | async | timeDistance }})\n </ng-container>\n </small>\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button mat-icon-button (click)=\"picker.open()\" [disabled]=\"disabled\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>{{ dateLabel }}</mat-label>\n <input #dateInput matInput [min]=\"dateInputMin$ | async\" [max]=\"dateInputMax$ | async\" [matDatepicker]=\"picker\" (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\" (keydown)=\"keydownOnDateInput($event)\" />\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\" [disabled]=\"disabled\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setLogicalTime('now')\">\n <span>Now</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>{{ timeLabel }}</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\" (keydown)=\"keydownOnTimeInput($event)\" />\n </mat-form-field>\n</ng-template>\n" }]
|
|
3150
3261
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
3151
3262
|
|
|
3152
3263
|
class DbxFormFormlyDateFieldModule {
|
|
@@ -3225,24 +3336,50 @@ function timeOnlyField(config = {}) {
|
|
|
3225
3336
|
});
|
|
3226
3337
|
}
|
|
3227
3338
|
function dateTimeField(config = {}) {
|
|
3228
|
-
const { key = 'date', timeMode = DbxDateTimeFieldTimeMode.REQUIRED, valueMode, fullDayInUTC, fullDayFieldName, getConfigObs, hideDateHint, timeOnly = false } = config;
|
|
3339
|
+
const { key = 'date', dateLabel, timeLabel, timeMode = DbxDateTimeFieldTimeMode.REQUIRED, valueMode, fullDayInUTC, fullDayFieldName, getConfigObs, getSyncFieldsObs, hideDateHint, timeOnly = false } = config;
|
|
3229
3340
|
const fieldConfig = formlyField({
|
|
3230
3341
|
key,
|
|
3231
3342
|
type: 'datetime',
|
|
3232
|
-
...
|
|
3343
|
+
...propsAndConfigForFieldConfig(config, {
|
|
3344
|
+
dateLabel,
|
|
3345
|
+
timeLabel,
|
|
3233
3346
|
valueMode,
|
|
3234
3347
|
timeOnly,
|
|
3235
3348
|
timeMode: timeOnly ? DbxDateTimeFieldTimeMode.REQUIRED : timeMode,
|
|
3236
3349
|
fullDayFieldName,
|
|
3237
3350
|
fullDayInUTC,
|
|
3238
3351
|
hideDateHint,
|
|
3239
|
-
getConfigObs
|
|
3352
|
+
getConfigObs,
|
|
3353
|
+
getSyncFieldsObs
|
|
3240
3354
|
})
|
|
3241
3355
|
});
|
|
3242
3356
|
return styleWrapper(fieldConfig, {
|
|
3243
3357
|
classGetter: 'dbx-mat-form-field-disable-underline'
|
|
3244
3358
|
});
|
|
3245
3359
|
}
|
|
3360
|
+
function dateRangeField(config = {}) {
|
|
3361
|
+
const { start, end } = config;
|
|
3362
|
+
const startFieldKey = start?.key ?? 'start';
|
|
3363
|
+
const endFieldKey = end?.key ?? 'end';
|
|
3364
|
+
const startField = dateTimeField({
|
|
3365
|
+
dateLabel: 'Start',
|
|
3366
|
+
timeMode: DbxDateTimeFieldTimeMode.NONE,
|
|
3367
|
+
getSyncFieldsObs: () => of([{ syncWith: endFieldKey, syncType: 'after' }]),
|
|
3368
|
+
...start,
|
|
3369
|
+
key: startFieldKey
|
|
3370
|
+
});
|
|
3371
|
+
const endField = dateTimeField({
|
|
3372
|
+
dateLabel: 'End',
|
|
3373
|
+
timeMode: DbxDateTimeFieldTimeMode.NONE,
|
|
3374
|
+
getSyncFieldsObs: () => of([{ syncWith: startFieldKey, syncType: 'before' }]),
|
|
3375
|
+
...end,
|
|
3376
|
+
key: endFieldKey
|
|
3377
|
+
});
|
|
3378
|
+
return {
|
|
3379
|
+
key: undefined,
|
|
3380
|
+
fieldGroup: [flexLayoutWrapper([startField, endField], { size: 1, relative: true })]
|
|
3381
|
+
};
|
|
3382
|
+
}
|
|
3246
3383
|
|
|
3247
3384
|
function isTruthy() {
|
|
3248
3385
|
return (control) => {
|
|
@@ -3314,6 +3451,12 @@ function isInRange(min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER)
|
|
|
3314
3451
|
};
|
|
3315
3452
|
}
|
|
3316
3453
|
const IS_DIVISIBLE_BY_VALIDATION_KEY = 'isDivisibleBy';
|
|
3454
|
+
/**
|
|
3455
|
+
* Angular Form ValidationFn for checking isDivisibleBy the input divisor.
|
|
3456
|
+
*
|
|
3457
|
+
* @param divisor
|
|
3458
|
+
* @returns
|
|
3459
|
+
*/
|
|
3317
3460
|
function isDivisibleBy(divisor) {
|
|
3318
3461
|
if (divisor === 0) {
|
|
3319
3462
|
throw new Error('Divisior must be greater than zero.');
|
|
@@ -3364,8 +3507,21 @@ function fieldValueIsAvailableValidator(config) {
|
|
|
3364
3507
|
})), first());
|
|
3365
3508
|
}
|
|
3366
3509
|
|
|
3510
|
+
function numberFieldTransformParser(config) {
|
|
3511
|
+
const { parsers: inputParsers, transform } = config;
|
|
3512
|
+
let parsers;
|
|
3513
|
+
if (inputParsers) {
|
|
3514
|
+
parsers = inputParsers;
|
|
3515
|
+
}
|
|
3516
|
+
if (transform) {
|
|
3517
|
+
const transformParser = transformNumberFunction(transform);
|
|
3518
|
+
parsers = concatArrays([transformParser], parsers);
|
|
3519
|
+
}
|
|
3520
|
+
return parsers;
|
|
3521
|
+
}
|
|
3367
3522
|
function numberField(config) {
|
|
3368
3523
|
const { key, min, max, step, enforceStep, inputType: type = 'number' } = config;
|
|
3524
|
+
const parsers = numberFieldTransformParser(config);
|
|
3369
3525
|
const validators = [];
|
|
3370
3526
|
if (step && enforceStep) {
|
|
3371
3527
|
validators.push(isDivisibleBy(step));
|
|
@@ -3373,7 +3529,7 @@ function numberField(config) {
|
|
|
3373
3529
|
return formlyField({
|
|
3374
3530
|
key,
|
|
3375
3531
|
type: 'input',
|
|
3376
|
-
...
|
|
3532
|
+
...propsAndConfigForFieldConfig(config, {
|
|
3377
3533
|
type,
|
|
3378
3534
|
min,
|
|
3379
3535
|
max,
|
|
@@ -3381,7 +3537,8 @@ function numberField(config) {
|
|
|
3381
3537
|
}),
|
|
3382
3538
|
...validatorsForFieldConfig({
|
|
3383
3539
|
validators
|
|
3384
|
-
})
|
|
3540
|
+
}),
|
|
3541
|
+
parsers
|
|
3385
3542
|
});
|
|
3386
3543
|
}
|
|
3387
3544
|
|
|
@@ -3466,30 +3623,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
|
|
|
3466
3623
|
}]
|
|
3467
3624
|
}] });
|
|
3468
3625
|
|
|
3626
|
+
function textFieldTransformParser(config) {
|
|
3627
|
+
const { parsers: inputParsers, transform } = config;
|
|
3628
|
+
let parsers;
|
|
3629
|
+
if (inputParsers) {
|
|
3630
|
+
parsers = inputParsers;
|
|
3631
|
+
}
|
|
3632
|
+
if (transform) {
|
|
3633
|
+
const transformParser = transformStringFunction(transform);
|
|
3634
|
+
parsers = concatArrays([transformParser], parsers);
|
|
3635
|
+
}
|
|
3636
|
+
return parsers;
|
|
3637
|
+
}
|
|
3469
3638
|
function textField(config) {
|
|
3470
|
-
const { key, pattern, minLength, maxLength, inputType: type = 'text' } = config;
|
|
3639
|
+
const { transform, key, pattern, minLength, maxLength, inputType: type = 'text' } = config;
|
|
3640
|
+
const parsers = textFieldTransformParser(config);
|
|
3471
3641
|
return formlyField({
|
|
3472
3642
|
key,
|
|
3473
3643
|
type: 'input',
|
|
3474
|
-
...
|
|
3644
|
+
...propsAndConfigForFieldConfig(config, {
|
|
3475
3645
|
type,
|
|
3476
3646
|
minLength,
|
|
3477
3647
|
maxLength,
|
|
3478
3648
|
pattern
|
|
3479
|
-
})
|
|
3649
|
+
}),
|
|
3650
|
+
parsers
|
|
3480
3651
|
});
|
|
3481
3652
|
}
|
|
3482
3653
|
function textAreaField(config) {
|
|
3483
3654
|
const { key, rows = 3, pattern, minLength, maxLength } = config;
|
|
3655
|
+
const parsers = textFieldTransformParser(config);
|
|
3484
3656
|
return formlyField({
|
|
3485
3657
|
key,
|
|
3486
3658
|
type: 'textarea',
|
|
3487
|
-
...
|
|
3659
|
+
...propsAndConfigForFieldConfig(config, {
|
|
3488
3660
|
rows,
|
|
3489
3661
|
minLength,
|
|
3490
3662
|
maxLength,
|
|
3491
3663
|
pattern
|
|
3492
|
-
})
|
|
3664
|
+
}),
|
|
3665
|
+
parsers
|
|
3493
3666
|
});
|
|
3494
3667
|
}
|
|
3495
3668
|
|
|
@@ -3498,7 +3671,7 @@ function phoneField(config = {}) {
|
|
|
3498
3671
|
const fieldConfig = formlyField({
|
|
3499
3672
|
key,
|
|
3500
3673
|
type: 'intphone',
|
|
3501
|
-
...
|
|
3674
|
+
...propsAndConfigForFieldConfig(config, {
|
|
3502
3675
|
preferredCountries,
|
|
3503
3676
|
onlyCountries
|
|
3504
3677
|
})
|
|
@@ -3601,7 +3774,10 @@ function stateField(config = {}) {
|
|
|
3601
3774
|
pattern,
|
|
3602
3775
|
autocomplete,
|
|
3603
3776
|
required,
|
|
3604
|
-
maxLength
|
|
3777
|
+
maxLength,
|
|
3778
|
+
transform: {
|
|
3779
|
+
toUppercase: true
|
|
3780
|
+
}
|
|
3605
3781
|
});
|
|
3606
3782
|
}
|
|
3607
3783
|
function countryField(config = {}) {
|
|
@@ -4380,5 +4556,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
|
|
|
4380
4556
|
* Generated bundle index. Do not edit.
|
|
4381
4557
|
*/
|
|
4382
4558
|
|
|
4383
|
-
export { APP_ACTION_FORM_DISABLED_KEY, AUTO_TOUCH_WRAPPER_KEY, AbstractAsyncFormlyFormDirective, AbstractConfigAsyncFormlyFormDirective, AbstractDbxPickableItemFieldDirective, AbstractDbxSearchableFieldDisplayDirective, AbstractDbxSearchableValueFieldDirective, AbstractFormExpandableSectionWrapperDirective, AbstractFormlyFormDirective, AbstractSyncFormlyFormDirective, AutoTouchFieldWrapperComponent, ChecklistItemFieldDataSetBuilder, DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN, DEFAULT_FORM_DISABLED_KEY, DEFAULT_HAS_VALUE_FN, DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE, DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER, DEFAULT_PREFERRED_COUNTRIES, DISPLAY_FOR_TIMEZONE_STRING_VALUE, DbxActionFormDirective, DbxActionFormSafetyDirective, DbxChecklistItemContentComponent, DbxChecklistItemFieldComponent, DbxDateTimeFieldComponent, DbxDateTimeFieldTimeMode, DbxDateTimeValueMode, DbxDefaultChecklistItemFieldDisplayComponent, DbxDefaultSearchableFieldDisplayComponent, DbxForm, DbxFormActionModule, DbxFormActionTransitionModule, DbxFormComponentFieldComponent, DbxFormExpandWrapperComponent, DbxFormExtensionModule, DbxFormFlexWrapperComponent, DbxFormFormlyArrayFieldModule, DbxFormFormlyBooleanFieldModule, DbxFormFormlyChecklistItemFieldModule, DbxFormFormlyComponentFieldModule, DbxFormFormlyDateFieldModule, DbxFormFormlyFieldModule, DbxFormFormlyNumberFieldModule, DbxFormFormlyPhoneFieldModule, DbxFormFormlyPickableFieldModule, DbxFormFormlySearchableFieldModule, DbxFormFormlySelectionModule, DbxFormFormlyTextEditorFieldModule, DbxFormFormlyTextFieldModule, DbxFormFormlyValueModule, DbxFormFormlyWrapperModule, DbxFormInfoWrapperComponent, DbxFormIoModule, DbxFormLayoutModule, DbxFormLoadingSourceDirective, DbxFormModule, DbxFormRepeatArrayTypeComponent, DbxFormSectionWrapperComponent, DbxFormSourceDirective, DbxFormSpacerComponent, DbxFormState, DbxFormSubsectionWrapperComponent, DbxFormToggleWrapperComponent, DbxFormValueChangesDirective, DbxFormWorkingWrapperComponent, DbxFormlyContext, DbxFormlyFieldsContextDirective, DbxFormlyFormComponent, DbxFormlyModule, DbxMutableForm, DbxPhoneFieldComponent, DbxPickableChipListFieldComponent, DbxPickableListFieldComponent, DbxPickableListFieldItemListComponent, DbxPickableListFieldItemListViewComponent, DbxPickableListFieldItemListViewItemComponent, DbxSearchableChipFieldComponent, DbxSearchableFieldAutocompleteItemComponent, DbxSearchableTextFieldComponent, DbxTextEditorFieldComponent, EXPANDABLE_WRAPPER_KEY, FIELD_VALUES_ARE_EQUAL_VALIDATION_KEY, FIELD_VALUE_IS_AVAILABLE_ERROR_VALIDATION_KEY, FIELD_VALUE_IS_AVAILABLE_VALIDATION_KEY, FLEX_WRAPPER_KEY, INFO_WRAPPER_KEY, INVALID_PHONE_NUMBER_MESSAGE, IS_DIVISIBLE_BY_VALIDATION_KEY, LABEL_STRING_MAX_LENGTH, MAX_LENGTH_VALIDATION_MESSAGE, MAX_VALIDATION_MESSAGE, MIN_LENGTH_VALIDATION_MESSAGE, MIN_VALIDATION_MESSAGE, PHONE_LABEL_MAX_LENGTH, REQUIRED_VALIDATION_MESSAGE, SEARCH_STRING_MAX_LENGTH, SECTION_WRAPPER_KEY, STYLE_WRAPPER_KEY, SUBSECTION_WRAPPER_KEY, TAKE_NEXT_UPCOMING_TIME_CONFIG_OBS, TOGGLE_WRAPPER_KEY, WORKING_WRAPPER_KEY, addWrapperToFormlyFieldConfig, addressField, addressFormlyFields, addressLineField, addressListField, autoTouchWrapper, checkIsFieldFlexLayoutGroupFieldConfig, checkboxField, checklistItemField, chipTextField, cityField, componentField, countryField, dateTimeField, dbxDateTimeInputValueParseFactory, dbxDateTimeOutputValueFactory, dbxFormSourceObservable, defaultValidationMessages, disableFormlyFieldAutofillAttributes, emailField, expandWrapper, fieldValueIsAvailableValidator, fieldValuesAreEqualValidator, filterPartialPotentialFieldConfigValuesFromObject, filterPickableItemFieldValuesByLabel, filterPickableItemFieldValuesByLabelFilterFunction, flexLayoutWrapper, formlyField, hiddenField, infoWrapper, isDivisibleBy, isDomain, isInRange, isTruthy, latLngTextField, makeMetaFilterSearchableFieldValueDisplayFn, maxLengthValidationMessage, maxValidationMessage, mergePropsValueObjects, minLengthValidationMessage, minValidationMessage, nameField, numberField, partialPotentialFieldConfigKeys, partialPotentialFieldConfigKeysFilter, phoneAndLabelSectionField, phoneField, phoneListField, pickableItemChipField, pickableItemListField, propsForFieldConfig, propsValueForFieldConfig, provideDbxForm, provideDbxMutableForm, provideFormlyContext, repeatArrayField, searchableChipField, searchableStringChipField, searchableTextField, sectionWrapper, sortPickableItemsByLabel, stateField, styleWrapper, subsectionWrapper, textAreaField, textEditorField, textField, textIsAvailableField, textPasswordField, textPasswordWithVerifyFieldGroup, textVerifyPasswordField, timeOnlyField, timezoneStringField, timezoneStringSearchFunction, toggleField, toggleWrapper, usernamePasswordLoginFields, validatorsForFieldConfig, valueSelectionField, workingWrapper, wrappedPhoneAndLabelField, zipCodeField };
|
|
4559
|
+
export { APP_ACTION_FORM_DISABLED_KEY, AUTO_TOUCH_WRAPPER_KEY, AbstractAsyncFormlyFormDirective, AbstractConfigAsyncFormlyFormDirective, AbstractDbxPickableItemFieldDirective, AbstractDbxSearchableFieldDisplayDirective, AbstractDbxSearchableValueFieldDirective, AbstractFormExpandableSectionWrapperDirective, AbstractFormlyFormDirective, AbstractSyncFormlyFormDirective, AutoTouchFieldWrapperComponent, ChecklistItemFieldDataSetBuilder, DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN, DEFAULT_FORM_DISABLED_KEY, DEFAULT_HAS_VALUE_FN, DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE, DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER, DEFAULT_PREFERRED_COUNTRIES, DISPLAY_FOR_TIMEZONE_STRING_VALUE, DbxActionFormDirective, DbxActionFormSafetyDirective, DbxChecklistItemContentComponent, DbxChecklistItemFieldComponent, DbxDateTimeFieldComponent, DbxDateTimeFieldTimeMode, DbxDateTimeValueMode, DbxDefaultChecklistItemFieldDisplayComponent, DbxDefaultSearchableFieldDisplayComponent, DbxForm, DbxFormActionModule, DbxFormActionTransitionModule, DbxFormComponentFieldComponent, DbxFormExpandWrapperComponent, DbxFormExtensionModule, DbxFormFlexWrapperComponent, DbxFormFormlyArrayFieldModule, DbxFormFormlyBooleanFieldModule, DbxFormFormlyChecklistItemFieldModule, DbxFormFormlyComponentFieldModule, DbxFormFormlyDateFieldModule, DbxFormFormlyFieldModule, DbxFormFormlyNumberFieldModule, DbxFormFormlyPhoneFieldModule, DbxFormFormlyPickableFieldModule, DbxFormFormlySearchableFieldModule, DbxFormFormlySelectionModule, DbxFormFormlyTextEditorFieldModule, DbxFormFormlyTextFieldModule, DbxFormFormlyValueModule, DbxFormFormlyWrapperModule, DbxFormInfoWrapperComponent, DbxFormIoModule, DbxFormLayoutModule, DbxFormLoadingSourceDirective, DbxFormModule, DbxFormRepeatArrayTypeComponent, DbxFormSectionWrapperComponent, DbxFormSourceDirective, DbxFormSpacerComponent, DbxFormState, DbxFormSubsectionWrapperComponent, DbxFormToggleWrapperComponent, DbxFormValueChangesDirective, DbxFormWorkingWrapperComponent, DbxFormlyContext, DbxFormlyFieldsContextDirective, DbxFormlyFormComponent, DbxFormlyModule, DbxMutableForm, DbxPhoneFieldComponent, DbxPickableChipListFieldComponent, DbxPickableListFieldComponent, DbxPickableListFieldItemListComponent, DbxPickableListFieldItemListViewComponent, DbxPickableListFieldItemListViewItemComponent, DbxSearchableChipFieldComponent, DbxSearchableFieldAutocompleteItemComponent, DbxSearchableTextFieldComponent, DbxTextEditorFieldComponent, EXPANDABLE_WRAPPER_KEY, FIELD_VALUES_ARE_EQUAL_VALIDATION_KEY, FIELD_VALUE_IS_AVAILABLE_ERROR_VALIDATION_KEY, FIELD_VALUE_IS_AVAILABLE_VALIDATION_KEY, FLEX_WRAPPER_KEY, INFO_WRAPPER_KEY, INVALID_PHONE_NUMBER_MESSAGE, IS_DIVISIBLE_BY_VALIDATION_KEY, LABEL_STRING_MAX_LENGTH, MAX_LENGTH_VALIDATION_MESSAGE, MAX_VALIDATION_MESSAGE, MIN_LENGTH_VALIDATION_MESSAGE, MIN_VALIDATION_MESSAGE, PHONE_LABEL_MAX_LENGTH, REQUIRED_VALIDATION_MESSAGE, SEARCH_STRING_MAX_LENGTH, SECTION_WRAPPER_KEY, STYLE_WRAPPER_KEY, SUBSECTION_WRAPPER_KEY, TAKE_NEXT_UPCOMING_TIME_CONFIG_OBS, TOGGLE_WRAPPER_KEY, WORKING_WRAPPER_KEY, addWrapperToFormlyFieldConfig, addressField, addressFormlyFields, addressLineField, addressListField, autoTouchWrapper, checkIsFieldFlexLayoutGroupFieldConfig, checkboxField, checklistItemField, chipTextField, cityField, componentField, countryField, dateRangeField, dateTimeField, dbxDateTimeInputValueParseFactory, dbxDateTimeOutputValueFactory, dbxFormSourceObservable, defaultValidationMessages, disableFormlyFieldAutofillAttributes, emailField, expandWrapper, fieldValueIsAvailableValidator, fieldValuesAreEqualValidator, filterPartialPotentialFieldConfigValuesFromObject, filterPickableItemFieldValuesByLabel, filterPickableItemFieldValuesByLabelFilterFunction, flexLayoutWrapper, formlyField, hiddenField, infoWrapper, isDivisibleBy, isDomain, isInRange, isTruthy, latLngTextField, makeMetaFilterSearchableFieldValueDisplayFn, maxLengthValidationMessage, maxValidationMessage, mergePropsValueObjects, minLengthValidationMessage, minValidationMessage, nameField, numberField, numberFieldTransformParser, partialPotentialFieldConfigKeys, partialPotentialFieldConfigKeysFilter, phoneAndLabelSectionField, phoneField, phoneListField, pickableItemChipField, pickableItemListField, propsAndConfigForFieldConfig, propsForFieldConfig, propsValueForFieldConfig, provideDbxForm, provideDbxMutableForm, provideFormlyContext, repeatArrayField, searchableChipField, searchableStringChipField, searchableTextField, sectionWrapper, sortPickableItemsByLabel, stateField, styleWrapper, subsectionWrapper, syncConfigValueObs, textAreaField, textEditorField, textField, textFieldTransformParser, textIsAvailableField, textPasswordField, textPasswordWithVerifyFieldGroup, textVerifyPasswordField, timeOnlyField, timezoneStringField, timezoneStringSearchFunction, toggleField, toggleWrapper, usernamePasswordLoginFields, validatorsForFieldConfig, valueSelectionField, workingWrapper, wrappedPhoneAndLabelField, zipCodeField };
|
|
4384
4560
|
//# sourceMappingURL=dereekb-dbx-form.mjs.map
|