@dereekb/dbx-core 2.0.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/esm2020/lib/action/directive/state/action.value.stream.directive.mjs +1 -1
- 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/index.mjs +3 -1
- package/fesm2015/dereekb-dbx-core.mjs +110 -3
- package/fesm2015/dereekb-dbx-core.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-core.mjs +110 -3
- package/fesm2020/dereekb-dbx-core.mjs.map +1 -1
- package/lib/action/directive/state/action.value.stream.directive.d.ts +2 -2
- 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/index.d.ts +2 -0
- package/package.json +8 -13
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
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 from 'rxjs';
|
|
4
|
-
import { BehaviorSubject, combineLatest, Subject, interval, EMPTY, of, isObservable, delay as delay$1,
|
|
4
|
+
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';
|
|
5
5
|
import * as i1$3 from '@dereekb/rxjs';
|
|
6
|
-
import { SubscriptionObject, LockSet, filterMaybe, LoadingStateType, beginLoading, idleLoadingState, errorResult, successResult, scanCount, combineLatestFromMapValuesObsFn, skipFirstMaybe, FilterSourceInstance, FilterSource, FilterSourceConnector, FilterMap } from '@dereekb/rxjs';
|
|
6
|
+
import { SubscriptionObject, LockSet, filterMaybe, LoadingStateType, beginLoading, idleLoadingState, errorResult, successResult, scanCount, combineLatestFromMapValuesObsFn, asObservable, returnIfIs, skipFirstMaybe, FilterSourceInstance, FilterSource, FilterSourceConnector, FilterMap } from '@dereekb/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
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';
|
|
@@ -1492,6 +1492,113 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
1492
1492
|
args: ['[dbxActionEnforceModified]']
|
|
1493
1493
|
}] } });
|
|
1494
1494
|
|
|
1495
|
+
/**
|
|
1496
|
+
* Utility class that handles trigger events to retrieve a value.
|
|
1497
|
+
*/
|
|
1498
|
+
class DbxActionValueOnTriggerInstance {
|
|
1499
|
+
constructor(config) {
|
|
1500
|
+
this._valueGetter = new BehaviorSubject(undefined);
|
|
1501
|
+
this.valueGetter$ = this._valueGetter.pipe(filterMaybe());
|
|
1502
|
+
this._triggeredSub = new SubscriptionObject();
|
|
1503
|
+
this.source = config.source;
|
|
1504
|
+
this._valueGetter.next(config.valueGetter);
|
|
1505
|
+
}
|
|
1506
|
+
get valueGetter() {
|
|
1507
|
+
return this._valueGetter.value;
|
|
1508
|
+
}
|
|
1509
|
+
set valueGetter(valueGetter) {
|
|
1510
|
+
this._valueGetter.next(valueGetter);
|
|
1511
|
+
}
|
|
1512
|
+
init() {
|
|
1513
|
+
// Ready the value after the source is triggered. Do modified check one last time.
|
|
1514
|
+
this._triggeredSub.subscription = this.source.triggered$.pipe(switchMap$1(() => this.valueGetter$.pipe(switchMap$1((valueGetter) => asObservable(valueGetter())))
|
|
1515
|
+
.pipe(
|
|
1516
|
+
// If the value is not null/undefined and is considered modified, then pass the value.
|
|
1517
|
+
switchMap$1((value) => returnIfIs(this.isModifiedFunction, value, false).pipe(map$1((value) => ({ value })))),
|
|
1518
|
+
// Catch any errors and pass them to reject.
|
|
1519
|
+
catchError((reject) => of({ reject }))))).subscribe((result) => {
|
|
1520
|
+
if (result.value != null) {
|
|
1521
|
+
this.source.readyValue(result.value);
|
|
1522
|
+
}
|
|
1523
|
+
else {
|
|
1524
|
+
this.source.reject(result.reject);
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
destroy() {
|
|
1529
|
+
this.source.lockSet.onNextUnlock(() => {
|
|
1530
|
+
this._triggeredSub.destroy();
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* Abstract class for directives that may perform an action when trigger is called, and returns a value.
|
|
1537
|
+
*/
|
|
1538
|
+
class AbstractDbxActionValueOnTriggerDirective {
|
|
1539
|
+
constructor(source, valueGetter) {
|
|
1540
|
+
this.source = source;
|
|
1541
|
+
this._triggeredSub = new SubscriptionObject();
|
|
1542
|
+
this._instance = new DbxActionValueOnTriggerInstance({
|
|
1543
|
+
source: this.source,
|
|
1544
|
+
valueGetter
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1547
|
+
get valueGetter() {
|
|
1548
|
+
return this._instance.valueGetter;
|
|
1549
|
+
}
|
|
1550
|
+
set valueGetter(valueGetter) {
|
|
1551
|
+
this._instance.valueGetter = valueGetter;
|
|
1552
|
+
}
|
|
1553
|
+
get isModifiedFunction() {
|
|
1554
|
+
return this._instance.isModifiedFunction;
|
|
1555
|
+
}
|
|
1556
|
+
set isModifiedFunction(isModifiedFunction) {
|
|
1557
|
+
this._instance.isModifiedFunction = isModifiedFunction;
|
|
1558
|
+
}
|
|
1559
|
+
ngOnInit() {
|
|
1560
|
+
this._instance.init();
|
|
1561
|
+
}
|
|
1562
|
+
ngOnDestroy() {
|
|
1563
|
+
this._instance.destroy();
|
|
1564
|
+
this._triggeredSub.destroy();
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
AbstractDbxActionValueOnTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractDbxActionValueOnTriggerDirective, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
1568
|
+
AbstractDbxActionValueOnTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: AbstractDbxActionValueOnTriggerDirective, ngImport: i0 });
|
|
1569
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AbstractDbxActionValueOnTriggerDirective, decorators: [{
|
|
1570
|
+
type: Directive
|
|
1571
|
+
}], ctorParameters: function () { return [{ type: DbxActionContextStoreSourceInstance }, { type: undefined }]; } });
|
|
1572
|
+
/**
|
|
1573
|
+
* Action directive that is used to trigger/display a popover, then watches that popover for a value.
|
|
1574
|
+
*/
|
|
1575
|
+
class DbxActionValueTriggerDirective extends AbstractDbxActionValueOnTriggerDirective {
|
|
1576
|
+
constructor(elementRef, source) {
|
|
1577
|
+
super(source);
|
|
1578
|
+
this.elementRef = elementRef;
|
|
1579
|
+
}
|
|
1580
|
+
set dbxActionValueOnTrigger(dbxActionValueTrigger) {
|
|
1581
|
+
this.valueGetter = dbxActionValueTrigger;
|
|
1582
|
+
}
|
|
1583
|
+
set dbxActionValueTriggerModified(isModifiedFunction) {
|
|
1584
|
+
this.isModifiedFunction = isModifiedFunction;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
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 });
|
|
1588
|
+
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 });
|
|
1589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: DbxActionValueTriggerDirective, decorators: [{
|
|
1590
|
+
type: Directive,
|
|
1591
|
+
args: [{
|
|
1592
|
+
exportAs: 'dbxActionValueOnTrigger',
|
|
1593
|
+
selector: '[dbxActionValueOnTrigger]'
|
|
1594
|
+
}]
|
|
1595
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DbxActionContextStoreSourceInstance }]; }, propDecorators: { dbxActionValueOnTrigger: [{
|
|
1596
|
+
type: Input,
|
|
1597
|
+
args: ['dbxActionValueOnTrigger']
|
|
1598
|
+
}], dbxActionValueTriggerModified: [{
|
|
1599
|
+
type: Input
|
|
1600
|
+
}] } });
|
|
1601
|
+
|
|
1495
1602
|
/**
|
|
1496
1603
|
* Configurable machine that handles components of the ActionContextStore lifecycle.
|
|
1497
1604
|
*
|
|
@@ -3363,5 +3470,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
3363
3470
|
* Generated bundle index. Do not edit.
|
|
3364
3471
|
*/
|
|
3365
3472
|
|
|
3366
|
-
export { APP_ACTION_DISABLED_DIRECTIVE_KEY, APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY, AbstractActionFilterSourceDirective, 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, 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 };
|
|
3473
|
+
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 };
|
|
3367
3474
|
//# sourceMappingURL=dereekb-dbx-core.mjs.map
|