@dereekb/dbx-form 1.1.0 → 2.1.0
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/README.md +1 -1
- package/esm2020/lib/form/action/form.action.directive.mjs +33 -18
- package/esm2020/lib/form/action/transition/form.action.transition.safety.directive.mjs +7 -7
- package/esm2020/lib/form/form.mjs +2 -1
- package/esm2020/lib/form/io/form.input.directive.mjs +1 -1
- package/esm2020/lib/formly/field/component/component.field.component.mjs +7 -20
- package/esm2020/lib/formly/field/component/component.field.mjs +3 -5
- package/esm2020/lib/formly/field/component/component.field.module.mjs +8 -8
- package/esm2020/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.mjs +5 -5
- package/esm2020/lib/formly/field/value/array/array.field.component.mjs +1 -1
- package/esm2020/lib/formly/field/value/date/datetime.field.component.mjs +46 -36
- package/esm2020/lib/formly/field/value/date/datetime.field.mjs +7 -7
- package/esm2020/lib/formly/formly.context.mjs +18 -7
- package/esm2020/lib/formly/formly.directive.mjs +5 -2
- package/esm2020/lib/formly/formly.form.component.mjs +51 -17
- package/fesm2015/dereekb-dbx-form.mjs +238 -180
- package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form.mjs +237 -179
- package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
- package/lib/form/action/form.action.directive.d.ts +13 -16
- package/lib/form/action/transition/form.action.transition.safety.directive.d.ts +3 -3
- package/lib/form/form.d.ts +19 -3
- package/lib/form/io/form.input.directive.d.ts +2 -1
- package/lib/formly/field/component/component.field.component.d.ts +7 -20
- package/lib/formly/field/component/component.field.d.ts +3 -5
- package/lib/formly/field/component/component.field.module.d.ts +1 -1
- package/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.d.ts +1 -1
- package/lib/formly/field/texteditor/_texteditor.scss +0 -2
- package/lib/formly/field/value/date/datetime.field.component.d.ts +7 -9
- package/lib/formly/field/value/date/datetime.field.d.ts +2 -2
- package/lib/formly/field/value/phone/_phone.scss +4 -0
- package/lib/formly/formly.context.d.ts +8 -5
- package/lib/formly/formly.directive.d.ts +2 -0
- package/lib/formly/formly.form.component.d.ts +13 -3
- package/package.json +23 -24
|
@@ -10,9 +10,9 @@ import { AbstractSubscriptionDirective, safeDetectChanges, DbxInjectedComponentM
|
|
|
10
10
|
import * as i1$1 from '@dereekb/dbx-web';
|
|
11
11
|
import { DbxActionTransitionSafetyDirective, DbxTextModule, DbxFlexLayoutModule, DbxSectionLayoutModule, DbxAnchorModule, AbstractDbxSelectionListWrapperDirective, DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE, AbstractSelectionValueListViewDirective, mapItemValuesToValueListItemConfig, ProvideDbxListView, AbstractDbxSelectionValueListViewItemComponent, DbxLoadingModule, DbxButtonModule, DbxListLayoutModule, mapCompactModeObs, DbxBarLayoutModule } from '@dereekb/dbx-web';
|
|
12
12
|
import { isPast, addSeconds, isSameMinute, startOfDay, isSameDay, addMinutes } from 'date-fns';
|
|
13
|
-
import {
|
|
14
|
-
import { switchMap, first, catchError, filter, map, distinctUntilChanged, shareReplay, delay as delay$1, debounceTime as debounceTime$1, startWith as startWith$1, tap, throttleTime } from 'rxjs/operators';
|
|
13
|
+
import { BehaviorSubject, switchMap, first, exhaustMap, of, catchError, delay, filter, combineLatest, map, distinctUntilChanged, mergeMap, shareReplay as shareReplay$1, startWith, debounceTime, Subject, skipWhile, interval, merge, throttleTime as throttleTime$1, scan } from 'rxjs';
|
|
15
14
|
import { LockSet, SubscriptionObject, switchMapMaybeObs, filterMaybe, switchMapMaybeDefault, asObservable, beginLoading, mapLoadingStateResults, successResult, ListLoadingStateContextInstance, isListLoadingStateEmpty, LoadingStateContextInstance, skipFirstMaybe, scanCount } from '@dereekb/rxjs';
|
|
15
|
+
import { filter as filter$1, first as first$1, map as map$1, distinctUntilChanged as distinctUntilChanged$1, shareReplay, delay as delay$1, debounceTime as debounceTime$1, switchMap as switchMap$1, startWith as startWith$1, tap, throttleTime } from 'rxjs/operators';
|
|
16
16
|
import * as i1$4 from '@ngx-formly/core';
|
|
17
17
|
import { FieldType, FieldWrapper, FormlyModule, FieldArrayType } from '@ngx-formly/core';
|
|
18
18
|
import * as i1 from '@angular/material/checkbox';
|
|
@@ -27,12 +27,12 @@ import * as i1$2 from '@angular/material/button';
|
|
|
27
27
|
import { MatButtonModule } from '@angular/material/button';
|
|
28
28
|
import * as i3$1 from '@angular/flex-layout/flex';
|
|
29
29
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
30
|
-
import { objectIsEmpty, mergeObjects, filterFromPOJO, addPlusPrefixToNumber, convertMaybeToArray, makeValuesGroupMap, findUnique, mergeIntoArray, lastValue, separateValues, arrayToMap, getValueFromObjectOrGetter } from '@dereekb/util';
|
|
30
|
+
import { objectIsEmpty, mergeObjects, filterFromPOJO, addPlusPrefixToNumber, convertMaybeToArray, makeValuesGroupMap, findUnique, mergeIntoArray, lastValue, separateValues, arrayToMap, getValueFromObjectOrGetter, dateFromLogicalDate, BooleanStringKeyArrayUtilityInstance } from '@dereekb/util';
|
|
31
31
|
import * as i1$3 from '@angular/material/slide-toggle';
|
|
32
32
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
33
33
|
import * as i2$2 from '@angular/flex-layout/extended';
|
|
34
34
|
import * as i6$1 from '@angular/material/input';
|
|
35
|
-
import { MatInputModule
|
|
35
|
+
import { MatInputModule } from '@angular/material/input';
|
|
36
36
|
import { FieldType as FieldType$1, FormlyMaterialModule } from '@ngx-formly/material';
|
|
37
37
|
import { camelCase } from 'change-case';
|
|
38
38
|
import * as i1$5 from '@angular/material/chips';
|
|
@@ -45,7 +45,7 @@ import { MatListModule } from '@angular/material/list';
|
|
|
45
45
|
import * as i3$2 from '@angular/material/form-field';
|
|
46
46
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
47
47
|
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
48
|
-
import { skipUntilTimeElapsedAfterLastEmission, guessCurrentTimezone, toReadableTimeString, utcDayForDate, readableTimeStringToDate, DateTimeMinuteInstance } from '@dereekb/date';
|
|
48
|
+
import { skipUntilTimeElapsedAfterLastEmission, guessCurrentTimezone, toReadableTimeString, utcDayForDate, readableTimeStringToDate, DateTimeMinuteInstance, toLocalReadableTimeString } from '@dereekb/date';
|
|
49
49
|
import * as i2$3 from 'ngx-editor';
|
|
50
50
|
import { Editor, NgxEditorModule } from 'ngx-editor';
|
|
51
51
|
import * as i5$1 from '@angular/cdk/drag-drop';
|
|
@@ -69,6 +69,7 @@ var DbxFormState;
|
|
|
69
69
|
DbxFormState[DbxFormState["RESET"] = 0] = "RESET";
|
|
70
70
|
DbxFormState[DbxFormState["USED"] = 1] = "USED";
|
|
71
71
|
})(DbxFormState || (DbxFormState = {}));
|
|
72
|
+
const DEFAULT_FORM_DISABLED_KEY = 'dbx_form_disabled';
|
|
72
73
|
/**
|
|
73
74
|
* Form that has an event stream, value, and state items.
|
|
74
75
|
*/
|
|
@@ -86,7 +87,7 @@ function ProvideDbxMutableForm(sourceType) {
|
|
|
86
87
|
];
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
const APP_ACTION_FORM_DISABLED_KEY = '
|
|
90
|
+
const APP_ACTION_FORM_DISABLED_KEY = 'dbx_action_form';
|
|
90
91
|
/**
|
|
91
92
|
* Used with an action to bind a form to an action as it's value source.
|
|
92
93
|
*
|
|
@@ -99,16 +100,25 @@ class DbxActionFormDirective {
|
|
|
99
100
|
this.form = form;
|
|
100
101
|
this.source = source;
|
|
101
102
|
this.lockSet = new LockSet();
|
|
103
|
+
this._formDisabledWhileWorking = new BehaviorSubject(true);
|
|
102
104
|
this._triggeredSub = new SubscriptionObject();
|
|
103
105
|
this._isCompleteSub = new SubscriptionObject();
|
|
106
|
+
this._isWorkingSub = new SubscriptionObject();
|
|
104
107
|
if (form.lockSet) {
|
|
105
108
|
this.lockSet.addChildLockSet(form.lockSet, 'form');
|
|
106
109
|
}
|
|
107
110
|
this.lockSet.addChildLockSet(source.lockSet, 'source');
|
|
108
111
|
}
|
|
112
|
+
get dbxActionFormDisabledWhileWorking() {
|
|
113
|
+
return this._formDisabledWhileWorking.value;
|
|
114
|
+
}
|
|
115
|
+
set dbxActionFormDisabledWhileWorking(dbxActionFormDisabledWhileWorking) {
|
|
116
|
+
this._formDisabledWhileWorking.next(Boolean(dbxActionFormDisabledWhileWorking ?? true));
|
|
117
|
+
}
|
|
109
118
|
ngOnInit() {
|
|
110
119
|
// Pass data from the form to the source when triggered.
|
|
111
|
-
this._triggeredSub.subscription = this.source.triggered$.pipe(switchMap(() => this.form.stream$.pipe(first(), exhaustMap((
|
|
120
|
+
this._triggeredSub.subscription = this.source.triggered$.pipe(switchMap(() => this.form.stream$.pipe(first(), exhaustMap((stream) => {
|
|
121
|
+
const { isComplete } = stream;
|
|
112
122
|
const doNothing = {}; // nothing, form not complete
|
|
113
123
|
let obs;
|
|
114
124
|
if (isComplete) {
|
|
@@ -119,7 +129,7 @@ class DbxActionFormDirective {
|
|
|
119
129
|
else {
|
|
120
130
|
return of(doNothing);
|
|
121
131
|
}
|
|
122
|
-
}), catchError((error) => of({ error })))));
|
|
132
|
+
}), catchError((error) => of({ reject: error })))));
|
|
123
133
|
}
|
|
124
134
|
else {
|
|
125
135
|
obs = of(doNothing);
|
|
@@ -137,7 +147,7 @@ class DbxActionFormDirective {
|
|
|
137
147
|
}
|
|
138
148
|
});
|
|
139
149
|
// Update the enabled/disabled state
|
|
140
|
-
this._isCompleteSub.subscription = this.form.stream$.pipe(filter((x) => x.state !== DbxFormState.INITIALIZING), switchMap((event) => {
|
|
150
|
+
this._isCompleteSub.subscription = this.form.stream$.pipe(delay(0), filter((x) => x.state !== DbxFormState.INITIALIZING), switchMap((event) => {
|
|
141
151
|
return this.form.getValue().pipe(first(), exhaustMap((value) => {
|
|
142
152
|
// Use both changes count and whether or not something was in the past to guage whether or not the item has been touched.
|
|
143
153
|
// Angular Form's untouched is whether or not focus has been lost but we can still recieve value updates.
|
|
@@ -147,7 +157,7 @@ class DbxActionFormDirective {
|
|
|
147
157
|
let validatorObs;
|
|
148
158
|
const initialIsValidCheck = event.isComplete;
|
|
149
159
|
if (initialIsValidCheck) {
|
|
150
|
-
validatorObs = (this.
|
|
160
|
+
validatorObs = (this.dbxActionFormValidator) ? this.dbxActionFormValidator(value) : of(true);
|
|
151
161
|
}
|
|
152
162
|
else {
|
|
153
163
|
validatorObs = of(false);
|
|
@@ -155,7 +165,7 @@ class DbxActionFormDirective {
|
|
|
155
165
|
let modifiedObs;
|
|
156
166
|
const isConsideredModified = (event.pristine === false && isProbablyTouched);
|
|
157
167
|
if (isConsideredModified) {
|
|
158
|
-
modifiedObs = (this.
|
|
168
|
+
modifiedObs = (this.dbxActionFormModified) ? this.dbxActionFormModified(value) : of(true);
|
|
159
169
|
}
|
|
160
170
|
else {
|
|
161
171
|
modifiedObs = of(false);
|
|
@@ -172,19 +182,24 @@ class DbxActionFormDirective {
|
|
|
172
182
|
// Disable if the form is not yet complete/valid.
|
|
173
183
|
this.source.enable(APP_ACTION_FORM_DISABLED_KEY, valid);
|
|
174
184
|
});
|
|
175
|
-
//
|
|
176
|
-
|
|
185
|
+
// Watch the working state and disable form while working
|
|
186
|
+
this._isWorkingSub.subscription = combineLatest([this.source.isWorking$, this._formDisabledWhileWorking]).pipe(map(([isWorking, lockOnWorking]) => lockOnWorking && isWorking), distinctUntilChanged()).subscribe((disable) => {
|
|
187
|
+
this.form.setDisabled(APP_ACTION_FORM_DISABLED_KEY, disable);
|
|
188
|
+
});
|
|
177
189
|
}
|
|
178
190
|
ngOnDestroy() {
|
|
179
191
|
this.source.enable(APP_ACTION_FORM_DISABLED_KEY);
|
|
180
192
|
this.lockSet.destroyOnNextUnlock(() => {
|
|
181
193
|
this._triggeredSub.destroy();
|
|
182
194
|
this._isCompleteSub.destroy();
|
|
195
|
+
this._isWorkingSub.destroy();
|
|
196
|
+
this._formDisabledWhileWorking.complete();
|
|
197
|
+
this.form.setDisabled(APP_ACTION_FORM_DISABLED_KEY, false);
|
|
183
198
|
});
|
|
184
199
|
}
|
|
185
200
|
preCheckReadyValue(value) {
|
|
186
|
-
let validatorObs = (this.
|
|
187
|
-
let modifiedObs = (this.
|
|
201
|
+
let validatorObs = (this.dbxActionFormValidator) ? this.dbxActionFormValidator(value) : of(true);
|
|
202
|
+
let modifiedObs = (this.dbxActionFormModified) ? this.dbxActionFormModified(value) : of(true);
|
|
188
203
|
return combineLatest([
|
|
189
204
|
validatorObs,
|
|
190
205
|
modifiedObs
|
|
@@ -194,8 +209,8 @@ class DbxActionFormDirective {
|
|
|
194
209
|
return of({ value });
|
|
195
210
|
}
|
|
196
211
|
}
|
|
197
|
-
DbxActionFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormDirective, deps: [{ token: DbxMutableForm, host: true }, { token: i2.
|
|
198
|
-
DbxActionFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionFormDirective, selector: "[dbxActionForm]", inputs: {
|
|
212
|
+
DbxActionFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormDirective, deps: [{ token: DbxMutableForm, host: true }, { token: i2.DbxActionContextStoreSourceInstance }], target: i0.ɵɵFactoryTarget.Directive });
|
|
213
|
+
DbxActionFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionFormDirective, selector: "[dbxActionForm]", inputs: { dbxActionFormValidator: "dbxActionFormValidator", dbxActionFormModified: "dbxActionFormModified", dbxActionFormDisabledWhileWorking: "dbxActionFormDisabledWhileWorking" }, ngImport: i0 });
|
|
199
214
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormDirective, decorators: [{
|
|
200
215
|
type: Directive,
|
|
201
216
|
args: [{
|
|
@@ -203,9 +218,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
203
218
|
}]
|
|
204
219
|
}], ctorParameters: function () { return [{ type: DbxMutableForm, decorators: [{
|
|
205
220
|
type: Host
|
|
206
|
-
}] }, { type: i2.
|
|
221
|
+
}] }, { type: i2.DbxActionContextStoreSourceInstance }]; }, propDecorators: { dbxActionFormValidator: [{
|
|
207
222
|
type: Input
|
|
208
|
-
}],
|
|
223
|
+
}], dbxActionFormModified: [{
|
|
224
|
+
type: Input
|
|
225
|
+
}], dbxActionFormDisabledWhileWorking: [{
|
|
209
226
|
type: Input
|
|
210
227
|
}] } });
|
|
211
228
|
|
|
@@ -215,16 +232,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
215
232
|
* NOTE: Only works with UIRouter
|
|
216
233
|
*/
|
|
217
234
|
class DbxActionFormSafetyDirective extends DbxActionTransitionSafetyDirective {
|
|
218
|
-
constructor(
|
|
235
|
+
constructor(dbxActionForm, source, transitionService, viewContainerRef, dialog) {
|
|
219
236
|
super(source, transitionService, viewContainerRef, dialog);
|
|
220
|
-
this.
|
|
237
|
+
this.dbxActionForm = dbxActionForm;
|
|
221
238
|
}
|
|
222
239
|
_handleOnBeforeTransition(transition) {
|
|
223
|
-
this.
|
|
240
|
+
this.dbxActionForm.form.forceFormUpdate();
|
|
224
241
|
return super._handleOnBeforeTransition(transition);
|
|
225
242
|
}
|
|
226
243
|
}
|
|
227
|
-
DbxActionFormSafetyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormSafetyDirective, deps: [{ token: DbxActionFormDirective, host: true }, { token: i2.
|
|
244
|
+
DbxActionFormSafetyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormSafetyDirective, deps: [{ token: DbxActionFormDirective, host: true }, { token: i2.DbxActionContextStoreSourceInstance }, { token: i3.TransitionService }, { token: i0.ViewContainerRef }, { token: i4.MatDialog }], target: i0.ɵɵFactoryTarget.Directive });
|
|
228
245
|
DbxActionFormSafetyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionFormSafetyDirective, selector: "[dbxActionFormSafety]", inputs: { inputSafetyType: ["dbxActionFormSafety", "inputSafetyType"] }, usesInheritance: true, ngImport: i0 });
|
|
229
246
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormSafetyDirective, decorators: [{
|
|
230
247
|
type: Directive,
|
|
@@ -233,7 +250,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
233
250
|
}]
|
|
234
251
|
}], ctorParameters: function () { return [{ type: DbxActionFormDirective, decorators: [{
|
|
235
252
|
type: Host
|
|
236
|
-
}] }, { type: i2.
|
|
253
|
+
}] }, { type: i2.DbxActionContextStoreSourceInstance }, { type: i3.TransitionService }, { type: i0.ViewContainerRef }, { type: i4.MatDialog }]; }, propDecorators: { inputSafetyType: [{
|
|
237
254
|
type: Input,
|
|
238
255
|
args: ['dbxActionFormSafety']
|
|
239
256
|
}] } });
|
|
@@ -304,9 +321,9 @@ class DbxFormLoadingSourceDirective extends AbstractSubscriptionDirective {
|
|
|
304
321
|
if (obs) {
|
|
305
322
|
subscription = combineLatest([
|
|
306
323
|
// Emit the first time initializing isn't there.
|
|
307
|
-
this.form.stream$.pipe(filter((x) => x.state !== DbxFormState.INITIALIZING), first()),
|
|
324
|
+
this.form.stream$.pipe(filter$1((x) => x.state !== DbxFormState.INITIALIZING), first$1()),
|
|
308
325
|
obs
|
|
309
|
-
]).pipe(map((x) => x[1]), filter((x) => Boolean(x)), distinctUntilChanged((x, y) => x.value === y.value)).subscribe((x) => {
|
|
326
|
+
]).pipe(map$1((x) => x[1]), filter$1((x) => Boolean(x)), distinctUntilChanged$1((x, y) => x.value === y.value)).subscribe((x) => {
|
|
310
327
|
if (!x.error && !x.loading) {
|
|
311
328
|
// console.log('Setting value: ', x.model);
|
|
312
329
|
this.form.setValue(x.value);
|
|
@@ -340,7 +357,7 @@ class DbxFormValueChangesDirective extends AbstractSubscriptionDirective {
|
|
|
340
357
|
this.dbxFormValueChange = new EventEmitter();
|
|
341
358
|
}
|
|
342
359
|
ngOnInit() {
|
|
343
|
-
this.sub = this.form.stream$.pipe(filter
|
|
360
|
+
this.sub = this.form.stream$.pipe(filter(x => x.isComplete), mergeMap(() => this.form.getValue().pipe(first())), delay(0)).subscribe((value) => {
|
|
344
361
|
this.dbxFormValueChange.next(value);
|
|
345
362
|
});
|
|
346
363
|
}
|
|
@@ -377,9 +394,9 @@ class DbxFormSourceDirective extends AbstractSubscriptionDirective {
|
|
|
377
394
|
if (obs) {
|
|
378
395
|
subscription = combineLatest([
|
|
379
396
|
// Emit the first time initializing isn't there.
|
|
380
|
-
this.form.stream$.pipe(filter((x) => x.state !== DbxFormState.INITIALIZING), first()),
|
|
397
|
+
this.form.stream$.pipe(filter$1((x) => x.state !== DbxFormState.INITIALIZING), first$1()),
|
|
381
398
|
obs
|
|
382
|
-
]).pipe(map((x) => x[1]), distinctUntilChanged((x, y) => x === y)).subscribe((x) => {
|
|
399
|
+
]).pipe(map$1((x) => x[1]), distinctUntilChanged$1((x, y) => x === y)).subscribe((x) => {
|
|
383
400
|
this.form.setValue(x);
|
|
384
401
|
});
|
|
385
402
|
}
|
|
@@ -511,9 +528,9 @@ class DbxChecklistItemFieldComponent extends FieldType {
|
|
|
511
528
|
constructor() {
|
|
512
529
|
super(...arguments);
|
|
513
530
|
this._displayContent = new BehaviorSubject(undefined);
|
|
514
|
-
this.displayContent$ = this._displayContent.pipe(switchMapMaybeObs(), distinctUntilChanged(), shareReplay(1));
|
|
515
|
-
this.anchor$ = this.displayContent$.pipe(map(x => x.anchor), shareReplay(1));
|
|
516
|
-
this.rippleDisabled$ = this.displayContent$.pipe(map(x => x.ripple === false || (x.ripple !== true && !x.anchor)), distinctUntilChanged(), shareReplay(1));
|
|
531
|
+
this.displayContent$ = this._displayContent.pipe(switchMapMaybeObs(), distinctUntilChanged$1(), shareReplay(1));
|
|
532
|
+
this.anchor$ = this.displayContent$.pipe(map$1(x => x.anchor), shareReplay(1));
|
|
533
|
+
this.rippleDisabled$ = this.displayContent$.pipe(map$1(x => x.ripple === false || (x.ripple !== true && !x.anchor)), distinctUntilChanged$1(), shareReplay(1));
|
|
517
534
|
}
|
|
518
535
|
get formGroup() {
|
|
519
536
|
return this.form;
|
|
@@ -706,7 +723,7 @@ class AbstractFormExpandableSectionWrapperDirective extends FieldWrapper {
|
|
|
706
723
|
this._formControlObs = new BehaviorSubject(undefined);
|
|
707
724
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
708
725
|
this._toggleOpen = new BehaviorSubject(undefined);
|
|
709
|
-
this.show$ = this._toggleOpen.pipe(switchMap
|
|
726
|
+
this.show$ = this._toggleOpen.pipe(switchMap((toggleOpen) => {
|
|
710
727
|
if (toggleOpen != null) {
|
|
711
728
|
return of(toggleOpen);
|
|
712
729
|
}
|
|
@@ -714,7 +731,7 @@ class AbstractFormExpandableSectionWrapperDirective extends FieldWrapper {
|
|
|
714
731
|
return this.hasValue$;
|
|
715
732
|
}
|
|
716
733
|
}), shareReplay$1(1));
|
|
717
|
-
this.hasValue$ = this.formControl$.pipe(switchMap
|
|
734
|
+
this.hasValue$ = this.formControl$.pipe(switchMap((x) => x.valueChanges.pipe(startWith(x.value), map((value) => {
|
|
718
735
|
return this.hasValueFn(value);
|
|
719
736
|
}), shareReplay$1(1))));
|
|
720
737
|
}
|
|
@@ -814,7 +831,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
814
831
|
class DbxFormToggleWrapperComponent extends AbstractFormExpandableSectionWrapperDirective {
|
|
815
832
|
constructor() {
|
|
816
833
|
super(...arguments);
|
|
817
|
-
this.slideLabel$ = this._toggleOpen.pipe(switchMap
|
|
834
|
+
this.slideLabel$ = this._toggleOpen.pipe(switchMap(x => {
|
|
818
835
|
if (this.expandableSection?.toggleLabelObs) {
|
|
819
836
|
return this.expandableSection?.toggleLabelObs(x);
|
|
820
837
|
}
|
|
@@ -824,7 +841,7 @@ class DbxFormToggleWrapperComponent extends AbstractFormExpandableSectionWrapper
|
|
|
824
841
|
}), shareReplay$1(1));
|
|
825
842
|
}
|
|
826
843
|
onToggleChange() {
|
|
827
|
-
this.show$.pipe(first
|
|
844
|
+
this.show$.pipe(first()).subscribe((show) => {
|
|
828
845
|
this._toggleOpen.next(!show);
|
|
829
846
|
});
|
|
830
847
|
}
|
|
@@ -1129,7 +1146,7 @@ class ChecklistItemFieldDataSetBuilder {
|
|
|
1129
1146
|
mergedConfig.displayContentObs = combineLatest([
|
|
1130
1147
|
currentField.displayContentObs,
|
|
1131
1148
|
config.displayContentObs
|
|
1132
|
-
]).pipe(map(([a, b]) => {
|
|
1149
|
+
]).pipe(map$1(([a, b]) => {
|
|
1133
1150
|
const result = {
|
|
1134
1151
|
...a,
|
|
1135
1152
|
...b
|
|
@@ -1185,7 +1202,7 @@ class ChecklistItemFieldDataSetBuilder {
|
|
|
1185
1202
|
}
|
|
1186
1203
|
// MARK: Utility
|
|
1187
1204
|
customContentFromData(mapFn) {
|
|
1188
|
-
return this.dataObs$.pipe(map(mapFn));
|
|
1205
|
+
return this.dataObs$.pipe(map$1(mapFn));
|
|
1189
1206
|
}
|
|
1190
1207
|
contentWithValueFromData(key, contentFn) {
|
|
1191
1208
|
return this.customContentFromData((data) => {
|
|
@@ -1205,33 +1222,20 @@ class ChecklistItemFieldDataSetBuilder {
|
|
|
1205
1222
|
}
|
|
1206
1223
|
}
|
|
1207
1224
|
|
|
1208
|
-
class
|
|
1209
|
-
}
|
|
1210
|
-
class FormComponentFieldComponent extends FieldType {
|
|
1225
|
+
class DbxFormComponentFieldComponent extends FieldType {
|
|
1211
1226
|
get config() {
|
|
1212
|
-
return this._config;
|
|
1213
|
-
}
|
|
1214
|
-
get componentField() {
|
|
1215
1227
|
return this.field.componentField;
|
|
1216
1228
|
}
|
|
1217
|
-
ngOnInit() {
|
|
1218
|
-
this._config = {
|
|
1219
|
-
componentClass: this.componentField.componentClass,
|
|
1220
|
-
init: (instance) => {
|
|
1221
|
-
instance.field = this;
|
|
1222
|
-
}
|
|
1223
|
-
};
|
|
1224
|
-
}
|
|
1225
1229
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
<div class="form-
|
|
1230
|
+
DbxFormComponentFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormComponentFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1231
|
+
DbxFormComponentFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: DbxFormComponentFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
|
|
1232
|
+
<div class="dbx-form-component" dbx-injected-content [config]="config"></div>
|
|
1229
1233
|
`, isInline: true, components: [{ type: i2.DbxInjectedComponent, selector: "dbx-injected-content, [dbx-injected-content]", inputs: ["config", "template"] }] });
|
|
1230
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type:
|
|
1234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormComponentFieldComponent, decorators: [{
|
|
1231
1235
|
type: Component,
|
|
1232
1236
|
args: [{
|
|
1233
1237
|
template: `
|
|
1234
|
-
<div class="form-
|
|
1238
|
+
<div class="dbx-form-component" dbx-injected-content [config]="config"></div>
|
|
1235
1239
|
`
|
|
1236
1240
|
}]
|
|
1237
1241
|
}] });
|
|
@@ -1239,14 +1243,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1239
1243
|
class DbxFormFormlyComponentFieldModule {
|
|
1240
1244
|
}
|
|
1241
1245
|
DbxFormFormlyComponentFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormFormlyComponentFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1242
|
-
DbxFormFormlyComponentFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormFormlyComponentFieldModule, declarations: [
|
|
1243
|
-
DbxInjectedComponentModule, i1$4.FormlyModule], exports: [
|
|
1246
|
+
DbxFormFormlyComponentFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormFormlyComponentFieldModule, declarations: [DbxFormComponentFieldComponent], imports: [CommonModule,
|
|
1247
|
+
DbxInjectedComponentModule, i1$4.FormlyModule], exports: [DbxFormComponentFieldComponent] });
|
|
1244
1248
|
DbxFormFormlyComponentFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormFormlyComponentFieldModule, imports: [[
|
|
1245
1249
|
CommonModule,
|
|
1246
1250
|
DbxInjectedComponentModule,
|
|
1247
1251
|
FormlyModule.forChild({
|
|
1248
1252
|
types: [
|
|
1249
|
-
{ name: 'component', component:
|
|
1253
|
+
{ name: 'component', component: DbxFormComponentFieldComponent }
|
|
1250
1254
|
]
|
|
1251
1255
|
})
|
|
1252
1256
|
]] });
|
|
@@ -1258,25 +1262,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1258
1262
|
DbxInjectedComponentModule,
|
|
1259
1263
|
FormlyModule.forChild({
|
|
1260
1264
|
types: [
|
|
1261
|
-
{ name: 'component', component:
|
|
1265
|
+
{ name: 'component', component: DbxFormComponentFieldComponent }
|
|
1262
1266
|
]
|
|
1263
1267
|
})
|
|
1264
1268
|
],
|
|
1265
1269
|
declarations: [
|
|
1266
|
-
|
|
1270
|
+
DbxFormComponentFieldComponent
|
|
1267
1271
|
],
|
|
1268
1272
|
exports: [
|
|
1269
|
-
|
|
1273
|
+
DbxFormComponentFieldComponent
|
|
1270
1274
|
]
|
|
1271
1275
|
}]
|
|
1272
1276
|
}] });
|
|
1273
1277
|
|
|
1274
|
-
function componentField(
|
|
1278
|
+
function componentField(config) {
|
|
1275
1279
|
return {
|
|
1276
1280
|
type: 'component',
|
|
1277
|
-
componentField:
|
|
1278
|
-
componentClass
|
|
1279
|
-
}
|
|
1281
|
+
componentField: config
|
|
1280
1282
|
};
|
|
1281
1283
|
}
|
|
1282
1284
|
|
|
@@ -1291,18 +1293,18 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1291
1293
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
1292
1294
|
this._displayHashMap = new BehaviorSubject(new Map());
|
|
1293
1295
|
this.filterInputValue$ = this.inputCtrl.valueChanges.pipe(startWith(undefined));
|
|
1294
|
-
this.filterInputValueString$ = this.filterInputValue$.pipe(debounceTime(200), distinctUntilChanged
|
|
1295
|
-
this.loadResultsDisplayValuesState$ = this.formControl$.pipe(first
|
|
1296
|
-
this._formControlValue = this.formControl$.pipe(switchMap
|
|
1297
|
-
this.loadResultsDisplayValues$ = this.loadResultsDisplayValuesState$.pipe(map
|
|
1296
|
+
this.filterInputValueString$ = this.filterInputValue$.pipe(debounceTime(200), distinctUntilChanged(), shareReplay$1(1));
|
|
1297
|
+
this.loadResultsDisplayValuesState$ = this.formControl$.pipe(first(), switchMap(() => this.loadValuesFn().pipe(switchMap((x) => this.loadDisplayValuesForFieldValues(x)), startWith(beginLoading()))), shareReplay$1(1));
|
|
1298
|
+
this._formControlValue = this.formControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith(control.value), shareReplay$1(1))));
|
|
1299
|
+
this.loadResultsDisplayValues$ = this.loadResultsDisplayValuesState$.pipe(map(x => x?.value ?? []));
|
|
1298
1300
|
/**
|
|
1299
1301
|
* Current values in the form control.
|
|
1300
1302
|
*/
|
|
1301
|
-
this.values$ = this._formControlValue.pipe(map
|
|
1303
|
+
this.values$ = this._formControlValue.pipe(map(convertMaybeToArray), shareReplay$1(1));
|
|
1302
1304
|
/**
|
|
1303
1305
|
* Current values with their display value.
|
|
1304
1306
|
*/
|
|
1305
|
-
this.displayValuesState$ = combineLatest([this.loadResultsDisplayValues$, this.values$]).pipe(switchMap
|
|
1307
|
+
this.displayValuesState$ = combineLatest([this.loadResultsDisplayValues$, this.values$]).pipe(switchMap(([displayValues, currentValues]) => {
|
|
1306
1308
|
const displayValuesMap = makeValuesGroupMap(displayValues, (x) => this.hashForValue(x.value));
|
|
1307
1309
|
const valuesNotInDisplayMap = [];
|
|
1308
1310
|
currentValues.forEach((x) => {
|
|
@@ -1313,7 +1315,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1313
1315
|
}
|
|
1314
1316
|
});
|
|
1315
1317
|
if (valuesNotInDisplayMap.length) {
|
|
1316
|
-
return this.loadDisplayValuesForValues(valuesNotInDisplayMap).pipe(map
|
|
1318
|
+
return this.loadDisplayValuesForValues(valuesNotInDisplayMap).pipe(map(x => mapLoadingStateResults(x, {
|
|
1317
1319
|
mapValue: (loadedValues) => {
|
|
1318
1320
|
loadedValues.forEach(x => x.isUnknown = x.isUnknown ?? true); // Assign unknown flag.
|
|
1319
1321
|
return ([...displayValues, ...loadedValues]);
|
|
@@ -1327,14 +1329,14 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1327
1329
|
/**
|
|
1328
1330
|
* Results to be displayed if filtered.
|
|
1329
1331
|
*/
|
|
1330
|
-
this.filteredSearchResultsState$ = this.loadResultsDisplayValues$.pipe(switchMap
|
|
1332
|
+
this.filteredSearchResultsState$ = this.loadResultsDisplayValues$.pipe(switchMap((values) => this.filterInputValueString$.pipe(switchMap(text => combineLatest([this._filterValues(text, values), this.displayValuesState$]).pipe(map(([values, displayState]) => mapLoadingStateResults(displayState, {
|
|
1331
1333
|
mapValue: (displayValues) => {
|
|
1332
1334
|
const valueHashSet = new Set(values.map(x => this.hashForValue(x)));
|
|
1333
1335
|
return displayValues.filter(x => !x.isUnknown && valueHashSet.has(x._hash));
|
|
1334
1336
|
}
|
|
1335
1337
|
})), startWith(beginLoading()))))), shareReplay$1(1));
|
|
1336
|
-
this.filteredSearchResults$ = this.filteredSearchResultsState$.pipe(map
|
|
1337
|
-
this.items$ = combineLatest([this.filteredSearchResults$, this.values$]).pipe(map
|
|
1338
|
+
this.filteredSearchResults$ = this.filteredSearchResultsState$.pipe(map(x => x?.value), filterMaybe(), shareReplay$1(1));
|
|
1339
|
+
this.items$ = combineLatest([this.filteredSearchResults$, this.values$]).pipe(map(([displayValues, values]) => {
|
|
1338
1340
|
const selectedHashValuesSet = new Set(values.map(x => this.hashForValue(x)));
|
|
1339
1341
|
let items = displayValues.map((x) => ({ value: x, selected: selectedHashValuesSet.has(x._hash) }));
|
|
1340
1342
|
if (this.sortItems) {
|
|
@@ -1342,17 +1344,17 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1342
1344
|
}
|
|
1343
1345
|
return items;
|
|
1344
1346
|
}), shareReplay$1(1));
|
|
1345
|
-
this.itemsLoadingState$ = this.loadResultsDisplayValues$.pipe(switchMap
|
|
1347
|
+
this.itemsLoadingState$ = this.loadResultsDisplayValues$.pipe(switchMap(x => this.items$.pipe(first(), map(x => successResult(x)), startWith(beginLoading()), shareReplay$1(1))));
|
|
1346
1348
|
/**
|
|
1347
1349
|
* Context used for managing the loading of items, or when the current results change.
|
|
1348
1350
|
*/
|
|
1349
1351
|
this.context = new ListLoadingStateContextInstance({ obs: this.itemsLoadingState$, showLoadingOnNoValue: false });
|
|
1350
|
-
this.filterItemsLoadingState$ = this.items$.pipe(map
|
|
1352
|
+
this.filterItemsLoadingState$ = this.items$.pipe(map(x => successResult(x)), startWith(beginLoading()), shareReplay$1(1));
|
|
1351
1353
|
/**
|
|
1352
1354
|
* Context used for searching/filtering.
|
|
1353
1355
|
*/
|
|
1354
1356
|
this.filterResultsContext = new ListLoadingStateContextInstance({ obs: this.filteredSearchResultsState$, showLoadingOnNoValue: true });
|
|
1355
|
-
this.noItemsAvailable$ = this.filterItemsLoadingState$.pipe(isListLoadingStateEmpty(), distinctUntilChanged
|
|
1357
|
+
this.noItemsAvailable$ = this.filterItemsLoadingState$.pipe(isListLoadingStateEmpty(), distinctUntilChanged());
|
|
1356
1358
|
}
|
|
1357
1359
|
get readonly() {
|
|
1358
1360
|
return this.field.templateOptions?.readonly;
|
|
@@ -1434,7 +1436,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1434
1436
|
return this.loadDisplayValuesForFieldValues(values.map((value) => ({ value })));
|
|
1435
1437
|
}
|
|
1436
1438
|
loadDisplayValuesForFieldValues(values) {
|
|
1437
|
-
return this.getDisplayValuesForFieldValues(values).pipe(map
|
|
1439
|
+
return this.getDisplayValuesForFieldValues(values).pipe(map((displayValues) => successResult(displayValues)), startWith(beginLoading()), shareReplay$1(1));
|
|
1438
1440
|
}
|
|
1439
1441
|
getDisplayValuesForFieldValues(values) {
|
|
1440
1442
|
return this._displayHashMap.pipe(mergeMap((displayMap) => {
|
|
@@ -1446,7 +1448,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1446
1448
|
if (needsDisplay.length > 0) {
|
|
1447
1449
|
// Go get the display value.
|
|
1448
1450
|
const displayValuesObs = this.displayForValue(needsDisplay.map(x => x[2]));
|
|
1449
|
-
return displayValuesObs.pipe(first
|
|
1451
|
+
return displayValuesObs.pipe(first(), map((displayResults) => {
|
|
1450
1452
|
const displayResultsWithHash = displayResults.map((x) => {
|
|
1451
1453
|
x._hash = this.hashForValue(x.value);
|
|
1452
1454
|
return x;
|
|
@@ -1472,7 +1474,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1472
1474
|
super.ngOnInit();
|
|
1473
1475
|
this._formControlObs.next(this.formControl);
|
|
1474
1476
|
// Focus after finished loading for the first time.
|
|
1475
|
-
this.context.loading$.pipe(delay(10), filter
|
|
1477
|
+
this.context.loading$.pipe(delay(10), filter(x => x), first()).subscribe(() => {
|
|
1476
1478
|
this.filterMatInput?.focus();
|
|
1477
1479
|
});
|
|
1478
1480
|
}
|
|
@@ -1591,7 +1593,7 @@ class DbxPickableListFieldItemListViewComponent extends AbstractSelectionValueLi
|
|
|
1591
1593
|
};
|
|
1592
1594
|
this.items$ = this.values$.pipe(
|
|
1593
1595
|
// NOTE: This causes the "value" to be a PickableValueFieldDisplayValue<T>, which means we emit PickableValueFieldDisplayValue<T> to DbxPickableListFieldComponent.
|
|
1594
|
-
map
|
|
1596
|
+
map(x => mapItemValuesToValueListItemConfig(this.config, x)), shareReplay$1(1));
|
|
1595
1597
|
}
|
|
1596
1598
|
get multiple() {
|
|
1597
1599
|
return this.dbxPickableListFieldComponent.multiSelect;
|
|
@@ -1749,22 +1751,22 @@ function pickableItemListField(config) {
|
|
|
1749
1751
|
});
|
|
1750
1752
|
}
|
|
1751
1753
|
|
|
1752
|
-
const
|
|
1754
|
+
const DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN = new InjectionToken('DbxSearchableField');
|
|
1753
1755
|
class DbxSearchableFieldAutocompleteItemComponent {
|
|
1754
1756
|
constructor() {
|
|
1755
1757
|
this._displayValue = new BehaviorSubject(undefined);
|
|
1756
1758
|
this.displayValue$ = this._displayValue.pipe(filterMaybe(), shareReplay$1(1));
|
|
1757
|
-
this.config$ = this.displayValue$.pipe(map
|
|
1759
|
+
this.config$ = this.displayValue$.pipe(map(x => {
|
|
1758
1760
|
const config = {
|
|
1759
1761
|
...x.display,
|
|
1760
1762
|
providers: mergeIntoArray([{
|
|
1761
|
-
provide:
|
|
1763
|
+
provide: DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN,
|
|
1762
1764
|
useValue: x
|
|
1763
1765
|
}], x.display.providers)
|
|
1764
1766
|
};
|
|
1765
1767
|
return config;
|
|
1766
1768
|
}));
|
|
1767
|
-
this.anchor$ = this.displayValue$.pipe(map
|
|
1769
|
+
this.anchor$ = this.displayValue$.pipe(map(x => x.anchor));
|
|
1768
1770
|
}
|
|
1769
1771
|
set displayValue(displayValue) {
|
|
1770
1772
|
this._displayValue.next(displayValue);
|
|
@@ -1798,13 +1800,13 @@ class AbstractDbxSearchableFieldDisplayDirective {
|
|
|
1798
1800
|
this.displayValue = displayValue;
|
|
1799
1801
|
}
|
|
1800
1802
|
}
|
|
1801
|
-
AbstractDbxSearchableFieldDisplayDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractDbxSearchableFieldDisplayDirective, deps: [{ token:
|
|
1803
|
+
AbstractDbxSearchableFieldDisplayDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractDbxSearchableFieldDisplayDirective, deps: [{ token: DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1802
1804
|
AbstractDbxSearchableFieldDisplayDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: AbstractDbxSearchableFieldDisplayDirective, ngImport: i0 });
|
|
1803
1805
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractDbxSearchableFieldDisplayDirective, decorators: [{
|
|
1804
1806
|
type: Directive
|
|
1805
1807
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1806
1808
|
type: Inject,
|
|
1807
|
-
args: [
|
|
1809
|
+
args: [DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN]
|
|
1808
1810
|
}] }]; } });
|
|
1809
1811
|
class DbxDefaultSearchableFieldDisplayComponent extends AbstractDbxSearchableFieldDisplayDirective {
|
|
1810
1812
|
}
|
|
@@ -1846,17 +1848,17 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType$1 {
|
|
|
1846
1848
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
1847
1849
|
this._displayHashMap = new BehaviorSubject(new Map());
|
|
1848
1850
|
this.inputValue$ = this.inputCtrl.valueChanges.pipe(startWith(this.inputCtrl.value));
|
|
1849
|
-
this.inputValueString$ = this.inputValue$.pipe(debounceTime(200), distinctUntilChanged
|
|
1850
|
-
this.searchResultsState$ = this.inputValueString$.pipe(switchMap
|
|
1851
|
+
this.inputValueString$ = this.inputValue$.pipe(debounceTime(200), distinctUntilChanged());
|
|
1852
|
+
this.searchResultsState$ = this.inputValueString$.pipe(switchMap((text) => ((text || this.searchOnEmptyText) ? this.search(text ?? '') : of([])).pipe(switchMap((x) => this.loadDisplayValuesForFieldValues(x)),
|
|
1851
1853
|
// Return begin loading to setup the loading state.
|
|
1852
1854
|
startWith(beginLoading()))), shareReplay$1(1));
|
|
1853
1855
|
this.singleValueSyncSubscription = new SubscriptionObject();
|
|
1854
1856
|
this.searchContext = new LoadingStateContextInstance({ obs: this.searchResultsState$, showLoadingOnNoValue: false });
|
|
1855
|
-
this.searchResults$ = this.searchResultsState$.pipe(map
|
|
1856
|
-
this._formControlValue = this.formControl$.pipe(switchMap
|
|
1857
|
-
this.values$ = this._formControlValue.pipe(map
|
|
1858
|
-
this.displayValuesState$ = this.values$.pipe(distinctUntilChanged
|
|
1859
|
-
this.displayValues$ = this.displayValuesState$.pipe(map
|
|
1857
|
+
this.searchResults$ = this.searchResultsState$.pipe(map(x => x?.value ?? []));
|
|
1858
|
+
this._formControlValue = this.formControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith(control.value), shareReplay$1(1))));
|
|
1859
|
+
this.values$ = this._formControlValue.pipe(map(convertMaybeToArray), shareReplay$1(1));
|
|
1860
|
+
this.displayValuesState$ = this.values$.pipe(distinctUntilChanged(), switchMap((values) => this.loadDisplayValuesForValues(values)), shareReplay$1(1));
|
|
1861
|
+
this.displayValues$ = this.displayValuesState$.pipe(map(x => x?.value ?? []));
|
|
1860
1862
|
}
|
|
1861
1863
|
get name() {
|
|
1862
1864
|
return this.field.name ?? (camelCase(this.label ?? this.key));
|
|
@@ -1910,7 +1912,7 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType$1 {
|
|
|
1910
1912
|
return this.loadDisplayValuesForFieldValues(values.map((value) => ({ value })));
|
|
1911
1913
|
}
|
|
1912
1914
|
loadDisplayValuesForFieldValues(values) {
|
|
1913
|
-
return this.getDisplayValuesForFieldValues(values).pipe(map
|
|
1915
|
+
return this.getDisplayValuesForFieldValues(values).pipe(map((displayValues) => successResult(displayValues)), startWith(beginLoading()), shareReplay$1(1));
|
|
1914
1916
|
}
|
|
1915
1917
|
getDisplayValuesForFieldValues(values) {
|
|
1916
1918
|
return this._displayHashMap.pipe(mergeMap((displayMap) => {
|
|
@@ -1925,7 +1927,7 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType$1 {
|
|
|
1925
1927
|
const displayValuesObs = this.displayForValue(needsDisplay.map(x => x[2]));
|
|
1926
1928
|
const defaultDisplay = mergeDbxInjectedComponentConfigs([this.defaultDisplay, this.display]);
|
|
1927
1929
|
const anchorForValue = this.useAnchor && this.anchorForValue;
|
|
1928
|
-
obs = displayValuesObs.pipe(first
|
|
1930
|
+
obs = displayValuesObs.pipe(first(), map((displayResults) => {
|
|
1929
1931
|
// Assign the default component classes to complete configuration.
|
|
1930
1932
|
displayResults.forEach(x => {
|
|
1931
1933
|
if (!x.display) {
|
|
@@ -2130,7 +2132,7 @@ function makeMetaFilterSearchableFieldValueDisplayFn({ loadMetaForValues, makeDi
|
|
|
2130
2132
|
let allValues;
|
|
2131
2133
|
if (needLoading.length > 0) {
|
|
2132
2134
|
const loadingResult = loadMetaForValues(needLoading);
|
|
2133
|
-
allValues = loadingResult.pipe(map((result) => {
|
|
2135
|
+
allValues = loadingResult.pipe(map$1((result) => {
|
|
2134
2136
|
const resultMap = arrayToMap(result, (x) => x.value);
|
|
2135
2137
|
const mergedWithLoad = needLoading.map((x) => {
|
|
2136
2138
|
const id = x.value;
|
|
@@ -2144,12 +2146,12 @@ function makeMetaFilterSearchableFieldValueDisplayFn({ loadMetaForValues, makeDi
|
|
|
2144
2146
|
};
|
|
2145
2147
|
}).filter(x => !x.meta);
|
|
2146
2148
|
return mergedWithLoad;
|
|
2147
|
-
}), map((result) => [...loaded, ...result]));
|
|
2149
|
+
}), map$1((result) => [...loaded, ...result]));
|
|
2148
2150
|
}
|
|
2149
2151
|
else {
|
|
2150
2152
|
allValues = of(loaded);
|
|
2151
2153
|
}
|
|
2152
|
-
return allValues.pipe(switchMap
|
|
2154
|
+
return allValues.pipe(switchMap((x) => makeDisplayForValues(x)));
|
|
2153
2155
|
};
|
|
2154
2156
|
}
|
|
2155
2157
|
function searchableStringChipField(config) {
|
|
@@ -2188,9 +2190,9 @@ function searchableTextField(config) {
|
|
|
2188
2190
|
class DbxSearchableTextFieldComponent extends AbstractDbxSearchableValueFieldDirective {
|
|
2189
2191
|
constructor() {
|
|
2190
2192
|
super(...arguments);
|
|
2191
|
-
this.selectedDisplayValue$ = this.displayValues$.pipe(map
|
|
2192
|
-
this.hasValue$ = this.selectedDisplayValue$.pipe(map
|
|
2193
|
-
this.showSelectedDisplayValue$ = this.selectedDisplayValue$.pipe(map
|
|
2193
|
+
this.selectedDisplayValue$ = this.displayValues$.pipe(map(x => x[0]), shareReplay$1(1), tapDetectChanges(this.cdRef));
|
|
2194
|
+
this.hasValue$ = this.selectedDisplayValue$.pipe(map(x => Boolean(x)));
|
|
2195
|
+
this.showSelectedDisplayValue$ = this.selectedDisplayValue$.pipe(map(x => this.showSelectedValue && Boolean(x)), distinctUntilChanged(), shareReplay$1(1), tapDetectChanges(this.cdRef));
|
|
2194
2196
|
this.multiSelect = false;
|
|
2195
2197
|
this._clearInputSub = new SubscriptionObject();
|
|
2196
2198
|
}
|
|
@@ -2375,7 +2377,7 @@ class DbxTextEditorFieldComponent extends FieldType$1 {
|
|
|
2375
2377
|
super.ngOnInit();
|
|
2376
2378
|
this._editor = new Editor({});
|
|
2377
2379
|
// Watch for value changes every second and update the pristine level.
|
|
2378
|
-
this._sub.subscription = this.editor.valueChanges.pipe(debounceTime$1(100), filter(_ => this.editor.view.hasFocus())).subscribe(() => {
|
|
2380
|
+
this._sub.subscription = this.editor.valueChanges.pipe(debounceTime$1(100), filter$1(_ => this.editor.view.hasFocus())).subscribe(() => {
|
|
2379
2381
|
this.formControl.updateValueAndValidity();
|
|
2380
2382
|
this.formControl.markAsDirty();
|
|
2381
2383
|
});
|
|
@@ -2575,7 +2577,7 @@ DbxFormRepeatArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion:
|
|
|
2575
2577
|
</div>
|
|
2576
2578
|
</dbx-subsection>
|
|
2577
2579
|
</div>
|
|
2578
|
-
`, isInline: true, components: [{ type: i1$1.DbxSubSectionComponent, selector: "dbx-subsection" }, { 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"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1$
|
|
2580
|
+
`, isInline: true, components: [{ type: i1$1.DbxSubSectionComponent, selector: "dbx-subsection" }, { 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"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1$4.FormlyField, selector: "formly-field", inputs: ["field"] }], directives: [{ type: i5$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i5$1.CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }, { type: i1$1.DbxBarDirective, selector: "dbx-bar", inputs: ["color"] }, { type: i5$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i1$1.DbxButtonSpacerDirective, selector: "dbx-button-spacer,dbxButtonSpacer" }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
2579
2581
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormRepeatArrayTypeComponent, decorators: [{
|
|
2580
2582
|
type: Component,
|
|
2581
2583
|
args: [{
|
|
@@ -2736,21 +2738,21 @@ export function acceptTermsField({ key = 'accept', label = 'Accept Terms', descr
|
|
|
2736
2738
|
}
|
|
2737
2739
|
*/
|
|
2738
2740
|
|
|
2739
|
-
var
|
|
2740
|
-
(function (
|
|
2741
|
+
var DbxDateTimeFieldTimeMode;
|
|
2742
|
+
(function (DbxDateTimeFieldTimeMode) {
|
|
2741
2743
|
/**
|
|
2742
2744
|
* Time is required.
|
|
2743
2745
|
*/
|
|
2744
|
-
|
|
2746
|
+
DbxDateTimeFieldTimeMode["REQUIRED"] = "required";
|
|
2745
2747
|
/**
|
|
2746
2748
|
* Time is optional.
|
|
2747
2749
|
*/
|
|
2748
|
-
|
|
2750
|
+
DbxDateTimeFieldTimeMode["OPTIONAL"] = "optional";
|
|
2749
2751
|
/**
|
|
2750
2752
|
* Time is permenantly off.
|
|
2751
2753
|
*/
|
|
2752
|
-
|
|
2753
|
-
})(
|
|
2754
|
+
DbxDateTimeFieldTimeMode["NONE"] = "none";
|
|
2755
|
+
})(DbxDateTimeFieldTimeMode || (DbxDateTimeFieldTimeMode = {}));
|
|
2754
2756
|
class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
2755
2757
|
constructor(cdRef) {
|
|
2756
2758
|
super();
|
|
@@ -2763,35 +2765,37 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2763
2765
|
this._formControlObs = new BehaviorSubject(undefined);
|
|
2764
2766
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
2765
2767
|
this._updateTime = new Subject();
|
|
2766
|
-
this.value$ = this.formControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith$1(control.value))), distinctUntilChanged((a, b) => isSameMinute(a, b)), shareReplay(1));
|
|
2768
|
+
this.value$ = this.formControl$.pipe(switchMap$1(control => control.valueChanges.pipe(startWith$1(control.value))), distinctUntilChanged$1((a, b) => isSameMinute(a, b)), shareReplay(1));
|
|
2767
2769
|
/**
|
|
2768
2770
|
* Used to trigger/display visual updates (specifically on timeDistance, etc.).
|
|
2769
2771
|
*/
|
|
2770
|
-
this.displayValue$ = interval(10 * 1000).pipe(startWith$1(0), map(_ => new Date().getMinutes()), distinctUntilChanged(), tap((_) => this.cdRef.markForCheck()), switchMap(_ => this.value$), shareReplay(1));
|
|
2771
|
-
this.timeString$ = this.value$.pipe(filterMaybe(), map((x) => {
|
|
2772
|
+
this.displayValue$ = interval(10 * 1000).pipe(startWith$1(0), map$1(_ => new Date().getMinutes()), distinctUntilChanged$1(), tap((_) => this.cdRef.markForCheck()), switchMap$1(_ => this.value$), shareReplay(1));
|
|
2773
|
+
this.timeString$ = this.value$.pipe(filterMaybe(), map$1((x) => {
|
|
2772
2774
|
const timezone = guessCurrentTimezone();
|
|
2773
2775
|
const timeString = toReadableTimeString(x, timezone);
|
|
2774
2776
|
return timeString;
|
|
2775
2777
|
}));
|
|
2778
|
+
this.dateInputCtrl = new FormControl(new Date(), {
|
|
2779
|
+
validators: []
|
|
2780
|
+
});
|
|
2776
2781
|
this.timeInputCtrl = new FormControl('', {
|
|
2777
2782
|
validators: [
|
|
2778
|
-
Validators.pattern(/^([0-9]|(0[0-9])|(1[0-9])|(2[0-3]))(:)?([0-5][0-9])?(\s)?([apAP][Mm])?(\\s)*$/)
|
|
2783
|
+
Validators.pattern(/^(now)$|^([0-9]|(0[0-9])|(1[0-9])|(2[0-3]))(:)?([0-5][0-9])?(\s)?([apAP][Mm])?(\\s)*$/)
|
|
2779
2784
|
]
|
|
2780
2785
|
});
|
|
2781
|
-
this._date = new BehaviorSubject(new Date());
|
|
2782
2786
|
this._config = new BehaviorSubject(undefined);
|
|
2783
|
-
this.fullDay$ = this.fullDayControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith$1(control.value))));
|
|
2784
|
-
this.showTimeInput$ = this.fullDay$.pipe(map(x => !x && this.timeMode !==
|
|
2785
|
-
this.showAddTime$ = this.showTimeInput$.pipe(map(x => !x && this.timeMode ===
|
|
2786
|
-
this.date$ = this.
|
|
2787
|
-
this.dateValue$ = merge(this.value$.pipe(
|
|
2788
|
-
this.timeInput$ = this._updateTime.pipe(debounceTime$1(5), map(_ => this.timeInputCtrl.value), distinctUntilChanged());
|
|
2787
|
+
this.fullDay$ = this.fullDayControl$.pipe(switchMap$1(control => control.valueChanges.pipe(startWith$1(control.value))));
|
|
2788
|
+
this.showTimeInput$ = this.fullDay$.pipe(map$1(x => !x && this.timeMode !== DbxDateTimeFieldTimeMode.NONE));
|
|
2789
|
+
this.showAddTime$ = this.showTimeInput$.pipe(map$1(x => !x && this.timeMode === DbxDateTimeFieldTimeMode.OPTIONAL), shareReplay(1));
|
|
2790
|
+
this.date$ = this.dateInputCtrl.valueChanges.pipe(startWith$1(this.dateInputCtrl.value), filterMaybe(), shareReplay(1));
|
|
2791
|
+
this.dateValue$ = merge(this.date$, this.value$.pipe(skipFirstMaybe())).pipe(map$1((x) => (x) ? startOfDay(x) : x), distinctUntilChanged$1((a, b) => Boolean(a && b) && isSameDay(a, b)), shareReplay(1));
|
|
2792
|
+
this.timeInput$ = this._updateTime.pipe(debounceTime$1(5), map$1(_ => this.timeInputCtrl.value), distinctUntilChanged$1());
|
|
2789
2793
|
this.config$ = this._config.pipe(switchMapMaybeDefault(), shareReplay(1));
|
|
2790
2794
|
this.rawDateTime$ = combineLatest([
|
|
2791
2795
|
this.dateValue$,
|
|
2792
2796
|
this.timeInput$.pipe(startWith$1(null)),
|
|
2793
2797
|
this.fullDay$
|
|
2794
|
-
]).pipe(map(([date, timeString, fullDay]) => {
|
|
2798
|
+
]).pipe(map$1(([date, timeString, fullDay]) => {
|
|
2795
2799
|
let result;
|
|
2796
2800
|
if (date) {
|
|
2797
2801
|
if (fullDay) {
|
|
@@ -2813,12 +2817,12 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2813
2817
|
}
|
|
2814
2818
|
}
|
|
2815
2819
|
return result;
|
|
2816
|
-
}), distinctUntilChanged((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
|
|
2820
|
+
}), distinctUntilChanged$1((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
|
|
2817
2821
|
this.timeOutput$ = combineLatest([
|
|
2818
2822
|
this.rawDateTime$,
|
|
2819
2823
|
this._offset,
|
|
2820
|
-
this.config$.pipe(distinctUntilChanged()),
|
|
2821
|
-
]).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]) => {
|
|
2824
|
+
this.config$.pipe(distinctUntilChanged$1()),
|
|
2825
|
+
]).pipe(throttleTime(40, undefined, { leading: false, trailing: true }), distinctUntilChanged$1((current, next) => current[0] === next[0] && next[1] === 0), tap(([_, stepsOffset]) => (stepsOffset) ? this._offset.next(0) : 0), map$1(([date, stepsOffset, config]) => {
|
|
2822
2826
|
if (date != null) {
|
|
2823
2827
|
const instance = new DateTimeMinuteInstance({
|
|
2824
2828
|
date,
|
|
@@ -2830,10 +2834,10 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2830
2834
|
date = addMinutes(date, minutes);
|
|
2831
2835
|
}
|
|
2832
2836
|
return date;
|
|
2833
|
-
}), distinctUntilChanged((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
|
|
2837
|
+
}), distinctUntilChanged$1((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
|
|
2834
2838
|
}
|
|
2835
2839
|
get dateOnly() {
|
|
2836
|
-
return this.timeMode ===
|
|
2840
|
+
return this.timeMode === DbxDateTimeFieldTimeMode.NONE;
|
|
2837
2841
|
}
|
|
2838
2842
|
get dateTimeField() {
|
|
2839
2843
|
return this.field.dateTimeField;
|
|
@@ -2845,7 +2849,7 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2845
2849
|
return !this.timeOnly;
|
|
2846
2850
|
}
|
|
2847
2851
|
get timeMode() {
|
|
2848
|
-
return (this.timeOnly) ?
|
|
2852
|
+
return (this.timeOnly) ? DbxDateTimeFieldTimeMode.REQUIRED : (this.dateTimeField.timeMode ?? DbxDateTimeFieldTimeMode.REQUIRED);
|
|
2849
2853
|
}
|
|
2850
2854
|
get description() {
|
|
2851
2855
|
return this.field.templateOptions?.description;
|
|
@@ -2864,7 +2868,18 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2864
2868
|
if (!this.timeInputCtrl.value && x === '12:00AM') {
|
|
2865
2869
|
return;
|
|
2866
2870
|
}
|
|
2867
|
-
this.
|
|
2871
|
+
this.setTime(x);
|
|
2872
|
+
});
|
|
2873
|
+
// Watch for disabled changes so we can propogate them properly.
|
|
2874
|
+
this.formControl.registerOnDisabledChange((disabled) => {
|
|
2875
|
+
if (disabled) {
|
|
2876
|
+
this.dateInputCtrl.disable({ emitEvent: false });
|
|
2877
|
+
this.timeInputCtrl.disable({ emitEvent: false });
|
|
2878
|
+
}
|
|
2879
|
+
else {
|
|
2880
|
+
this.dateInputCtrl.enable({ emitEvent: false });
|
|
2881
|
+
this.timeInputCtrl.enable({ emitEvent: false });
|
|
2882
|
+
}
|
|
2868
2883
|
});
|
|
2869
2884
|
const isFullDayField = this.dateTimeField.fullDayFieldName;
|
|
2870
2885
|
let fullDayFieldCtrl;
|
|
@@ -2881,12 +2896,12 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2881
2896
|
}
|
|
2882
2897
|
this._fullDayControlObs.next(fullDayFieldCtrl);
|
|
2883
2898
|
switch (this.dateTimeField.timeMode) {
|
|
2884
|
-
case
|
|
2899
|
+
case DbxDateTimeFieldTimeMode.OPTIONAL:
|
|
2885
2900
|
break;
|
|
2886
|
-
case
|
|
2901
|
+
case DbxDateTimeFieldTimeMode.NONE:
|
|
2887
2902
|
this.removeTime();
|
|
2888
2903
|
break;
|
|
2889
|
-
case
|
|
2904
|
+
case DbxDateTimeFieldTimeMode.REQUIRED:
|
|
2890
2905
|
this.addTime();
|
|
2891
2906
|
break;
|
|
2892
2907
|
}
|
|
@@ -2894,25 +2909,25 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2894
2909
|
ngOnDestroy() {
|
|
2895
2910
|
super.ngOnDestroy();
|
|
2896
2911
|
this._formControlObs.complete();
|
|
2897
|
-
this._date.complete();
|
|
2898
2912
|
this._updateTime.complete();
|
|
2899
2913
|
this._config.complete();
|
|
2900
2914
|
this._sub.destroy();
|
|
2901
2915
|
this._valueSub.destroy();
|
|
2902
2916
|
}
|
|
2903
|
-
dateTextChanged(e) {
|
|
2904
|
-
const value = this.dateInput.value;
|
|
2905
|
-
if (value == null) {
|
|
2906
|
-
this._date.next(undefined);
|
|
2907
|
-
}
|
|
2908
|
-
}
|
|
2909
2917
|
datePicked(event) {
|
|
2910
2918
|
const date = event.value;
|
|
2911
2919
|
if (date) {
|
|
2912
|
-
this.
|
|
2920
|
+
this.dateInputCtrl.setValue(date);
|
|
2913
2921
|
this._updateTime.next();
|
|
2914
2922
|
}
|
|
2915
2923
|
}
|
|
2924
|
+
setLogicalTime(time) {
|
|
2925
|
+
const date = dateFromLogicalDate(time);
|
|
2926
|
+
if (date) {
|
|
2927
|
+
const timeString = toLocalReadableTimeString(date);
|
|
2928
|
+
this.setTime(timeString);
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2916
2931
|
setTime(time) {
|
|
2917
2932
|
this.timeInputCtrl.setValue(time);
|
|
2918
2933
|
this._offset.next(0);
|
|
@@ -2955,20 +2970,17 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2955
2970
|
this.setFullDay(true);
|
|
2956
2971
|
}
|
|
2957
2972
|
setFullDay(fullDay) {
|
|
2958
|
-
this.fullDayControl$.pipe(first()).subscribe((x) => {
|
|
2973
|
+
this.fullDayControl$.pipe(first$1()).subscribe((x) => {
|
|
2959
2974
|
x.setValue(fullDay);
|
|
2960
2975
|
});
|
|
2961
2976
|
}
|
|
2962
2977
|
}
|
|
2963
2978
|
DbxDateTimeFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxDateTimeFieldComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2964
|
-
DbxDateTimeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: DbxDateTimeFieldComponent, selector: "ng-component",
|
|
2979
|
+
DbxDateTimeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", 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> Add Time\n </button>\n </div>\n </div>\n <div class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\"><b class=\"dbx-ok\">All Day</b> {{ dateValue$ | async | date:'fullDate' }}\n ({{ dateValue$ | async | dateDistance }})</small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\"><b class=\"dbx-ok\">At</b> {{ displayValue$ | async | date:'medium' }}\n ({{ displayValue$ | async | timeDistance }})</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>Date</mat-label>\n <input #dateInput matInput [formControl]=\"dateInputCtrl\" [matDatepicker]=\"picker\" (dateChange)=\"datePicked($event)\"\n [value]=\"dateValue$ | async\">\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>Time</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\"\n (keydown)=\"keydownOnInput($event)\">\n </mat-form-field>\n</ng-template>\n", components: [{ 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"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3$2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i4$4.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { type: i5$2.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i5$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i4$2.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i3$1.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"] }, { type: i3$1.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"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.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"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { 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"] }, { type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3$2.MatLabel, selector: "mat-label" }, { type: i6$1.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"] }, { type: i4$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]" }, { type: i4$4.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5$2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }], pipes: { "async": i5.AsyncPipe, "date": i5.DatePipe, "dateDistance": i2.DateDistancePipe, "timeDistance": i2.TimeDistancePipe } });
|
|
2965
2980
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxDateTimeFieldComponent, decorators: [{
|
|
2966
2981
|
type: Component,
|
|
2967
|
-
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> Add Time\n </button>\n </div>\n </div>\n <div class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\"><b class=\"dbx-ok\">All Day</b> {{ dateValue$ | async | date:'fullDate' }}\n ({{ dateValue$ | async | dateDistance }})</small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\"><b class=\"dbx-ok\">At</b> {{ displayValue$ | async | date:'medium' }}\n ({{ displayValue$ | async | timeDistance }})</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()\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>Date</mat-label>\n <input #dateInput matInput [
|
|
2968
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }
|
|
2969
|
-
type: ViewChild,
|
|
2970
|
-
args: ['dateInput', { read: MatInput }]
|
|
2971
|
-
}] } });
|
|
2982
|
+
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> Add Time\n </button>\n </div>\n </div>\n <div class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\"><b class=\"dbx-ok\">All Day</b> {{ dateValue$ | async | date:'fullDate' }}\n ({{ dateValue$ | async | dateDistance }})</small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\"><b class=\"dbx-ok\">At</b> {{ displayValue$ | async | date:'medium' }}\n ({{ displayValue$ | async | timeDistance }})</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>Date</mat-label>\n <input #dateInput matInput [formControl]=\"dateInputCtrl\" [matDatepicker]=\"picker\" (dateChange)=\"datePicked($event)\"\n [value]=\"dateValue$ | async\">\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>Time</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\"\n (keydown)=\"keydownOnInput($event)\">\n </mat-form-field>\n</ng-template>\n" }]
|
|
2983
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
2972
2984
|
|
|
2973
2985
|
class DbxFormFormlyDateFieldModule {
|
|
2974
2986
|
}
|
|
@@ -3048,20 +3060,20 @@ const TAKE_NEXT_UPCOMING_TIME_CONFIG_OBS = () => of({
|
|
|
3048
3060
|
/**
|
|
3049
3061
|
* Same as DateTime field but with the Date input hidden by default.
|
|
3050
3062
|
*/
|
|
3051
|
-
function timeOnlyField(config) {
|
|
3063
|
+
function timeOnlyField(config = {}) {
|
|
3052
3064
|
return dateTimeField({
|
|
3053
3065
|
...config,
|
|
3054
|
-
timeMode:
|
|
3066
|
+
timeMode: DbxDateTimeFieldTimeMode.REQUIRED,
|
|
3055
3067
|
timeOnly: true
|
|
3056
3068
|
});
|
|
3057
3069
|
}
|
|
3058
|
-
function dateTimeField(config) {
|
|
3059
|
-
const { key = 'date', timeMode =
|
|
3070
|
+
function dateTimeField(config = {}) {
|
|
3071
|
+
const { key = 'date', timeMode = DbxDateTimeFieldTimeMode.REQUIRED, fullDayFieldName, getConfigObs, timeOnly = false } = config;
|
|
3060
3072
|
const fieldConfig = formlyField({
|
|
3061
3073
|
key,
|
|
3062
3074
|
type: 'datetime',
|
|
3063
3075
|
dateTimeField: {
|
|
3064
|
-
timeMode: (timeOnly) ?
|
|
3076
|
+
timeMode: (timeOnly) ? DbxDateTimeFieldTimeMode.REQUIRED : timeMode,
|
|
3065
3077
|
fullDayFieldName,
|
|
3066
3078
|
getConfigObs,
|
|
3067
3079
|
timeOnly,
|
|
@@ -3596,10 +3608,11 @@ class DbxFormlyContext {
|
|
|
3596
3608
|
this.lockSet = new LockSet();
|
|
3597
3609
|
this._fields = new BehaviorSubject(undefined);
|
|
3598
3610
|
this._initialValue = new BehaviorSubject(undefined);
|
|
3599
|
-
this._disabled = new BehaviorSubject(
|
|
3611
|
+
this._disabled = new BehaviorSubject(undefined);
|
|
3600
3612
|
this._delegate = new BehaviorSubject(undefined);
|
|
3601
3613
|
this.fields$ = this._fields.pipe(filterMaybe());
|
|
3602
|
-
this.
|
|
3614
|
+
this.disabled$ = this._disabled.pipe(filterMaybe());
|
|
3615
|
+
this.stream$ = this._delegate.pipe(distinctUntilChanged(), switchMap(x => (x) ? x.stream$ : of(DbxFormlyContext.INITIAL_STATE)), shareReplay$1(1));
|
|
3603
3616
|
}
|
|
3604
3617
|
destroy() {
|
|
3605
3618
|
this.lockSet.destroyOnNextUnlock(() => {
|
|
@@ -3614,8 +3627,8 @@ class DbxFormlyContext {
|
|
|
3614
3627
|
if (delegate != null) {
|
|
3615
3628
|
delegate.init({
|
|
3616
3629
|
fields: this.fields$,
|
|
3617
|
-
|
|
3618
|
-
|
|
3630
|
+
initialDisabled: this._disabled.value,
|
|
3631
|
+
initialValue: this._initialValue.value
|
|
3619
3632
|
});
|
|
3620
3633
|
}
|
|
3621
3634
|
this._delegate.next(delegate);
|
|
@@ -3634,7 +3647,7 @@ class DbxFormlyContext {
|
|
|
3634
3647
|
}
|
|
3635
3648
|
// MARK: FormComponent
|
|
3636
3649
|
getValue() {
|
|
3637
|
-
return this._delegate.pipe(filterMaybe(), switchMap
|
|
3650
|
+
return this._delegate.pipe(filterMaybe(), switchMap(x => x.getValue()), shareReplay$1(1));
|
|
3638
3651
|
}
|
|
3639
3652
|
setValue(value) {
|
|
3640
3653
|
this._initialValue.next(value);
|
|
@@ -3643,10 +3656,19 @@ class DbxFormlyContext {
|
|
|
3643
3656
|
}
|
|
3644
3657
|
}
|
|
3645
3658
|
isDisabled() {
|
|
3659
|
+
return BooleanStringKeyArrayUtilityInstance.isTrue(this.disabled);
|
|
3660
|
+
}
|
|
3661
|
+
get disabled() {
|
|
3646
3662
|
return this._disabled.value;
|
|
3647
3663
|
}
|
|
3648
|
-
|
|
3649
|
-
this._disabled.
|
|
3664
|
+
getDisabled() {
|
|
3665
|
+
return this._disabled.asObservable();
|
|
3666
|
+
}
|
|
3667
|
+
setDisabled(key, disabled = true) {
|
|
3668
|
+
this._disabled.next(BooleanStringKeyArrayUtilityInstance.set(this.disabled, key ?? DEFAULT_FORM_DISABLED_KEY, disabled));
|
|
3669
|
+
if (this._delegate.value) {
|
|
3670
|
+
this._delegate.value.setDisabled(key, disabled);
|
|
3671
|
+
}
|
|
3650
3672
|
}
|
|
3651
3673
|
resetForm() {
|
|
3652
3674
|
if (this._delegate.value) {
|
|
@@ -3672,7 +3694,7 @@ class AbstractFormlyFormDirective {
|
|
|
3672
3694
|
return this.context.isDisabled();
|
|
3673
3695
|
}
|
|
3674
3696
|
set disabled(disabled) {
|
|
3675
|
-
this.context.setDisabled(disabled);
|
|
3697
|
+
this.context.setDisabled(undefined, disabled);
|
|
3676
3698
|
}
|
|
3677
3699
|
ngOnDestroy() {
|
|
3678
3700
|
this.context.destroy();
|
|
@@ -3690,6 +3712,9 @@ class AbstractFormlyFormDirective {
|
|
|
3690
3712
|
clearValue() {
|
|
3691
3713
|
this.setValue({});
|
|
3692
3714
|
}
|
|
3715
|
+
setDisabled(key, disabled) {
|
|
3716
|
+
this.context.setDisabled(key, disabled);
|
|
3717
|
+
}
|
|
3693
3718
|
}
|
|
3694
3719
|
AbstractFormlyFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractFormlyFormDirective, deps: [{ token: DbxFormlyContext }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3695
3720
|
AbstractFormlyFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: AbstractFormlyFormDirective, inputs: { disabled: "disabled" }, ngImport: i0 });
|
|
@@ -3720,7 +3745,7 @@ class AbstractAsyncFormlyFormDirective extends AbstractFormlyFormDirective {
|
|
|
3720
3745
|
this._fieldsSub = new SubscriptionObject();
|
|
3721
3746
|
}
|
|
3722
3747
|
ngOnInit() {
|
|
3723
|
-
this._fieldsSub.subscription = this.fields$.pipe(distinctUntilChanged
|
|
3748
|
+
this._fieldsSub.subscription = this.fields$.pipe(distinctUntilChanged()).subscribe((fields) => {
|
|
3724
3749
|
this.context.fields = fields;
|
|
3725
3750
|
});
|
|
3726
3751
|
}
|
|
@@ -3801,15 +3826,34 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
3801
3826
|
this.context = context;
|
|
3802
3827
|
this._fields = new BehaviorSubject(undefined);
|
|
3803
3828
|
this._events = new BehaviorSubject({ isComplete: false, state: DbxFormState.INITIALIZING });
|
|
3829
|
+
this._disabled = new BehaviorSubject(undefined);
|
|
3804
3830
|
this._reset = new BehaviorSubject(new Date());
|
|
3805
3831
|
this._forceUpdate = new Subject();
|
|
3832
|
+
this._disabledSub = new SubscriptionObject();
|
|
3806
3833
|
this.form = new FormGroup({});
|
|
3807
3834
|
this.model = {};
|
|
3808
3835
|
this.options = {};
|
|
3809
|
-
this.fields$ = this._fields.pipe(switchMapMaybeObs(), distinctUntilChanged
|
|
3810
|
-
this.stream$ = this._reset.pipe(switchMap
|
|
3836
|
+
this.fields$ = this._fields.pipe(switchMapMaybeObs(), distinctUntilChanged(), shareReplay$1(1));
|
|
3837
|
+
this.stream$ = this._reset.pipe(switchMap((lastResetAt) => this.form.valueChanges.pipe(startWith(0), distinctUntilChanged(), throttleTime$1(50, undefined, { leading: true, trailing: true }), scanCount(), map((changesSinceLastResetCount) => ({
|
|
3838
|
+
changesSinceLastResetCount,
|
|
3839
|
+
isFormValid: this.form.valid,
|
|
3840
|
+
isFormDisabled: this.form.disabled
|
|
3841
|
+
})), scan((acc, next) => {
|
|
3842
|
+
// Pass forward valid if next was a disabled change/check, which changes angular form's isValid value.
|
|
3843
|
+
// If it was valid prior, then it should be valid now, unless we just reset, in which case it might not be valid.
|
|
3844
|
+
const valid = next.isFormValid || (next.isFormDisabled && acc.isFormValid && acc.changesSinceLastResetCount > 0);
|
|
3845
|
+
return {
|
|
3846
|
+
changesSinceLastResetCount: next.changesSinceLastResetCount,
|
|
3847
|
+
isFormValid: valid,
|
|
3848
|
+
isFormDisabled: next.isFormDisabled
|
|
3849
|
+
};
|
|
3850
|
+
}, {
|
|
3851
|
+
changesSinceLastResetCount: 0,
|
|
3852
|
+
isFormValid: false,
|
|
3853
|
+
isFormDisabled: false
|
|
3854
|
+
}), map(({ changesSinceLastResetCount, isFormValid, isFormDisabled }) => {
|
|
3811
3855
|
const isReset = changesSinceLastResetCount === 1;
|
|
3812
|
-
const complete =
|
|
3856
|
+
const complete = isFormValid;
|
|
3813
3857
|
const nextState = {
|
|
3814
3858
|
isComplete: complete,
|
|
3815
3859
|
state: (isReset) ? DbxFormState.RESET : DbxFormState.USED,
|
|
@@ -3817,13 +3861,25 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
3817
3861
|
pristine: this.form.pristine,
|
|
3818
3862
|
changesCount: changesSinceLastResetCount,
|
|
3819
3863
|
lastResetAt,
|
|
3820
|
-
|
|
3864
|
+
disabled: this.disabled,
|
|
3865
|
+
isDisabled: isFormDisabled
|
|
3821
3866
|
};
|
|
3822
3867
|
return nextState;
|
|
3823
3868
|
}))), shareReplay$1(1));
|
|
3824
3869
|
}
|
|
3825
3870
|
ngOnInit() {
|
|
3826
3871
|
this.context.setDelegate(this);
|
|
3872
|
+
this._disabledSub.subscription = this._disabled.pipe(distinctUntilChanged()).subscribe((disabled) => {
|
|
3873
|
+
const isDisabled = BooleanStringKeyArrayUtilityInstance.isTrue(disabled);
|
|
3874
|
+
if (this.form.disabled !== isDisabled) {
|
|
3875
|
+
if (isDisabled) {
|
|
3876
|
+
this.form.disable({ emitEvent: true });
|
|
3877
|
+
}
|
|
3878
|
+
else {
|
|
3879
|
+
this.form.enable({ emitEvent: true });
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
});
|
|
3827
3883
|
}
|
|
3828
3884
|
ngOnDestroy() {
|
|
3829
3885
|
this.context.lockSet.onNextUnlock(() => {
|
|
@@ -3833,11 +3889,14 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
3833
3889
|
this._fields.complete();
|
|
3834
3890
|
this._reset.complete();
|
|
3835
3891
|
this._forceUpdate.complete();
|
|
3892
|
+
this._disabled.complete();
|
|
3893
|
+
this._disabledSub.destroy();
|
|
3836
3894
|
});
|
|
3837
3895
|
}
|
|
3838
3896
|
// MARK: Delegate
|
|
3839
3897
|
init(initialize) {
|
|
3840
3898
|
this._fields.next(initialize.fields);
|
|
3899
|
+
this._disabled.next(initialize.initialDisabled);
|
|
3841
3900
|
}
|
|
3842
3901
|
getValue() {
|
|
3843
3902
|
return of(this.form.value);
|
|
@@ -3865,18 +3924,17 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
3865
3924
|
this.options.resetModel();
|
|
3866
3925
|
}
|
|
3867
3926
|
}
|
|
3927
|
+
get isDisabled() {
|
|
3928
|
+
return BooleanStringKeyArrayUtilityInstance.isTrue(this.disabled);
|
|
3929
|
+
}
|
|
3868
3930
|
get disabled() {
|
|
3869
|
-
return this.
|
|
3931
|
+
return this._disabled.value;
|
|
3870
3932
|
}
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
else {
|
|
3877
|
-
this.form.enable({ emitEvent: true });
|
|
3878
|
-
}
|
|
3879
|
-
}
|
|
3933
|
+
getDisabled() {
|
|
3934
|
+
return this._disabled.asObservable();
|
|
3935
|
+
}
|
|
3936
|
+
setDisabled(key, disabled = true) {
|
|
3937
|
+
this._disabled.next(BooleanStringKeyArrayUtilityInstance.set(this.disabled, key ?? DEFAULT_FORM_DISABLED_KEY, disabled));
|
|
3880
3938
|
}
|
|
3881
3939
|
// MARK: Update
|
|
3882
3940
|
forceFormUpdate() {
|
|
@@ -4055,5 +4113,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
4055
4113
|
* Generated bundle index. Do not edit.
|
|
4056
4114
|
*/
|
|
4057
4115
|
|
|
4058
|
-
export { ADDRESS_CITY_MAX_LENGTH, ADDRESS_COUNTRY_MAX_LENGTH, ADDRESS_LINE_MAX_LENGTH, ADDRESS_STATE_MAX_LENGTH, ADDRESS_ZIP_MAX_LENGTH, APP_ACTION_FORM_DISABLED_KEY, AbstractAsyncFormlyFormDirective, AbstractConfigAsyncFormlyFormDirective, AbstractDbxPickableItemFieldDirective, AbstractDbxSearchableFieldDisplayDirective, AbstractDbxSearchableValueFieldDirective,
|
|
4116
|
+
export { ADDRESS_CITY_MAX_LENGTH, ADDRESS_COUNTRY_MAX_LENGTH, ADDRESS_LINE_MAX_LENGTH, ADDRESS_STATE_MAX_LENGTH, ADDRESS_ZIP_MAX_LENGTH, APP_ACTION_FORM_DISABLED_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_PREFERRED_COUNTRIES, DOMAIN_NAME_REGEX, DbxActionFormDirective, DbxActionFormSafetyDirective, DbxChecklistItemContentComponent, DbxChecklistItemFieldComponent, DbxDateTimeFieldComponent, DbxDateTimeFieldTimeMode, DbxDefaultChecklistItemFieldDisplayComponent, DbxDefaultSearchableFieldDisplayComponent, DbxForm, DbxFormActionModule, DbxFormActionTransitionModule, DbxFormComponentFieldComponent, DbxFormExpandWrapperComponent, DbxFormExtensionModule, DbxFormFlexWrapperComponent, DbxFormFormlyArrayFieldModule, DbxFormFormlyBooleanFieldModule, DbxFormFormlyChecklistItemFieldModule, DbxFormFormlyComponentFieldModule, DbxFormFormlyDateFieldModule, DbxFormFormlyEnumFieldModule, DbxFormFormlyFieldModule, DbxFormFormlyPhoneFieldModule, DbxFormFormlyPickableFieldModule, DbxFormFormlySearchableFieldModule, DbxFormFormlySelectionModule, DbxFormFormlyTextEditorFieldModule, DbxFormFormlyTextFieldModule, DbxFormFormlyValueModule, DbxFormFormlyWrapperModule, DbxFormInfoWrapperComponent, DbxFormIoModule, DbxFormLayoutModule, DbxFormLoadingSourceDirective, DbxFormModule, DbxFormRepeatArrayTypeComponent, DbxFormSectionWrapperComponent, DbxFormSourceDirective, DbxFormSpacerComponent, DbxFormState, DbxFormSubsectionWrapperComponent, DbxFormToggleWrapperComponent, DbxFormValueChangesDirective, DbxFormlyContext, DbxFormlyFieldsContextDirective, DbxFormlyFormComponent, DbxFormlyModule, DbxMutableForm, DbxPhoneFieldComponent, DbxPickableChipListFieldComponent, DbxPickableListFieldComponent, DbxPickableListFieldItemListComponent, DbxPickableListFieldItemListViewComponent, DbxPickableListFieldItemListViewItemComponent, DbxSearchableChipFieldComponent, DbxSearchableFieldAutocompleteItemComponent, DbxSearchableTextFieldComponent, DbxTextEditorFieldComponent, EXPANDABLE_WRAPPER_KEY, FLEX_WRAPPER_KEY, INFO_WRAPPER_KEY, INVALID_PHONE_NUMBER_MESSAGE, IsDomain, IsInRange, IsTruthy, LABEL_STRING_MAX_LENGTH, MAX_LENGTH_VALIDATION_MESSAGE, MAX_VALIDATION_MESSAGE, MIN_LENGTH_VALIDATION_MESSAGE, MIN_VALIDATION_MESSAGE, PHONE_LABEL_MAX_LENGTH, ProvideDbxForm, ProvideDbxMutableForm, ProvideFormlyContext, 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, addWrapperToFormlyFieldConfig, addressField, addressFormlyFields, addressListField, checkIsFieldFlexLayoutGroupFieldConfig, checkboxField, checklistItemField, chipTextField, cityField, componentField, countryField, dateTimeField, defaultValidationMessages, disableFormlyFieldAutofillAttributes, emailField, expandWrapper, filterPickableItemFieldValuesByLabel, flexLayoutWrapper, formlyField, hiddenField, infoWrapper, makeMetaFilterSearchableFieldValueDisplayFn, maxLengthValidationMessage, maxValidationMessage, minLengthValidationMessage, minValidationMessage, nameField, phoneAndLabelSectionField, phoneField, phoneListField, pickableItemChipField, pickableItemListField, repeatArrayField, searchableChipField, searchableStringChipField, searchableTextField, sectionWrapper, sortPickableItemsByLabel, stateField, staticEnumField, styleWrapper, subsectionWrapper, templateOptionsForFieldConfig, templateOptionsValueForFieldConfig, textAreaField, textEditorField, textField, timeOnlyField, toggleField, toggleWrapper, wrappedPhoneAndLabelField, zipCodeField };
|
|
4059
4117
|
//# sourceMappingURL=dereekb-dbx-form.mjs.map
|