@dereekb/dbx-core 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/action/action.handler.mjs +3 -3
- package/esm2020/lib/action/action.holder.mjs +13 -4
- package/esm2020/lib/action/action.machine.mjs +12 -5
- package/esm2020/lib/action/action.mjs +37 -17
- package/esm2020/lib/action/action.module.mjs +11 -11
- package/esm2020/lib/action/action.reference.mjs +7 -0
- package/esm2020/lib/action/action.store.mjs +60 -23
- package/esm2020/lib/action/action.store.source.mjs +27 -13
- package/esm2020/lib/action/directive/auto/action.automodify.directive.mjs +5 -5
- package/esm2020/lib/action/directive/auto/action.autotrigger.directive.mjs +8 -7
- package/esm2020/lib/action/directive/auto/index.mjs +2 -2
- package/esm2020/lib/action/directive/context/action.directive.mjs +5 -5
- package/esm2020/lib/action/directive/debug/action.logger.directive.mjs +4 -4
- package/esm2020/lib/action/directive/map/action.map.working.disable.directive.mjs +5 -5
- package/esm2020/lib/action/directive/state/action.disabled.directive.mjs +7 -5
- package/esm2020/lib/action/directive/state/action.enforce.modified.directive.mjs +48 -0
- package/esm2020/lib/action/directive/state/action.handler.directive.mjs +5 -5
- package/esm2020/lib/action/directive/state/action.success.component.mjs +4 -4
- package/esm2020/lib/action/directive/state/action.success.directive.mjs +4 -4
- package/esm2020/lib/action/directive/state/action.value.directive.mjs +9 -7
- package/esm2020/lib/action/directive/state/action.value.stream.directive.mjs +80 -0
- package/esm2020/lib/action/directive/state/action.value.trigger.directive.mjs +73 -0
- package/esm2020/lib/action/directive/state/action.value.trigger.instance.mjs +42 -0
- package/esm2020/lib/action/directive/state/action.working.component.mjs +4 -4
- package/esm2020/lib/action/directive/state/index.mjs +4 -2
- package/esm2020/lib/action/index.mjs +2 -2
- package/esm2020/lib/button/action/action.button.directive.mjs +12 -11
- package/esm2020/lib/button/action/action.button.trigger.directive.mjs +4 -4
- package/esm2020/lib/button/button.directive.mjs +1 -1
- package/esm2020/lib/button/button.mjs +1 -1
- package/esm2020/lib/filter/action/action.filter.source.directive.mjs +4 -4
- package/fesm2015/dereekb-dbx-core.mjs +430 -240
- package/fesm2015/dereekb-dbx-core.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-core.mjs +428 -238
- package/fesm2020/dereekb-dbx-core.mjs.map +1 -1
- package/lib/action/action.d.ts +14 -12
- package/lib/action/action.handler.d.ts +13 -5
- package/lib/action/action.holder.d.ts +9 -5
- package/lib/action/action.machine.d.ts +21 -8
- package/lib/action/action.module.d.ts +3 -3
- package/lib/action/action.reference.d.ts +11 -0
- package/lib/action/action.store.d.ts +33 -15
- package/lib/action/action.store.source.d.ts +20 -13
- package/lib/action/directive/auto/action.automodify.directive.d.ts +5 -4
- package/lib/action/directive/auto/action.autotrigger.directive.d.ts +6 -6
- package/lib/action/directive/auto/index.d.ts +1 -1
- package/lib/action/directive/context/action.directive.d.ts +3 -3
- package/lib/action/directive/debug/action.logger.directive.d.ts +3 -3
- package/lib/action/directive/map/action.map.working.disable.directive.d.ts +6 -6
- package/lib/action/directive/state/action.disabled.directive.d.ts +5 -4
- package/lib/action/directive/state/action.enforce.modified.directive.d.ts +19 -0
- package/lib/action/directive/state/action.handler.directive.d.ts +3 -3
- package/lib/action/directive/state/action.success.component.d.ts +3 -3
- package/lib/action/directive/state/action.success.directive.d.ts +3 -3
- package/lib/action/directive/state/action.value.directive.d.ts +3 -3
- package/lib/action/directive/state/action.value.stream.directive.d.ts +25 -0
- package/lib/action/directive/state/action.value.trigger.directive.d.ts +34 -0
- package/lib/action/directive/state/action.value.trigger.instance.d.ts +34 -0
- package/lib/action/directive/state/action.working.component.d.ts +3 -3
- package/lib/action/directive/state/index.d.ts +3 -1
- package/lib/action/index.d.ts +1 -1
- package/lib/button/action/action.button.directive.d.ts +4 -4
- package/lib/button/action/action.button.trigger.directive.d.ts +3 -3
- package/lib/button/button.d.ts +2 -2
- package/lib/button/button.directive.d.ts +2 -2
- package/lib/filter/action/action.filter.source.directive.d.ts +2 -2
- package/package.json +9 -13
- package/esm2020/lib/action/directive/auto/action.autotrigger.value.directive.mjs +0 -79
- package/esm2020/lib/action/directive/state/action.disabled.modified.directive.mjs +0 -35
- package/esm2020/lib/action/snackbar/index.mjs +0 -3
- package/esm2020/lib/action/snackbar/snackbar.mjs +0 -24
- package/lib/action/directive/auto/action.autotrigger.value.directive.d.ts +0 -25
- package/lib/action/directive/state/action.disabled.modified.directive.d.ts +0 -16
- package/lib/action/snackbar/index.d.ts +0 -1
- package/lib/action/snackbar/snackbar.d.ts +0 -50
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, forwardRef, Host, Input,
|
|
2
|
+
import { Directive, Injectable, forwardRef, Host, Input, Optional, Component, NgModule, EventEmitter, Output, LOCALE_ID, Pipe, Inject, ViewChild, InjectionToken, Injector, ViewContainerRef } from '@angular/core';
|
|
3
3
|
import * as i1$3 from '@dereekb/rxjs';
|
|
4
|
-
import { SubscriptionObject, LockSet, filterMaybe, scanCount, combineLatestFromMapValuesObsFn, skipFirstMaybe, FilterSourceInstance, FilterSource, FilterSourceConnector, FilterMap } from '@dereekb/rxjs';
|
|
4
|
+
import { SubscriptionObject, LockSet, filterMaybe, LoadingStateType, beginLoading, idleLoadingState, errorResult, successResult, scanCount, combineLatestFromMapValuesObsFn, asObservable, returnIfIs, skipFirstMaybe, FilterSourceInstance, FilterSource, FilterSourceConnector, FilterMap } from '@dereekb/rxjs';
|
|
5
5
|
import * as i1 from 'rxjs';
|
|
6
|
-
import { BehaviorSubject, combineLatest, Subject, interval, EMPTY, of, isObservable, delay as delay$1,
|
|
6
|
+
import { BehaviorSubject, combineLatest, Subject, interval, EMPTY, of, isObservable, delay as delay$1, switchMap as switchMap$1, map as map$1, catchError, tap as tap$1, filter as filter$1, startWith as startWith$1, shareReplay as shareReplay$1, first as first$1, Observable } from 'rxjs';
|
|
7
7
|
import { switchMap, first, distinctUntilChanged, filter, debounce, throttle, exhaustMap, mergeMap, map, shareReplay, withLatestFrom, startWith, tap, delay } from 'rxjs/operators';
|
|
8
8
|
import * as i1$4 from '@dereekb/util';
|
|
9
|
-
import { hasValueOrNotEmpty, BooleanStringKeyArrayUtilityInstance, reduceBooleansWithOrFn, getValueFromObjectOrGetter, expandTreeFunction, flattenTreeToArrayFunction, expandFlattenTreeFunction, mergeArrayIntoArray, objectFlatMergeMatrix, mergeArrays, filterMaybeValues, mergeObjects, mergeArrayOrValueIntoArray, DataIsExpiredError, DataDoesNotExistError, filterMaybeValuesFn, StorageObjectUtility, SHARED_MEMORY_STORAGE } from '@dereekb/util';
|
|
9
|
+
import { isDefinedAndNotFalse, hasValueOrNotEmpty, BooleanStringKeyArrayUtilityInstance, reduceBooleansWithOrFn, isUndefinedAndNotFalse, getValueFromObjectOrGetter, expandTreeFunction, flattenTreeToArrayFunction, expandFlattenTreeFunction, mergeArrayIntoArray, objectFlatMergeMatrix, mergeArrays, filterMaybeValues, mergeObjects, mergeArrayOrValueIntoArray, DataIsExpiredError, DataDoesNotExistError, filterMaybeValuesFn, StorageObjectUtility, SHARED_MEMORY_STORAGE } from '@dereekb/util';
|
|
10
10
|
import { ComponentStore } from '@ngrx/component-store';
|
|
11
11
|
import * as i2 from '@angular/common';
|
|
12
12
|
import { CommonModule, formatDate } from '@angular/common';
|
|
13
|
-
import ms from 'ms';
|
|
14
13
|
import * as i1$1 from '@angular/router';
|
|
15
14
|
import { NavigationStart, NavigationEnd } from '@angular/router';
|
|
16
15
|
import { isArray } from 'class-validator';
|
|
@@ -81,8 +80,10 @@ function pipeActionStore(source, pipeFn) {
|
|
|
81
80
|
function useActionStore(source, useFn) {
|
|
82
81
|
return source.store$.pipe(first()).subscribe(useFn);
|
|
83
82
|
}
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Service that wraps a ActionContextStoreSource.
|
|
85
|
+
*/
|
|
86
|
+
class DbxActionContextStoreSourceInstance {
|
|
86
87
|
constructor(source) {
|
|
87
88
|
this.source = source;
|
|
88
89
|
this.lockSet = new LockSet();
|
|
@@ -124,6 +125,9 @@ class ActionContextStoreSourceInstance {
|
|
|
124
125
|
get isModified$() {
|
|
125
126
|
return this.pipeStore(x => x.isModified$);
|
|
126
127
|
}
|
|
128
|
+
get canTrigger$() {
|
|
129
|
+
return this.pipeStore(x => x.canTrigger$);
|
|
130
|
+
}
|
|
127
131
|
get isModifiedAndCanTriggerUpdates$() {
|
|
128
132
|
return this.pipeStore(x => x.isModifiedAndCanTriggerUpdates$);
|
|
129
133
|
}
|
|
@@ -133,12 +137,21 @@ class ActionContextStoreSourceInstance {
|
|
|
133
137
|
get actionState$() {
|
|
134
138
|
return this.pipeStore(x => x.actionState$);
|
|
135
139
|
}
|
|
140
|
+
get loadingState$() {
|
|
141
|
+
return this.pipeStore(x => x.loadingState$);
|
|
142
|
+
}
|
|
143
|
+
get loadingStateType$() {
|
|
144
|
+
return this.pipeStore(x => x.loadingStateType$);
|
|
145
|
+
}
|
|
136
146
|
get isWorking$() {
|
|
137
147
|
return this.pipeStore(x => x.isWorking$);
|
|
138
148
|
}
|
|
139
149
|
get isSuccess$() {
|
|
140
150
|
return this.pipeStore(x => x.isSuccess$);
|
|
141
151
|
}
|
|
152
|
+
get disabledKeys$() {
|
|
153
|
+
return this.pipeStore(x => x.disabledKeys$);
|
|
154
|
+
}
|
|
142
155
|
get isDisabled$() {
|
|
143
156
|
return this.pipeStore(x => x.isDisabled$);
|
|
144
157
|
}
|
|
@@ -166,23 +179,23 @@ class ActionContextStoreSourceInstance {
|
|
|
166
179
|
reject(error) {
|
|
167
180
|
this.useStore((x) => x.reject(error));
|
|
168
181
|
}
|
|
169
|
-
|
|
170
|
-
this.useStore((x) => x.
|
|
182
|
+
resolve(value) {
|
|
183
|
+
this.useStore((x) => x.resolve(value));
|
|
171
184
|
}
|
|
172
185
|
reset() {
|
|
173
186
|
this.useStore((x) => x.reset());
|
|
174
187
|
}
|
|
175
188
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type:
|
|
179
|
-
type:
|
|
189
|
+
DbxActionContextStoreSourceInstance.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionContextStoreSourceInstance, deps: [{ token: ActionContextStoreSource }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
190
|
+
DbxActionContextStoreSourceInstance.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionContextStoreSourceInstance });
|
|
191
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
192
|
+
type: Injectable
|
|
180
193
|
}], ctorParameters: function () { return [{ type: ActionContextStoreSource }]; } });
|
|
181
194
|
const actionContextStoreSourceInstanceFactory = (source) => {
|
|
182
|
-
return new
|
|
195
|
+
return new DbxActionContextStoreSourceInstance(source);
|
|
183
196
|
};
|
|
184
197
|
/**
|
|
185
|
-
* Provides an ActionContextStoreSource, as well as an
|
|
198
|
+
* Provides an ActionContextStoreSource, as well as an DbxActionContextStoreSourceInstance.
|
|
186
199
|
*/
|
|
187
200
|
function ProvideActionStoreSource(sourceType) {
|
|
188
201
|
return [{
|
|
@@ -190,7 +203,7 @@ function ProvideActionStoreSource(sourceType) {
|
|
|
190
203
|
useExisting: forwardRef(() => sourceType)
|
|
191
204
|
},
|
|
192
205
|
{
|
|
193
|
-
provide:
|
|
206
|
+
provide: DbxActionContextStoreSourceInstance,
|
|
194
207
|
useFactory: actionContextStoreSourceInstanceFactory,
|
|
195
208
|
deps: [ActionContextStoreSource]
|
|
196
209
|
}];
|
|
@@ -214,7 +227,7 @@ class DbxActionAutoModifyDirective extends AbstractSubscriptionDirective {
|
|
|
214
227
|
return this._autoModifyEnabled.value;
|
|
215
228
|
}
|
|
216
229
|
set autoModifyEnabled(autoModifyEnabled) {
|
|
217
|
-
this._autoModifyEnabled.next(autoModifyEnabled !==
|
|
230
|
+
this._autoModifyEnabled.next(autoModifyEnabled !== false);
|
|
218
231
|
}
|
|
219
232
|
ngOnInit() {
|
|
220
233
|
const obs = combineLatest([
|
|
@@ -234,7 +247,7 @@ class DbxActionAutoModifyDirective extends AbstractSubscriptionDirective {
|
|
|
234
247
|
});
|
|
235
248
|
}
|
|
236
249
|
}
|
|
237
|
-
DbxActionAutoModifyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionAutoModifyDirective, deps: [{ token:
|
|
250
|
+
DbxActionAutoModifyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionAutoModifyDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
238
251
|
DbxActionAutoModifyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionAutoModifyDirective, selector: "[dbxActionAutoModify]", inputs: { autoModifyEnabled: ["dbxActionAutoModify", "autoModifyEnabled"] }, usesInheritance: true, ngImport: i0 });
|
|
239
252
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionAutoModifyDirective, decorators: [{
|
|
240
253
|
type: Directive,
|
|
@@ -242,7 +255,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
242
255
|
selector: '[dbxActionAutoModify]',
|
|
243
256
|
}]
|
|
244
257
|
}], ctorParameters: function () {
|
|
245
|
-
return [{ type:
|
|
258
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
246
259
|
type: Host
|
|
247
260
|
}] }];
|
|
248
261
|
}, propDecorators: { autoModifyEnabled: [{
|
|
@@ -255,7 +268,7 @@ const DEFAULT_THROTTLE_MS = 10 * 1000;
|
|
|
255
268
|
const DEFAULT_ERROR_THROTTLE_MS = 3 * 1000;
|
|
256
269
|
const MAX_ERRORS_TO_THROTTLE_ON = 6;
|
|
257
270
|
/**
|
|
258
|
-
*
|
|
271
|
+
* Directive that automatically triggers the action periodically when it is in a modified state.
|
|
259
272
|
*/
|
|
260
273
|
class DbxActionAutoTriggerDirective extends AbstractSubscriptionDirective {
|
|
261
274
|
constructor(source) {
|
|
@@ -307,7 +320,7 @@ class DbxActionAutoTriggerDirective extends AbstractSubscriptionDirective {
|
|
|
307
320
|
* Used in forms that are simple.
|
|
308
321
|
*/
|
|
309
322
|
set fastTrigger(fastTrigger) {
|
|
310
|
-
if (fastTrigger) {
|
|
323
|
+
if (isDefinedAndNotFalse(fastTrigger)) {
|
|
311
324
|
this.triggerDebounce = 200;
|
|
312
325
|
this.triggerThrottle = 500;
|
|
313
326
|
}
|
|
@@ -318,7 +331,7 @@ class DbxActionAutoTriggerDirective extends AbstractSubscriptionDirective {
|
|
|
318
331
|
* Used in forms that generally return a single value.
|
|
319
332
|
*/
|
|
320
333
|
set instantTrigger(instantTrigger) {
|
|
321
|
-
if (instantTrigger) {
|
|
334
|
+
if (isDefinedAndNotFalse(instantTrigger)) {
|
|
322
335
|
this.triggerDebounce = 10;
|
|
323
336
|
this.triggerThrottle = 0;
|
|
324
337
|
}
|
|
@@ -346,7 +359,7 @@ class DbxActionAutoTriggerDirective extends AbstractSubscriptionDirective {
|
|
|
346
359
|
});
|
|
347
360
|
}
|
|
348
361
|
}
|
|
349
|
-
DbxActionAutoTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionAutoTriggerDirective, deps: [{ token:
|
|
362
|
+
DbxActionAutoTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionAutoTriggerDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
350
363
|
DbxActionAutoTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionAutoTriggerDirective, selector: "dbxActionAutoTrigger, [dbxActionAutoTrigger]", inputs: { triggerEnabled: ["dbxActionAutoTrigger", "triggerEnabled"], triggerDebounce: "triggerDebounce", triggerThrottle: "triggerThrottle", triggerErrorThrottle: "triggerErrorThrottle", fastTrigger: "fastTrigger", instantTrigger: "instantTrigger", triggerLimit: "triggerLimit" }, usesInheritance: true, ngImport: i0 });
|
|
351
364
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionAutoTriggerDirective, decorators: [{
|
|
352
365
|
type: Directive,
|
|
@@ -354,7 +367,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
354
367
|
selector: 'dbxActionAutoTrigger, [dbxActionAutoTrigger]',
|
|
355
368
|
}]
|
|
356
369
|
}], ctorParameters: function () {
|
|
357
|
-
return [{ type:
|
|
370
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
358
371
|
type: Host
|
|
359
372
|
}] }];
|
|
360
373
|
}, propDecorators: { triggerEnabled: [{
|
|
@@ -375,19 +388,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
375
388
|
}] } });
|
|
376
389
|
|
|
377
390
|
/**
|
|
378
|
-
* Directive that watches
|
|
391
|
+
* Directive that watches a value observable for changes and sets the new value and modified states as necessary.
|
|
379
392
|
*/
|
|
380
|
-
class
|
|
393
|
+
class dbxActionValueStreamDirective {
|
|
381
394
|
constructor(source) {
|
|
382
395
|
this.source = source;
|
|
383
396
|
this._valueObs = new BehaviorSubject(EMPTY);
|
|
384
397
|
this._isModifiedFn = new BehaviorSubject(undefined);
|
|
385
398
|
this._modifiedSub = new SubscriptionObject();
|
|
386
399
|
this._triggerSub = new SubscriptionObject();
|
|
387
|
-
this.modifiedValue$ = this._valueObs.pipe(switchMap((obs) => obs.pipe(withLatestFrom(this._isModifiedFn), mergeMap(([value,
|
|
400
|
+
this.modifiedValue$ = this._valueObs.pipe(switchMap((obs) => obs.pipe(withLatestFrom(this._isModifiedFn), mergeMap(([value, dbxActionValueStreamModified]) => {
|
|
388
401
|
let result;
|
|
389
|
-
if (
|
|
390
|
-
result =
|
|
402
|
+
if (dbxActionValueStreamModified) {
|
|
403
|
+
result = dbxActionValueStreamModified(value).pipe(map((isModified) => [isModified, value]));
|
|
391
404
|
}
|
|
392
405
|
else {
|
|
393
406
|
result = of([true, value]);
|
|
@@ -395,18 +408,18 @@ class DbxActionAutoTriggerValueDirective {
|
|
|
395
408
|
return result;
|
|
396
409
|
}), shareReplay(1))));
|
|
397
410
|
}
|
|
398
|
-
set
|
|
399
|
-
this._valueObs.next(
|
|
411
|
+
set dbxActionValueStream(dbxActionValueStream) {
|
|
412
|
+
this._valueObs.next(dbxActionValueStream);
|
|
400
413
|
}
|
|
401
|
-
set
|
|
402
|
-
if (requireNonEmpty) {
|
|
403
|
-
this.
|
|
414
|
+
set dbxActionValueStreamIsNotEmpty(requireNonEmpty) {
|
|
415
|
+
if (isDefinedAndNotFalse(requireNonEmpty)) {
|
|
416
|
+
this.dbxActionValueStreamModified = (value) => {
|
|
404
417
|
return of(hasValueOrNotEmpty(value));
|
|
405
418
|
};
|
|
406
419
|
}
|
|
407
420
|
}
|
|
408
|
-
set
|
|
409
|
-
this._isModifiedFn.next(
|
|
421
|
+
set dbxActionValueStreamModified(dbxActionValueStreamModified) {
|
|
422
|
+
this._isModifiedFn.next(dbxActionValueStreamModified);
|
|
410
423
|
}
|
|
411
424
|
ngOnInit() {
|
|
412
425
|
// Update Modified value.
|
|
@@ -414,89 +427,109 @@ class DbxActionAutoTriggerValueDirective {
|
|
|
414
427
|
this.source.setIsModified(isModified);
|
|
415
428
|
});
|
|
416
429
|
// Set the value on triggers.
|
|
417
|
-
this._triggerSub.subscription = this.source.triggered$.pipe(
|
|
418
|
-
|
|
430
|
+
this._triggerSub.subscription = this.source.triggered$.pipe(switchMap(_ => this.modifiedValue$)).subscribe(([isModified, value]) => {
|
|
431
|
+
if (isModified) {
|
|
432
|
+
this.source.readyValue(value);
|
|
433
|
+
}
|
|
419
434
|
});
|
|
420
435
|
}
|
|
421
436
|
ngOnDestroy() {
|
|
422
437
|
this.source.lockSet.onNextUnlock(() => {
|
|
423
|
-
this._isModifiedFn.complete();
|
|
424
438
|
this._valueObs.complete();
|
|
439
|
+
this._isModifiedFn.complete();
|
|
425
440
|
this._modifiedSub.destroy();
|
|
426
441
|
this._triggerSub.destroy();
|
|
427
442
|
});
|
|
428
443
|
}
|
|
429
444
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type:
|
|
445
|
+
dbxActionValueStreamDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: dbxActionValueStreamDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
446
|
+
dbxActionValueStreamDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: dbxActionValueStreamDirective, selector: "[dbxActionValueStream]", inputs: { dbxActionValueStream: "dbxActionValueStream", dbxActionValueStreamIsNotEmpty: "dbxActionValueStreamIsNotEmpty", dbxActionValueStreamModified: "dbxActionValueStreamModified" }, ngImport: i0 });
|
|
447
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: dbxActionValueStreamDirective, decorators: [{
|
|
433
448
|
type: Directive,
|
|
434
449
|
args: [{
|
|
435
|
-
selector: '[
|
|
450
|
+
selector: '[dbxActionValueStream]',
|
|
436
451
|
}]
|
|
437
452
|
}], ctorParameters: function () {
|
|
438
|
-
return [{ type:
|
|
453
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
439
454
|
type: Host
|
|
440
455
|
}] }];
|
|
441
|
-
}, propDecorators: {
|
|
442
|
-
type: Input
|
|
443
|
-
|
|
444
|
-
}], dbxActionAutoTriggerModifiedNonEmptyValue: [{
|
|
456
|
+
}, propDecorators: { dbxActionValueStream: [{
|
|
457
|
+
type: Input
|
|
458
|
+
}], dbxActionValueStreamIsNotEmpty: [{
|
|
445
459
|
type: Input
|
|
446
|
-
}],
|
|
460
|
+
}], dbxActionValueStreamModified: [{
|
|
447
461
|
type: Input
|
|
448
462
|
}] } });
|
|
449
463
|
|
|
450
464
|
/**
|
|
451
465
|
* Used by ActionContextState to denote what state the action is in.
|
|
452
466
|
*/
|
|
453
|
-
var
|
|
454
|
-
(function (
|
|
467
|
+
var DbxActionState;
|
|
468
|
+
(function (DbxActionState) {
|
|
455
469
|
/**
|
|
456
470
|
* No action in progress. Waiting for the trigger.
|
|
457
471
|
*/
|
|
458
|
-
|
|
472
|
+
DbxActionState["IDLE"] = "idle";
|
|
459
473
|
/**
|
|
460
474
|
* Idle state that can be set to show that the source is not yet ready.
|
|
461
475
|
*/
|
|
462
|
-
|
|
476
|
+
DbxActionState["DISABLED"] = "disabled";
|
|
463
477
|
/**
|
|
464
478
|
* The action was triggered. We wait (and allow) the value to be updated.
|
|
465
479
|
*/
|
|
466
|
-
|
|
480
|
+
DbxActionState["TRIGGERED"] = "triggered";
|
|
467
481
|
/**
|
|
468
482
|
* The trigger was accepted and the value is updated. It should begin working immediately.
|
|
469
483
|
*
|
|
470
484
|
* ValueReady cannot be set until triggered is set.
|
|
471
485
|
*/
|
|
472
|
-
|
|
486
|
+
DbxActionState["VALUE_READY"] = "valueReady";
|
|
473
487
|
/**
|
|
474
488
|
* The action is in progress.
|
|
475
489
|
*/
|
|
476
|
-
|
|
490
|
+
DbxActionState["WORKING"] = "working";
|
|
477
491
|
/**
|
|
478
492
|
* The trigger, action, or value was rejected due to an error or other issue.
|
|
479
493
|
*
|
|
480
494
|
* An error may be specified optionally.
|
|
481
495
|
*/
|
|
482
|
-
|
|
496
|
+
DbxActionState["REJECTED"] = "rejected";
|
|
483
497
|
/**
|
|
484
|
-
* The action
|
|
498
|
+
* The action resolved without issue.
|
|
485
499
|
*/
|
|
486
|
-
|
|
487
|
-
})(
|
|
488
|
-
const DEFAULT_ACTION_DISABLED_KEY = '
|
|
500
|
+
DbxActionState["RESOLVED"] = "resolved";
|
|
501
|
+
})(DbxActionState || (DbxActionState = {}));
|
|
502
|
+
const DEFAULT_ACTION_DISABLED_KEY = 'dbx_action_disabled';
|
|
489
503
|
function isIdleActionState(actionState) {
|
|
490
504
|
switch (actionState) {
|
|
491
|
-
case
|
|
492
|
-
case
|
|
493
|
-
case
|
|
494
|
-
case
|
|
505
|
+
case DbxActionState.IDLE:
|
|
506
|
+
case DbxActionState.DISABLED:
|
|
507
|
+
case DbxActionState.REJECTED:
|
|
508
|
+
case DbxActionState.RESOLVED:
|
|
495
509
|
return true;
|
|
496
510
|
default:
|
|
497
511
|
return false;
|
|
498
512
|
}
|
|
499
513
|
}
|
|
514
|
+
function loadingStateTypeForActionState(actionState) {
|
|
515
|
+
let loadingStateType;
|
|
516
|
+
switch (actionState) {
|
|
517
|
+
case DbxActionState.RESOLVED:
|
|
518
|
+
loadingStateType = LoadingStateType.SUCCESS;
|
|
519
|
+
break;
|
|
520
|
+
case DbxActionState.REJECTED:
|
|
521
|
+
loadingStateType = LoadingStateType.ERROR;
|
|
522
|
+
break;
|
|
523
|
+
case DbxActionState.IDLE:
|
|
524
|
+
case DbxActionState.DISABLED:
|
|
525
|
+
loadingStateType = LoadingStateType.IDLE;
|
|
526
|
+
break;
|
|
527
|
+
default:
|
|
528
|
+
loadingStateType = LoadingStateType.LOADING;
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
return loadingStateType;
|
|
532
|
+
}
|
|
500
533
|
|
|
501
534
|
function isActionContextEnabled(state) {
|
|
502
535
|
return BooleanStringKeyArrayUtilityInstance.isFalse(state.disabled);
|
|
@@ -511,13 +544,13 @@ function isWorkingActionState(actionState) {
|
|
|
511
544
|
return !isIdleActionState(actionState);
|
|
512
545
|
}
|
|
513
546
|
function canTriggerActionState(actionState) {
|
|
514
|
-
return actionState !==
|
|
547
|
+
return actionState !== DbxActionState.DISABLED && isIdleActionState(actionState);
|
|
515
548
|
}
|
|
516
549
|
function canTriggerAction(state) {
|
|
517
550
|
return isActionContextEnabled(state) && isIdleActionState(state.actionState);
|
|
518
551
|
}
|
|
519
552
|
function canReadyValue(state) {
|
|
520
|
-
return state.actionState ===
|
|
553
|
+
return state.actionState === DbxActionState.TRIGGERED;
|
|
521
554
|
}
|
|
522
555
|
function actionContextIsModifiedAndCanTrigger(state) {
|
|
523
556
|
// console.log('check: ', state, state.isModified, canTriggerAction(state));
|
|
@@ -526,20 +559,42 @@ function actionContextIsModifiedAndCanTrigger(state) {
|
|
|
526
559
|
function actionContextHasNoErrorAndIsModifiedAndCanTrigger(state) {
|
|
527
560
|
return !state.error && actionContextIsModifiedAndCanTrigger(state);
|
|
528
561
|
}
|
|
562
|
+
function loadingStateForActionContextState(state) {
|
|
563
|
+
let loadingState;
|
|
564
|
+
switch (state.actionState) {
|
|
565
|
+
case DbxActionState.RESOLVED:
|
|
566
|
+
loadingState = successResult(state.result);
|
|
567
|
+
break;
|
|
568
|
+
case DbxActionState.REJECTED:
|
|
569
|
+
loadingState = errorResult(state.error);
|
|
570
|
+
break;
|
|
571
|
+
case DbxActionState.IDLE:
|
|
572
|
+
case DbxActionState.DISABLED:
|
|
573
|
+
loadingState = idleLoadingState();
|
|
574
|
+
break;
|
|
575
|
+
default:
|
|
576
|
+
loadingState = beginLoading();
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
return loadingState;
|
|
580
|
+
}
|
|
581
|
+
function loadingStateTypeForActionContextState(state) {
|
|
582
|
+
return loadingStateTypeForActionState(state.actionState);
|
|
583
|
+
}
|
|
529
584
|
const INITIAL_STATE = {
|
|
530
585
|
isModified: false,
|
|
531
|
-
actionState:
|
|
586
|
+
actionState: DbxActionState.IDLE
|
|
532
587
|
};
|
|
533
588
|
class ActionContextStore extends ComponentStore {
|
|
534
589
|
constructor() {
|
|
535
590
|
super(Object.assign({}, INITIAL_STATE));
|
|
536
591
|
this.lockSet = new LockSet();
|
|
537
592
|
// MARK: Accessors
|
|
538
|
-
this.actionState$ = this.state$.pipe(map(x => isDisabledActionContextState(x) ?
|
|
593
|
+
this.actionState$ = this.state$.pipe(map(x => isDisabledActionContextState(x) ? DbxActionState.DISABLED : x.actionState), shareReplay(1));
|
|
539
594
|
/**
|
|
540
|
-
* Returns the current disabled reasons.
|
|
595
|
+
* Returns the current disabled reasons/keys.
|
|
541
596
|
*/
|
|
542
|
-
this.
|
|
597
|
+
this.disabledKeys$ = this.state$.pipe(map(x => { var _a; return [...(_a = x.disabled) !== null && _a !== void 0 ? _a : []]; }), distinctUntilChanged(), shareReplay(1));
|
|
543
598
|
/**
|
|
544
599
|
* Maps the current state to true or not when the action state changes to/from disabled.
|
|
545
600
|
*/
|
|
@@ -551,19 +606,19 @@ class ActionContextStore extends ComponentStore {
|
|
|
551
606
|
/**
|
|
552
607
|
* Pipes true when triggered.
|
|
553
608
|
*/
|
|
554
|
-
this.triggered$ = this.afterDistinctActionState(
|
|
609
|
+
this.triggered$ = this.afterDistinctActionState(DbxActionState.TRIGGERED, () => true);
|
|
555
610
|
/**
|
|
556
611
|
* Pipes the readied value on ValueReady.
|
|
557
612
|
*/
|
|
558
|
-
this.valueReady$ = this.afterDistinctActionState(
|
|
613
|
+
this.valueReady$ = this.afterDistinctActionState(DbxActionState.VALUE_READY, x => x.value);
|
|
559
614
|
/**
|
|
560
615
|
* Pipes the error on the rejection state.
|
|
561
616
|
*/
|
|
562
|
-
this.rejected$ = this.afterDistinctActionState(
|
|
617
|
+
this.rejected$ = this.afterDistinctActionState(DbxActionState.REJECTED, x => x.error);
|
|
563
618
|
/**
|
|
564
619
|
* Pipes the result when the ActionState becomes working.
|
|
565
620
|
*/
|
|
566
|
-
this.working$ = this.afterDistinctActionState(
|
|
621
|
+
this.working$ = this.afterDistinctActionState(DbxActionState.WORKING, () => true);
|
|
567
622
|
/**
|
|
568
623
|
* Whether or not it is currently in a working state.
|
|
569
624
|
*/
|
|
@@ -575,11 +630,19 @@ class ActionContextStore extends ComponentStore {
|
|
|
575
630
|
/**
|
|
576
631
|
* Pipes the result when the ActionState becomes success.
|
|
577
632
|
*/
|
|
578
|
-
this.success$ = this.afterDistinctActionState(
|
|
633
|
+
this.success$ = this.afterDistinctActionState(DbxActionState.RESOLVED, x => x.result);
|
|
579
634
|
/**
|
|
580
635
|
* Whether or not it is currently in a success state.
|
|
581
636
|
*/
|
|
582
|
-
this.isSuccess$ = this.afterDistinctBoolean(x => x.actionState ===
|
|
637
|
+
this.isSuccess$ = this.afterDistinctBoolean(x => x.actionState === DbxActionState.RESOLVED);
|
|
638
|
+
/**
|
|
639
|
+
* Returns a loading state based on the current state.
|
|
640
|
+
*/
|
|
641
|
+
this.loadingState$ = this.afterDistinctLoadingStateTypeChange().pipe(map(x => loadingStateForActionContextState(x)), shareReplay(1));
|
|
642
|
+
/**
|
|
643
|
+
* Returns the current LoadingStateType based on the current state.
|
|
644
|
+
*/
|
|
645
|
+
this.loadingStateType$ = this.state$.pipe(map(x => loadingStateTypeForActionContextState(x)), distinctUntilChanged(), shareReplay(1));
|
|
583
646
|
/**
|
|
584
647
|
* Number of errors since last success.
|
|
585
648
|
*/
|
|
@@ -611,35 +674,35 @@ class ActionContextStore extends ComponentStore {
|
|
|
611
674
|
/**
|
|
612
675
|
* Triggers the modified state, if not disabled.
|
|
613
676
|
*/
|
|
614
|
-
this.setIsModified = this.updater((state, isModified) => (Object.assign(Object.assign({}, state), { actionState: (state.actionState ===
|
|
677
|
+
this.setIsModified = this.updater((state, isModified) => (Object.assign(Object.assign({}, state), { actionState: (state.actionState === DbxActionState.RESOLVED) ? DbxActionState.IDLE : state.actionState, isModified: isModified !== null && isModified !== void 0 ? isModified : true })));
|
|
615
678
|
/**
|
|
616
679
|
* Triggers the action if the state is currently not idle. The current state is cleared, but the error is retained (as we may need the error from the previous attempt).
|
|
617
680
|
*
|
|
618
681
|
* Will not fire if the action is disabled.
|
|
619
682
|
*/
|
|
620
683
|
this.trigger = this.updater((state) => canTriggerAction(state)
|
|
621
|
-
? ({ isModified: state.isModified, actionState:
|
|
684
|
+
? ({ isModified: state.isModified, actionState: DbxActionState.TRIGGERED, error: state.error, value: undefined })
|
|
622
685
|
: state);
|
|
623
686
|
/**
|
|
624
687
|
* Updates the value, setting value ready. The current result is cleared.
|
|
625
688
|
*/
|
|
626
689
|
this.readyValue = this.updater((state, value) => canReadyValue(state)
|
|
627
|
-
? (Object.assign(Object.assign({}, state), { actionState:
|
|
690
|
+
? (Object.assign(Object.assign({}, state), { actionState: DbxActionState.VALUE_READY, value, result: undefined }))
|
|
628
691
|
: state);
|
|
629
692
|
/**
|
|
630
693
|
* Notifys the context that the action is in progress.
|
|
631
694
|
*/
|
|
632
|
-
this.startWorking = this.updater((state) => (Object.assign(Object.assign({}, state), { actionState:
|
|
695
|
+
this.startWorking = this.updater((state) => (Object.assign(Object.assign({}, state), { actionState: DbxActionState.WORKING })));
|
|
633
696
|
/**
|
|
634
697
|
* Triggers rejection of the action. The value is cleared.
|
|
635
698
|
*/
|
|
636
|
-
this.reject = this.updater((state, error) => { var _a; return ({ isModified: state.isModified, actionState:
|
|
699
|
+
this.reject = this.updater((state, error) => { var _a; return ({ isModified: state.isModified, actionState: DbxActionState.REJECTED, error, errorCount: ((_a = state.errorCount) !== null && _a !== void 0 ? _a : 0) + 1, disabled: state.disabled }); });
|
|
637
700
|
/**
|
|
638
701
|
* Updates the state to success, and optionally sets a result.
|
|
639
702
|
*
|
|
640
703
|
* Clears modified state, and any errors.
|
|
641
704
|
*/
|
|
642
|
-
this.
|
|
705
|
+
this.resolve = this.updater((state, result) => ({ isModified: false, actionState: DbxActionState.RESOLVED, value: state.value, result, error: undefined, disabled: state.disabled }));
|
|
643
706
|
/**
|
|
644
707
|
* Completely resets the store.
|
|
645
708
|
*/
|
|
@@ -651,9 +714,16 @@ class ActionContextStore extends ComponentStore {
|
|
|
651
714
|
return this.state$.pipe(map(x => fromState(x)), distinctUntilChanged(), shareReplay(1));
|
|
652
715
|
}
|
|
653
716
|
afterDistinctActionState(actionState, fromState) {
|
|
717
|
+
return this.afterDistinctActionStateChange().pipe(filter((x) => x.actionState === actionState), // Only pipe when the new action state matches.
|
|
718
|
+
map(x => fromState(x)), shareReplay(1));
|
|
719
|
+
}
|
|
720
|
+
afterDistinctActionStateChange() {
|
|
654
721
|
return this.state$.pipe(map((x) => ([x, x.actionState])), distinctUntilChanged((a, b) => (a === null || a === void 0 ? void 0 : a[1]) === (b === null || b === void 0 ? void 0 : b[1])), // Filter out when the state remains the same.
|
|
655
|
-
|
|
656
|
-
|
|
722
|
+
map(x => x[0]), shareReplay(1));
|
|
723
|
+
}
|
|
724
|
+
afterDistinctLoadingStateTypeChange() {
|
|
725
|
+
return this.state$.pipe(map((x) => ([x, loadingStateForActionContextState(x)])), distinctUntilChanged((a, b) => (a === null || a === void 0 ? void 0 : a[1]) === (b === null || b === void 0 ? void 0 : b[1])), // Filter out when the loading state remains the same.
|
|
726
|
+
map(x => x[0]), shareReplay(1));
|
|
657
727
|
}
|
|
658
728
|
// MARK: Cleanup
|
|
659
729
|
ngOnDestroy() {
|
|
@@ -672,7 +742,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
672
742
|
/**
|
|
673
743
|
* Abstract class that can either use SecondaryActionContextStoreSource or create it's own.
|
|
674
744
|
*/
|
|
675
|
-
class
|
|
745
|
+
class DbxActionContextBaseSource {
|
|
676
746
|
constructor(inputSource) {
|
|
677
747
|
this.inputSource = inputSource;
|
|
678
748
|
if (this.inputSource) {
|
|
@@ -682,7 +752,7 @@ class ActionContextBaseSource {
|
|
|
682
752
|
this._store = new ActionContextStore();
|
|
683
753
|
this._store$ = of(this._store);
|
|
684
754
|
}
|
|
685
|
-
this._instance = new
|
|
755
|
+
this._instance = new DbxActionContextStoreSourceInstance(this);
|
|
686
756
|
this.isModified$ = this._instance.isModified$;
|
|
687
757
|
this.triggered$ = this._instance.triggered$;
|
|
688
758
|
this.success$ = this._instance.success$;
|
|
@@ -714,12 +784,21 @@ class ActionContextBaseSource {
|
|
|
714
784
|
reset() {
|
|
715
785
|
this._instance.reset();
|
|
716
786
|
}
|
|
787
|
+
enable(key, enable) {
|
|
788
|
+
this._instance.enable(key, enable);
|
|
789
|
+
}
|
|
790
|
+
disable(key, disable) {
|
|
791
|
+
this._instance.disable(key, disable);
|
|
792
|
+
}
|
|
793
|
+
setIsModified(isModified) {
|
|
794
|
+
this._instance.setIsModified(isModified);
|
|
795
|
+
}
|
|
717
796
|
}
|
|
718
797
|
|
|
719
798
|
/**
|
|
720
799
|
* Provides an DbxActionContext.
|
|
721
800
|
*/
|
|
722
|
-
class DbxActionDirective extends
|
|
801
|
+
class DbxActionDirective extends DbxActionContextBaseSource {
|
|
723
802
|
constructor(inputSource) {
|
|
724
803
|
super(inputSource);
|
|
725
804
|
}
|
|
@@ -730,12 +809,12 @@ class DbxActionDirective extends ActionContextBaseSource {
|
|
|
730
809
|
}
|
|
731
810
|
}
|
|
732
811
|
DbxActionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionDirective, deps: [{ token: SecondaryActionContextStoreSource, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
733
|
-
DbxActionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionDirective, selector: "dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]", providers: ProvideActionStoreSource(DbxActionDirective), exportAs: ["action"], usesInheritance: true, ngImport: i0 });
|
|
812
|
+
DbxActionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionDirective, selector: "dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]", providers: ProvideActionStoreSource(DbxActionDirective), exportAs: ["action", "dbxAction"], usesInheritance: true, ngImport: i0 });
|
|
734
813
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionDirective, decorators: [{
|
|
735
814
|
type: Directive,
|
|
736
815
|
args: [{
|
|
737
816
|
selector: 'dbx-action,[dbxAction],dbx-action-context,[dbxActionContext]',
|
|
738
|
-
exportAs: 'action',
|
|
817
|
+
exportAs: 'action,dbxAction',
|
|
739
818
|
providers: ProvideActionStoreSource(DbxActionDirective)
|
|
740
819
|
}]
|
|
741
820
|
}], ctorParameters: function () {
|
|
@@ -794,7 +873,7 @@ class DbxActionContextLoggerDirective extends AbstractSubscriptionDirective {
|
|
|
794
873
|
});
|
|
795
874
|
}
|
|
796
875
|
}
|
|
797
|
-
DbxActionContextLoggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionContextLoggerDirective, deps: [{ token:
|
|
876
|
+
DbxActionContextLoggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionContextLoggerDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
798
877
|
DbxActionContextLoggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionContextLoggerDirective, selector: "[dbxActionLogger],[dbxActionContextLogger]", usesInheritance: true, ngImport: i0 });
|
|
799
878
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionContextLoggerDirective, decorators: [{
|
|
800
879
|
type: Directive,
|
|
@@ -802,7 +881,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
802
881
|
selector: '[dbxActionLogger],[dbxActionContextLogger]'
|
|
803
882
|
}]
|
|
804
883
|
}], ctorParameters: function () {
|
|
805
|
-
return [{ type:
|
|
884
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
806
885
|
type: Host
|
|
807
886
|
}] }];
|
|
808
887
|
} });
|
|
@@ -957,7 +1036,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
957
1036
|
class ActionContextStoreSourceMap {
|
|
958
1037
|
}
|
|
959
1038
|
|
|
960
|
-
const DEFAULT_ACTION_MAP_WORKING_DISABLED_KEY = '
|
|
1039
|
+
const DEFAULT_ACTION_MAP_WORKING_DISABLED_KEY = 'action_map_working_disable';
|
|
961
1040
|
/**
|
|
962
1041
|
* Used to communicate with an dbxActionMap and set the ActionContextStore to be disabled if any other element in the map is working.
|
|
963
1042
|
*/
|
|
@@ -977,7 +1056,7 @@ class DbxActionMapWorkingDisableDirective extends AbstractSubscriptionDirective
|
|
|
977
1056
|
this.source.enable(this.disabledKey || DEFAULT_ACTION_MAP_WORKING_DISABLED_KEY);
|
|
978
1057
|
}
|
|
979
1058
|
}
|
|
980
|
-
DbxActionMapWorkingDisableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionMapWorkingDisableDirective, deps: [{ token:
|
|
1059
|
+
DbxActionMapWorkingDisableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionMapWorkingDisableDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }, { token: DbxActionContextMapDirective }], target: i0.ɵɵFactoryTarget.Directive });
|
|
981
1060
|
DbxActionMapWorkingDisableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionMapWorkingDisableDirective, selector: "[dbxActionMapWorkingDisable]", inputs: { disabledKey: ["dbxActionMapWorkingDisable", "disabledKey"] }, usesInheritance: true, ngImport: i0 });
|
|
982
1061
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionMapWorkingDisableDirective, decorators: [{
|
|
983
1062
|
type: Directive,
|
|
@@ -985,7 +1064,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
985
1064
|
selector: '[dbxActionMapWorkingDisable]'
|
|
986
1065
|
}]
|
|
987
1066
|
}], ctorParameters: function () {
|
|
988
|
-
return [{ type:
|
|
1067
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
989
1068
|
type: Host
|
|
990
1069
|
}] }, { type: DbxActionContextMapDirective }];
|
|
991
1070
|
}, propDecorators: { disabledKey: [{
|
|
@@ -1018,10 +1097,11 @@ class DbxActionDisabledDirective extends AbstractSubscriptionDirective {
|
|
|
1018
1097
|
return this._disabled.value;
|
|
1019
1098
|
}
|
|
1020
1099
|
set disabled(disabled) {
|
|
1021
|
-
|
|
1100
|
+
const disable = isUndefinedAndNotFalse(disabled);
|
|
1101
|
+
this._disabled.next(disable);
|
|
1022
1102
|
}
|
|
1023
1103
|
}
|
|
1024
|
-
DbxActionDisabledDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionDisabledDirective, deps: [{ token:
|
|
1104
|
+
DbxActionDisabledDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionDisabledDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1025
1105
|
DbxActionDisabledDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionDisabledDirective, selector: "[dbxActionDisabled]", inputs: { disabled: ["dbxActionDisabled", "disabled"] }, usesInheritance: true, ngImport: i0 });
|
|
1026
1106
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionDisabledDirective, decorators: [{
|
|
1027
1107
|
type: Directive,
|
|
@@ -1029,7 +1109,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1029
1109
|
selector: '[dbxActionDisabled]'
|
|
1030
1110
|
}]
|
|
1031
1111
|
}], ctorParameters: function () {
|
|
1032
|
-
return [{ type:
|
|
1112
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
1033
1113
|
type: Host
|
|
1034
1114
|
}] }];
|
|
1035
1115
|
}, propDecorators: { disabled: [{
|
|
@@ -1037,40 +1117,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1037
1117
|
args: ['dbxActionDisabled']
|
|
1038
1118
|
}] } });
|
|
1039
1119
|
|
|
1040
|
-
const APP_ACTION_DISABLED_UNTIL_MODIFIED_DIRECTIVE_KEY = 'dbx_action_is_not_modified';
|
|
1041
|
-
/**
|
|
1042
|
-
* Directive that sets the disabled state based on the current isModified state.
|
|
1043
|
-
*/
|
|
1044
|
-
class DbxActionDisabledUntilModifiedDirective extends AbstractSubscriptionDirective {
|
|
1045
|
-
constructor(source) {
|
|
1046
|
-
super();
|
|
1047
|
-
this.source = source;
|
|
1048
|
-
}
|
|
1049
|
-
ngOnInit() {
|
|
1050
|
-
this.sub = this.source.isModified$.subscribe((x) => {
|
|
1051
|
-
this.source.disable(APP_ACTION_DISABLED_UNTIL_MODIFIED_DIRECTIVE_KEY, !x);
|
|
1052
|
-
});
|
|
1053
|
-
}
|
|
1054
|
-
ngOnDestroy() {
|
|
1055
|
-
super.ngOnDestroy();
|
|
1056
|
-
this.source.enable(APP_ACTION_DISABLED_UNTIL_MODIFIED_DIRECTIVE_KEY);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
DbxActionDisabledUntilModifiedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionDisabledUntilModifiedDirective, deps: [{ token: ActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1060
|
-
DbxActionDisabledUntilModifiedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionDisabledUntilModifiedDirective, selector: "[dbxActionDisabledUntilModified]", usesInheritance: true, ngImport: i0 });
|
|
1061
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionDisabledUntilModifiedDirective, decorators: [{
|
|
1062
|
-
type: Directive,
|
|
1063
|
-
args: [{
|
|
1064
|
-
selector: '[dbxActionDisabledUntilModified]'
|
|
1065
|
-
}]
|
|
1066
|
-
}], ctorParameters: function () {
|
|
1067
|
-
return [{ type: ActionContextStoreSourceInstance, decorators: [{
|
|
1068
|
-
type: Host
|
|
1069
|
-
}] }];
|
|
1070
|
-
} });
|
|
1071
|
-
|
|
1072
1120
|
/**
|
|
1073
|
-
* WorkHandlerContextDelegate implementation using an
|
|
1121
|
+
* WorkHandlerContextDelegate implementation using an DbxActionContextStoreSourceInstance.
|
|
1074
1122
|
*/
|
|
1075
1123
|
class WorkHandlerContextSourceDelegate {
|
|
1076
1124
|
constructor(source) {
|
|
@@ -1080,7 +1128,7 @@ class WorkHandlerContextSourceDelegate {
|
|
|
1080
1128
|
this.source.startWorking();
|
|
1081
1129
|
}
|
|
1082
1130
|
success(result) {
|
|
1083
|
-
this.source.
|
|
1131
|
+
this.source.resolve(result);
|
|
1084
1132
|
}
|
|
1085
1133
|
reject(error) {
|
|
1086
1134
|
this.source.reject(error);
|
|
@@ -1231,7 +1279,7 @@ class DbxActionHandlerDirective extends AbstractSubscriptionDirective {
|
|
|
1231
1279
|
const context = handleWorkValueReadyFn({ handlerFunction, delegate: this._delegate })(value);
|
|
1232
1280
|
if (context) {
|
|
1233
1281
|
// Add the action to the lockSet for the source to prevent it from being destroyed until the action completes.
|
|
1234
|
-
this.source.lockSet.addLock('
|
|
1282
|
+
this.source.lockSet.addLock('dbxActionHandler', context.isComplete$.pipe(map(x => !x)));
|
|
1235
1283
|
}
|
|
1236
1284
|
})))).subscribe();
|
|
1237
1285
|
}
|
|
@@ -1241,7 +1289,7 @@ class DbxActionHandlerDirective extends AbstractSubscriptionDirective {
|
|
|
1241
1289
|
});
|
|
1242
1290
|
}
|
|
1243
1291
|
}
|
|
1244
|
-
DbxActionHandlerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionHandlerDirective, deps: [{ token:
|
|
1292
|
+
DbxActionHandlerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionHandlerDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1245
1293
|
DbxActionHandlerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: { handlerFunction: ["dbxActionHandler", "handlerFunction"] }, usesInheritance: true, ngImport: i0 });
|
|
1246
1294
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionHandlerDirective, decorators: [{
|
|
1247
1295
|
type: Directive,
|
|
@@ -1249,7 +1297,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1249
1297
|
selector: '[dbxActionHandler]',
|
|
1250
1298
|
}]
|
|
1251
1299
|
}], ctorParameters: function () {
|
|
1252
|
-
return [{ type:
|
|
1300
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
1253
1301
|
type: Host
|
|
1254
1302
|
}] }];
|
|
1255
1303
|
}, propDecorators: { handlerFunction: [{
|
|
@@ -1280,7 +1328,7 @@ class DbxActionSuccessComponent {
|
|
|
1280
1328
|
}), shareReplay(1));
|
|
1281
1329
|
}
|
|
1282
1330
|
}
|
|
1283
|
-
DbxActionSuccessComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionSuccessComponent, deps: [{ token:
|
|
1331
|
+
DbxActionSuccessComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionSuccessComponent, deps: [{ token: DbxActionContextStoreSourceInstance }], target: i0.ɵɵFactoryTarget.Component });
|
|
1284
1332
|
DbxActionSuccessComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionSuccessComponent, selector: "dbx-action-success", inputs: { hideAfter: "hideAfter" }, ngImport: i0, template: `
|
|
1285
1333
|
<ng-container *ngIf="show$ | async">
|
|
1286
1334
|
<ng-content></ng-content>
|
|
@@ -1296,7 +1344,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1296
1344
|
</ng-container>
|
|
1297
1345
|
`
|
|
1298
1346
|
}]
|
|
1299
|
-
}], ctorParameters: function () { return [{ type:
|
|
1347
|
+
}], ctorParameters: function () { return [{ type: DbxActionContextStoreSourceInstance }]; }, propDecorators: { hideAfter: [{
|
|
1300
1348
|
type: Input
|
|
1301
1349
|
}] } });
|
|
1302
1350
|
|
|
@@ -1326,7 +1374,7 @@ class DbxActionSuccessDirective extends AbstractSubscriptionDirective {
|
|
|
1326
1374
|
this._successFunction.complete();
|
|
1327
1375
|
}
|
|
1328
1376
|
}
|
|
1329
|
-
DbxActionSuccessDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionSuccessDirective, deps: [{ token:
|
|
1377
|
+
DbxActionSuccessDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionSuccessDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1330
1378
|
DbxActionSuccessDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionSuccessDirective, selector: "[dbxActionSuccess]", inputs: { successFunction: ["dbxActionSuccess", "successFunction"] }, usesInheritance: true, ngImport: i0 });
|
|
1331
1379
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionSuccessDirective, decorators: [{
|
|
1332
1380
|
type: Directive,
|
|
@@ -1334,7 +1382,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1334
1382
|
selector: '[dbxActionSuccess]',
|
|
1335
1383
|
}]
|
|
1336
1384
|
}], ctorParameters: function () {
|
|
1337
|
-
return [{ type:
|
|
1385
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
1338
1386
|
type: Host
|
|
1339
1387
|
}] }];
|
|
1340
1388
|
}, propDecorators: { successFunction: [{
|
|
@@ -1358,7 +1406,7 @@ class DbxActionValueDirective extends AbstractSubscriptionDirective {
|
|
|
1358
1406
|
return this._valueOrFunction.value;
|
|
1359
1407
|
}
|
|
1360
1408
|
set valueOrFunction(valueOrFunction) {
|
|
1361
|
-
this._valueOrFunction.next(valueOrFunction);
|
|
1409
|
+
this._valueOrFunction.next(valueOrFunction || undefined);
|
|
1362
1410
|
}
|
|
1363
1411
|
ngOnInit() {
|
|
1364
1412
|
this.sub = this.valueOrFunction$.pipe(switchMap(valueOrFunction => this.source.triggered$.pipe(tap(() => {
|
|
@@ -1367,11 +1415,13 @@ class DbxActionValueDirective extends AbstractSubscriptionDirective {
|
|
|
1367
1415
|
})))).subscribe();
|
|
1368
1416
|
}
|
|
1369
1417
|
ngOnDestroy() {
|
|
1370
|
-
|
|
1371
|
-
|
|
1418
|
+
this.source.lockSet.onNextUnlock(() => {
|
|
1419
|
+
super.ngOnDestroy();
|
|
1420
|
+
this._valueOrFunction.complete();
|
|
1421
|
+
});
|
|
1372
1422
|
}
|
|
1373
1423
|
}
|
|
1374
|
-
DbxActionValueDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionValueDirective, deps: [{ token:
|
|
1424
|
+
DbxActionValueDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionValueDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1375
1425
|
DbxActionValueDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionValueDirective, selector: "[dbxActionValue]", inputs: { valueOrFunction: ["dbxActionValue", "valueOrFunction"] }, usesInheritance: true, ngImport: i0 });
|
|
1376
1426
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionValueDirective, decorators: [{
|
|
1377
1427
|
type: Directive,
|
|
@@ -1379,7 +1429,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1379
1429
|
selector: '[dbxActionValue]',
|
|
1380
1430
|
}]
|
|
1381
1431
|
}], ctorParameters: function () {
|
|
1382
|
-
return [{ type:
|
|
1432
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
1383
1433
|
type: Host
|
|
1384
1434
|
}] }];
|
|
1385
1435
|
}, propDecorators: { valueOrFunction: [{
|
|
@@ -1396,7 +1446,7 @@ class DbxActionWorkingComponent {
|
|
|
1396
1446
|
this.show$ = this.source.isWorking$;
|
|
1397
1447
|
}
|
|
1398
1448
|
}
|
|
1399
|
-
DbxActionWorkingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionWorkingComponent, deps: [{ token:
|
|
1449
|
+
DbxActionWorkingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionWorkingComponent, deps: [{ token: DbxActionContextStoreSourceInstance }], target: i0.ɵɵFactoryTarget.Component });
|
|
1400
1450
|
DbxActionWorkingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionWorkingComponent, selector: "dbx-action-working", ngImport: i0, template: `
|
|
1401
1451
|
<ng-container *ngIf="show$ | async">
|
|
1402
1452
|
<ng-content></ng-content>
|
|
@@ -1412,45 +1462,177 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1412
1462
|
</ng-container>
|
|
1413
1463
|
`
|
|
1414
1464
|
}]
|
|
1415
|
-
}], ctorParameters: function () { return [{ type:
|
|
1416
|
-
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
(
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1465
|
+
}], ctorParameters: function () { return [{ type: DbxActionContextStoreSourceInstance }]; } });
|
|
1466
|
+
|
|
1467
|
+
const APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY = 'dbx_action_enforce_modified';
|
|
1468
|
+
/**
|
|
1469
|
+
* Directive that toggles disabling an action if the action is not marked modified.
|
|
1470
|
+
*/
|
|
1471
|
+
class DbxActionEnforceModifiedDirective extends AbstractSubscriptionDirective {
|
|
1472
|
+
constructor(source) {
|
|
1473
|
+
super();
|
|
1474
|
+
this.source = source;
|
|
1475
|
+
this._enabled = new BehaviorSubject(true);
|
|
1476
|
+
}
|
|
1477
|
+
ngOnInit() {
|
|
1478
|
+
this.sub = combineLatest([this.source.isModified$, this._enabled]).pipe(delay$1(0)).subscribe(([modified, enableDirective]) => {
|
|
1479
|
+
const disable = enableDirective && !modified;
|
|
1480
|
+
this.source.disable(APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY, disable);
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
ngOnDestroy() {
|
|
1484
|
+
super.ngOnDestroy();
|
|
1485
|
+
this._enabled.complete();
|
|
1486
|
+
this.source.enable(APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY);
|
|
1487
|
+
}
|
|
1488
|
+
get enabled() {
|
|
1489
|
+
return this._enabled.value;
|
|
1490
|
+
}
|
|
1491
|
+
set enabled(enabled) {
|
|
1492
|
+
this._enabled.next(enabled !== null && enabled !== void 0 ? enabled : true);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
DbxActionEnforceModifiedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionEnforceModifiedDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1496
|
+
DbxActionEnforceModifiedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionEnforceModifiedDirective, selector: "[dbxActionEnforceModified]", inputs: { enabled: ["[dbxActionEnforceModified]", "enabled"] }, usesInheritance: true, ngImport: i0 });
|
|
1497
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionEnforceModifiedDirective, decorators: [{
|
|
1498
|
+
type: Directive,
|
|
1499
|
+
args: [{
|
|
1500
|
+
selector: '[dbxActionEnforceModified]'
|
|
1501
|
+
}]
|
|
1502
|
+
}], ctorParameters: function () {
|
|
1503
|
+
return [{ type: DbxActionContextStoreSourceInstance, decorators: [{
|
|
1504
|
+
type: Host
|
|
1505
|
+
}] }];
|
|
1506
|
+
}, propDecorators: { enabled: [{
|
|
1507
|
+
type: Input,
|
|
1508
|
+
args: ['[dbxActionEnforceModified]']
|
|
1509
|
+
}] } });
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Utility class that handles trigger events to retrieve a value.
|
|
1513
|
+
*/
|
|
1514
|
+
class DbxActionValueOnTriggerInstance {
|
|
1515
|
+
constructor(config) {
|
|
1516
|
+
this._valueGetter = new BehaviorSubject(undefined);
|
|
1517
|
+
this.valueGetter$ = this._valueGetter.pipe(filterMaybe());
|
|
1518
|
+
this._triggeredSub = new SubscriptionObject();
|
|
1519
|
+
this.source = config.source;
|
|
1520
|
+
this._valueGetter.next(config.valueGetter);
|
|
1521
|
+
}
|
|
1522
|
+
get valueGetter() {
|
|
1523
|
+
return this._valueGetter.value;
|
|
1524
|
+
}
|
|
1525
|
+
set valueGetter(valueGetter) {
|
|
1526
|
+
this._valueGetter.next(valueGetter);
|
|
1527
|
+
}
|
|
1528
|
+
init() {
|
|
1529
|
+
// Ready the value after the source is triggered. Do modified check one last time.
|
|
1530
|
+
this._triggeredSub.subscription = this.source.triggered$.pipe(switchMap$1(() => this.valueGetter$.pipe(switchMap$1((valueGetter) => asObservable(valueGetter())))
|
|
1531
|
+
.pipe(
|
|
1532
|
+
// If the value is not null/undefined and is considered modified, then pass the value.
|
|
1533
|
+
switchMap$1((value) => returnIfIs(this.isModifiedFunction, value, false).pipe(map$1((value) => ({ value })))),
|
|
1534
|
+
// Catch any errors and pass them to reject.
|
|
1535
|
+
catchError((reject) => of({ reject }))))).subscribe((result) => {
|
|
1536
|
+
if (result.value != null) {
|
|
1537
|
+
this.source.readyValue(result.value);
|
|
1538
|
+
}
|
|
1539
|
+
else {
|
|
1540
|
+
this.source.reject(result.reject);
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
destroy() {
|
|
1545
|
+
this.source.lockSet.onNextUnlock(() => {
|
|
1546
|
+
this._triggeredSub.destroy();
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
/**
|
|
1552
|
+
* Abstract class for directives that may perform an action when trigger is called, and returns a value.
|
|
1553
|
+
*/
|
|
1554
|
+
class AbstractDbxActionValueOnTriggerDirective {
|
|
1555
|
+
constructor(source, valueGetter) {
|
|
1556
|
+
this.source = source;
|
|
1557
|
+
this._triggeredSub = new SubscriptionObject();
|
|
1558
|
+
this._instance = new DbxActionValueOnTriggerInstance({
|
|
1559
|
+
source: this.source,
|
|
1560
|
+
valueGetter
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
get valueGetter() {
|
|
1564
|
+
return this._instance.valueGetter;
|
|
1565
|
+
}
|
|
1566
|
+
set valueGetter(valueGetter) {
|
|
1567
|
+
this._instance.valueGetter = valueGetter;
|
|
1568
|
+
}
|
|
1569
|
+
get isModifiedFunction() {
|
|
1570
|
+
return this._instance.isModifiedFunction;
|
|
1571
|
+
}
|
|
1572
|
+
set isModifiedFunction(isModifiedFunction) {
|
|
1573
|
+
this._instance.isModifiedFunction = isModifiedFunction;
|
|
1574
|
+
}
|
|
1575
|
+
ngOnInit() {
|
|
1576
|
+
this._instance.init();
|
|
1577
|
+
}
|
|
1578
|
+
ngOnDestroy() {
|
|
1579
|
+
this._instance.destroy();
|
|
1580
|
+
this._triggeredSub.destroy();
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
AbstractDbxActionValueOnTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractDbxActionValueOnTriggerDirective, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
1584
|
+
AbstractDbxActionValueOnTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: AbstractDbxActionValueOnTriggerDirective, ngImport: i0 });
|
|
1585
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractDbxActionValueOnTriggerDirective, decorators: [{
|
|
1586
|
+
type: Directive
|
|
1587
|
+
}], ctorParameters: function () { return [{ type: DbxActionContextStoreSourceInstance }, { type: undefined }]; } });
|
|
1588
|
+
/**
|
|
1589
|
+
* Action directive that is used to trigger/display a popover, then watches that popover for a value.
|
|
1590
|
+
*/
|
|
1591
|
+
class DbxActionValueTriggerDirective extends AbstractDbxActionValueOnTriggerDirective {
|
|
1592
|
+
constructor(elementRef, source) {
|
|
1593
|
+
super(source);
|
|
1594
|
+
this.elementRef = elementRef;
|
|
1595
|
+
}
|
|
1596
|
+
set dbxActionValueOnTrigger(dbxActionValueTrigger) {
|
|
1597
|
+
this.valueGetter = dbxActionValueTrigger;
|
|
1598
|
+
}
|
|
1599
|
+
set dbxActionValueTriggerModified(isModifiedFunction) {
|
|
1600
|
+
this.isModifiedFunction = isModifiedFunction;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
DbxActionValueTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionValueTriggerDirective, deps: [{ token: i0.ElementRef }, { token: DbxActionContextStoreSourceInstance }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1604
|
+
DbxActionValueTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionValueTriggerDirective, selector: "[dbxActionValueOnTrigger]", inputs: { dbxActionValueOnTrigger: "dbxActionValueOnTrigger", dbxActionValueTriggerModified: "dbxActionValueTriggerModified" }, exportAs: ["dbxActionValueOnTrigger"], usesInheritance: true, ngImport: i0 });
|
|
1605
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionValueTriggerDirective, decorators: [{
|
|
1606
|
+
type: Directive,
|
|
1607
|
+
args: [{
|
|
1608
|
+
exportAs: 'dbxActionValueOnTrigger',
|
|
1609
|
+
selector: '[dbxActionValueOnTrigger]'
|
|
1610
|
+
}]
|
|
1611
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DbxActionContextStoreSourceInstance }]; }, propDecorators: { dbxActionValueOnTrigger: [{
|
|
1612
|
+
type: Input,
|
|
1613
|
+
args: ['dbxActionValueOnTrigger']
|
|
1614
|
+
}], dbxActionValueTriggerModified: [{
|
|
1615
|
+
type: Input
|
|
1616
|
+
}] } });
|
|
1441
1617
|
|
|
1442
1618
|
/**
|
|
1443
1619
|
* Configurable machine that handles components of the ActionContextStore lifecycle.
|
|
1620
|
+
*
|
|
1621
|
+
* It can be configured to activate only once before cleaning itself up. It can be used directly as a DbxActionContextSourceReference in cases where it is created as a one-off action.
|
|
1444
1622
|
*/
|
|
1445
|
-
class
|
|
1623
|
+
class DbxActionContextMachine extends DbxActionContextBaseSource {
|
|
1446
1624
|
constructor(config, source) {
|
|
1447
1625
|
super(source);
|
|
1448
1626
|
this.config = config;
|
|
1449
1627
|
this._isShutdown = true;
|
|
1450
1628
|
this._handleValueReadySub = new SubscriptionObject();
|
|
1629
|
+
this._successSub = new SubscriptionObject();
|
|
1451
1630
|
// Handle Value Ready
|
|
1452
1631
|
this._handleValueReadySub.subscription = this.sourceInstance.valueReady$.subscribe((value) => {
|
|
1453
|
-
handleWorkValueReadyFn({
|
|
1632
|
+
handleWorkValueReadyFn({
|
|
1633
|
+
handlerFunction: config.handleValueReady,
|
|
1634
|
+
delegate: new WorkHandlerContextSourceDelegate(this.sourceInstance)
|
|
1635
|
+
})(value);
|
|
1454
1636
|
});
|
|
1455
1637
|
// If this is a one-time use, then destroy it after the first success comes through.
|
|
1456
1638
|
if (this.config.oneTimeUse) {
|
|
@@ -1459,12 +1641,13 @@ class ActionContextMachine extends ActionContextBaseSource {
|
|
|
1459
1641
|
});
|
|
1460
1642
|
}
|
|
1461
1643
|
if (this.config.onSuccess) {
|
|
1462
|
-
this.sourceInstance.success$.subscribe(this.config.onSuccess);
|
|
1644
|
+
this._successSub.subscription = this.sourceInstance.success$.subscribe(this.config.onSuccess);
|
|
1463
1645
|
}
|
|
1464
1646
|
}
|
|
1465
1647
|
destroy() {
|
|
1466
1648
|
super.destroy();
|
|
1467
1649
|
this._handleValueReadySub.destroy();
|
|
1650
|
+
this._successSub.destroy();
|
|
1468
1651
|
this._isShutdown = true;
|
|
1469
1652
|
}
|
|
1470
1653
|
get isShutdown() {
|
|
@@ -1476,11 +1659,11 @@ class DbxCoreActionModule {
|
|
|
1476
1659
|
}
|
|
1477
1660
|
DbxCoreActionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxCoreActionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1478
1661
|
DbxCoreActionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxCoreActionModule, declarations: [DbxActionDirective, DbxActionContextMapDirective, DbxActionFromMapDirective, DbxActionMapSourceDirective,
|
|
1479
|
-
DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionHandlerDirective, DbxActionDisabledDirective,
|
|
1480
|
-
DbxActionAutoTriggerDirective,
|
|
1662
|
+
DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionHandlerDirective, DbxActionDisabledDirective, DbxActionEnforceModifiedDirective,
|
|
1663
|
+
DbxActionAutoTriggerDirective, dbxActionValueStreamDirective, DbxActionAutoModifyDirective, DbxActionValueDirective, DbxActionContextLoggerDirective,
|
|
1481
1664
|
DbxActionSuccessComponent, DbxActionSuccessDirective, DbxActionWorkingComponent], imports: [CommonModule], exports: [DbxActionDirective, DbxActionContextMapDirective, DbxActionFromMapDirective, DbxActionMapSourceDirective,
|
|
1482
|
-
DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionHandlerDirective, DbxActionDisabledDirective,
|
|
1483
|
-
DbxActionAutoTriggerDirective,
|
|
1665
|
+
DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionHandlerDirective, DbxActionDisabledDirective, DbxActionEnforceModifiedDirective,
|
|
1666
|
+
DbxActionAutoTriggerDirective, dbxActionValueStreamDirective, DbxActionAutoModifyDirective, DbxActionValueDirective, DbxActionContextLoggerDirective,
|
|
1484
1667
|
DbxActionSuccessComponent, DbxActionSuccessDirective, DbxActionWorkingComponent] });
|
|
1485
1668
|
DbxCoreActionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxCoreActionModule, imports: [[
|
|
1486
1669
|
CommonModule
|
|
@@ -1493,19 +1676,70 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1493
1676
|
],
|
|
1494
1677
|
declarations: [
|
|
1495
1678
|
DbxActionDirective, DbxActionContextMapDirective, DbxActionFromMapDirective, DbxActionMapSourceDirective,
|
|
1496
|
-
DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionHandlerDirective, DbxActionDisabledDirective,
|
|
1497
|
-
DbxActionAutoTriggerDirective,
|
|
1498
|
-
DbxActionSuccessComponent, DbxActionSuccessDirective, DbxActionWorkingComponent
|
|
1679
|
+
DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionHandlerDirective, DbxActionDisabledDirective, DbxActionEnforceModifiedDirective,
|
|
1680
|
+
DbxActionAutoTriggerDirective, dbxActionValueStreamDirective, DbxActionAutoModifyDirective, DbxActionValueDirective, DbxActionContextLoggerDirective,
|
|
1681
|
+
DbxActionSuccessComponent, DbxActionSuccessDirective, DbxActionWorkingComponent,
|
|
1499
1682
|
],
|
|
1500
1683
|
exports: [
|
|
1501
1684
|
DbxActionDirective, DbxActionContextMapDirective, DbxActionFromMapDirective, DbxActionMapSourceDirective,
|
|
1502
|
-
DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionHandlerDirective, DbxActionDisabledDirective,
|
|
1503
|
-
DbxActionAutoTriggerDirective,
|
|
1685
|
+
DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionHandlerDirective, DbxActionDisabledDirective, DbxActionEnforceModifiedDirective,
|
|
1686
|
+
DbxActionAutoTriggerDirective, dbxActionValueStreamDirective, DbxActionAutoModifyDirective, DbxActionValueDirective, DbxActionContextLoggerDirective,
|
|
1504
1687
|
DbxActionSuccessComponent, DbxActionSuccessDirective, DbxActionWorkingComponent
|
|
1505
1688
|
]
|
|
1506
1689
|
}]
|
|
1507
1690
|
}] });
|
|
1508
1691
|
|
|
1692
|
+
function makeDbxActionContextSourceReference(sourceInstance) {
|
|
1693
|
+
return {
|
|
1694
|
+
sourceInstance,
|
|
1695
|
+
destroy: () => 0
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* Convenience function used within observables for views that need to detect changes after a value changes.
|
|
1701
|
+
*
|
|
1702
|
+
* @param cdRef
|
|
1703
|
+
* @param timeout
|
|
1704
|
+
* @returns
|
|
1705
|
+
*/
|
|
1706
|
+
function tapDetectChanges(cdRef, timeout = 0) {
|
|
1707
|
+
return tap$1(() => setTimeout(() => safeDetectChanges(cdRef), timeout));
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Triggers a detection change on the input view as long as the view has not been destroyed.
|
|
1711
|
+
*
|
|
1712
|
+
* @param cdRef
|
|
1713
|
+
*/
|
|
1714
|
+
function safeDetectChanges(cdRef) {
|
|
1715
|
+
if (!cdRef.destroyed) {
|
|
1716
|
+
cdRef.detectChanges();
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Used to check an injected ElementRef that wraps an ng-content injection point whether or not any content was injected,
|
|
1721
|
+
* or more specifically if the parent component passed any target content to the child. This will still return true if
|
|
1722
|
+
* passed content is empty.
|
|
1723
|
+
*
|
|
1724
|
+
* TS:
|
|
1725
|
+
* @ViewChild('customLoading', { static: false }) customCustom: ElementRef;
|
|
1726
|
+
*
|
|
1727
|
+
* HTML:
|
|
1728
|
+
* <div #customContent>
|
|
1729
|
+
* <ng-content select="[content]"></ng-content>
|
|
1730
|
+
* </div>
|
|
1731
|
+
*/
|
|
1732
|
+
function checkNgContentWrapperHasContent(ref) {
|
|
1733
|
+
// https://github.com/angular/angular/issues/26083
|
|
1734
|
+
let hasContent = false;
|
|
1735
|
+
if (ref != null) {
|
|
1736
|
+
const childNodes = ref.nativeElement.childNodes;
|
|
1737
|
+
const hasChildNodes = childNodes && childNodes.length > 0;
|
|
1738
|
+
hasContent = Boolean(hasChildNodes);
|
|
1739
|
+
}
|
|
1740
|
+
return hasContent;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1509
1743
|
class DbxButton {
|
|
1510
1744
|
}
|
|
1511
1745
|
function ProvideDbxButton(sourceType) {
|
|
@@ -1533,7 +1767,7 @@ class DbxActionButtonTriggerDirective extends AbstractSubscriptionDirective {
|
|
|
1533
1767
|
this.source.trigger();
|
|
1534
1768
|
}
|
|
1535
1769
|
}
|
|
1536
|
-
DbxActionButtonTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionButtonTriggerDirective, deps: [{ token: DbxButton, host: true }, { token:
|
|
1770
|
+
DbxActionButtonTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionButtonTriggerDirective, deps: [{ token: DbxButton, host: true }, { token: DbxActionContextStoreSourceInstance }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1537
1771
|
DbxActionButtonTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionButtonTriggerDirective, selector: "[dbxActionButtonTrigger]", usesInheritance: true, ngImport: i0 });
|
|
1538
1772
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionButtonTriggerDirective, decorators: [{
|
|
1539
1773
|
type: Directive,
|
|
@@ -1543,28 +1777,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1543
1777
|
}], ctorParameters: function () {
|
|
1544
1778
|
return [{ type: DbxButton, decorators: [{
|
|
1545
1779
|
type: Host
|
|
1546
|
-
}] }, { type:
|
|
1780
|
+
}] }, { type: DbxActionContextStoreSourceInstance }];
|
|
1547
1781
|
} });
|
|
1548
1782
|
|
|
1549
1783
|
/**
|
|
1550
1784
|
* Context used for linking a button to an ActionContext.
|
|
1551
1785
|
*/
|
|
1552
1786
|
class DbxActionButtonDirective extends DbxActionButtonTriggerDirective {
|
|
1553
|
-
constructor(button, source,
|
|
1787
|
+
constructor(button, source, cdRef) {
|
|
1554
1788
|
super(button, source);
|
|
1555
|
-
this.
|
|
1789
|
+
this.cdRef = cdRef;
|
|
1556
1790
|
this._workingSub = new SubscriptionObject();
|
|
1557
1791
|
this._disabledSub = new SubscriptionObject();
|
|
1558
1792
|
}
|
|
1559
1793
|
ngOnInit() {
|
|
1560
1794
|
super.ngOnInit();
|
|
1561
1795
|
this._workingSub.subscription = this.source.isWorking$.subscribe((working) => {
|
|
1562
|
-
|
|
1563
|
-
|
|
1796
|
+
this.button.working = working;
|
|
1797
|
+
safeDetectChanges(this.cdRef);
|
|
1564
1798
|
});
|
|
1565
1799
|
this._disabledSub.subscription = this.source.isDisabled$.subscribe((disabled) => {
|
|
1566
|
-
|
|
1567
|
-
|
|
1800
|
+
this.button.disabled = disabled;
|
|
1801
|
+
safeDetectChanges(this.cdRef);
|
|
1568
1802
|
});
|
|
1569
1803
|
}
|
|
1570
1804
|
ngOnDestroy() {
|
|
@@ -1573,7 +1807,7 @@ class DbxActionButtonDirective extends DbxActionButtonTriggerDirective {
|
|
|
1573
1807
|
this._disabledSub.destroy();
|
|
1574
1808
|
}
|
|
1575
1809
|
}
|
|
1576
|
-
DbxActionButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionButtonDirective, deps: [{ token: DbxButton, host: true }, { token:
|
|
1810
|
+
DbxActionButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionButtonDirective, deps: [{ token: DbxButton, host: true }, { token: DbxActionContextStoreSourceInstance }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1577
1811
|
DbxActionButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: DbxActionButtonDirective, selector: "[dbxActionButton]", usesInheritance: true, ngImport: i0 });
|
|
1578
1812
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionButtonDirective, decorators: [{
|
|
1579
1813
|
type: Directive,
|
|
@@ -1583,7 +1817,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1583
1817
|
}], ctorParameters: function () {
|
|
1584
1818
|
return [{ type: DbxButton, decorators: [{
|
|
1585
1819
|
type: Host
|
|
1586
|
-
}] }, { type:
|
|
1820
|
+
}] }, { type: DbxActionContextStoreSourceInstance }, { type: i0.ChangeDetectorRef }];
|
|
1587
1821
|
} });
|
|
1588
1822
|
|
|
1589
1823
|
const expandClickableAnchorLinkTreeNode = expandTreeFunction({
|
|
@@ -2467,12 +2701,12 @@ class AbstractActionFilterSourceDirective extends AbstractFilterSourceDirective
|
|
|
2467
2701
|
}
|
|
2468
2702
|
}
|
|
2469
2703
|
AbstractActionFilterSourceDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractActionFilterSourceDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2470
|
-
AbstractActionFilterSourceDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: AbstractActionFilterSourceDirective, viewQueries: [{ propertyName: "filterAction", first: true, predicate:
|
|
2704
|
+
AbstractActionFilterSourceDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: AbstractActionFilterSourceDirective, viewQueries: [{ propertyName: "filterAction", first: true, predicate: DbxActionContextStoreSourceInstance, descendants: true, read: DbxActionContextStoreSourceInstance, static: true }], usesInheritance: true, ngImport: i0 });
|
|
2471
2705
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractActionFilterSourceDirective, decorators: [{
|
|
2472
2706
|
type: Directive
|
|
2473
2707
|
}], propDecorators: { filterAction: [{
|
|
2474
2708
|
type: ViewChild,
|
|
2475
|
-
args: [
|
|
2709
|
+
args: [DbxActionContextStoreSourceInstance, { static: true, read: DbxActionContextStoreSourceInstance }]
|
|
2476
2710
|
}] } });
|
|
2477
2711
|
|
|
2478
2712
|
/**
|
|
@@ -3251,53 +3485,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
3251
3485
|
type: NgModule
|
|
3252
3486
|
}] });
|
|
3253
3487
|
|
|
3254
|
-
/**
|
|
3255
|
-
* Convenience function used within observables for views that need to detect changes after a value changes.
|
|
3256
|
-
*
|
|
3257
|
-
* @param cdRef
|
|
3258
|
-
* @param timeout
|
|
3259
|
-
* @returns
|
|
3260
|
-
*/
|
|
3261
|
-
function tapDetectChanges(cdRef, timeout = 0) {
|
|
3262
|
-
return tap$1(() => setTimeout(() => safeDetectChanges(cdRef), timeout));
|
|
3263
|
-
}
|
|
3264
|
-
/**
|
|
3265
|
-
* Triggers a detection change on the input view as long as the view has not been destroyed.
|
|
3266
|
-
*
|
|
3267
|
-
* @param cdRef
|
|
3268
|
-
*/
|
|
3269
|
-
function safeDetectChanges(cdRef) {
|
|
3270
|
-
if (!cdRef.destroyed) {
|
|
3271
|
-
cdRef.detectChanges();
|
|
3272
|
-
}
|
|
3273
|
-
}
|
|
3274
|
-
/**
|
|
3275
|
-
* Used to check an injected ElementRef that wraps an ng-content injection point whether or not any content was injected,
|
|
3276
|
-
* or more specifically if the parent component passed any target content to the child. This will still return true if
|
|
3277
|
-
* passed content is empty.
|
|
3278
|
-
*
|
|
3279
|
-
* TS:
|
|
3280
|
-
* @ViewChild('customLoading', { static: false }) customCustom: ElementRef;
|
|
3281
|
-
*
|
|
3282
|
-
* HTML:
|
|
3283
|
-
* <div #customContent>
|
|
3284
|
-
* <ng-content select="[content]"></ng-content>
|
|
3285
|
-
* </div>
|
|
3286
|
-
*/
|
|
3287
|
-
function checkNgContentWrapperHasContent(ref) {
|
|
3288
|
-
// https://github.com/angular/angular/issues/26083
|
|
3289
|
-
let hasContent = false;
|
|
3290
|
-
if (ref != null) {
|
|
3291
|
-
const childNodes = ref.nativeElement.childNodes;
|
|
3292
|
-
const hasChildNodes = childNodes && childNodes.length > 0;
|
|
3293
|
-
hasContent = Boolean(hasChildNodes);
|
|
3294
|
-
}
|
|
3295
|
-
return hasContent;
|
|
3296
|
-
}
|
|
3297
|
-
|
|
3298
3488
|
/**
|
|
3299
3489
|
* Generated bundle index. Do not edit.
|
|
3300
3490
|
*/
|
|
3301
3491
|
|
|
3302
|
-
export { APP_ACTION_DISABLED_DIRECTIVE_KEY,
|
|
3492
|
+
export { APP_ACTION_DISABLED_DIRECTIVE_KEY, APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY, AbstractActionFilterSourceDirective, AbstractDbxActionValueOnTriggerDirective, AbstractDbxAnchorDirective, AbstractDbxButtonDirective, AbstractDbxFilterMapInstanceDirective, AbstractDbxInjectedDirective, AbstractFilterSourceConnectorDirective, AbstractFilterSourceDirective, AbstractLockSetSubscriptionDirective, AbstractSubscriptionDirective, AbstractTransitionDirective, AbstractTransitionWatcherDirective, ActionContextStore, ActionContextStoreSource, ActionContextStoreSourceMap, AnchorType, DBX_INJECTED_COMPONENT_DATA, DEFAULT_ACTION_DISABLED_KEY, DEFAULT_ACTION_MAP_WORKING_DISABLED_KEY, DEFAULT_STORAGE_ACCESSOR_FACTORY_TOKEN, DEFAULT_STORAGE_OBJECT_TOKEN, DateDistancePipe, DateFormatDistancePipe, DateFromToTimePipe, DbxActionAutoModifyDirective, DbxActionAutoTriggerDirective, DbxActionButtonDirective, DbxActionButtonTriggerDirective, DbxActionContextBaseSource, DbxActionContextLoggerDirective, DbxActionContextMachine, DbxActionContextMapDirective, DbxActionContextMapDirectiveSourceInstance, DbxActionContextStoreSourceInstance, DbxActionDirective, DbxActionDisabledDirective, DbxActionEnforceModifiedDirective, DbxActionFromMapDirective, DbxActionHandlerDirective, DbxActionMapSourceDirective, DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionState, DbxActionSuccessComponent, DbxActionSuccessDirective, DbxActionValueDirective, DbxActionValueOnTriggerInstance, DbxActionValueTriggerDirective, DbxActionWorkingComponent, DbxAnchor, DbxAngularRouterService, DbxButton, DbxButtonDirective, DbxButtonSegueDirective, DbxCoreActionModule, DbxCoreAngularRouterSegueModule, DbxCoreButtonModule, DbxCoreFilterModule, DbxCoreUIRouterSegueModule, DbxDatePipeModule, DbxFilterMapDirective, DbxFilterMapSourceConnectorDirective, DbxFilterMapSourceDirective, DbxFilterSourceConnectorDirective, DbxFilterSourceDirective, DbxInjectedComponent, DbxInjectedComponentInstance, DbxInjectedComponentModule, DbxLoadingButtonDirective, DbxRouterService, DbxRouterTransitionEventType, DbxRouterTransitionService, DbxStorageModule, DbxUIRouterService, FullLocalStorageObject, InstantStorageAccessor, LimitedStorageAccessor, MemoryStorageObject, MinutesStringPipe, ProvideActionStoreSource, ProvideDbxAnchor, ProvideDbxButton, ProvideFilterSource, ProvideFilterSourceConnector, ProvideSecondaryActionStoreSource, SecondaryActionContextStoreSource, SimpleStorageAccessor, SimpleStorageAccessorFactory, StorageAccessor, StringStorageAccessor, StringifySimpleStorageAccessorConverter, TimeDistanceCountdownPipe, TimeDistancePipe, ToJsDatePipe, ToMinutesPipe, WorkHandlerContext, WorkHandlerContextSourceDelegate, WrapperSimpleStorageAccessorDelegate, actionContextHasNoErrorAndIsModifiedAndCanTrigger, actionContextIsModifiedAndCanTrigger, actionContextStoreSourceInstanceFactory, actionContextStoreSourcePipe, anchorTypeForAnchor, canReadyValue, canTriggerAction, canTriggerActionState, checkNgContentWrapperHasContent, dbxActionValueStreamDirective, defaultStorageObjectFactory, expandClickableAnchorLinkTree, expandClickableAnchorLinkTreeNode, expandClickableAnchorLinkTrees, filterTransitionEvent, filterTransitionSuccess, flattenExpandedClickableAnchorLinkTree, flattenExpandedClickableAnchorLinkTreeToLinks, handleWorkValueReadyFn, handleWorkValueReadyWithConfigFn, isActionContextDisabled, isActionContextEnabled, isDisabledActionContextState, isIdleActionState, isWorkingActionState, loadingStateForActionContextState, loadingStateTypeForActionContextState, loadingStateTypeForActionState, makeDbxActionContextSourceReference, mapRefStringObsToSegueRefObs, mergeDbxInjectedComponentConfigs, pipeActionStore, refStringToSegueRef, safeDetectChanges, successTransition, tapDetectChanges, useActionStore };
|
|
3303
3493
|
//# sourceMappingURL=dereekb-dbx-core.mjs.map
|