@coolon/angular-ui-powerups 1.0.1 → 1.0.2
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 +2 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +435 -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/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/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/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-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/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/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-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 +365 -115
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +393 -123
- 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
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
pectin.assert.notNil(this.pectinCommand);
|
|
240
240
|
if (this.pectinCommand instanceof pectin.UnaryCommand) {
|
|
241
241
|
if (!this._commandParameterProvided) {
|
|
242
|
-
pectin.lang.illegalState('UnaryCommands
|
|
242
|
+
pectin.lang.illegalState('UnaryCommands require the command parameter to be specified.');
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
else {
|
|
@@ -252,8 +252,8 @@
|
|
|
252
252
|
var _this = this;
|
|
253
253
|
// for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
|
|
254
254
|
// we need to do this.
|
|
255
|
-
var
|
|
256
|
-
|
|
255
|
+
var when = pectin.Dsl.disposeWith(this).when;
|
|
256
|
+
when.valueOf(this._commandEnabled).changes(function (enabled) {
|
|
257
257
|
if (enabled) {
|
|
258
258
|
_this.elementRef.nativeElement.removeAttribute('disabled');
|
|
259
259
|
if (_this.elementRef.nativeElement.tagName === 'A') {
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
_this.elementRef.nativeElement.removeAttribute('href');
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
});
|
|
269
|
+
}, { initialValue: 'triggerChange' });
|
|
270
270
|
};
|
|
271
271
|
CommandDirective.prototype.ngOnDestroy = function () {
|
|
272
272
|
this.dispose();
|
|
@@ -356,12 +356,12 @@
|
|
|
356
356
|
var _this = this;
|
|
357
357
|
// TODO: Make this also track the current enabled/disabled state.
|
|
358
358
|
if (this.hasBinding()) {
|
|
359
|
-
var
|
|
360
|
-
|
|
359
|
+
var when = pectin.Dsl.disposeWith(this).when;
|
|
360
|
+
when.valueOf(this.pectinFocusBinding.focusContext.focused).changes(function (focused) {
|
|
361
361
|
if (focused && !_this.alreadyHasFocus()) {
|
|
362
362
|
_this.tryAndFocus();
|
|
363
363
|
}
|
|
364
|
-
});
|
|
364
|
+
}, { initialValue: 'triggerChange' });
|
|
365
365
|
}
|
|
366
366
|
else {
|
|
367
367
|
pectin.Logger.get(this).warn('pectinFocusBinding was nil');
|
|
@@ -489,7 +489,18 @@
|
|
|
489
489
|
__extends(AbstractInputComponent, _super);
|
|
490
490
|
function AbstractInputComponent() {
|
|
491
491
|
var _this = _super.call(this) || this;
|
|
492
|
-
|
|
492
|
+
/**
|
|
493
|
+
* A backing model for all our @Input() valueModel properties which should be defined as follows.
|
|
494
|
+
*
|
|
495
|
+
* @Input() @UseDelegate({useExisting: "delegatingFormValueModel"})
|
|
496
|
+
* valueModel: FormValueModel<string> | MutableValueModel<string>;
|
|
497
|
+
*
|
|
498
|
+
* This approach allows the input to accept plain or form models but all backed by a form
|
|
499
|
+
* friendly delegate. We have to use an existing delegate for union types as pectin just
|
|
500
|
+
* gets told it's an Object and can't scan for a base type annotated with @DelegateUsing(..).
|
|
501
|
+
*/
|
|
502
|
+
// We have to register it as a disposable so it ditches any listeners when we're disposed.
|
|
503
|
+
_this.delegatingFormValueModel = _this.registerDisposable(new pectin.DelegatingFormValueModel());
|
|
493
504
|
// TODO: fix this.
|
|
494
505
|
// tslint:disable-next-line:no-output-native
|
|
495
506
|
_this.focus = new core.EventEmitter();
|
|
@@ -799,6 +810,142 @@
|
|
|
799
810
|
return ScrollContainerComponent;
|
|
800
811
|
}());
|
|
801
812
|
|
|
813
|
+
var SwitchCaseOption = /** @class */ (function () {
|
|
814
|
+
function SwitchCaseOption(templateRef) {
|
|
815
|
+
this.templateRef = templateRef;
|
|
816
|
+
}
|
|
817
|
+
Object.defineProperty(SwitchCaseOption.prototype, "name", {
|
|
818
|
+
get: function () {
|
|
819
|
+
return this.constructor.name;
|
|
820
|
+
},
|
|
821
|
+
enumerable: true,
|
|
822
|
+
configurable: true
|
|
823
|
+
});
|
|
824
|
+
return SwitchCaseOption;
|
|
825
|
+
}());
|
|
826
|
+
var SwitchCaseWhenDirective = /** @class */ (function (_super) {
|
|
827
|
+
__extends(SwitchCaseWhenDirective, _super);
|
|
828
|
+
function SwitchCaseWhenDirective(templateRef) {
|
|
829
|
+
var _this = _super.call(this, templateRef) || this;
|
|
830
|
+
_this.isDefault = false;
|
|
831
|
+
return _this;
|
|
832
|
+
}
|
|
833
|
+
SwitchCaseWhenDirective_1 = SwitchCaseWhenDirective;
|
|
834
|
+
SwitchCaseWhenDirective.prototype.matches = function (value) {
|
|
835
|
+
return this.aupSwitchCaseWhen === value;
|
|
836
|
+
};
|
|
837
|
+
var SwitchCaseWhenDirective_1;
|
|
838
|
+
SwitchCaseWhenDirective.ctorParameters = function () { return [
|
|
839
|
+
{ type: core.TemplateRef }
|
|
840
|
+
]; };
|
|
841
|
+
__decorate([
|
|
842
|
+
core.Input(),
|
|
843
|
+
__metadata("design:type", Object)
|
|
844
|
+
], SwitchCaseWhenDirective.prototype, "aupSwitchCaseWhen", void 0);
|
|
845
|
+
SwitchCaseWhenDirective = SwitchCaseWhenDirective_1 = __decorate([
|
|
846
|
+
core.Directive({
|
|
847
|
+
selector: '[aupSwitchCaseWhen]',
|
|
848
|
+
providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseWhenDirective_1 }]
|
|
849
|
+
}),
|
|
850
|
+
__metadata("design:paramtypes", [core.TemplateRef])
|
|
851
|
+
], SwitchCaseWhenDirective);
|
|
852
|
+
return SwitchCaseWhenDirective;
|
|
853
|
+
}(SwitchCaseOption));
|
|
854
|
+
var SwitchCaseDefaultDirective = /** @class */ (function (_super) {
|
|
855
|
+
__extends(SwitchCaseDefaultDirective, _super);
|
|
856
|
+
function SwitchCaseDefaultDirective(templateRef) {
|
|
857
|
+
var _this = _super.call(this, templateRef) || this;
|
|
858
|
+
_this.isDefault = true;
|
|
859
|
+
return _this;
|
|
860
|
+
}
|
|
861
|
+
SwitchCaseDefaultDirective_1 = SwitchCaseDefaultDirective;
|
|
862
|
+
SwitchCaseDefaultDirective.prototype.matches = function (value) {
|
|
863
|
+
return false;
|
|
864
|
+
};
|
|
865
|
+
var SwitchCaseDefaultDirective_1;
|
|
866
|
+
SwitchCaseDefaultDirective.ctorParameters = function () { return [
|
|
867
|
+
{ type: core.TemplateRef }
|
|
868
|
+
]; };
|
|
869
|
+
SwitchCaseDefaultDirective = SwitchCaseDefaultDirective_1 = __decorate([
|
|
870
|
+
core.Directive({
|
|
871
|
+
selector: '[aupSwitchCaseDefault]',
|
|
872
|
+
providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseDefaultDirective_1 }]
|
|
873
|
+
}),
|
|
874
|
+
__metadata("design:paramtypes", [core.TemplateRef])
|
|
875
|
+
], SwitchCaseDefaultDirective);
|
|
876
|
+
return SwitchCaseDefaultDirective;
|
|
877
|
+
}(SwitchCaseOption));
|
|
878
|
+
var SwitchCaseComponent = /** @class */ (function (_super) {
|
|
879
|
+
__extends(SwitchCaseComponent, _super);
|
|
880
|
+
function SwitchCaseComponent(cdr) {
|
|
881
|
+
var _this = _super.call(this) || this;
|
|
882
|
+
_this.cdr = cdr;
|
|
883
|
+
_this.selectedIndex = 0;
|
|
884
|
+
return _this;
|
|
885
|
+
}
|
|
886
|
+
SwitchCaseComponent.prototype.ngOnInit = function () {
|
|
887
|
+
};
|
|
888
|
+
SwitchCaseComponent.prototype.ngAfterContentInit = function () {
|
|
889
|
+
var _this = this;
|
|
890
|
+
var subscription = this.switchCaseOptions.changes.subscribe(function (change) { return _this.updateSelection(); });
|
|
891
|
+
this.onDispose(function () { return subscription.unsubscribe(); });
|
|
892
|
+
var _a = pectin.Dsl.disposeWith(this), chain = _a.chain, when = _a.when;
|
|
893
|
+
when.valueOf(this.switchModel).changes(function () { return _this.updateSelection(); }, { initialValue: 'triggerChange' });
|
|
894
|
+
this.cdr.detectChanges();
|
|
895
|
+
};
|
|
896
|
+
SwitchCaseComponent.prototype.updateSelection = function () {
|
|
897
|
+
var _this = this;
|
|
898
|
+
var matchingIndicies = [];
|
|
899
|
+
this.switchCaseOptions.forEach(function (option, index) {
|
|
900
|
+
if (option.matches(_this.switchModel.value)) {
|
|
901
|
+
matchingIndicies.push(index);
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
if (matchingIndicies.length > 1) {
|
|
905
|
+
console.warn("found " + matchingIndicies.length + " matching case values, displaying the first.");
|
|
906
|
+
}
|
|
907
|
+
if (matchingIndicies.length === 0) {
|
|
908
|
+
this.switchCaseOptions.forEach(function (option, index) {
|
|
909
|
+
matchingIndicies.push(index);
|
|
910
|
+
});
|
|
911
|
+
if (matchingIndicies.length > 1) {
|
|
912
|
+
console.warn("found " + matchingIndicies.length + " default case values, displaying the first.");
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
if (matchingIndicies.length > 0) {
|
|
916
|
+
this.selectedIndex = matchingIndicies[0];
|
|
917
|
+
}
|
|
918
|
+
else {
|
|
919
|
+
console.warn("found no matching or default case values.");
|
|
920
|
+
this.selectedIndex = -1;
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
SwitchCaseComponent.ctorParameters = function () { return [
|
|
924
|
+
{ type: core.ChangeDetectorRef }
|
|
925
|
+
]; };
|
|
926
|
+
__decorate([
|
|
927
|
+
core.Input(), pectin.UseDelegate(),
|
|
928
|
+
__metadata("design:type", pectin.ValueModel)
|
|
929
|
+
], SwitchCaseComponent.prototype, "switchModel", void 0);
|
|
930
|
+
__decorate([
|
|
931
|
+
core.Input(), pectin.StoreInValueModel('switchModel'),
|
|
932
|
+
__metadata("design:type", Object)
|
|
933
|
+
], SwitchCaseComponent.prototype, "switch", void 0);
|
|
934
|
+
__decorate([
|
|
935
|
+
core.ContentChildren(SwitchCaseOption),
|
|
936
|
+
__metadata("design:type", core.QueryList)
|
|
937
|
+
], SwitchCaseComponent.prototype, "switchCaseOptions", void 0);
|
|
938
|
+
SwitchCaseComponent = __decorate([
|
|
939
|
+
core.Component({
|
|
940
|
+
selector: 'aup-switch-case',
|
|
941
|
+
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",
|
|
942
|
+
styles: [":host{display:flex;flex-direction:column;align-items:stretch}mat-tab-group{flex:1}"]
|
|
943
|
+
}),
|
|
944
|
+
__metadata("design:paramtypes", [core.ChangeDetectorRef])
|
|
945
|
+
], SwitchCaseComponent);
|
|
946
|
+
return SwitchCaseComponent;
|
|
947
|
+
}(DisposableComponent));
|
|
948
|
+
|
|
802
949
|
var ComponentsModule = /** @class */ (function () {
|
|
803
950
|
function ComponentsModule() {
|
|
804
951
|
}
|
|
@@ -811,7 +958,10 @@
|
|
|
811
958
|
SelectInputComponent,
|
|
812
959
|
ScrollContainerComponent,
|
|
813
960
|
NoopComponent,
|
|
814
|
-
AbstractInputComponent
|
|
961
|
+
AbstractInputComponent,
|
|
962
|
+
SwitchCaseComponent,
|
|
963
|
+
SwitchCaseWhenDirective,
|
|
964
|
+
SwitchCaseDefaultDirective
|
|
815
965
|
],
|
|
816
966
|
imports: [
|
|
817
967
|
common.CommonModule,
|
|
@@ -831,7 +981,10 @@
|
|
|
831
981
|
PasswordInputComponent,
|
|
832
982
|
SelectInputComponent,
|
|
833
983
|
ScrollContainerComponent,
|
|
834
|
-
NoopComponent
|
|
984
|
+
NoopComponent,
|
|
985
|
+
SwitchCaseComponent,
|
|
986
|
+
SwitchCaseWhenDirective,
|
|
987
|
+
SwitchCaseDefaultDirective
|
|
835
988
|
]
|
|
836
989
|
})
|
|
837
990
|
], ComponentsModule);
|
|
@@ -903,7 +1056,7 @@
|
|
|
903
1056
|
core.Component({
|
|
904
1057
|
selector: 'aup-alert-dialog',
|
|
905
1058
|
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",
|
|
906
|
-
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
|
|
1059
|
+
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}"]
|
|
907
1060
|
}),
|
|
908
1061
|
__param(0, core.Inject(ACTIVITY_DATA)),
|
|
909
1062
|
__metadata("design:paramtypes", [Object])
|
|
@@ -944,7 +1097,7 @@
|
|
|
944
1097
|
core.Component({
|
|
945
1098
|
selector: 'aup-confirmation-dialog',
|
|
946
1099
|
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",
|
|
947
|
-
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
|
|
1100
|
+
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}"]
|
|
948
1101
|
}),
|
|
949
1102
|
__param(0, core.Inject(ACTIVITY_DATA)),
|
|
950
1103
|
__metadata("design:paramtypes", [Object])
|
|
@@ -972,7 +1125,7 @@
|
|
|
972
1125
|
core.Component({
|
|
973
1126
|
selector: 'aup-confirmation-dialog',
|
|
974
1127
|
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",
|
|
975
|
-
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
|
|
1128
|
+
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}"]
|
|
976
1129
|
}),
|
|
977
1130
|
__param(0, core.Inject(ACTIVITY_DATA)),
|
|
978
1131
|
__metadata("design:paramtypes", [Object])
|
|
@@ -1375,7 +1528,7 @@
|
|
|
1375
1528
|
}());
|
|
1376
1529
|
|
|
1377
1530
|
var inplaceMonitorCount = 0;
|
|
1378
|
-
exports.ɵ
|
|
1531
|
+
exports.ɵz = /** @class */ (function () {
|
|
1379
1532
|
function InteractionService(modelInteractionContextFactory) {
|
|
1380
1533
|
this.modelInteractionContextFactory = modelInteractionContextFactory;
|
|
1381
1534
|
this.garbage = new pectin.GarbageCollector();
|
|
@@ -1535,7 +1688,7 @@
|
|
|
1535
1688
|
return ApiAdapter;
|
|
1536
1689
|
}());
|
|
1537
1690
|
InteractionService.ApiAdapter = ApiAdapter;
|
|
1538
|
-
})(exports.ɵ
|
|
1691
|
+
})(exports.ɵz || (exports.ɵz = {}));
|
|
1539
1692
|
|
|
1540
1693
|
var InPlaceInteractionContextComponent = /** @class */ (function (_super) {
|
|
1541
1694
|
__extends(InPlaceInteractionContextComponent, _super);
|
|
@@ -1579,7 +1732,7 @@
|
|
|
1579
1732
|
return this.activityContainerComponent.startActivity(activityType, data);
|
|
1580
1733
|
};
|
|
1581
1734
|
InPlaceInteractionContextComponent.ctorParameters = function () { return [
|
|
1582
|
-
{ type: exports.ɵ
|
|
1735
|
+
{ type: exports.ɵz }
|
|
1583
1736
|
]; };
|
|
1584
1737
|
__decorate([
|
|
1585
1738
|
core.ViewChild('activityContainer', { static: true }),
|
|
@@ -1591,7 +1744,7 @@
|
|
|
1591
1744
|
template: "<mat-tab-group no-tab-header [selectedIndex]=\"isActive() ? 1 : 0\" full-height-tabs [dynamicHeight]=\"false\">\n <mat-tab>\n <ng-content></ng-content>\n </mat-tab>\n <mat-tab>\n <aup-activity-container #activityContainer [dynamicHeight]=\"false\"></aup-activity-container>\n </mat-tab>\n</mat-tab-group>\n\n",
|
|
1592
1745
|
styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
|
|
1593
1746
|
}),
|
|
1594
|
-
__metadata("design:paramtypes", [exports.ɵ
|
|
1747
|
+
__metadata("design:paramtypes", [exports.ɵz])
|
|
1595
1748
|
], InPlaceInteractionContextComponent);
|
|
1596
1749
|
return InPlaceInteractionContextComponent;
|
|
1597
1750
|
}(DisposableComponent));
|
|
@@ -1629,7 +1782,7 @@
|
|
|
1629
1782
|
AlertDialogComponent
|
|
1630
1783
|
],
|
|
1631
1784
|
providers: [
|
|
1632
|
-
exports.ɵ
|
|
1785
|
+
exports.ɵz,
|
|
1633
1786
|
]
|
|
1634
1787
|
})
|
|
1635
1788
|
], InteractionModule);
|
|
@@ -1663,22 +1816,22 @@
|
|
|
1663
1816
|
return this.options.getOptional(key, null);
|
|
1664
1817
|
};
|
|
1665
1818
|
// @Trace()
|
|
1666
|
-
ParameterDefinition.prototype.sanitise = function (value, visit, placeHistory, injector) {
|
|
1819
|
+
ParameterDefinition.prototype.sanitise = function (value, visit, placeHistory, injector, isPopState) {
|
|
1667
1820
|
return __awaiter(this, void 0, void 0, function () {
|
|
1668
|
-
var
|
|
1821
|
+
var returningFromSomewhereElse, lastKnownVisit;
|
|
1669
1822
|
return __generator(this, function (_a) {
|
|
1670
1823
|
if (this.isMissingFrom(visit)) {
|
|
1671
|
-
|
|
1672
|
-
if (
|
|
1673
|
-
|
|
1824
|
+
returningFromSomewhereElse = !placeHistory.lastVisitIncluded(visit.placeDefinition);
|
|
1825
|
+
if (returningFromSomewhereElse) {
|
|
1826
|
+
lastKnownVisit = placeHistory.getMostRecentVisitFor(visit.placeDefinition);
|
|
1827
|
+
if (this.remember && lastKnownVisit) {
|
|
1828
|
+
value = lastKnownVisit.getParameter(this.name);
|
|
1829
|
+
}
|
|
1830
|
+
return [2 /*return*/, this.isEmptyValue(value) ? this.defaultValue : value];
|
|
1674
1831
|
}
|
|
1675
|
-
return [2 /*return*/, this.isEmptyValue(value) ? this.defaultValue : value];
|
|
1676
|
-
}
|
|
1677
|
-
else {
|
|
1678
|
-
// todo: add custom sanitiser
|
|
1679
|
-
return [2 /*return*/, value];
|
|
1680
1832
|
}
|
|
1681
|
-
|
|
1833
|
+
// todo: add custom sanitiser
|
|
1834
|
+
return [2 /*return*/, value];
|
|
1682
1835
|
});
|
|
1683
1836
|
});
|
|
1684
1837
|
};
|
|
@@ -1925,11 +2078,11 @@
|
|
|
1925
2078
|
var binding = this.registerDisposable(new pectin.Binding(this.visitModel, model, {
|
|
1926
2079
|
toRight: function (visit) {
|
|
1927
2080
|
var value = visit.getParameter(parameterDef.name);
|
|
1928
|
-
console.log('push to component', { name: parameterDef.name, value
|
|
2081
|
+
// console.log('push to component', { name: parameterDef.name, value, visit });
|
|
1929
2082
|
return value;
|
|
1930
2083
|
},
|
|
1931
2084
|
toLeft: function (value, currentVisit) {
|
|
1932
|
-
console.log('push to route', { name: parameterDef.name, value
|
|
2085
|
+
// console.log('push to route', { name: parameterDef.name, value, currentVisit });
|
|
1933
2086
|
return currentVisit.replace(parameterDef, value);
|
|
1934
2087
|
}
|
|
1935
2088
|
}));
|
|
@@ -2748,21 +2901,34 @@
|
|
|
2748
2901
|
return PopStateNavigation;
|
|
2749
2902
|
}(AbstractPopStateNavigation));
|
|
2750
2903
|
|
|
2751
|
-
|
|
2904
|
+
exports.ɵbc = /** @class */ (function () {
|
|
2752
2905
|
function PlaceHistory() {
|
|
2753
|
-
this.
|
|
2906
|
+
this._archive = new Map();
|
|
2907
|
+
this.placeHistoryDepth = 4;
|
|
2754
2908
|
}
|
|
2755
|
-
|
|
2756
|
-
PlaceHistory.prototype.
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
history.unshift(state); // LIFO
|
|
2761
|
-
this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
|
|
2909
|
+
PlaceHistory_1 = PlaceHistory;
|
|
2910
|
+
PlaceHistory.prototype.notifyNavigationStarted = function () {
|
|
2911
|
+
if (this._activeVisits) {
|
|
2912
|
+
this.archive(this._activeVisits.visits);
|
|
2913
|
+
this._previousVisits = this._activeVisits;
|
|
2762
2914
|
}
|
|
2763
2915
|
};
|
|
2916
|
+
PlaceHistory.prototype.notifyNavigationFinished = function (visits) {
|
|
2917
|
+
this._activeVisits = new PlaceHistory_1.VisitRecord(visits);
|
|
2918
|
+
};
|
|
2919
|
+
PlaceHistory.prototype.updateVisit = function (visit) {
|
|
2920
|
+
pectin.assert.isTruthy(this._activeVisits);
|
|
2921
|
+
this._activeVisits.update(visit);
|
|
2922
|
+
};
|
|
2923
|
+
PlaceHistory.prototype.lastVisitIncluded = function (placeDef) {
|
|
2924
|
+
var _a;
|
|
2925
|
+
return !!((_a = this._previousVisits) === null || _a === void 0 ? void 0 : _a.getVisitFor(placeDef));
|
|
2926
|
+
};
|
|
2927
|
+
PlaceHistory.prototype.getMostRecentVisitFor = function (placeDef) {
|
|
2928
|
+
return ___default__default.first(this.getHistory(placeDef));
|
|
2929
|
+
};
|
|
2764
2930
|
PlaceHistory.prototype.getHistory = function (placeDef) {
|
|
2765
|
-
var history = this.
|
|
2931
|
+
var history = this._archive.get(placeDef);
|
|
2766
2932
|
if (!history) {
|
|
2767
2933
|
history = [];
|
|
2768
2934
|
this.setHistory(placeDef, history);
|
|
@@ -2770,10 +2936,22 @@
|
|
|
2770
2936
|
return history;
|
|
2771
2937
|
};
|
|
2772
2938
|
PlaceHistory.prototype.setHistory = function (placeDef, history) {
|
|
2773
|
-
this.
|
|
2939
|
+
this._archive.set(placeDef, history);
|
|
2774
2940
|
};
|
|
2941
|
+
PlaceHistory.prototype.archive = function (visits) {
|
|
2942
|
+
var _this = this;
|
|
2943
|
+
visits.forEach(function (state) {
|
|
2944
|
+
var history = _this.getHistory(state.placeDefinition);
|
|
2945
|
+
var previousState = ___default__default.first(history);
|
|
2946
|
+
if (!previousState || state.hasChangedFrom(previousState)) {
|
|
2947
|
+
history.unshift(state); // LIFO
|
|
2948
|
+
_this.setHistory(state.placeDefinition, history.slice(0, _this.placeHistoryDepth));
|
|
2949
|
+
}
|
|
2950
|
+
});
|
|
2951
|
+
};
|
|
2952
|
+
var PlaceHistory_1;
|
|
2775
2953
|
PlaceHistory.ɵprov = core.ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(); }, token: PlaceHistory, providedIn: "root" });
|
|
2776
|
-
PlaceHistory = __decorate([
|
|
2954
|
+
PlaceHistory = PlaceHistory_1 = __decorate([
|
|
2777
2955
|
core.Injectable({
|
|
2778
2956
|
providedIn: 'root'
|
|
2779
2957
|
}),
|
|
@@ -2781,6 +2959,86 @@
|
|
|
2781
2959
|
], PlaceHistory);
|
|
2782
2960
|
return PlaceHistory;
|
|
2783
2961
|
}());
|
|
2962
|
+
(function (PlaceHistory) {
|
|
2963
|
+
var VisitRecord = /** @class */ (function () {
|
|
2964
|
+
function VisitRecord(visits) {
|
|
2965
|
+
this.visits = visits;
|
|
2966
|
+
}
|
|
2967
|
+
VisitRecord.prototype.update = function (visit) {
|
|
2968
|
+
this.visits = this.visits.filter(function (v) { return v.placeDefinition !== visit.placeDefinition; }).concat(visit);
|
|
2969
|
+
};
|
|
2970
|
+
VisitRecord.prototype.getVisitFor = function (placeDef) {
|
|
2971
|
+
return this.visits.find(function (v) { return v.placeDefinition === placeDef; });
|
|
2972
|
+
};
|
|
2973
|
+
return VisitRecord;
|
|
2974
|
+
}());
|
|
2975
|
+
PlaceHistory.VisitRecord = VisitRecord;
|
|
2976
|
+
// export class Query {
|
|
2977
|
+
// private _history: Visit.State[];
|
|
2978
|
+
// private _places: Place[];
|
|
2979
|
+
// private _predicate: (visit: any) => boolean;
|
|
2980
|
+
// private _limit: number;
|
|
2981
|
+
//
|
|
2982
|
+
// constructor(history, limit = history.length) {
|
|
2983
|
+
// this._history = history;
|
|
2984
|
+
// this._places = [];
|
|
2985
|
+
// this._predicate = (visit => true);
|
|
2986
|
+
// this._limit = limit;
|
|
2987
|
+
// }
|
|
2988
|
+
//
|
|
2989
|
+
// to(...places:Place[]):this {
|
|
2990
|
+
// this._places = places;
|
|
2991
|
+
// return this;
|
|
2992
|
+
// }
|
|
2993
|
+
//
|
|
2994
|
+
// with(parameters: { [parameter: string]: any }): this {
|
|
2995
|
+
// this.matching(state => {
|
|
2996
|
+
// return Object.keys(parameters).reduce((acc, key) => {
|
|
2997
|
+
// const matchValue = parameters[key];
|
|
2998
|
+
// const visitValue = state.get(key);
|
|
2999
|
+
// const matched = matchValue === '*' ? !_.isNil(visitValue) : visitValue == matchValue;
|
|
3000
|
+
// // Logger.get(this).info(`matched=${matched}`, parameters, visitValue);
|
|
3001
|
+
// return acc && matched;
|
|
3002
|
+
// }, true);
|
|
3003
|
+
// });
|
|
3004
|
+
// return this;
|
|
3005
|
+
// }
|
|
3006
|
+
//
|
|
3007
|
+
// last(): Visit.State {
|
|
3008
|
+
// return _.findLast(this._history, visit => this._matches(visit))
|
|
3009
|
+
// }
|
|
3010
|
+
//
|
|
3011
|
+
// // @trace
|
|
3012
|
+
// allThatMatch(): Visit.State[] {
|
|
3013
|
+
// return _.filter(this._history, visit => this._matches(visit)).slice(-this._limit);
|
|
3014
|
+
// }
|
|
3015
|
+
//
|
|
3016
|
+
// // @trace
|
|
3017
|
+
// mostRecentValueOf<T=any>(param: string, defaultValue: T = null): T {
|
|
3018
|
+
// const lastStateWithParam = _.findLast(this.allThatMatch(), state => !_.isNil(state.get(param)));
|
|
3019
|
+
// return _.isNil(lastStateWithParam) ? defaultValue : lastStateWithParam.get(param);
|
|
3020
|
+
// }
|
|
3021
|
+
//
|
|
3022
|
+
// limit(limit: number): this {
|
|
3023
|
+
// this._limit = limit;
|
|
3024
|
+
// return this;
|
|
3025
|
+
// }
|
|
3026
|
+
//
|
|
3027
|
+
// matching(predicate: (visit: Visit.State) => boolean): this {
|
|
3028
|
+
// this._predicate = predicate;
|
|
3029
|
+
// return this;
|
|
3030
|
+
// }
|
|
3031
|
+
//
|
|
3032
|
+
// _matches(visit: Visit.State) {
|
|
3033
|
+
// return this._isPlaceMatch(visit) && this._predicate(visit);
|
|
3034
|
+
// }
|
|
3035
|
+
//
|
|
3036
|
+
// _isPlaceMatch(visit: Visit.State) {
|
|
3037
|
+
// return this._places.length < 1 || this._places.includes(visit.place)
|
|
3038
|
+
// }
|
|
3039
|
+
//
|
|
3040
|
+
// }
|
|
3041
|
+
})(exports.ɵbc || (exports.ɵbc = {}));
|
|
2784
3042
|
|
|
2785
3043
|
exports.UrlSnapshot = /** @class */ (function () {
|
|
2786
3044
|
// TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
|
|
@@ -2944,6 +3202,75 @@
|
|
|
2944
3202
|
return UrlService;
|
|
2945
3203
|
}());
|
|
2946
3204
|
|
|
3205
|
+
var Visit = /** @class */ (function () {
|
|
3206
|
+
function Visit(placeDefinition, visitParameters) {
|
|
3207
|
+
if (visitParameters === void 0) { visitParameters = {}; }
|
|
3208
|
+
this.placeDefinition = placeDefinition;
|
|
3209
|
+
this.visitParameters = visitParameters;
|
|
3210
|
+
}
|
|
3211
|
+
// @Trace()
|
|
3212
|
+
Visit.prototype.getRouteId = function () {
|
|
3213
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
3214
|
+
};
|
|
3215
|
+
// @Trace()
|
|
3216
|
+
Visit.prototype.hasRouteId = function () {
|
|
3217
|
+
return !___default.isNil(this.getRouteId());
|
|
3218
|
+
};
|
|
3219
|
+
/**
|
|
3220
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
3221
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
3222
|
+
* same as the the ValueModel property name.
|
|
3223
|
+
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
3224
|
+
*/
|
|
3225
|
+
Visit.prototype.getParameter = function (parameterName) {
|
|
3226
|
+
return this.visitParameters[parameterName];
|
|
3227
|
+
};
|
|
3228
|
+
// @Trace()
|
|
3229
|
+
Visit.prototype.hasParameter = function (parameterName) {
|
|
3230
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
3231
|
+
};
|
|
3232
|
+
Visit.prototype.replace = function (parameter, value) {
|
|
3233
|
+
var _a;
|
|
3234
|
+
return new Visit(this.placeDefinition, __assign(__assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
|
|
3235
|
+
};
|
|
3236
|
+
Visit.prototype.mergeRouteParameters = function (routeParams) {
|
|
3237
|
+
var _this = this;
|
|
3238
|
+
// todo: whitelist parameters.
|
|
3239
|
+
var routeParameterKeys = Object.keys(routeParams);
|
|
3240
|
+
var params = {};
|
|
3241
|
+
this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
|
|
3242
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
3243
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
3244
|
+
params[def.name] = routeParams[def.name];
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
else {
|
|
3248
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
3249
|
+
// defaults and remember sanitisation process.
|
|
3250
|
+
var value = _this.getParameter(def.name);
|
|
3251
|
+
if (_this.hasParameter(def.name)) {
|
|
3252
|
+
params[def.name] = value;
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
});
|
|
3256
|
+
return new Visit(this.placeDefinition, params);
|
|
3257
|
+
};
|
|
3258
|
+
Visit.prototype.hasRoutingChangedFrom = function (other) {
|
|
3259
|
+
var samePlace = other.placeDefinition === this.placeDefinition;
|
|
3260
|
+
var sameRouteParameters = ___default.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
3261
|
+
return !samePlace || !sameRouteParameters;
|
|
3262
|
+
};
|
|
3263
|
+
Visit.prototype.hasChangedFrom = function (other) {
|
|
3264
|
+
var sameNonRouteParameters = ___default.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
3265
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
3266
|
+
};
|
|
3267
|
+
Visit.prototype.toDebugString = function () {
|
|
3268
|
+
var _this = this;
|
|
3269
|
+
return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(",");
|
|
3270
|
+
};
|
|
3271
|
+
return Visit;
|
|
3272
|
+
}());
|
|
3273
|
+
|
|
2947
3274
|
var PlaceRouter = /** @class */ (function (_super) {
|
|
2948
3275
|
__extends(PlaceRouter, _super);
|
|
2949
3276
|
function PlaceRouter(angularRouter, angularLocation, interactionService, urlService, placeHistory) {
|
|
@@ -3139,14 +3466,11 @@
|
|
|
3139
3466
|
enumerable: true,
|
|
3140
3467
|
configurable: true
|
|
3141
3468
|
});
|
|
3142
|
-
// @Trace()
|
|
3143
3469
|
PlaceRouter.prototype.pushVisitChangesToRoute = function (previous, next) {
|
|
3144
3470
|
return __awaiter(this, void 0, void 0, function () {
|
|
3145
3471
|
var _this = this;
|
|
3146
3472
|
return __generator(this, function (_a) {
|
|
3147
|
-
|
|
3148
|
-
// when it's been cleared by the user.
|
|
3149
|
-
this.placeHistory.add(next);
|
|
3473
|
+
this.placeHistory.updateVisit(next);
|
|
3150
3474
|
// FIXME: no route id -> route id duplicates route parameters
|
|
3151
3475
|
if (next.hasRoutingChangedFrom(previous)) {
|
|
3152
3476
|
return [2 /*return*/, this.doNavigation(next, function (router) {
|
|
@@ -3168,6 +3492,9 @@
|
|
|
3168
3492
|
// @Trace()
|
|
3169
3493
|
PlaceRouter.prototype.transitionTo = function (next) {
|
|
3170
3494
|
var previous = this.navigationSessionModel.value;
|
|
3495
|
+
if (!previous) {
|
|
3496
|
+
this.placeHistory.notifyNavigationStarted();
|
|
3497
|
+
}
|
|
3171
3498
|
pectin.assert.isTruthy(next !== previous);
|
|
3172
3499
|
pectin.Logger.get(this).info("### Router State Transition: " + (previous ? previous.toString() : 'null') + " -> " + next.toString());
|
|
3173
3500
|
this.navigationSessionModel.value = next;
|
|
@@ -3178,10 +3505,9 @@
|
|
|
3178
3505
|
};
|
|
3179
3506
|
// @Trace()
|
|
3180
3507
|
PlaceRouter.prototype.routingSessionFinished = function (visits) {
|
|
3181
|
-
var _this = this;
|
|
3182
3508
|
if (visits && visits.length > 0) {
|
|
3183
3509
|
pectin.assert.isTruthy(this.navigationInProgress.value);
|
|
3184
|
-
|
|
3510
|
+
this.placeHistory.notifyNavigationFinished(visits);
|
|
3185
3511
|
// We update the active visits before we finish the session so the
|
|
3186
3512
|
// place outlets can ignore the incoming changes until things are
|
|
3187
3513
|
// settled. TODO: can we removed the event'ness here and just do a push?
|
|
@@ -3235,93 +3561,30 @@
|
|
|
3235
3561
|
PlaceRouter.ctorParameters = function () { return [
|
|
3236
3562
|
{ type: router.Router },
|
|
3237
3563
|
{ type: common.Location },
|
|
3238
|
-
{ type: exports.ɵ
|
|
3564
|
+
{ type: exports.ɵz },
|
|
3239
3565
|
{ type: UrlService },
|
|
3240
|
-
{ type:
|
|
3566
|
+
{ type: exports.ɵbc }
|
|
3241
3567
|
]; };
|
|
3242
|
-
PlaceRouter.ɵprov = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(common.Location), core.ɵɵinject(exports.ɵ
|
|
3568
|
+
PlaceRouter.ɵprov = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(common.Location), core.ɵɵinject(exports.ɵz), core.ɵɵinject(UrlService), core.ɵɵinject(exports.ɵbc)); }, token: PlaceRouter, providedIn: "root" });
|
|
3569
|
+
__decorate([
|
|
3570
|
+
pectin.Trace(),
|
|
3571
|
+
__metadata("design:type", Function),
|
|
3572
|
+
__metadata("design:paramtypes", [Visit, Visit]),
|
|
3573
|
+
__metadata("design:returntype", Promise)
|
|
3574
|
+
], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
|
|
3243
3575
|
PlaceRouter = __decorate([
|
|
3244
3576
|
core.Injectable({
|
|
3245
3577
|
providedIn: 'root'
|
|
3246
3578
|
}),
|
|
3247
3579
|
__metadata("design:paramtypes", [router.Router,
|
|
3248
3580
|
common.Location,
|
|
3249
|
-
exports.ɵ
|
|
3581
|
+
exports.ɵz,
|
|
3250
3582
|
UrlService,
|
|
3251
|
-
|
|
3583
|
+
exports.ɵbc])
|
|
3252
3584
|
], PlaceRouter);
|
|
3253
3585
|
return PlaceRouter;
|
|
3254
3586
|
}(pectin.GarbageCollector));
|
|
3255
3587
|
|
|
3256
|
-
var Visit = /** @class */ (function () {
|
|
3257
|
-
function Visit(placeDefinition, visitParameters) {
|
|
3258
|
-
if (visitParameters === void 0) { visitParameters = {}; }
|
|
3259
|
-
this.placeDefinition = placeDefinition;
|
|
3260
|
-
this.visitParameters = visitParameters;
|
|
3261
|
-
}
|
|
3262
|
-
// @Trace()
|
|
3263
|
-
Visit.prototype.getRouteId = function () {
|
|
3264
|
-
return this.placeDefinition.getRouteIdFrom(this);
|
|
3265
|
-
};
|
|
3266
|
-
// @Trace()
|
|
3267
|
-
Visit.prototype.hasRouteId = function () {
|
|
3268
|
-
return !___default.isNil(this.getRouteId());
|
|
3269
|
-
};
|
|
3270
|
-
/**
|
|
3271
|
-
* Returns the value of the place parameter with the specified name. The parameter
|
|
3272
|
-
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
3273
|
-
* same as the the ValueModel property name.
|
|
3274
|
-
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
3275
|
-
*/
|
|
3276
|
-
Visit.prototype.getParameter = function (parameterName) {
|
|
3277
|
-
return this.visitParameters[parameterName];
|
|
3278
|
-
};
|
|
3279
|
-
// @Trace()
|
|
3280
|
-
Visit.prototype.hasParameter = function (parameterName) {
|
|
3281
|
-
return Object.keys(this.visitParameters).includes(parameterName);
|
|
3282
|
-
};
|
|
3283
|
-
Visit.prototype.replace = function (parameter, value) {
|
|
3284
|
-
var _a;
|
|
3285
|
-
return new Visit(this.placeDefinition, __assign(__assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
|
|
3286
|
-
};
|
|
3287
|
-
Visit.prototype.mergeRouteParameters = function (routeParams) {
|
|
3288
|
-
var _this = this;
|
|
3289
|
-
// todo: whitelist parameters.
|
|
3290
|
-
var routeParameterKeys = Object.keys(routeParams);
|
|
3291
|
-
var params = {};
|
|
3292
|
-
this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
|
|
3293
|
-
if (def.isRouteId || def.isRouteParameter) {
|
|
3294
|
-
if (routeParameterKeys.includes(def.name)) {
|
|
3295
|
-
params[def.name] = routeParams[def.name];
|
|
3296
|
-
}
|
|
3297
|
-
}
|
|
3298
|
-
else {
|
|
3299
|
-
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
3300
|
-
// defaults and remember sanitisation process.
|
|
3301
|
-
var value = _this.getParameter(def.name);
|
|
3302
|
-
if (_this.hasParameter(def.name)) {
|
|
3303
|
-
params[def.name] = value;
|
|
3304
|
-
}
|
|
3305
|
-
}
|
|
3306
|
-
});
|
|
3307
|
-
return new Visit(this.placeDefinition, params);
|
|
3308
|
-
};
|
|
3309
|
-
Visit.prototype.hasRoutingChangedFrom = function (other) {
|
|
3310
|
-
var samePlace = other.placeDefinition === this.placeDefinition;
|
|
3311
|
-
var sameRouteParameters = ___default.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
3312
|
-
return !samePlace || !sameRouteParameters;
|
|
3313
|
-
};
|
|
3314
|
-
Visit.prototype.hasChangedFrom = function (other) {
|
|
3315
|
-
var sameNonRouteParameters = ___default.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
3316
|
-
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
3317
|
-
};
|
|
3318
|
-
Visit.prototype.toDebugString = function () {
|
|
3319
|
-
var _this = this;
|
|
3320
|
-
return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(",");
|
|
3321
|
-
};
|
|
3322
|
-
return Visit;
|
|
3323
|
-
}());
|
|
3324
|
-
|
|
3325
3588
|
var AUP_PLACE_CONFIG = new core.InjectionToken('AUP_PLACE_CONFIG');
|
|
3326
3589
|
|
|
3327
3590
|
// Freezes the state of the components at the start of the animation.
|
|
@@ -4123,13 +4386,13 @@
|
|
|
4123
4386
|
}());
|
|
4124
4387
|
|
|
4125
4388
|
var VisitSanitiser = /** @class */ (function () {
|
|
4126
|
-
function VisitSanitiser(activatedRoute, router, placeHistory, injector) {
|
|
4389
|
+
function VisitSanitiser(navigationSession, activatedRoute, router, placeHistory, injector) {
|
|
4390
|
+
this.navigationSession = navigationSession;
|
|
4127
4391
|
this.activatedRoute = activatedRoute;
|
|
4128
4392
|
this.router = router;
|
|
4129
4393
|
this.placeHistory = placeHistory;
|
|
4130
4394
|
this.injector = injector;
|
|
4131
4395
|
}
|
|
4132
|
-
// @Trace()
|
|
4133
4396
|
VisitSanitiser.prototype.sanitise = function (visit) {
|
|
4134
4397
|
return __awaiter(this, void 0, void 0, function () {
|
|
4135
4398
|
var placeDef, routeIdDef, routeId, sanitisedValue, parameterDefs, sanitisedVisit, i, def, value, sanitisedValue;
|
|
@@ -4140,10 +4403,10 @@
|
|
|
4140
4403
|
if (!placeDef.hasRouteId()) return [3 /*break*/, 2];
|
|
4141
4404
|
routeIdDef = placeDef.getRouteIdParameterDef();
|
|
4142
4405
|
routeId = visit.getRouteId();
|
|
4143
|
-
return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
|
|
4406
|
+
return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector, this.navigationSession.isPopState)];
|
|
4144
4407
|
case 1:
|
|
4145
4408
|
sanitisedValue = _a.sent();
|
|
4146
|
-
|
|
4409
|
+
console.log({ routeId: routeId, sanitisedValue: sanitisedValue });
|
|
4147
4410
|
// ###------- EARLY EXIT --------###
|
|
4148
4411
|
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
4149
4412
|
// if the route id has changed we redirect immediately as other
|
|
@@ -4163,7 +4426,7 @@
|
|
|
4163
4426
|
if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
|
|
4164
4427
|
def = parameterDefs[i];
|
|
4165
4428
|
value = visit.getParameter(def.name);
|
|
4166
|
-
return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
|
|
4429
|
+
return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector, this.navigationSession.isPopState)];
|
|
4167
4430
|
case 4:
|
|
4168
4431
|
sanitisedValue = _a.sent();
|
|
4169
4432
|
if (def.hasChanged(value, sanitisedValue)) {
|
|
@@ -4178,6 +4441,12 @@
|
|
|
4178
4441
|
});
|
|
4179
4442
|
});
|
|
4180
4443
|
};
|
|
4444
|
+
__decorate([
|
|
4445
|
+
pectin.Trace(),
|
|
4446
|
+
__metadata("design:type", Function),
|
|
4447
|
+
__metadata("design:paramtypes", [Visit]),
|
|
4448
|
+
__metadata("design:returntype", Promise)
|
|
4449
|
+
], VisitSanitiser.prototype, "sanitise", null);
|
|
4181
4450
|
return VisitSanitiser;
|
|
4182
4451
|
}());
|
|
4183
4452
|
|
|
@@ -4203,19 +4472,20 @@
|
|
|
4203
4472
|
return __generator(this, function (_a) {
|
|
4204
4473
|
switch (_a.label) {
|
|
4205
4474
|
case 0: return [4 /*yield*/, this.cleanInteractionState(activatedRoute, state, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4206
|
-
var params, parsedParams, initialVisit, sanitiser, sanitisedVisit, urlSnapshot;
|
|
4475
|
+
var params, parsedParams, navigationSession, initialVisit, sanitiser, sanitisedVisit, urlSnapshot;
|
|
4207
4476
|
return __generator(this, function (_a) {
|
|
4208
4477
|
switch (_a.label) {
|
|
4209
4478
|
case 0:
|
|
4210
4479
|
params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
4211
4480
|
parsedParams = placeDefinition.parseRouteParams(params);
|
|
4212
|
-
|
|
4213
|
-
|
|
4481
|
+
navigationSession = this.placeRouter.navigationSession;
|
|
4482
|
+
initialVisit = navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
|
|
4483
|
+
sanitiser = new VisitSanitiser(navigationSession, activatedRoute, this.router, this.placeHistory, this.injector);
|
|
4214
4484
|
return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
|
|
4215
4485
|
case 1:
|
|
4216
4486
|
sanitisedVisit = _a.sent();
|
|
4217
4487
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
4218
|
-
|
|
4488
|
+
navigationSession.storeVisit(sanitisedVisit);
|
|
4219
4489
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
4220
4490
|
urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
|
|
4221
4491
|
// console.log('##### Place Guard Redirect', urlSnapshot);
|
|
@@ -4457,7 +4727,7 @@
|
|
|
4457
4727
|
exports.FocusBindingDirective = FocusBindingDirective;
|
|
4458
4728
|
exports.InPlaceInteractionContextComponent = InPlaceInteractionContextComponent;
|
|
4459
4729
|
exports.InteractionModule = InteractionModule;
|
|
4460
|
-
exports.InteractionService = exports.ɵ
|
|
4730
|
+
exports.InteractionService = exports.ɵz;
|
|
4461
4731
|
exports.InteractionServiceRoutingAdapter = InteractionServiceRoutingAdapter;
|
|
4462
4732
|
exports.LEFT_RIGHT_PLACE_ANIMATION = LEFT_RIGHT_PLACE_ANIMATION;
|
|
4463
4733
|
exports.ListPlaceNavComponent = ListPlaceNavComponent;
|
|
@@ -4473,7 +4743,7 @@
|
|
|
4473
4743
|
exports.PlaceComponentDeactivationHandler = PlaceComponentDeactivationHandler;
|
|
4474
4744
|
exports.PlaceDefinition = PlaceDefinition;
|
|
4475
4745
|
exports.PlaceGuard = PlaceGuard;
|
|
4476
|
-
exports.PlaceHistory =
|
|
4746
|
+
exports.PlaceHistory = exports.ɵbc;
|
|
4477
4747
|
exports.PlaceModule = PlaceModule;
|
|
4478
4748
|
exports.PlaceOutletComponent = PlaceOutletComponent;
|
|
4479
4749
|
exports.PlaceRouter = PlaceRouter;
|
|
@@ -4487,6 +4757,10 @@
|
|
|
4487
4757
|
exports.ScrollContainerComponent = ScrollContainerComponent;
|
|
4488
4758
|
exports.SelectInputComponent = SelectInputComponent;
|
|
4489
4759
|
exports.StringInputComponent = StringInputComponent;
|
|
4760
|
+
exports.SwitchCaseComponent = SwitchCaseComponent;
|
|
4761
|
+
exports.SwitchCaseDefaultDirective = SwitchCaseDefaultDirective;
|
|
4762
|
+
exports.SwitchCaseOption = SwitchCaseOption;
|
|
4763
|
+
exports.SwitchCaseWhenDirective = SwitchCaseWhenDirective;
|
|
4490
4764
|
exports.SynchroniseInteractionContextIdsWithRoute = SynchroniseInteractionContextIdsWithRoute;
|
|
4491
4765
|
exports.TabbedPlaceNavigationComponent = TabbedPlaceNavigationComponent;
|
|
4492
4766
|
exports.UrlService = UrlService;
|
|
@@ -4502,18 +4776,21 @@
|
|
|
4502
4776
|
exports.slideRightOnEnterAnimation = slideRightOnEnterAnimation;
|
|
4503
4777
|
exports.ɵa = DirectivesModule;
|
|
4504
4778
|
exports.ɵb = CommandDirective;
|
|
4505
|
-
exports.ɵba =
|
|
4506
|
-
exports.ɵbb =
|
|
4507
|
-
exports.ɵ
|
|
4508
|
-
exports.ɵ
|
|
4509
|
-
exports.ɵ
|
|
4510
|
-
exports.ɵ
|
|
4511
|
-
exports.ɵ
|
|
4512
|
-
exports.ɵ
|
|
4513
|
-
exports.ɵ
|
|
4514
|
-
exports.ɵbk =
|
|
4515
|
-
exports.ɵbl =
|
|
4516
|
-
exports.ɵ
|
|
4779
|
+
exports.ɵba = ModalInteractionContextFactory;
|
|
4780
|
+
exports.ɵbb = UrlService;
|
|
4781
|
+
exports.ɵbd = TabbedPlaceNavigationComponent;
|
|
4782
|
+
exports.ɵbe = AbstractPlaceNavigationComponent;
|
|
4783
|
+
exports.ɵbf = ListPlaceNavComponent;
|
|
4784
|
+
exports.ɵbg = InteractionModule;
|
|
4785
|
+
exports.ɵbh = ActivityContainerComponent;
|
|
4786
|
+
exports.ɵbi = AbstractInteractionContext;
|
|
4787
|
+
exports.ɵbj = ActivityOutletComponent;
|
|
4788
|
+
exports.ɵbk = ConfirmationDialogComponent;
|
|
4789
|
+
exports.ɵbl = ACTIVITY_DATA;
|
|
4790
|
+
exports.ɵbm = Activity;
|
|
4791
|
+
exports.ɵbo = ConfirmThenDialogComponent;
|
|
4792
|
+
exports.ɵbp = AlertDialogComponent;
|
|
4793
|
+
exports.ɵbr = InPlaceInteractionContextComponent;
|
|
4517
4794
|
exports.ɵc = FocusBindingDirective;
|
|
4518
4795
|
exports.ɵd = DisposableComponent;
|
|
4519
4796
|
exports.ɵe = ComponentsModule;
|
|
@@ -4524,18 +4801,18 @@
|
|
|
4524
4801
|
exports.ɵj = SelectInputComponent;
|
|
4525
4802
|
exports.ɵk = ScrollContainerComponent;
|
|
4526
4803
|
exports.ɵl = NoopComponent;
|
|
4527
|
-
exports.ɵm =
|
|
4528
|
-
exports.ɵn =
|
|
4529
|
-
exports.ɵo =
|
|
4530
|
-
exports.ɵp =
|
|
4531
|
-
exports.ɵq =
|
|
4532
|
-
exports.ɵr =
|
|
4533
|
-
exports.ɵs =
|
|
4534
|
-
exports.ɵ
|
|
4535
|
-
exports.ɵ
|
|
4536
|
-
exports.ɵ
|
|
4537
|
-
exports.ɵ
|
|
4538
|
-
exports.ɵ
|
|
4804
|
+
exports.ɵm = SwitchCaseOption;
|
|
4805
|
+
exports.ɵn = SwitchCaseWhenDirective;
|
|
4806
|
+
exports.ɵo = SwitchCaseDefaultDirective;
|
|
4807
|
+
exports.ɵp = SwitchCaseComponent;
|
|
4808
|
+
exports.ɵq = PlaceModule;
|
|
4809
|
+
exports.ɵr = EmptyStateComponent;
|
|
4810
|
+
exports.ɵs = BusyOverlayComponent;
|
|
4811
|
+
exports.ɵt = PlaceOutletComponent;
|
|
4812
|
+
exports.ɵu = leftRightPlaceAnimation;
|
|
4813
|
+
exports.ɵv = LEFT_RIGHT_PLACE_ANIMATION;
|
|
4814
|
+
exports.ɵw = AUP_PLACE_CONFIG;
|
|
4815
|
+
exports.ɵy = PlaceRouter;
|
|
4539
4816
|
|
|
4540
4817
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4541
4818
|
|