@coolon/angular-ui-powerups 16.1.0-alpha.232 → 16.1.0-alpha.234
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/interaction/components/activity-container/activity-container.component.mjs +19 -5
- package/esm2022/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.mjs +7 -1
- package/esm2022/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.mjs +38 -3
- package/esm2022/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.mjs +10 -10
- package/fesm2022/coolon-angular-ui-powerups.mjs +119 -65
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +4 -2
- package/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.d.ts +15 -1
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|
|
41
41
|
import * as i4$2 from 'ng-table-virtual-scroll';
|
|
42
42
|
import { TableVirtualScrollDataSource, TableVirtualScrollModule } from 'ng-table-virtual-scroll';
|
|
43
43
|
import * as i1$3 from '@coolon/pectin';
|
|
44
|
-
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, proxify, ValueModel, Proxify, Logger, StoreInValueModel, Command, MutableListModel, StoreInListModel, ListModel, Disposable, Trace, DelegatingListModel, MutableValueModel, DelegateToValueModel, FocusManager, EventListenerList, Guard, DelegatingFormListModel, Binding, DebugContext, DelegateToListModel, DelegatingFormValueModel, Functions, PageController, SelectionModel, CanProxy, MultipleSelectionModel, WatchList, ProxyRegistry, DependsOnOptions, LoadingStateTracker, DelegatingCommand, ComputedListModel, ReducingValueModel, AndValueModel,
|
|
44
|
+
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, proxify, ValueModel, Proxify, Logger, StoreInValueModel, Command, MutableListModel, StoreInListModel, ListModel, Disposable, Trace, DelegatingListModel, MutableValueModel, DelegateToValueModel, FocusManager, EventListenerList, Guard, DelegatingFormListModel, Binding, DebugContext, DelegateToListModel, DelegatingFormValueModel, Functions, PageController, SelectionModel, CanProxy, MultipleSelectionModel, WatchList, ProxyRegistry, DependsOnOptions, LoadingStateTracker, DelegatingCommand, ComputedListModel, Deferred, ReducingValueModel, AndValueModel, DirtyTrackingForm } from '@coolon/pectin';
|
|
45
45
|
import { __decorate, __metadata, __param } from 'tslib';
|
|
46
46
|
import * as i1 from '@angular/platform-browser';
|
|
47
47
|
import escapeStringRegexp from 'escape-string-regexp';
|
|
@@ -8260,6 +8260,93 @@ class WaitUntilLeavingInteractionTransitionCancelled extends EventCleanUpSession
|
|
|
8260
8260
|
}
|
|
8261
8261
|
}
|
|
8262
8262
|
|
|
8263
|
+
/**
|
|
8264
|
+
* How long to wait for the popstate triggered by location.back() before assuming it was silently
|
|
8265
|
+
* dropped and self-healing with an imperative replaceUrl navigation. A real popstate is dispatched
|
|
8266
|
+
* on the next frame, so this only needs to outlast that; it is the longest the modal backdrop can
|
|
8267
|
+
* remain stranded in the broken-browser case before we recover.
|
|
8268
|
+
*/
|
|
8269
|
+
const SELF_HEAL_AFTER_MS = 250;
|
|
8270
|
+
/**
|
|
8271
|
+
* This session tracks the process of removing the last interaction context from the URL and provides a promise
|
|
8272
|
+
* the resolves when the process and completed. This case is special as the process involves a regular routing cycle
|
|
8273
|
+
* followed by a call to location.back(). The later triggers a url change with no other routing events. So this
|
|
8274
|
+
* class tracks when the first routing cycle finishes and then waits for the subsequent lone url change event.
|
|
8275
|
+
*
|
|
8276
|
+
* location.back() is preferred because it pops the history entry that opening the interaction pushed, so the
|
|
8277
|
+
* browser back button closes the interaction in a single click. But a programmatic back() can be silently dropped
|
|
8278
|
+
* — producing no popstate — by some browser/extension combinations (observed: Chrome 149 with 1Password active on
|
|
8279
|
+
* a form field). When that happens this session would otherwise never receive its popstate, never finish, and stay
|
|
8280
|
+
* in progress forever — stranding the modal backdrop and blocking every subsequent navigation. So we arm a watchdog:
|
|
8281
|
+
* if no popstate arrives, we self-heal with an imperative replaceUrl navigation to the interaction-free url. That
|
|
8282
|
+
* leaves the url clean and unblocks the router; the only cost in the broken browser is that back doesn't pop the
|
|
8283
|
+
* pushed entry, so it takes one extra click — unavoidable, since we can't pop history when back() is dropped.
|
|
8284
|
+
*/
|
|
8285
|
+
class RemoveLastInteractionFromUrlNavigationSession extends NavigationSession {
|
|
8286
|
+
interactionFreeUrl;
|
|
8287
|
+
isPopState = true;
|
|
8288
|
+
debugPropertyKeys = ['startingUrl', 'poppedHistoryUrl'];
|
|
8289
|
+
finished;
|
|
8290
|
+
gotPopState;
|
|
8291
|
+
selfHealing = false;
|
|
8292
|
+
constructor(context, startingUrl, interactionFreeUrl) {
|
|
8293
|
+
super(context, startingUrl);
|
|
8294
|
+
this.interactionFreeUrl = interactionFreeUrl;
|
|
8295
|
+
this.finished = Deferred.defer();
|
|
8296
|
+
}
|
|
8297
|
+
get isInteractionSync() {
|
|
8298
|
+
return true;
|
|
8299
|
+
}
|
|
8300
|
+
notifyActive() {
|
|
8301
|
+
// location.back() has already been (or is about to be) called by the time we're active. Arm the
|
|
8302
|
+
// watchdog so that if its popstate never arrives we recover instead of wedging the router forever.
|
|
8303
|
+
const handle = setTimeout(() => this.selfHealIfBackWasDropped(), SELF_HEAL_AFTER_MS);
|
|
8304
|
+
this.onDispose(() => clearTimeout(handle));
|
|
8305
|
+
}
|
|
8306
|
+
// @Trace()
|
|
8307
|
+
onPopState(event) {
|
|
8308
|
+
this.gotPopState = true;
|
|
8309
|
+
}
|
|
8310
|
+
// @Trace()
|
|
8311
|
+
onRouterStarted(event) {
|
|
8312
|
+
this.ignore(event);
|
|
8313
|
+
}
|
|
8314
|
+
// @Trace()
|
|
8315
|
+
onRouterCancelled(event) {
|
|
8316
|
+
this.ignore(event);
|
|
8317
|
+
}
|
|
8318
|
+
// @Trace()
|
|
8319
|
+
// override onUrlChange(url: string) {
|
|
8320
|
+
// }
|
|
8321
|
+
selfHealIfBackWasDropped() {
|
|
8322
|
+
if (this.isDisposed() || this.gotPopState) {
|
|
8323
|
+
// back() landed normally (popstate seen, session finishing/finished) — nothing to heal.
|
|
8324
|
+
return;
|
|
8325
|
+
}
|
|
8326
|
+
// back() was dropped: clean the url imperatively so we don't strand the backdrop or wedge the router.
|
|
8327
|
+
// onRouterEnd will finish us up once this navigation completes.
|
|
8328
|
+
this.selfHealing = true;
|
|
8329
|
+
this.context.navigateByUrl(this.interactionFreeUrl, { replaceUrl: true });
|
|
8330
|
+
}
|
|
8331
|
+
finishUp() {
|
|
8332
|
+
this.context.finishRoutingSession();
|
|
8333
|
+
this.finished.resolve(true);
|
|
8334
|
+
}
|
|
8335
|
+
// @Trace()
|
|
8336
|
+
onRouterEnd(event) {
|
|
8337
|
+
if (this.gotPopState || this.selfHealing) {
|
|
8338
|
+
this.finishUp();
|
|
8339
|
+
}
|
|
8340
|
+
}
|
|
8341
|
+
// @Trace()
|
|
8342
|
+
handleCanDeactivateCancelledEventScenario(locationTriggerUrl) {
|
|
8343
|
+
lang.illegalState('onCanDeactivateInteractionCancelled not supported for activity context synchronisation since we should never leave a place');
|
|
8344
|
+
}
|
|
8345
|
+
get finishedPromise() {
|
|
8346
|
+
return this.finished.promise;
|
|
8347
|
+
}
|
|
8348
|
+
}
|
|
8349
|
+
|
|
8263
8350
|
class SynchroniseInteractionContextIdsWithRoute extends NavigationSession {
|
|
8264
8351
|
wasTriggeredByPopState;
|
|
8265
8352
|
isPopState = false;
|
|
@@ -8322,15 +8409,14 @@ class SynchroniseInteractionContextIdsWithRoute extends NavigationSession {
|
|
|
8322
8409
|
// noop. Our url will be back to the non interaction version now so we dont' need to do anything.
|
|
8323
8410
|
}
|
|
8324
8411
|
else {
|
|
8325
|
-
//
|
|
8326
|
-
//
|
|
8327
|
-
//
|
|
8328
|
-
//
|
|
8329
|
-
// back()
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
this.context.navigateByUrl(urlSnapshot, { replaceUrl: true });
|
|
8412
|
+
// Pop our interaction id's from the browser history. We use location.back() (not an imperative
|
|
8413
|
+
// replaceUrl) so the history entry that opening the interaction pushed is actually removed —
|
|
8414
|
+
// that keeps the browser back button a clean one-click close. RemoveLastInteractionFromUrl...
|
|
8415
|
+
// self-heals to a replaceUrl if the back() is silently dropped (Chrome 149 + 1Password), so a
|
|
8416
|
+
// dropped back() can no longer strand the backdrop or wedge the router. See that session's docs.
|
|
8417
|
+
const session = new RemoveLastInteractionFromUrlNavigationSession(this.context, this.urlService.getCurrentRouterUrl(), urlSnapshot);
|
|
8418
|
+
this.context.transitionTo(session);
|
|
8419
|
+
this.urlService.back();
|
|
8334
8420
|
}
|
|
8335
8421
|
}
|
|
8336
8422
|
else {
|
|
@@ -10037,6 +10123,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
10037
10123
|
|
|
10038
10124
|
class ActivityContainerComponent extends AbstractInteractionContext {
|
|
10039
10125
|
placeRouter;
|
|
10126
|
+
elementRef;
|
|
10040
10127
|
dynamicHeight = false;
|
|
10041
10128
|
tabs;
|
|
10042
10129
|
activityOutlets;
|
|
@@ -10060,9 +10147,10 @@ class ActivityContainerComponent extends AbstractInteractionContext {
|
|
|
10060
10147
|
syncTabsJob = undefined;
|
|
10061
10148
|
stable$;
|
|
10062
10149
|
wasActive = false;
|
|
10063
|
-
constructor(placeRouter) {
|
|
10150
|
+
constructor(placeRouter, elementRef) {
|
|
10064
10151
|
super();
|
|
10065
10152
|
this.placeRouter = placeRouter;
|
|
10153
|
+
this.elementRef = elementRef;
|
|
10066
10154
|
const { chain, valueOf, when } = Dsl.disposeWith(this);
|
|
10067
10155
|
when(this.ready$).becomesTruthy(() => this.finaliseActivityStates());
|
|
10068
10156
|
this.stable$ = valueOf.all(this.ready$, this._started$, chain(this.animating$).isFalsey()).areTruthy();
|
|
@@ -10265,6 +10353,12 @@ class ActivityContainerComponent extends AbstractInteractionContext {
|
|
|
10265
10353
|
const activityRef = this.activityRefs[newIndex];
|
|
10266
10354
|
activityRef.setFocused(false);
|
|
10267
10355
|
this.busy.setDelegate(activityRef.activityBusy);
|
|
10356
|
+
// Move focus off the outgoing tab before the switch. MatTabGroup sets aria-hidden="true" on the
|
|
10357
|
+
// now-inactive tab body; if the element that triggered the transition (e.g. the "Next" or "Done"
|
|
10358
|
+
// button) still has focus inside it, Chrome warns ("Blocked aria-hidden ... descendant retained
|
|
10359
|
+
// focus"). The incoming tab's cdkTrapFocusAutoCapture re-establishes focus, but only after an
|
|
10360
|
+
// async gap. Scoped to our own host so we never blur something outside the dialog.
|
|
10361
|
+
this.blurFocusWithinContainer();
|
|
10268
10362
|
this.tabs.selectedIndex = newIndex;
|
|
10269
10363
|
// if (this.ready$.value) {
|
|
10270
10364
|
// // Note: We're not using the animation done event as it's firing almost immeadiately.
|
|
@@ -10272,6 +10366,12 @@ class ActivityContainerComponent extends AbstractInteractionContext {
|
|
|
10272
10366
|
// }
|
|
10273
10367
|
}
|
|
10274
10368
|
}
|
|
10369
|
+
blurFocusWithinContainer() {
|
|
10370
|
+
const active = (typeof document === 'undefined' ? null : document.activeElement);
|
|
10371
|
+
if (active && active !== document.body && this.elementRef.nativeElement.contains(active)) {
|
|
10372
|
+
active.blur();
|
|
10373
|
+
}
|
|
10374
|
+
}
|
|
10275
10375
|
finaliseActivityStates() {
|
|
10276
10376
|
this._animating$.value = false;
|
|
10277
10377
|
this.activityRefs = this.activityRefs.filter(tab => !tab.isComplete());
|
|
@@ -10318,7 +10418,7 @@ class ActivityContainerComponent extends AbstractInteractionContext {
|
|
|
10318
10418
|
this._started$.value = true;
|
|
10319
10419
|
this.finaliseActivityStates();
|
|
10320
10420
|
}
|
|
10321
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: ActivityContainerComponent, deps: [{ token: PlaceRouter }], target: i0.ɵɵFactoryTarget.Component });
|
|
10421
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: ActivityContainerComponent, deps: [{ token: PlaceRouter }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
10322
10422
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: ActivityContainerComponent, selector: "aup-activity-container", inputs: { dynamicHeight: "dynamicHeight", animationDuration: "animationDuration" }, providers: [
|
|
10323
10423
|
{ provide: INTERACTION_CONTEXT, useClass: ActivityContainerComponent },
|
|
10324
10424
|
], viewQueries: [{ propertyName: "tabs", first: true, predicate: ["tabs"], descendants: true, static: true }, { propertyName: "activityOutlets", predicate: ActivityOutletComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\"\n [animationDuration]=\"getTabAnimationDuration()\"\n (animationDone)=\"onAnimationDone()\"\n>\n <mat-tab *ngFor=\"let activityRef of activityRefs; let i = index; trackBy: activityIndex\">\n <aup-busy-overlay [busy$]=\"busy\" cdkTrapFocus cdkTrapFocusAutoCapture>\n <!--\n We have issues where angular is triggering a leave animation when an\n new activity is started, but is not running the enter animation\n when it is scrolled back into view. So we track the tab changes and\n disable all animations inside the tab while we're animating.\n -->\n <div class=\"activity-outlet-wrapper\" [@.disabled]=\"!activityRef.focused\">\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"activityRef\"></aup-activity-outlet>\n </div>\n </aup-busy-overlay>\n </mat-tab>\n</mat-tab-group>\n", styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}aup-busy-overlay{flex:1}.activity-outlet-wrapper{flex:1}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i3$3.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i3$3.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }, { kind: "component", type: BusyOverlayComponent, selector: "aup-busy-overlay", inputs: ["busy$", "busy"] }, { kind: "directive", type: i5$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: ActivityOutletComponent, selector: "aup-activity-outlet", inputs: ["nestedInteractionContext", "activityRef"] }] });
|
|
@@ -10334,7 +10434,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
10334
10434
|
args: [{ selector: "aup-activity-container", providers: [
|
|
10335
10435
|
{ provide: INTERACTION_CONTEXT, useClass: ActivityContainerComponent },
|
|
10336
10436
|
], template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\"\n [animationDuration]=\"getTabAnimationDuration()\"\n (animationDone)=\"onAnimationDone()\"\n>\n <mat-tab *ngFor=\"let activityRef of activityRefs; let i = index; trackBy: activityIndex\">\n <aup-busy-overlay [busy$]=\"busy\" cdkTrapFocus cdkTrapFocusAutoCapture>\n <!--\n We have issues where angular is triggering a leave animation when an\n new activity is started, but is not running the enter animation\n when it is scrolled back into view. So we track the tab changes and\n disable all animations inside the tab while we're animating.\n -->\n <div class=\"activity-outlet-wrapper\" [@.disabled]=\"!activityRef.focused\">\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"activityRef\"></aup-activity-outlet>\n </div>\n </aup-busy-overlay>\n </mat-tab>\n</mat-tab-group>\n", styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}aup-busy-overlay{flex:1}.activity-outlet-wrapper{flex:1}\n"] }]
|
|
10337
|
-
}], ctorParameters: function () { return [{ type: PlaceRouter }]; }, propDecorators: { dynamicHeight: [{
|
|
10437
|
+
}], ctorParameters: function () { return [{ type: PlaceRouter }, { type: i0.ElementRef }]; }, propDecorators: { dynamicHeight: [{
|
|
10338
10438
|
type: Input
|
|
10339
10439
|
}], tabs: [{
|
|
10340
10440
|
type: ViewChild,
|
|
@@ -12834,6 +12934,12 @@ class DialogInteractionContextFactory extends ModalInteractionContextFactory {
|
|
|
12834
12934
|
autoFocus: false,
|
|
12835
12935
|
hasBackdrop: true,
|
|
12836
12936
|
closeOnNavigation: false,
|
|
12937
|
+
// Don't return focus to the opening trigger on close: CDK still has aria-hidden="true" on the
|
|
12938
|
+
// background root (frontend-root) at that point, and Chrome blocks/warns when focus lands inside
|
|
12939
|
+
// an aria-hidden subtree ("Blocked aria-hidden on an element because its descendant retained
|
|
12940
|
+
// focus"). CDK 16 has no inert background-hide option, so suppressing the restore is the clean
|
|
12941
|
+
// fix. (Benign warning only — unrelated to the alpha.233 stuck-backdrop fix.)
|
|
12942
|
+
restoreFocus: false,
|
|
12837
12943
|
...this.matDialogDefaultConfig,
|
|
12838
12944
|
...this.dialogServiceDefaults
|
|
12839
12945
|
};
|
|
@@ -13109,58 +13215,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
13109
13215
|
args: [{ providedIn: 'root' }]
|
|
13110
13216
|
}], ctorParameters: function () { return [{ type: i1$5.Router }, { type: UrlService }, { type: PlaceRouter }, { type: PlaceHistory }, { type: InteractionService }, { type: i0.Injector }]; } });
|
|
13111
13217
|
|
|
13112
|
-
/**
|
|
13113
|
-
* This session tracks the process of removing the last interaction context from the URL and provides a promise
|
|
13114
|
-
* the resolves when the process and completed. This case is special as the process involves a regular routing cycle
|
|
13115
|
-
* followed by a call to location.back(). The later triggers a url change with no other routing events. So this
|
|
13116
|
-
* class tracks when the first routing cycle finishes and then waits for the subsequent lone url change event.
|
|
13117
|
-
*/
|
|
13118
|
-
class RemoveLastInteractionFromUrlNavigationSession extends NavigationSession {
|
|
13119
|
-
isPopState = true;
|
|
13120
|
-
debugPropertyKeys = ['startingUrl', 'poppedHistoryUrl'];
|
|
13121
|
-
finished;
|
|
13122
|
-
gotPopState;
|
|
13123
|
-
constructor(context, startingUrl) {
|
|
13124
|
-
super(context, startingUrl);
|
|
13125
|
-
this.finished = Deferred.defer();
|
|
13126
|
-
}
|
|
13127
|
-
get isInteractionSync() {
|
|
13128
|
-
return true;
|
|
13129
|
-
}
|
|
13130
|
-
// @Trace()
|
|
13131
|
-
onPopState(event) {
|
|
13132
|
-
this.gotPopState = true;
|
|
13133
|
-
}
|
|
13134
|
-
// @Trace()
|
|
13135
|
-
onRouterStarted(event) {
|
|
13136
|
-
this.ignore(event);
|
|
13137
|
-
}
|
|
13138
|
-
// @Trace()
|
|
13139
|
-
onRouterCancelled(event) {
|
|
13140
|
-
this.ignore(event);
|
|
13141
|
-
}
|
|
13142
|
-
// @Trace()
|
|
13143
|
-
// override onUrlChange(url: string) {
|
|
13144
|
-
// }
|
|
13145
|
-
finishUp() {
|
|
13146
|
-
this.context.finishRoutingSession();
|
|
13147
|
-
this.finished.resolve(true);
|
|
13148
|
-
}
|
|
13149
|
-
// @Trace()
|
|
13150
|
-
onRouterEnd(event) {
|
|
13151
|
-
if (this.gotPopState) {
|
|
13152
|
-
this.finishUp();
|
|
13153
|
-
}
|
|
13154
|
-
}
|
|
13155
|
-
// @Trace()
|
|
13156
|
-
handleCanDeactivateCancelledEventScenario(locationTriggerUrl) {
|
|
13157
|
-
lang.illegalState('onCanDeactivateInteractionCancelled not supported for activity context synchronisation since we should never leave a place');
|
|
13158
|
-
}
|
|
13159
|
-
get finishedPromise() {
|
|
13160
|
-
return this.finished.promise;
|
|
13161
|
-
}
|
|
13162
|
-
}
|
|
13163
|
-
|
|
13164
13218
|
var Formatter;
|
|
13165
13219
|
(function (Formatter) {
|
|
13166
13220
|
class StringType {
|