@dereekb/dbx-core 12.0.4 → 12.0.6
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/esm2022/lib/action/directive/map/action.map.key.directive.mjs +9 -19
- package/esm2022/lib/action/directive/map/action.map.source.directive.mjs +17 -18
- package/esm2022/lib/action/directive/state/action.disabled.directive.mjs +10 -19
- package/esm2022/lib/action/directive/state/action.disableonsuccess.directive.mjs +12 -20
- package/esm2022/lib/action/directive/state/action.enforce.modified.directive.mjs +9 -17
- package/esm2022/lib/action/directive/state/action.presuccess.directive.mjs +8 -10
- package/esm2022/lib/action/directive/state/action.success.directive.mjs +8 -10
- package/esm2022/lib/action/directive/state/action.working.directive.mjs +10 -11
- package/esm2022/lib/auth/auth.role.any.directive.mjs +6 -12
- package/esm2022/lib/auth/auth.role.has.directive.mjs +6 -12
- package/esm2022/lib/auth/auth.role.not.directive.mjs +6 -12
- package/esm2022/lib/button/router/button.segue.directive.mjs +14 -28
- package/esm2022/lib/context/context.directive.mjs +11 -26
- package/esm2022/lib/injection/injection.context.directive.mjs +31 -27
- package/esm2022/lib/injection/injection.directive.mjs +1 -1
- package/esm2022/lib/injection/injection.instance.mjs +5 -5
- package/esm2022/lib/router/anchor/anchor.directive.mjs +41 -51
- package/esm2022/lib/router/anchor/anchor.mjs +1 -1
- package/esm2022/lib/router/model/id.param.redirect.mjs +1 -1
- package/fesm2022/dereekb-dbx-core.mjs +165 -255
- package/fesm2022/dereekb-dbx-core.mjs.map +1 -1
- package/lib/action/directive/map/action.map.key.directive.d.ts +4 -8
- package/lib/action/directive/map/action.map.source.directive.d.ts +5 -4
- package/lib/action/directive/state/action.disabled.directive.d.ts +5 -7
- package/lib/action/directive/state/action.disableonsuccess.directive.d.ts +6 -8
- package/lib/action/directive/state/action.enforce.modified.directive.d.ts +3 -4
- package/lib/action/directive/state/action.presuccess.directive.d.ts +3 -2
- package/lib/action/directive/state/action.success.directive.d.ts +3 -2
- package/lib/action/directive/state/action.working.directive.d.ts +4 -4
- package/lib/auth/auth.role.any.directive.d.ts +3 -4
- package/lib/auth/auth.role.has.directive.d.ts +3 -4
- package/lib/auth/auth.role.not.directive.d.ts +3 -4
- package/lib/button/router/button.segue.directive.d.ts +4 -9
- package/lib/context/context.directive.d.ts +4 -10
- package/lib/injection/injection.context.directive.d.ts +4 -2
- package/lib/injection/injection.directive.d.ts +1 -1
- package/lib/injection/injection.instance.d.ts +5 -5
- package/lib/router/anchor/anchor.d.ts +0 -3
- package/lib/router/anchor/anchor.directive.d.ts +15 -23
- package/lib/router/model/id.param.redirect.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, inject, input, computed, signal, Injectable, forwardRef,
|
|
3
|
-
import { SubscriptionObject, LockSet, filterMaybe, LoadingStateType, beginLoading, idleLoadingState, errorResult, successResult, scanCount, workFactory, asObservable, combineLatestFromMapValuesObsFn, emitDelayObs, makeIsModifiedFunctionObservable, returnIfIs, timeoutStartWith, onFalseToTrue, onTrueToFalse, setContainsAllValuesFrom, setContainsNoValueFrom, maybeValueFromObservableOrValue,
|
|
2
|
+
import { Directive, inject, input, computed, signal, Injectable, forwardRef, effect, TemplateRef, ViewContainerRef, Injector, runInInjectionContext, NgModule, InjectionToken, makeEnvironmentProviders, output, model, NgZone, Input, Pipe, LOCALE_ID, viewChild, Component, ChangeDetectionStrategy, Inject, Optional } from '@angular/core';
|
|
3
|
+
import { SubscriptionObject, LockSet, filterMaybe, LoadingStateType, beginLoading, idleLoadingState, errorResult, successResult, scanCount, workFactory, asObservable, combineLatestFromMapValuesObsFn, emitDelayObs, makeIsModifiedFunctionObservable, returnIfIs, timeoutStartWith, onFalseToTrue, onTrueToFalse, setContainsAllValuesFrom, setContainsNoValueFrom, maybeValueFromObservableOrValue, distinctUntilKeysChange, maybeValueFromObservableOrValueGetter, switchMapToDefault, asObservableFromGetter, FilterSource, FilterSourceConnector, FilterSourceInstance, FilterMap, skipAllInitialMaybe, switchMapObject } from '@dereekb/rxjs';
|
|
4
4
|
import { switchMap, first, distinctUntilChanged, filter, EMPTY, debounce, interval, throttle, exhaustMap, mergeMap, map, shareReplay, combineLatest, startWith, of, delay, BehaviorSubject, tap, combineLatestWith, catchError, withLatestFrom, firstValueFrom, takeUntil, Subject, Observable } from 'rxjs';
|
|
5
5
|
import { isNotFalse, isDefinedAndNotFalse, BooleanStringKeyArrayUtility, reduceBooleansWithOrFn, asGetter, getValueFromGetter, toReadableError, hasValueOrNotEmpty, isGetter, asArray, setIncludes, isAllowed, maybeSet, iterableToSet, expandTreeFunction, flattenTreeToArrayFunction, expandFlattenTreeFunction, mailToUrlString, telUrlString, mergeObjects, KeyValueTypleValueFilter, filterMaybeArrayValues, defaultForwardFunctionFactory, cutString, dollarAmountString, objectHasKey, objectHasKeys, mergeArrays, pushItemOrArrayItemsIntoArray, promiseReference, DataIsExpiredError, DataDoesNotExistError, hasNonNullValue, unixTimeNumberForNow, isThrottled, splitJoinRemainder, StorageObjectUtility, SHARED_MEMORY_STORAGE } from '@dereekb/util';
|
|
6
6
|
import { toObservable, outputToObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
@@ -1004,19 +1004,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1004
1004
|
*/
|
|
1005
1005
|
class DbxActionFromMapDirective {
|
|
1006
1006
|
_actionContextStoreSourceMap = inject(ActionContextStoreSourceMap);
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
this._key.complete();
|
|
1011
|
-
}
|
|
1012
|
-
get key() {
|
|
1013
|
-
return this._key.value;
|
|
1014
|
-
}
|
|
1015
|
-
set key(key) {
|
|
1016
|
-
this._key.next(key);
|
|
1017
|
-
}
|
|
1007
|
+
key = input(undefined, { alias: 'dbxActionFromMap' });
|
|
1008
|
+
key$ = toObservable(this.key);
|
|
1009
|
+
store$ = this.key$.pipe(filterMaybe(), switchMap((x) => this._actionContextStoreSourceMap.sourceForKey(x).store$));
|
|
1018
1010
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionFromMapDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1019
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1011
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxActionFromMapDirective, isStandalone: true, selector: "[dbxActionFromMap]", inputs: { key: { classPropertyName: "key", publicName: "dbxActionFromMap", isSignal: true, isRequired: false, transformFunction: null } }, providers: provideSecondaryActionStoreSource(DbxActionFromMapDirective), ngImport: i0 });
|
|
1020
1012
|
}
|
|
1021
1013
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionFromMapDirective, decorators: [{
|
|
1022
1014
|
type: Directive,
|
|
@@ -1025,10 +1017,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1025
1017
|
providers: provideSecondaryActionStoreSource(DbxActionFromMapDirective),
|
|
1026
1018
|
standalone: true
|
|
1027
1019
|
}]
|
|
1028
|
-
}]
|
|
1029
|
-
type: Input,
|
|
1030
|
-
args: ['dbxActionFromMap']
|
|
1031
|
-
}] } });
|
|
1020
|
+
}] });
|
|
1032
1021
|
|
|
1033
1022
|
/**
|
|
1034
1023
|
* Used to communicate with an dbxActionMap and set the ActionContextStore to the store based on the key.
|
|
@@ -1036,29 +1025,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1036
1025
|
class DbxActionMapSourceDirective {
|
|
1037
1026
|
_actionContextStoreSourceMap = inject(ActionContextStoreSourceMap);
|
|
1038
1027
|
source = inject(ActionContextStoreSource, { host: true });
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
if (this._key !== key) {
|
|
1028
|
+
key = input(undefined, { alias: 'dbxActionMapSource' });
|
|
1029
|
+
_currentKey;
|
|
1030
|
+
_keyEffect = effect(() => {
|
|
1031
|
+
const nextKey = this.key();
|
|
1032
|
+
if (this._currentKey !== nextKey) {
|
|
1045
1033
|
this._removeFromToStore();
|
|
1046
1034
|
}
|
|
1047
|
-
this.
|
|
1035
|
+
this._currentKey = nextKey;
|
|
1048
1036
|
this._addToStore();
|
|
1037
|
+
});
|
|
1038
|
+
ngOnDestroy() {
|
|
1039
|
+
this._removeFromToStore();
|
|
1049
1040
|
}
|
|
1050
1041
|
_addToStore() {
|
|
1051
|
-
if (this.
|
|
1052
|
-
this._actionContextStoreSourceMap.addStoreSource(this.
|
|
1042
|
+
if (this._currentKey) {
|
|
1043
|
+
this._actionContextStoreSourceMap.addStoreSource(this._currentKey, this.source);
|
|
1053
1044
|
}
|
|
1054
1045
|
}
|
|
1055
1046
|
_removeFromToStore() {
|
|
1056
|
-
if (this.
|
|
1057
|
-
this._actionContextStoreSourceMap.removeStoreSource(this.
|
|
1047
|
+
if (this._currentKey) {
|
|
1048
|
+
this._actionContextStoreSourceMap.removeStoreSource(this._currentKey);
|
|
1058
1049
|
}
|
|
1059
1050
|
}
|
|
1060
1051
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionMapSourceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1061
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1052
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxActionMapSourceDirective, isStandalone: true, selector: "[dbxActionMapSource]", inputs: { key: { classPropertyName: "key", publicName: "dbxActionMapSource", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
1062
1053
|
}
|
|
1063
1054
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionMapSourceDirective, decorators: [{
|
|
1064
1055
|
type: Directive,
|
|
@@ -1066,10 +1057,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1066
1057
|
selector: '[dbxActionMapSource]',
|
|
1067
1058
|
standalone: true
|
|
1068
1059
|
}]
|
|
1069
|
-
}]
|
|
1070
|
-
type: Input,
|
|
1071
|
-
args: ['dbxActionMapSource']
|
|
1072
|
-
}] } });
|
|
1060
|
+
}] });
|
|
1073
1061
|
|
|
1074
1062
|
/**
|
|
1075
1063
|
* Creates a new ActionContextStoreSourceMapReader from the input.
|
|
@@ -1140,26 +1128,20 @@ const APP_ACTION_DISABLED_DIRECTIVE_KEY = 'dbx_action_disabled';
|
|
|
1140
1128
|
*/
|
|
1141
1129
|
class DbxActionDisabledDirective extends AbstractSubscriptionDirective {
|
|
1142
1130
|
source = inject((DbxActionContextStoreSourceInstance), { host: true });
|
|
1143
|
-
|
|
1144
|
-
disabled$ = this.
|
|
1145
|
-
|
|
1131
|
+
disabled = input(false, { alias: 'dbxActionDisabled', transform: (value) => value !== false });
|
|
1132
|
+
disabled$ = toObservable(this.disabled);
|
|
1133
|
+
constructor() {
|
|
1134
|
+
super();
|
|
1146
1135
|
this.sub = this.disabled$.subscribe((x) => {
|
|
1147
1136
|
this.source.disable(APP_ACTION_DISABLED_DIRECTIVE_KEY, x);
|
|
1148
1137
|
});
|
|
1149
1138
|
}
|
|
1150
1139
|
ngOnDestroy() {
|
|
1151
1140
|
super.ngOnDestroy();
|
|
1152
|
-
this._disabled.complete();
|
|
1153
1141
|
this.source.enable(APP_ACTION_DISABLED_DIRECTIVE_KEY);
|
|
1154
1142
|
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
}
|
|
1158
|
-
set disabled(disabled) {
|
|
1159
|
-
this._disabled.next(disabled !== false);
|
|
1160
|
-
}
|
|
1161
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionDisabledDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1162
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: DbxActionDisabledDirective, isStandalone: true, selector: "[dbxActionDisabled]", inputs: { disabled: ["dbxActionDisabled", "disabled"] }, usesInheritance: true, ngImport: i0 });
|
|
1143
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionDisabledDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1144
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxActionDisabledDirective, isStandalone: true, selector: "[dbxActionDisabled]", inputs: { disabled: { classPropertyName: "disabled", publicName: "dbxActionDisabled", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
1163
1145
|
}
|
|
1164
1146
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionDisabledDirective, decorators: [{
|
|
1165
1147
|
type: Directive,
|
|
@@ -1167,10 +1149,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1167
1149
|
selector: '[dbxActionDisabled]',
|
|
1168
1150
|
standalone: true
|
|
1169
1151
|
}]
|
|
1170
|
-
}],
|
|
1171
|
-
type: Input,
|
|
1172
|
-
args: ['dbxActionDisabled']
|
|
1173
|
-
}] } });
|
|
1152
|
+
}], ctorParameters: () => [] });
|
|
1174
1153
|
|
|
1175
1154
|
const APP_ACTION_DISABLED_ON_SUCCESS_DIRECTIVE_KEY = 'dbx_action_disabled_on_success';
|
|
1176
1155
|
/**
|
|
@@ -1178,26 +1157,20 @@ const APP_ACTION_DISABLED_ON_SUCCESS_DIRECTIVE_KEY = 'dbx_action_disabled_on_suc
|
|
|
1178
1157
|
*/
|
|
1179
1158
|
class DbxActionDisabledOnSuccessDirective extends AbstractSubscriptionDirective {
|
|
1180
1159
|
source = inject((DbxActionContextStoreSourceInstance), { host: true });
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1160
|
+
disabledOnSuccess = input(true, { alias: 'dbxActionDisabledOnSuccess', transform: (value) => value !== false });
|
|
1161
|
+
disabledOnSuccess$ = toObservable(this.disabledOnSuccess);
|
|
1162
|
+
constructor() {
|
|
1163
|
+
super();
|
|
1164
|
+
this.sub = combineLatest([this.disabledOnSuccess$, this.source.isSuccess$]).subscribe(([disableOnSuccess, success]) => {
|
|
1185
1165
|
this.source.disable(APP_ACTION_DISABLED_ON_SUCCESS_DIRECTIVE_KEY, disableOnSuccess && success);
|
|
1186
1166
|
});
|
|
1187
1167
|
}
|
|
1188
1168
|
ngOnDestroy() {
|
|
1189
1169
|
super.ngOnDestroy();
|
|
1190
|
-
this._disableOnSuccess.complete();
|
|
1191
1170
|
this.source.enable(APP_ACTION_DISABLED_ON_SUCCESS_DIRECTIVE_KEY);
|
|
1192
1171
|
}
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
}
|
|
1196
|
-
set disabled(disabled) {
|
|
1197
|
-
this._disableOnSuccess.next(disabled !== false);
|
|
1198
|
-
}
|
|
1199
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionDisabledOnSuccessDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1200
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: DbxActionDisabledOnSuccessDirective, isStandalone: true, selector: "[dbxActionDisabledOnSuccess]", inputs: { disabled: ["dbxActionDisabledOnSuccess", "disabled"] }, usesInheritance: true, ngImport: i0 });
|
|
1172
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionDisabledOnSuccessDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1173
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxActionDisabledOnSuccessDirective, isStandalone: true, selector: "[dbxActionDisabledOnSuccess]", inputs: { disabledOnSuccess: { classPropertyName: "disabledOnSuccess", publicName: "dbxActionDisabledOnSuccess", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
1201
1174
|
}
|
|
1202
1175
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionDisabledOnSuccessDirective, decorators: [{
|
|
1203
1176
|
type: Directive,
|
|
@@ -1205,10 +1178,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1205
1178
|
selector: '[dbxActionDisabledOnSuccess]',
|
|
1206
1179
|
standalone: true
|
|
1207
1180
|
}]
|
|
1208
|
-
}],
|
|
1209
|
-
type: Input,
|
|
1210
|
-
args: ['dbxActionDisabledOnSuccess']
|
|
1211
|
-
}] } });
|
|
1181
|
+
}], ctorParameters: () => [] });
|
|
1212
1182
|
|
|
1213
1183
|
const DBX_ACTION_HANDLER_LOCK_KEY = 'dbxActionHandler';
|
|
1214
1184
|
/**
|
|
@@ -1351,17 +1321,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1351
1321
|
* Can be configured to hide for a temporary period.
|
|
1352
1322
|
*/
|
|
1353
1323
|
class DbxActionPreSuccessDirective extends AbstractIfDirective {
|
|
1354
|
-
|
|
1355
|
-
|
|
1324
|
+
_store = inject(DbxActionContextStoreSourceInstance);
|
|
1325
|
+
hideFor = input(undefined, { alias: 'dbxActionPreSuccess', transform: (value) => (value === '' ? undefined : value) });
|
|
1326
|
+
show$ = this._store.isSuccess$.pipe(exhaustMap((success) => {
|
|
1356
1327
|
if (success) {
|
|
1357
|
-
return emitDelayObs(false, true, this.hideFor
|
|
1328
|
+
return emitDelayObs(false, true, this.hideFor());
|
|
1358
1329
|
}
|
|
1359
1330
|
else {
|
|
1360
1331
|
return of(true);
|
|
1361
1332
|
}
|
|
1362
1333
|
}), shareReplay(1));
|
|
1363
1334
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionPreSuccessDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1364
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1335
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxActionPreSuccessDirective, isStandalone: true, selector: "[dbxActionPreSuccess]", inputs: { hideFor: { classPropertyName: "hideFor", publicName: "dbxActionPreSuccess", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
1365
1336
|
}
|
|
1366
1337
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionPreSuccessDirective, decorators: [{
|
|
1367
1338
|
type: Directive,
|
|
@@ -1369,10 +1340,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1369
1340
|
selector: '[dbxActionPreSuccess]',
|
|
1370
1341
|
standalone: true
|
|
1371
1342
|
}]
|
|
1372
|
-
}]
|
|
1373
|
-
type: Input,
|
|
1374
|
-
args: ['dbxActionPreSuccess']
|
|
1375
|
-
}] } });
|
|
1343
|
+
}] });
|
|
1376
1344
|
|
|
1377
1345
|
/**
|
|
1378
1346
|
* Structural directive that displays the content when the store has a success value.
|
|
@@ -1380,17 +1348,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1380
1348
|
* Can be configured to show for a temporary period.
|
|
1381
1349
|
*/
|
|
1382
1350
|
class DbxActionHasSuccessDirective extends AbstractIfDirective {
|
|
1383
|
-
|
|
1384
|
-
|
|
1351
|
+
_store = inject(DbxActionContextStoreSourceInstance);
|
|
1352
|
+
hideAfter = input(undefined, { alias: 'dbxActionHasSuccess', transform: (value) => (value === '' ? undefined : value) });
|
|
1353
|
+
show$ = this._store.isSuccess$.pipe(exhaustMap((success) => {
|
|
1385
1354
|
if (success) {
|
|
1386
|
-
return emitDelayObs(true, false, this.hideAfter
|
|
1355
|
+
return emitDelayObs(true, false, this.hideAfter());
|
|
1387
1356
|
}
|
|
1388
1357
|
else {
|
|
1389
1358
|
return of(false);
|
|
1390
1359
|
}
|
|
1391
1360
|
}), shareReplay(1));
|
|
1392
1361
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionHasSuccessDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1393
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1362
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxActionHasSuccessDirective, isStandalone: true, selector: "[dbxActionHasSuccess]", inputs: { hideAfter: { classPropertyName: "hideAfter", publicName: "dbxActionHasSuccess", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
1394
1363
|
}
|
|
1395
1364
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionHasSuccessDirective, decorators: [{
|
|
1396
1365
|
type: Directive,
|
|
@@ -1398,10 +1367,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1398
1367
|
selector: '[dbxActionHasSuccess]',
|
|
1399
1368
|
standalone: true
|
|
1400
1369
|
}]
|
|
1401
|
-
}]
|
|
1402
|
-
type: Input,
|
|
1403
|
-
args: ['dbxActionHasSuccess']
|
|
1404
|
-
}] } });
|
|
1370
|
+
}] });
|
|
1405
1371
|
|
|
1406
1372
|
/**
|
|
1407
1373
|
* Directive that executes a function on ActionContextStore Success.
|
|
@@ -1477,17 +1443,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1477
1443
|
* Can specify a period in milliseconds that shows how long to show up after working for a particular number of seconds.
|
|
1478
1444
|
*/
|
|
1479
1445
|
class DbxActionIsWorkingDirective extends AbstractIfDirective {
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1446
|
+
_store = inject(DbxActionContextStoreSourceInstance);
|
|
1447
|
+
showAfter = input(undefined, { alias: 'dbxActionIsWorking', transform: (value) => (value === '' ? undefined : value) });
|
|
1448
|
+
show$ = this._store.isWorking$.pipe(exhaustMap((isWorking) => {
|
|
1449
|
+
const showAfter = this.showAfter();
|
|
1450
|
+
if (isWorking && showAfter) {
|
|
1451
|
+
return emitDelayObs(false, true, showAfter);
|
|
1484
1452
|
}
|
|
1485
1453
|
else {
|
|
1486
1454
|
return of(isWorking);
|
|
1487
1455
|
}
|
|
1488
1456
|
}), shareReplay(1));
|
|
1489
1457
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionIsWorkingDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1490
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1458
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxActionIsWorkingDirective, isStandalone: true, selector: "[dbxActionIsWorking]", inputs: { showAfter: { classPropertyName: "showAfter", publicName: "dbxActionIsWorking", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
1491
1459
|
}
|
|
1492
1460
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionIsWorkingDirective, decorators: [{
|
|
1493
1461
|
type: Directive,
|
|
@@ -1495,10 +1463,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1495
1463
|
selector: '[dbxActionIsWorking]',
|
|
1496
1464
|
standalone: true
|
|
1497
1465
|
}]
|
|
1498
|
-
}]
|
|
1499
|
-
type: Input,
|
|
1500
|
-
args: ['dbxActionIsWorking']
|
|
1501
|
-
}] } });
|
|
1466
|
+
}] });
|
|
1502
1467
|
|
|
1503
1468
|
const APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY = 'dbx_action_enforce_modified';
|
|
1504
1469
|
/**
|
|
@@ -1506,9 +1471,10 @@ const APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY = 'dbx_action_enforce_modified';
|
|
|
1506
1471
|
*/
|
|
1507
1472
|
class DbxActionEnforceModifiedDirective extends AbstractSubscriptionDirective {
|
|
1508
1473
|
source = inject(DbxActionContextStoreSourceInstance, { host: true });
|
|
1509
|
-
|
|
1474
|
+
enabled = input(true, { alias: 'dbxActionEnforceModified', transform: (value) => value !== false });
|
|
1475
|
+
enabled$ = toObservable(this.enabled);
|
|
1510
1476
|
ngOnInit() {
|
|
1511
|
-
this.sub = combineLatest([this.source.isModified$, this.
|
|
1477
|
+
this.sub = combineLatest([this.source.isModified$, this.enabled$])
|
|
1512
1478
|
.pipe(delay(0))
|
|
1513
1479
|
.subscribe(([modified, enableDirective]) => {
|
|
1514
1480
|
const disable = enableDirective && !modified;
|
|
@@ -1517,17 +1483,10 @@ class DbxActionEnforceModifiedDirective extends AbstractSubscriptionDirective {
|
|
|
1517
1483
|
}
|
|
1518
1484
|
ngOnDestroy() {
|
|
1519
1485
|
super.ngOnDestroy();
|
|
1520
|
-
this._enabled.complete();
|
|
1521
1486
|
this.source.enable(APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY);
|
|
1522
1487
|
}
|
|
1523
|
-
get enabled() {
|
|
1524
|
-
return this._enabled.value;
|
|
1525
|
-
}
|
|
1526
|
-
set enabled(enabled) {
|
|
1527
|
-
this._enabled.next(enabled !== false);
|
|
1528
|
-
}
|
|
1529
1488
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionEnforceModifiedDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1530
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1489
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxActionEnforceModifiedDirective, isStandalone: true, selector: "[dbxActionEnforceModified]", inputs: { enabled: { classPropertyName: "enabled", publicName: "dbxActionEnforceModified", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
1531
1490
|
}
|
|
1532
1491
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxActionEnforceModifiedDirective, decorators: [{
|
|
1533
1492
|
type: Directive,
|
|
@@ -1535,10 +1494,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1535
1494
|
selector: '[dbxActionEnforceModified]',
|
|
1536
1495
|
standalone: true
|
|
1537
1496
|
}]
|
|
1538
|
-
}]
|
|
1539
|
-
type: Input,
|
|
1540
|
-
args: ['dbxActionEnforceModified']
|
|
1541
|
-
}] } });
|
|
1497
|
+
}] });
|
|
1542
1498
|
|
|
1543
1499
|
/**
|
|
1544
1500
|
* Utility class that handles trigger events to retrieve a value.
|
|
@@ -2475,15 +2431,12 @@ function authRolesSetContainsNoRolesFrom(roles) {
|
|
|
2475
2431
|
* Structural decorator directive similar to ngIf that embeds content if the current auth user has any of the target role(s).
|
|
2476
2432
|
*/
|
|
2477
2433
|
class DbxAuthHasAnyRoleDirective extends AbstractIfDirective {
|
|
2478
|
-
_targetRoles = signal(undefined);
|
|
2479
2434
|
_authService = inject(DbxAuthService);
|
|
2480
|
-
targetRoles
|
|
2435
|
+
targetRoles = input(undefined, { alias: 'dbxAuthHasAnyRole' });
|
|
2436
|
+
targetRoles$ = toObservable(this.targetRoles);
|
|
2481
2437
|
show$ = this._authService.authRoles$.pipe(authRolesSetContainsAnyRoleFrom(this.targetRoles$));
|
|
2482
|
-
set targetRoles(roles) {
|
|
2483
|
-
this._targetRoles.set(roles);
|
|
2484
|
-
}
|
|
2485
2438
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxAuthHasAnyRoleDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2486
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2439
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxAuthHasAnyRoleDirective, isStandalone: true, selector: "[dbxAuthHasAnyRole]", inputs: { targetRoles: { classPropertyName: "targetRoles", publicName: "dbxAuthHasAnyRole", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
2487
2440
|
}
|
|
2488
2441
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxAuthHasAnyRoleDirective, decorators: [{
|
|
2489
2442
|
type: Directive,
|
|
@@ -2491,24 +2444,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2491
2444
|
selector: '[dbxAuthHasAnyRole]',
|
|
2492
2445
|
standalone: true
|
|
2493
2446
|
}]
|
|
2494
|
-
}]
|
|
2495
|
-
type: Input,
|
|
2496
|
-
args: ['dbxAuthHasAnyRole']
|
|
2497
|
-
}] } });
|
|
2447
|
+
}] });
|
|
2498
2448
|
|
|
2499
2449
|
/**
|
|
2500
2450
|
* Structural decorator directive similar to ngIf that embeds content if the current auth user has all of the target role(s).
|
|
2501
2451
|
*/
|
|
2502
2452
|
class DbxAuthHasRolesDirective extends AbstractIfDirective {
|
|
2503
|
-
_targetRoles = signal(undefined);
|
|
2504
2453
|
_authService = inject(DbxAuthService);
|
|
2505
|
-
targetRoles
|
|
2454
|
+
targetRoles = input(undefined, { alias: 'dbxAuthHasRoles' });
|
|
2455
|
+
targetRoles$ = toObservable(this.targetRoles);
|
|
2506
2456
|
show$ = this._authService.authRoles$.pipe(authRolesSetContainsAllRolesFrom(this.targetRoles$));
|
|
2507
|
-
set targetRoles(roles) {
|
|
2508
|
-
this._targetRoles.set(roles);
|
|
2509
|
-
}
|
|
2510
2457
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxAuthHasRolesDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2511
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2458
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxAuthHasRolesDirective, isStandalone: true, selector: "[dbxAuthHasRoles]", inputs: { targetRoles: { classPropertyName: "targetRoles", publicName: "dbxAuthHasRoles", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
2512
2459
|
}
|
|
2513
2460
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxAuthHasRolesDirective, decorators: [{
|
|
2514
2461
|
type: Directive,
|
|
@@ -2516,24 +2463,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2516
2463
|
selector: '[dbxAuthHasRoles]',
|
|
2517
2464
|
standalone: true
|
|
2518
2465
|
}]
|
|
2519
|
-
}]
|
|
2520
|
-
type: Input,
|
|
2521
|
-
args: ['dbxAuthHasRoles']
|
|
2522
|
-
}] } });
|
|
2466
|
+
}] });
|
|
2523
2467
|
|
|
2524
2468
|
/**
|
|
2525
2469
|
* Structural decorator directive similar to ngIf that embeds content if the current auth user has none of the target role(s).
|
|
2526
2470
|
*/
|
|
2527
2471
|
class DbxAuthNotAnyRoleDirective extends AbstractIfDirective {
|
|
2528
|
-
_targetRoles = signal(undefined);
|
|
2529
2472
|
_authService = inject(DbxAuthService);
|
|
2530
|
-
targetRoles
|
|
2473
|
+
targetRoles = input(undefined, { alias: 'dbxAuthNotAnyRole' });
|
|
2474
|
+
targetRoles$ = toObservable(this.targetRoles);
|
|
2531
2475
|
show$ = this._authService.authRoles$.pipe(authRolesSetContainsNoRolesFrom(this.targetRoles$));
|
|
2532
|
-
set targetRoles(roles) {
|
|
2533
|
-
this._targetRoles.set(roles);
|
|
2534
|
-
}
|
|
2535
2476
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxAuthNotAnyRoleDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2536
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2477
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxAuthNotAnyRoleDirective, isStandalone: true, selector: "[dbxAuthNotAnyRole]", inputs: { targetRoles: { classPropertyName: "targetRoles", publicName: "dbxAuthNotAnyRole", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
2537
2478
|
}
|
|
2538
2479
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxAuthNotAnyRoleDirective, decorators: [{
|
|
2539
2480
|
type: Directive,
|
|
@@ -2541,10 +2482,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2541
2482
|
selector: '[dbxAuthNotAnyRole]',
|
|
2542
2483
|
standalone: true
|
|
2543
2484
|
}]
|
|
2544
|
-
}]
|
|
2545
|
-
type: Input,
|
|
2546
|
-
args: ['dbxAuthNotAnyRole']
|
|
2547
|
-
}] } });
|
|
2485
|
+
}] });
|
|
2548
2486
|
|
|
2549
2487
|
/**
|
|
2550
2488
|
* @deprecated import the directives directly instead of using this module.
|
|
@@ -2709,27 +2647,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2709
2647
|
class DbxButtonSegueDirective extends AbstractSubscriptionDirective {
|
|
2710
2648
|
dbxButton = inject(DbxButton);
|
|
2711
2649
|
dbxRouterService = inject(DbxRouterService);
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
this.sub = this.segueRef$
|
|
2722
|
-
.pipe(switchMap((segueRef) => this.dbxButton.clicked$.pipe(tap(() => {
|
|
2723
|
-
this.dbxRouterService.go(segueRef);
|
|
2724
|
-
}))))
|
|
2725
|
-
.subscribe();
|
|
2726
|
-
}
|
|
2727
|
-
ngOnDestroy() {
|
|
2728
|
-
super.ngOnDestroy();
|
|
2729
|
-
this._segueRef.complete();
|
|
2650
|
+
segueRef = input(undefined, { alias: 'dbxButtonSegue' });
|
|
2651
|
+
constructor() {
|
|
2652
|
+
super();
|
|
2653
|
+
this.sub = this.dbxButton.clicked$.subscribe(() => {
|
|
2654
|
+
const segueRef = this.segueRef();
|
|
2655
|
+
if (segueRef) {
|
|
2656
|
+
this.dbxRouterService.go(segueRef);
|
|
2657
|
+
}
|
|
2658
|
+
});
|
|
2730
2659
|
}
|
|
2731
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxButtonSegueDirective, deps:
|
|
2732
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2660
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxButtonSegueDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2661
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxButtonSegueDirective, isStandalone: true, selector: "[dbxButtonSegue]", inputs: { segueRef: { classPropertyName: "segueRef", publicName: "dbxButtonSegue", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
2733
2662
|
}
|
|
2734
2663
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxButtonSegueDirective, decorators: [{
|
|
2735
2664
|
type: Directive,
|
|
@@ -2737,10 +2666,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2737
2666
|
selector: '[dbxButtonSegue]',
|
|
2738
2667
|
standalone: true
|
|
2739
2668
|
}]
|
|
2740
|
-
}],
|
|
2741
|
-
type: Input,
|
|
2742
|
-
args: ['dbxButtonSegue']
|
|
2743
|
-
}] } });
|
|
2669
|
+
}], ctorParameters: () => [] });
|
|
2744
2670
|
|
|
2745
2671
|
/**
|
|
2746
2672
|
* Abstract button component.
|
|
@@ -2927,26 +2853,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2927
2853
|
/**
|
|
2928
2854
|
* Used to set the DbxAppContextState for an app to the input state using the DbxAppContextService.
|
|
2929
2855
|
*/
|
|
2930
|
-
class DbxAppContextStateDirective
|
|
2856
|
+
class DbxAppContextStateDirective {
|
|
2931
2857
|
dbxAppContextStateService = inject(DbxAppContextService);
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
ngOnInit() {
|
|
2937
|
-
this.sub = this._state.pipe(filterMaybe()).subscribe((state) => {
|
|
2858
|
+
state = input(undefined, { alias: 'dbxAppContextState' });
|
|
2859
|
+
_stateEffect = effect(() => {
|
|
2860
|
+
const state = this.state();
|
|
2861
|
+
if (state != null) {
|
|
2938
2862
|
this.dbxAppContextStateService.setState(state);
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
2941
|
-
ngOnDestroy() {
|
|
2942
|
-
super.ngOnDestroy();
|
|
2943
|
-
this._state.complete();
|
|
2944
|
-
}
|
|
2945
|
-
set state(state) {
|
|
2946
|
-
this._state.next(state);
|
|
2947
|
-
}
|
|
2863
|
+
}
|
|
2864
|
+
}, { allowSignalWrites: true });
|
|
2948
2865
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxAppContextStateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2949
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2866
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxAppContextStateDirective, isStandalone: true, selector: "[dbxAppContextState]", inputs: { state: { classPropertyName: "state", publicName: "dbxAppContextState", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
2950
2867
|
}
|
|
2951
2868
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxAppContextStateDirective, decorators: [{
|
|
2952
2869
|
type: Directive,
|
|
@@ -2954,10 +2871,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2954
2871
|
selector: '[dbxAppContextState]',
|
|
2955
2872
|
standalone: true
|
|
2956
2873
|
}]
|
|
2957
|
-
}]
|
|
2958
|
-
type: Input,
|
|
2959
|
-
args: ['dbxAppContextState']
|
|
2960
|
-
}] } });
|
|
2874
|
+
}] });
|
|
2961
2875
|
|
|
2962
2876
|
/**
|
|
2963
2877
|
* @deprecated Use provideDbxAppContextState() and import DbxAppContextStateDirective directly. DbxAppContextStateDirective is now standalone.
|
|
@@ -3087,62 +3001,54 @@ function provideDbxAnchor(sourceType) {
|
|
|
3087
3001
|
* Abstract anchor directive.
|
|
3088
3002
|
*/
|
|
3089
3003
|
class AbstractDbxAnchorDirective {
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3004
|
+
ref = model();
|
|
3005
|
+
anchor = model();
|
|
3006
|
+
disabled = model();
|
|
3007
|
+
selected = model();
|
|
3008
|
+
anchorSignal = computed(() => {
|
|
3009
|
+
const ref = this.ref();
|
|
3010
|
+
const anchor = this.anchor();
|
|
3011
|
+
let result = anchor;
|
|
3012
|
+
if (ref != null) {
|
|
3013
|
+
result = asSegueRef(ref);
|
|
3014
|
+
}
|
|
3015
|
+
return result;
|
|
3016
|
+
});
|
|
3017
|
+
selectedSignal = computed(() => {
|
|
3018
|
+
const selected = this.selected();
|
|
3019
|
+
const anchor = this.anchorSignal();
|
|
3020
|
+
return selected || anchor?.selected;
|
|
3021
|
+
});
|
|
3022
|
+
typeSignal = computed(() => {
|
|
3023
|
+
const anchor = this.anchorSignal();
|
|
3024
|
+
const disabled = this.disabled();
|
|
3025
|
+
return anchorTypeForAnchor(anchor, disabled);
|
|
3026
|
+
});
|
|
3101
3027
|
urlSignal = computed(() => this.anchorSignal()?.url);
|
|
3102
3028
|
targetSignal = computed(() => this.anchorSignal()?.target);
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
*/
|
|
3111
|
-
set ref(ref) {
|
|
3112
|
-
this.anchor = asSegueRef(ref);
|
|
3113
|
-
}
|
|
3114
|
-
get anchor() {
|
|
3115
|
-
return this._anchor.value;
|
|
3116
|
-
}
|
|
3117
|
-
set anchor(anchor) {
|
|
3118
|
-
this._anchor.next(anchor);
|
|
3119
|
-
}
|
|
3120
|
-
get disabled() {
|
|
3121
|
-
return this._disabled.value;
|
|
3029
|
+
anchor$ = toObservable(this.anchorSignal);
|
|
3030
|
+
disabled$ = toObservable(this.disabled);
|
|
3031
|
+
selected$ = toObservable(this.selectedSignal);
|
|
3032
|
+
type$ = toObservable(this.typeSignal);
|
|
3033
|
+
// MARK: Accessors
|
|
3034
|
+
setRef(ref) {
|
|
3035
|
+
this.ref.set(ref);
|
|
3122
3036
|
}
|
|
3123
|
-
|
|
3124
|
-
this.
|
|
3037
|
+
setAnchor(anchor) {
|
|
3038
|
+
this.anchor.set(anchor);
|
|
3125
3039
|
}
|
|
3126
|
-
|
|
3127
|
-
|
|
3040
|
+
setDisabled(disabled) {
|
|
3041
|
+
this.disabled.set(disabled);
|
|
3128
3042
|
}
|
|
3129
|
-
|
|
3130
|
-
this.
|
|
3043
|
+
setSelected(selected) {
|
|
3044
|
+
this.selected.set(selected);
|
|
3131
3045
|
}
|
|
3132
3046
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AbstractDbxAnchorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3133
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
3047
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: AbstractDbxAnchorDirective, inputs: { ref: { classPropertyName: "ref", publicName: "ref", isSignal: true, isRequired: false, transformFunction: null }, anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ref: "refChange", anchor: "anchorChange", disabled: "disabledChange", selected: "selectedChange" }, ngImport: i0 });
|
|
3134
3048
|
}
|
|
3135
3049
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AbstractDbxAnchorDirective, decorators: [{
|
|
3136
3050
|
type: Directive
|
|
3137
|
-
}]
|
|
3138
|
-
type: Input
|
|
3139
|
-
}], anchor: [{
|
|
3140
|
-
type: Input
|
|
3141
|
-
}], disabled: [{
|
|
3142
|
-
type: Input
|
|
3143
|
-
}], selected: [{
|
|
3144
|
-
type: Input
|
|
3145
|
-
}] } });
|
|
3051
|
+
}] });
|
|
3146
3052
|
|
|
3147
3053
|
function clickableUrlInNewTab(url) {
|
|
3148
3054
|
return {
|
|
@@ -4994,8 +4900,8 @@ class DbxInjectionInstance {
|
|
|
4994
4900
|
_content = new BehaviorSubject(undefined);
|
|
4995
4901
|
_componentRef = new BehaviorSubject(undefined);
|
|
4996
4902
|
_injector;
|
|
4997
|
-
config$ = this._config.pipe(maybeValueFromObservableOrValueGetter(), distinctUntilChanged());
|
|
4998
|
-
template$ = this._template.pipe(maybeValueFromObservableOrValueGetter(), distinctUntilChanged());
|
|
4903
|
+
config$ = this._config.pipe(maybeValueFromObservableOrValueGetter(), distinctUntilChanged(), shareReplay(1));
|
|
4904
|
+
template$ = this._template.pipe(maybeValueFromObservableOrValueGetter(), distinctUntilChanged(), shareReplay(1));
|
|
4999
4905
|
content$ = this._content.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
|
|
5000
4906
|
get config() {
|
|
5001
4907
|
return this._config.value;
|
|
@@ -5037,7 +4943,7 @@ class DbxInjectionInstance {
|
|
|
5037
4943
|
else {
|
|
5038
4944
|
return undefined;
|
|
5039
4945
|
}
|
|
5040
|
-
}),
|
|
4946
|
+
}), skipAllInitialMaybe());
|
|
5041
4947
|
this._subscriptionObject.subscription = combineLatest([configTemplateObs, this.content$]).subscribe(([inputConfig, content]) => {
|
|
5042
4948
|
const { config, template } = inputConfig ?? {};
|
|
5043
4949
|
this._reset(content);
|
|
@@ -5214,24 +5120,12 @@ class DbxInjectionContextDirective {
|
|
|
5214
5120
|
_currentPromise;
|
|
5215
5121
|
_embeddedView;
|
|
5216
5122
|
_isDetached = false;
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
this._isDetached = true;
|
|
5224
|
-
}
|
|
5225
|
-
}
|
|
5226
|
-
else if (this._isDetached) {
|
|
5227
|
-
reattach = true;
|
|
5228
|
-
}
|
|
5229
|
-
this._instance.config = config;
|
|
5230
|
-
if (reattach) {
|
|
5231
|
-
this._viewContainer.insert(this._embeddedView);
|
|
5232
|
-
this._isDetached = false;
|
|
5233
|
-
}
|
|
5234
|
-
}
|
|
5123
|
+
config = input();
|
|
5124
|
+
_configEffect = effect(() => {
|
|
5125
|
+
this.setConfig(this.config());
|
|
5126
|
+
// NOTE: we have/call setConfig() because the effect() may not respond to all value changes,
|
|
5127
|
+
// especially when setConfig() ends up being called twice quickly in quick succession.
|
|
5128
|
+
});
|
|
5235
5129
|
ngOnInit() {
|
|
5236
5130
|
this._instance.content = this._viewContainer;
|
|
5237
5131
|
this._instance.init();
|
|
@@ -5273,7 +5167,7 @@ class DbxInjectionContextDirective {
|
|
|
5273
5167
|
}
|
|
5274
5168
|
}
|
|
5275
5169
|
};
|
|
5276
|
-
this.
|
|
5170
|
+
this.setConfig(injectionConfig);
|
|
5277
5171
|
});
|
|
5278
5172
|
this._currentPromise = promiseRef;
|
|
5279
5173
|
// await the promise
|
|
@@ -5285,7 +5179,7 @@ class DbxInjectionContextDirective {
|
|
|
5285
5179
|
// if we're still using the same promiseRef
|
|
5286
5180
|
if (promiseRef && promiseRef === this._currentPromise) {
|
|
5287
5181
|
// clear the config to reshow the view
|
|
5288
|
-
this.
|
|
5182
|
+
this.setConfig(undefined);
|
|
5289
5183
|
// clear the current promise
|
|
5290
5184
|
this._currentPromise = undefined;
|
|
5291
5185
|
}
|
|
@@ -5303,15 +5197,33 @@ class DbxInjectionContextDirective {
|
|
|
5303
5197
|
// clear the current promise too
|
|
5304
5198
|
this._currentPromise = undefined;
|
|
5305
5199
|
// clear the config.
|
|
5306
|
-
this.
|
|
5200
|
+
this.setConfig(undefined);
|
|
5307
5201
|
// send a rejection signal to bail out.
|
|
5308
5202
|
promise.reject(new Error('dbxInjectionContext bailout'));
|
|
5309
5203
|
clearedValue = true;
|
|
5310
5204
|
}
|
|
5311
5205
|
return clearedValue;
|
|
5312
5206
|
}
|
|
5207
|
+
setConfig(config) {
|
|
5208
|
+
let reattach = false;
|
|
5209
|
+
if (config) {
|
|
5210
|
+
if (!this._isDetached) {
|
|
5211
|
+
// detach the original view before setting config.
|
|
5212
|
+
this._viewContainer.detach();
|
|
5213
|
+
this._isDetached = true;
|
|
5214
|
+
}
|
|
5215
|
+
}
|
|
5216
|
+
else if (this._isDetached) {
|
|
5217
|
+
reattach = true;
|
|
5218
|
+
}
|
|
5219
|
+
this._instance.config = config;
|
|
5220
|
+
if (reattach) {
|
|
5221
|
+
this._viewContainer.insert(this._embeddedView);
|
|
5222
|
+
this._isDetached = false;
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5313
5225
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxInjectionContextDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
5314
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
5226
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: DbxInjectionContextDirective, isStandalone: true, selector: "[dbxInjectionContext]", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, providers: provideDbxInjectionContext(DbxInjectionContextDirective), ngImport: i0 });
|
|
5315
5227
|
}
|
|
5316
5228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxInjectionContextDirective, decorators: [{
|
|
5317
5229
|
type: Directive,
|
|
@@ -5320,9 +5232,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
5320
5232
|
providers: provideDbxInjectionContext(DbxInjectionContextDirective),
|
|
5321
5233
|
standalone: true
|
|
5322
5234
|
}]
|
|
5323
|
-
}]
|
|
5324
|
-
type: Input
|
|
5325
|
-
}] } });
|
|
5235
|
+
}] });
|
|
5326
5236
|
|
|
5327
5237
|
const importsAndExports = [DbxInjectionComponent, DbxInjectionArrayComponent, DbxInjectionContextDirective];
|
|
5328
5238
|
/**
|