@coolon/angular-ui-powerups 0.0.116 → 0.0.118
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 +730 -158
- 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/esm2015/lib/place/guards/navigation-state.js +507 -97
- package/esm2015/lib/place/guards/navigation-state.js.map +1 -1
- package/esm2015/lib/place/guards/navigation-state.metadata.json +1 -1
- package/esm2015/lib/place/route/parameter-decorators.js +4 -1
- package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
- package/esm5/lib/place/guards/navigation-state.js +726 -157
- package/esm5/lib/place/guards/navigation-state.js.map +1 -1
- package/esm5/lib/place/route/parameter-decorators.js +4 -1
- package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +512 -99
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +730 -158
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/guards/navigation-state.d.ts +111 -16
- package/package.json +2 -2
|
@@ -17,6 +17,7 @@ NavigationState = /** @class */ (function (_super) {
|
|
|
17
17
|
var _this = _super.call(this) || this;
|
|
18
18
|
_this.context = context;
|
|
19
19
|
_this._visits = new Map();
|
|
20
|
+
_this.debugPropertyKeys = [];
|
|
20
21
|
return _this;
|
|
21
22
|
}
|
|
22
23
|
Object.defineProperty(NavigationState.prototype, "name", {
|
|
@@ -237,14 +238,18 @@ NavigationState = /** @class */ (function (_super) {
|
|
|
237
238
|
function (event) {
|
|
238
239
|
/** @type {?} */
|
|
239
240
|
var popstate = event.navigationTrigger === 'popstate';
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
this.
|
|
246
|
-
|
|
247
|
-
|
|
241
|
+
/** @type {?} */
|
|
242
|
+
var inInteraction = this.interactionService.isActive();
|
|
243
|
+
if (popstate) {
|
|
244
|
+
return inInteraction ?
|
|
245
|
+
new NavigationState.LeavingInteractionAfterPopStateTransition(this.context, this.currentRouterUrl(), event.url) :
|
|
246
|
+
new NavigationState.PopStateTransition(this.context, this.currentRouterUrl(), event.url);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
return inInteraction ?
|
|
250
|
+
new NavigationState.StartingInteractionTransition(this.context, this.currentRouterUrl()) :
|
|
251
|
+
new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());
|
|
252
|
+
}
|
|
248
253
|
};
|
|
249
254
|
/**
|
|
250
255
|
* @protected
|
|
@@ -259,17 +264,36 @@ NavigationState = /** @class */ (function (_super) {
|
|
|
259
264
|
new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
|
|
260
265
|
new NavigationState.Idle(this.context);
|
|
261
266
|
};
|
|
267
|
+
//
|
|
268
|
+
//
|
|
262
269
|
/**
|
|
263
270
|
* @param {?} url
|
|
264
271
|
* @return {?}
|
|
265
272
|
*/
|
|
266
|
-
NavigationState.prototype.resetBrowserLocation =
|
|
273
|
+
NavigationState.prototype.resetBrowserLocation =
|
|
274
|
+
//
|
|
275
|
+
/**
|
|
267
276
|
* @param {?} url
|
|
268
277
|
* @return {?}
|
|
269
278
|
*/
|
|
270
279
|
function (url) {
|
|
271
280
|
this.placeRouter.resetBrowserLocation(url);
|
|
272
281
|
};
|
|
282
|
+
/**
|
|
283
|
+
* @param {?} event
|
|
284
|
+
* @param {?=} reason
|
|
285
|
+
* @return {?}
|
|
286
|
+
*/
|
|
287
|
+
NavigationState.prototype.ignore = /**
|
|
288
|
+
* @param {?} event
|
|
289
|
+
* @param {?=} reason
|
|
290
|
+
* @return {?}
|
|
291
|
+
*/
|
|
292
|
+
function (event, reason) {
|
|
293
|
+
reason = reason ? " -> " + reason : '';
|
|
294
|
+
Logger.get(this).info("Ignoring router event" + reason + ": " + event.constructor.name + " -> " + event.url + " :: " + this.toString());
|
|
295
|
+
return this;
|
|
296
|
+
};
|
|
273
297
|
/**
|
|
274
298
|
* @return {?}
|
|
275
299
|
*/
|
|
@@ -277,7 +301,27 @@ NavigationState = /** @class */ (function (_super) {
|
|
|
277
301
|
* @return {?}
|
|
278
302
|
*/
|
|
279
303
|
function () {
|
|
280
|
-
return this.constructor.name;
|
|
304
|
+
return this.constructor.name + "(" + this.debugState() + ")";
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* @protected
|
|
308
|
+
* @param {?=} properties
|
|
309
|
+
* @return {?}
|
|
310
|
+
*/
|
|
311
|
+
NavigationState.prototype.debugState = /**
|
|
312
|
+
* @protected
|
|
313
|
+
* @param {?=} properties
|
|
314
|
+
* @return {?}
|
|
315
|
+
*/
|
|
316
|
+
function (properties) {
|
|
317
|
+
var _this = this;
|
|
318
|
+
return (properties || this.debugPropertyKeys).map((/**
|
|
319
|
+
* @param {?} p
|
|
320
|
+
* @return {?}
|
|
321
|
+
*/
|
|
322
|
+
function (p) {
|
|
323
|
+
return p + ": " + _this[p];
|
|
324
|
+
})).join(', ');
|
|
281
325
|
};
|
|
282
326
|
return NavigationState;
|
|
283
327
|
}(GarbageCollector));
|
|
@@ -297,6 +341,8 @@ if (false) {
|
|
|
297
341
|
NavigationState.prototype.startingUrl;
|
|
298
342
|
/** @type {?} */
|
|
299
343
|
NavigationState.prototype.isPopState;
|
|
344
|
+
/** @type {?} */
|
|
345
|
+
NavigationState.prototype.debugPropertyKeys;
|
|
300
346
|
/**
|
|
301
347
|
* @type {?}
|
|
302
348
|
* @protected
|
|
@@ -362,7 +408,7 @@ if (false) {
|
|
|
362
408
|
}
|
|
363
409
|
if (this.placeRouter.hasActiveInteractionIds(event.url)) {
|
|
364
410
|
Logger.get(this).info("navigation started with interaction outlet -> " + event.url);
|
|
365
|
-
return new
|
|
411
|
+
return new StartingInteractionTransition(this.context, event.url);
|
|
366
412
|
}
|
|
367
413
|
else {
|
|
368
414
|
return this.createTransitionStateFor(event);
|
|
@@ -455,14 +501,14 @@ if (false) {
|
|
|
455
501
|
return new Idle(this.context);
|
|
456
502
|
};
|
|
457
503
|
/**
|
|
458
|
-
* @param {?}
|
|
504
|
+
* @param {?} newUrl
|
|
459
505
|
* @return {?}
|
|
460
506
|
*/
|
|
461
507
|
AbstractNavigationTransition.prototype.onBackClickedDuringNavigationInteraction = /**
|
|
462
|
-
* @param {?}
|
|
508
|
+
* @param {?} newUrl
|
|
463
509
|
* @return {?}
|
|
464
510
|
*/
|
|
465
|
-
function (
|
|
511
|
+
function (newUrl) {
|
|
466
512
|
Logger.get(this).info("back button pressed during navigation session interaction promise");
|
|
467
513
|
// detach the interaction from the session so it doesn't get disposed until the activity has completed.
|
|
468
514
|
/** @type {?} */
|
|
@@ -470,25 +516,22 @@ if (false) {
|
|
|
470
516
|
var when = Dsl.disposeWith(navigationInteraction).when;
|
|
471
517
|
// TODO: I need to make the exclusive interaction context disallow nested activities or
|
|
472
518
|
// that would mess things up entirely. Or, can I do a context.abortAll().then(..)
|
|
519
|
+
Logger.get(this).info('cancelling current navigation activity..');
|
|
473
520
|
navigationInteraction.cancelActiveActivity().then((/**
|
|
474
521
|
* @return {?}
|
|
475
522
|
*/
|
|
476
523
|
function () {
|
|
477
524
|
navigationInteraction.dispose();
|
|
478
525
|
}));
|
|
479
|
-
return
|
|
526
|
+
return this.createNavigationInteractionCancelledState(newUrl);
|
|
480
527
|
};
|
|
481
|
-
// @Trace()
|
|
482
|
-
// @Trace()
|
|
483
528
|
/**
|
|
484
529
|
* @param {?} component
|
|
485
530
|
* @param {?} currentUrl
|
|
486
531
|
* @param {?} nextUrl
|
|
487
532
|
* @return {?}
|
|
488
533
|
*/
|
|
489
|
-
AbstractNavigationTransition.prototype.canDeactivatePlace =
|
|
490
|
-
// @Trace()
|
|
491
|
-
/**
|
|
534
|
+
AbstractNavigationTransition.prototype.canDeactivatePlace = /**
|
|
492
535
|
* @param {?} component
|
|
493
536
|
* @param {?} currentUrl
|
|
494
537
|
* @param {?} nextUrl
|
|
@@ -510,11 +553,11 @@ if (false) {
|
|
|
510
553
|
});
|
|
511
554
|
};
|
|
512
555
|
/**
|
|
513
|
-
* @
|
|
556
|
+
* @protected
|
|
514
557
|
* @return {?}
|
|
515
558
|
*/
|
|
516
559
|
AbstractNavigationTransition.prototype.detachInteractionContext = /**
|
|
517
|
-
* @
|
|
560
|
+
* @protected
|
|
518
561
|
* @return {?}
|
|
519
562
|
*/
|
|
520
563
|
function () {
|
|
@@ -541,12 +584,19 @@ if (false) {
|
|
|
541
584
|
AbstractNavigationTransition.prototype._interactionContext;
|
|
542
585
|
/** @type {?} */
|
|
543
586
|
AbstractNavigationTransition.prototype.startingUrl;
|
|
587
|
+
/**
|
|
588
|
+
* @abstract
|
|
589
|
+
* @param {?} newUrl
|
|
590
|
+
* @return {?}
|
|
591
|
+
*/
|
|
592
|
+
AbstractNavigationTransition.prototype.createNavigationInteractionCancelledState = function (newUrl) { };
|
|
544
593
|
}
|
|
545
594
|
var NavigationTransition = /** @class */ (function (_super) {
|
|
546
595
|
tslib_1.__extends(NavigationTransition, _super);
|
|
547
596
|
function NavigationTransition() {
|
|
548
597
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
549
598
|
_this.isPopState = false;
|
|
599
|
+
_this.debugPropertyKeys = ['startingUrl'];
|
|
550
600
|
return _this;
|
|
551
601
|
}
|
|
552
602
|
/**
|
|
@@ -573,13 +623,15 @@ if (false) {
|
|
|
573
623
|
return new Idle(this.context);
|
|
574
624
|
};
|
|
575
625
|
/**
|
|
626
|
+
* @param {?} newUrl
|
|
576
627
|
* @return {?}
|
|
577
628
|
*/
|
|
578
|
-
NavigationTransition.prototype.
|
|
629
|
+
NavigationTransition.prototype.createNavigationInteractionCancelledState = /**
|
|
630
|
+
* @param {?} newUrl
|
|
579
631
|
* @return {?}
|
|
580
632
|
*/
|
|
581
|
-
function () {
|
|
582
|
-
return this.
|
|
633
|
+
function (newUrl) {
|
|
634
|
+
return new LinkTriggeredNavigationInteractionCancelled(this.context, this.startingUrl, newUrl);
|
|
583
635
|
};
|
|
584
636
|
return NavigationTransition;
|
|
585
637
|
}(AbstractNavigationTransition));
|
|
@@ -587,12 +639,16 @@ if (false) {
|
|
|
587
639
|
if (false) {
|
|
588
640
|
/** @type {?} */
|
|
589
641
|
NavigationTransition.prototype.isPopState;
|
|
642
|
+
/** @type {?} */
|
|
643
|
+
NavigationTransition.prototype.debugPropertyKeys;
|
|
590
644
|
}
|
|
591
645
|
var PopStateTransition = /** @class */ (function (_super) {
|
|
592
646
|
tslib_1.__extends(PopStateTransition, _super);
|
|
593
|
-
function PopStateTransition() {
|
|
594
|
-
var _this = _super
|
|
647
|
+
function PopStateTransition(context, startingUrl, poppedHistoryUrl) {
|
|
648
|
+
var _this = _super.call(this, context, startingUrl) || this;
|
|
649
|
+
_this.poppedHistoryUrl = poppedHistoryUrl;
|
|
595
650
|
_this.isPopState = true;
|
|
651
|
+
_this.debugPropertyKeys = ['startingUrl', 'poppedHistoryUrl'];
|
|
596
652
|
return _this;
|
|
597
653
|
}
|
|
598
654
|
/**
|
|
@@ -607,7 +663,8 @@ if (false) {
|
|
|
607
663
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
608
664
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
609
665
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
610
|
-
this.resetBrowserLocation(this.
|
|
666
|
+
this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.
|
|
667
|
+
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
611
668
|
return new Idle(this.context);
|
|
612
669
|
};
|
|
613
670
|
/**
|
|
@@ -624,24 +681,75 @@ if (false) {
|
|
|
624
681
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
625
682
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
626
683
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
627
|
-
this.resetBrowserLocation(this.
|
|
684
|
+
this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.
|
|
685
|
+
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
628
686
|
}
|
|
629
687
|
return new Idle(this.context);
|
|
630
688
|
};
|
|
689
|
+
/**
|
|
690
|
+
* @param {?} locationTriggerUrl
|
|
691
|
+
* @return {?}
|
|
692
|
+
*/
|
|
693
|
+
PopStateTransition.prototype.createNavigationInteractionCancelledState = /**
|
|
694
|
+
* @param {?} locationTriggerUrl
|
|
695
|
+
* @return {?}
|
|
696
|
+
*/
|
|
697
|
+
function (locationTriggerUrl) {
|
|
698
|
+
return new PopStateTriggeredNavigationInteractionCancelled(this.context, this.startingUrl, locationTriggerUrl, this.poppedHistoryUrl);
|
|
699
|
+
};
|
|
631
700
|
return PopStateTransition;
|
|
632
701
|
}(AbstractNavigationTransition));
|
|
633
702
|
NavigationState.PopStateTransition = PopStateTransition;
|
|
634
703
|
if (false) {
|
|
635
704
|
/** @type {?} */
|
|
636
705
|
PopStateTransition.prototype.isPopState;
|
|
706
|
+
/** @type {?} */
|
|
707
|
+
PopStateTransition.prototype.debugPropertyKeys;
|
|
708
|
+
/** @type {?} */
|
|
709
|
+
PopStateTransition.prototype.poppedHistoryUrl;
|
|
637
710
|
}
|
|
638
|
-
|
|
711
|
+
/**
|
|
712
|
+
* @abstract
|
|
713
|
+
*/
|
|
714
|
+
var /**
|
|
715
|
+
* @abstract
|
|
716
|
+
*/
|
|
717
|
+
AbstractInteractionTransition = /** @class */ (function (_super) {
|
|
718
|
+
tslib_1.__extends(AbstractInteractionTransition, _super);
|
|
719
|
+
function AbstractInteractionTransition(context, startingUrl) {
|
|
720
|
+
var _this = _super.call(this, context, startingUrl) || this;
|
|
721
|
+
_this.startingUrl = startingUrl;
|
|
722
|
+
_this.isTransitional = true;
|
|
723
|
+
return _this;
|
|
724
|
+
}
|
|
725
|
+
return AbstractInteractionTransition;
|
|
726
|
+
}(AbstractNavigationTransition));
|
|
727
|
+
NavigationState.AbstractInteractionTransition = AbstractInteractionTransition;
|
|
728
|
+
if (false) {
|
|
729
|
+
/** @type {?} */
|
|
730
|
+
AbstractInteractionTransition.prototype.isTransitional;
|
|
731
|
+
/** @type {?} */
|
|
732
|
+
AbstractInteractionTransition.prototype.startingUrl;
|
|
733
|
+
}
|
|
734
|
+
// The following states exist to handle all events while any kind of navigation is in progress. That way all other states can
|
|
735
|
+
// happily ignore interaction contexts.
|
|
736
|
+
/**
|
|
737
|
+
* This is the non transitional (i.e. rest) state that is used whenever an interaction context is active.
|
|
738
|
+
*/
|
|
739
|
+
var
|
|
740
|
+
// The following states exist to handle all events while any kind of navigation is in progress. That way all other states can
|
|
741
|
+
// happily ignore interaction contexts.
|
|
742
|
+
/**
|
|
743
|
+
* This is the non transitional (i.e. rest) state that is used whenever an interaction context is active.
|
|
744
|
+
*/
|
|
745
|
+
IdleDuringInteraction = /** @class */ (function (_super) {
|
|
639
746
|
tslib_1.__extends(IdleDuringInteraction, _super);
|
|
640
747
|
function IdleDuringInteraction(context, startingUrl) {
|
|
641
748
|
var _this = _super.call(this, context) || this;
|
|
642
749
|
_this.startingUrl = startingUrl;
|
|
643
750
|
_this.isTransitional = false;
|
|
644
751
|
_this.isPopState = false;
|
|
752
|
+
_this.debugPropertyKeys = ['startingUrl'];
|
|
645
753
|
return _this;
|
|
646
754
|
}
|
|
647
755
|
/**
|
|
@@ -655,40 +763,34 @@ if (false) {
|
|
|
655
763
|
* @return {?}
|
|
656
764
|
*/
|
|
657
765
|
function (visit, initialUrl) {
|
|
766
|
+
// we're in an interaction and the user clicked back
|
|
658
767
|
/** @type {?} */
|
|
659
|
-
var navigationTransition = new
|
|
768
|
+
var navigationTransition = new StartingInteractionTransition(this.context, initialUrl);
|
|
660
769
|
navigationTransition.storeVisit(visit);
|
|
661
770
|
return navigationTransition;
|
|
662
771
|
};
|
|
663
|
-
// @Trace()
|
|
664
|
-
// @Trace()
|
|
665
772
|
/**
|
|
666
773
|
* @param {?} event
|
|
667
774
|
* @return {?}
|
|
668
775
|
*/
|
|
669
|
-
IdleDuringInteraction.prototype.onRouterStarted =
|
|
670
|
-
// @Trace()
|
|
671
|
-
/**
|
|
776
|
+
IdleDuringInteraction.prototype.onRouterStarted = /**
|
|
672
777
|
* @param {?} event
|
|
673
778
|
* @return {?}
|
|
674
779
|
*/
|
|
675
780
|
function (event) {
|
|
676
|
-
return new
|
|
781
|
+
return new StartingInteractionTransition(this.context, event.url);
|
|
677
782
|
};
|
|
678
|
-
// @Trace()
|
|
679
|
-
// @Trace()
|
|
680
783
|
/**
|
|
681
784
|
* @param {?} event
|
|
682
785
|
* @return {?}
|
|
683
786
|
*/
|
|
684
|
-
IdleDuringInteraction.prototype.onPopState =
|
|
685
|
-
// @Trace()
|
|
686
|
-
/**
|
|
787
|
+
IdleDuringInteraction.prototype.onPopState = /**
|
|
687
788
|
* @param {?} event
|
|
688
789
|
* @return {?}
|
|
689
790
|
*/
|
|
690
791
|
function (event) {
|
|
691
|
-
|
|
792
|
+
// we're in an interaction and the user clicked back
|
|
793
|
+
return new LeavingInteractionAfterPopStateTransition(this.context, event.url, event.url);
|
|
692
794
|
};
|
|
693
795
|
return IdleDuringInteraction;
|
|
694
796
|
}(NavigationState));
|
|
@@ -699,55 +801,34 @@ if (false) {
|
|
|
699
801
|
/** @type {?} */
|
|
700
802
|
IdleDuringInteraction.prototype.isPopState;
|
|
701
803
|
/** @type {?} */
|
|
702
|
-
IdleDuringInteraction.prototype.
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
|
-
* @abstract
|
|
706
|
-
*/
|
|
707
|
-
var /**
|
|
708
|
-
* @abstract
|
|
709
|
-
*/
|
|
710
|
-
AbstractInteractionTransition = /** @class */ (function (_super) {
|
|
711
|
-
tslib_1.__extends(AbstractInteractionTransition, _super);
|
|
712
|
-
function AbstractInteractionTransition(context, startingUrl) {
|
|
713
|
-
var _this = _super.call(this, context, startingUrl) || this;
|
|
714
|
-
_this.startingUrl = startingUrl;
|
|
715
|
-
_this.isTransitional = true;
|
|
716
|
-
return _this;
|
|
717
|
-
}
|
|
718
|
-
return AbstractInteractionTransition;
|
|
719
|
-
}(AbstractNavigationTransition));
|
|
720
|
-
NavigationState.AbstractInteractionTransition = AbstractInteractionTransition;
|
|
721
|
-
if (false) {
|
|
722
|
-
/** @type {?} */
|
|
723
|
-
AbstractInteractionTransition.prototype.isTransitional;
|
|
804
|
+
IdleDuringInteraction.prototype.debugPropertyKeys;
|
|
724
805
|
/** @type {?} */
|
|
725
|
-
|
|
806
|
+
IdleDuringInteraction.prototype.startingUrl;
|
|
726
807
|
}
|
|
727
808
|
/**
|
|
728
809
|
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
729
810
|
* happily ignore interaction contexts.
|
|
811
|
+
* NOTE: This state is activated when ever an interaction is started. It might be better to split it into
|
|
812
|
+
* different states for different scenarios, e.g. starting model, starting model during route guard etc.
|
|
730
813
|
*/
|
|
731
814
|
var /**
|
|
732
815
|
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
733
816
|
* happily ignore interaction contexts.
|
|
817
|
+
* NOTE: This state is activated when ever an interaction is started. It might be better to split it into
|
|
818
|
+
* different states for different scenarios, e.g. starting model, starting model during route guard etc.
|
|
734
819
|
*/
|
|
735
|
-
|
|
736
|
-
tslib_1.__extends(
|
|
737
|
-
function
|
|
820
|
+
StartingInteractionTransition = /** @class */ (function (_super) {
|
|
821
|
+
tslib_1.__extends(StartingInteractionTransition, _super);
|
|
822
|
+
function StartingInteractionTransition() {
|
|
738
823
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
739
824
|
_this.isPopState = false;
|
|
740
825
|
return _this;
|
|
741
826
|
}
|
|
742
|
-
// @Trace()
|
|
743
|
-
// @Trace()
|
|
744
827
|
/**
|
|
745
828
|
* @param {?} event
|
|
746
829
|
* @return {?}
|
|
747
830
|
*/
|
|
748
|
-
|
|
749
|
-
// @Trace()
|
|
750
|
-
/**
|
|
831
|
+
StartingInteractionTransition.prototype.onRouterCancelled = /**
|
|
751
832
|
* @param {?} event
|
|
752
833
|
* @return {?}
|
|
753
834
|
*/
|
|
@@ -762,15 +843,11 @@ if (false) {
|
|
|
762
843
|
return new Idle(this.context);
|
|
763
844
|
}
|
|
764
845
|
};
|
|
765
|
-
// @Trace()
|
|
766
|
-
// @Trace()
|
|
767
846
|
/**
|
|
768
847
|
* @param {?} event
|
|
769
848
|
* @return {?}
|
|
770
849
|
*/
|
|
771
|
-
|
|
772
|
-
// @Trace()
|
|
773
|
-
/**
|
|
850
|
+
StartingInteractionTransition.prototype.onRouterError = /**
|
|
774
851
|
* @param {?} event
|
|
775
852
|
* @return {?}
|
|
776
853
|
*/
|
|
@@ -778,15 +855,11 @@ if (false) {
|
|
|
778
855
|
// navigation was aborted.
|
|
779
856
|
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
780
857
|
};
|
|
781
|
-
// @Trace()
|
|
782
|
-
// @Trace()
|
|
783
858
|
/**
|
|
784
859
|
* @param {?} event
|
|
785
860
|
* @return {?}
|
|
786
861
|
*/
|
|
787
|
-
|
|
788
|
-
// @Trace()
|
|
789
|
-
/**
|
|
862
|
+
StartingInteractionTransition.prototype.onRouterEnd = /**
|
|
790
863
|
* @param {?} event
|
|
791
864
|
* @return {?}
|
|
792
865
|
*/
|
|
@@ -798,12 +871,163 @@ if (false) {
|
|
|
798
871
|
return new Idle(this.context);
|
|
799
872
|
}
|
|
800
873
|
};
|
|
801
|
-
|
|
874
|
+
/**
|
|
875
|
+
* @param {?} locationTriggerUrl
|
|
876
|
+
* @return {?}
|
|
877
|
+
*/
|
|
878
|
+
StartingInteractionTransition.prototype.createNavigationInteractionCancelledState = /**
|
|
879
|
+
* @param {?} locationTriggerUrl
|
|
880
|
+
* @return {?}
|
|
881
|
+
*/
|
|
882
|
+
function (locationTriggerUrl) {
|
|
883
|
+
return new LeavingInteractionTransitionCancelled(this.context, this.startingUrl, locationTriggerUrl);
|
|
884
|
+
};
|
|
885
|
+
return StartingInteractionTransition;
|
|
802
886
|
}(AbstractInteractionTransition));
|
|
803
|
-
NavigationState.
|
|
887
|
+
NavigationState.StartingInteractionTransition = StartingInteractionTransition;
|
|
804
888
|
if (false) {
|
|
805
889
|
/** @type {?} */
|
|
806
|
-
|
|
890
|
+
StartingInteractionTransition.prototype.isPopState;
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* The sequence of router events are:
|
|
894
|
+
* Error -> url = url of navigation link
|
|
895
|
+
* End
|
|
896
|
+
* onPopState url = current intereaction url sans the query params
|
|
897
|
+
* Cancel url == same as above.
|
|
898
|
+
*/
|
|
899
|
+
var /**
|
|
900
|
+
* The sequence of router events are:
|
|
901
|
+
* Error -> url = url of navigation link
|
|
902
|
+
* End
|
|
903
|
+
* onPopState url = current intereaction url sans the query params
|
|
904
|
+
* Cancel url == same as above.
|
|
905
|
+
*/
|
|
906
|
+
LeavingInteractionTransitionCancelled = /** @class */ (function (_super) {
|
|
907
|
+
tslib_1.__extends(LeavingInteractionTransitionCancelled, _super);
|
|
908
|
+
function LeavingInteractionTransitionCancelled(context, startingUrl, locationChangeTriggerUrl) {
|
|
909
|
+
var _this = _super.call(this, context) || this;
|
|
910
|
+
_this.startingUrl = startingUrl;
|
|
911
|
+
_this.locationChangeTriggerUrl = locationChangeTriggerUrl;
|
|
912
|
+
_this.isPopState = false;
|
|
913
|
+
_this.firstCancelHandled = false;
|
|
914
|
+
_this.popStateHandled = false;
|
|
915
|
+
_this.debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
|
|
916
|
+
return _this;
|
|
917
|
+
}
|
|
918
|
+
Object.defineProperty(LeavingInteractionTransitionCancelled.prototype, "isTransitional", {
|
|
919
|
+
get: /**
|
|
920
|
+
* @return {?}
|
|
921
|
+
*/
|
|
922
|
+
function () {
|
|
923
|
+
return true;
|
|
924
|
+
},
|
|
925
|
+
enumerable: true,
|
|
926
|
+
configurable: true
|
|
927
|
+
});
|
|
928
|
+
/**
|
|
929
|
+
* @param {?} event
|
|
930
|
+
* @return {?}
|
|
931
|
+
*/
|
|
932
|
+
LeavingInteractionTransitionCancelled.prototype.onRouterStarted = /**
|
|
933
|
+
* @param {?} event
|
|
934
|
+
* @return {?}
|
|
935
|
+
*/
|
|
936
|
+
function (event) {
|
|
937
|
+
return this.ignore(event);
|
|
938
|
+
};
|
|
939
|
+
/**
|
|
940
|
+
* @param {?} event
|
|
941
|
+
* @return {?}
|
|
942
|
+
*/
|
|
943
|
+
LeavingInteractionTransitionCancelled.prototype.onRouterCancelled = /**
|
|
944
|
+
* @param {?} event
|
|
945
|
+
* @return {?}
|
|
946
|
+
*/
|
|
947
|
+
function (event) {
|
|
948
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
949
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
950
|
+
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
951
|
+
if (this.interactionService.isActive()) {
|
|
952
|
+
/** @type {?} */
|
|
953
|
+
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
954
|
+
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
955
|
+
}
|
|
956
|
+
else {
|
|
957
|
+
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
958
|
+
}
|
|
959
|
+
return this.createIdleState();
|
|
960
|
+
};
|
|
961
|
+
/**
|
|
962
|
+
* @param {?} event
|
|
963
|
+
* @return {?}
|
|
964
|
+
*/
|
|
965
|
+
LeavingInteractionTransitionCancelled.prototype.onRouterEnd = /**
|
|
966
|
+
* @param {?} event
|
|
967
|
+
* @return {?}
|
|
968
|
+
*/
|
|
969
|
+
function (event) {
|
|
970
|
+
return this.ignore(event);
|
|
971
|
+
};
|
|
972
|
+
/**
|
|
973
|
+
* @param {?} event
|
|
974
|
+
* @return {?}
|
|
975
|
+
*/
|
|
976
|
+
LeavingInteractionTransitionCancelled.prototype.onRouterError = /**
|
|
977
|
+
* @param {?} event
|
|
978
|
+
* @return {?}
|
|
979
|
+
*/
|
|
980
|
+
function (event) {
|
|
981
|
+
return this.ignore(event);
|
|
982
|
+
};
|
|
983
|
+
/**
|
|
984
|
+
* @param {?} event
|
|
985
|
+
* @return {?}
|
|
986
|
+
*/
|
|
987
|
+
LeavingInteractionTransitionCancelled.prototype.onPopState = /**
|
|
988
|
+
* @param {?} event
|
|
989
|
+
* @return {?}
|
|
990
|
+
*/
|
|
991
|
+
function (event) {
|
|
992
|
+
return this.ignore(event);
|
|
993
|
+
};
|
|
994
|
+
/**
|
|
995
|
+
* @param {?} component
|
|
996
|
+
* @param {?} currentUrl
|
|
997
|
+
* @param {?} nextUrl
|
|
998
|
+
* @return {?}
|
|
999
|
+
*/
|
|
1000
|
+
LeavingInteractionTransitionCancelled.prototype.canDeactivatePlace = /**
|
|
1001
|
+
* @param {?} component
|
|
1002
|
+
* @param {?} currentUrl
|
|
1003
|
+
* @param {?} nextUrl
|
|
1004
|
+
* @return {?}
|
|
1005
|
+
*/
|
|
1006
|
+
function (component, currentUrl, nextUrl) {
|
|
1007
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1008
|
+
return tslib_1.__generator(this, function (_a) {
|
|
1009
|
+
return [2 /*return*/, false];
|
|
1010
|
+
});
|
|
1011
|
+
});
|
|
1012
|
+
};
|
|
1013
|
+
return LeavingInteractionTransitionCancelled;
|
|
1014
|
+
}(NavigationState));
|
|
1015
|
+
NavigationState.LeavingInteractionTransitionCancelled = LeavingInteractionTransitionCancelled;
|
|
1016
|
+
if (false) {
|
|
1017
|
+
/** @type {?} */
|
|
1018
|
+
LeavingInteractionTransitionCancelled.prototype.isPopState;
|
|
1019
|
+
/** @type {?} */
|
|
1020
|
+
LeavingInteractionTransitionCancelled.prototype.firstCancelHandled;
|
|
1021
|
+
/** @type {?} */
|
|
1022
|
+
LeavingInteractionTransitionCancelled.prototype.popStateHandled;
|
|
1023
|
+
/** @type {?} */
|
|
1024
|
+
LeavingInteractionTransitionCancelled.prototype.popStateEventUrl;
|
|
1025
|
+
/** @type {?} */
|
|
1026
|
+
LeavingInteractionTransitionCancelled.prototype.debugPropertyKeys;
|
|
1027
|
+
/** @type {?} */
|
|
1028
|
+
LeavingInteractionTransitionCancelled.prototype.startingUrl;
|
|
1029
|
+
/** @type {?} */
|
|
1030
|
+
LeavingInteractionTransitionCancelled.prototype.locationChangeTriggerUrl;
|
|
807
1031
|
}
|
|
808
1032
|
/**
|
|
809
1033
|
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
@@ -813,22 +1037,19 @@ if (false) {
|
|
|
813
1037
|
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
814
1038
|
* happily ignore interaction contexts.
|
|
815
1039
|
*/
|
|
816
|
-
|
|
817
|
-
tslib_1.__extends(
|
|
818
|
-
function
|
|
819
|
-
var _this = _super
|
|
1040
|
+
LeavingInteractionAfterPopStateTransition = /** @class */ (function (_super) {
|
|
1041
|
+
tslib_1.__extends(LeavingInteractionAfterPopStateTransition, _super);
|
|
1042
|
+
function LeavingInteractionAfterPopStateTransition(context, startingUrl, poppedHistoryUrl) {
|
|
1043
|
+
var _this = _super.call(this, context, startingUrl) || this;
|
|
1044
|
+
_this.poppedHistoryUrl = poppedHistoryUrl;
|
|
820
1045
|
_this.isPopState = true;
|
|
821
1046
|
return _this;
|
|
822
1047
|
}
|
|
823
|
-
// @Trace()
|
|
824
|
-
// @Trace()
|
|
825
1048
|
/**
|
|
826
1049
|
* @param {?} event
|
|
827
1050
|
* @return {?}
|
|
828
1051
|
*/
|
|
829
|
-
|
|
830
|
-
// @Trace()
|
|
831
|
-
/**
|
|
1052
|
+
LeavingInteractionAfterPopStateTransition.prototype.onRouterCancelled = /**
|
|
832
1053
|
* @param {?} event
|
|
833
1054
|
* @return {?}
|
|
834
1055
|
*/
|
|
@@ -843,15 +1064,11 @@ if (false) {
|
|
|
843
1064
|
return new Idle(this.context);
|
|
844
1065
|
}
|
|
845
1066
|
};
|
|
846
|
-
// @Trace()
|
|
847
|
-
// @Trace()
|
|
848
1067
|
/**
|
|
849
1068
|
* @param {?} event
|
|
850
1069
|
* @return {?}
|
|
851
1070
|
*/
|
|
852
|
-
|
|
853
|
-
// @Trace()
|
|
854
|
-
/**
|
|
1071
|
+
LeavingInteractionAfterPopStateTransition.prototype.onRouterEnd = /**
|
|
855
1072
|
* @param {?} event
|
|
856
1073
|
* @return {?}
|
|
857
1074
|
*/
|
|
@@ -863,25 +1080,219 @@ if (false) {
|
|
|
863
1080
|
return new Idle(this.context);
|
|
864
1081
|
}
|
|
865
1082
|
};
|
|
866
|
-
|
|
1083
|
+
/**
|
|
1084
|
+
* @param {?} newUrl
|
|
1085
|
+
* @return {?}
|
|
1086
|
+
*/
|
|
1087
|
+
LeavingInteractionAfterPopStateTransition.prototype.createNavigationInteractionCancelledState = /**
|
|
1088
|
+
* @param {?} newUrl
|
|
1089
|
+
* @return {?}
|
|
1090
|
+
*/
|
|
1091
|
+
function (newUrl) {
|
|
1092
|
+
return this.illegalTransition("Leaving interaction after pop-state should't block so should never see a back button click");
|
|
1093
|
+
};
|
|
1094
|
+
return LeavingInteractionAfterPopStateTransition;
|
|
867
1095
|
}(AbstractInteractionTransition));
|
|
868
|
-
NavigationState.
|
|
1096
|
+
NavigationState.LeavingInteractionAfterPopStateTransition = LeavingInteractionAfterPopStateTransition;
|
|
869
1097
|
if (false) {
|
|
870
1098
|
/** @type {?} */
|
|
871
|
-
|
|
1099
|
+
LeavingInteractionAfterPopStateTransition.prototype.isPopState;
|
|
1100
|
+
/** @type {?} */
|
|
1101
|
+
LeavingInteractionAfterPopStateTransition.prototype.poppedHistoryUrl;
|
|
872
1102
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1103
|
+
// See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
|
|
1104
|
+
//
|
|
1105
|
+
// export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
|
|
1106
|
+
//
|
|
1107
|
+
// readonly isPopState = false;
|
|
1108
|
+
// firstCancelHandled = false;
|
|
1109
|
+
// popStateHandled = false;
|
|
1110
|
+
// popStateEventUrl: string;
|
|
1111
|
+
// debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
|
|
1112
|
+
//
|
|
1113
|
+
// constructor(context: Context,
|
|
1114
|
+
// readonly startingUrl: string,
|
|
1115
|
+
// readonly locationChangeTriggerUrl: string,
|
|
1116
|
+
// readonly poppedHistoryUrl: string) {
|
|
1117
|
+
// super(context);
|
|
1118
|
+
// }
|
|
1119
|
+
//
|
|
1120
|
+
// get isTransitional() {
|
|
1121
|
+
// return true;
|
|
1122
|
+
// }
|
|
1123
|
+
//
|
|
1124
|
+
// onRouterStarted(event: NavigationStart): NavigationState {
|
|
1125
|
+
// return this.ignore(event);
|
|
1126
|
+
// }
|
|
1127
|
+
//
|
|
1128
|
+
//
|
|
1129
|
+
// onRouterCancelled(event: NavigationCancel): NavigationState {
|
|
1130
|
+
//
|
|
1131
|
+
// // if (this.firstCancelHandled && this.popStateHandled) {
|
|
1132
|
+
// // // Angular doesn't preserve the url when a guard cancels the back button.
|
|
1133
|
+
// // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
1134
|
+
// // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
1135
|
+
// // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
|
|
1136
|
+
// // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
1137
|
+
// // if (this.interactionService.isActive()) {
|
|
1138
|
+
// // const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
1139
|
+
// // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
1140
|
+
// // } else {
|
|
1141
|
+
// // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
1142
|
+
// // }
|
|
1143
|
+
// // return this.createIdleState();
|
|
1144
|
+
// // } else {
|
|
1145
|
+
// // this.firstCancelHandled = true;
|
|
1146
|
+
// return this.ignore(event);
|
|
1147
|
+
// // }
|
|
1148
|
+
// }
|
|
1149
|
+
//
|
|
1150
|
+
//
|
|
1151
|
+
// onRouterEnd(event: NavigationEnd): NavigationState {
|
|
1152
|
+
// return this.ignore(event);
|
|
1153
|
+
// }
|
|
1154
|
+
//
|
|
1155
|
+
//
|
|
1156
|
+
// onRouterError(event: NavigationError): NavigationState {
|
|
1157
|
+
// return this.ignore(event);
|
|
1158
|
+
// }
|
|
1159
|
+
//
|
|
1160
|
+
//
|
|
1161
|
+
// onPopState(event: NavigationStart): NavigationState {
|
|
1162
|
+
// // this.popStateHandled = true;
|
|
1163
|
+
// // this.popStateEventUrl = event.url;
|
|
1164
|
+
// return this.ignore(event);
|
|
1165
|
+
// }
|
|
1166
|
+
//
|
|
1167
|
+
// async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
|
|
1168
|
+
// return false;
|
|
1169
|
+
// }
|
|
1170
|
+
// }
|
|
1171
|
+
/**
|
|
1172
|
+
* This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
|
|
1173
|
+
* The routing event sequence is different depending on the link that was clicked.
|
|
1174
|
+
*
|
|
1175
|
+
* If the link was the same as the previous history location (i.e. they've gone back via a link rather than clicking back) then the sequence is:
|
|
1176
|
+
*
|
|
1177
|
+
* -> Idle -> NavigationTransition
|
|
1178
|
+
* -> confirm dialog shown.
|
|
1179
|
+
* -> click back
|
|
1180
|
+
* -> NavigationCancel -> clickedLinkUrl === cancel.url
|
|
1181
|
+
* -> NavigationEnd
|
|
1182
|
+
*
|
|
1183
|
+
* Otherwise if the link is different from teh history location then the sequence is:
|
|
1184
|
+
*
|
|
1185
|
+
* -> Idle -> NavigationTransition
|
|
1186
|
+
* -> confirm dialog shown.
|
|
1187
|
+
* -> click back
|
|
1188
|
+
* -> NavigationCancel -> clickedLinkUrl !== cancel.url
|
|
1189
|
+
* -> NavigationEnd
|
|
1190
|
+
* -> PopState
|
|
1191
|
+
* -> NavigationCancel
|
|
1192
|
+
*/
|
|
1193
|
+
var
|
|
1194
|
+
// See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
|
|
1195
|
+
//
|
|
1196
|
+
// export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
|
|
1197
|
+
//
|
|
1198
|
+
// readonly isPopState = false;
|
|
1199
|
+
// firstCancelHandled = false;
|
|
1200
|
+
// popStateHandled = false;
|
|
1201
|
+
// popStateEventUrl: string;
|
|
1202
|
+
// debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
|
|
1203
|
+
//
|
|
1204
|
+
// constructor(context: Context,
|
|
1205
|
+
// readonly startingUrl: string,
|
|
1206
|
+
// readonly locationChangeTriggerUrl: string,
|
|
1207
|
+
// readonly poppedHistoryUrl: string) {
|
|
1208
|
+
// super(context);
|
|
1209
|
+
// }
|
|
1210
|
+
//
|
|
1211
|
+
// get isTransitional() {
|
|
1212
|
+
// return true;
|
|
1213
|
+
// }
|
|
1214
|
+
//
|
|
1215
|
+
// onRouterStarted(event: NavigationStart): NavigationState {
|
|
1216
|
+
// return this.ignore(event);
|
|
1217
|
+
// }
|
|
1218
|
+
//
|
|
1219
|
+
//
|
|
1220
|
+
// onRouterCancelled(event: NavigationCancel): NavigationState {
|
|
1221
|
+
//
|
|
1222
|
+
// // if (this.firstCancelHandled && this.popStateHandled) {
|
|
1223
|
+
// // // Angular doesn't preserve the url when a guard cancels the back button.
|
|
1224
|
+
// // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
1225
|
+
// // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
1226
|
+
// // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
|
|
1227
|
+
// // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
1228
|
+
// // if (this.interactionService.isActive()) {
|
|
1229
|
+
// // const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
1230
|
+
// // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
1231
|
+
// // } else {
|
|
1232
|
+
// // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
1233
|
+
// // }
|
|
1234
|
+
// // return this.createIdleState();
|
|
1235
|
+
// // } else {
|
|
1236
|
+
// // this.firstCancelHandled = true;
|
|
1237
|
+
// return this.ignore(event);
|
|
1238
|
+
// // }
|
|
1239
|
+
// }
|
|
1240
|
+
//
|
|
1241
|
+
//
|
|
1242
|
+
// onRouterEnd(event: NavigationEnd): NavigationState {
|
|
1243
|
+
// return this.ignore(event);
|
|
1244
|
+
// }
|
|
1245
|
+
//
|
|
1246
|
+
//
|
|
1247
|
+
// onRouterError(event: NavigationError): NavigationState {
|
|
1248
|
+
// return this.ignore(event);
|
|
1249
|
+
// }
|
|
1250
|
+
//
|
|
1251
|
+
//
|
|
1252
|
+
// onPopState(event: NavigationStart): NavigationState {
|
|
1253
|
+
// // this.popStateHandled = true;
|
|
1254
|
+
// // this.popStateEventUrl = event.url;
|
|
1255
|
+
// return this.ignore(event);
|
|
1256
|
+
// }
|
|
1257
|
+
//
|
|
1258
|
+
// async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
|
|
1259
|
+
// return false;
|
|
1260
|
+
// }
|
|
1261
|
+
// }
|
|
1262
|
+
/**
|
|
1263
|
+
* This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
|
|
1264
|
+
* The routing event sequence is different depending on the link that was clicked.
|
|
1265
|
+
*
|
|
1266
|
+
* If the link was the same as the previous history location (i.e. they've gone back via a link rather than clicking back) then the sequence is:
|
|
1267
|
+
*
|
|
1268
|
+
* -> Idle -> NavigationTransition
|
|
1269
|
+
* -> confirm dialog shown.
|
|
1270
|
+
* -> click back
|
|
1271
|
+
* -> NavigationCancel -> clickedLinkUrl === cancel.url
|
|
1272
|
+
* -> NavigationEnd
|
|
1273
|
+
*
|
|
1274
|
+
* Otherwise if the link is different from teh history location then the sequence is:
|
|
1275
|
+
*
|
|
1276
|
+
* -> Idle -> NavigationTransition
|
|
1277
|
+
* -> confirm dialog shown.
|
|
1278
|
+
* -> click back
|
|
1279
|
+
* -> NavigationCancel -> clickedLinkUrl !== cancel.url
|
|
1280
|
+
* -> NavigationEnd
|
|
1281
|
+
* -> PopState
|
|
1282
|
+
* -> NavigationCancel
|
|
1283
|
+
*/
|
|
1284
|
+
LinkTriggeredNavigationInteractionCancelled = /** @class */ (function (_super) {
|
|
1285
|
+
tslib_1.__extends(LinkTriggeredNavigationInteractionCancelled, _super);
|
|
1286
|
+
function LinkTriggeredNavigationInteractionCancelled(context, startingUrl, clickedLinkUrl) {
|
|
876
1287
|
var _this = _super.call(this, context) || this;
|
|
877
1288
|
_this.startingUrl = startingUrl;
|
|
878
|
-
_this.
|
|
879
|
-
_this.locationChangeTriggerUrl = locationChangeTriggerUrl;
|
|
1289
|
+
_this.clickedLinkUrl = clickedLinkUrl;
|
|
880
1290
|
_this.isPopState = false;
|
|
881
|
-
_this.
|
|
1291
|
+
_this.clickedLinkMatchedBackButtonUrl = false;
|
|
1292
|
+
_this.debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];
|
|
882
1293
|
return _this;
|
|
883
1294
|
}
|
|
884
|
-
Object.defineProperty(
|
|
1295
|
+
Object.defineProperty(LinkTriggeredNavigationInteractionCancelled.prototype, "isTransitional", {
|
|
885
1296
|
get: /**
|
|
886
1297
|
* @return {?}
|
|
887
1298
|
*/
|
|
@@ -895,53 +1306,56 @@ if (false) {
|
|
|
895
1306
|
* @param {?} event
|
|
896
1307
|
* @return {?}
|
|
897
1308
|
*/
|
|
898
|
-
|
|
1309
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.onRouterStarted = /**
|
|
899
1310
|
* @param {?} event
|
|
900
1311
|
* @return {?}
|
|
901
1312
|
*/
|
|
902
1313
|
function (event) {
|
|
903
1314
|
return this.ignore(event);
|
|
904
1315
|
};
|
|
905
|
-
// @Trace()
|
|
906
|
-
// @Trace()
|
|
907
1316
|
/**
|
|
908
1317
|
* @param {?} event
|
|
909
1318
|
* @return {?}
|
|
910
1319
|
*/
|
|
911
|
-
|
|
912
|
-
// @Trace()
|
|
913
|
-
/**
|
|
1320
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.onRouterCancelled = /**
|
|
914
1321
|
* @param {?} event
|
|
915
1322
|
* @return {?}
|
|
916
1323
|
*/
|
|
917
1324
|
function (event) {
|
|
918
|
-
//
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1325
|
+
// TODO: should really split this into two sub states in the first cancel event.
|
|
1326
|
+
if (!this.firstCancelEventUrl) {
|
|
1327
|
+
this.firstCancelEventUrl = event.url;
|
|
1328
|
+
this.clickedLinkMatchedBackButtonUrl = event.url === this.clickedLinkUrl;
|
|
1329
|
+
return this.ignore(event);
|
|
1330
|
+
}
|
|
1331
|
+
else {
|
|
1332
|
+
// we wait for our popped state to come in.
|
|
1333
|
+
if (!this.clickedLinkMatchedBackButtonUrl && this.popStateEventUrl) {
|
|
1334
|
+
return this.finaliseRouting();
|
|
1335
|
+
}
|
|
926
1336
|
}
|
|
927
|
-
return this.gotPopStateWithLeavingUrl || this.locationChangeTriggerUrl === event.url ? this.createIdleState() : this.ignore(event);
|
|
928
1337
|
};
|
|
929
1338
|
/**
|
|
930
1339
|
* @param {?} event
|
|
931
1340
|
* @return {?}
|
|
932
1341
|
*/
|
|
933
|
-
|
|
1342
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.onRouterEnd = /**
|
|
934
1343
|
* @param {?} event
|
|
935
1344
|
* @return {?}
|
|
936
1345
|
*/
|
|
937
1346
|
function (event) {
|
|
938
|
-
|
|
1347
|
+
if (this.clickedLinkMatchedBackButtonUrl) {
|
|
1348
|
+
return this.finaliseRouting();
|
|
1349
|
+
}
|
|
1350
|
+
else {
|
|
1351
|
+
return this.ignore(event);
|
|
1352
|
+
}
|
|
939
1353
|
};
|
|
940
1354
|
/**
|
|
941
1355
|
* @param {?} event
|
|
942
1356
|
* @return {?}
|
|
943
1357
|
*/
|
|
944
|
-
|
|
1358
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.onRouterError = /**
|
|
945
1359
|
* @param {?} event
|
|
946
1360
|
* @return {?}
|
|
947
1361
|
*/
|
|
@@ -952,25 +1366,42 @@ if (false) {
|
|
|
952
1366
|
* @param {?} event
|
|
953
1367
|
* @return {?}
|
|
954
1368
|
*/
|
|
955
|
-
|
|
1369
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.onPopState = /**
|
|
956
1370
|
* @param {?} event
|
|
957
1371
|
* @return {?}
|
|
958
1372
|
*/
|
|
959
1373
|
function (event) {
|
|
960
|
-
this.
|
|
1374
|
+
this.popStateEventUrl = event.url;
|
|
961
1375
|
return this.ignore(event);
|
|
962
1376
|
};
|
|
963
|
-
|
|
964
|
-
|
|
1377
|
+
/**
|
|
1378
|
+
* @return {?}
|
|
1379
|
+
*/
|
|
1380
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.finaliseRouting = /**
|
|
1381
|
+
* @return {?}
|
|
1382
|
+
*/
|
|
1383
|
+
function () {
|
|
1384
|
+
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
1385
|
+
this.resetBrowserLocation(this.clickedLinkUrl); // put the back click one back in.
|
|
1386
|
+
if (this.interactionService.isActive()) {
|
|
1387
|
+
/** @type {?} */
|
|
1388
|
+
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
1389
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
1390
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
1391
|
+
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
1392
|
+
}
|
|
1393
|
+
else {
|
|
1394
|
+
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
1395
|
+
}
|
|
1396
|
+
return this.createIdleState();
|
|
1397
|
+
};
|
|
965
1398
|
/**
|
|
966
1399
|
* @param {?} component
|
|
967
1400
|
* @param {?} currentUrl
|
|
968
1401
|
* @param {?} nextUrl
|
|
969
1402
|
* @return {?}
|
|
970
1403
|
*/
|
|
971
|
-
|
|
972
|
-
// @Trace()
|
|
973
|
-
/**
|
|
1404
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.canDeactivatePlace = /**
|
|
974
1405
|
* @param {?} component
|
|
975
1406
|
* @param {?} currentUrl
|
|
976
1407
|
* @param {?} nextUrl
|
|
@@ -983,47 +1414,185 @@ if (false) {
|
|
|
983
1414
|
});
|
|
984
1415
|
});
|
|
985
1416
|
};
|
|
1417
|
+
return LinkTriggeredNavigationInteractionCancelled;
|
|
1418
|
+
}(NavigationState));
|
|
1419
|
+
NavigationState.LinkTriggeredNavigationInteractionCancelled = LinkTriggeredNavigationInteractionCancelled;
|
|
1420
|
+
if (false) {
|
|
1421
|
+
/** @type {?} */
|
|
1422
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.isPopState;
|
|
1423
|
+
/** @type {?} */
|
|
1424
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.firstCancelEventUrl;
|
|
1425
|
+
/** @type {?} */
|
|
1426
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.popStateEventUrl;
|
|
1427
|
+
/** @type {?} */
|
|
1428
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.clickedLinkMatchedBackButtonUrl;
|
|
1429
|
+
/** @type {?} */
|
|
1430
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.debugPropertyKeys;
|
|
1431
|
+
/** @type {?} */
|
|
1432
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.startingUrl;
|
|
1433
|
+
/** @type {?} */
|
|
1434
|
+
LinkTriggeredNavigationInteractionCancelled.prototype.clickedLinkUrl;
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* This state handles the scenario where a pop state triggered and interaction and the user clickeb back a second time to cancel it.
|
|
1438
|
+
* The sequence of routing events/state transitions is as follows.
|
|
1439
|
+
* -> Idle -> PopStateTransition (poppedHistoryUrl == page to go to, startingUrl = page to stay on )
|
|
1440
|
+
* -> confirm dialog shown.
|
|
1441
|
+
* -> click back
|
|
1442
|
+
* -> PopStateTransition -> CancelledDuringBackButtonNavigationInteraction(trigger url is the page before the popped history url)
|
|
1443
|
+
* -> NavigationCancel (for the previous back)
|
|
1444
|
+
* -> PopState
|
|
1445
|
+
* -> NavigationCancel
|
|
1446
|
+
*/
|
|
1447
|
+
var /**
|
|
1448
|
+
* This state handles the scenario where a pop state triggered and interaction and the user clickeb back a second time to cancel it.
|
|
1449
|
+
* The sequence of routing events/state transitions is as follows.
|
|
1450
|
+
* -> Idle -> PopStateTransition (poppedHistoryUrl == page to go to, startingUrl = page to stay on )
|
|
1451
|
+
* -> confirm dialog shown.
|
|
1452
|
+
* -> click back
|
|
1453
|
+
* -> PopStateTransition -> CancelledDuringBackButtonNavigationInteraction(trigger url is the page before the popped history url)
|
|
1454
|
+
* -> NavigationCancel (for the previous back)
|
|
1455
|
+
* -> PopState
|
|
1456
|
+
* -> NavigationCancel
|
|
1457
|
+
*/
|
|
1458
|
+
PopStateTriggeredNavigationInteractionCancelled = /** @class */ (function (_super) {
|
|
1459
|
+
tslib_1.__extends(PopStateTriggeredNavigationInteractionCancelled, _super);
|
|
1460
|
+
function PopStateTriggeredNavigationInteractionCancelled(context, startingUrl, locationChangeTriggerUrl, poppedHistoryUrl) {
|
|
1461
|
+
var _this = _super.call(this, context) || this;
|
|
1462
|
+
_this.startingUrl = startingUrl;
|
|
1463
|
+
_this.locationChangeTriggerUrl = locationChangeTriggerUrl;
|
|
1464
|
+
_this.poppedHistoryUrl = poppedHistoryUrl;
|
|
1465
|
+
_this.isPopState = false;
|
|
1466
|
+
_this.firstCancelHandled = false;
|
|
1467
|
+
_this.popStateHandled = false;
|
|
1468
|
+
_this.debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
|
|
1469
|
+
return _this;
|
|
1470
|
+
}
|
|
1471
|
+
Object.defineProperty(PopStateTriggeredNavigationInteractionCancelled.prototype, "isTransitional", {
|
|
1472
|
+
get: /**
|
|
1473
|
+
* @return {?}
|
|
1474
|
+
*/
|
|
1475
|
+
function () {
|
|
1476
|
+
return true;
|
|
1477
|
+
},
|
|
1478
|
+
enumerable: true,
|
|
1479
|
+
configurable: true
|
|
1480
|
+
});
|
|
986
1481
|
/**
|
|
987
1482
|
* @param {?} event
|
|
988
|
-
* @param {?=} reason
|
|
989
1483
|
* @return {?}
|
|
990
1484
|
*/
|
|
991
|
-
|
|
1485
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.onRouterStarted = /**
|
|
992
1486
|
* @param {?} event
|
|
993
|
-
* @param {?=} reason
|
|
994
1487
|
* @return {?}
|
|
995
1488
|
*/
|
|
996
|
-
function (event
|
|
997
|
-
|
|
998
|
-
Logger.get(this).info("ignoring router event" + reason + ": " + event.constructor.name + " -> " + event.url);
|
|
999
|
-
return this;
|
|
1489
|
+
function (event) {
|
|
1490
|
+
return this.ignore(event);
|
|
1000
1491
|
};
|
|
1001
1492
|
/**
|
|
1493
|
+
* @param {?} event
|
|
1002
1494
|
* @return {?}
|
|
1003
1495
|
*/
|
|
1004
|
-
|
|
1496
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.onRouterCancelled = /**
|
|
1497
|
+
* @param {?} event
|
|
1005
1498
|
* @return {?}
|
|
1006
1499
|
*/
|
|
1007
|
-
function () {
|
|
1008
|
-
|
|
1500
|
+
function (event) {
|
|
1501
|
+
if (this.firstCancelHandled && this.popStateHandled) {
|
|
1502
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
1503
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
1504
|
+
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
1505
|
+
this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
|
|
1506
|
+
this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
1507
|
+
if (this.interactionService.isActive()) {
|
|
1508
|
+
/** @type {?} */
|
|
1509
|
+
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
1510
|
+
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
1511
|
+
}
|
|
1512
|
+
else {
|
|
1513
|
+
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
1514
|
+
}
|
|
1515
|
+
return this.createIdleState();
|
|
1516
|
+
}
|
|
1517
|
+
else {
|
|
1518
|
+
this.firstCancelHandled = true;
|
|
1519
|
+
return this.ignore(event);
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
/**
|
|
1523
|
+
* @param {?} event
|
|
1524
|
+
* @return {?}
|
|
1525
|
+
*/
|
|
1526
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.onRouterEnd = /**
|
|
1527
|
+
* @param {?} event
|
|
1528
|
+
* @return {?}
|
|
1529
|
+
*/
|
|
1530
|
+
function (event) {
|
|
1531
|
+
return this.ignore(event);
|
|
1532
|
+
};
|
|
1533
|
+
/**
|
|
1534
|
+
* @param {?} event
|
|
1535
|
+
* @return {?}
|
|
1536
|
+
*/
|
|
1537
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.onRouterError = /**
|
|
1538
|
+
* @param {?} event
|
|
1539
|
+
* @return {?}
|
|
1540
|
+
*/
|
|
1541
|
+
function (event) {
|
|
1542
|
+
return this.ignore(event);
|
|
1009
1543
|
};
|
|
1010
|
-
|
|
1544
|
+
/**
|
|
1545
|
+
* @param {?} event
|
|
1546
|
+
* @return {?}
|
|
1547
|
+
*/
|
|
1548
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.onPopState = /**
|
|
1549
|
+
* @param {?} event
|
|
1550
|
+
* @return {?}
|
|
1551
|
+
*/
|
|
1552
|
+
function (event) {
|
|
1553
|
+
this.popStateHandled = true;
|
|
1554
|
+
this.popStateEventUrl = event.url;
|
|
1555
|
+
return this.ignore(event);
|
|
1556
|
+
};
|
|
1557
|
+
/**
|
|
1558
|
+
* @param {?} component
|
|
1559
|
+
* @param {?} currentUrl
|
|
1560
|
+
* @param {?} nextUrl
|
|
1561
|
+
* @return {?}
|
|
1562
|
+
*/
|
|
1563
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.canDeactivatePlace = /**
|
|
1564
|
+
* @param {?} component
|
|
1565
|
+
* @param {?} currentUrl
|
|
1566
|
+
* @param {?} nextUrl
|
|
1567
|
+
* @return {?}
|
|
1568
|
+
*/
|
|
1569
|
+
function (component, currentUrl, nextUrl) {
|
|
1570
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1571
|
+
return tslib_1.__generator(this, function (_a) {
|
|
1572
|
+
return [2 /*return*/, false];
|
|
1573
|
+
});
|
|
1574
|
+
});
|
|
1575
|
+
};
|
|
1576
|
+
return PopStateTriggeredNavigationInteractionCancelled;
|
|
1011
1577
|
}(NavigationState));
|
|
1012
|
-
NavigationState.
|
|
1578
|
+
NavigationState.PopStateTriggeredNavigationInteractionCancelled = PopStateTriggeredNavigationInteractionCancelled;
|
|
1013
1579
|
if (false) {
|
|
1014
1580
|
/** @type {?} */
|
|
1015
|
-
|
|
1016
|
-
/**
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1581
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.isPopState;
|
|
1582
|
+
/** @type {?} */
|
|
1583
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.firstCancelHandled;
|
|
1584
|
+
/** @type {?} */
|
|
1585
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.popStateHandled;
|
|
1586
|
+
/** @type {?} */
|
|
1587
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.popStateEventUrl;
|
|
1588
|
+
/** @type {?} */
|
|
1589
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.debugPropertyKeys;
|
|
1021
1590
|
/** @type {?} */
|
|
1022
|
-
|
|
1591
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.startingUrl;
|
|
1023
1592
|
/** @type {?} */
|
|
1024
|
-
|
|
1593
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.locationChangeTriggerUrl;
|
|
1025
1594
|
/** @type {?} */
|
|
1026
|
-
|
|
1595
|
+
PopStateTriggeredNavigationInteractionCancelled.prototype.poppedHistoryUrl;
|
|
1027
1596
|
}
|
|
1028
1597
|
})(NavigationState || (NavigationState = {}));
|
|
1029
1598
|
//# sourceMappingURL=navigation-state.js.map
|