@coolon/angular-ui-powerups 0.0.98 → 0.0.101
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/bundles/coolon-angular-ui-powerups.umd.js +1351 -1109
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.d.ts +19 -19
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +19 -19
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +19 -5
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +13 -3
- package/esm2015/lib/interaction/index.js +5 -4
- package/esm2015/lib/interaction/interaction-context.js +7 -53
- package/esm2015/lib/interaction/interaction.module.js +3 -3
- package/esm2015/lib/interaction/services/interaction.service.js +228 -0
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +62 -0
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +145 -0
- package/esm2015/lib/interaction/services/modal-interaction-context.factory.js +17 -0
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +3 -3
- package/esm2015/lib/place/guards/abstract-place.guard.js +13 -12
- package/esm2015/lib/place/guards/interaction.guard.js +27 -19
- package/esm2015/lib/place/guards/navigation-state.js +309 -246
- package/esm2015/lib/place/place-router.js +160 -115
- package/esm2015/lib/place/url-snapshot.js +91 -19
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +19 -19
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +23 -14
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +10 -3
- package/esm5/lib/interaction/index.js +5 -4
- package/esm5/lib/interaction/interaction-context.js +8 -61
- package/esm5/lib/interaction/interaction.module.js +3 -3
- package/esm5/lib/interaction/services/interaction.service.js +271 -0
- package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +65 -0
- package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +170 -0
- package/esm5/lib/interaction/services/modal-interaction-context.factory.js +27 -0
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +3 -3
- package/esm5/lib/place/guards/abstract-place.guard.js +15 -14
- package/esm5/lib/place/guards/interaction.guard.js +25 -17
- package/esm5/lib/place/guards/navigation-state.js +422 -292
- package/esm5/lib/place/place-router.js +182 -133
- package/esm5/lib/place/url-snapshot.js +105 -21
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +1112 -918
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +1302 -1060
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +1 -0
- package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +3 -1
- package/lib/interaction/index.d.ts +4 -3
- package/lib/interaction/interaction-context.d.ts +2 -11
- package/lib/interaction/services/interaction.service.d.ts +46 -0
- package/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.d.ts +15 -0
- package/lib/interaction/services/{dialog-interaction-context.d.ts → mat-dialog-interaction/dialog-interaction-context.d.ts} +2 -2
- package/lib/interaction/services/modal-interaction-context.factory.d.ts +4 -0
- package/lib/place/guards/abstract-place.guard.d.ts +1 -1
- package/lib/place/guards/interaction.guard.d.ts +3 -3
- package/lib/place/guards/navigation-state.d.ts +65 -37
- package/lib/place/place-router.d.ts +15 -22
- package/lib/place/url-snapshot.d.ts +18 -6
- package/package.json +1 -1
- package/schematics/place-routes/templates/place-routes.ts.template +3 -3
- package/styles/styles.scss +1 -1
- package/esm2015/lib/interaction/services/dialog-interaction-context.js +0 -163
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +0 -151
- package/esm2015/lib/interaction/services/modal-interaction.service.js +0 -109
- package/esm5/lib/interaction/services/dialog-interaction-context.js +0 -188
- package/esm5/lib/interaction/services/dialog-interaction.service.js +0 -179
- package/esm5/lib/interaction/services/modal-interaction.service.js +0 -153
- package/lib/interaction/services/dialog-interaction.service.d.ts +0 -24
- package/lib/interaction/services/modal-interaction.service.d.ts +0 -15
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { DOCUMENT, CommonModule, Location } from '@angular/common';
|
|
2
2
|
import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, Optional, SkipSelf, HostBinding, INJECTOR } from '@angular/core';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
|
-
import { MatInputModule, MatFormFieldModule, MatSelectModule,
|
|
4
|
+
import { MatInputModule, MatFormFieldModule, MatSelectModule, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule, MatDialog } from '@angular/material';
|
|
5
5
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
6
6
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
|
-
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel,
|
|
7
|
+
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, Binding, Trace, Guard, StoreInValueModel, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
8
8
|
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
|
-
import { RouterModule,
|
|
10
|
+
import { RouterModule, UrlSegment, UrlSegmentGroup, NavigationStart, NavigationEnd, NavigationError, NavigationCancel, Router, UrlSerializer, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
11
11
|
import ___default, { last, isNil, isEqual } from 'lodash';
|
|
12
12
|
import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
|
|
13
|
-
import { MatDialogConfig, MatDialog as MatDialog$1, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
|
|
14
13
|
import { MatIconModule } from '@angular/material/icon';
|
|
15
14
|
import { MatListModule } from '@angular/material/list';
|
|
16
15
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
@@ -19,6 +18,7 @@ import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator';
|
|
|
19
18
|
import 'reflect-metadata';
|
|
20
19
|
import { style, query, group, animate, trigger, transition } from '@angular/animations';
|
|
21
20
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
21
|
+
import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
22
22
|
import { Observable } from 'rxjs';
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -896,10 +896,6 @@ if (false) {
|
|
|
896
896
|
* @abstract
|
|
897
897
|
*/
|
|
898
898
|
class InteractionContext extends GarbageCollector {
|
|
899
|
-
constructor() {
|
|
900
|
-
super(...arguments);
|
|
901
|
-
this.activityListeners = new EventListenerList();
|
|
902
|
-
}
|
|
903
899
|
/**
|
|
904
900
|
* Returns true if an activity is currently running.
|
|
905
901
|
* @return {?}
|
|
@@ -908,41 +904,16 @@ class InteractionContext extends GarbageCollector {
|
|
|
908
904
|
return this.active.value;
|
|
909
905
|
}
|
|
910
906
|
/**
|
|
911
|
-
* @param {?} listener
|
|
912
|
-
* @return {?}
|
|
913
|
-
*/
|
|
914
|
-
addActivityListener(listener) {
|
|
915
|
-
return this.activityListeners.add(listener);
|
|
916
|
-
}
|
|
917
|
-
/**
|
|
918
|
-
* @protected
|
|
919
|
-
* @return {?}
|
|
920
|
-
*/
|
|
921
|
-
notifyActivityStarted() {
|
|
922
|
-
this.activityListeners.fire((/**
|
|
923
|
-
* @param {?} l
|
|
924
|
-
* @return {?}
|
|
925
|
-
*/
|
|
926
|
-
l => l.onActivityStarted()));
|
|
927
|
-
}
|
|
928
|
-
/**
|
|
929
|
-
* @protected
|
|
930
907
|
* @return {?}
|
|
931
908
|
*/
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
l => l.onActivityFinished()));
|
|
909
|
+
dispose() {
|
|
910
|
+
// TODO: think about auto cancelling any outstanding activity on dispose.
|
|
911
|
+
// See NavigationState.Navigating for a use-case.
|
|
912
|
+
assert.isFalsey(this.isActive());
|
|
913
|
+
super.dispose();
|
|
938
914
|
}
|
|
939
915
|
}
|
|
940
916
|
if (false) {
|
|
941
|
-
/**
|
|
942
|
-
* @type {?}
|
|
943
|
-
* @private
|
|
944
|
-
*/
|
|
945
|
-
InteractionContext.prototype.activityListeners;
|
|
946
917
|
/** @type {?} */
|
|
947
918
|
InteractionContext.prototype.activityList;
|
|
948
919
|
/** @type {?} */
|
|
@@ -991,23 +962,6 @@ if (false) {
|
|
|
991
962
|
*/
|
|
992
963
|
InteractionContext.prototype.confirmThen = function (confirm, activityType, data) { };
|
|
993
964
|
}
|
|
994
|
-
(function (InteractionContext) {
|
|
995
|
-
/**
|
|
996
|
-
* @record
|
|
997
|
-
*/
|
|
998
|
-
function Listener() { }
|
|
999
|
-
InteractionContext.Listener = Listener;
|
|
1000
|
-
if (false) {
|
|
1001
|
-
/**
|
|
1002
|
-
* @return {?}
|
|
1003
|
-
*/
|
|
1004
|
-
Listener.prototype.onActivityStarted = function () { };
|
|
1005
|
-
/**
|
|
1006
|
-
* @return {?}
|
|
1007
|
-
*/
|
|
1008
|
-
Listener.prototype.onActivityFinished = function () { };
|
|
1009
|
-
}
|
|
1010
|
-
})(InteractionContext || (InteractionContext = {}));
|
|
1011
965
|
|
|
1012
966
|
/**
|
|
1013
967
|
* @fileoverview added by tsickle
|
|
@@ -1480,6 +1434,12 @@ class TabContext {
|
|
|
1480
1434
|
this._complete = true;
|
|
1481
1435
|
this.activityCallbacks.onCancel(error);
|
|
1482
1436
|
}
|
|
1437
|
+
/**
|
|
1438
|
+
* @return {?}
|
|
1439
|
+
*/
|
|
1440
|
+
dispose() {
|
|
1441
|
+
this.component.dispose();
|
|
1442
|
+
}
|
|
1483
1443
|
}
|
|
1484
1444
|
if (false) {
|
|
1485
1445
|
/**
|
|
@@ -1562,9 +1522,6 @@ class ActivityContainerComponent extends InteractionContextBase {
|
|
|
1562
1522
|
get initialActivityOutletContext() {
|
|
1563
1523
|
return this._initialActivityOutletContext.value;
|
|
1564
1524
|
}
|
|
1565
|
-
// get isFinished() {
|
|
1566
|
-
// return !this._initialActivityOutletContext;
|
|
1567
|
-
// }
|
|
1568
1525
|
/**
|
|
1569
1526
|
* @return {?}
|
|
1570
1527
|
*/
|
|
@@ -1651,12 +1608,23 @@ class ActivityContainerComponent extends InteractionContextBase {
|
|
|
1651
1608
|
*/
|
|
1652
1609
|
cleanupStaleNestedActivities() {
|
|
1653
1610
|
if (this.tabs.selectedIndex < this.activityTabs.length - 1) {
|
|
1611
|
+
/** @type {?} */
|
|
1612
|
+
const tabs = this.activityTabs.value;
|
|
1613
|
+
/** @type {?} */
|
|
1614
|
+
const remainingActivities = tabs.slice(0, 1 + this.tabs.selectedIndex);
|
|
1615
|
+
/** @type {?} */
|
|
1616
|
+
const finishedActivityTabs = tabs.slice(1 + this.tabs.selectedIndex);
|
|
1617
|
+
finishedActivityTabs.forEach((/**
|
|
1618
|
+
* @param {?} a
|
|
1619
|
+
* @return {?}
|
|
1620
|
+
*/
|
|
1621
|
+
a => a.dispose()));
|
|
1654
1622
|
this.activityTabs.runInTransaction((/**
|
|
1655
1623
|
* @param {?} draft
|
|
1656
1624
|
* @return {?}
|
|
1657
1625
|
*/
|
|
1658
1626
|
draft => {
|
|
1659
|
-
draft.value =
|
|
1627
|
+
draft.value = remainingActivities;
|
|
1660
1628
|
}));
|
|
1661
1629
|
}
|
|
1662
1630
|
}
|
|
@@ -1757,6 +1725,244 @@ if (false) {
|
|
|
1757
1725
|
ActivityContainerComponent.prototype._activityList;
|
|
1758
1726
|
}
|
|
1759
1727
|
|
|
1728
|
+
/**
|
|
1729
|
+
* @fileoverview added by tsickle
|
|
1730
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1731
|
+
*/
|
|
1732
|
+
/**
|
|
1733
|
+
* @abstract
|
|
1734
|
+
*/
|
|
1735
|
+
class ModalInteractionContextFactory {
|
|
1736
|
+
}
|
|
1737
|
+
if (false) {
|
|
1738
|
+
/**
|
|
1739
|
+
* @abstract
|
|
1740
|
+
* @return {?}
|
|
1741
|
+
*/
|
|
1742
|
+
ModalInteractionContextFactory.prototype.createInteractionContext = function () { };
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* @fileoverview added by tsickle
|
|
1747
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1748
|
+
*/
|
|
1749
|
+
/** @type {?} */
|
|
1750
|
+
let inplaceMonitorCount = 0;
|
|
1751
|
+
class InteractionService {
|
|
1752
|
+
/**
|
|
1753
|
+
* @param {?} modelInteractionContextFactory
|
|
1754
|
+
*/
|
|
1755
|
+
constructor(modelInteractionContextFactory) {
|
|
1756
|
+
this.modelInteractionContextFactory = modelInteractionContextFactory;
|
|
1757
|
+
this.garbage = new GarbageCollector();
|
|
1758
|
+
this.exclusiveContext = new MutableValueModel();
|
|
1759
|
+
this._activeModalInteractionContextModel = new MutableValueModel();
|
|
1760
|
+
this._activeInlineInteractionContextModel = new MutableValueModel();
|
|
1761
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this.garbage);
|
|
1762
|
+
this._activeInteractionContext = chain(this._activeModalInteractionContextModel)
|
|
1763
|
+
.otherwise(this._activeInlineInteractionContextModel)
|
|
1764
|
+
.pluck('interactionContext');
|
|
1765
|
+
this.active = chain(this._activeInteractionContext).isNotNil();
|
|
1766
|
+
this.modelInteractionActive = chain(this._activeModalInteractionContextModel).isNotNil();
|
|
1767
|
+
this.inlineInteractionActive = chain(this._activeInlineInteractionContextModel).isNotNil();
|
|
1768
|
+
// TODO: chain.concat(listOrValueModels) would be nice.
|
|
1769
|
+
this.activeInteractionContextIds = chain(new MutableListModel())
|
|
1770
|
+
.append(this._activeInlineInteractionContextModel)
|
|
1771
|
+
.append(this._activeModalInteractionContextModel)
|
|
1772
|
+
.rejectNil()
|
|
1773
|
+
.pluck('id');
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* @return {?}
|
|
1777
|
+
*/
|
|
1778
|
+
isActive() {
|
|
1779
|
+
return this.active.value;
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* @param {?} disposable
|
|
1783
|
+
* @return {?}
|
|
1784
|
+
*/
|
|
1785
|
+
createModalInteractionContextFor(disposable) {
|
|
1786
|
+
/** @type {?} */
|
|
1787
|
+
const context = this.modelInteractionContextFactory.createInteractionContext();
|
|
1788
|
+
disposable.registerDisposable(new InteractionService.Monitor('modal', context, this._activeModalInteractionContextModel, this.exclusiveContext));
|
|
1789
|
+
return context;
|
|
1790
|
+
}
|
|
1791
|
+
/**
|
|
1792
|
+
* @param {?} interactionContext
|
|
1793
|
+
* @return {?}
|
|
1794
|
+
*/
|
|
1795
|
+
_registerInplaceInteractionContext(interactionContext) {
|
|
1796
|
+
interactionContext.registerDisposable(new InteractionService.Monitor(`ip${++inplaceMonitorCount}`, interactionContext, this._activeInlineInteractionContextModel, this.exclusiveContext));
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* @return {?}
|
|
1800
|
+
*/
|
|
1801
|
+
getCurrentActivity() {
|
|
1802
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1803
|
+
assert$1.isTruthy(this.isActive());
|
|
1804
|
+
return this._activeInteractionContext.value.getCurrentActivity();
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Creates an interaction context that will prevent any other contexts from starting an
|
|
1809
|
+
* activity until it is disposed. This is intended for use by the router for passing
|
|
1810
|
+
* to PlaceComponent.canDeactivate(interactionContext). This ensures components don't
|
|
1811
|
+
* try and interact in a way that we can't track and synchronise with the browser back
|
|
1812
|
+
* button.
|
|
1813
|
+
* @return {?}
|
|
1814
|
+
*/
|
|
1815
|
+
_createExclusiveModalInteractionContext() {
|
|
1816
|
+
this.exclusiveContext.value = this.modelInteractionContextFactory.createInteractionContext();
|
|
1817
|
+
/** @type {?} */
|
|
1818
|
+
const self = this;
|
|
1819
|
+
this.exclusiveContext.value.registerDisposable({
|
|
1820
|
+
/**
|
|
1821
|
+
* @return {?}
|
|
1822
|
+
*/
|
|
1823
|
+
dispose() {
|
|
1824
|
+
self.exclusiveContext.value = null;
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
1827
|
+
return this.exclusiveContext.value;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
InteractionService.decorators = [
|
|
1831
|
+
{ type: Injectable, args: [{
|
|
1832
|
+
providedIn: 'root'
|
|
1833
|
+
},] }
|
|
1834
|
+
];
|
|
1835
|
+
/** @nocollapse */
|
|
1836
|
+
InteractionService.ctorParameters = () => [
|
|
1837
|
+
{ type: ModalInteractionContextFactory }
|
|
1838
|
+
];
|
|
1839
|
+
/** @nocollapse */ InteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionService_Factory() { return new InteractionService(ɵɵinject(ModalInteractionContextFactory)); }, token: InteractionService, providedIn: "root" });
|
|
1840
|
+
if (false) {
|
|
1841
|
+
/**
|
|
1842
|
+
* @type {?}
|
|
1843
|
+
* @private
|
|
1844
|
+
*/
|
|
1845
|
+
InteractionService.prototype.garbage;
|
|
1846
|
+
/** @type {?} */
|
|
1847
|
+
InteractionService.prototype.active;
|
|
1848
|
+
/**
|
|
1849
|
+
* @type {?}
|
|
1850
|
+
* @private
|
|
1851
|
+
*/
|
|
1852
|
+
InteractionService.prototype.exclusiveContext;
|
|
1853
|
+
/**
|
|
1854
|
+
* @type {?}
|
|
1855
|
+
* @private
|
|
1856
|
+
*/
|
|
1857
|
+
InteractionService.prototype._activeModalInteractionContextModel;
|
|
1858
|
+
/**
|
|
1859
|
+
* @type {?}
|
|
1860
|
+
* @private
|
|
1861
|
+
*/
|
|
1862
|
+
InteractionService.prototype._activeInlineInteractionContextModel;
|
|
1863
|
+
/**
|
|
1864
|
+
* @type {?}
|
|
1865
|
+
* @private
|
|
1866
|
+
*/
|
|
1867
|
+
InteractionService.prototype._activeInteractionContext;
|
|
1868
|
+
/** @type {?} */
|
|
1869
|
+
InteractionService.prototype.activeInteractionContextIds;
|
|
1870
|
+
/** @type {?} */
|
|
1871
|
+
InteractionService.prototype.modelInteractionActive;
|
|
1872
|
+
/** @type {?} */
|
|
1873
|
+
InteractionService.prototype.inlineInteractionActive;
|
|
1874
|
+
/** @type {?} */
|
|
1875
|
+
InteractionService.prototype.modelInteractionContextFactory;
|
|
1876
|
+
}
|
|
1877
|
+
(function (InteractionService) {
|
|
1878
|
+
/**
|
|
1879
|
+
* @record
|
|
1880
|
+
*/
|
|
1881
|
+
function Callback() { }
|
|
1882
|
+
InteractionService.Callback = Callback;
|
|
1883
|
+
if (false) {
|
|
1884
|
+
/**
|
|
1885
|
+
* @param {?} monitor
|
|
1886
|
+
* @return {?}
|
|
1887
|
+
*/
|
|
1888
|
+
Callback.prototype.onStarted = function (monitor) { };
|
|
1889
|
+
/**
|
|
1890
|
+
* @param {?} monitor
|
|
1891
|
+
* @return {?}
|
|
1892
|
+
*/
|
|
1893
|
+
Callback.prototype.onFinished = function (monitor) { };
|
|
1894
|
+
}
|
|
1895
|
+
class Monitor extends GarbageCollector {
|
|
1896
|
+
/**
|
|
1897
|
+
* @param {?} id
|
|
1898
|
+
* @param {?} interactionContext
|
|
1899
|
+
* @param {?} currentActiveMonitor
|
|
1900
|
+
* @param {?} exclusiveContext
|
|
1901
|
+
*/
|
|
1902
|
+
constructor(id, interactionContext, currentActiveMonitor, exclusiveContext) {
|
|
1903
|
+
super();
|
|
1904
|
+
this.id = id;
|
|
1905
|
+
this.interactionContext = interactionContext;
|
|
1906
|
+
this.currentActiveMonitor = currentActiveMonitor;
|
|
1907
|
+
this.exclusiveContext = exclusiveContext;
|
|
1908
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
1909
|
+
when.valueOf(interactionContext.active).becomesTruthy((/**
|
|
1910
|
+
* @return {?}
|
|
1911
|
+
*/
|
|
1912
|
+
() => this.onStarted()));
|
|
1913
|
+
when.valueOf(interactionContext.active).becomesFalsey((/**
|
|
1914
|
+
* @return {?}
|
|
1915
|
+
*/
|
|
1916
|
+
() => this.onFinished()));
|
|
1917
|
+
interactionContext.registerDisposable(this);
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* @protected
|
|
1921
|
+
* @return {?}
|
|
1922
|
+
*/
|
|
1923
|
+
onStarted() {
|
|
1924
|
+
this.assertCanStart();
|
|
1925
|
+
this.currentActiveMonitor.value = this;
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* @private
|
|
1929
|
+
* @return {?}
|
|
1930
|
+
*/
|
|
1931
|
+
assertCanStart() {
|
|
1932
|
+
assert$1.isFalsey(this.currentActiveMonitor.value);
|
|
1933
|
+
if (this.exclusiveContext.value && this.interactionContext !== this.exclusiveContext.value) {
|
|
1934
|
+
lang.illegalState('Interaction started while exclusive lock active. This is usually because you using a different context during place.canDeactivate(interactionContext)');
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
/**
|
|
1938
|
+
* @protected
|
|
1939
|
+
* @return {?}
|
|
1940
|
+
*/
|
|
1941
|
+
onFinished() {
|
|
1942
|
+
this.assertCurrentlyActive();
|
|
1943
|
+
this.currentActiveMonitor.value = null;
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* @private
|
|
1947
|
+
* @return {?}
|
|
1948
|
+
*/
|
|
1949
|
+
assertCurrentlyActive() {
|
|
1950
|
+
assert$1.isTruthy(this.currentActiveMonitor.value === this);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
InteractionService.Monitor = Monitor;
|
|
1954
|
+
if (false) {
|
|
1955
|
+
/** @type {?} */
|
|
1956
|
+
Monitor.prototype.id;
|
|
1957
|
+
/** @type {?} */
|
|
1958
|
+
Monitor.prototype.interactionContext;
|
|
1959
|
+
/** @type {?} */
|
|
1960
|
+
Monitor.prototype.currentActiveMonitor;
|
|
1961
|
+
/** @type {?} */
|
|
1962
|
+
Monitor.prototype.exclusiveContext;
|
|
1963
|
+
}
|
|
1964
|
+
})(InteractionService || (InteractionService = {}));
|
|
1965
|
+
|
|
1760
1966
|
/**
|
|
1761
1967
|
* @fileoverview added by tsickle
|
|
1762
1968
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -1765,9 +1971,14 @@ if (false) {
|
|
|
1765
1971
|
* @template D, R, E
|
|
1766
1972
|
*/
|
|
1767
1973
|
class InplaceInteractionContextComponent extends InteractionContextBase {
|
|
1768
|
-
|
|
1974
|
+
/**
|
|
1975
|
+
* @param {?} interactionService
|
|
1976
|
+
*/
|
|
1977
|
+
constructor(interactionService) {
|
|
1769
1978
|
super();
|
|
1979
|
+
this.interactionService = interactionService;
|
|
1770
1980
|
this._active = new MutableValueModel(false);
|
|
1981
|
+
this.interactionService._registerInplaceInteractionContext(this);
|
|
1771
1982
|
}
|
|
1772
1983
|
/**
|
|
1773
1984
|
* @return {?}
|
|
@@ -1829,7 +2040,9 @@ InplaceInteractionContextComponent.decorators = [
|
|
|
1829
2040
|
}] }
|
|
1830
2041
|
];
|
|
1831
2042
|
/** @nocollapse */
|
|
1832
|
-
InplaceInteractionContextComponent.ctorParameters = () => [
|
|
2043
|
+
InplaceInteractionContextComponent.ctorParameters = () => [
|
|
2044
|
+
{ type: InteractionService }
|
|
2045
|
+
];
|
|
1833
2046
|
InplaceInteractionContextComponent.propDecorators = {
|
|
1834
2047
|
interactionContext: [{ type: ViewChild, args: ['activityContainer', { static: true },] }]
|
|
1835
2048
|
};
|
|
@@ -1843,6 +2056,8 @@ if (false) {
|
|
|
1843
2056
|
* @private
|
|
1844
2057
|
*/
|
|
1845
2058
|
InplaceInteractionContextComponent.prototype._active;
|
|
2059
|
+
/** @type {?} */
|
|
2060
|
+
InplaceInteractionContextComponent.prototype.interactionService;
|
|
1846
2061
|
}
|
|
1847
2062
|
|
|
1848
2063
|
/**
|
|
@@ -1867,461 +2082,58 @@ InteractionOutletComponent.ctorParameters = () => [];
|
|
|
1867
2082
|
* @fileoverview added by tsickle
|
|
1868
2083
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1869
2084
|
*/
|
|
1870
|
-
class
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
2085
|
+
class InteractionModule {
|
|
2086
|
+
}
|
|
2087
|
+
InteractionModule.decorators = [
|
|
2088
|
+
{ type: NgModule, args: [{
|
|
2089
|
+
imports: [
|
|
2090
|
+
CommonModule,
|
|
2091
|
+
MatButtonModule,
|
|
2092
|
+
MatDialogModule,
|
|
2093
|
+
MatTabsModule$1,
|
|
2094
|
+
PortalModule,
|
|
2095
|
+
RouterModule
|
|
2096
|
+
],
|
|
2097
|
+
declarations: [
|
|
2098
|
+
ActivityContainerComponent,
|
|
2099
|
+
ConfirmationDialogComponent,
|
|
2100
|
+
ConfirmThenDialogComponent,
|
|
2101
|
+
AlertDialogComponent,
|
|
2102
|
+
ActivityOutletComponent,
|
|
2103
|
+
InteractionOutletComponent,
|
|
2104
|
+
InplaceInteractionContextComponent
|
|
2105
|
+
],
|
|
2106
|
+
exports: [
|
|
2107
|
+
ActivityContainerComponent,
|
|
2108
|
+
ActivityOutletComponent,
|
|
2109
|
+
InteractionOutletComponent,
|
|
2110
|
+
InplaceInteractionContextComponent
|
|
2111
|
+
],
|
|
2112
|
+
entryComponents: [
|
|
2113
|
+
ActivityContainerComponent,
|
|
2114
|
+
ConfirmationDialogComponent,
|
|
2115
|
+
ConfirmThenDialogComponent,
|
|
2116
|
+
AlertDialogComponent
|
|
2117
|
+
],
|
|
2118
|
+
providers: [
|
|
2119
|
+
InteractionService,
|
|
2120
|
+
]
|
|
2121
|
+
},] }
|
|
2122
|
+
];
|
|
2123
|
+
|
|
2124
|
+
/**
|
|
2125
|
+
* @fileoverview added by tsickle
|
|
2126
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2127
|
+
*/
|
|
2128
|
+
/**
|
|
2129
|
+
* @abstract
|
|
2130
|
+
* @template T, E
|
|
2131
|
+
*/
|
|
2132
|
+
class ParameterDefinition {
|
|
1890
2133
|
/**
|
|
1891
|
-
* @
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
return this._activeModel.readonly;
|
|
1895
|
-
}
|
|
1896
|
-
/**
|
|
1897
|
-
* @protected
|
|
1898
|
-
* @template D, R, E
|
|
1899
|
-
* @param {?} activityType
|
|
1900
|
-
* @param {?} data
|
|
1901
|
-
* @param {?=} disableClose
|
|
1902
|
-
* @return {?}
|
|
1903
|
-
*/
|
|
1904
|
-
_startActivity(activityType, data, disableClose = true) {
|
|
1905
|
-
if (this.isActive()) {
|
|
1906
|
-
lang.illegalState(`Activity already in progress: ${this.activityList.value.map((/**
|
|
1907
|
-
* @param {?} a
|
|
1908
|
-
* @return {?}
|
|
1909
|
-
*/
|
|
1910
|
-
a => a.constructor.name)).join(', ')}`);
|
|
1911
|
-
}
|
|
1912
|
-
this._activeModel.value = true;
|
|
1913
|
-
this.notifyActivityStarted();
|
|
1914
|
-
/** @type {?} */
|
|
1915
|
-
const config = Object.assign({}, this.config, {
|
|
1916
|
-
data,
|
|
1917
|
-
disableClose,
|
|
1918
|
-
panelClass: 'dialog-interaction-service'
|
|
1919
|
-
});
|
|
1920
|
-
/** @type {?} */
|
|
1921
|
-
const self = this;
|
|
1922
|
-
/** @type {?} */
|
|
1923
|
-
const matDialogRef = (/** @type {?} */ (this.dialogService.open(ActivityContainerComponent, config)));
|
|
1924
|
-
return new Promise((/**
|
|
1925
|
-
* @param {?} resolve
|
|
1926
|
-
* @param {?} reject
|
|
1927
|
-
* @return {?}
|
|
1928
|
-
*/
|
|
1929
|
-
(resolve, reject) => {
|
|
1930
|
-
/** @type {?} */
|
|
1931
|
-
const activityContainer = matDialogRef.componentInstance;
|
|
1932
|
-
self.safelyUpdateActivityListDelegate(activityContainer.activityList);
|
|
1933
|
-
activityContainer.initialActivityOutletContext = {
|
|
1934
|
-
activityClass: activityType,
|
|
1935
|
-
activityData: data,
|
|
1936
|
-
/**
|
|
1937
|
-
* @param {?} result
|
|
1938
|
-
* @return {?}
|
|
1939
|
-
*/
|
|
1940
|
-
onDone(result) {
|
|
1941
|
-
resolve(result);
|
|
1942
|
-
matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
|
|
1943
|
-
},
|
|
1944
|
-
/**
|
|
1945
|
-
* @param {?} error
|
|
1946
|
-
* @return {?}
|
|
1947
|
-
*/
|
|
1948
|
-
onCancel(error) {
|
|
1949
|
-
reject(error);
|
|
1950
|
-
matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
|
|
1951
|
-
}
|
|
1952
|
-
};
|
|
1953
|
-
// we need to check if our onDone/onCancel methods above we called or if we were
|
|
1954
|
-
// closed by the user clicking the backdrop. If the later then we need to reject
|
|
1955
|
-
// our promise.
|
|
1956
|
-
matDialogRef.afterClosed().subscribe((/**
|
|
1957
|
-
* @param {?} promiseAlreadyFinished
|
|
1958
|
-
* @return {?}
|
|
1959
|
-
*/
|
|
1960
|
-
promiseAlreadyFinished => {
|
|
1961
|
-
if (!promiseAlreadyFinished) {
|
|
1962
|
-
reject('auto-closed');
|
|
1963
|
-
}
|
|
1964
|
-
}));
|
|
1965
|
-
matDialogRef.updateSize();
|
|
1966
|
-
matDialogRef.afterOpened().subscribe((/**
|
|
1967
|
-
* @param {?} promiseAlreadyFinished
|
|
1968
|
-
* @return {?}
|
|
1969
|
-
*/
|
|
1970
|
-
promiseAlreadyFinished => {
|
|
1971
|
-
matDialogRef.updateSize();
|
|
1972
|
-
}));
|
|
1973
|
-
})).finally((/**
|
|
1974
|
-
* @return {?}
|
|
1975
|
-
*/
|
|
1976
|
-
() => {
|
|
1977
|
-
this._activeModel.value = false;
|
|
1978
|
-
this.notifyActivityFinished();
|
|
1979
|
-
self.safelyUpdateActivityListDelegate(null);
|
|
1980
|
-
}));
|
|
1981
|
-
}
|
|
1982
|
-
/**
|
|
1983
|
-
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
1984
|
-
* @param {?} delegate
|
|
1985
|
-
* @return {?}
|
|
1986
|
-
*/
|
|
1987
|
-
safelyUpdateActivityListDelegate(delegate) {
|
|
1988
|
-
setTimeout((/**
|
|
1989
|
-
* @return {?}
|
|
1990
|
-
*/
|
|
1991
|
-
() => this.setActivityList(delegate)));
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
1994
|
-
DialogInteractionContext.decorators = [
|
|
1995
|
-
{ type: Injectable, args: [{
|
|
1996
|
-
providedIn: 'root'
|
|
1997
|
-
},] }
|
|
1998
|
-
];
|
|
1999
|
-
/** @nocollapse */
|
|
2000
|
-
DialogInteractionContext.ctorParameters = () => [
|
|
2001
|
-
{ type: MatDialog },
|
|
2002
|
-
{ type: MatDialogConfig }
|
|
2003
|
-
];
|
|
2004
|
-
/** @nocollapse */ DialogInteractionContext.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionContext_Factory() { return new DialogInteractionContext(ɵɵinject(MatDialog$1), ɵɵinject(MatDialogConfig)); }, token: DialogInteractionContext, providedIn: "root" });
|
|
2005
|
-
if (false) {
|
|
2006
|
-
/**
|
|
2007
|
-
* @type {?}
|
|
2008
|
-
* @private
|
|
2009
|
-
*/
|
|
2010
|
-
DialogInteractionContext.prototype._activeModel;
|
|
2011
|
-
/**
|
|
2012
|
-
* @type {?}
|
|
2013
|
-
* @private
|
|
2014
|
-
*/
|
|
2015
|
-
DialogInteractionContext.prototype.dialogService;
|
|
2016
|
-
/** @type {?} */
|
|
2017
|
-
DialogInteractionContext.prototype.config;
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
/**
|
|
2021
|
-
* @fileoverview added by tsickle
|
|
2022
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2023
|
-
*/
|
|
2024
|
-
class Guard extends ValueModel {
|
|
2025
|
-
constructor() {
|
|
2026
|
-
super({ initialValue: false });
|
|
2027
|
-
}
|
|
2028
|
-
/**
|
|
2029
|
-
* @return {?}
|
|
2030
|
-
*/
|
|
2031
|
-
get value() {
|
|
2032
|
-
return this.store.read();
|
|
2033
|
-
}
|
|
2034
|
-
/**
|
|
2035
|
-
* @template R
|
|
2036
|
-
* @param {?} fun
|
|
2037
|
-
* @return {?}
|
|
2038
|
-
*/
|
|
2039
|
-
whileTrue(fun) {
|
|
2040
|
-
this.startTransaction().commit(true);
|
|
2041
|
-
try {
|
|
2042
|
-
return fun();
|
|
2043
|
-
}
|
|
2044
|
-
finally {
|
|
2045
|
-
this.startTransaction().commit(false);
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
/**
|
|
2049
|
-
* @template R
|
|
2050
|
-
* @param {?} fun
|
|
2051
|
-
* @param {?=} defaultValue
|
|
2052
|
-
* @return {?}
|
|
2053
|
-
*/
|
|
2054
|
-
runIfFalse(fun, defaultValue = null) {
|
|
2055
|
-
return !this.value ? fun() : defaultValue;
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
/**
|
|
2059
|
-
* @abstract
|
|
2060
|
-
*/
|
|
2061
|
-
class ModalInteractionService extends GarbageCollector {
|
|
2062
|
-
constructor() {
|
|
2063
|
-
super();
|
|
2064
|
-
this._activityListeners = new EventListenerList();
|
|
2065
|
-
}
|
|
2066
|
-
/**
|
|
2067
|
-
* @return {?}
|
|
2068
|
-
*/
|
|
2069
|
-
isActive() {
|
|
2070
|
-
return this.active.value;
|
|
2071
|
-
}
|
|
2072
|
-
/**
|
|
2073
|
-
* @param {?} listener
|
|
2074
|
-
* @return {?}
|
|
2075
|
-
*/
|
|
2076
|
-
addActivityListener(listener) {
|
|
2077
|
-
return this._activityListeners.add(listener);
|
|
2078
|
-
}
|
|
2079
|
-
/**
|
|
2080
|
-
* @protected
|
|
2081
|
-
* @return {?}
|
|
2082
|
-
*/
|
|
2083
|
-
notifyActivityStarted() {
|
|
2084
|
-
this._activityListeners.fire((/**
|
|
2085
|
-
* @param {?} l
|
|
2086
|
-
* @return {?}
|
|
2087
|
-
*/
|
|
2088
|
-
l => l.onActivityStarted()));
|
|
2089
|
-
}
|
|
2090
|
-
/**
|
|
2091
|
-
* @protected
|
|
2092
|
-
* @return {?}
|
|
2093
|
-
*/
|
|
2094
|
-
notifyActivityFinished() {
|
|
2095
|
-
this._activityListeners.fire((/**
|
|
2096
|
-
* @param {?} l
|
|
2097
|
-
* @return {?}
|
|
2098
|
-
*/
|
|
2099
|
-
l => l.onActivityFinished()));
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
2102
|
-
if (false) {
|
|
2103
|
-
/**
|
|
2104
|
-
* @type {?}
|
|
2105
|
-
* @private
|
|
2106
|
-
*/
|
|
2107
|
-
ModalInteractionService.prototype._activityListeners;
|
|
2108
|
-
/** @type {?} */
|
|
2109
|
-
ModalInteractionService.prototype.active;
|
|
2110
|
-
/**
|
|
2111
|
-
* @abstract
|
|
2112
|
-
* @param {?} disposable
|
|
2113
|
-
* @return {?}
|
|
2114
|
-
*/
|
|
2115
|
-
ModalInteractionService.prototype.createInteractionContextFor = function (disposable) { };
|
|
2116
|
-
/**
|
|
2117
|
-
* @abstract
|
|
2118
|
-
* @return {?}
|
|
2119
|
-
*/
|
|
2120
|
-
ModalInteractionService.prototype.createExclusiveInteractionContext = function () { };
|
|
2121
|
-
/**
|
|
2122
|
-
* @abstract
|
|
2123
|
-
* @return {?}
|
|
2124
|
-
*/
|
|
2125
|
-
ModalInteractionService.prototype.getCurrentActivity = function () { };
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
/**
|
|
2129
|
-
* @fileoverview added by tsickle
|
|
2130
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2131
|
-
*/
|
|
2132
|
-
/** @type {?} */
|
|
2133
|
-
const DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
|
|
2134
|
-
class DialogInteractionService extends ModalInteractionService {
|
|
2135
|
-
/**
|
|
2136
|
-
* @param {?} dialogService
|
|
2137
|
-
* @param {?} dialogServiceDefaults
|
|
2138
|
-
* @param {?} matDialogDefaultConfig
|
|
2139
|
-
*/
|
|
2140
|
-
constructor(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
2141
|
-
super();
|
|
2142
|
-
this.dialogService = dialogService;
|
|
2143
|
-
this.dialogServiceDefaults = dialogServiceDefaults;
|
|
2144
|
-
this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
2145
|
-
this._activeInteractionContextModel = new MutableValueModel();
|
|
2146
|
-
assert$1.notNil(dialogService);
|
|
2147
|
-
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
2148
|
-
this.active = chain(this._activeInteractionContextModel).isNotNil();
|
|
2149
|
-
}
|
|
2150
|
-
/**
|
|
2151
|
-
* @param {?} disposable
|
|
2152
|
-
* @return {?}
|
|
2153
|
-
*/
|
|
2154
|
-
createInteractionContextFor(disposable) {
|
|
2155
|
-
return disposable.registerDisposable(this._createInteractionContext());
|
|
2156
|
-
}
|
|
2157
|
-
/**
|
|
2158
|
-
* @return {?}
|
|
2159
|
-
*/
|
|
2160
|
-
_createInteractionContext() {
|
|
2161
|
-
/** @type {?} */
|
|
2162
|
-
const config = Object.assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults);
|
|
2163
|
-
/** @type {?} */
|
|
2164
|
-
const self = this;
|
|
2165
|
-
/** @type {?} */
|
|
2166
|
-
const dialogInteractionContext = new DialogInteractionContext(this.dialogService, config);
|
|
2167
|
-
dialogInteractionContext.registerDisposable(dialogInteractionContext.addActivityListener({
|
|
2168
|
-
/**
|
|
2169
|
-
* @return {?}
|
|
2170
|
-
*/
|
|
2171
|
-
onActivityStarted() {
|
|
2172
|
-
self.onActivityStarted(dialogInteractionContext);
|
|
2173
|
-
},
|
|
2174
|
-
/**
|
|
2175
|
-
* @return {?}
|
|
2176
|
-
*/
|
|
2177
|
-
onActivityFinished() {
|
|
2178
|
-
self.onActivityFinished(dialogInteractionContext);
|
|
2179
|
-
}
|
|
2180
|
-
}));
|
|
2181
|
-
return dialogInteractionContext;
|
|
2182
|
-
}
|
|
2183
|
-
/**
|
|
2184
|
-
* @return {?}
|
|
2185
|
-
*/
|
|
2186
|
-
createExclusiveInteractionContext() {
|
|
2187
|
-
this.exclusiveContext = this._createInteractionContext();
|
|
2188
|
-
/** @type {?} */
|
|
2189
|
-
const self = this;
|
|
2190
|
-
this.exclusiveContext.registerDisposable({
|
|
2191
|
-
/**
|
|
2192
|
-
* @return {?}
|
|
2193
|
-
*/
|
|
2194
|
-
dispose() {
|
|
2195
|
-
self.exclusiveContext = null;
|
|
2196
|
-
}
|
|
2197
|
-
});
|
|
2198
|
-
return this.exclusiveContext;
|
|
2199
|
-
}
|
|
2200
|
-
// @Trace()
|
|
2201
|
-
/**
|
|
2202
|
-
* @param {?} dialogInteractionContext
|
|
2203
|
-
* @return {?}
|
|
2204
|
-
*/
|
|
2205
|
-
onActivityStarted(dialogInteractionContext) {
|
|
2206
|
-
assert$1.isFalsey(this.isActive());
|
|
2207
|
-
if (this.exclusiveContext && dialogInteractionContext !== this.exclusiveContext) {
|
|
2208
|
-
lang.illegalState("Interaction started while exclusive lock active. This is usually because you using a different context during place.canDeactivate(interactionContext)");
|
|
2209
|
-
}
|
|
2210
|
-
this._activeInteractionContextModel.value = dialogInteractionContext;
|
|
2211
|
-
this.notifyActivityStarted();
|
|
2212
|
-
}
|
|
2213
|
-
// @Trace()
|
|
2214
|
-
/**
|
|
2215
|
-
* @param {?} dialogInteractionContext
|
|
2216
|
-
* @return {?}
|
|
2217
|
-
*/
|
|
2218
|
-
onActivityFinished(dialogInteractionContext) {
|
|
2219
|
-
assert$1.isTruthy(this._activeInteractionContextModel.value === dialogInteractionContext);
|
|
2220
|
-
this._activeInteractionContextModel.value = null;
|
|
2221
|
-
this.notifyActivityFinished();
|
|
2222
|
-
}
|
|
2223
|
-
/**
|
|
2224
|
-
* @return {?}
|
|
2225
|
-
*/
|
|
2226
|
-
getCurrentActivity() {
|
|
2227
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2228
|
-
assert$1.isTruthy(this.isActive());
|
|
2229
|
-
return this._activeInteractionContextModel.value.getCurrentActivity();
|
|
2230
|
-
});
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
DialogInteractionService.decorators = [
|
|
2234
|
-
{ type: Injectable, args: [{
|
|
2235
|
-
providedIn: 'root'
|
|
2236
|
-
},] }
|
|
2237
|
-
];
|
|
2238
|
-
/** @nocollapse */
|
|
2239
|
-
DialogInteractionService.ctorParameters = () => [
|
|
2240
|
-
{ type: MatDialog },
|
|
2241
|
-
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
|
|
2242
|
-
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
|
|
2243
|
-
];
|
|
2244
|
-
/** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
|
|
2245
|
-
if (false) {
|
|
2246
|
-
/**
|
|
2247
|
-
* @type {?}
|
|
2248
|
-
* @private
|
|
2249
|
-
*/
|
|
2250
|
-
DialogInteractionService.prototype._activeInteractionContextModel;
|
|
2251
|
-
/** @type {?} */
|
|
2252
|
-
DialogInteractionService.prototype.active;
|
|
2253
|
-
/**
|
|
2254
|
-
* @type {?}
|
|
2255
|
-
* @private
|
|
2256
|
-
*/
|
|
2257
|
-
DialogInteractionService.prototype.exclusiveContext;
|
|
2258
|
-
/**
|
|
2259
|
-
* @type {?}
|
|
2260
|
-
* @private
|
|
2261
|
-
*/
|
|
2262
|
-
DialogInteractionService.prototype.dialogService;
|
|
2263
|
-
/** @type {?} */
|
|
2264
|
-
DialogInteractionService.prototype.dialogServiceDefaults;
|
|
2265
|
-
/** @type {?} */
|
|
2266
|
-
DialogInteractionService.prototype.matDialogDefaultConfig;
|
|
2267
|
-
}
|
|
2268
|
-
|
|
2269
|
-
/**
|
|
2270
|
-
* @fileoverview added by tsickle
|
|
2271
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2272
|
-
*/
|
|
2273
|
-
class InteractionModule {
|
|
2274
|
-
}
|
|
2275
|
-
InteractionModule.decorators = [
|
|
2276
|
-
{ type: NgModule, args: [{
|
|
2277
|
-
imports: [
|
|
2278
|
-
CommonModule,
|
|
2279
|
-
MatButtonModule,
|
|
2280
|
-
MatDialogModule,
|
|
2281
|
-
MatTabsModule$1,
|
|
2282
|
-
PortalModule,
|
|
2283
|
-
RouterModule
|
|
2284
|
-
],
|
|
2285
|
-
declarations: [
|
|
2286
|
-
ActivityContainerComponent,
|
|
2287
|
-
ConfirmationDialogComponent,
|
|
2288
|
-
ConfirmThenDialogComponent,
|
|
2289
|
-
AlertDialogComponent,
|
|
2290
|
-
ActivityOutletComponent,
|
|
2291
|
-
InteractionOutletComponent,
|
|
2292
|
-
InplaceInteractionContextComponent
|
|
2293
|
-
],
|
|
2294
|
-
exports: [
|
|
2295
|
-
ActivityContainerComponent,
|
|
2296
|
-
ActivityOutletComponent,
|
|
2297
|
-
InteractionOutletComponent,
|
|
2298
|
-
InplaceInteractionContextComponent
|
|
2299
|
-
],
|
|
2300
|
-
entryComponents: [
|
|
2301
|
-
ActivityContainerComponent,
|
|
2302
|
-
ConfirmationDialogComponent,
|
|
2303
|
-
ConfirmThenDialogComponent,
|
|
2304
|
-
AlertDialogComponent
|
|
2305
|
-
],
|
|
2306
|
-
providers: [
|
|
2307
|
-
DialogInteractionService,
|
|
2308
|
-
]
|
|
2309
|
-
},] }
|
|
2310
|
-
];
|
|
2311
|
-
|
|
2312
|
-
/**
|
|
2313
|
-
* @fileoverview added by tsickle
|
|
2314
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2315
|
-
*/
|
|
2316
|
-
/**
|
|
2317
|
-
* @abstract
|
|
2318
|
-
* @template T, E
|
|
2319
|
-
*/
|
|
2320
|
-
class ParameterDefinition {
|
|
2321
|
-
/**
|
|
2322
|
-
* @param {?} propertyName
|
|
2323
|
-
* @param {?} options
|
|
2324
|
-
* @param {?=} urlFormat
|
|
2134
|
+
* @param {?} propertyName
|
|
2135
|
+
* @param {?} options
|
|
2136
|
+
* @param {?=} urlFormat
|
|
2325
2137
|
*/
|
|
2326
2138
|
constructor(propertyName, options, urlFormat) {
|
|
2327
2139
|
this.propertyName = propertyName;
|
|
@@ -3177,6 +2989,24 @@ class NavigationState extends GarbageCollector {
|
|
|
3177
2989
|
this.context = context;
|
|
3178
2990
|
this._visits = new Map();
|
|
3179
2991
|
}
|
|
2992
|
+
/**
|
|
2993
|
+
* @return {?}
|
|
2994
|
+
*/
|
|
2995
|
+
get idle() {
|
|
2996
|
+
return !this.isTransitional;
|
|
2997
|
+
}
|
|
2998
|
+
/**
|
|
2999
|
+
* @return {?}
|
|
3000
|
+
*/
|
|
3001
|
+
get placeRouter() {
|
|
3002
|
+
return this.context.placeRouter;
|
|
3003
|
+
}
|
|
3004
|
+
/**
|
|
3005
|
+
* @return {?}
|
|
3006
|
+
*/
|
|
3007
|
+
get interactionService() {
|
|
3008
|
+
return this.context.interactionService;
|
|
3009
|
+
}
|
|
3180
3010
|
/**
|
|
3181
3011
|
* @return {?}
|
|
3182
3012
|
*/
|
|
@@ -3197,6 +3027,41 @@ class NavigationState extends GarbageCollector {
|
|
|
3197
3027
|
getVisitFor(placeDef) {
|
|
3198
3028
|
return this._visits.get(placeDef);
|
|
3199
3029
|
}
|
|
3030
|
+
/**
|
|
3031
|
+
* @param {?} event
|
|
3032
|
+
* @return {?}
|
|
3033
|
+
*/
|
|
3034
|
+
onPopState(event) {
|
|
3035
|
+
return this.illegalTransition(event);
|
|
3036
|
+
}
|
|
3037
|
+
/**
|
|
3038
|
+
* @param {?} event
|
|
3039
|
+
* @return {?}
|
|
3040
|
+
*/
|
|
3041
|
+
onStart(event) {
|
|
3042
|
+
return this.illegalTransition(event);
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* @param {?} event
|
|
3046
|
+
* @return {?}
|
|
3047
|
+
*/
|
|
3048
|
+
onCancel(event) {
|
|
3049
|
+
return this.illegalTransition(event);
|
|
3050
|
+
}
|
|
3051
|
+
/**
|
|
3052
|
+
* @param {?} event
|
|
3053
|
+
* @return {?}
|
|
3054
|
+
*/
|
|
3055
|
+
onError(event) {
|
|
3056
|
+
return this.illegalTransition(event);
|
|
3057
|
+
}
|
|
3058
|
+
/**
|
|
3059
|
+
* @param {?} event
|
|
3060
|
+
* @return {?}
|
|
3061
|
+
*/
|
|
3062
|
+
onEnd(event) {
|
|
3063
|
+
return this.illegalTransition(event);
|
|
3064
|
+
}
|
|
3200
3065
|
/**
|
|
3201
3066
|
* @param {?} newUrl
|
|
3202
3067
|
* @return {?}
|
|
@@ -3204,6 +3069,16 @@ class NavigationState extends GarbageCollector {
|
|
|
3204
3069
|
onBackClickedDuringNavigationInteraction(newUrl) {
|
|
3205
3070
|
return this.illegalTransition('onBackClickedDuringNavigationInteraction');
|
|
3206
3071
|
}
|
|
3072
|
+
/**
|
|
3073
|
+
* @param {?} component
|
|
3074
|
+
* @param {?} nextState
|
|
3075
|
+
* @return {?}
|
|
3076
|
+
*/
|
|
3077
|
+
canDeactivatePlace(component, nextState) {
|
|
3078
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3079
|
+
return this.illegalTransition('canDeactivatePlace');
|
|
3080
|
+
});
|
|
3081
|
+
}
|
|
3207
3082
|
/**
|
|
3208
3083
|
* @return {?}
|
|
3209
3084
|
*/
|
|
@@ -3224,24 +3099,31 @@ class NavigationState extends GarbageCollector {
|
|
|
3224
3099
|
* @return {?}
|
|
3225
3100
|
*/
|
|
3226
3101
|
currentRouterUrl() {
|
|
3227
|
-
return this.
|
|
3102
|
+
return this.placeRouter.getCurrentRouterUrl();
|
|
3228
3103
|
}
|
|
3229
3104
|
/**
|
|
3230
3105
|
* @protected
|
|
3231
3106
|
* @param {?} event
|
|
3232
3107
|
* @return {?}
|
|
3233
3108
|
*/
|
|
3234
|
-
|
|
3109
|
+
createTransitionStateFor(event) {
|
|
3235
3110
|
// TODO: check if the event is purely for interaction context changes.
|
|
3236
|
-
|
|
3111
|
+
/** @type {?} */
|
|
3112
|
+
const popstate = event.navigationTrigger === 'popstate';
|
|
3113
|
+
return popstate ?
|
|
3114
|
+
new NavigationState.NavigationBackTransition(this.context, popstate, this.currentRouterUrl()) :
|
|
3115
|
+
new NavigationState.NavigationTransition(this.context, popstate, this.currentRouterUrl());
|
|
3237
3116
|
}
|
|
3238
3117
|
/**
|
|
3239
|
-
* @protected
|
|
3240
3118
|
* @param {?} url
|
|
3241
3119
|
* @return {?}
|
|
3242
3120
|
*/
|
|
3243
|
-
|
|
3244
|
-
this
|
|
3121
|
+
resetBrowserLocation(url) {
|
|
3122
|
+
// TODO: Should this be a navigate operation to avoid confusing the router...??
|
|
3123
|
+
setTimeout((/**
|
|
3124
|
+
* @return {?}
|
|
3125
|
+
*/
|
|
3126
|
+
() => this.placeRouter.resetBrowserLocation(url)));
|
|
3245
3127
|
}
|
|
3246
3128
|
/**
|
|
3247
3129
|
* @return {?}
|
|
@@ -3250,12 +3132,6 @@ class NavigationState extends GarbageCollector {
|
|
|
3250
3132
|
return this.constructor.name;
|
|
3251
3133
|
}
|
|
3252
3134
|
}
|
|
3253
|
-
__decorate([
|
|
3254
|
-
Trace(),
|
|
3255
|
-
__metadata("design:type", Function),
|
|
3256
|
-
__metadata("design:paramtypes", [Object]),
|
|
3257
|
-
__metadata("design:returntype", void 0)
|
|
3258
|
-
], NavigationState.prototype, "updateLocation", null);
|
|
3259
3135
|
if (false) {
|
|
3260
3136
|
/**
|
|
3261
3137
|
* @type {?}
|
|
@@ -3263,71 +3139,36 @@ if (false) {
|
|
|
3263
3139
|
*/
|
|
3264
3140
|
NavigationState.prototype._visits;
|
|
3265
3141
|
/** @type {?} */
|
|
3266
|
-
NavigationState.prototype.
|
|
3267
|
-
/** @type {?} */
|
|
3268
|
-
NavigationState.prototype.active;
|
|
3142
|
+
NavigationState.prototype.isTransitional;
|
|
3269
3143
|
/** @type {?} */
|
|
3270
3144
|
NavigationState.prototype.startingUrl;
|
|
3145
|
+
/** @type {?} */
|
|
3146
|
+
NavigationState.prototype.isPopState;
|
|
3271
3147
|
/**
|
|
3272
3148
|
* @type {?}
|
|
3273
3149
|
* @protected
|
|
3274
3150
|
*/
|
|
3275
3151
|
NavigationState.prototype.context;
|
|
3276
|
-
/**
|
|
3277
|
-
* @abstract
|
|
3278
|
-
* @param {?} event
|
|
3279
|
-
* @return {?}
|
|
3280
|
-
*/
|
|
3281
|
-
NavigationState.prototype.onStart = function (event) { };
|
|
3282
|
-
/**
|
|
3283
|
-
* @abstract
|
|
3284
|
-
* @param {?} event
|
|
3285
|
-
* @return {?}
|
|
3286
|
-
*/
|
|
3287
|
-
NavigationState.prototype.onCancel = function (event) { };
|
|
3288
|
-
/**
|
|
3289
|
-
* @abstract
|
|
3290
|
-
* @param {?} event
|
|
3291
|
-
* @return {?}
|
|
3292
|
-
*/
|
|
3293
|
-
NavigationState.prototype.onError = function (event) { };
|
|
3294
|
-
/**
|
|
3295
|
-
* @abstract
|
|
3296
|
-
* @param {?} event
|
|
3297
|
-
* @return {?}
|
|
3298
|
-
*/
|
|
3299
|
-
NavigationState.prototype.onEnd = function (event) { };
|
|
3300
|
-
/**
|
|
3301
|
-
* @abstract
|
|
3302
|
-
* @param {?} component
|
|
3303
|
-
* @param {?} nextState
|
|
3304
|
-
* @return {?}
|
|
3305
|
-
*/
|
|
3306
|
-
NavigationState.prototype.canDeactivatePlace = function (component, nextState) { };
|
|
3307
3152
|
}
|
|
3308
3153
|
(function (NavigationState) {
|
|
3309
3154
|
class Context {
|
|
3310
3155
|
/**
|
|
3311
|
-
* @param {?}
|
|
3312
|
-
* @param {?}
|
|
3313
|
-
* @param {?} angularLocation
|
|
3156
|
+
* @param {?} placeRouter
|
|
3157
|
+
* @param {?} interactionService
|
|
3314
3158
|
* @param {?} notifySuccess
|
|
3315
3159
|
*/
|
|
3316
|
-
constructor(
|
|
3317
|
-
this.
|
|
3318
|
-
this.
|
|
3319
|
-
this.angularLocation = angularLocation;
|
|
3160
|
+
constructor(placeRouter, interactionService, notifySuccess) {
|
|
3161
|
+
this.placeRouter = placeRouter;
|
|
3162
|
+
this.interactionService = interactionService;
|
|
3320
3163
|
this.notifySuccess = notifySuccess;
|
|
3321
3164
|
}
|
|
3322
3165
|
}
|
|
3323
3166
|
NavigationState.Context = Context;
|
|
3324
3167
|
if (false) {
|
|
3325
3168
|
/** @type {?} */
|
|
3326
|
-
Context.prototype.
|
|
3327
|
-
/** @type {?} */
|
|
3328
|
-
Context.prototype.modalInteractionService;
|
|
3169
|
+
Context.prototype.placeRouter;
|
|
3329
3170
|
/** @type {?} */
|
|
3330
|
-
Context.prototype.
|
|
3171
|
+
Context.prototype.interactionService;
|
|
3331
3172
|
/** @type {?} */
|
|
3332
3173
|
Context.prototype.notifySuccess;
|
|
3333
3174
|
}
|
|
@@ -3337,18 +3178,9 @@ if (false) {
|
|
|
3337
3178
|
*/
|
|
3338
3179
|
constructor(context) {
|
|
3339
3180
|
super(context);
|
|
3340
|
-
this.
|
|
3181
|
+
this.isTransitional = false;
|
|
3341
3182
|
this.startingUrl = null;
|
|
3342
|
-
|
|
3343
|
-
/**
|
|
3344
|
-
* @param {?} component
|
|
3345
|
-
* @param {?} nextState
|
|
3346
|
-
* @return {?}
|
|
3347
|
-
*/
|
|
3348
|
-
canDeactivatePlace(component, nextState) {
|
|
3349
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3350
|
-
return this.illegalTransition('canDeactivatePlace');
|
|
3351
|
-
});
|
|
3183
|
+
this.isPopState = false;
|
|
3352
3184
|
}
|
|
3353
3185
|
/**
|
|
3354
3186
|
* @param {?} event
|
|
@@ -3360,44 +3192,35 @@ if (false) {
|
|
|
3360
3192
|
Logger.get(this).info(`navigation started to same url -> ${event.url}`);
|
|
3361
3193
|
return this;
|
|
3362
3194
|
}
|
|
3363
|
-
if (event.url
|
|
3195
|
+
if (this.placeRouter.hasActiveInteractionIds(event.url)) {
|
|
3364
3196
|
Logger.get(this).info(`navigation started with interaction outlet -> ${event.url}`);
|
|
3365
|
-
return new
|
|
3197
|
+
return new InteractionTransition(this.context, event.url);
|
|
3198
|
+
}
|
|
3199
|
+
else {
|
|
3200
|
+
return this.createTransitionStateFor(event);
|
|
3366
3201
|
}
|
|
3367
|
-
return this.createActiveSession(event);
|
|
3368
|
-
}
|
|
3369
|
-
/**
|
|
3370
|
-
* @param {?} event
|
|
3371
|
-
* @return {?}
|
|
3372
|
-
*/
|
|
3373
|
-
onCancel(event) {
|
|
3374
|
-
return this.illegalTransition(event);
|
|
3375
3202
|
}
|
|
3376
3203
|
/**
|
|
3377
3204
|
* @param {?} event
|
|
3378
3205
|
* @return {?}
|
|
3379
3206
|
*/
|
|
3380
|
-
|
|
3381
|
-
return this.
|
|
3382
|
-
}
|
|
3383
|
-
/**
|
|
3384
|
-
* @param {?} event
|
|
3385
|
-
* @return {?}
|
|
3386
|
-
*/
|
|
3387
|
-
onError(event) {
|
|
3388
|
-
return this.illegalTransition(event);
|
|
3207
|
+
onPopState(event) {
|
|
3208
|
+
return this.createTransitionStateFor(event);
|
|
3389
3209
|
}
|
|
3390
3210
|
}
|
|
3391
3211
|
NavigationState.Idle = Idle;
|
|
3392
3212
|
if (false) {
|
|
3393
3213
|
/** @type {?} */
|
|
3394
|
-
Idle.prototype.
|
|
3395
|
-
/** @type {?} */
|
|
3396
|
-
Idle.prototype.active;
|
|
3214
|
+
Idle.prototype.isTransitional;
|
|
3397
3215
|
/** @type {?} */
|
|
3398
3216
|
Idle.prototype.startingUrl;
|
|
3217
|
+
/** @type {?} */
|
|
3218
|
+
Idle.prototype.isPopState;
|
|
3399
3219
|
}
|
|
3400
|
-
|
|
3220
|
+
/**
|
|
3221
|
+
* @abstract
|
|
3222
|
+
*/
|
|
3223
|
+
class AbstractNavigationTransition extends NavigationState {
|
|
3401
3224
|
/**
|
|
3402
3225
|
* @param {?} context
|
|
3403
3226
|
* @param {?} isPopState
|
|
@@ -3407,9 +3230,9 @@ if (false) {
|
|
|
3407
3230
|
super(context);
|
|
3408
3231
|
this.isPopState = isPopState;
|
|
3409
3232
|
this.startingUrl = startingUrl;
|
|
3410
|
-
this.
|
|
3233
|
+
this.isTransitional = true;
|
|
3411
3234
|
this.componentDeactivationHandlers = new Map();
|
|
3412
|
-
this._interactionContext = this.
|
|
3235
|
+
this._interactionContext = this.interactionService._createExclusiveModalInteractionContext();
|
|
3413
3236
|
this.onDispose((/**
|
|
3414
3237
|
* @return {?}
|
|
3415
3238
|
*/
|
|
@@ -3417,9 +3240,9 @@ if (false) {
|
|
|
3417
3240
|
// the interaction context can be detached during the back button cancellation state transition
|
|
3418
3241
|
// as the transition is synchronous and activityCancellation isn't. Otherwise dispose will be
|
|
3419
3242
|
// called before the context has been cancelled. It might be work having the interaction context
|
|
3420
|
-
// automatically cancel if the context is disposed.
|
|
3243
|
+
// automatically cancel if the context is disposed so we don't have worry about detaching etc.
|
|
3421
3244
|
if (this._interactionContext) {
|
|
3422
|
-
this._interactionContext.dispose();
|
|
3245
|
+
this._interactionContext.dispose(); // or do something like cancelAndDispose?
|
|
3423
3246
|
}
|
|
3424
3247
|
}));
|
|
3425
3248
|
}
|
|
@@ -3434,7 +3257,8 @@ if (false) {
|
|
|
3434
3257
|
* @return {?}
|
|
3435
3258
|
*/
|
|
3436
3259
|
onStart(event) {
|
|
3437
|
-
// active sessions can have many cancel start cycles
|
|
3260
|
+
// active sessions can have many cancel start cycles due
|
|
3261
|
+
// to place guard redirects
|
|
3438
3262
|
return this;
|
|
3439
3263
|
}
|
|
3440
3264
|
/**
|
|
@@ -3446,58 +3270,27 @@ if (false) {
|
|
|
3446
3270
|
this.context.notifySuccess(this);
|
|
3447
3271
|
return new Idle(this.context);
|
|
3448
3272
|
}
|
|
3449
|
-
/**
|
|
3450
|
-
* @param {?} event
|
|
3451
|
-
* @return {?}
|
|
3452
|
-
*/
|
|
3453
|
-
onCancel(event) {
|
|
3454
|
-
if (this.isPopState) { // back button clicked and a guard cancelled
|
|
3455
|
-
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
3456
|
-
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
3457
|
-
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
3458
|
-
this.updateLocation(this.startingUrl);
|
|
3459
|
-
}
|
|
3460
|
-
return this.isPopState ? new Idle(this.context) : this;
|
|
3461
|
-
}
|
|
3462
|
-
/**
|
|
3463
|
-
* @param {?} event
|
|
3464
|
-
* @return {?}
|
|
3465
|
-
*/
|
|
3466
|
-
onError(event) {
|
|
3467
|
-
// navigation was aborted.
|
|
3468
|
-
if (this.isPopState && this.currentRouterUrl() !== this.startingUrl) {
|
|
3469
|
-
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
3470
|
-
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
3471
|
-
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
3472
|
-
this.updateLocation(this.startingUrl);
|
|
3473
|
-
}
|
|
3474
|
-
return new Idle(this.context);
|
|
3475
|
-
}
|
|
3476
3273
|
/**
|
|
3477
3274
|
* @param {?} locationTriggerUrl
|
|
3478
3275
|
* @return {?}
|
|
3479
3276
|
*/
|
|
3480
3277
|
onBackClickedDuringNavigationInteraction(locationTriggerUrl) {
|
|
3278
|
+
// detach the interactoin from the session so it doesn't get disposed until the activity
|
|
3279
|
+
// has completed.
|
|
3481
3280
|
/** @type {?} */
|
|
3482
3281
|
const context = this.detachInteractionContext();
|
|
3282
|
+
const { when } = Dsl.disposeWith(context);
|
|
3283
|
+
// TODO: I need to make the exclusive interaction context disallow nested activities or
|
|
3284
|
+
// that would mess things up entirely.
|
|
3483
3285
|
context.getCurrentActivity().then((/**
|
|
3484
3286
|
* @param {?} activity
|
|
3485
3287
|
* @return {?}
|
|
3486
3288
|
*/
|
|
3487
3289
|
activity => {
|
|
3488
|
-
context.
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
onActivityFinished() {
|
|
3493
|
-
context.dispose();
|
|
3494
|
-
},
|
|
3495
|
-
/**
|
|
3496
|
-
* @return {?}
|
|
3497
|
-
*/
|
|
3498
|
-
onActivityStarted() {
|
|
3499
|
-
}
|
|
3500
|
-
});
|
|
3290
|
+
when.valueOf(context.active).becomesFalsey((/**
|
|
3291
|
+
* @return {?}
|
|
3292
|
+
*/
|
|
3293
|
+
() => context.dispose()), { once: true });
|
|
3501
3294
|
activity.cancel(null);
|
|
3502
3295
|
}));
|
|
3503
3296
|
return new CancelledDuringNavigationInteraction(this.context, this.startingUrl, locationTriggerUrl);
|
|
@@ -3531,51 +3324,116 @@ if (false) {
|
|
|
3531
3324
|
this._interactionContext = null;
|
|
3532
3325
|
return context;
|
|
3533
3326
|
}
|
|
3534
|
-
/**
|
|
3535
|
-
* @return {?}
|
|
3536
|
-
*/
|
|
3537
|
-
toString() {
|
|
3538
|
-
return `${this.constructor.name}(startingUrl: ${this.startingUrl}, isPopState:${this.isPopState})`;
|
|
3539
|
-
}
|
|
3540
3327
|
}
|
|
3541
|
-
|
|
3542
|
-
Trace(),
|
|
3543
|
-
__metadata("design:type", Function),
|
|
3544
|
-
__metadata("design:paramtypes", [NavigationStart]),
|
|
3545
|
-
__metadata("design:returntype", NavigationState)
|
|
3546
|
-
], Active.prototype, "onStart", null);
|
|
3547
|
-
__decorate([
|
|
3548
|
-
Trace(),
|
|
3549
|
-
__metadata("design:type", Function),
|
|
3550
|
-
__metadata("design:paramtypes", [NavigationCancel]),
|
|
3551
|
-
__metadata("design:returntype", NavigationState)
|
|
3552
|
-
], Active.prototype, "onCancel", null);
|
|
3553
|
-
__decorate([
|
|
3554
|
-
Trace(),
|
|
3555
|
-
__metadata("design:type", Function),
|
|
3556
|
-
__metadata("design:paramtypes", [NavigationError]),
|
|
3557
|
-
__metadata("design:returntype", NavigationState)
|
|
3558
|
-
], Active.prototype, "onError", null);
|
|
3559
|
-
NavigationState.Active = Active;
|
|
3328
|
+
NavigationState.AbstractNavigationTransition = AbstractNavigationTransition;
|
|
3560
3329
|
if (false) {
|
|
3561
3330
|
/** @type {?} */
|
|
3562
|
-
|
|
3331
|
+
AbstractNavigationTransition.prototype.isTransitional;
|
|
3563
3332
|
/**
|
|
3564
3333
|
* @type {?}
|
|
3565
3334
|
* @private
|
|
3566
3335
|
*/
|
|
3567
|
-
|
|
3336
|
+
AbstractNavigationTransition.prototype.componentDeactivationHandlers;
|
|
3568
3337
|
/**
|
|
3569
3338
|
* @type {?}
|
|
3570
3339
|
* @private
|
|
3571
3340
|
*/
|
|
3572
|
-
|
|
3341
|
+
AbstractNavigationTransition.prototype._interactionContext;
|
|
3342
|
+
/** @type {?} */
|
|
3343
|
+
AbstractNavigationTransition.prototype.isPopState;
|
|
3344
|
+
/** @type {?} */
|
|
3345
|
+
AbstractNavigationTransition.prototype.startingUrl;
|
|
3346
|
+
}
|
|
3347
|
+
class NavigationTransition extends AbstractNavigationTransition {
|
|
3348
|
+
constructor() {
|
|
3349
|
+
super(...arguments);
|
|
3350
|
+
this.isPopState = false;
|
|
3351
|
+
}
|
|
3352
|
+
/**
|
|
3353
|
+
* @param {?} event
|
|
3354
|
+
* @return {?}
|
|
3355
|
+
*/
|
|
3356
|
+
onStart(event) {
|
|
3357
|
+
// active sessions can have many cancel start cycles due
|
|
3358
|
+
// to place guard redirects
|
|
3359
|
+
return this;
|
|
3360
|
+
}
|
|
3361
|
+
/**
|
|
3362
|
+
* @param {?} event
|
|
3363
|
+
* @return {?}
|
|
3364
|
+
*/
|
|
3365
|
+
onEnd(event) {
|
|
3366
|
+
// navigation succeeded
|
|
3367
|
+
this.context.notifySuccess(this);
|
|
3368
|
+
return new Idle(this.context);
|
|
3369
|
+
}
|
|
3370
|
+
/**
|
|
3371
|
+
* @param {?} event
|
|
3372
|
+
* @return {?}
|
|
3373
|
+
*/
|
|
3374
|
+
onCancel(event) {
|
|
3375
|
+
return new Idle(this.context);
|
|
3376
|
+
}
|
|
3377
|
+
/**
|
|
3378
|
+
* @param {?} event
|
|
3379
|
+
* @return {?}
|
|
3380
|
+
*/
|
|
3381
|
+
onError(event) {
|
|
3382
|
+
// navigation was aborted.
|
|
3383
|
+
return new Idle(this.context);
|
|
3384
|
+
}
|
|
3385
|
+
/**
|
|
3386
|
+
* @return {?}
|
|
3387
|
+
*/
|
|
3388
|
+
toString() {
|
|
3389
|
+
return `${this.constructor.name}(startingUrl: ${this.startingUrl})`;
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
NavigationState.NavigationTransition = NavigationTransition;
|
|
3393
|
+
if (false) {
|
|
3573
3394
|
/** @type {?} */
|
|
3574
|
-
|
|
3395
|
+
NavigationTransition.prototype.isPopState;
|
|
3396
|
+
}
|
|
3397
|
+
class NavigationBackTransition extends AbstractNavigationTransition {
|
|
3398
|
+
constructor() {
|
|
3399
|
+
super(...arguments);
|
|
3400
|
+
this.isPopState = true;
|
|
3401
|
+
}
|
|
3402
|
+
/**
|
|
3403
|
+
* @param {?} event
|
|
3404
|
+
* @return {?}
|
|
3405
|
+
*/
|
|
3406
|
+
onCancel(event) {
|
|
3407
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
3408
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
3409
|
+
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
3410
|
+
this.resetBrowserLocation(this.startingUrl);
|
|
3411
|
+
return new Idle(this.context);
|
|
3412
|
+
}
|
|
3413
|
+
/**
|
|
3414
|
+
* @param {?} event
|
|
3415
|
+
* @return {?}
|
|
3416
|
+
*/
|
|
3417
|
+
onError(event) {
|
|
3418
|
+
// navigation was aborted.
|
|
3419
|
+
if (this.currentRouterUrl() !== this.startingUrl) {
|
|
3420
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
3421
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
3422
|
+
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
3423
|
+
this.resetBrowserLocation(this.startingUrl);
|
|
3424
|
+
}
|
|
3425
|
+
return new Idle(this.context);
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
NavigationState.NavigationBackTransition = NavigationBackTransition;
|
|
3429
|
+
if (false) {
|
|
3575
3430
|
/** @type {?} */
|
|
3576
|
-
|
|
3431
|
+
NavigationBackTransition.prototype.isPopState;
|
|
3577
3432
|
}
|
|
3578
|
-
|
|
3433
|
+
/**
|
|
3434
|
+
* @abstract
|
|
3435
|
+
*/
|
|
3436
|
+
class AbstractInteractionTransition extends NavigationState {
|
|
3579
3437
|
/**
|
|
3580
3438
|
* @param {?} context
|
|
3581
3439
|
* @param {?} startingUrl
|
|
@@ -3583,98 +3441,117 @@ if (false) {
|
|
|
3583
3441
|
constructor(context, startingUrl) {
|
|
3584
3442
|
super(context);
|
|
3585
3443
|
this.startingUrl = startingUrl;
|
|
3586
|
-
this.
|
|
3587
|
-
this.isPopState = false;
|
|
3444
|
+
this.isTransitional = true;
|
|
3588
3445
|
}
|
|
3589
3446
|
/**
|
|
3590
|
-
* @
|
|
3447
|
+
* @protected
|
|
3591
3448
|
* @return {?}
|
|
3592
3449
|
*/
|
|
3593
|
-
|
|
3594
|
-
|
|
3450
|
+
reinstateInteractionRoute() {
|
|
3451
|
+
console.log(this.startingUrl);
|
|
3452
|
+
setTimeout((/**
|
|
3453
|
+
* @return {?}
|
|
3454
|
+
*/
|
|
3455
|
+
() => this.placeRouter.syncInteractionIdsWithRouter()));
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
NavigationState.AbstractInteractionTransition = AbstractInteractionTransition;
|
|
3459
|
+
if (false) {
|
|
3460
|
+
/** @type {?} */
|
|
3461
|
+
AbstractInteractionTransition.prototype.isTransitional;
|
|
3462
|
+
/** @type {?} */
|
|
3463
|
+
AbstractInteractionTransition.prototype.startingUrl;
|
|
3464
|
+
}
|
|
3465
|
+
/**
|
|
3466
|
+
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
3467
|
+
* happily ignore interaction contexts.
|
|
3468
|
+
*/
|
|
3469
|
+
class InteractionTransition extends AbstractInteractionTransition {
|
|
3470
|
+
constructor() {
|
|
3471
|
+
super(...arguments);
|
|
3472
|
+
this.isPopState = false;
|
|
3595
3473
|
}
|
|
3596
3474
|
/**
|
|
3597
3475
|
* @param {?} event
|
|
3598
3476
|
* @return {?}
|
|
3599
3477
|
*/
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
if (!ModalInteractionSession.hasInteraction(event.url)) {
|
|
3608
|
-
// this capture the case where
|
|
3609
|
-
this.updateLocation(this.startingUrl);
|
|
3610
|
-
}
|
|
3478
|
+
onEnd(event) {
|
|
3479
|
+
if (this.context.interactionService.isActive()) {
|
|
3480
|
+
this.reinstateInteractionRoute();
|
|
3481
|
+
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
3482
|
+
}
|
|
3483
|
+
else {
|
|
3484
|
+
return new Idle(this.context);
|
|
3611
3485
|
}
|
|
3612
|
-
return this;
|
|
3613
3486
|
}
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3487
|
+
}
|
|
3488
|
+
NavigationState.InteractionTransition = InteractionTransition;
|
|
3489
|
+
if (false) {
|
|
3490
|
+
/** @type {?} */
|
|
3491
|
+
InteractionTransition.prototype.isPopState;
|
|
3492
|
+
}
|
|
3493
|
+
/**
|
|
3494
|
+
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
3495
|
+
* happily ignore interaction contexts.
|
|
3496
|
+
*/
|
|
3497
|
+
class InteractionBackTransition extends AbstractInteractionTransition {
|
|
3498
|
+
constructor() {
|
|
3499
|
+
super(...arguments);
|
|
3500
|
+
this.isPopState = true;
|
|
3621
3501
|
}
|
|
3622
3502
|
/**
|
|
3623
3503
|
* @param {?} event
|
|
3624
3504
|
* @return {?}
|
|
3625
3505
|
*/
|
|
3626
3506
|
onEnd(event) {
|
|
3627
|
-
if (this.
|
|
3628
|
-
|
|
3507
|
+
if (this.interactionService.isActive()) {
|
|
3508
|
+
this.reinstateInteractionRoute();
|
|
3509
|
+
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
3629
3510
|
}
|
|
3630
3511
|
else {
|
|
3631
3512
|
return new Idle(this.context);
|
|
3632
3513
|
}
|
|
3633
3514
|
}
|
|
3515
|
+
}
|
|
3516
|
+
NavigationState.InteractionBackTransition = InteractionBackTransition;
|
|
3517
|
+
if (false) {
|
|
3518
|
+
/** @type {?} */
|
|
3519
|
+
InteractionBackTransition.prototype.isPopState;
|
|
3520
|
+
}
|
|
3521
|
+
class IdleDuringInteraction extends NavigationState {
|
|
3522
|
+
/**
|
|
3523
|
+
* @param {?} context
|
|
3524
|
+
* @param {?} startingUrl
|
|
3525
|
+
*/
|
|
3526
|
+
constructor(context, startingUrl) {
|
|
3527
|
+
super(context);
|
|
3528
|
+
this.startingUrl = startingUrl;
|
|
3529
|
+
this.isTransitional = false;
|
|
3530
|
+
this.isPopState = false;
|
|
3531
|
+
}
|
|
3634
3532
|
/**
|
|
3635
3533
|
* @param {?} event
|
|
3636
3534
|
* @return {?}
|
|
3637
3535
|
*/
|
|
3638
|
-
|
|
3639
|
-
return this.
|
|
3536
|
+
onStart(event) {
|
|
3537
|
+
return new InteractionTransition(this.context, event.url);
|
|
3640
3538
|
}
|
|
3641
3539
|
/**
|
|
3642
|
-
* @param {?}
|
|
3643
|
-
* @param {?} nextState
|
|
3540
|
+
* @param {?} event
|
|
3644
3541
|
* @return {?}
|
|
3645
3542
|
*/
|
|
3646
|
-
|
|
3647
|
-
return
|
|
3648
|
-
return true;
|
|
3649
|
-
});
|
|
3543
|
+
onPopState(event) {
|
|
3544
|
+
return new InteractionBackTransition(this.context, event.url);
|
|
3650
3545
|
}
|
|
3651
3546
|
}
|
|
3652
|
-
|
|
3653
|
-
Trace(),
|
|
3654
|
-
__metadata("design:type", Function),
|
|
3655
|
-
__metadata("design:paramtypes", [NavigationStart]),
|
|
3656
|
-
__metadata("design:returntype", NavigationState)
|
|
3657
|
-
], ModalInteractionSession.prototype, "onStart", null);
|
|
3658
|
-
__decorate([
|
|
3659
|
-
Trace(),
|
|
3660
|
-
__metadata("design:type", Function),
|
|
3661
|
-
__metadata("design:paramtypes", [NavigationCancel]),
|
|
3662
|
-
__metadata("design:returntype", NavigationState)
|
|
3663
|
-
], ModalInteractionSession.prototype, "onCancel", null);
|
|
3664
|
-
__decorate([
|
|
3665
|
-
Trace(),
|
|
3666
|
-
__metadata("design:type", Function),
|
|
3667
|
-
__metadata("design:paramtypes", [NavigationEnd]),
|
|
3668
|
-
__metadata("design:returntype", NavigationState)
|
|
3669
|
-
], ModalInteractionSession.prototype, "onEnd", null);
|
|
3670
|
-
NavigationState.ModalInteractionSession = ModalInteractionSession;
|
|
3547
|
+
NavigationState.IdleDuringInteraction = IdleDuringInteraction;
|
|
3671
3548
|
if (false) {
|
|
3672
3549
|
/** @type {?} */
|
|
3673
|
-
|
|
3550
|
+
IdleDuringInteraction.prototype.isTransitional;
|
|
3674
3551
|
/** @type {?} */
|
|
3675
|
-
|
|
3552
|
+
IdleDuringInteraction.prototype.isPopState;
|
|
3676
3553
|
/** @type {?} */
|
|
3677
|
-
|
|
3554
|
+
IdleDuringInteraction.prototype.startingUrl;
|
|
3678
3555
|
}
|
|
3679
3556
|
class CancelledDuringNavigationInteraction extends NavigationState {
|
|
3680
3557
|
/**
|
|
@@ -3686,20 +3563,27 @@ if (false) {
|
|
|
3686
3563
|
super(context);
|
|
3687
3564
|
this.startingUrl = startingUrl;
|
|
3688
3565
|
this.locationChangeTriggerUrl = locationChangeTriggerUrl;
|
|
3689
|
-
this.
|
|
3566
|
+
this.isPopState = false;
|
|
3690
3567
|
this.capturedFauxRouterStart = false;
|
|
3691
|
-
// This will trigger a return to the route we originally started with.
|
|
3692
|
-
// this.angularLocation.go(this.startingUrl);
|
|
3693
3568
|
}
|
|
3694
3569
|
/**
|
|
3695
|
-
* @param {?} component
|
|
3696
|
-
* @param {?} nextState
|
|
3697
3570
|
* @return {?}
|
|
3698
3571
|
*/
|
|
3699
|
-
|
|
3700
|
-
return
|
|
3701
|
-
|
|
3702
|
-
|
|
3572
|
+
get isTransitional() {
|
|
3573
|
+
return !this.capturedFauxRouterStart;
|
|
3574
|
+
}
|
|
3575
|
+
/**
|
|
3576
|
+
* @param {?} event
|
|
3577
|
+
* @return {?}
|
|
3578
|
+
*/
|
|
3579
|
+
onStart(event) {
|
|
3580
|
+
if (event.url === this.locationChangeTriggerUrl && !this.capturedFauxRouterStart) {
|
|
3581
|
+
this.capturedFauxRouterStart = true;
|
|
3582
|
+
return this.ignore(event, 'url matched back button location change');
|
|
3583
|
+
}
|
|
3584
|
+
else {
|
|
3585
|
+
return this.createTransitionStateFor(event);
|
|
3586
|
+
}
|
|
3703
3587
|
}
|
|
3704
3588
|
/**
|
|
3705
3589
|
* @param {?} event
|
|
@@ -3726,14 +3610,8 @@ if (false) {
|
|
|
3726
3610
|
* @param {?} event
|
|
3727
3611
|
* @return {?}
|
|
3728
3612
|
*/
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
this.capturedFauxRouterStart = true;
|
|
3732
|
-
return this.ignore(event, 'url matched back button location change');
|
|
3733
|
-
}
|
|
3734
|
-
else {
|
|
3735
|
-
return this.createActiveSession(event);
|
|
3736
|
-
}
|
|
3613
|
+
onPopState(event) {
|
|
3614
|
+
return this.createTransitionStateFor(event);
|
|
3737
3615
|
}
|
|
3738
3616
|
/**
|
|
3739
3617
|
* @param {?} event
|
|
@@ -3754,8 +3632,6 @@ if (false) {
|
|
|
3754
3632
|
}
|
|
3755
3633
|
NavigationState.CancelledDuringNavigationInteraction = CancelledDuringNavigationInteraction;
|
|
3756
3634
|
if (false) {
|
|
3757
|
-
/** @type {?} */
|
|
3758
|
-
CancelledDuringNavigationInteraction.prototype.active;
|
|
3759
3635
|
/** @type {?} */
|
|
3760
3636
|
CancelledDuringNavigationInteraction.prototype.isPopState;
|
|
3761
3637
|
/**
|
|
@@ -3837,29 +3713,27 @@ if (false) {
|
|
|
3837
3713
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3838
3714
|
*/
|
|
3839
3715
|
class UrlSnapshot {
|
|
3716
|
+
// TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
|
|
3840
3717
|
/**
|
|
3841
|
-
* @param {?}
|
|
3842
|
-
|
|
3843
|
-
constructor(urlTree) {
|
|
3844
|
-
this.urlTree = urlTree;
|
|
3845
|
-
// console.log({ segments: this.urlTree.root.children.primary.segments });
|
|
3846
|
-
}
|
|
3847
|
-
/**
|
|
3848
|
-
* @return {?}
|
|
3718
|
+
* @param {?} urlSerializer
|
|
3719
|
+
* @param {?} url
|
|
3849
3720
|
*/
|
|
3850
|
-
|
|
3851
|
-
|
|
3721
|
+
constructor(urlSerializer, url) {
|
|
3722
|
+
this.urlSerializer = urlSerializer;
|
|
3723
|
+
this.url = url;
|
|
3724
|
+
this.urlTree = urlSerializer.parse(url);
|
|
3852
3725
|
}
|
|
3853
3726
|
/**
|
|
3727
|
+
* @protected
|
|
3854
3728
|
* @param {?} visit
|
|
3855
3729
|
* @return {?}
|
|
3856
3730
|
*/
|
|
3857
|
-
|
|
3731
|
+
replaceExistingVisitSegmentsWith(visit) {
|
|
3858
3732
|
// Ugly, but it works for now.
|
|
3859
3733
|
/** @type {?} */
|
|
3860
|
-
const segments = this.
|
|
3734
|
+
const segments = [...this.getPrimarySegments()];
|
|
3861
3735
|
/** @type {?} */
|
|
3862
|
-
const visitSegments = this.
|
|
3736
|
+
const visitSegments = this.getSegmentsFor(visit);
|
|
3863
3737
|
/** @type {?} */
|
|
3864
3738
|
const replaceAt = segments.findIndex((/**
|
|
3865
3739
|
* @param {?} segment
|
|
@@ -3870,12 +3744,20 @@ class UrlSnapshot {
|
|
|
3870
3744
|
segments.splice(replaceAt, visitSegments.length, ...visitSegments);
|
|
3871
3745
|
return segments;
|
|
3872
3746
|
}
|
|
3747
|
+
/**
|
|
3748
|
+
* @private
|
|
3749
|
+
* @return {?}
|
|
3750
|
+
*/
|
|
3751
|
+
getPrimarySegments() {
|
|
3752
|
+
return this.urlTree.root.children.primary.segments;
|
|
3753
|
+
}
|
|
3873
3754
|
/**
|
|
3874
3755
|
* Converts the visit into segments. Please not that these segments are not e
|
|
3756
|
+
* @protected
|
|
3875
3757
|
* @param {?} visit
|
|
3876
3758
|
* @return {?}
|
|
3877
3759
|
*/
|
|
3878
|
-
|
|
3760
|
+
getSegmentsFor(visit) {
|
|
3879
3761
|
return visit.placeDefinition.hasRouteId() ?
|
|
3880
3762
|
[
|
|
3881
3763
|
// NOTE:
|
|
@@ -3895,7 +3777,7 @@ class UrlSnapshot {
|
|
|
3895
3777
|
*/
|
|
3896
3778
|
createRedirectCommandsFor(visit) {
|
|
3897
3779
|
/** @type {?} */
|
|
3898
|
-
const segments = this.
|
|
3780
|
+
const segments = this.replaceExistingVisitSegmentsWith(visit);
|
|
3899
3781
|
/** @type {?} */
|
|
3900
3782
|
const commands = [];
|
|
3901
3783
|
segments.forEach((/**
|
|
@@ -3915,17 +3797,82 @@ class UrlSnapshot {
|
|
|
3915
3797
|
* @return {?}
|
|
3916
3798
|
*/
|
|
3917
3799
|
includesPathOf(placeDef) {
|
|
3918
|
-
return this.
|
|
3800
|
+
return this.getPrimarySegments().find((/**
|
|
3919
3801
|
* @param {?} s
|
|
3920
3802
|
* @return {?}
|
|
3921
3803
|
*/
|
|
3922
3804
|
s => s.path === placeDef.path));
|
|
3923
3805
|
}
|
|
3806
|
+
/**
|
|
3807
|
+
* @return {?}
|
|
3808
|
+
*/
|
|
3809
|
+
getInteractionIds() {
|
|
3810
|
+
/** @type {?} */
|
|
3811
|
+
const interactionOutlet = this.urlTree.root.children[UrlSnapshot.INTERACTION_ROUTER_OUTLET];
|
|
3812
|
+
if (interactionOutlet) {
|
|
3813
|
+
assert.isTruthy(interactionOutlet.segments.length === 2);
|
|
3814
|
+
assert.isTruthy(interactionOutlet.segments[0].path === UrlSnapshot.INTERACTION_ROUTER_PATH);
|
|
3815
|
+
return UrlSnapshot.parseInteractionIds(interactionOutlet.segments[1].path);
|
|
3816
|
+
}
|
|
3817
|
+
else {
|
|
3818
|
+
return [];
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
// @Trace()
|
|
3822
|
+
/**
|
|
3823
|
+
* @param {?} ids
|
|
3824
|
+
* @return {?}
|
|
3825
|
+
*/
|
|
3826
|
+
addOrReplaceInteractionIds(ids) {
|
|
3827
|
+
/** @type {?} */
|
|
3828
|
+
const urlTree = this.urlSerializer.parse(this.url);
|
|
3829
|
+
urlTree.root.children[UrlSnapshot.INTERACTION_ROUTER_OUTLET] = new UrlSegmentGroup([
|
|
3830
|
+
new UrlSegment(UrlSnapshot.INTERACTION_ROUTER_PATH, {}),
|
|
3831
|
+
new UrlSegment(UrlSnapshot.createPathIdFor(ids), {})
|
|
3832
|
+
], {});
|
|
3833
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
3834
|
+
}
|
|
3924
3835
|
}
|
|
3925
3836
|
if (false) {
|
|
3926
|
-
/**
|
|
3837
|
+
/**
|
|
3838
|
+
* @type {?}
|
|
3839
|
+
* @private
|
|
3840
|
+
*/
|
|
3927
3841
|
UrlSnapshot.prototype.urlTree;
|
|
3842
|
+
/** @type {?} */
|
|
3843
|
+
UrlSnapshot.prototype.urlSerializer;
|
|
3844
|
+
/** @type {?} */
|
|
3845
|
+
UrlSnapshot.prototype.url;
|
|
3928
3846
|
}
|
|
3847
|
+
(function (UrlSnapshot) {
|
|
3848
|
+
UrlSnapshot.INTERACTION_ROUTER_OUTLET = 'aup-interactions';
|
|
3849
|
+
UrlSnapshot.INTERACTION_ROUTER_PATH = 'active';
|
|
3850
|
+
UrlSnapshot.INTERACTION_ID_SEPARATOR = '--';
|
|
3851
|
+
/**
|
|
3852
|
+
* @param {?} path
|
|
3853
|
+
* @return {?}
|
|
3854
|
+
*/
|
|
3855
|
+
function parseInteractionIds(path) {
|
|
3856
|
+
return path.split(UrlSnapshot.INTERACTION_ID_SEPARATOR);
|
|
3857
|
+
}
|
|
3858
|
+
UrlSnapshot.parseInteractionIds = parseInteractionIds;
|
|
3859
|
+
/**
|
|
3860
|
+
* @param {?} interactionIds
|
|
3861
|
+
* @return {?}
|
|
3862
|
+
*/
|
|
3863
|
+
function createPathIdFor(interactionIds) {
|
|
3864
|
+
return interactionIds.join(UrlSnapshot.INTERACTION_ID_SEPARATOR);
|
|
3865
|
+
}
|
|
3866
|
+
UrlSnapshot.createPathIdFor = createPathIdFor;
|
|
3867
|
+
/**
|
|
3868
|
+
* @param {?} interactionIds
|
|
3869
|
+
* @return {?}
|
|
3870
|
+
*/
|
|
3871
|
+
function createInteractionOutletRouterCommands(interactionIds) {
|
|
3872
|
+
return [UrlSnapshot.INTERACTION_ROUTER_PATH, createPathIdFor(interactionIds)];
|
|
3873
|
+
}
|
|
3874
|
+
UrlSnapshot.createInteractionOutletRouterCommands = createInteractionOutletRouterCommands;
|
|
3875
|
+
})(UrlSnapshot || (UrlSnapshot = {}));
|
|
3929
3876
|
|
|
3930
3877
|
/**
|
|
3931
3878
|
* @fileoverview added by tsickle
|
|
@@ -3937,29 +3884,33 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3937
3884
|
* @param {?} urlSerializer
|
|
3938
3885
|
* @param {?} angularLocation
|
|
3939
3886
|
* @param {?} placeHistory
|
|
3940
|
-
* @param {?}
|
|
3887
|
+
* @param {?} interactionService
|
|
3941
3888
|
*/
|
|
3942
|
-
constructor(router, urlSerializer, angularLocation, placeHistory,
|
|
3889
|
+
constructor(router, urlSerializer, angularLocation, placeHistory, interactionService) {
|
|
3943
3890
|
super();
|
|
3944
3891
|
this.router = router;
|
|
3945
3892
|
this.urlSerializer = urlSerializer;
|
|
3946
3893
|
this.angularLocation = angularLocation;
|
|
3947
3894
|
this.placeHistory = placeHistory;
|
|
3948
|
-
this.
|
|
3949
|
-
this.
|
|
3950
|
-
this._navigationSessionModel = new MutableValueModel();
|
|
3895
|
+
this.interactionService = interactionService;
|
|
3896
|
+
this._navigationStateModel = new MutableValueModel();
|
|
3951
3897
|
this._activeVisits = new MutableListModel();
|
|
3952
3898
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
3953
3899
|
this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');
|
|
3954
|
-
this.
|
|
3955
|
-
this._navigationSessionContext = new NavigationState.Context(this
|
|
3900
|
+
this.navigationInProgress = chain(this.navigationStateModel).pluck('isTransitional');
|
|
3901
|
+
this._navigationSessionContext = new NavigationState.Context(this, this.interactionService, (/**
|
|
3956
3902
|
* @param {?} session
|
|
3957
3903
|
* @return {?}
|
|
3958
3904
|
*/
|
|
3959
3905
|
session => {
|
|
3960
3906
|
this.processNavigationSuccess(session);
|
|
3961
3907
|
}));
|
|
3962
|
-
this.
|
|
3908
|
+
this._navigationStateModel.value = new NavigationState.Idle(this._navigationSessionContext);
|
|
3909
|
+
this._navigationStateTypeModel = chain(this._navigationStateModel).map((/**
|
|
3910
|
+
* @param {?} state
|
|
3911
|
+
* @return {?}
|
|
3912
|
+
*/
|
|
3913
|
+
state => (/** @type {?} */ (state.constructor))));
|
|
3963
3914
|
// TODO: make setup the callbacks in during module initiation to make this testable.
|
|
3964
3915
|
this.router.events.subscribe((/**
|
|
3965
3916
|
* @param {?} event
|
|
@@ -3973,53 +3924,85 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3973
3924
|
// NavigationStart -> .... -> NavigationError --> navigation aborted, end session.
|
|
3974
3925
|
// =======================
|
|
3975
3926
|
if (event instanceof NavigationStart) {
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3927
|
+
console.log(event);
|
|
3928
|
+
if (event.navigationTrigger === 'popstate') {
|
|
3929
|
+
this.runStateTransition((/**
|
|
3930
|
+
* @param {?} state
|
|
3931
|
+
* @return {?}
|
|
3932
|
+
*/
|
|
3933
|
+
state => state.onPopState(event)));
|
|
3934
|
+
}
|
|
3935
|
+
else {
|
|
3936
|
+
this.runStateTransition((/**
|
|
3937
|
+
* @param {?} state
|
|
3938
|
+
* @return {?}
|
|
3939
|
+
*/
|
|
3940
|
+
state => state.onStart(event)));
|
|
3941
|
+
}
|
|
3981
3942
|
}
|
|
3982
3943
|
if (event instanceof NavigationEnd) {
|
|
3944
|
+
console.log(event);
|
|
3983
3945
|
this.runStateTransition((/**
|
|
3984
|
-
* @param {?}
|
|
3946
|
+
* @param {?} state
|
|
3985
3947
|
* @return {?}
|
|
3986
3948
|
*/
|
|
3987
|
-
|
|
3949
|
+
state => state.onEnd(event)));
|
|
3988
3950
|
}
|
|
3989
3951
|
if (event instanceof NavigationError) {
|
|
3952
|
+
console.log(event);
|
|
3990
3953
|
this.runStateTransition((/**
|
|
3991
|
-
* @param {?}
|
|
3954
|
+
* @param {?} state
|
|
3992
3955
|
* @return {?}
|
|
3993
3956
|
*/
|
|
3994
|
-
|
|
3957
|
+
state => state.onError(event)));
|
|
3995
3958
|
}
|
|
3996
3959
|
if (event instanceof NavigationCancel) {
|
|
3960
|
+
console.log(event);
|
|
3997
3961
|
this.runStateTransition((/**
|
|
3998
|
-
* @param {?}
|
|
3962
|
+
* @param {?} state
|
|
3999
3963
|
* @return {?}
|
|
4000
3964
|
*/
|
|
4001
|
-
|
|
3965
|
+
state => state.onCancel(event)));
|
|
4002
3966
|
}
|
|
4003
3967
|
}));
|
|
4004
3968
|
// Push dialog state to the url so we can capture the back button.
|
|
4005
|
-
|
|
3969
|
+
when.listOf(this.interactionService.activeInteractionContextIds).changes((/**
|
|
3970
|
+
* @param {?} ids
|
|
3971
|
+
* @param {?} previous
|
|
3972
|
+
* @return {?}
|
|
3973
|
+
*/
|
|
3974
|
+
(ids, previous) => {
|
|
3975
|
+
this.syncInteractionIdsWithRouter();
|
|
3976
|
+
}), { unless: this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
|
|
3977
|
+
// TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
|
|
3978
|
+
/** @type {?} */
|
|
3979
|
+
const urlChanges = new MutableStream();
|
|
4006
3980
|
// The angular router doesn't always fire router events when the back button is pushed while a navigation
|
|
4007
3981
|
// session is in progress. Sometimes we only know about it from the url change.
|
|
3982
|
+
// IMPORTANT ORDER DEPENDENCY
|
|
3983
|
+
// This only works because we're notified of the change after the router has started reacting to it. This
|
|
3984
|
+
// we can can use our navigationState to determine things.
|
|
4008
3985
|
angularLocation.onUrlChange((/**
|
|
4009
3986
|
* @param {?} url
|
|
4010
3987
|
* @return {?}
|
|
4011
3988
|
*/
|
|
4012
3989
|
url => {
|
|
4013
|
-
console.log(`#### url changed ->`, { url, navIsActive: this.navigationSessionActive.value });
|
|
4014
3990
|
/** @type {?} */
|
|
4015
|
-
const
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
3991
|
+
const navigationState = this._navigationStateModel.value;
|
|
3992
|
+
console.log(`URLChange -> ${url}`, { state: navigationState });
|
|
3993
|
+
urlChanges.publish({ url, state: navigationState });
|
|
3994
|
+
// We've entered a navigation transition
|
|
3995
|
+
if (navigationState instanceof NavigationState.NavigationTransition) {
|
|
3996
|
+
/** @type {?} */
|
|
3997
|
+
const navigationInteraction = this.navigationState.interactionContext;
|
|
3998
|
+
if (navigationInteraction && navigationInteraction.isActive()) {
|
|
3999
|
+
Logger.get(this).info(`back button pressed during navigation session interaction promise`);
|
|
4000
|
+
this.runStateTransition((/**
|
|
4001
|
+
* @param {?} state
|
|
4002
|
+
* @return {?}
|
|
4003
|
+
*/
|
|
4004
|
+
state => state.onBackClickedDuringNavigationInteraction(url)));
|
|
4005
|
+
}
|
|
4023
4006
|
}
|
|
4024
4007
|
}));
|
|
4025
4008
|
}
|
|
@@ -4031,7 +4014,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4031
4014
|
processNavigationSuccess(session) {
|
|
4032
4015
|
// We need to update the visits before the session finishes. This allows the placeOutets to ignore visit
|
|
4033
4016
|
// changes that occur while routerNavigationActive is true.
|
|
4034
|
-
assert.isTruthy(this.
|
|
4017
|
+
assert.isTruthy(this.navigationInProgress.value);
|
|
4035
4018
|
/** @type {?} */
|
|
4036
4019
|
const visits = session.getVisits();
|
|
4037
4020
|
visits.forEach((/**
|
|
@@ -4044,14 +4027,14 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4044
4027
|
/**
|
|
4045
4028
|
* @return {?}
|
|
4046
4029
|
*/
|
|
4047
|
-
get
|
|
4048
|
-
return this.
|
|
4030
|
+
get navigationState() {
|
|
4031
|
+
return this._navigationStateModel.value;
|
|
4049
4032
|
}
|
|
4050
4033
|
/**
|
|
4051
4034
|
* @return {?}
|
|
4052
4035
|
*/
|
|
4053
|
-
get
|
|
4054
|
-
return this.
|
|
4036
|
+
get navigationStateModel() {
|
|
4037
|
+
return this._navigationStateModel.readonly;
|
|
4055
4038
|
}
|
|
4056
4039
|
/**
|
|
4057
4040
|
* @return {?}
|
|
@@ -4103,7 +4086,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4103
4086
|
*/
|
|
4104
4087
|
router => {
|
|
4105
4088
|
/** @type {?} */
|
|
4106
|
-
const commands = this.parseUrl(this.router.routerState.snapshot).createRedirectCommandsFor(next);
|
|
4089
|
+
const commands = this.parseUrl(this.router.routerState.snapshot.url).createRedirectCommandsFor(next);
|
|
4107
4090
|
console.log('### Push Changes to route Redirect', { commands });
|
|
4108
4091
|
return router.navigate(commands);
|
|
4109
4092
|
}));
|
|
@@ -4117,7 +4100,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4117
4100
|
*/
|
|
4118
4101
|
doNavigation(visit, runNavigationCommands) {
|
|
4119
4102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4120
|
-
if (this.
|
|
4103
|
+
if (this.navigationInProgress.value) {
|
|
4121
4104
|
lang.illegalState('Navigation already in progress');
|
|
4122
4105
|
}
|
|
4123
4106
|
this.runStateTransition((/**
|
|
@@ -4126,7 +4109,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4126
4109
|
*/
|
|
4127
4110
|
current => {
|
|
4128
4111
|
/** @type {?} */
|
|
4129
|
-
const session = new NavigationState.
|
|
4112
|
+
const session = new NavigationState.NavigationTransition(this._navigationSessionContext, false, this.router.routerState.snapshot.url);
|
|
4130
4113
|
session.storeVisit(visit);
|
|
4131
4114
|
return session;
|
|
4132
4115
|
}));
|
|
@@ -4136,7 +4119,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4136
4119
|
finally {
|
|
4137
4120
|
// Router has finished (since there was no router change required) so we
|
|
4138
4121
|
// need to end the navigation session.
|
|
4139
|
-
if (this.
|
|
4122
|
+
if (this.navigationState.isTransitional && !this.router.getCurrentNavigation()) {
|
|
4140
4123
|
this.runStateTransition((/**
|
|
4141
4124
|
* @param {?} session
|
|
4142
4125
|
* @return {?}
|
|
@@ -4153,10 +4136,10 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4153
4136
|
*/
|
|
4154
4137
|
runStateTransition(transition) {
|
|
4155
4138
|
/** @type {?} */
|
|
4156
|
-
const previous = this.
|
|
4139
|
+
const previous = this._navigationStateModel.value;
|
|
4157
4140
|
/** @type {?} */
|
|
4158
|
-
const next = transition(this.
|
|
4159
|
-
this.
|
|
4141
|
+
const next = transition(this.navigationState);
|
|
4142
|
+
this._navigationStateModel.value = next;
|
|
4160
4143
|
if (next !== previous) {
|
|
4161
4144
|
previous.dispose();
|
|
4162
4145
|
Logger.get(this).info(`Router State Transition: ${previous.toString()} -> ${next.toString()}`);
|
|
@@ -4186,11 +4169,71 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4186
4169
|
child => child.url)));
|
|
4187
4170
|
}
|
|
4188
4171
|
/**
|
|
4189
|
-
* @param {?}
|
|
4172
|
+
* @param {?} url
|
|
4173
|
+
* @return {?}
|
|
4174
|
+
*/
|
|
4175
|
+
parseUrl(url) {
|
|
4176
|
+
return new UrlSnapshot(this.urlSerializer, url);
|
|
4177
|
+
}
|
|
4178
|
+
/**
|
|
4179
|
+
* @param {?} url
|
|
4180
|
+
* @return {?}
|
|
4181
|
+
*/
|
|
4182
|
+
resetBrowserLocation(url) {
|
|
4183
|
+
this.angularLocation.go(url);
|
|
4184
|
+
}
|
|
4185
|
+
/**
|
|
4186
|
+
* @return {?}
|
|
4187
|
+
*/
|
|
4188
|
+
getCurrentRouterUrl() {
|
|
4189
|
+
return this.router.routerState ? this.router.routerState.snapshot.url : null;
|
|
4190
|
+
}
|
|
4191
|
+
/**
|
|
4192
|
+
* @param {?} url
|
|
4193
|
+
* @return {?}
|
|
4194
|
+
*/
|
|
4195
|
+
getActiveInteractionIdsFromUrl(url) {
|
|
4196
|
+
return this.parseUrl(url).getInteractionIds();
|
|
4197
|
+
}
|
|
4198
|
+
// @Trace()
|
|
4199
|
+
/**
|
|
4200
|
+
* @param {?} url
|
|
4201
|
+
* @return {?}
|
|
4202
|
+
*/
|
|
4203
|
+
hasActiveInteractionIds(url) {
|
|
4204
|
+
return this.getActiveInteractionIdsFromUrl(url).length > 0;
|
|
4205
|
+
}
|
|
4206
|
+
/**
|
|
4190
4207
|
* @return {?}
|
|
4191
4208
|
*/
|
|
4192
|
-
|
|
4193
|
-
|
|
4209
|
+
syncInteractionIdsWithRouter() {
|
|
4210
|
+
assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.
|
|
4211
|
+
// Updating interaction routes during an existing navigation breaks all the things.
|
|
4212
|
+
/** @type {?} */
|
|
4213
|
+
const currentIds = this.interactionService.activeInteractionContextIds.value;
|
|
4214
|
+
if (___default.isEqual(currentIds, this.getActiveInteractionIdsFromUrl(this.getCurrentRouterUrl()))) {
|
|
4215
|
+
console.log('activity ids were the same, skipping');
|
|
4216
|
+
}
|
|
4217
|
+
else {
|
|
4218
|
+
if (currentIds.length < 1) {
|
|
4219
|
+
this.router.navigate(['.', {
|
|
4220
|
+
outlets: {
|
|
4221
|
+
[UrlSnapshot.INTERACTION_ROUTER_OUTLET]: null
|
|
4222
|
+
}
|
|
4223
|
+
}], {
|
|
4224
|
+
replaceUrl: true // remove the interaction from the history.
|
|
4225
|
+
});
|
|
4226
|
+
}
|
|
4227
|
+
else {
|
|
4228
|
+
/** @type {?} */
|
|
4229
|
+
const urlSnapshot = this.parseUrl(this.getCurrentRouterUrl());
|
|
4230
|
+
this.router.navigate(['.', {
|
|
4231
|
+
outlets: {
|
|
4232
|
+
[UrlSnapshot.INTERACTION_ROUTER_OUTLET]: UrlSnapshot.createInteractionOutletRouterCommands(currentIds)
|
|
4233
|
+
}
|
|
4234
|
+
}]);
|
|
4235
|
+
}
|
|
4236
|
+
}
|
|
4194
4237
|
}
|
|
4195
4238
|
}
|
|
4196
4239
|
PlaceRouter.decorators = [
|
|
@@ -4204,27 +4247,28 @@ PlaceRouter.ctorParameters = () => [
|
|
|
4204
4247
|
{ type: UrlSerializer },
|
|
4205
4248
|
{ type: Location },
|
|
4206
4249
|
{ type: PlaceHistory },
|
|
4207
|
-
{ type:
|
|
4250
|
+
{ type: InteractionService }
|
|
4208
4251
|
];
|
|
4209
|
-
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(Location), ɵɵinject(PlaceHistory), ɵɵinject(
|
|
4252
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(Location), ɵɵinject(PlaceHistory), ɵɵinject(InteractionService)); }, token: PlaceRouter, providedIn: "root" });
|
|
4253
|
+
__decorate([
|
|
4254
|
+
Trace(),
|
|
4255
|
+
__metadata("design:type", Function),
|
|
4256
|
+
__metadata("design:paramtypes", []),
|
|
4257
|
+
__metadata("design:returntype", void 0)
|
|
4258
|
+
], PlaceRouter.prototype, "syncInteractionIdsWithRouter", null);
|
|
4210
4259
|
if (false) {
|
|
4211
4260
|
/**
|
|
4212
4261
|
* @type {?}
|
|
4213
4262
|
* @private
|
|
4214
4263
|
*/
|
|
4215
|
-
PlaceRouter.prototype.
|
|
4216
|
-
/**
|
|
4217
|
-
* @type {?}
|
|
4218
|
-
* @private
|
|
4219
|
-
*/
|
|
4220
|
-
PlaceRouter.prototype._navigationSessionModel;
|
|
4264
|
+
PlaceRouter.prototype._navigationStateModel;
|
|
4221
4265
|
/**
|
|
4222
4266
|
* @type {?}
|
|
4223
4267
|
* @private
|
|
4224
4268
|
*/
|
|
4225
4269
|
PlaceRouter.prototype._activeVisits;
|
|
4226
4270
|
/** @type {?} */
|
|
4227
|
-
PlaceRouter.prototype.
|
|
4271
|
+
PlaceRouter.prototype.navigationInProgress;
|
|
4228
4272
|
/** @type {?} */
|
|
4229
4273
|
PlaceRouter.prototype.activeVisitIndex;
|
|
4230
4274
|
/**
|
|
@@ -4232,6 +4276,11 @@ if (false) {
|
|
|
4232
4276
|
* @private
|
|
4233
4277
|
*/
|
|
4234
4278
|
PlaceRouter.prototype._navigationSessionContext;
|
|
4279
|
+
/**
|
|
4280
|
+
* @type {?}
|
|
4281
|
+
* @private
|
|
4282
|
+
*/
|
|
4283
|
+
PlaceRouter.prototype._navigationStateTypeModel;
|
|
4235
4284
|
/**
|
|
4236
4285
|
* @type {?}
|
|
4237
4286
|
* @private
|
|
@@ -4256,65 +4305,8 @@ if (false) {
|
|
|
4256
4305
|
* @type {?}
|
|
4257
4306
|
* @private
|
|
4258
4307
|
*/
|
|
4259
|
-
PlaceRouter.prototype.
|
|
4308
|
+
PlaceRouter.prototype.interactionService;
|
|
4260
4309
|
}
|
|
4261
|
-
(function (PlaceRouter) {
|
|
4262
|
-
PlaceRouter.INTERACTION_ROUTER_OUTLET = 'aup-interaction';
|
|
4263
|
-
class InteractionRouteMediator {
|
|
4264
|
-
/**
|
|
4265
|
-
* @param {?} navigationSessionModelActive
|
|
4266
|
-
* @param {?} router
|
|
4267
|
-
*/
|
|
4268
|
-
constructor(navigationSessionModelActive, router) {
|
|
4269
|
-
this.navigationSessionModelActive = navigationSessionModelActive;
|
|
4270
|
-
this.router = router;
|
|
4271
|
-
}
|
|
4272
|
-
/**
|
|
4273
|
-
* @return {?}
|
|
4274
|
-
*/
|
|
4275
|
-
get isNavigating() {
|
|
4276
|
-
return this.navigationSessionModelActive.value;
|
|
4277
|
-
}
|
|
4278
|
-
// If we're not in a navigation we push
|
|
4279
|
-
// @Trace()
|
|
4280
|
-
/**
|
|
4281
|
-
* @return {?}
|
|
4282
|
-
*/
|
|
4283
|
-
onActivityStarted() {
|
|
4284
|
-
if (!this.isNavigating) {
|
|
4285
|
-
this.router.navigate(['.', {
|
|
4286
|
-
outlets: {
|
|
4287
|
-
[PlaceRouter.INTERACTION_ROUTER_OUTLET]: ['modal'] // "open" must be a valid route for this outlet.
|
|
4288
|
-
}
|
|
4289
|
-
}], {
|
|
4290
|
-
replaceUrl: false
|
|
4291
|
-
});
|
|
4292
|
-
}
|
|
4293
|
-
}
|
|
4294
|
-
// @Trace()
|
|
4295
|
-
/**
|
|
4296
|
-
* @return {?}
|
|
4297
|
-
*/
|
|
4298
|
-
onActivityFinished() {
|
|
4299
|
-
if (!this.isNavigating) {
|
|
4300
|
-
this.router.navigate(['.', {
|
|
4301
|
-
outlets: {
|
|
4302
|
-
[PlaceRouter.INTERACTION_ROUTER_OUTLET]: null
|
|
4303
|
-
}
|
|
4304
|
-
}], {
|
|
4305
|
-
replaceUrl: true // remove the interaction from the history.
|
|
4306
|
-
});
|
|
4307
|
-
}
|
|
4308
|
-
}
|
|
4309
|
-
}
|
|
4310
|
-
PlaceRouter.InteractionRouteMediator = InteractionRouteMediator;
|
|
4311
|
-
if (false) {
|
|
4312
|
-
/** @type {?} */
|
|
4313
|
-
InteractionRouteMediator.prototype.navigationSessionModelActive;
|
|
4314
|
-
/** @type {?} */
|
|
4315
|
-
InteractionRouteMediator.prototype.router;
|
|
4316
|
-
}
|
|
4317
|
-
})(PlaceRouter || (PlaceRouter = {}));
|
|
4318
4310
|
|
|
4319
4311
|
/**
|
|
4320
4312
|
* @fileoverview added by tsickle
|
|
@@ -4408,9 +4400,9 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
4408
4400
|
this.placeChanged = new EventEmitter();
|
|
4409
4401
|
this._activePlace = new MutableValueModel();
|
|
4410
4402
|
this._activePlaceVisitModel = new DelegatingValueModel();
|
|
4411
|
-
this._inOutletActivation = new Guard
|
|
4412
|
-
this._inOutletDeactivation = new Guard
|
|
4413
|
-
this._inRouteVisitUpdate = new Guard
|
|
4403
|
+
this._inOutletActivation = new Guard();
|
|
4404
|
+
this._inOutletDeactivation = new Guard();
|
|
4405
|
+
this._inRouteVisitUpdate = new Guard();
|
|
4414
4406
|
this._activatedRouteModel = new MutableValueModel();
|
|
4415
4407
|
this._placeDefinition = new MutableValueModel();
|
|
4416
4408
|
this.initialPlaceIndex = null;
|
|
@@ -4470,10 +4462,10 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
4470
4462
|
(next, previous) => {
|
|
4471
4463
|
this.pushVisitChangesToRoute(next, previous);
|
|
4472
4464
|
}), {
|
|
4473
|
-
unless: this.placeRouter.
|
|
4465
|
+
unless: this.placeRouter.navigationInProgress
|
|
4474
4466
|
});
|
|
4475
4467
|
chain(this._activePlace)
|
|
4476
|
-
.postponeWhile(placeRouter.
|
|
4468
|
+
.postponeWhile(placeRouter.navigationInProgress)
|
|
4477
4469
|
.subscribe((/**
|
|
4478
4470
|
* @param {?} place
|
|
4479
4471
|
* @return {?}
|
|
@@ -5393,6 +5385,201 @@ if (false) {
|
|
|
5393
5385
|
ActivityOutletContext.prototype.componentReady = function (component) { };
|
|
5394
5386
|
}
|
|
5395
5387
|
|
|
5388
|
+
/**
|
|
5389
|
+
* @fileoverview added by tsickle
|
|
5390
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5391
|
+
*/
|
|
5392
|
+
class DialogInteractionContext extends InteractionContextBase {
|
|
5393
|
+
/**
|
|
5394
|
+
* @param {?} dialogService
|
|
5395
|
+
* @param {?} config
|
|
5396
|
+
*/
|
|
5397
|
+
constructor(dialogService, config) {
|
|
5398
|
+
super();
|
|
5399
|
+
this.dialogService = dialogService;
|
|
5400
|
+
this.config = config;
|
|
5401
|
+
this._activeModel = new MutableValueModel(false);
|
|
5402
|
+
assert$1.notNil(dialogService);
|
|
5403
|
+
this.onDispose((/**
|
|
5404
|
+
* @return {?}
|
|
5405
|
+
*/
|
|
5406
|
+
() => {
|
|
5407
|
+
if (this.isActive()) {
|
|
5408
|
+
lang.illegalState('Dispose called while active.');
|
|
5409
|
+
}
|
|
5410
|
+
}));
|
|
5411
|
+
}
|
|
5412
|
+
/**
|
|
5413
|
+
* @return {?}
|
|
5414
|
+
*/
|
|
5415
|
+
get active() {
|
|
5416
|
+
return this._activeModel.readonly;
|
|
5417
|
+
}
|
|
5418
|
+
/**
|
|
5419
|
+
* @protected
|
|
5420
|
+
* @template D, R, E
|
|
5421
|
+
* @param {?} activityType
|
|
5422
|
+
* @param {?} data
|
|
5423
|
+
* @param {?=} disableClose
|
|
5424
|
+
* @return {?}
|
|
5425
|
+
*/
|
|
5426
|
+
_startActivity(activityType, data, disableClose = true) {
|
|
5427
|
+
if (this.isActive()) {
|
|
5428
|
+
lang.illegalState(`Activity already in progress: ${this.activityList.value.map((/**
|
|
5429
|
+
* @param {?} a
|
|
5430
|
+
* @return {?}
|
|
5431
|
+
*/
|
|
5432
|
+
a => a.constructor.name)).join(', ')}`);
|
|
5433
|
+
}
|
|
5434
|
+
this._activeModel.value = true;
|
|
5435
|
+
/** @type {?} */
|
|
5436
|
+
const config = Object.assign({}, this.config, {
|
|
5437
|
+
data,
|
|
5438
|
+
disableClose,
|
|
5439
|
+
panelClass: 'dialog-interaction-context'
|
|
5440
|
+
});
|
|
5441
|
+
/** @type {?} */
|
|
5442
|
+
const self = this;
|
|
5443
|
+
/** @type {?} */
|
|
5444
|
+
const matDialogRef = (/** @type {?} */ (this.dialogService.open(ActivityContainerComponent, config)));
|
|
5445
|
+
return new Promise((/**
|
|
5446
|
+
* @param {?} resolve
|
|
5447
|
+
* @param {?} reject
|
|
5448
|
+
* @return {?}
|
|
5449
|
+
*/
|
|
5450
|
+
(resolve, reject) => {
|
|
5451
|
+
/** @type {?} */
|
|
5452
|
+
const activityContainer = matDialogRef.componentInstance;
|
|
5453
|
+
self.safelyUpdateActivityListDelegate(activityContainer.activityList);
|
|
5454
|
+
activityContainer.initialActivityOutletContext = {
|
|
5455
|
+
activityClass: activityType,
|
|
5456
|
+
activityData: data,
|
|
5457
|
+
/**
|
|
5458
|
+
* @param {?} result
|
|
5459
|
+
* @return {?}
|
|
5460
|
+
*/
|
|
5461
|
+
onDone(result) {
|
|
5462
|
+
resolve(result);
|
|
5463
|
+
matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
|
|
5464
|
+
},
|
|
5465
|
+
/**
|
|
5466
|
+
* @param {?} error
|
|
5467
|
+
* @return {?}
|
|
5468
|
+
*/
|
|
5469
|
+
onCancel(error) {
|
|
5470
|
+
reject(error);
|
|
5471
|
+
matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
|
|
5472
|
+
}
|
|
5473
|
+
};
|
|
5474
|
+
// we need to check if our onDone/onCancel methods above we called or if we were
|
|
5475
|
+
// closed by the user clicking the backdrop. If the later then we need to reject
|
|
5476
|
+
// our promise.
|
|
5477
|
+
matDialogRef.afterClosed().subscribe((/**
|
|
5478
|
+
* @param {?} promiseAlreadyFinished
|
|
5479
|
+
* @return {?}
|
|
5480
|
+
*/
|
|
5481
|
+
promiseAlreadyFinished => {
|
|
5482
|
+
if (!promiseAlreadyFinished) {
|
|
5483
|
+
reject('auto-closed');
|
|
5484
|
+
}
|
|
5485
|
+
}));
|
|
5486
|
+
matDialogRef.updateSize();
|
|
5487
|
+
matDialogRef.afterOpened().subscribe((/**
|
|
5488
|
+
* @param {?} promiseAlreadyFinished
|
|
5489
|
+
* @return {?}
|
|
5490
|
+
*/
|
|
5491
|
+
promiseAlreadyFinished => {
|
|
5492
|
+
matDialogRef.updateSize();
|
|
5493
|
+
}));
|
|
5494
|
+
})).finally((/**
|
|
5495
|
+
* @return {?}
|
|
5496
|
+
*/
|
|
5497
|
+
() => {
|
|
5498
|
+
self.safelyUpdateActivityListDelegate(null);
|
|
5499
|
+
this._activeModel.value = false;
|
|
5500
|
+
}));
|
|
5501
|
+
}
|
|
5502
|
+
/**
|
|
5503
|
+
* Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
|
|
5504
|
+
* @param {?} delegate
|
|
5505
|
+
* @return {?}
|
|
5506
|
+
*/
|
|
5507
|
+
safelyUpdateActivityListDelegate(delegate) {
|
|
5508
|
+
setTimeout((/**
|
|
5509
|
+
* @return {?}
|
|
5510
|
+
*/
|
|
5511
|
+
() => this.setActivityList(delegate)));
|
|
5512
|
+
}
|
|
5513
|
+
}
|
|
5514
|
+
if (false) {
|
|
5515
|
+
/**
|
|
5516
|
+
* @type {?}
|
|
5517
|
+
* @private
|
|
5518
|
+
*/
|
|
5519
|
+
DialogInteractionContext.prototype._activeModel;
|
|
5520
|
+
/**
|
|
5521
|
+
* @type {?}
|
|
5522
|
+
* @private
|
|
5523
|
+
*/
|
|
5524
|
+
DialogInteractionContext.prototype.dialogService;
|
|
5525
|
+
/** @type {?} */
|
|
5526
|
+
DialogInteractionContext.prototype.config;
|
|
5527
|
+
}
|
|
5528
|
+
|
|
5529
|
+
/**
|
|
5530
|
+
* @fileoverview added by tsickle
|
|
5531
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5532
|
+
*/
|
|
5533
|
+
/** @type {?} */
|
|
5534
|
+
const DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
|
|
5535
|
+
class DialogInteractionContextFactory extends ModalInteractionContextFactory {
|
|
5536
|
+
/**
|
|
5537
|
+
* @param {?} dialogService
|
|
5538
|
+
* @param {?} dialogServiceDefaults
|
|
5539
|
+
* @param {?} matDialogDefaultConfig
|
|
5540
|
+
*/
|
|
5541
|
+
constructor(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
5542
|
+
super();
|
|
5543
|
+
this.dialogService = dialogService;
|
|
5544
|
+
this.dialogServiceDefaults = dialogServiceDefaults;
|
|
5545
|
+
this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
5546
|
+
assert$1.notNil(dialogService);
|
|
5547
|
+
}
|
|
5548
|
+
/**
|
|
5549
|
+
* @return {?}
|
|
5550
|
+
*/
|
|
5551
|
+
createInteractionContext() {
|
|
5552
|
+
/** @type {?} */
|
|
5553
|
+
const config = Object.assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults);
|
|
5554
|
+
return new DialogInteractionContext(this.dialogService, config);
|
|
5555
|
+
}
|
|
5556
|
+
}
|
|
5557
|
+
DialogInteractionContextFactory.decorators = [
|
|
5558
|
+
{ type: Injectable, args: [{
|
|
5559
|
+
providedIn: 'root'
|
|
5560
|
+
},] }
|
|
5561
|
+
];
|
|
5562
|
+
/** @nocollapse */
|
|
5563
|
+
DialogInteractionContextFactory.ctorParameters = () => [
|
|
5564
|
+
{ type: MatDialog },
|
|
5565
|
+
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
|
|
5566
|
+
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
|
|
5567
|
+
];
|
|
5568
|
+
/** @nocollapse */ DialogInteractionContextFactory.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionContextFactory_Factory() { return new DialogInteractionContextFactory(ɵɵinject(MatDialog$1), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionContextFactory, providedIn: "root" });
|
|
5569
|
+
if (false) {
|
|
5570
|
+
/** @type {?} */
|
|
5571
|
+
DialogInteractionContextFactory.prototype.active;
|
|
5572
|
+
/**
|
|
5573
|
+
* @type {?}
|
|
5574
|
+
* @private
|
|
5575
|
+
*/
|
|
5576
|
+
DialogInteractionContextFactory.prototype.dialogService;
|
|
5577
|
+
/** @type {?} */
|
|
5578
|
+
DialogInteractionContextFactory.prototype.dialogServiceDefaults;
|
|
5579
|
+
/** @type {?} */
|
|
5580
|
+
DialogInteractionContextFactory.prototype.matDialogDefaultConfig;
|
|
5581
|
+
}
|
|
5582
|
+
|
|
5396
5583
|
/**
|
|
5397
5584
|
* @fileoverview added by tsickle
|
|
5398
5585
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -5726,17 +5913,17 @@ class AbstractPlaceGuard {
|
|
|
5726
5913
|
/** @type {?} */
|
|
5727
5914
|
const parsedParams = placeDefinition.parseRouteParams(params);
|
|
5728
5915
|
/** @type {?} */
|
|
5729
|
-
const initialVisit = this.placeRouter.
|
|
5916
|
+
const initialVisit = this.placeRouter.navigationState.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
|
|
5730
5917
|
/** @type {?} */
|
|
5731
5918
|
const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
|
|
5732
5919
|
/** @type {?} */
|
|
5733
5920
|
const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
|
|
5734
5921
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
5735
|
-
this.placeRouter.
|
|
5922
|
+
this.placeRouter.navigationState.storeVisit(sanitisedVisit);
|
|
5736
5923
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
5737
5924
|
// Regenerate the url
|
|
5738
5925
|
/** @type {?} */
|
|
5739
|
-
const commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
|
|
5926
|
+
const commands = this.placeRouter.parseUrl(state.url).createRedirectCommandsFor(sanitisedVisit);
|
|
5740
5927
|
console.log('##### Place Guard Redirect', commands);
|
|
5741
5928
|
return this.router.createUrlTree(commands, {
|
|
5742
5929
|
replaceUrl: true,
|
|
@@ -5758,7 +5945,7 @@ class AbstractPlaceGuard {
|
|
|
5758
5945
|
*/
|
|
5759
5946
|
canDeactivate(component, currentRoute, currentState, nextState) {
|
|
5760
5947
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5761
|
-
return this.placeRouter.
|
|
5948
|
+
return this.placeRouter.navigationState.canDeactivatePlace(component, this.placeRouter.parseUrl(nextState.url));
|
|
5762
5949
|
});
|
|
5763
5950
|
}
|
|
5764
5951
|
// @Trace()
|
|
@@ -5766,22 +5953,23 @@ class AbstractPlaceGuard {
|
|
|
5766
5953
|
* @protected
|
|
5767
5954
|
* @param {?} activatedRoute
|
|
5768
5955
|
* @param {?} state
|
|
5769
|
-
* @param {?}
|
|
5956
|
+
* @param {?} runPlaceGuards
|
|
5770
5957
|
* @return {?}
|
|
5771
5958
|
*/
|
|
5772
|
-
authorisePlaceThen(activatedRoute, state,
|
|
5959
|
+
authorisePlaceThen(activatedRoute, state, runPlaceGuards) {
|
|
5773
5960
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5774
5961
|
if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
|
|
5775
5962
|
/** @type {?} */
|
|
5776
5963
|
const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
|
|
5777
5964
|
/** @type {?} */
|
|
5778
|
-
const
|
|
5779
|
-
if (
|
|
5780
|
-
|
|
5965
|
+
const authoriseResult = placeDefinition.authenticate ? yield this.isAuthorised(activatedRoute, state) : true;
|
|
5966
|
+
if (authoriseResult === true) {
|
|
5967
|
+
// we're authorised, now run the place guards.
|
|
5968
|
+
return runPlaceGuards(placeDefinition);
|
|
5781
5969
|
}
|
|
5782
5970
|
else {
|
|
5783
|
-
console.log('not authorised result',
|
|
5784
|
-
return
|
|
5971
|
+
console.log('not authorised result', authoriseResult);
|
|
5972
|
+
return authoriseResult;
|
|
5785
5973
|
}
|
|
5786
5974
|
}
|
|
5787
5975
|
else {
|
|
@@ -5852,14 +6040,14 @@ class InteractionGuard {
|
|
|
5852
6040
|
* @param {?} injector
|
|
5853
6041
|
* @param {?} placeRouter
|
|
5854
6042
|
* @param {?} angularLocation
|
|
5855
|
-
* @param {?}
|
|
6043
|
+
* @param {?} interactionService
|
|
5856
6044
|
*/
|
|
5857
|
-
constructor(router, injector, placeRouter, angularLocation,
|
|
6045
|
+
constructor(router, injector, placeRouter, angularLocation, interactionService) {
|
|
5858
6046
|
this.router = router;
|
|
5859
6047
|
this.injector = injector;
|
|
5860
6048
|
this.placeRouter = placeRouter;
|
|
5861
6049
|
this.angularLocation = angularLocation;
|
|
5862
|
-
this.
|
|
6050
|
+
this.interactionService = interactionService;
|
|
5863
6051
|
}
|
|
5864
6052
|
/**
|
|
5865
6053
|
* @param {?} route
|
|
@@ -5869,10 +6057,10 @@ class InteractionGuard {
|
|
|
5869
6057
|
canActivate(route, state) {
|
|
5870
6058
|
/** @type {?} */
|
|
5871
6059
|
const url = this.router.parseUrl(state.url);
|
|
5872
|
-
if (!this.
|
|
6060
|
+
if (!this.interactionService.isActive() && url.root.children[UrlSnapshot.INTERACTION_ROUTER_OUTLET]) {
|
|
5873
6061
|
// This happens if we reload the page or the url was pasted as the route should only be activated
|
|
5874
6062
|
// after the interaction context has become active.
|
|
5875
|
-
delete url.root.children[
|
|
6063
|
+
delete url.root.children[UrlSnapshot.INTERACTION_ROUTER_OUTLET];
|
|
5876
6064
|
return url;
|
|
5877
6065
|
}
|
|
5878
6066
|
else {
|
|
@@ -5888,16 +6076,22 @@ class InteractionGuard {
|
|
|
5888
6076
|
*/
|
|
5889
6077
|
canDeactivate(component, currentRoute, currentState, nextState) {
|
|
5890
6078
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
// The activity is still active so the route change was triggered by the back button.
|
|
6079
|
+
if (this.interactionService.isActive()) {
|
|
6080
|
+
/** @type {?} */
|
|
6081
|
+
const currentIds = this.interactionService.activeInteractionContextIds.value;
|
|
5895
6082
|
/** @type {?} */
|
|
5896
|
-
const
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
6083
|
+
const routeIds = this.placeRouter.getActiveInteractionIdsFromUrl(nextState.url);
|
|
6084
|
+
if (!isEqual(currentIds, routeIds)) {
|
|
6085
|
+
// The activity is still active so the route change was triggered by the back button.
|
|
6086
|
+
/** @type {?} */
|
|
6087
|
+
const activity = yield this.interactionService.getCurrentActivity();
|
|
6088
|
+
activity.cancel();
|
|
6089
|
+
}
|
|
5900
6090
|
}
|
|
6091
|
+
// IMPORTANT:
|
|
6092
|
+
// We always return true, the router state engine will redirect as required. Return false
|
|
6093
|
+
// during the guard causes all kinds of grief. It might be worth trying a redirect here
|
|
6094
|
+
// again now that our state engine is more thorough.
|
|
5901
6095
|
return true;
|
|
5902
6096
|
});
|
|
5903
6097
|
}
|
|
@@ -5913,9 +6107,9 @@ InteractionGuard.ctorParameters = () => [
|
|
|
5913
6107
|
{ type: Injector },
|
|
5914
6108
|
{ type: PlaceRouter },
|
|
5915
6109
|
{ type: Location },
|
|
5916
|
-
{ type:
|
|
6110
|
+
{ type: InteractionService }
|
|
5917
6111
|
];
|
|
5918
|
-
/** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(Location), ɵɵinject(
|
|
6112
|
+
/** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(Location), ɵɵinject(InteractionService)); }, token: InteractionGuard, providedIn: "root" });
|
|
5919
6113
|
if (false) {
|
|
5920
6114
|
/**
|
|
5921
6115
|
* @type {?}
|
|
@@ -5941,7 +6135,7 @@ if (false) {
|
|
|
5941
6135
|
* @type {?}
|
|
5942
6136
|
* @private
|
|
5943
6137
|
*/
|
|
5944
|
-
InteractionGuard.prototype.
|
|
6138
|
+
InteractionGuard.prototype.interactionService;
|
|
5945
6139
|
}
|
|
5946
6140
|
|
|
5947
6141
|
/**
|
|
@@ -6218,5 +6412,5 @@ if (false) {
|
|
|
6218
6412
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6219
6413
|
*/
|
|
6220
6414
|
|
|
6221
|
-
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceGuard, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext,
|
|
6415
|
+
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceGuard, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionContextBase, InteractionGuard, InteractionModule, InteractionOutletComponent, InteractionService, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionContextFactory, NavigationState, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, InteractionModule as ɵba, ActivityContainerComponent as ɵbb, InteractionContextBase as ɵbc, InteractionContext as ɵbd, ActivityOutletComponent as ɵbe, ConfirmationDialogComponent as ɵbf, AbstractActivity as ɵbg, ACTIVITY_DATA as ɵbh, Activity as ɵbi, ConfirmThenDialogComponent as ɵbk, AlertDialogComponent as ɵbl, InteractionOutletComponent as ɵbn, InplaceInteractionContextComponent as ɵbo, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, PlaceHistory as ɵu, InteractionService as ɵv, ModalInteractionContextFactory as ɵw, TabbedPlaceNavigationComponent as ɵx, AbstractPlaceNavigationComponent as ɵy, ListPlaceNavComponent as ɵz };
|
|
6222
6416
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|