@coolon/angular-ui-powerups 0.0.106 → 0.0.108
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 +108 -75
- 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.metadata.json +1 -1
- package/esm2015/lib/place/guards/navigation-state.js +41 -12
- package/esm2015/lib/place/guards/place-component-deactivation-handler.js +3 -3
- package/esm2015/lib/place/place-router.js +53 -18
- package/esm2015/lib/place/url-snapshot.js +5 -25
- package/esm5/lib/place/guards/navigation-state.js +47 -23
- package/esm5/lib/place/guards/place-component-deactivation-handler.js +2 -3
- package/esm5/lib/place/place-router.js +60 -24
- package/esm5/lib/place/url-snapshot.js +5 -31
- package/fesm2015/coolon-angular-ui-powerups.js +97 -53
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +109 -76
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/place-router.d.ts +3 -3
- package/lib/place/url-snapshot.d.ts +2 -5
- package/package.json +1 -1
|
@@ -3853,7 +3853,7 @@
|
|
|
3853
3853
|
// we always return true if we accepted promise from a previous cycle of the current
|
|
3854
3854
|
// navigation session.
|
|
3855
3855
|
if (!this.canDeactivatePromise) {
|
|
3856
|
-
console.log(
|
|
3856
|
+
// console.log(`creating deactivate promise for -> ${this.component.constructor.name}`);
|
|
3857
3857
|
this.canDeactivatePromise = this.canDeactivateComponent(currentUrl, nextState);
|
|
3858
3858
|
}
|
|
3859
3859
|
return [2 /*return*/, this.canDeactivatePromise];
|
|
@@ -3882,7 +3882,6 @@
|
|
|
3882
3882
|
return __generator(this, function (_a) {
|
|
3883
3883
|
switch (_a.label) {
|
|
3884
3884
|
case 0:
|
|
3885
|
-
console.log(this.navigationState.toString());
|
|
3886
3885
|
if (!this.navigationState.isPopState) return [3 /*break*/, 5];
|
|
3887
3886
|
if (!(this.isPrimaryComponent && this.interactionService.isModalActive())) return [3 /*break*/, 3];
|
|
3888
3887
|
routeIds = this.placeRouter.getActiveInteractionIdsFromUrl(nextState.url);
|
|
@@ -4608,11 +4607,15 @@
|
|
|
4608
4607
|
navigationTransition.storeVisit(visit);
|
|
4609
4608
|
return navigationTransition;
|
|
4610
4609
|
};
|
|
4610
|
+
// @Trace()
|
|
4611
|
+
// @Trace()
|
|
4611
4612
|
/**
|
|
4612
4613
|
* @param {?} event
|
|
4613
4614
|
* @return {?}
|
|
4614
4615
|
*/
|
|
4615
|
-
IdleDuringInteraction.prototype.onRouterStarted =
|
|
4616
|
+
IdleDuringInteraction.prototype.onRouterStarted =
|
|
4617
|
+
// @Trace()
|
|
4618
|
+
/**
|
|
4616
4619
|
* @param {?} event
|
|
4617
4620
|
* @return {?}
|
|
4618
4621
|
*/
|
|
@@ -4630,12 +4633,6 @@
|
|
|
4630
4633
|
function (event) {
|
|
4631
4634
|
return new InteractionPopStateTransition(this.context, event.url);
|
|
4632
4635
|
};
|
|
4633
|
-
__decorate([
|
|
4634
|
-
pectin.Trace(),
|
|
4635
|
-
__metadata("design:type", Function),
|
|
4636
|
-
__metadata("design:paramtypes", [router.NavigationStart]),
|
|
4637
|
-
__metadata("design:returntype", NavigationState)
|
|
4638
|
-
], IdleDuringInteraction.prototype, "onRouterStarted", null);
|
|
4639
4636
|
__decorate([
|
|
4640
4637
|
pectin.Trace(),
|
|
4641
4638
|
__metadata("design:type", Function),
|
|
@@ -4680,11 +4677,7 @@
|
|
|
4680
4677
|
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
4681
4678
|
* happily ignore interaction contexts.
|
|
4682
4679
|
*/
|
|
4683
|
-
var /**
|
|
4684
|
-
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
4685
|
-
* happily ignore interaction contexts.
|
|
4686
|
-
*/
|
|
4687
|
-
InteractionTransition = /** @class */ (function (_super) {
|
|
4680
|
+
var InteractionTransition = /** @class */ (function (_super) {
|
|
4688
4681
|
__extends(InteractionTransition, _super);
|
|
4689
4682
|
function InteractionTransition() {
|
|
4690
4683
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -4738,6 +4731,24 @@
|
|
|
4738
4731
|
return new Idle(this.context);
|
|
4739
4732
|
}
|
|
4740
4733
|
};
|
|
4734
|
+
__decorate([
|
|
4735
|
+
pectin.Trace(),
|
|
4736
|
+
__metadata("design:type", Function),
|
|
4737
|
+
__metadata("design:paramtypes", [router.NavigationCancel]),
|
|
4738
|
+
__metadata("design:returntype", NavigationState)
|
|
4739
|
+
], InteractionTransition.prototype, "onRouterCancelled", null);
|
|
4740
|
+
__decorate([
|
|
4741
|
+
pectin.Trace(),
|
|
4742
|
+
__metadata("design:type", Function),
|
|
4743
|
+
__metadata("design:paramtypes", [router.NavigationError]),
|
|
4744
|
+
__metadata("design:returntype", NavigationState)
|
|
4745
|
+
], InteractionTransition.prototype, "onRouterError", null);
|
|
4746
|
+
__decorate([
|
|
4747
|
+
pectin.Trace(),
|
|
4748
|
+
__metadata("design:type", Function),
|
|
4749
|
+
__metadata("design:paramtypes", [router.NavigationEnd]),
|
|
4750
|
+
__metadata("design:returntype", NavigationState)
|
|
4751
|
+
], InteractionTransition.prototype, "onRouterEnd", null);
|
|
4741
4752
|
return InteractionTransition;
|
|
4742
4753
|
}(AbstractInteractionTransition));
|
|
4743
4754
|
NavigationState.InteractionTransition = InteractionTransition;
|
|
@@ -4749,11 +4760,7 @@
|
|
|
4749
4760
|
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
4750
4761
|
* happily ignore interaction contexts.
|
|
4751
4762
|
*/
|
|
4752
|
-
var /**
|
|
4753
|
-
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
4754
|
-
* happily ignore interaction contexts.
|
|
4755
|
-
*/
|
|
4756
|
-
InteractionPopStateTransition = /** @class */ (function (_super) {
|
|
4763
|
+
var InteractionPopStateTransition = /** @class */ (function (_super) {
|
|
4757
4764
|
__extends(InteractionPopStateTransition, _super);
|
|
4758
4765
|
function InteractionPopStateTransition() {
|
|
4759
4766
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -4795,6 +4802,18 @@
|
|
|
4795
4802
|
return new Idle(this.context);
|
|
4796
4803
|
}
|
|
4797
4804
|
};
|
|
4805
|
+
__decorate([
|
|
4806
|
+
pectin.Trace(),
|
|
4807
|
+
__metadata("design:type", Function),
|
|
4808
|
+
__metadata("design:paramtypes", [router.NavigationCancel]),
|
|
4809
|
+
__metadata("design:returntype", NavigationState)
|
|
4810
|
+
], InteractionPopStateTransition.prototype, "onRouterCancelled", null);
|
|
4811
|
+
__decorate([
|
|
4812
|
+
pectin.Trace(),
|
|
4813
|
+
__metadata("design:type", Function),
|
|
4814
|
+
__metadata("design:paramtypes", [router.NavigationEnd]),
|
|
4815
|
+
__metadata("design:returntype", NavigationState)
|
|
4816
|
+
], InteractionPopStateTransition.prototype, "onRouterEnd", null);
|
|
4798
4817
|
return InteractionPopStateTransition;
|
|
4799
4818
|
}(AbstractInteractionTransition));
|
|
4800
4819
|
NavigationState.InteractionPopStateTransition = InteractionPopStateTransition;
|
|
@@ -4844,10 +4863,14 @@
|
|
|
4844
4863
|
*/
|
|
4845
4864
|
function (event) {
|
|
4846
4865
|
// Depending on the state of the router and what was done we get a different
|
|
4847
|
-
// sequence of events.
|
|
4848
|
-
// with the locationChangeTriggerUrl as the final event.
|
|
4849
|
-
//
|
|
4850
|
-
|
|
4866
|
+
// sequence of events.
|
|
4867
|
+
// If the navigation change was triggered by clicking a link we'll get a cancel with the locationChangeTriggerUrl as the final event.
|
|
4868
|
+
// If the navigation change was triggered with a pop state then we'll get an onPopState with the locationChangeTriggerUrl but no cancel event with it.
|
|
4869
|
+
if (this.gotPopStateWithLeavingUrl && this.interactionService.isActive()) {
|
|
4870
|
+
/** @type {?} */
|
|
4871
|
+
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
4872
|
+
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
4873
|
+
}
|
|
4851
4874
|
return this.gotPopStateWithLeavingUrl || this.locationChangeTriggerUrl === event.url ? this.createIdleState() : this.ignore(event);
|
|
4852
4875
|
};
|
|
4853
4876
|
/**
|
|
@@ -5043,10 +5066,9 @@
|
|
|
5043
5066
|
*/
|
|
5044
5067
|
exports.UrlSnapshot = /** @class */ (function () {
|
|
5045
5068
|
// TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
|
|
5046
|
-
function UrlSnapshot(urlSerializer, url
|
|
5069
|
+
function UrlSnapshot(urlSerializer, url) {
|
|
5047
5070
|
this.urlSerializer = urlSerializer;
|
|
5048
5071
|
this.url = url;
|
|
5049
|
-
this.options = options;
|
|
5050
5072
|
this.urlTree = urlSerializer.parse(url);
|
|
5051
5073
|
}
|
|
5052
5074
|
/**
|
|
@@ -5074,7 +5096,7 @@
|
|
|
5074
5096
|
// do not use the return value, it's the items that were removed!
|
|
5075
5097
|
segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
|
|
5076
5098
|
urlTree.root.children.primary.segments = segments;
|
|
5077
|
-
return new UrlSnapshot(this.urlSerializer, urlTree.toString()
|
|
5099
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
5078
5100
|
};
|
|
5079
5101
|
/**
|
|
5080
5102
|
* @private
|
|
@@ -5179,7 +5201,7 @@
|
|
|
5179
5201
|
/** @type {?} */
|
|
5180
5202
|
var urlTree = this.urlSerializer.parse(this.url);
|
|
5181
5203
|
urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM] = UrlSnapshot.createPathIdFor(ids);
|
|
5182
|
-
return new UrlSnapshot(this.urlSerializer, urlTree.toString()
|
|
5204
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
5183
5205
|
}
|
|
5184
5206
|
};
|
|
5185
5207
|
// @Trace()
|
|
@@ -5198,27 +5220,7 @@
|
|
|
5198
5220
|
if (urlTree.queryParams && urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM]) {
|
|
5199
5221
|
urlTree.queryParams = {}; //[UrlSnapshot.INTERACTION_ROUTER_OUTLET]
|
|
5200
5222
|
}
|
|
5201
|
-
return new UrlSnapshot(this.urlSerializer, urlTree.toString()
|
|
5202
|
-
};
|
|
5203
|
-
/**
|
|
5204
|
-
* @param {?} options
|
|
5205
|
-
* @return {?}
|
|
5206
|
-
*/
|
|
5207
|
-
UrlSnapshot.prototype.withOptions = /**
|
|
5208
|
-
* @param {?} options
|
|
5209
|
-
* @return {?}
|
|
5210
|
-
*/
|
|
5211
|
-
function (options) {
|
|
5212
|
-
return new UrlSnapshot(this.urlSerializer, this.url, options);
|
|
5213
|
-
};
|
|
5214
|
-
/**
|
|
5215
|
-
* @return {?}
|
|
5216
|
-
*/
|
|
5217
|
-
UrlSnapshot.prototype.getNavigationExtras = /**
|
|
5218
|
-
* @return {?}
|
|
5219
|
-
*/
|
|
5220
|
-
function () {
|
|
5221
|
-
return this.options;
|
|
5223
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
5222
5224
|
};
|
|
5223
5225
|
return UrlSnapshot;
|
|
5224
5226
|
}());
|
|
@@ -5229,11 +5231,6 @@
|
|
|
5229
5231
|
exports.UrlSnapshot.prototype.urlSerializer;
|
|
5230
5232
|
/** @type {?} */
|
|
5231
5233
|
exports.UrlSnapshot.prototype.url;
|
|
5232
|
-
/**
|
|
5233
|
-
* @type {?}
|
|
5234
|
-
* @private
|
|
5235
|
-
*/
|
|
5236
|
-
exports.UrlSnapshot.prototype.options;
|
|
5237
5234
|
}
|
|
5238
5235
|
(function (UrlSnapshot) {
|
|
5239
5236
|
UrlSnapshot.INTERACTION_QUERY_PARAM = 'aup-interactions';
|
|
@@ -5356,7 +5353,7 @@
|
|
|
5356
5353
|
* @return {?}
|
|
5357
5354
|
*/
|
|
5358
5355
|
function (ids, previous) {
|
|
5359
|
-
_this.syncInteractionIdsWithRouter();
|
|
5356
|
+
_this.syncInteractionIdsWithRouter(ids, previous);
|
|
5360
5357
|
}), { unless: _this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
|
|
5361
5358
|
// TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
|
|
5362
5359
|
/** @type {?} */
|
|
@@ -5647,7 +5644,7 @@
|
|
|
5647
5644
|
* @return {?}
|
|
5648
5645
|
*/
|
|
5649
5646
|
function (url) {
|
|
5650
|
-
return new exports.UrlSnapshot(this.urlSerializer, url
|
|
5647
|
+
return new exports.UrlSnapshot(this.urlSerializer, url);
|
|
5651
5648
|
};
|
|
5652
5649
|
/**
|
|
5653
5650
|
* @param {?} url
|
|
@@ -5729,47 +5726,77 @@
|
|
|
5729
5726
|
function (url) {
|
|
5730
5727
|
return this.getActiveInteractionIdsFromUrl(url).length > 0;
|
|
5731
5728
|
};
|
|
5732
|
-
// @Trace()
|
|
5733
|
-
// @Trace()
|
|
5734
5729
|
/**
|
|
5735
5730
|
* @param {?} urlSnapshot
|
|
5731
|
+
* @param {?=} navigationExtras
|
|
5736
5732
|
* @return {?}
|
|
5737
5733
|
*/
|
|
5738
|
-
PlaceRouter.prototype.navigateByUrl =
|
|
5739
|
-
// @Trace()
|
|
5740
|
-
/**
|
|
5734
|
+
PlaceRouter.prototype.navigateByUrl = /**
|
|
5741
5735
|
* @param {?} urlSnapshot
|
|
5736
|
+
* @param {?=} navigationExtras
|
|
5742
5737
|
* @return {?}
|
|
5743
5738
|
*/
|
|
5744
|
-
function (urlSnapshot) {
|
|
5745
|
-
this.router.navigateByUrl(urlSnapshot.urlTree,
|
|
5739
|
+
function (urlSnapshot, navigationExtras) {
|
|
5740
|
+
return this.router.navigateByUrl(urlSnapshot.urlTree, navigationExtras);
|
|
5746
5741
|
};
|
|
5747
|
-
//
|
|
5748
|
-
//
|
|
5742
|
+
// TODO: Should this be moved to the navigation states?
|
|
5743
|
+
// TODO: Should this be moved to the navigation states?
|
|
5749
5744
|
/**
|
|
5745
|
+
* @param {?} currentIds
|
|
5746
|
+
* @param {?} previous
|
|
5750
5747
|
* @return {?}
|
|
5751
5748
|
*/
|
|
5752
5749
|
PlaceRouter.prototype.syncInteractionIdsWithRouter =
|
|
5753
|
-
//
|
|
5750
|
+
// TODO: Should this be moved to the navigation states?
|
|
5754
5751
|
/**
|
|
5752
|
+
* @param {?} currentIds
|
|
5753
|
+
* @param {?} previous
|
|
5755
5754
|
* @return {?}
|
|
5756
5755
|
*/
|
|
5757
|
-
function () {
|
|
5756
|
+
function (currentIds, previous) {
|
|
5757
|
+
var _this = this;
|
|
5758
5758
|
pectin.assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5759
|
+
console.log({
|
|
5760
|
+
startingActivity: currentIds.length > previous.length,
|
|
5761
|
+
wasBackButton: this.navigationState.isPopState
|
|
5762
|
+
});
|
|
5763
|
+
if (___default__default.isEqual(currentIds, previous)) {
|
|
5763
5764
|
console.log('activity ids were the same, skipping');
|
|
5764
5765
|
}
|
|
5765
5766
|
else {
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5767
|
+
// OMG, this is nuts.
|
|
5768
|
+
/** @type {?} */
|
|
5769
|
+
var addingActivity = currentIds.length > previous.length;
|
|
5770
|
+
/** @type {?} */
|
|
5771
|
+
var isFirstActivity = addingActivity && previous.length < 1;
|
|
5772
|
+
/** @type {?} */
|
|
5773
|
+
var removingLastActivity = currentIds.length < 1;
|
|
5774
|
+
if (addingActivity) { // we're starting a new activity, push the change to the history and update the url
|
|
5775
|
+
console.log('adding activity');
|
|
5776
|
+
this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds), {
|
|
5777
|
+
replaceUrl: !isFirstActivity // we don't let the history pile up
|
|
5778
|
+
});
|
|
5769
5779
|
}
|
|
5770
5780
|
else {
|
|
5771
|
-
|
|
5772
|
-
this.
|
|
5781
|
+
/** @type {?} */
|
|
5782
|
+
var urlSnapshot = this.getCurrentRouteSnapshot().updateInteractionIds(currentIds);
|
|
5783
|
+
if (removingLastActivity) {
|
|
5784
|
+
this.navigateByUrl(urlSnapshot, {
|
|
5785
|
+
replaceUrl: true
|
|
5786
|
+
}).then((/**
|
|
5787
|
+
* @return {?}
|
|
5788
|
+
*/
|
|
5789
|
+
function () {
|
|
5790
|
+
// for some reason we need to pop the last history off the stack when leaving the
|
|
5791
|
+
// active activity state.
|
|
5792
|
+
_this.angularLocation.back();
|
|
5793
|
+
}));
|
|
5794
|
+
}
|
|
5795
|
+
else {
|
|
5796
|
+
this.navigateByUrl(urlSnapshot, {
|
|
5797
|
+
replaceUrl: true
|
|
5798
|
+
});
|
|
5799
|
+
}
|
|
5773
5800
|
}
|
|
5774
5801
|
}
|
|
5775
5802
|
};
|
|
@@ -5787,6 +5814,12 @@
|
|
|
5787
5814
|
{ type: exports.ɵv }
|
|
5788
5815
|
]; };
|
|
5789
5816
|
/** @nocollapse */ PlaceRouter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(router.UrlSerializer), core.ɵɵinject(common.Location), core.ɵɵinject(PlaceHistory), core.ɵɵinject(exports.ɵv)); }, token: PlaceRouter, providedIn: "root" });
|
|
5817
|
+
__decorate([
|
|
5818
|
+
pectin.Trace(),
|
|
5819
|
+
__metadata("design:type", Function),
|
|
5820
|
+
__metadata("design:paramtypes", [exports.UrlSnapshot, Object]),
|
|
5821
|
+
__metadata("design:returntype", Promise)
|
|
5822
|
+
], PlaceRouter.prototype, "navigateByUrl", null);
|
|
5790
5823
|
return PlaceRouter;
|
|
5791
5824
|
}(pectin.GarbageCollector));
|
|
5792
5825
|
if (false) {
|