@coolon/angular-ui-powerups 1.0.1 → 1.1.0
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/CHANGELOG.md +18 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +446 -169
- 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 +26 -25
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +24 -23
- package/esm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/esm2015/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/components.module.js +9 -2
- package/esm2015/lib/components/components.module.js.map +1 -1
- package/esm2015/lib/components/components.module.metadata.json +1 -1
- package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/forms/abstract-input.component.js +12 -1
- package/esm2015/lib/components/forms/abstract-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/abstract-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/number-input/number-input.component.js +2 -2
- package/esm2015/lib/components/forms/number-input/number-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/number-input/number-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/password-input/password-input.component.js +2 -2
- package/esm2015/lib/components/forms/password-input/password-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/password-input/password-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/select-input/select-input.component.js +3 -3
- package/esm2015/lib/components/forms/select-input/select-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/select-input/select-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/string-input/string-input.component.js +3 -3
- package/esm2015/lib/components/forms/string-input/string-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/string-input/string-input.component.metadata.json +1 -1
- package/esm2015/lib/components/index.js +1 -0
- package/esm2015/lib/components/index.js.map +1 -1
- package/esm2015/lib/components/index.metadata.json +1 -1
- package/esm2015/lib/components/switch-case/switch-case.component.js +124 -0
- package/esm2015/lib/components/switch-case/switch-case.component.js.map +1 -0
- package/esm2015/lib/components/switch-case/switch-case.component.metadata.json +1 -0
- package/esm2015/lib/components/switch-case/switch-case.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/switch-case/switch-case.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/directives/command.directive.js +4 -4
- package/esm2015/lib/directives/command.directive.js.map +1 -1
- package/esm2015/lib/directives/focus-binding.directive.js +3 -3
- package/esm2015/lib/directives/focus-binding.directive.js.map +1 -1
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +1 -1
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +1 -1
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +1 -1
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.metadata.json +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +3 -3
- package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.metadata.json +1 -1
- package/esm2015/lib/place/components/busy-overlay/busy-overlay.component.js +2 -2
- package/esm2015/lib/place/components/busy-overlay/busy-overlay.component.js.map +1 -1
- package/esm2015/lib/place/components/busy-overlay/busy-overlay.component.metadata.json +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +3 -3
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
- package/esm2015/lib/place/guards/place.guard.js +4 -3
- package/esm2015/lib/place/guards/place.guard.js.map +1 -1
- package/esm2015/lib/place/place-component.js +2 -2
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/esm2015/lib/place/place-history.js +116 -13
- package/esm2015/lib/place/place-history.js.map +1 -1
- package/esm2015/lib/place/place-history.metadata.json +1 -1
- package/esm2015/lib/place/place-router.js +13 -6
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/esm2015/lib/place/place-router.metadata.json +1 -1
- package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
- package/esm2015/lib/place/route/parameter-definition.class.js +10 -9
- package/esm2015/lib/place/route/parameter-definition.class.js.map +1 -1
- package/esm2015/lib/place/route/visit-sanitiser.js +14 -6
- package/esm2015/lib/place/route/visit-sanitiser.js.map +1 -1
- package/esm2015/lib/place/route/visit-sanitiser.metadata.json +1 -1
- package/esm5/coolon-angular-ui-powerups.js +24 -23
- package/esm5/coolon-angular-ui-powerups.js.map +1 -1
- package/esm5/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
- package/esm5/lib/components/components.module.js +9 -2
- package/esm5/lib/components/components.module.js.map +1 -1
- package/esm5/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm5/lib/components/forms/abstract-input.component.js +12 -1
- package/esm5/lib/components/forms/abstract-input.component.js.map +1 -1
- package/esm5/lib/components/forms/number-input/number-input.component.js +2 -2
- package/esm5/lib/components/forms/number-input/number-input.component.js.map +1 -1
- package/esm5/lib/components/forms/password-input/password-input.component.js +2 -2
- package/esm5/lib/components/forms/password-input/password-input.component.js.map +1 -1
- package/esm5/lib/components/forms/select-input/select-input.component.js +3 -3
- package/esm5/lib/components/forms/select-input/select-input.component.js.map +1 -1
- package/esm5/lib/components/forms/string-input/string-input.component.js +3 -3
- package/esm5/lib/components/forms/string-input/string-input.component.js.map +1 -1
- package/esm5/lib/components/index.js +1 -0
- package/esm5/lib/components/index.js.map +1 -1
- package/esm5/lib/components/switch-case/switch-case.component.js +144 -0
- package/esm5/lib/components/switch-case/switch-case.component.js.map +1 -0
- package/esm5/lib/components/switch-case/switch-case.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/switch-case/switch-case.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/directives/command.directive.js +4 -4
- package/esm5/lib/directives/command.directive.js.map +1 -1
- package/esm5/lib/directives/focus-binding.directive.js +3 -3
- package/esm5/lib/directives/focus-binding.directive.js.map +1 -1
- package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +1 -1
- package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +1 -1
- package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +1 -1
- package/esm5/lib/place/components/abstract-place-navigation.component.js +3 -3
- package/esm5/lib/place/components/abstract-place-navigation.component.js.map +1 -1
- package/esm5/lib/place/components/busy-overlay/busy-overlay.component.js +2 -2
- package/esm5/lib/place/components/busy-overlay/busy-overlay.component.js.map +1 -1
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +3 -3
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/esm5/lib/place/guards/place.guard.js +5 -4
- package/esm5/lib/place/guards/place.guard.js.map +1 -1
- package/esm5/lib/place/place-component.js +2 -2
- package/esm5/lib/place/place-component.js.map +1 -1
- package/esm5/lib/place/place-history.js +117 -11
- package/esm5/lib/place/place-history.js.map +1 -1
- package/esm5/lib/place/place-router.js +13 -7
- package/esm5/lib/place/place-router.js.map +1 -1
- package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
- package/esm5/lib/place/route/parameter-definition.class.js +11 -11
- package/esm5/lib/place/route/parameter-definition.class.js.map +1 -1
- package/esm5/lib/place/route/visit-sanitiser.js +14 -6
- package/esm5/lib/place/route/visit-sanitiser.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +377 -127
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +405 -135
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/forms/abstract-input.component.d.ts +11 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/switch-case/switch-case.component.d.ts +32 -0
- package/lib/place/place-history.d.ts +17 -3
- package/lib/place/route/parameter-definition.class.d.ts +1 -1
- package/lib/place/route/visit-sanitiser.d.ts +3 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param, __awaiter } from 'tslib';
|
|
2
2
|
import { DOCUMENT, CommonModule, Location } from '@angular/common';
|
|
3
|
-
import { ElementRef, Inject, Input, HostListener, Directive, NgZone, NgModule, EventEmitter, Output, Component, ContentChild, TemplateRef, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren,
|
|
3
|
+
import { ElementRef, Inject, Input, HostListener, Directive, NgZone, NgModule, EventEmitter, Output, Component, ContentChild, TemplateRef, ChangeDetectorRef, ContentChildren, QueryList, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, ɵɵdefineInjectable, ɵɵinject, Injectable, Optional, SkipSelf, HostBinding } from '@angular/core';
|
|
4
4
|
import { FormsModule } from '@angular/forms';
|
|
5
5
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
6
|
import { MatInputModule } from '@angular/material/input';
|
|
@@ -9,7 +9,7 @@ import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
|
|
|
9
9
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
10
10
|
import { MatButtonModule } from '@angular/material/button';
|
|
11
11
|
import { MatIconModule } from '@angular/material/icon';
|
|
12
|
-
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, Command,
|
|
12
|
+
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, Command, TrackExternal, ListModel, StoreInListModel, ValueModel, StoreInValueModel, Deferred, Trace, MutableListModel, MutableValueModel, Guard, DebugContext, Binding, ValueHolder } from '@coolon/pectin';
|
|
13
13
|
import { PortalModule } from '@angular/cdk/portal';
|
|
14
14
|
import { MatDialogModule, MatDialog, MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
|
|
15
15
|
import { RouterModule, UrlSegment, Router, UrlSerializer, NavigationStart, NavigationEnd, NavigationError, NavigationCancel, RouterOutlet } from '@angular/router';
|
|
@@ -50,7 +50,7 @@ let CommandDirective = class CommandDirective extends GarbageCollector {
|
|
|
50
50
|
assert.notNil(this.pectinCommand);
|
|
51
51
|
if (this.pectinCommand instanceof UnaryCommand) {
|
|
52
52
|
if (!this._commandParameterProvided) {
|
|
53
|
-
lang.illegalState('UnaryCommands
|
|
53
|
+
lang.illegalState('UnaryCommands require the command parameter to be specified.');
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
@@ -62,8 +62,8 @@ let CommandDirective = class CommandDirective extends GarbageCollector {
|
|
|
62
62
|
ngAfterViewInit() {
|
|
63
63
|
// for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
|
|
64
64
|
// we need to do this.
|
|
65
|
-
const {
|
|
66
|
-
|
|
65
|
+
const { when } = Dsl.disposeWith(this);
|
|
66
|
+
when.valueOf(this._commandEnabled).changes(enabled => {
|
|
67
67
|
if (enabled) {
|
|
68
68
|
this.elementRef.nativeElement.removeAttribute('disabled');
|
|
69
69
|
if (this.elementRef.nativeElement.tagName === 'A') {
|
|
@@ -76,7 +76,7 @@ let CommandDirective = class CommandDirective extends GarbageCollector {
|
|
|
76
76
|
this.elementRef.nativeElement.removeAttribute('href');
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
});
|
|
79
|
+
}, { initialValue: 'triggerChange' });
|
|
80
80
|
}
|
|
81
81
|
ngOnDestroy() {
|
|
82
82
|
this.dispose();
|
|
@@ -157,12 +157,12 @@ let FocusBindingDirective = class FocusBindingDirective extends DisposableCompon
|
|
|
157
157
|
ngAfterViewInit() {
|
|
158
158
|
// TODO: Make this also track the current enabled/disabled state.
|
|
159
159
|
if (this.hasBinding()) {
|
|
160
|
-
const {
|
|
161
|
-
|
|
160
|
+
const { when } = Dsl.disposeWith(this);
|
|
161
|
+
when.valueOf(this.pectinFocusBinding.focusContext.focused).changes((focused) => {
|
|
162
162
|
if (focused && !this.alreadyHasFocus()) {
|
|
163
163
|
this.tryAndFocus();
|
|
164
164
|
}
|
|
165
|
-
});
|
|
165
|
+
}, { initialValue: 'triggerChange' });
|
|
166
166
|
}
|
|
167
167
|
else {
|
|
168
168
|
Logger.get(this).warn('pectinFocusBinding was nil');
|
|
@@ -279,7 +279,18 @@ DirectivesModule = __decorate([
|
|
|
279
279
|
let AbstractInputComponent = class AbstractInputComponent extends DisposableComponent {
|
|
280
280
|
constructor() {
|
|
281
281
|
super();
|
|
282
|
-
|
|
282
|
+
/**
|
|
283
|
+
* A backing model for all our @Input() valueModel properties which should be defined as follows.
|
|
284
|
+
*
|
|
285
|
+
* @Input() @TrackExternal({useExisting: "delegatingFormValueModel"})
|
|
286
|
+
* valueModel: FormValueModel<string> | MutableValueModel<string>;
|
|
287
|
+
*
|
|
288
|
+
* This approach allows the input to accept plain or form models but all backed by a form
|
|
289
|
+
* friendly delegate. We have to use an existing delegate for union types as pectin just
|
|
290
|
+
* gets told it's an Object and can't scan for a base type annotated with @DelegateUsing(..).
|
|
291
|
+
*/
|
|
292
|
+
// We have to register it as a disposable so it ditches any listeners when we're disposed.
|
|
293
|
+
this.delegatingFormValueModel = this.registerDisposable(new DelegatingFormValueModel());
|
|
283
294
|
// TODO: fix this.
|
|
284
295
|
// tslint:disable-next-line:no-output-native
|
|
285
296
|
this.focus = new EventEmitter();
|
|
@@ -421,7 +432,7 @@ let NumberInputComponent = class NumberInputComponent extends AbstractInputCompo
|
|
|
421
432
|
}
|
|
422
433
|
};
|
|
423
434
|
__decorate([
|
|
424
|
-
Input(),
|
|
435
|
+
Input(), TrackExternal({ delegateTo: "delegatingFormValueModel" }),
|
|
425
436
|
__metadata("design:type", Object)
|
|
426
437
|
], NumberInputComponent.prototype, "valueModel", void 0);
|
|
427
438
|
NumberInputComponent = __decorate([
|
|
@@ -441,7 +452,7 @@ let PasswordInputComponent = class PasswordInputComponent extends AbstractInputC
|
|
|
441
452
|
}
|
|
442
453
|
};
|
|
443
454
|
__decorate([
|
|
444
|
-
Input(),
|
|
455
|
+
Input(), TrackExternal({ delegateTo: "delegatingFormValueModel" }),
|
|
445
456
|
__metadata("design:type", Object)
|
|
446
457
|
], PasswordInputComponent.prototype, "valueModel", void 0);
|
|
447
458
|
PasswordInputComponent = __decorate([
|
|
@@ -462,11 +473,11 @@ let SelectInputComponent = class SelectInputComponent extends AbstractInputCompo
|
|
|
462
473
|
}
|
|
463
474
|
};
|
|
464
475
|
__decorate([
|
|
465
|
-
Input(),
|
|
476
|
+
Input(), TrackExternal({ delegateTo: "delegatingFormValueModel" }),
|
|
466
477
|
__metadata("design:type", Object)
|
|
467
478
|
], SelectInputComponent.prototype, "valueModel", void 0);
|
|
468
479
|
__decorate([
|
|
469
|
-
Input(),
|
|
480
|
+
Input(), TrackExternal(),
|
|
470
481
|
__metadata("design:type", ListModel)
|
|
471
482
|
], SelectInputComponent.prototype, "optionsModel", void 0);
|
|
472
483
|
__decorate([
|
|
@@ -515,11 +526,11 @@ let StringInputComponent = class StringInputComponent extends AbstractInputCompo
|
|
|
515
526
|
}
|
|
516
527
|
};
|
|
517
528
|
__decorate([
|
|
518
|
-
Input(),
|
|
529
|
+
Input(), TrackExternal({ delegateTo: "delegatingFormValueModel" }),
|
|
519
530
|
__metadata("design:type", Object)
|
|
520
531
|
], StringInputComponent.prototype, "valueModel", void 0);
|
|
521
532
|
__decorate([
|
|
522
|
-
Input(),
|
|
533
|
+
Input(), TrackExternal({ defaultValue: false }),
|
|
523
534
|
__metadata("design:type", ValueModel)
|
|
524
535
|
], StringInputComponent.prototype, "enableClearModel", void 0);
|
|
525
536
|
__decorate([
|
|
@@ -562,6 +573,123 @@ ScrollContainerComponent = __decorate([
|
|
|
562
573
|
__metadata("design:paramtypes", [])
|
|
563
574
|
], ScrollContainerComponent);
|
|
564
575
|
|
|
576
|
+
var SwitchCaseWhenDirective_1, SwitchCaseDefaultDirective_1;
|
|
577
|
+
class SwitchCaseOption {
|
|
578
|
+
constructor(templateRef) {
|
|
579
|
+
this.templateRef = templateRef;
|
|
580
|
+
}
|
|
581
|
+
get name() {
|
|
582
|
+
return this.constructor.name;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
let SwitchCaseWhenDirective = SwitchCaseWhenDirective_1 = class SwitchCaseWhenDirective extends SwitchCaseOption {
|
|
586
|
+
constructor(templateRef) {
|
|
587
|
+
super(templateRef);
|
|
588
|
+
this.isDefault = false;
|
|
589
|
+
}
|
|
590
|
+
matches(value) {
|
|
591
|
+
return this.aupSwitchCaseWhen === value;
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
SwitchCaseWhenDirective.ctorParameters = () => [
|
|
595
|
+
{ type: TemplateRef }
|
|
596
|
+
];
|
|
597
|
+
__decorate([
|
|
598
|
+
Input(),
|
|
599
|
+
__metadata("design:type", Object)
|
|
600
|
+
], SwitchCaseWhenDirective.prototype, "aupSwitchCaseWhen", void 0);
|
|
601
|
+
SwitchCaseWhenDirective = SwitchCaseWhenDirective_1 = __decorate([
|
|
602
|
+
Directive({
|
|
603
|
+
selector: '[aupSwitchCaseWhen]',
|
|
604
|
+
providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseWhenDirective_1 }]
|
|
605
|
+
}),
|
|
606
|
+
__metadata("design:paramtypes", [TemplateRef])
|
|
607
|
+
], SwitchCaseWhenDirective);
|
|
608
|
+
let SwitchCaseDefaultDirective = SwitchCaseDefaultDirective_1 = class SwitchCaseDefaultDirective extends SwitchCaseOption {
|
|
609
|
+
constructor(templateRef) {
|
|
610
|
+
super(templateRef);
|
|
611
|
+
this.isDefault = true;
|
|
612
|
+
}
|
|
613
|
+
matches(value) {
|
|
614
|
+
return false;
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
SwitchCaseDefaultDirective.ctorParameters = () => [
|
|
618
|
+
{ type: TemplateRef }
|
|
619
|
+
];
|
|
620
|
+
SwitchCaseDefaultDirective = SwitchCaseDefaultDirective_1 = __decorate([
|
|
621
|
+
Directive({
|
|
622
|
+
selector: '[aupSwitchCaseDefault]',
|
|
623
|
+
providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseDefaultDirective_1 }]
|
|
624
|
+
}),
|
|
625
|
+
__metadata("design:paramtypes", [TemplateRef])
|
|
626
|
+
], SwitchCaseDefaultDirective);
|
|
627
|
+
let SwitchCaseComponent = class SwitchCaseComponent extends DisposableComponent {
|
|
628
|
+
constructor(cdr) {
|
|
629
|
+
super();
|
|
630
|
+
this.cdr = cdr;
|
|
631
|
+
this.selectedIndex = 0;
|
|
632
|
+
}
|
|
633
|
+
ngOnInit() {
|
|
634
|
+
}
|
|
635
|
+
ngAfterContentInit() {
|
|
636
|
+
const subscription = this.switchCaseOptions.changes.subscribe(change => this.updateSelection());
|
|
637
|
+
this.onDispose(() => subscription.unsubscribe());
|
|
638
|
+
const { chain, when } = Dsl.disposeWith(this);
|
|
639
|
+
when.valueOf(this.switchModel).changes(() => this.updateSelection(), { initialValue: 'triggerChange' });
|
|
640
|
+
this.cdr.detectChanges();
|
|
641
|
+
}
|
|
642
|
+
updateSelection() {
|
|
643
|
+
const matchingIndicies = [];
|
|
644
|
+
this.switchCaseOptions.forEach((option, index) => {
|
|
645
|
+
if (option.matches(this.switchModel.value)) {
|
|
646
|
+
matchingIndicies.push(index);
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
if (matchingIndicies.length > 1) {
|
|
650
|
+
console.warn(`found ${matchingIndicies.length} matching case values, displaying the first.`);
|
|
651
|
+
}
|
|
652
|
+
if (matchingIndicies.length === 0) {
|
|
653
|
+
this.switchCaseOptions.forEach((option, index) => {
|
|
654
|
+
matchingIndicies.push(index);
|
|
655
|
+
});
|
|
656
|
+
if (matchingIndicies.length > 1) {
|
|
657
|
+
console.warn(`found ${matchingIndicies.length} default case values, displaying the first.`);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (matchingIndicies.length > 0) {
|
|
661
|
+
this.selectedIndex = matchingIndicies[0];
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
console.warn(`found no matching or default case values.`);
|
|
665
|
+
this.selectedIndex = -1;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
SwitchCaseComponent.ctorParameters = () => [
|
|
670
|
+
{ type: ChangeDetectorRef }
|
|
671
|
+
];
|
|
672
|
+
__decorate([
|
|
673
|
+
Input(), TrackExternal(),
|
|
674
|
+
__metadata("design:type", ValueModel)
|
|
675
|
+
], SwitchCaseComponent.prototype, "switchModel", void 0);
|
|
676
|
+
__decorate([
|
|
677
|
+
Input(), StoreInValueModel('switchModel'),
|
|
678
|
+
__metadata("design:type", Object)
|
|
679
|
+
], SwitchCaseComponent.prototype, "switch", void 0);
|
|
680
|
+
__decorate([
|
|
681
|
+
ContentChildren(SwitchCaseOption),
|
|
682
|
+
__metadata("design:type", QueryList)
|
|
683
|
+
], SwitchCaseComponent.prototype, "switchCaseOptions", void 0);
|
|
684
|
+
SwitchCaseComponent = __decorate([
|
|
685
|
+
Component({
|
|
686
|
+
selector: 'aup-switch-case',
|
|
687
|
+
template: "<mat-tab-group class=\"content-wrapper\" no-tab-header full-height-tabs [selectedIndex]=\"selectedIndex\">\n <mat-tab *ngFor=\"let option of switchCaseOptions\">\n <ng-template [ngTemplateOutlet]=\"option.templateRef\"></ng-template>\n </mat-tab>\n</mat-tab-group>\n\n\n",
|
|
688
|
+
styles: [":host{display:flex;flex-direction:column;align-items:stretch}mat-tab-group{flex:1}"]
|
|
689
|
+
}),
|
|
690
|
+
__metadata("design:paramtypes", [ChangeDetectorRef])
|
|
691
|
+
], SwitchCaseComponent);
|
|
692
|
+
|
|
565
693
|
let ComponentsModule = class ComponentsModule {
|
|
566
694
|
};
|
|
567
695
|
ComponentsModule = __decorate([
|
|
@@ -573,7 +701,10 @@ ComponentsModule = __decorate([
|
|
|
573
701
|
SelectInputComponent,
|
|
574
702
|
ScrollContainerComponent,
|
|
575
703
|
NoopComponent,
|
|
576
|
-
AbstractInputComponent
|
|
704
|
+
AbstractInputComponent,
|
|
705
|
+
SwitchCaseComponent,
|
|
706
|
+
SwitchCaseWhenDirective,
|
|
707
|
+
SwitchCaseDefaultDirective
|
|
577
708
|
],
|
|
578
709
|
imports: [
|
|
579
710
|
CommonModule,
|
|
@@ -593,7 +724,10 @@ ComponentsModule = __decorate([
|
|
|
593
724
|
PasswordInputComponent,
|
|
594
725
|
SelectInputComponent,
|
|
595
726
|
ScrollContainerComponent,
|
|
596
|
-
NoopComponent
|
|
727
|
+
NoopComponent,
|
|
728
|
+
SwitchCaseComponent,
|
|
729
|
+
SwitchCaseWhenDirective,
|
|
730
|
+
SwitchCaseDefaultDirective
|
|
597
731
|
]
|
|
598
732
|
})
|
|
599
733
|
], ComponentsModule);
|
|
@@ -651,7 +785,7 @@ AlertDialogComponent = __decorate([
|
|
|
651
785
|
Component({
|
|
652
786
|
selector: 'aup-alert-dialog',
|
|
653
787
|
template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</div>\n",
|
|
654
|
-
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
|
|
788
|
+
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
|
|
655
789
|
}),
|
|
656
790
|
__param(0, Inject(ACTIVITY_DATA)),
|
|
657
791
|
__metadata("design:paramtypes", [Object])
|
|
@@ -684,7 +818,7 @@ ConfirmThenDialogComponent = __decorate([
|
|
|
684
818
|
Component({
|
|
685
819
|
selector: 'aup-confirmation-dialog',
|
|
686
820
|
template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
|
|
687
|
-
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
|
|
821
|
+
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
|
|
688
822
|
}),
|
|
689
823
|
__param(0, Inject(ACTIVITY_DATA)),
|
|
690
824
|
__metadata("design:paramtypes", [Object])
|
|
@@ -709,7 +843,7 @@ ConfirmationDialogComponent = __decorate([
|
|
|
709
843
|
Component({
|
|
710
844
|
selector: 'aup-confirmation-dialog',
|
|
711
845
|
template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
|
|
712
|
-
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
|
|
846
|
+
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
|
|
713
847
|
}),
|
|
714
848
|
__param(0, Inject(ACTIVITY_DATA)),
|
|
715
849
|
__metadata("design:paramtypes", [Object])
|
|
@@ -1327,19 +1461,20 @@ class ParameterDefinition {
|
|
|
1327
1461
|
return this.options.getOptional(key, null);
|
|
1328
1462
|
}
|
|
1329
1463
|
// @Trace()
|
|
1330
|
-
sanitise(value, visit, placeHistory, injector) {
|
|
1464
|
+
sanitise(value, visit, placeHistory, injector, isPopState) {
|
|
1331
1465
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1332
1466
|
if (this.isMissingFrom(visit)) {
|
|
1333
|
-
const
|
|
1334
|
-
if (
|
|
1335
|
-
|
|
1467
|
+
const returningFromSomewhereElse = !placeHistory.lastVisitIncluded(visit.placeDefinition);
|
|
1468
|
+
if (returningFromSomewhereElse) {
|
|
1469
|
+
const lastKnownVisit = placeHistory.getMostRecentVisitFor(visit.placeDefinition);
|
|
1470
|
+
if (this.remember && lastKnownVisit) {
|
|
1471
|
+
value = lastKnownVisit.getParameter(this.name);
|
|
1472
|
+
}
|
|
1473
|
+
return this.isEmptyValue(value) ? this.defaultValue : value;
|
|
1336
1474
|
}
|
|
1337
|
-
return this.isEmptyValue(value) ? this.defaultValue : value;
|
|
1338
|
-
}
|
|
1339
|
-
else {
|
|
1340
|
-
// todo: add custom sanitiser
|
|
1341
|
-
return value;
|
|
1342
1475
|
}
|
|
1476
|
+
// todo: add custom sanitiser
|
|
1477
|
+
return value;
|
|
1343
1478
|
});
|
|
1344
1479
|
}
|
|
1345
1480
|
isMissingFrom(visit) {
|
|
@@ -1567,11 +1702,11 @@ let PlaceComponent = PlaceComponent_1 = class PlaceComponent extends DisposableC
|
|
|
1567
1702
|
const binding = this.registerDisposable(new Binding(this.visitModel, model, {
|
|
1568
1703
|
toRight(visit) {
|
|
1569
1704
|
const value = visit.getParameter(parameterDef.name);
|
|
1570
|
-
console.log('push to component', { name: parameterDef.name, value, visit });
|
|
1705
|
+
// console.log('push to component', { name: parameterDef.name, value, visit });
|
|
1571
1706
|
return value;
|
|
1572
1707
|
},
|
|
1573
1708
|
toLeft(value, currentVisit) {
|
|
1574
|
-
console.log('push to route', { name: parameterDef.name, value, currentVisit });
|
|
1709
|
+
// console.log('push to route', { name: parameterDef.name, value, currentVisit });
|
|
1575
1710
|
return currentVisit.replace(parameterDef, value);
|
|
1576
1711
|
}
|
|
1577
1712
|
}));
|
|
@@ -2294,21 +2429,34 @@ class PopStateNavigation extends AbstractPopStateNavigation {
|
|
|
2294
2429
|
}
|
|
2295
2430
|
}
|
|
2296
2431
|
|
|
2297
|
-
|
|
2432
|
+
var PlaceHistory_1;
|
|
2433
|
+
let PlaceHistory = PlaceHistory_1 = class PlaceHistory {
|
|
2298
2434
|
constructor() {
|
|
2299
|
-
this.
|
|
2435
|
+
this._archive = new Map();
|
|
2436
|
+
this.placeHistoryDepth = 4;
|
|
2300
2437
|
}
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
if (!previousState || state.hasChangedFrom(previousState)) {
|
|
2306
|
-
history.unshift(state); // LIFO
|
|
2307
|
-
this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
|
|
2438
|
+
notifyNavigationStarted() {
|
|
2439
|
+
if (this._activeVisits) {
|
|
2440
|
+
this.archive(this._activeVisits.visits);
|
|
2441
|
+
this._previousVisits = this._activeVisits;
|
|
2308
2442
|
}
|
|
2309
2443
|
}
|
|
2444
|
+
notifyNavigationFinished(visits) {
|
|
2445
|
+
this._activeVisits = new PlaceHistory_1.VisitRecord(visits);
|
|
2446
|
+
}
|
|
2447
|
+
updateVisit(visit) {
|
|
2448
|
+
assert.isTruthy(this._activeVisits);
|
|
2449
|
+
this._activeVisits.update(visit);
|
|
2450
|
+
}
|
|
2451
|
+
lastVisitIncluded(placeDef) {
|
|
2452
|
+
var _a;
|
|
2453
|
+
return !!((_a = this._previousVisits) === null || _a === void 0 ? void 0 : _a.getVisitFor(placeDef));
|
|
2454
|
+
}
|
|
2455
|
+
getMostRecentVisitFor(placeDef) {
|
|
2456
|
+
return ___default.first(this.getHistory(placeDef));
|
|
2457
|
+
}
|
|
2310
2458
|
getHistory(placeDef) {
|
|
2311
|
-
let history = this.
|
|
2459
|
+
let history = this._archive.get(placeDef);
|
|
2312
2460
|
if (!history) {
|
|
2313
2461
|
history = [];
|
|
2314
2462
|
this.setHistory(placeDef, history);
|
|
@@ -2316,16 +2464,105 @@ let PlaceHistory = class PlaceHistory {
|
|
|
2316
2464
|
return history;
|
|
2317
2465
|
}
|
|
2318
2466
|
setHistory(placeDef, history) {
|
|
2319
|
-
this.
|
|
2467
|
+
this._archive.set(placeDef, history);
|
|
2468
|
+
}
|
|
2469
|
+
archive(visits) {
|
|
2470
|
+
visits.forEach(state => {
|
|
2471
|
+
const history = this.getHistory(state.placeDefinition);
|
|
2472
|
+
const previousState = ___default.first(history);
|
|
2473
|
+
if (!previousState || state.hasChangedFrom(previousState)) {
|
|
2474
|
+
history.unshift(state); // LIFO
|
|
2475
|
+
this.setHistory(state.placeDefinition, history.slice(0, this.placeHistoryDepth));
|
|
2476
|
+
}
|
|
2477
|
+
});
|
|
2320
2478
|
}
|
|
2321
2479
|
};
|
|
2322
2480
|
PlaceHistory.ɵprov = ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(); }, token: PlaceHistory, providedIn: "root" });
|
|
2323
|
-
PlaceHistory = __decorate([
|
|
2481
|
+
PlaceHistory = PlaceHistory_1 = __decorate([
|
|
2324
2482
|
Injectable({
|
|
2325
2483
|
providedIn: 'root'
|
|
2326
2484
|
}),
|
|
2327
2485
|
__metadata("design:paramtypes", [])
|
|
2328
2486
|
], PlaceHistory);
|
|
2487
|
+
(function (PlaceHistory) {
|
|
2488
|
+
class VisitRecord {
|
|
2489
|
+
constructor(visits) {
|
|
2490
|
+
this.visits = visits;
|
|
2491
|
+
}
|
|
2492
|
+
update(visit) {
|
|
2493
|
+
this.visits = this.visits.filter(v => v.placeDefinition !== visit.placeDefinition).concat(visit);
|
|
2494
|
+
}
|
|
2495
|
+
getVisitFor(placeDef) {
|
|
2496
|
+
return this.visits.find(v => v.placeDefinition === placeDef);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
PlaceHistory.VisitRecord = VisitRecord;
|
|
2500
|
+
// export class Query {
|
|
2501
|
+
// private _history: Visit.State[];
|
|
2502
|
+
// private _places: Place[];
|
|
2503
|
+
// private _predicate: (visit: any) => boolean;
|
|
2504
|
+
// private _limit: number;
|
|
2505
|
+
//
|
|
2506
|
+
// constructor(history, limit = history.length) {
|
|
2507
|
+
// this._history = history;
|
|
2508
|
+
// this._places = [];
|
|
2509
|
+
// this._predicate = (visit => true);
|
|
2510
|
+
// this._limit = limit;
|
|
2511
|
+
// }
|
|
2512
|
+
//
|
|
2513
|
+
// to(...places:Place[]):this {
|
|
2514
|
+
// this._places = places;
|
|
2515
|
+
// return this;
|
|
2516
|
+
// }
|
|
2517
|
+
//
|
|
2518
|
+
// with(parameters: { [parameter: string]: any }): this {
|
|
2519
|
+
// this.matching(state => {
|
|
2520
|
+
// return Object.keys(parameters).reduce((acc, key) => {
|
|
2521
|
+
// const matchValue = parameters[key];
|
|
2522
|
+
// const visitValue = state.get(key);
|
|
2523
|
+
// const matched = matchValue === '*' ? !_.isNil(visitValue) : visitValue == matchValue;
|
|
2524
|
+
// // Logger.get(this).info(`matched=${matched}`, parameters, visitValue);
|
|
2525
|
+
// return acc && matched;
|
|
2526
|
+
// }, true);
|
|
2527
|
+
// });
|
|
2528
|
+
// return this;
|
|
2529
|
+
// }
|
|
2530
|
+
//
|
|
2531
|
+
// last(): Visit.State {
|
|
2532
|
+
// return _.findLast(this._history, visit => this._matches(visit))
|
|
2533
|
+
// }
|
|
2534
|
+
//
|
|
2535
|
+
// // @trace
|
|
2536
|
+
// allThatMatch(): Visit.State[] {
|
|
2537
|
+
// return _.filter(this._history, visit => this._matches(visit)).slice(-this._limit);
|
|
2538
|
+
// }
|
|
2539
|
+
//
|
|
2540
|
+
// // @trace
|
|
2541
|
+
// mostRecentValueOf<T=any>(param: string, defaultValue: T = null): T {
|
|
2542
|
+
// const lastStateWithParam = _.findLast(this.allThatMatch(), state => !_.isNil(state.get(param)));
|
|
2543
|
+
// return _.isNil(lastStateWithParam) ? defaultValue : lastStateWithParam.get(param);
|
|
2544
|
+
// }
|
|
2545
|
+
//
|
|
2546
|
+
// limit(limit: number): this {
|
|
2547
|
+
// this._limit = limit;
|
|
2548
|
+
// return this;
|
|
2549
|
+
// }
|
|
2550
|
+
//
|
|
2551
|
+
// matching(predicate: (visit: Visit.State) => boolean): this {
|
|
2552
|
+
// this._predicate = predicate;
|
|
2553
|
+
// return this;
|
|
2554
|
+
// }
|
|
2555
|
+
//
|
|
2556
|
+
// _matches(visit: Visit.State) {
|
|
2557
|
+
// return this._isPlaceMatch(visit) && this._predicate(visit);
|
|
2558
|
+
// }
|
|
2559
|
+
//
|
|
2560
|
+
// _isPlaceMatch(visit: Visit.State) {
|
|
2561
|
+
// return this._places.length < 1 || this._places.includes(visit.place)
|
|
2562
|
+
// }
|
|
2563
|
+
//
|
|
2564
|
+
// }
|
|
2565
|
+
})(PlaceHistory || (PlaceHistory = {}));
|
|
2329
2566
|
|
|
2330
2567
|
class UrlSnapshot {
|
|
2331
2568
|
// TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
|
|
@@ -2482,6 +2719,70 @@ UrlService = __decorate([
|
|
|
2482
2719
|
__metadata("design:paramtypes", [Router, Location, UrlSerializer])
|
|
2483
2720
|
], UrlService);
|
|
2484
2721
|
|
|
2722
|
+
class Visit {
|
|
2723
|
+
constructor(placeDefinition, visitParameters = {}) {
|
|
2724
|
+
this.placeDefinition = placeDefinition;
|
|
2725
|
+
this.visitParameters = visitParameters;
|
|
2726
|
+
}
|
|
2727
|
+
// @Trace()
|
|
2728
|
+
getRouteId() {
|
|
2729
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
2730
|
+
}
|
|
2731
|
+
// @Trace()
|
|
2732
|
+
hasRouteId() {
|
|
2733
|
+
return !isNil(this.getRouteId());
|
|
2734
|
+
}
|
|
2735
|
+
/**
|
|
2736
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
2737
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
2738
|
+
* same as the the ValueModel property name.
|
|
2739
|
+
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
2740
|
+
*/
|
|
2741
|
+
getParameter(parameterName) {
|
|
2742
|
+
return this.visitParameters[parameterName];
|
|
2743
|
+
}
|
|
2744
|
+
// @Trace()
|
|
2745
|
+
hasParameter(parameterName) {
|
|
2746
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
2747
|
+
}
|
|
2748
|
+
replace(parameter, value) {
|
|
2749
|
+
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
|
|
2750
|
+
}
|
|
2751
|
+
mergeRouteParameters(routeParams) {
|
|
2752
|
+
// todo: whitelist parameters.
|
|
2753
|
+
const routeParameterKeys = Object.keys(routeParams);
|
|
2754
|
+
const params = {};
|
|
2755
|
+
this.placeDefinition.getVisitParameterDefs().forEach(def => {
|
|
2756
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
2757
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
2758
|
+
params[def.name] = routeParams[def.name];
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
else {
|
|
2762
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
2763
|
+
// defaults and remember sanitisation process.
|
|
2764
|
+
const value = this.getParameter(def.name);
|
|
2765
|
+
if (this.hasParameter(def.name)) {
|
|
2766
|
+
params[def.name] = value;
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
});
|
|
2770
|
+
return new Visit(this.placeDefinition, params);
|
|
2771
|
+
}
|
|
2772
|
+
hasRoutingChangedFrom(other) {
|
|
2773
|
+
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
2774
|
+
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
2775
|
+
return !samePlace || !sameRouteParameters;
|
|
2776
|
+
}
|
|
2777
|
+
hasChangedFrom(other) {
|
|
2778
|
+
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
2779
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
2780
|
+
}
|
|
2781
|
+
toDebugString() {
|
|
2782
|
+
return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(",");
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2485
2786
|
let PlaceRouter = class PlaceRouter extends GarbageCollector {
|
|
2486
2787
|
constructor(angularRouter, angularLocation, interactionService, urlService, placeHistory) {
|
|
2487
2788
|
super();
|
|
@@ -2643,12 +2944,9 @@ let PlaceRouter = class PlaceRouter extends GarbageCollector {
|
|
|
2643
2944
|
get activeVisits() {
|
|
2644
2945
|
return this._activeVisits.readonly;
|
|
2645
2946
|
}
|
|
2646
|
-
// @Trace()
|
|
2647
2947
|
pushVisitChangesToRoute(previous, next) {
|
|
2648
2948
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2649
|
-
|
|
2650
|
-
// when it's been cleared by the user.
|
|
2651
|
-
this.placeHistory.add(next);
|
|
2949
|
+
this.placeHistory.updateVisit(next);
|
|
2652
2950
|
// FIXME: no route id -> route id duplicates route parameters
|
|
2653
2951
|
if (next.hasRoutingChangedFrom(previous)) {
|
|
2654
2952
|
return this.doNavigation(next, router => {
|
|
@@ -2668,6 +2966,9 @@ let PlaceRouter = class PlaceRouter extends GarbageCollector {
|
|
|
2668
2966
|
// @Trace()
|
|
2669
2967
|
transitionTo(next) {
|
|
2670
2968
|
const previous = this.navigationSessionModel.value;
|
|
2969
|
+
if (!previous) {
|
|
2970
|
+
this.placeHistory.notifyNavigationStarted();
|
|
2971
|
+
}
|
|
2671
2972
|
assert.isTruthy(next !== previous);
|
|
2672
2973
|
Logger.get(this).info(`### Router State Transition: ${previous ? previous.toString() : 'null'} -> ${next.toString()}`);
|
|
2673
2974
|
this.navigationSessionModel.value = next;
|
|
@@ -2680,7 +2981,7 @@ let PlaceRouter = class PlaceRouter extends GarbageCollector {
|
|
|
2680
2981
|
routingSessionFinished(visits) {
|
|
2681
2982
|
if (visits && visits.length > 0) {
|
|
2682
2983
|
assert.isTruthy(this.navigationInProgress.value);
|
|
2683
|
-
|
|
2984
|
+
this.placeHistory.notifyNavigationFinished(visits);
|
|
2684
2985
|
// We update the active visits before we finish the session so the
|
|
2685
2986
|
// place outlets can ignore the incoming changes until things are
|
|
2686
2987
|
// settled. TODO: can we removed the event'ness here and just do a push?
|
|
@@ -2739,6 +3040,12 @@ PlaceRouter.ctorParameters = () => [
|
|
|
2739
3040
|
{ type: PlaceHistory }
|
|
2740
3041
|
];
|
|
2741
3042
|
PlaceRouter.ɵprov = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location), ɵɵinject(InteractionService), ɵɵinject(UrlService), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
3043
|
+
__decorate([
|
|
3044
|
+
Trace(),
|
|
3045
|
+
__metadata("design:type", Function),
|
|
3046
|
+
__metadata("design:paramtypes", [Visit, Visit]),
|
|
3047
|
+
__metadata("design:returntype", Promise)
|
|
3048
|
+
], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
|
|
2742
3049
|
PlaceRouter = __decorate([
|
|
2743
3050
|
Injectable({
|
|
2744
3051
|
providedIn: 'root'
|
|
@@ -2750,70 +3057,6 @@ PlaceRouter = __decorate([
|
|
|
2750
3057
|
PlaceHistory])
|
|
2751
3058
|
], PlaceRouter);
|
|
2752
3059
|
|
|
2753
|
-
class Visit {
|
|
2754
|
-
constructor(placeDefinition, visitParameters = {}) {
|
|
2755
|
-
this.placeDefinition = placeDefinition;
|
|
2756
|
-
this.visitParameters = visitParameters;
|
|
2757
|
-
}
|
|
2758
|
-
// @Trace()
|
|
2759
|
-
getRouteId() {
|
|
2760
|
-
return this.placeDefinition.getRouteIdFrom(this);
|
|
2761
|
-
}
|
|
2762
|
-
// @Trace()
|
|
2763
|
-
hasRouteId() {
|
|
2764
|
-
return !isNil(this.getRouteId());
|
|
2765
|
-
}
|
|
2766
|
-
/**
|
|
2767
|
-
* Returns the value of the place parameter with the specified name. The parameter
|
|
2768
|
-
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
2769
|
-
* same as the the ValueModel property name.
|
|
2770
|
-
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
2771
|
-
*/
|
|
2772
|
-
getParameter(parameterName) {
|
|
2773
|
-
return this.visitParameters[parameterName];
|
|
2774
|
-
}
|
|
2775
|
-
// @Trace()
|
|
2776
|
-
hasParameter(parameterName) {
|
|
2777
|
-
return Object.keys(this.visitParameters).includes(parameterName);
|
|
2778
|
-
}
|
|
2779
|
-
replace(parameter, value) {
|
|
2780
|
-
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
|
|
2781
|
-
}
|
|
2782
|
-
mergeRouteParameters(routeParams) {
|
|
2783
|
-
// todo: whitelist parameters.
|
|
2784
|
-
const routeParameterKeys = Object.keys(routeParams);
|
|
2785
|
-
const params = {};
|
|
2786
|
-
this.placeDefinition.getVisitParameterDefs().forEach(def => {
|
|
2787
|
-
if (def.isRouteId || def.isRouteParameter) {
|
|
2788
|
-
if (routeParameterKeys.includes(def.name)) {
|
|
2789
|
-
params[def.name] = routeParams[def.name];
|
|
2790
|
-
}
|
|
2791
|
-
}
|
|
2792
|
-
else {
|
|
2793
|
-
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
2794
|
-
// defaults and remember sanitisation process.
|
|
2795
|
-
const value = this.getParameter(def.name);
|
|
2796
|
-
if (this.hasParameter(def.name)) {
|
|
2797
|
-
params[def.name] = value;
|
|
2798
|
-
}
|
|
2799
|
-
}
|
|
2800
|
-
});
|
|
2801
|
-
return new Visit(this.placeDefinition, params);
|
|
2802
|
-
}
|
|
2803
|
-
hasRoutingChangedFrom(other) {
|
|
2804
|
-
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
2805
|
-
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
2806
|
-
return !samePlace || !sameRouteParameters;
|
|
2807
|
-
}
|
|
2808
|
-
hasChangedFrom(other) {
|
|
2809
|
-
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
2810
|
-
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
2811
|
-
}
|
|
2812
|
-
toDebugString() {
|
|
2813
|
-
return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(",");
|
|
2814
|
-
}
|
|
2815
|
-
}
|
|
2816
|
-
|
|
2817
3060
|
const AUP_PLACE_CONFIG = new InjectionToken('AUP_PLACE_CONFIG');
|
|
2818
3061
|
|
|
2819
3062
|
// Freezes the state of the components at the start of the animation.
|
|
@@ -3003,11 +3246,11 @@ __decorate([
|
|
|
3003
3246
|
__metadata("design:type", Boolean)
|
|
3004
3247
|
], PlaceOutletComponent.prototype, "animate", void 0);
|
|
3005
3248
|
__decorate([
|
|
3006
|
-
Input(),
|
|
3249
|
+
Input(), TrackExternal({ defaultValue: true }),
|
|
3007
3250
|
__metadata("design:type", ValueModel)
|
|
3008
3251
|
], PlaceOutletComponent.prototype, "animateModel", void 0);
|
|
3009
3252
|
__decorate([
|
|
3010
|
-
Input('placeAnimationOrderModel'),
|
|
3253
|
+
Input('placeAnimationOrderModel'), TrackExternal(),
|
|
3011
3254
|
__metadata("design:type", ListModel)
|
|
3012
3255
|
], PlaceOutletComponent.prototype, "customPlaceAnimationOrderModel", void 0);
|
|
3013
3256
|
__decorate([
|
|
@@ -3074,7 +3317,7 @@ __decorate([
|
|
|
3074
3317
|
__metadata("design:type", Array)
|
|
3075
3318
|
], AbstractPlaceNavigationComponent.prototype, "places", void 0);
|
|
3076
3319
|
__decorate([
|
|
3077
|
-
Input(),
|
|
3320
|
+
Input(), TrackExternal(),
|
|
3078
3321
|
__metadata("design:type", ListModel)
|
|
3079
3322
|
], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
|
|
3080
3323
|
__decorate([
|
|
@@ -3082,7 +3325,7 @@ __decorate([
|
|
|
3082
3325
|
__metadata("design:type", PlaceOutletComponent)
|
|
3083
3326
|
], AbstractPlaceNavigationComponent.prototype, "placeOutlet", void 0);
|
|
3084
3327
|
__decorate([
|
|
3085
|
-
Input(),
|
|
3328
|
+
Input(), TrackExternal(),
|
|
3086
3329
|
__metadata("design:type", ValueModel)
|
|
3087
3330
|
], AbstractPlaceNavigationComponent.prototype, "placeOutletModel", void 0);
|
|
3088
3331
|
__decorate([
|
|
@@ -3105,7 +3348,7 @@ let BusyOverlayComponent = class BusyOverlayComponent {
|
|
|
3105
3348
|
}
|
|
3106
3349
|
};
|
|
3107
3350
|
__decorate([
|
|
3108
|
-
Input(),
|
|
3351
|
+
Input(), TrackExternal(),
|
|
3109
3352
|
__metadata("design:type", ValueModel)
|
|
3110
3353
|
], BusyOverlayComponent.prototype, "busyModel", void 0);
|
|
3111
3354
|
__decorate([
|
|
@@ -3541,21 +3784,21 @@ NoopAuthGuard = __decorate([
|
|
|
3541
3784
|
], NoopAuthGuard);
|
|
3542
3785
|
|
|
3543
3786
|
class VisitSanitiser {
|
|
3544
|
-
constructor(activatedRoute, router, placeHistory, injector) {
|
|
3787
|
+
constructor(navigationSession, activatedRoute, router, placeHistory, injector) {
|
|
3788
|
+
this.navigationSession = navigationSession;
|
|
3545
3789
|
this.activatedRoute = activatedRoute;
|
|
3546
3790
|
this.router = router;
|
|
3547
3791
|
this.placeHistory = placeHistory;
|
|
3548
3792
|
this.injector = injector;
|
|
3549
3793
|
}
|
|
3550
|
-
// @Trace()
|
|
3551
3794
|
sanitise(visit) {
|
|
3552
3795
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3553
3796
|
const placeDef = visit.placeDefinition;
|
|
3554
3797
|
if (placeDef.hasRouteId()) {
|
|
3555
3798
|
const routeIdDef = placeDef.getRouteIdParameterDef();
|
|
3556
3799
|
const routeId = visit.getRouteId();
|
|
3557
|
-
const sanitisedValue = yield routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector);
|
|
3558
|
-
|
|
3800
|
+
const sanitisedValue = yield routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector, this.navigationSession.isPopState);
|
|
3801
|
+
console.log({ routeId, sanitisedValue });
|
|
3559
3802
|
// ###------- EARLY EXIT --------###
|
|
3560
3803
|
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
3561
3804
|
// if the route id has changed we redirect immediately as other
|
|
@@ -3572,7 +3815,7 @@ class VisitSanitiser {
|
|
|
3572
3815
|
for (let i = 0; i < parameterDefs.length; i++) {
|
|
3573
3816
|
const def = parameterDefs[i];
|
|
3574
3817
|
const value = visit.getParameter(def.name);
|
|
3575
|
-
const sanitisedValue = yield def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector);
|
|
3818
|
+
const sanitisedValue = yield def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector, this.navigationSession.isPopState);
|
|
3576
3819
|
if (def.hasChanged(value, sanitisedValue)) {
|
|
3577
3820
|
sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
|
|
3578
3821
|
}
|
|
@@ -3581,6 +3824,12 @@ class VisitSanitiser {
|
|
|
3581
3824
|
});
|
|
3582
3825
|
}
|
|
3583
3826
|
}
|
|
3827
|
+
__decorate([
|
|
3828
|
+
Trace(),
|
|
3829
|
+
__metadata("design:type", Function),
|
|
3830
|
+
__metadata("design:paramtypes", [Visit]),
|
|
3831
|
+
__metadata("design:returntype", Promise)
|
|
3832
|
+
], VisitSanitiser.prototype, "sanitise", null);
|
|
3584
3833
|
|
|
3585
3834
|
class PlaceGuard {
|
|
3586
3835
|
constructor(router, urlService, placeRouter, placeHistory, interactionService, injector) {
|
|
@@ -3601,11 +3850,12 @@ class PlaceGuard {
|
|
|
3601
3850
|
// Parse our route params.
|
|
3602
3851
|
const params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
3603
3852
|
const parsedParams = placeDefinition.parseRouteParams(params);
|
|
3604
|
-
const
|
|
3605
|
-
const
|
|
3853
|
+
const navigationSession = this.placeRouter.navigationSession;
|
|
3854
|
+
const initialVisit = navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
|
|
3855
|
+
const sanitiser = new VisitSanitiser(navigationSession, activatedRoute, this.router, this.placeHistory, this.injector);
|
|
3606
3856
|
const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
|
|
3607
3857
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
3608
|
-
|
|
3858
|
+
navigationSession.storeVisit(sanitisedVisit);
|
|
3609
3859
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
3610
3860
|
// Regenerate the url
|
|
3611
3861
|
const urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
|
|
@@ -3779,5 +4029,5 @@ function VisitParameterList(options) {
|
|
|
3779
4029
|
* Generated bundle index. Do not edit.
|
|
3780
4030
|
*/
|
|
3781
4031
|
|
|
3782
|
-
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputComponent, AbstractInteractionContext, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, Activity, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, EventCleanUpSession, FocusBindingDirective, Formatter, InPlaceInteractionContextComponent, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionContextFactory, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SelectInputComponent, StringInputComponent, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, UrlService, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, slideDownOnEnterAnimation, slideRightOnEnterAnimation, DirectivesModule as ɵa, CommandDirective as ɵb,
|
|
4032
|
+
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputComponent, AbstractInteractionContext, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, Activity, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, EventCleanUpSession, FocusBindingDirective, Formatter, InPlaceInteractionContextComponent, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionContextFactory, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SelectInputComponent, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, UrlService, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, slideDownOnEnterAnimation, slideRightOnEnterAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, ModalInteractionContextFactory as ɵba, UrlService as ɵbb, PlaceHistory as ɵbc, TabbedPlaceNavigationComponent as ɵbd, AbstractPlaceNavigationComponent as ɵbe, ListPlaceNavComponent as ɵbf, InteractionModule as ɵbg, ActivityContainerComponent as ɵbh, AbstractInteractionContext as ɵbi, ActivityOutletComponent as ɵbj, ConfirmationDialogComponent as ɵbk, ACTIVITY_DATA as ɵbl, Activity as ɵbm, ConfirmThenDialogComponent as ɵbo, AlertDialogComponent as ɵbp, InPlaceInteractionContextComponent as ɵbr, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, ScrollContainerComponent as ɵk, NoopComponent as ɵl, SwitchCaseOption as ɵm, SwitchCaseWhenDirective as ɵn, SwitchCaseDefaultDirective as ɵo, SwitchCaseComponent as ɵp, PlaceModule as ɵq, EmptyStateComponent as ɵr, BusyOverlayComponent as ɵs, PlaceOutletComponent as ɵt, leftRightPlaceAnimation as ɵu, LEFT_RIGHT_PLACE_ANIMATION as ɵv, AUP_PLACE_CONFIG as ɵw, PlaceRouter as ɵy, InteractionService as ɵz };
|
|
3783
4033
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|