@coolon/angular-ui-powerups 0.0.106 → 0.0.107
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 +100 -71
- 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 +33 -8
- 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 +39 -19
- 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 +89 -49
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +101 -72
- 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;
|
|
@@ -5043,10 +5062,9 @@
|
|
|
5043
5062
|
*/
|
|
5044
5063
|
exports.UrlSnapshot = /** @class */ (function () {
|
|
5045
5064
|
// 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
|
|
5065
|
+
function UrlSnapshot(urlSerializer, url) {
|
|
5047
5066
|
this.urlSerializer = urlSerializer;
|
|
5048
5067
|
this.url = url;
|
|
5049
|
-
this.options = options;
|
|
5050
5068
|
this.urlTree = urlSerializer.parse(url);
|
|
5051
5069
|
}
|
|
5052
5070
|
/**
|
|
@@ -5074,7 +5092,7 @@
|
|
|
5074
5092
|
// do not use the return value, it's the items that were removed!
|
|
5075
5093
|
segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
|
|
5076
5094
|
urlTree.root.children.primary.segments = segments;
|
|
5077
|
-
return new UrlSnapshot(this.urlSerializer, urlTree.toString()
|
|
5095
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
5078
5096
|
};
|
|
5079
5097
|
/**
|
|
5080
5098
|
* @private
|
|
@@ -5179,7 +5197,7 @@
|
|
|
5179
5197
|
/** @type {?} */
|
|
5180
5198
|
var urlTree = this.urlSerializer.parse(this.url);
|
|
5181
5199
|
urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM] = UrlSnapshot.createPathIdFor(ids);
|
|
5182
|
-
return new UrlSnapshot(this.urlSerializer, urlTree.toString()
|
|
5200
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
5183
5201
|
}
|
|
5184
5202
|
};
|
|
5185
5203
|
// @Trace()
|
|
@@ -5198,27 +5216,7 @@
|
|
|
5198
5216
|
if (urlTree.queryParams && urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM]) {
|
|
5199
5217
|
urlTree.queryParams = {}; //[UrlSnapshot.INTERACTION_ROUTER_OUTLET]
|
|
5200
5218
|
}
|
|
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;
|
|
5219
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
5222
5220
|
};
|
|
5223
5221
|
return UrlSnapshot;
|
|
5224
5222
|
}());
|
|
@@ -5229,11 +5227,6 @@
|
|
|
5229
5227
|
exports.UrlSnapshot.prototype.urlSerializer;
|
|
5230
5228
|
/** @type {?} */
|
|
5231
5229
|
exports.UrlSnapshot.prototype.url;
|
|
5232
|
-
/**
|
|
5233
|
-
* @type {?}
|
|
5234
|
-
* @private
|
|
5235
|
-
*/
|
|
5236
|
-
exports.UrlSnapshot.prototype.options;
|
|
5237
5230
|
}
|
|
5238
5231
|
(function (UrlSnapshot) {
|
|
5239
5232
|
UrlSnapshot.INTERACTION_QUERY_PARAM = 'aup-interactions';
|
|
@@ -5356,7 +5349,7 @@
|
|
|
5356
5349
|
* @return {?}
|
|
5357
5350
|
*/
|
|
5358
5351
|
function (ids, previous) {
|
|
5359
|
-
_this.syncInteractionIdsWithRouter();
|
|
5352
|
+
_this.syncInteractionIdsWithRouter(ids, previous);
|
|
5360
5353
|
}), { unless: _this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
|
|
5361
5354
|
// TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
|
|
5362
5355
|
/** @type {?} */
|
|
@@ -5647,7 +5640,7 @@
|
|
|
5647
5640
|
* @return {?}
|
|
5648
5641
|
*/
|
|
5649
5642
|
function (url) {
|
|
5650
|
-
return new exports.UrlSnapshot(this.urlSerializer, url
|
|
5643
|
+
return new exports.UrlSnapshot(this.urlSerializer, url);
|
|
5651
5644
|
};
|
|
5652
5645
|
/**
|
|
5653
5646
|
* @param {?} url
|
|
@@ -5729,47 +5722,77 @@
|
|
|
5729
5722
|
function (url) {
|
|
5730
5723
|
return this.getActiveInteractionIdsFromUrl(url).length > 0;
|
|
5731
5724
|
};
|
|
5732
|
-
// @Trace()
|
|
5733
|
-
// @Trace()
|
|
5734
5725
|
/**
|
|
5735
5726
|
* @param {?} urlSnapshot
|
|
5727
|
+
* @param {?=} navigationExtras
|
|
5736
5728
|
* @return {?}
|
|
5737
5729
|
*/
|
|
5738
|
-
PlaceRouter.prototype.navigateByUrl =
|
|
5739
|
-
// @Trace()
|
|
5740
|
-
/**
|
|
5730
|
+
PlaceRouter.prototype.navigateByUrl = /**
|
|
5741
5731
|
* @param {?} urlSnapshot
|
|
5732
|
+
* @param {?=} navigationExtras
|
|
5742
5733
|
* @return {?}
|
|
5743
5734
|
*/
|
|
5744
|
-
function (urlSnapshot) {
|
|
5745
|
-
this.router.navigateByUrl(urlSnapshot.urlTree,
|
|
5735
|
+
function (urlSnapshot, navigationExtras) {
|
|
5736
|
+
return this.router.navigateByUrl(urlSnapshot.urlTree, navigationExtras);
|
|
5746
5737
|
};
|
|
5747
|
-
//
|
|
5748
|
-
//
|
|
5738
|
+
// TODO: Should this be moved to the navigation states?
|
|
5739
|
+
// TODO: Should this be moved to the navigation states?
|
|
5749
5740
|
/**
|
|
5741
|
+
* @param {?} currentIds
|
|
5742
|
+
* @param {?} previous
|
|
5750
5743
|
* @return {?}
|
|
5751
5744
|
*/
|
|
5752
5745
|
PlaceRouter.prototype.syncInteractionIdsWithRouter =
|
|
5753
|
-
//
|
|
5746
|
+
// TODO: Should this be moved to the navigation states?
|
|
5754
5747
|
/**
|
|
5748
|
+
* @param {?} currentIds
|
|
5749
|
+
* @param {?} previous
|
|
5755
5750
|
* @return {?}
|
|
5756
5751
|
*/
|
|
5757
|
-
function () {
|
|
5752
|
+
function (currentIds, previous) {
|
|
5753
|
+
var _this = this;
|
|
5758
5754
|
pectin.assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5755
|
+
console.log({
|
|
5756
|
+
startingActivity: currentIds.length > previous.length,
|
|
5757
|
+
wasBackButton: this.navigationState.isPopState
|
|
5758
|
+
});
|
|
5759
|
+
if (___default__default.isEqual(currentIds, previous)) {
|
|
5763
5760
|
console.log('activity ids were the same, skipping');
|
|
5764
5761
|
}
|
|
5765
5762
|
else {
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5763
|
+
// OMG, this is nuts.
|
|
5764
|
+
/** @type {?} */
|
|
5765
|
+
var addingActivity = currentIds.length > previous.length;
|
|
5766
|
+
/** @type {?} */
|
|
5767
|
+
var isFirstActivity = addingActivity && previous.length < 1;
|
|
5768
|
+
/** @type {?} */
|
|
5769
|
+
var removingLastActivity = currentIds.length < 1;
|
|
5770
|
+
if (addingActivity) { // we're starting a new activity, push the change to the history and update the url
|
|
5771
|
+
console.log('adding activity');
|
|
5772
|
+
this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds), {
|
|
5773
|
+
replaceUrl: !isFirstActivity // we don't let the history pile up
|
|
5774
|
+
});
|
|
5769
5775
|
}
|
|
5770
5776
|
else {
|
|
5771
|
-
|
|
5772
|
-
this.
|
|
5777
|
+
/** @type {?} */
|
|
5778
|
+
var urlSnapshot = this.getCurrentRouteSnapshot().updateInteractionIds(currentIds);
|
|
5779
|
+
if (removingLastActivity) {
|
|
5780
|
+
this.navigateByUrl(urlSnapshot, {
|
|
5781
|
+
replaceUrl: true
|
|
5782
|
+
}).then((/**
|
|
5783
|
+
* @return {?}
|
|
5784
|
+
*/
|
|
5785
|
+
function () {
|
|
5786
|
+
// for some reason we need to pop the last history off the stack when leaving the
|
|
5787
|
+
// active activity state.
|
|
5788
|
+
_this.angularLocation.back();
|
|
5789
|
+
}));
|
|
5790
|
+
}
|
|
5791
|
+
else {
|
|
5792
|
+
this.navigateByUrl(urlSnapshot, {
|
|
5793
|
+
replaceUrl: true
|
|
5794
|
+
});
|
|
5795
|
+
}
|
|
5773
5796
|
}
|
|
5774
5797
|
}
|
|
5775
5798
|
};
|
|
@@ -5787,6 +5810,12 @@
|
|
|
5787
5810
|
{ type: exports.ɵv }
|
|
5788
5811
|
]; };
|
|
5789
5812
|
/** @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" });
|
|
5813
|
+
__decorate([
|
|
5814
|
+
pectin.Trace(),
|
|
5815
|
+
__metadata("design:type", Function),
|
|
5816
|
+
__metadata("design:paramtypes", [exports.UrlSnapshot, Object]),
|
|
5817
|
+
__metadata("design:returntype", Promise)
|
|
5818
|
+
], PlaceRouter.prototype, "navigateByUrl", null);
|
|
5790
5819
|
return PlaceRouter;
|
|
5791
5820
|
}(pectin.GarbageCollector));
|
|
5792
5821
|
if (false) {
|