@dereekb/dbx-form 1.2.0 → 2.0.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 +33 -23
- package/esm2020/lib/formly/field/value/date/datetime.field.mjs +3 -3
- 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 +224 -166
- package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form.mjs +223 -165
- package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
- package/lib/form/action/form.action.directive.d.ts +12 -10
- 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 +4 -6
- package/lib/formly/field/value/date/datetime.field.d.ts +2 -2
- 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 +7 -6
|
@@ -5,14 +5,14 @@ import { CommonModule } from '@angular/common';
|
|
|
5
5
|
import * as i1$1 from '@dereekb/dbx-web';
|
|
6
6
|
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';
|
|
7
7
|
import { isPast, addSeconds, isSameMinute, startOfDay, isSameDay, addMinutes } from 'date-fns';
|
|
8
|
-
import {
|
|
9
|
-
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';
|
|
8
|
+
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';
|
|
10
9
|
import { LockSet, SubscriptionObject, switchMapMaybeObs, filterMaybe, switchMapMaybeDefault, asObservable, beginLoading, mapLoadingStateResults, successResult, ListLoadingStateContextInstance, isListLoadingStateEmpty, LoadingStateContextInstance, skipFirstMaybe, scanCount } from '@dereekb/rxjs';
|
|
11
10
|
import * as i2 from '@dereekb/dbx-core';
|
|
12
11
|
import { AbstractSubscriptionDirective, safeDetectChanges, DbxInjectedComponentModule, DbxDatePipeModule, mergeDbxInjectedComponentConfigs, tapDetectChanges } from '@dereekb/dbx-core';
|
|
13
12
|
import * as i3 from '@uirouter/core';
|
|
14
13
|
import * as i4 from '@angular/material/dialog';
|
|
15
14
|
import { MatDialogModule } from '@angular/material/dialog';
|
|
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,7 +27,7 @@ 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';
|
|
@@ -38,14 +38,14 @@ import { MatChipsModule } from '@angular/material/chips';
|
|
|
38
38
|
import * as i4$2 from '@angular/material/divider';
|
|
39
39
|
import { MatDividerModule } from '@angular/material/divider';
|
|
40
40
|
import * as i6$1 from '@angular/material/input';
|
|
41
|
-
import { MatInputModule
|
|
41
|
+
import { MatInputModule } from '@angular/material/input';
|
|
42
42
|
import * as i4$3 from '@angular/material/autocomplete';
|
|
43
43
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
44
44
|
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 !== null && dbxActionFormDisabledWhileWorking !== void 0 ? 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
|
var _a, _b;
|
|
143
153
|
// Use both changes count and whether or not something was in the past to guage whether or not the item has been touched.
|
|
@@ -148,7 +158,7 @@ class DbxActionFormDirective {
|
|
|
148
158
|
let validatorObs;
|
|
149
159
|
const initialIsValidCheck = event.isComplete;
|
|
150
160
|
if (initialIsValidCheck) {
|
|
151
|
-
validatorObs = (this.
|
|
161
|
+
validatorObs = (this.dbxActionFormValidator) ? this.dbxActionFormValidator(value) : of(true);
|
|
152
162
|
}
|
|
153
163
|
else {
|
|
154
164
|
validatorObs = of(false);
|
|
@@ -156,7 +166,7 @@ class DbxActionFormDirective {
|
|
|
156
166
|
let modifiedObs;
|
|
157
167
|
const isConsideredModified = (event.pristine === false && isProbablyTouched);
|
|
158
168
|
if (isConsideredModified) {
|
|
159
|
-
modifiedObs = (this.
|
|
169
|
+
modifiedObs = (this.dbxActionFormModified) ? this.dbxActionFormModified(value) : of(true);
|
|
160
170
|
}
|
|
161
171
|
else {
|
|
162
172
|
modifiedObs = of(false);
|
|
@@ -173,19 +183,24 @@ class DbxActionFormDirective {
|
|
|
173
183
|
// Disable if the form is not yet complete/valid.
|
|
174
184
|
this.source.enable(APP_ACTION_FORM_DISABLED_KEY, valid);
|
|
175
185
|
});
|
|
176
|
-
//
|
|
177
|
-
|
|
186
|
+
// Watch the working state and disable form while working
|
|
187
|
+
this._isWorkingSub.subscription = combineLatest([this.source.isWorking$, this._formDisabledWhileWorking]).pipe(map(([isWorking, lockOnWorking]) => lockOnWorking && isWorking), distinctUntilChanged()).subscribe((disable) => {
|
|
188
|
+
this.form.setDisabled(APP_ACTION_FORM_DISABLED_KEY, disable);
|
|
189
|
+
});
|
|
178
190
|
}
|
|
179
191
|
ngOnDestroy() {
|
|
180
192
|
this.source.enable(APP_ACTION_FORM_DISABLED_KEY);
|
|
181
193
|
this.lockSet.destroyOnNextUnlock(() => {
|
|
182
194
|
this._triggeredSub.destroy();
|
|
183
195
|
this._isCompleteSub.destroy();
|
|
196
|
+
this._isWorkingSub.destroy();
|
|
197
|
+
this._formDisabledWhileWorking.complete();
|
|
198
|
+
this.form.setDisabled(APP_ACTION_FORM_DISABLED_KEY, false);
|
|
184
199
|
});
|
|
185
200
|
}
|
|
186
201
|
preCheckReadyValue(value) {
|
|
187
|
-
let validatorObs = (this.
|
|
188
|
-
let modifiedObs = (this.
|
|
202
|
+
let validatorObs = (this.dbxActionFormValidator) ? this.dbxActionFormValidator(value) : of(true);
|
|
203
|
+
let modifiedObs = (this.dbxActionFormModified) ? this.dbxActionFormModified(value) : of(true);
|
|
189
204
|
return combineLatest([
|
|
190
205
|
validatorObs,
|
|
191
206
|
modifiedObs
|
|
@@ -195,8 +210,8 @@ class DbxActionFormDirective {
|
|
|
195
210
|
return of({ value });
|
|
196
211
|
}
|
|
197
212
|
}
|
|
198
|
-
DbxActionFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormDirective, deps: [{ token: DbxMutableForm, host: true }, { token: i2.
|
|
199
|
-
DbxActionFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionFormDirective, selector: "[dbxActionForm]", inputs: {
|
|
213
|
+
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 });
|
|
214
|
+
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 });
|
|
200
215
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormDirective, decorators: [{
|
|
201
216
|
type: Directive,
|
|
202
217
|
args: [{
|
|
@@ -205,10 +220,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
205
220
|
}], ctorParameters: function () {
|
|
206
221
|
return [{ type: DbxMutableForm, decorators: [{
|
|
207
222
|
type: Host
|
|
208
|
-
}] }, { type: i2.
|
|
209
|
-
}, propDecorators: {
|
|
223
|
+
}] }, { type: i2.DbxActionContextStoreSourceInstance }];
|
|
224
|
+
}, propDecorators: { dbxActionFormValidator: [{
|
|
210
225
|
type: Input
|
|
211
|
-
}],
|
|
226
|
+
}], dbxActionFormModified: [{
|
|
227
|
+
type: Input
|
|
228
|
+
}], dbxActionFormDisabledWhileWorking: [{
|
|
212
229
|
type: Input
|
|
213
230
|
}] } });
|
|
214
231
|
|
|
@@ -218,16 +235,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
218
235
|
* NOTE: Only works with UIRouter
|
|
219
236
|
*/
|
|
220
237
|
class DbxActionFormSafetyDirective extends DbxActionTransitionSafetyDirective {
|
|
221
|
-
constructor(
|
|
238
|
+
constructor(dbxActionForm, source, transitionService, viewContainerRef, dialog) {
|
|
222
239
|
super(source, transitionService, viewContainerRef, dialog);
|
|
223
|
-
this.
|
|
240
|
+
this.dbxActionForm = dbxActionForm;
|
|
224
241
|
}
|
|
225
242
|
_handleOnBeforeTransition(transition) {
|
|
226
|
-
this.
|
|
243
|
+
this.dbxActionForm.form.forceFormUpdate();
|
|
227
244
|
return super._handleOnBeforeTransition(transition);
|
|
228
245
|
}
|
|
229
246
|
}
|
|
230
|
-
DbxActionFormSafetyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormSafetyDirective, deps: [{ token: DbxActionFormDirective, host: true }, { token: i2.
|
|
247
|
+
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 });
|
|
231
248
|
DbxActionFormSafetyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionFormSafetyDirective, selector: "[dbxActionFormSafety]", inputs: { inputSafetyType: ["dbxActionFormSafety", "inputSafetyType"] }, usesInheritance: true, ngImport: i0 });
|
|
232
249
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionFormSafetyDirective, decorators: [{
|
|
233
250
|
type: Directive,
|
|
@@ -237,7 +254,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
237
254
|
}], ctorParameters: function () {
|
|
238
255
|
return [{ type: DbxActionFormDirective, decorators: [{
|
|
239
256
|
type: Host
|
|
240
|
-
}] }, { type: i2.
|
|
257
|
+
}] }, { type: i2.DbxActionContextStoreSourceInstance }, { type: i3.TransitionService }, { type: i0.ViewContainerRef }, { type: i4.MatDialog }];
|
|
241
258
|
}, propDecorators: { inputSafetyType: [{
|
|
242
259
|
type: Input,
|
|
243
260
|
args: ['dbxActionFormSafety']
|
|
@@ -309,9 +326,9 @@ class DbxFormLoadingSourceDirective extends AbstractSubscriptionDirective {
|
|
|
309
326
|
if (obs) {
|
|
310
327
|
subscription = combineLatest([
|
|
311
328
|
// Emit the first time initializing isn't there.
|
|
312
|
-
this.form.stream$.pipe(filter((x) => x.state !== DbxFormState.INITIALIZING), first()),
|
|
329
|
+
this.form.stream$.pipe(filter$1((x) => x.state !== DbxFormState.INITIALIZING), first$1()),
|
|
313
330
|
obs
|
|
314
|
-
]).pipe(map((x) => x[1]), filter((x) => Boolean(x)), distinctUntilChanged((x, y) => x.value === y.value)).subscribe((x) => {
|
|
331
|
+
]).pipe(map$1((x) => x[1]), filter$1((x) => Boolean(x)), distinctUntilChanged$1((x, y) => x.value === y.value)).subscribe((x) => {
|
|
315
332
|
if (!x.error && !x.loading) {
|
|
316
333
|
// console.log('Setting value: ', x.model);
|
|
317
334
|
this.form.setValue(x.value);
|
|
@@ -347,7 +364,7 @@ class DbxFormValueChangesDirective extends AbstractSubscriptionDirective {
|
|
|
347
364
|
this.dbxFormValueChange = new EventEmitter();
|
|
348
365
|
}
|
|
349
366
|
ngOnInit() {
|
|
350
|
-
this.sub = this.form.stream$.pipe(filter
|
|
367
|
+
this.sub = this.form.stream$.pipe(filter(x => x.isComplete), mergeMap(() => this.form.getValue().pipe(first())), delay(0)).subscribe((value) => {
|
|
351
368
|
this.dbxFormValueChange.next(value);
|
|
352
369
|
});
|
|
353
370
|
}
|
|
@@ -386,9 +403,9 @@ class DbxFormSourceDirective extends AbstractSubscriptionDirective {
|
|
|
386
403
|
if (obs) {
|
|
387
404
|
subscription = combineLatest([
|
|
388
405
|
// Emit the first time initializing isn't there.
|
|
389
|
-
this.form.stream$.pipe(filter((x) => x.state !== DbxFormState.INITIALIZING), first()),
|
|
406
|
+
this.form.stream$.pipe(filter$1((x) => x.state !== DbxFormState.INITIALIZING), first$1()),
|
|
390
407
|
obs
|
|
391
|
-
]).pipe(map((x) => x[1]), distinctUntilChanged((x, y) => x === y)).subscribe((x) => {
|
|
408
|
+
]).pipe(map$1((x) => x[1]), distinctUntilChanged$1((x, y) => x === y)).subscribe((x) => {
|
|
392
409
|
this.form.setValue(x);
|
|
393
410
|
});
|
|
394
411
|
}
|
|
@@ -525,9 +542,9 @@ class DbxChecklistItemFieldComponent extends FieldType {
|
|
|
525
542
|
constructor() {
|
|
526
543
|
super(...arguments);
|
|
527
544
|
this._displayContent = new BehaviorSubject(undefined);
|
|
528
|
-
this.displayContent$ = this._displayContent.pipe(switchMapMaybeObs(), distinctUntilChanged(), shareReplay(1));
|
|
529
|
-
this.anchor$ = this.displayContent$.pipe(map(x => x.anchor), shareReplay(1));
|
|
530
|
-
this.rippleDisabled$ = this.displayContent$.pipe(map(x => x.ripple === false || (x.ripple !== true && !x.anchor)), distinctUntilChanged(), shareReplay(1));
|
|
545
|
+
this.displayContent$ = this._displayContent.pipe(switchMapMaybeObs(), distinctUntilChanged$1(), shareReplay(1));
|
|
546
|
+
this.anchor$ = this.displayContent$.pipe(map$1(x => x.anchor), shareReplay(1));
|
|
547
|
+
this.rippleDisabled$ = this.displayContent$.pipe(map$1(x => x.ripple === false || (x.ripple !== true && !x.anchor)), distinctUntilChanged$1(), shareReplay(1));
|
|
531
548
|
}
|
|
532
549
|
get formGroup() {
|
|
533
550
|
return this.form;
|
|
@@ -731,7 +748,7 @@ class AbstractFormExpandableSectionWrapperDirective extends FieldWrapper {
|
|
|
731
748
|
this._formControlObs = new BehaviorSubject(undefined);
|
|
732
749
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
733
750
|
this._toggleOpen = new BehaviorSubject(undefined);
|
|
734
|
-
this.show$ = this._toggleOpen.pipe(switchMap
|
|
751
|
+
this.show$ = this._toggleOpen.pipe(switchMap((toggleOpen) => {
|
|
735
752
|
if (toggleOpen != null) {
|
|
736
753
|
return of(toggleOpen);
|
|
737
754
|
}
|
|
@@ -739,7 +756,7 @@ class AbstractFormExpandableSectionWrapperDirective extends FieldWrapper {
|
|
|
739
756
|
return this.hasValue$;
|
|
740
757
|
}
|
|
741
758
|
}), shareReplay$1(1));
|
|
742
|
-
this.hasValue$ = this.formControl$.pipe(switchMap
|
|
759
|
+
this.hasValue$ = this.formControl$.pipe(switchMap((x) => x.valueChanges.pipe(startWith(x.value), map((value) => {
|
|
743
760
|
return this.hasValueFn(value);
|
|
744
761
|
}), shareReplay$1(1))));
|
|
745
762
|
}
|
|
@@ -842,7 +859,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
842
859
|
class DbxFormToggleWrapperComponent extends AbstractFormExpandableSectionWrapperDirective {
|
|
843
860
|
constructor() {
|
|
844
861
|
super(...arguments);
|
|
845
|
-
this.slideLabel$ = this._toggleOpen.pipe(switchMap
|
|
862
|
+
this.slideLabel$ = this._toggleOpen.pipe(switchMap(x => {
|
|
846
863
|
var _a, _b;
|
|
847
864
|
if ((_a = this.expandableSection) === null || _a === void 0 ? void 0 : _a.toggleLabelObs) {
|
|
848
865
|
return (_b = this.expandableSection) === null || _b === void 0 ? void 0 : _b.toggleLabelObs(x);
|
|
@@ -853,7 +870,7 @@ class DbxFormToggleWrapperComponent extends AbstractFormExpandableSectionWrapper
|
|
|
853
870
|
}), shareReplay$1(1));
|
|
854
871
|
}
|
|
855
872
|
onToggleChange() {
|
|
856
|
-
this.show$.pipe(first
|
|
873
|
+
this.show$.pipe(first()).subscribe((show) => {
|
|
857
874
|
this._toggleOpen.next(!show);
|
|
858
875
|
});
|
|
859
876
|
}
|
|
@@ -1143,7 +1160,7 @@ class ChecklistItemFieldDataSetBuilder {
|
|
|
1143
1160
|
mergedConfig.displayContentObs = combineLatest([
|
|
1144
1161
|
currentField.displayContentObs,
|
|
1145
1162
|
config.displayContentObs
|
|
1146
|
-
]).pipe(map(([a, b]) => {
|
|
1163
|
+
]).pipe(map$1(([a, b]) => {
|
|
1147
1164
|
const result = Object.assign(Object.assign({}, a), b);
|
|
1148
1165
|
// console.log('A and b: ', a, b, result);
|
|
1149
1166
|
return result;
|
|
@@ -1184,7 +1201,7 @@ class ChecklistItemFieldDataSetBuilder {
|
|
|
1184
1201
|
}
|
|
1185
1202
|
// MARK: Utility
|
|
1186
1203
|
customContentFromData(mapFn) {
|
|
1187
|
-
return this.dataObs$.pipe(map(mapFn));
|
|
1204
|
+
return this.dataObs$.pipe(map$1(mapFn));
|
|
1188
1205
|
}
|
|
1189
1206
|
contentWithValueFromData(key, contentFn) {
|
|
1190
1207
|
return this.customContentFromData((data) => {
|
|
@@ -1201,33 +1218,20 @@ class ChecklistItemFieldDataSetBuilder {
|
|
|
1201
1218
|
}
|
|
1202
1219
|
}
|
|
1203
1220
|
|
|
1204
|
-
class
|
|
1205
|
-
}
|
|
1206
|
-
class FormComponentFieldComponent extends FieldType {
|
|
1221
|
+
class DbxFormComponentFieldComponent extends FieldType {
|
|
1207
1222
|
get config() {
|
|
1208
|
-
return this._config;
|
|
1209
|
-
}
|
|
1210
|
-
get componentField() {
|
|
1211
1223
|
return this.field.componentField;
|
|
1212
1224
|
}
|
|
1213
|
-
ngOnInit() {
|
|
1214
|
-
this._config = {
|
|
1215
|
-
componentClass: this.componentField.componentClass,
|
|
1216
|
-
init: (instance) => {
|
|
1217
|
-
instance.field = this;
|
|
1218
|
-
}
|
|
1219
|
-
};
|
|
1220
|
-
}
|
|
1221
1225
|
}
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
<div class="form-
|
|
1226
|
+
DbxFormComponentFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormComponentFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1227
|
+
DbxFormComponentFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: DbxFormComponentFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
|
|
1228
|
+
<div class="dbx-form-component" dbx-injected-content [config]="config"></div>
|
|
1225
1229
|
`, isInline: true, components: [{ type: i2.DbxInjectedComponent, selector: "dbx-injected-content, [dbx-injected-content]", inputs: ["config", "template"] }] });
|
|
1226
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type:
|
|
1230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormComponentFieldComponent, decorators: [{
|
|
1227
1231
|
type: Component,
|
|
1228
1232
|
args: [{
|
|
1229
1233
|
template: `
|
|
1230
|
-
<div class="form-
|
|
1234
|
+
<div class="dbx-form-component" dbx-injected-content [config]="config"></div>
|
|
1231
1235
|
`
|
|
1232
1236
|
}]
|
|
1233
1237
|
}] });
|
|
@@ -1235,14 +1239,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1235
1239
|
class DbxFormFormlyComponentFieldModule {
|
|
1236
1240
|
}
|
|
1237
1241
|
DbxFormFormlyComponentFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormFormlyComponentFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1238
|
-
DbxFormFormlyComponentFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormFormlyComponentFieldModule, declarations: [
|
|
1239
|
-
DbxInjectedComponentModule, i1$4.FormlyModule], exports: [
|
|
1242
|
+
DbxFormFormlyComponentFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormFormlyComponentFieldModule, declarations: [DbxFormComponentFieldComponent], imports: [CommonModule,
|
|
1243
|
+
DbxInjectedComponentModule, i1$4.FormlyModule], exports: [DbxFormComponentFieldComponent] });
|
|
1240
1244
|
DbxFormFormlyComponentFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormFormlyComponentFieldModule, imports: [[
|
|
1241
1245
|
CommonModule,
|
|
1242
1246
|
DbxInjectedComponentModule,
|
|
1243
1247
|
FormlyModule.forChild({
|
|
1244
1248
|
types: [
|
|
1245
|
-
{ name: 'component', component:
|
|
1249
|
+
{ name: 'component', component: DbxFormComponentFieldComponent }
|
|
1246
1250
|
]
|
|
1247
1251
|
})
|
|
1248
1252
|
]] });
|
|
@@ -1254,25 +1258,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1254
1258
|
DbxInjectedComponentModule,
|
|
1255
1259
|
FormlyModule.forChild({
|
|
1256
1260
|
types: [
|
|
1257
|
-
{ name: 'component', component:
|
|
1261
|
+
{ name: 'component', component: DbxFormComponentFieldComponent }
|
|
1258
1262
|
]
|
|
1259
1263
|
})
|
|
1260
1264
|
],
|
|
1261
1265
|
declarations: [
|
|
1262
|
-
|
|
1266
|
+
DbxFormComponentFieldComponent
|
|
1263
1267
|
],
|
|
1264
1268
|
exports: [
|
|
1265
|
-
|
|
1269
|
+
DbxFormComponentFieldComponent
|
|
1266
1270
|
]
|
|
1267
1271
|
}]
|
|
1268
1272
|
}] });
|
|
1269
1273
|
|
|
1270
|
-
function componentField(
|
|
1274
|
+
function componentField(config) {
|
|
1271
1275
|
return {
|
|
1272
1276
|
type: 'component',
|
|
1273
|
-
componentField:
|
|
1274
|
-
componentClass
|
|
1275
|
-
}
|
|
1277
|
+
componentField: config
|
|
1276
1278
|
};
|
|
1277
1279
|
}
|
|
1278
1280
|
|
|
@@ -1287,18 +1289,18 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1287
1289
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
1288
1290
|
this._displayHashMap = new BehaviorSubject(new Map());
|
|
1289
1291
|
this.filterInputValue$ = this.inputCtrl.valueChanges.pipe(startWith(undefined));
|
|
1290
|
-
this.filterInputValueString$ = this.filterInputValue$.pipe(debounceTime(200), distinctUntilChanged
|
|
1291
|
-
this.loadResultsDisplayValuesState$ = this.formControl$.pipe(first
|
|
1292
|
-
this._formControlValue = this.formControl$.pipe(switchMap
|
|
1293
|
-
this.loadResultsDisplayValues$ = this.loadResultsDisplayValuesState$.pipe(map
|
|
1292
|
+
this.filterInputValueString$ = this.filterInputValue$.pipe(debounceTime(200), distinctUntilChanged(), shareReplay$1(1));
|
|
1293
|
+
this.loadResultsDisplayValuesState$ = this.formControl$.pipe(first(), switchMap(() => this.loadValuesFn().pipe(switchMap((x) => this.loadDisplayValuesForFieldValues(x)), startWith(beginLoading()))), shareReplay$1(1));
|
|
1294
|
+
this._formControlValue = this.formControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith(control.value), shareReplay$1(1))));
|
|
1295
|
+
this.loadResultsDisplayValues$ = this.loadResultsDisplayValuesState$.pipe(map(x => { var _a; return (_a = x === null || x === void 0 ? void 0 : x.value) !== null && _a !== void 0 ? _a : []; }));
|
|
1294
1296
|
/**
|
|
1295
1297
|
* Current values in the form control.
|
|
1296
1298
|
*/
|
|
1297
|
-
this.values$ = this._formControlValue.pipe(map
|
|
1299
|
+
this.values$ = this._formControlValue.pipe(map(convertMaybeToArray), shareReplay$1(1));
|
|
1298
1300
|
/**
|
|
1299
1301
|
* Current values with their display value.
|
|
1300
1302
|
*/
|
|
1301
|
-
this.displayValuesState$ = combineLatest([this.loadResultsDisplayValues$, this.values$]).pipe(switchMap
|
|
1303
|
+
this.displayValuesState$ = combineLatest([this.loadResultsDisplayValues$, this.values$]).pipe(switchMap(([displayValues, currentValues]) => {
|
|
1302
1304
|
const displayValuesMap = makeValuesGroupMap(displayValues, (x) => this.hashForValue(x.value));
|
|
1303
1305
|
const valuesNotInDisplayMap = [];
|
|
1304
1306
|
currentValues.forEach((x) => {
|
|
@@ -1310,7 +1312,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1310
1312
|
}
|
|
1311
1313
|
});
|
|
1312
1314
|
if (valuesNotInDisplayMap.length) {
|
|
1313
|
-
return this.loadDisplayValuesForValues(valuesNotInDisplayMap).pipe(map
|
|
1315
|
+
return this.loadDisplayValuesForValues(valuesNotInDisplayMap).pipe(map(x => mapLoadingStateResults(x, {
|
|
1314
1316
|
mapValue: (loadedValues) => {
|
|
1315
1317
|
loadedValues.forEach(x => { var _a; return x.isUnknown = (_a = x.isUnknown) !== null && _a !== void 0 ? _a : true; }); // Assign unknown flag.
|
|
1316
1318
|
return ([...displayValues, ...loadedValues]);
|
|
@@ -1324,14 +1326,14 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1324
1326
|
/**
|
|
1325
1327
|
* Results to be displayed if filtered.
|
|
1326
1328
|
*/
|
|
1327
|
-
this.filteredSearchResultsState$ = this.loadResultsDisplayValues$.pipe(switchMap
|
|
1329
|
+
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, {
|
|
1328
1330
|
mapValue: (displayValues) => {
|
|
1329
1331
|
const valueHashSet = new Set(values.map(x => this.hashForValue(x)));
|
|
1330
1332
|
return displayValues.filter(x => !x.isUnknown && valueHashSet.has(x._hash));
|
|
1331
1333
|
}
|
|
1332
1334
|
})), startWith(beginLoading()))))), shareReplay$1(1));
|
|
1333
|
-
this.filteredSearchResults$ = this.filteredSearchResultsState$.pipe(map
|
|
1334
|
-
this.items$ = combineLatest([this.filteredSearchResults$, this.values$]).pipe(map
|
|
1335
|
+
this.filteredSearchResults$ = this.filteredSearchResultsState$.pipe(map(x => x === null || x === void 0 ? void 0 : x.value), filterMaybe(), shareReplay$1(1));
|
|
1336
|
+
this.items$ = combineLatest([this.filteredSearchResults$, this.values$]).pipe(map(([displayValues, values]) => {
|
|
1335
1337
|
const selectedHashValuesSet = new Set(values.map(x => this.hashForValue(x)));
|
|
1336
1338
|
let items = displayValues.map((x) => ({ value: x, selected: selectedHashValuesSet.has(x._hash) }));
|
|
1337
1339
|
if (this.sortItems) {
|
|
@@ -1339,17 +1341,17 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1339
1341
|
}
|
|
1340
1342
|
return items;
|
|
1341
1343
|
}), shareReplay$1(1));
|
|
1342
|
-
this.itemsLoadingState$ = this.loadResultsDisplayValues$.pipe(switchMap
|
|
1344
|
+
this.itemsLoadingState$ = this.loadResultsDisplayValues$.pipe(switchMap(x => this.items$.pipe(first(), map(x => successResult(x)), startWith(beginLoading()), shareReplay$1(1))));
|
|
1343
1345
|
/**
|
|
1344
1346
|
* Context used for managing the loading of items, or when the current results change.
|
|
1345
1347
|
*/
|
|
1346
1348
|
this.context = new ListLoadingStateContextInstance({ obs: this.itemsLoadingState$, showLoadingOnNoValue: false });
|
|
1347
|
-
this.filterItemsLoadingState$ = this.items$.pipe(map
|
|
1349
|
+
this.filterItemsLoadingState$ = this.items$.pipe(map(x => successResult(x)), startWith(beginLoading()), shareReplay$1(1));
|
|
1348
1350
|
/**
|
|
1349
1351
|
* Context used for searching/filtering.
|
|
1350
1352
|
*/
|
|
1351
1353
|
this.filterResultsContext = new ListLoadingStateContextInstance({ obs: this.filteredSearchResultsState$, showLoadingOnNoValue: true });
|
|
1352
|
-
this.noItemsAvailable$ = this.filterItemsLoadingState$.pipe(isListLoadingStateEmpty(), distinctUntilChanged
|
|
1354
|
+
this.noItemsAvailable$ = this.filterItemsLoadingState$.pipe(isListLoadingStateEmpty(), distinctUntilChanged());
|
|
1353
1355
|
}
|
|
1354
1356
|
get readonly() {
|
|
1355
1357
|
var _a;
|
|
@@ -1442,7 +1444,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1442
1444
|
return this.loadDisplayValuesForFieldValues(values.map((value) => ({ value })));
|
|
1443
1445
|
}
|
|
1444
1446
|
loadDisplayValuesForFieldValues(values) {
|
|
1445
|
-
return this.getDisplayValuesForFieldValues(values).pipe(map
|
|
1447
|
+
return this.getDisplayValuesForFieldValues(values).pipe(map((displayValues) => successResult(displayValues)), startWith(beginLoading()), shareReplay$1(1));
|
|
1446
1448
|
}
|
|
1447
1449
|
getDisplayValuesForFieldValues(values) {
|
|
1448
1450
|
return this._displayHashMap.pipe(mergeMap((displayMap) => {
|
|
@@ -1454,7 +1456,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1454
1456
|
if (needsDisplay.length > 0) {
|
|
1455
1457
|
// Go get the display value.
|
|
1456
1458
|
const displayValuesObs = this.displayForValue(needsDisplay.map(x => x[2]));
|
|
1457
|
-
return displayValuesObs.pipe(first
|
|
1459
|
+
return displayValuesObs.pipe(first(), map((displayResults) => {
|
|
1458
1460
|
const displayResultsWithHash = displayResults.map((x) => {
|
|
1459
1461
|
x._hash = this.hashForValue(x.value);
|
|
1460
1462
|
return x;
|
|
@@ -1480,7 +1482,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
|
|
|
1480
1482
|
super.ngOnInit();
|
|
1481
1483
|
this._formControlObs.next(this.formControl);
|
|
1482
1484
|
// Focus after finished loading for the first time.
|
|
1483
|
-
this.context.loading$.pipe(delay(10), filter
|
|
1485
|
+
this.context.loading$.pipe(delay(10), filter(x => x), first()).subscribe(() => {
|
|
1484
1486
|
var _a;
|
|
1485
1487
|
(_a = this.filterMatInput) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1486
1488
|
});
|
|
@@ -1600,7 +1602,7 @@ class DbxPickableListFieldItemListViewComponent extends AbstractSelectionValueLi
|
|
|
1600
1602
|
};
|
|
1601
1603
|
this.items$ = this.values$.pipe(
|
|
1602
1604
|
// NOTE: This causes the "value" to be a PickableValueFieldDisplayValue<T>, which means we emit PickableValueFieldDisplayValue<T> to DbxPickableListFieldComponent.
|
|
1603
|
-
map
|
|
1605
|
+
map(x => mapItemValuesToValueListItemConfig(this.config, x)), shareReplay$1(1));
|
|
1604
1606
|
}
|
|
1605
1607
|
get multiple() {
|
|
1606
1608
|
return this.dbxPickableListFieldComponent.multiSelect;
|
|
@@ -1748,19 +1750,19 @@ function pickableItemListField(config) {
|
|
|
1748
1750
|
})), { pickableField: config }));
|
|
1749
1751
|
}
|
|
1750
1752
|
|
|
1751
|
-
const
|
|
1753
|
+
const DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN = new InjectionToken('DbxSearchableField');
|
|
1752
1754
|
class DbxSearchableFieldAutocompleteItemComponent {
|
|
1753
1755
|
constructor() {
|
|
1754
1756
|
this._displayValue = new BehaviorSubject(undefined);
|
|
1755
1757
|
this.displayValue$ = this._displayValue.pipe(filterMaybe(), shareReplay$1(1));
|
|
1756
|
-
this.config$ = this.displayValue$.pipe(map
|
|
1758
|
+
this.config$ = this.displayValue$.pipe(map(x => {
|
|
1757
1759
|
const config = Object.assign(Object.assign({}, x.display), { providers: mergeIntoArray([{
|
|
1758
|
-
provide:
|
|
1760
|
+
provide: DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN,
|
|
1759
1761
|
useValue: x
|
|
1760
1762
|
}], x.display.providers) });
|
|
1761
1763
|
return config;
|
|
1762
1764
|
}));
|
|
1763
|
-
this.anchor$ = this.displayValue$.pipe(map
|
|
1765
|
+
this.anchor$ = this.displayValue$.pipe(map(x => x.anchor));
|
|
1764
1766
|
}
|
|
1765
1767
|
set displayValue(displayValue) {
|
|
1766
1768
|
this._displayValue.next(displayValue);
|
|
@@ -1794,14 +1796,14 @@ class AbstractDbxSearchableFieldDisplayDirective {
|
|
|
1794
1796
|
this.displayValue = displayValue;
|
|
1795
1797
|
}
|
|
1796
1798
|
}
|
|
1797
|
-
AbstractDbxSearchableFieldDisplayDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractDbxSearchableFieldDisplayDirective, deps: [{ token:
|
|
1799
|
+
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 });
|
|
1798
1800
|
AbstractDbxSearchableFieldDisplayDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: AbstractDbxSearchableFieldDisplayDirective, ngImport: i0 });
|
|
1799
1801
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractDbxSearchableFieldDisplayDirective, decorators: [{
|
|
1800
1802
|
type: Directive
|
|
1801
1803
|
}], ctorParameters: function () {
|
|
1802
1804
|
return [{ type: undefined, decorators: [{
|
|
1803
1805
|
type: Inject,
|
|
1804
|
-
args: [
|
|
1806
|
+
args: [DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN]
|
|
1805
1807
|
}] }];
|
|
1806
1808
|
} });
|
|
1807
1809
|
class DbxDefaultSearchableFieldDisplayComponent extends AbstractDbxSearchableFieldDisplayDirective {
|
|
@@ -1844,17 +1846,17 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType$1 {
|
|
|
1844
1846
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
1845
1847
|
this._displayHashMap = new BehaviorSubject(new Map());
|
|
1846
1848
|
this.inputValue$ = this.inputCtrl.valueChanges.pipe(startWith(this.inputCtrl.value));
|
|
1847
|
-
this.inputValueString$ = this.inputValue$.pipe(debounceTime(200), distinctUntilChanged
|
|
1848
|
-
this.searchResultsState$ = this.inputValueString$.pipe(switchMap
|
|
1849
|
+
this.inputValueString$ = this.inputValue$.pipe(debounceTime(200), distinctUntilChanged());
|
|
1850
|
+
this.searchResultsState$ = this.inputValueString$.pipe(switchMap((text) => ((text || this.searchOnEmptyText) ? this.search(text !== null && text !== void 0 ? text : '') : of([])).pipe(switchMap((x) => this.loadDisplayValuesForFieldValues(x)),
|
|
1849
1851
|
// Return begin loading to setup the loading state.
|
|
1850
1852
|
startWith(beginLoading()))), shareReplay$1(1));
|
|
1851
1853
|
this.singleValueSyncSubscription = new SubscriptionObject();
|
|
1852
1854
|
this.searchContext = new LoadingStateContextInstance({ obs: this.searchResultsState$, showLoadingOnNoValue: false });
|
|
1853
|
-
this.searchResults$ = this.searchResultsState$.pipe(map
|
|
1854
|
-
this._formControlValue = this.formControl$.pipe(switchMap
|
|
1855
|
-
this.values$ = this._formControlValue.pipe(map
|
|
1856
|
-
this.displayValuesState$ = this.values$.pipe(distinctUntilChanged
|
|
1857
|
-
this.displayValues$ = this.displayValuesState$.pipe(map
|
|
1855
|
+
this.searchResults$ = this.searchResultsState$.pipe(map(x => { var _a; return (_a = x === null || x === void 0 ? void 0 : x.value) !== null && _a !== void 0 ? _a : []; }));
|
|
1856
|
+
this._formControlValue = this.formControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith(control.value), shareReplay$1(1))));
|
|
1857
|
+
this.values$ = this._formControlValue.pipe(map(convertMaybeToArray), shareReplay$1(1));
|
|
1858
|
+
this.displayValuesState$ = this.values$.pipe(distinctUntilChanged(), switchMap((values) => this.loadDisplayValuesForValues(values)), shareReplay$1(1));
|
|
1859
|
+
this.displayValues$ = this.displayValuesState$.pipe(map(x => { var _a; return (_a = x === null || x === void 0 ? void 0 : x.value) !== null && _a !== void 0 ? _a : []; }));
|
|
1858
1860
|
}
|
|
1859
1861
|
get name() {
|
|
1860
1862
|
var _a, _b;
|
|
@@ -1917,7 +1919,7 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType$1 {
|
|
|
1917
1919
|
return this.loadDisplayValuesForFieldValues(values.map((value) => ({ value })));
|
|
1918
1920
|
}
|
|
1919
1921
|
loadDisplayValuesForFieldValues(values) {
|
|
1920
|
-
return this.getDisplayValuesForFieldValues(values).pipe(map
|
|
1922
|
+
return this.getDisplayValuesForFieldValues(values).pipe(map((displayValues) => successResult(displayValues)), startWith(beginLoading()), shareReplay$1(1));
|
|
1921
1923
|
}
|
|
1922
1924
|
getDisplayValuesForFieldValues(values) {
|
|
1923
1925
|
return this._displayHashMap.pipe(mergeMap((displayMap) => {
|
|
@@ -1932,7 +1934,7 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType$1 {
|
|
|
1932
1934
|
const displayValuesObs = this.displayForValue(needsDisplay.map(x => x[2]));
|
|
1933
1935
|
const defaultDisplay = mergeDbxInjectedComponentConfigs([this.defaultDisplay, this.display]);
|
|
1934
1936
|
const anchorForValue = this.useAnchor && this.anchorForValue;
|
|
1935
|
-
obs = displayValuesObs.pipe(first
|
|
1937
|
+
obs = displayValuesObs.pipe(first(), map((displayResults) => {
|
|
1936
1938
|
// Assign the default component classes to complete configuration.
|
|
1937
1939
|
displayResults.forEach(x => {
|
|
1938
1940
|
if (!x.display) {
|
|
@@ -2137,7 +2139,7 @@ function makeMetaFilterSearchableFieldValueDisplayFn({ loadMetaForValues, makeDi
|
|
|
2137
2139
|
let allValues;
|
|
2138
2140
|
if (needLoading.length > 0) {
|
|
2139
2141
|
const loadingResult = loadMetaForValues(needLoading);
|
|
2140
|
-
allValues = loadingResult.pipe(map((result) => {
|
|
2142
|
+
allValues = loadingResult.pipe(map$1((result) => {
|
|
2141
2143
|
const resultMap = arrayToMap(result, (x) => x.value);
|
|
2142
2144
|
const mergedWithLoad = needLoading.map((x) => {
|
|
2143
2145
|
var _a;
|
|
@@ -2149,12 +2151,12 @@ function makeMetaFilterSearchableFieldValueDisplayFn({ loadMetaForValues, makeDi
|
|
|
2149
2151
|
meta });
|
|
2150
2152
|
}).filter(x => !x.meta);
|
|
2151
2153
|
return mergedWithLoad;
|
|
2152
|
-
}), map((result) => [...loaded, ...result]));
|
|
2154
|
+
}), map$1((result) => [...loaded, ...result]));
|
|
2153
2155
|
}
|
|
2154
2156
|
else {
|
|
2155
2157
|
allValues = of(loaded);
|
|
2156
2158
|
}
|
|
2157
|
-
return allValues.pipe(switchMap
|
|
2159
|
+
return allValues.pipe(switchMap((x) => makeDisplayForValues(x)));
|
|
2158
2160
|
};
|
|
2159
2161
|
}
|
|
2160
2162
|
function searchableStringChipField(config) {
|
|
@@ -2180,9 +2182,9 @@ function searchableTextField(config) {
|
|
|
2180
2182
|
class DbxSearchableTextFieldComponent extends AbstractDbxSearchableValueFieldDirective {
|
|
2181
2183
|
constructor() {
|
|
2182
2184
|
super(...arguments);
|
|
2183
|
-
this.selectedDisplayValue$ = this.displayValues$.pipe(map
|
|
2184
|
-
this.hasValue$ = this.selectedDisplayValue$.pipe(map
|
|
2185
|
-
this.showSelectedDisplayValue$ = this.selectedDisplayValue$.pipe(map
|
|
2185
|
+
this.selectedDisplayValue$ = this.displayValues$.pipe(map(x => x[0]), shareReplay$1(1), tapDetectChanges(this.cdRef));
|
|
2186
|
+
this.hasValue$ = this.selectedDisplayValue$.pipe(map(x => Boolean(x)));
|
|
2187
|
+
this.showSelectedDisplayValue$ = this.selectedDisplayValue$.pipe(map(x => this.showSelectedValue && Boolean(x)), distinctUntilChanged(), shareReplay$1(1), tapDetectChanges(this.cdRef));
|
|
2186
2188
|
this.multiSelect = false;
|
|
2187
2189
|
this._clearInputSub = new SubscriptionObject();
|
|
2188
2190
|
}
|
|
@@ -2364,7 +2366,7 @@ class DbxTextEditorFieldComponent extends FieldType$1 {
|
|
|
2364
2366
|
super.ngOnInit();
|
|
2365
2367
|
this._editor = new Editor({});
|
|
2366
2368
|
// Watch for value changes every second and update the pristine level.
|
|
2367
|
-
this._sub.subscription = this.editor.valueChanges.pipe(debounceTime$1(100), filter(_ => this.editor.view.hasFocus())).subscribe(() => {
|
|
2369
|
+
this._sub.subscription = this.editor.valueChanges.pipe(debounceTime$1(100), filter$1(_ => this.editor.view.hasFocus())).subscribe(() => {
|
|
2368
2370
|
this.formControl.updateValueAndValidity();
|
|
2369
2371
|
this.formControl.markAsDirty();
|
|
2370
2372
|
});
|
|
@@ -2566,7 +2568,7 @@ DbxFormRepeatArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion:
|
|
|
2566
2568
|
</div>
|
|
2567
2569
|
</dbx-subsection>
|
|
2568
2570
|
</div>
|
|
2569
|
-
`, 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$
|
|
2571
|
+
`, 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"] }] });
|
|
2570
2572
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxFormRepeatArrayTypeComponent, decorators: [{
|
|
2571
2573
|
type: Component,
|
|
2572
2574
|
args: [{
|
|
@@ -2737,35 +2739,37 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2737
2739
|
this._formControlObs = new BehaviorSubject(undefined);
|
|
2738
2740
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
2739
2741
|
this._updateTime = new Subject();
|
|
2740
|
-
this.value$ = this.formControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith$1(control.value))), distinctUntilChanged((a, b) => isSameMinute(a, b)), shareReplay(1));
|
|
2742
|
+
this.value$ = this.formControl$.pipe(switchMap$1(control => control.valueChanges.pipe(startWith$1(control.value))), distinctUntilChanged$1((a, b) => isSameMinute(a, b)), shareReplay(1));
|
|
2741
2743
|
/**
|
|
2742
2744
|
* Used to trigger/display visual updates (specifically on timeDistance, etc.).
|
|
2743
2745
|
*/
|
|
2744
|
-
this.displayValue$ = interval(10 * 1000).pipe(startWith$1(0), map(_ => new Date().getMinutes()), distinctUntilChanged(), tap((_) => this.cdRef.markForCheck()), switchMap(_ => this.value$), shareReplay(1));
|
|
2745
|
-
this.timeString$ = this.value$.pipe(filterMaybe(), map((x) => {
|
|
2746
|
+
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));
|
|
2747
|
+
this.timeString$ = this.value$.pipe(filterMaybe(), map$1((x) => {
|
|
2746
2748
|
const timezone = guessCurrentTimezone();
|
|
2747
2749
|
const timeString = toReadableTimeString(x, timezone);
|
|
2748
2750
|
return timeString;
|
|
2749
2751
|
}));
|
|
2752
|
+
this.dateInputCtrl = new FormControl(new Date(), {
|
|
2753
|
+
validators: []
|
|
2754
|
+
});
|
|
2750
2755
|
this.timeInputCtrl = new FormControl('', {
|
|
2751
2756
|
validators: [
|
|
2752
|
-
Validators.pattern(/^([0-9]|(0[0-9])|(1[0-9])|(2[0-3]))(:)?([0-5][0-9])?(\s)?([apAP][Mm])?(\\s)*$/)
|
|
2757
|
+
Validators.pattern(/^(now)$|^([0-9]|(0[0-9])|(1[0-9])|(2[0-3]))(:)?([0-5][0-9])?(\s)?([apAP][Mm])?(\\s)*$/)
|
|
2753
2758
|
]
|
|
2754
2759
|
});
|
|
2755
|
-
this._date = new BehaviorSubject(new Date());
|
|
2756
2760
|
this._config = new BehaviorSubject(undefined);
|
|
2757
|
-
this.fullDay$ = this.fullDayControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith$1(control.value))));
|
|
2758
|
-
this.showTimeInput$ = this.fullDay$.pipe(map(x => !x && this.timeMode !== DateTimeFieldTimeMode.NONE));
|
|
2759
|
-
this.showAddTime$ = this.showTimeInput$.pipe(map(x => !x && this.timeMode === DateTimeFieldTimeMode.OPTIONAL), shareReplay(1));
|
|
2760
|
-
this.date$ = this.
|
|
2761
|
-
this.dateValue$ = merge(this.value$.pipe(
|
|
2762
|
-
this.timeInput$ = this._updateTime.pipe(debounceTime$1(5), map(_ => this.timeInputCtrl.value), distinctUntilChanged());
|
|
2761
|
+
this.fullDay$ = this.fullDayControl$.pipe(switchMap$1(control => control.valueChanges.pipe(startWith$1(control.value))));
|
|
2762
|
+
this.showTimeInput$ = this.fullDay$.pipe(map$1(x => !x && this.timeMode !== DateTimeFieldTimeMode.NONE));
|
|
2763
|
+
this.showAddTime$ = this.showTimeInput$.pipe(map$1(x => !x && this.timeMode === DateTimeFieldTimeMode.OPTIONAL), shareReplay(1));
|
|
2764
|
+
this.date$ = this.dateInputCtrl.valueChanges.pipe(filterMaybe(), shareReplay(1));
|
|
2765
|
+
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));
|
|
2766
|
+
this.timeInput$ = this._updateTime.pipe(debounceTime$1(5), map$1(_ => this.timeInputCtrl.value), distinctUntilChanged$1());
|
|
2763
2767
|
this.config$ = this._config.pipe(switchMapMaybeDefault(), shareReplay(1));
|
|
2764
2768
|
this.rawDateTime$ = combineLatest([
|
|
2765
2769
|
this.dateValue$,
|
|
2766
2770
|
this.timeInput$.pipe(startWith$1(null)),
|
|
2767
2771
|
this.fullDay$
|
|
2768
|
-
]).pipe(map(([date, timeString, fullDay]) => {
|
|
2772
|
+
]).pipe(map$1(([date, timeString, fullDay]) => {
|
|
2769
2773
|
var _a;
|
|
2770
2774
|
let result;
|
|
2771
2775
|
if (date) {
|
|
@@ -2788,12 +2792,12 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2788
2792
|
}
|
|
2789
2793
|
}
|
|
2790
2794
|
return result;
|
|
2791
|
-
}), distinctUntilChanged((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
|
|
2795
|
+
}), distinctUntilChanged$1((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
|
|
2792
2796
|
this.timeOutput$ = combineLatest([
|
|
2793
2797
|
this.rawDateTime$,
|
|
2794
2798
|
this._offset,
|
|
2795
|
-
this.config$.pipe(distinctUntilChanged()),
|
|
2796
|
-
]).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]) => {
|
|
2799
|
+
this.config$.pipe(distinctUntilChanged$1()),
|
|
2800
|
+
]).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]) => {
|
|
2797
2801
|
if (date != null) {
|
|
2798
2802
|
const instance = new DateTimeMinuteInstance(Object.assign(Object.assign({ date }, config), { roundDownToMinute: true }));
|
|
2799
2803
|
date = instance.limit(date);
|
|
@@ -2801,7 +2805,7 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2801
2805
|
date = addMinutes(date, minutes);
|
|
2802
2806
|
}
|
|
2803
2807
|
return date;
|
|
2804
|
-
}), distinctUntilChanged((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
|
|
2808
|
+
}), distinctUntilChanged$1((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
|
|
2805
2809
|
}
|
|
2806
2810
|
get dateOnly() {
|
|
2807
2811
|
return this.timeMode === DateTimeFieldTimeMode.NONE;
|
|
@@ -2838,7 +2842,18 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2838
2842
|
if (!this.timeInputCtrl.value && x === '12:00AM') {
|
|
2839
2843
|
return;
|
|
2840
2844
|
}
|
|
2841
|
-
this.
|
|
2845
|
+
this.setTime(x);
|
|
2846
|
+
});
|
|
2847
|
+
// Watch for disabled changes so we can propogate them properly.
|
|
2848
|
+
this.formControl.registerOnDisabledChange((disabled) => {
|
|
2849
|
+
if (disabled) {
|
|
2850
|
+
this.dateInputCtrl.disable({ emitEvent: false });
|
|
2851
|
+
this.timeInputCtrl.disable({ emitEvent: false });
|
|
2852
|
+
}
|
|
2853
|
+
else {
|
|
2854
|
+
this.dateInputCtrl.enable({ emitEvent: false });
|
|
2855
|
+
this.timeInputCtrl.enable({ emitEvent: false });
|
|
2856
|
+
}
|
|
2842
2857
|
});
|
|
2843
2858
|
const isFullDayField = this.dateTimeField.fullDayFieldName;
|
|
2844
2859
|
let fullDayFieldCtrl;
|
|
@@ -2868,25 +2883,25 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2868
2883
|
ngOnDestroy() {
|
|
2869
2884
|
super.ngOnDestroy();
|
|
2870
2885
|
this._formControlObs.complete();
|
|
2871
|
-
this._date.complete();
|
|
2872
2886
|
this._updateTime.complete();
|
|
2873
2887
|
this._config.complete();
|
|
2874
2888
|
this._sub.destroy();
|
|
2875
2889
|
this._valueSub.destroy();
|
|
2876
2890
|
}
|
|
2877
|
-
dateTextChanged(e) {
|
|
2878
|
-
const value = this.dateInput.value;
|
|
2879
|
-
if (value == null) {
|
|
2880
|
-
this._date.next(undefined);
|
|
2881
|
-
}
|
|
2882
|
-
}
|
|
2883
2891
|
datePicked(event) {
|
|
2884
2892
|
const date = event.value;
|
|
2885
2893
|
if (date) {
|
|
2886
|
-
this.
|
|
2894
|
+
this.dateInputCtrl.setValue(date);
|
|
2887
2895
|
this._updateTime.next();
|
|
2888
2896
|
}
|
|
2889
2897
|
}
|
|
2898
|
+
setLogicalTime(time) {
|
|
2899
|
+
const date = dateFromLogicalDate(time);
|
|
2900
|
+
if (date) {
|
|
2901
|
+
const timeString = toLocalReadableTimeString(date);
|
|
2902
|
+
this.setTime(timeString);
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2890
2905
|
setTime(time) {
|
|
2891
2906
|
this.timeInputCtrl.setValue(time);
|
|
2892
2907
|
this._offset.next(0);
|
|
@@ -2930,20 +2945,17 @@ class DbxDateTimeFieldComponent extends FieldType$1 {
|
|
|
2930
2945
|
this.setFullDay(true);
|
|
2931
2946
|
}
|
|
2932
2947
|
setFullDay(fullDay) {
|
|
2933
|
-
this.fullDayControl$.pipe(first()).subscribe((x) => {
|
|
2948
|
+
this.fullDayControl$.pipe(first$1()).subscribe((x) => {
|
|
2934
2949
|
x.setValue(fullDay);
|
|
2935
2950
|
});
|
|
2936
2951
|
}
|
|
2937
2952
|
}
|
|
2938
2953
|
DbxDateTimeFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxDateTimeFieldComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2939
|
-
DbxDateTimeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: DbxDateTimeFieldComponent, selector: "ng-component",
|
|
2954
|
+
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 } });
|
|
2940
2955
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxDateTimeFieldComponent, decorators: [{
|
|
2941
2956
|
type: Component,
|
|
2942
|
-
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 [
|
|
2943
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }
|
|
2944
|
-
type: ViewChild,
|
|
2945
|
-
args: ['dateInput', { read: MatInput }]
|
|
2946
|
-
}] } });
|
|
2957
|
+
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" }]
|
|
2958
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
2947
2959
|
|
|
2948
2960
|
class DbxFormFormlyDateFieldModule {
|
|
2949
2961
|
}
|
|
@@ -3023,10 +3035,10 @@ const TAKE_NEXT_UPCOMING_TIME_CONFIG_OBS = () => of({
|
|
|
3023
3035
|
/**
|
|
3024
3036
|
* Same as DateTime field but with the Date input hidden by default.
|
|
3025
3037
|
*/
|
|
3026
|
-
function timeOnlyField(config) {
|
|
3038
|
+
function timeOnlyField(config = {}) {
|
|
3027
3039
|
return dateTimeField(Object.assign(Object.assign({}, config), { timeMode: DateTimeFieldTimeMode.REQUIRED, timeOnly: true }));
|
|
3028
3040
|
}
|
|
3029
|
-
function dateTimeField(config) {
|
|
3041
|
+
function dateTimeField(config = {}) {
|
|
3030
3042
|
const { key = 'date', timeMode = DateTimeFieldTimeMode.REQUIRED, fullDayFieldName, getConfigObs, timeOnly = false } = config;
|
|
3031
3043
|
const fieldConfig = formlyField(Object.assign(Object.assign({ key, type: 'datetime', dateTimeField: {
|
|
3032
3044
|
timeMode: (timeOnly) ? DateTimeFieldTimeMode.REQUIRED : timeMode,
|
|
@@ -3535,10 +3547,11 @@ class DbxFormlyContext {
|
|
|
3535
3547
|
this.lockSet = new LockSet();
|
|
3536
3548
|
this._fields = new BehaviorSubject(undefined);
|
|
3537
3549
|
this._initialValue = new BehaviorSubject(undefined);
|
|
3538
|
-
this._disabled = new BehaviorSubject(
|
|
3550
|
+
this._disabled = new BehaviorSubject(undefined);
|
|
3539
3551
|
this._delegate = new BehaviorSubject(undefined);
|
|
3540
3552
|
this.fields$ = this._fields.pipe(filterMaybe());
|
|
3541
|
-
this.
|
|
3553
|
+
this.disabled$ = this._disabled.pipe(filterMaybe());
|
|
3554
|
+
this.stream$ = this._delegate.pipe(distinctUntilChanged(), switchMap(x => (x) ? x.stream$ : of(DbxFormlyContext.INITIAL_STATE)), shareReplay$1(1));
|
|
3542
3555
|
}
|
|
3543
3556
|
destroy() {
|
|
3544
3557
|
this.lockSet.destroyOnNextUnlock(() => {
|
|
@@ -3553,8 +3566,8 @@ class DbxFormlyContext {
|
|
|
3553
3566
|
if (delegate != null) {
|
|
3554
3567
|
delegate.init({
|
|
3555
3568
|
fields: this.fields$,
|
|
3556
|
-
|
|
3557
|
-
|
|
3569
|
+
initialDisabled: this._disabled.value,
|
|
3570
|
+
initialValue: this._initialValue.value
|
|
3558
3571
|
});
|
|
3559
3572
|
}
|
|
3560
3573
|
this._delegate.next(delegate);
|
|
@@ -3573,7 +3586,7 @@ class DbxFormlyContext {
|
|
|
3573
3586
|
}
|
|
3574
3587
|
// MARK: FormComponent
|
|
3575
3588
|
getValue() {
|
|
3576
|
-
return this._delegate.pipe(filterMaybe(), switchMap
|
|
3589
|
+
return this._delegate.pipe(filterMaybe(), switchMap(x => x.getValue()), shareReplay$1(1));
|
|
3577
3590
|
}
|
|
3578
3591
|
setValue(value) {
|
|
3579
3592
|
this._initialValue.next(value);
|
|
@@ -3582,10 +3595,19 @@ class DbxFormlyContext {
|
|
|
3582
3595
|
}
|
|
3583
3596
|
}
|
|
3584
3597
|
isDisabled() {
|
|
3598
|
+
return BooleanStringKeyArrayUtilityInstance.isTrue(this.disabled);
|
|
3599
|
+
}
|
|
3600
|
+
get disabled() {
|
|
3585
3601
|
return this._disabled.value;
|
|
3586
3602
|
}
|
|
3587
|
-
|
|
3588
|
-
this._disabled.
|
|
3603
|
+
getDisabled() {
|
|
3604
|
+
return this._disabled.asObservable();
|
|
3605
|
+
}
|
|
3606
|
+
setDisabled(key, disabled = true) {
|
|
3607
|
+
this._disabled.next(BooleanStringKeyArrayUtilityInstance.set(this.disabled, key !== null && key !== void 0 ? key : DEFAULT_FORM_DISABLED_KEY, disabled));
|
|
3608
|
+
if (this._delegate.value) {
|
|
3609
|
+
this._delegate.value.setDisabled(key, disabled);
|
|
3610
|
+
}
|
|
3589
3611
|
}
|
|
3590
3612
|
resetForm() {
|
|
3591
3613
|
if (this._delegate.value) {
|
|
@@ -3611,7 +3633,7 @@ class AbstractFormlyFormDirective {
|
|
|
3611
3633
|
return this.context.isDisabled();
|
|
3612
3634
|
}
|
|
3613
3635
|
set disabled(disabled) {
|
|
3614
|
-
this.context.setDisabled(disabled);
|
|
3636
|
+
this.context.setDisabled(undefined, disabled);
|
|
3615
3637
|
}
|
|
3616
3638
|
ngOnDestroy() {
|
|
3617
3639
|
this.context.destroy();
|
|
@@ -3629,6 +3651,9 @@ class AbstractFormlyFormDirective {
|
|
|
3629
3651
|
clearValue() {
|
|
3630
3652
|
this.setValue({});
|
|
3631
3653
|
}
|
|
3654
|
+
setDisabled(key, disabled) {
|
|
3655
|
+
this.context.setDisabled(key, disabled);
|
|
3656
|
+
}
|
|
3632
3657
|
}
|
|
3633
3658
|
AbstractFormlyFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractFormlyFormDirective, deps: [{ token: DbxFormlyContext }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3634
3659
|
AbstractFormlyFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: AbstractFormlyFormDirective, inputs: { disabled: "disabled" }, ngImport: i0 });
|
|
@@ -3659,7 +3684,7 @@ class AbstractAsyncFormlyFormDirective extends AbstractFormlyFormDirective {
|
|
|
3659
3684
|
this._fieldsSub = new SubscriptionObject();
|
|
3660
3685
|
}
|
|
3661
3686
|
ngOnInit() {
|
|
3662
|
-
this._fieldsSub.subscription = this.fields$.pipe(distinctUntilChanged
|
|
3687
|
+
this._fieldsSub.subscription = this.fields$.pipe(distinctUntilChanged()).subscribe((fields) => {
|
|
3663
3688
|
this.context.fields = fields;
|
|
3664
3689
|
});
|
|
3665
3690
|
}
|
|
@@ -3740,15 +3765,34 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
3740
3765
|
this.context = context;
|
|
3741
3766
|
this._fields = new BehaviorSubject(undefined);
|
|
3742
3767
|
this._events = new BehaviorSubject({ isComplete: false, state: DbxFormState.INITIALIZING });
|
|
3768
|
+
this._disabled = new BehaviorSubject(undefined);
|
|
3743
3769
|
this._reset = new BehaviorSubject(new Date());
|
|
3744
3770
|
this._forceUpdate = new Subject();
|
|
3771
|
+
this._disabledSub = new SubscriptionObject();
|
|
3745
3772
|
this.form = new FormGroup({});
|
|
3746
3773
|
this.model = {};
|
|
3747
3774
|
this.options = {};
|
|
3748
|
-
this.fields$ = this._fields.pipe(switchMapMaybeObs(), distinctUntilChanged
|
|
3749
|
-
this.stream$ = this._reset.pipe(switchMap
|
|
3775
|
+
this.fields$ = this._fields.pipe(switchMapMaybeObs(), distinctUntilChanged(), shareReplay$1(1));
|
|
3776
|
+
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) => ({
|
|
3777
|
+
changesSinceLastResetCount,
|
|
3778
|
+
isFormValid: this.form.valid,
|
|
3779
|
+
isFormDisabled: this.form.disabled
|
|
3780
|
+
})), scan((acc, next) => {
|
|
3781
|
+
// Pass forward valid if next was a disabled change/check, which changes angular form's isValid value.
|
|
3782
|
+
// If it was valid prior, then it should be valid now, unless we just reset, in which case it might not be valid.
|
|
3783
|
+
const valid = next.isFormValid || (next.isFormDisabled && acc.isFormValid && acc.changesSinceLastResetCount > 0);
|
|
3784
|
+
return {
|
|
3785
|
+
changesSinceLastResetCount: next.changesSinceLastResetCount,
|
|
3786
|
+
isFormValid: valid,
|
|
3787
|
+
isFormDisabled: next.isFormDisabled
|
|
3788
|
+
};
|
|
3789
|
+
}, {
|
|
3790
|
+
changesSinceLastResetCount: 0,
|
|
3791
|
+
isFormValid: false,
|
|
3792
|
+
isFormDisabled: false
|
|
3793
|
+
}), map(({ changesSinceLastResetCount, isFormValid, isFormDisabled }) => {
|
|
3750
3794
|
const isReset = changesSinceLastResetCount === 1;
|
|
3751
|
-
const complete =
|
|
3795
|
+
const complete = isFormValid;
|
|
3752
3796
|
const nextState = {
|
|
3753
3797
|
isComplete: complete,
|
|
3754
3798
|
state: (isReset) ? DbxFormState.RESET : DbxFormState.USED,
|
|
@@ -3756,13 +3800,25 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
3756
3800
|
pristine: this.form.pristine,
|
|
3757
3801
|
changesCount: changesSinceLastResetCount,
|
|
3758
3802
|
lastResetAt,
|
|
3759
|
-
|
|
3803
|
+
disabled: this.disabled,
|
|
3804
|
+
isDisabled: isFormDisabled
|
|
3760
3805
|
};
|
|
3761
3806
|
return nextState;
|
|
3762
3807
|
}))), shareReplay$1(1));
|
|
3763
3808
|
}
|
|
3764
3809
|
ngOnInit() {
|
|
3765
3810
|
this.context.setDelegate(this);
|
|
3811
|
+
this._disabledSub.subscription = this._disabled.pipe(distinctUntilChanged()).subscribe((disabled) => {
|
|
3812
|
+
const isDisabled = BooleanStringKeyArrayUtilityInstance.isTrue(disabled);
|
|
3813
|
+
if (this.form.disabled !== isDisabled) {
|
|
3814
|
+
if (isDisabled) {
|
|
3815
|
+
this.form.disable({ emitEvent: true });
|
|
3816
|
+
}
|
|
3817
|
+
else {
|
|
3818
|
+
this.form.enable({ emitEvent: true });
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
});
|
|
3766
3822
|
}
|
|
3767
3823
|
ngOnDestroy() {
|
|
3768
3824
|
this.context.lockSet.onNextUnlock(() => {
|
|
@@ -3772,11 +3828,14 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
3772
3828
|
this._fields.complete();
|
|
3773
3829
|
this._reset.complete();
|
|
3774
3830
|
this._forceUpdate.complete();
|
|
3831
|
+
this._disabled.complete();
|
|
3832
|
+
this._disabledSub.destroy();
|
|
3775
3833
|
});
|
|
3776
3834
|
}
|
|
3777
3835
|
// MARK: Delegate
|
|
3778
3836
|
init(initialize) {
|
|
3779
3837
|
this._fields.next(initialize.fields);
|
|
3838
|
+
this._disabled.next(initialize.initialDisabled);
|
|
3780
3839
|
}
|
|
3781
3840
|
getValue() {
|
|
3782
3841
|
return of(this.form.value);
|
|
@@ -3805,18 +3864,17 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
3805
3864
|
this.options.resetModel();
|
|
3806
3865
|
}
|
|
3807
3866
|
}
|
|
3867
|
+
get isDisabled() {
|
|
3868
|
+
return BooleanStringKeyArrayUtilityInstance.isTrue(this.disabled);
|
|
3869
|
+
}
|
|
3808
3870
|
get disabled() {
|
|
3809
|
-
return this.
|
|
3871
|
+
return this._disabled.value;
|
|
3810
3872
|
}
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
else {
|
|
3817
|
-
this.form.enable({ emitEvent: true });
|
|
3818
|
-
}
|
|
3819
|
-
}
|
|
3873
|
+
getDisabled() {
|
|
3874
|
+
return this._disabled.asObservable();
|
|
3875
|
+
}
|
|
3876
|
+
setDisabled(key, disabled = true) {
|
|
3877
|
+
this._disabled.next(BooleanStringKeyArrayUtilityInstance.set(this.disabled, key !== null && key !== void 0 ? key : DEFAULT_FORM_DISABLED_KEY, disabled));
|
|
3820
3878
|
}
|
|
3821
3879
|
// MARK: Update
|
|
3822
3880
|
forceFormUpdate() {
|
|
@@ -3996,5 +4054,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
3996
4054
|
* Generated bundle index. Do not edit.
|
|
3997
4055
|
*/
|
|
3998
4056
|
|
|
3999
|
-
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,
|
|
4057
|
+
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, DateTimeFieldTimeMode, DbxActionFormDirective, DbxActionFormSafetyDirective, DbxChecklistItemContentComponent, DbxChecklistItemFieldComponent, DbxDateTimeFieldComponent, 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 };
|
|
4000
4058
|
//# sourceMappingURL=dereekb-dbx-form.mjs.map
|