@coolon/angular-ui-powerups 0.0.63 → 0.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/coolon-angular-ui-powerups.umd.js +725 -561
- 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 +10 -10
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +10 -10
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/abstract-activity.js +5 -68
- package/esm2015/lib/interaction/activity.js +72 -11
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +213 -120
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.js +6 -7
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +19 -43
- package/esm2015/lib/interaction/index.js +2 -2
- package/esm2015/lib/interaction/interaction-context.js +11 -5
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +94 -65
- package/esm2015/lib/place/guards/leave-place.guard.js +95 -131
- package/esm2015/lib/place/place-router.js +87 -6
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +10 -10
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/abstract-activity.js +10 -96
- package/esm5/lib/interaction/activity.js +114 -11
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +285 -143
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet-context.js +6 -7
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +19 -67
- package/esm5/lib/interaction/index.js +2 -2
- package/esm5/lib/interaction/interaction-context.js +18 -7
- package/esm5/lib/interaction/services/dialog-interaction.service.js +112 -64
- package/esm5/lib/place/guards/leave-place.guard.js +51 -137
- package/esm5/lib/place/place-router.js +96 -6
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +583 -439
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +698 -535
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/abstract-activity.d.ts +4 -13
- package/lib/interaction/activity.d.ts +14 -7
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +37 -25
- package/lib/interaction/components/activity-outlet/activity-outlet-context.d.ts +2 -5
- package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +1 -10
- package/lib/interaction/interaction-context.d.ts +6 -6
- package/lib/interaction/services/dialog-interaction.service.d.ts +4 -6
- package/lib/place/guards/leave-place.guard.d.ts +6 -7
- package/lib/place/place-router.d.ts +14 -1
- package/package.json +1 -1
|
@@ -5,18 +5,19 @@ import { MatDialog, MatButtonModule, MatDialogModule, MatTabsModule, MatProgress
|
|
|
5
5
|
import { MatTabsModule as MatTabsModule$1 } from '@angular/material/tabs';
|
|
6
6
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
7
|
import { __extends, __decorate, __metadata, __assign, __awaiter, __generator } from 'tslib';
|
|
8
|
-
import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingValueModel, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Guard, OptionsHelper, ValueHolder
|
|
8
|
+
import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Guard as Guard$1, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
|
+
import ___default, { last, isNil } from 'lodash';
|
|
10
11
|
import { assert as assert$1, Klass, Opts } from '@coolon/typescript-utilities';
|
|
11
12
|
import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
12
|
-
import {
|
|
13
|
+
import { v1 } from 'uuid';
|
|
13
14
|
import { MatIconModule } from '@angular/material/icon';
|
|
14
15
|
import { MatListModule } from '@angular/material/list';
|
|
15
16
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
17
|
+
import { Router, NavigationStart, NavigationEnd, NavigationError, RouterModule } from '@angular/router';
|
|
16
18
|
import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
17
19
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator';
|
|
18
20
|
import 'reflect-metadata';
|
|
19
|
-
import ___default, { isNil } from 'lodash';
|
|
20
21
|
import { style, query, group, animate, trigger, transition } from '@angular/animations';
|
|
21
22
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
22
23
|
|
|
@@ -807,15 +808,25 @@ InteractionContext = /** @class */ (function (_super) {
|
|
|
807
808
|
function InteractionContext() {
|
|
808
809
|
return _super.call(this) || this;
|
|
809
810
|
}
|
|
811
|
+
Object.defineProperty(InteractionContext.prototype, "currentActivity", {
|
|
812
|
+
/**
|
|
813
|
+
* Returns the activity that is currently active.
|
|
814
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
815
|
+
*/
|
|
816
|
+
get: /**
|
|
817
|
+
* Returns the activity that is currently active.
|
|
818
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
819
|
+
* @return {?}
|
|
820
|
+
*/
|
|
821
|
+
function () {
|
|
822
|
+
return last(this.activityList.value);
|
|
823
|
+
},
|
|
824
|
+
enumerable: true,
|
|
825
|
+
configurable: true
|
|
826
|
+
});
|
|
810
827
|
return InteractionContext;
|
|
811
828
|
}(GarbageCollector));
|
|
812
829
|
if (false) {
|
|
813
|
-
/**
|
|
814
|
-
* Returns the activity that is currently active.
|
|
815
|
-
* This model is only updated in the next tick after the view has been updated.
|
|
816
|
-
* @type {?}
|
|
817
|
-
*/
|
|
818
|
-
InteractionContext.prototype.currentActivity;
|
|
819
830
|
/**
|
|
820
831
|
* Returns the current list of activities that are in progress.
|
|
821
832
|
* This model is only updated in the next tick after the view has been updated.
|
|
@@ -867,29 +878,124 @@ if (false) {
|
|
|
867
878
|
/** @type {?} */
|
|
868
879
|
var ACTIVITY_DATA = new InjectionToken('InteractionActivityData');
|
|
869
880
|
/**
|
|
870
|
-
* @
|
|
881
|
+
* @abstract
|
|
871
882
|
* @template D, R, E
|
|
872
883
|
*/
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
884
|
+
var /**
|
|
885
|
+
* @abstract
|
|
886
|
+
* @template D, R, E
|
|
887
|
+
*/
|
|
888
|
+
Activity = /** @class */ (function (_super) {
|
|
889
|
+
__extends(Activity, _super);
|
|
890
|
+
function Activity() {
|
|
891
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
892
|
+
_this._busyModel = new DelegatingValueModel().withDefault(false);
|
|
893
|
+
return _this;
|
|
894
|
+
}
|
|
877
895
|
/**
|
|
878
896
|
* @param {?} activityContext
|
|
879
897
|
* @return {?}
|
|
880
898
|
*/
|
|
881
|
-
Activity.prototype.initialise =
|
|
899
|
+
Activity.prototype.initialise = /**
|
|
900
|
+
* @param {?} activityContext
|
|
901
|
+
* @return {?}
|
|
902
|
+
*/
|
|
903
|
+
function (activityContext) {
|
|
904
|
+
assert$1.isNil(this._activityContext);
|
|
905
|
+
this._activityContext = activityContext;
|
|
906
|
+
};
|
|
882
907
|
/**
|
|
883
|
-
* @param {
|
|
908
|
+
* @param {?=} result
|
|
909
|
+
* @return {?}
|
|
910
|
+
*/
|
|
911
|
+
Activity.prototype.done = /**
|
|
912
|
+
* @param {?=} result
|
|
884
913
|
* @return {?}
|
|
885
914
|
*/
|
|
886
|
-
|
|
915
|
+
function (result) {
|
|
916
|
+
return this._activityContext.onDone(result);
|
|
917
|
+
};
|
|
887
918
|
/**
|
|
888
|
-
* @param {
|
|
919
|
+
* @param {?=} error
|
|
920
|
+
* @return {?}
|
|
921
|
+
*/
|
|
922
|
+
Activity.prototype.cancel = /**
|
|
923
|
+
* @param {?=} error
|
|
889
924
|
* @return {?}
|
|
890
925
|
*/
|
|
891
|
-
|
|
926
|
+
function (error) {
|
|
927
|
+
this._activityContext.onCancel(error);
|
|
928
|
+
};
|
|
929
|
+
// @Trace()
|
|
930
|
+
// @Trace()
|
|
931
|
+
/**
|
|
932
|
+
* @return {?}
|
|
933
|
+
*/
|
|
934
|
+
Activity.prototype.onActivityReady =
|
|
935
|
+
// @Trace()
|
|
936
|
+
/**
|
|
937
|
+
* @return {?}
|
|
938
|
+
*/
|
|
939
|
+
function () {
|
|
940
|
+
};
|
|
941
|
+
Object.defineProperty(Activity.prototype, "busy", {
|
|
942
|
+
get: /**
|
|
943
|
+
* @return {?}
|
|
944
|
+
*/
|
|
945
|
+
function () {
|
|
946
|
+
return this._busyModel.readonly;
|
|
947
|
+
},
|
|
948
|
+
enumerable: true,
|
|
949
|
+
configurable: true
|
|
950
|
+
});
|
|
951
|
+
/**
|
|
952
|
+
* @param {?} busyModel
|
|
953
|
+
* @return {?}
|
|
954
|
+
*/
|
|
955
|
+
Activity.prototype.busyWhile = /**
|
|
956
|
+
* @param {?} busyModel
|
|
957
|
+
* @return {?}
|
|
958
|
+
*/
|
|
959
|
+
function (busyModel) {
|
|
960
|
+
this._busyModel.setDelegate(busyModel);
|
|
961
|
+
};
|
|
962
|
+
/**
|
|
963
|
+
* @return {?}
|
|
964
|
+
*/
|
|
965
|
+
Activity.prototype.isBusy = /**
|
|
966
|
+
* @return {?}
|
|
967
|
+
*/
|
|
968
|
+
function () {
|
|
969
|
+
return this._busyModel.value;
|
|
970
|
+
};
|
|
971
|
+
return Activity;
|
|
972
|
+
}(GarbageCollector));
|
|
973
|
+
if (false) {
|
|
974
|
+
/**
|
|
975
|
+
* @type {?}
|
|
976
|
+
* @private
|
|
977
|
+
*/
|
|
978
|
+
Activity.prototype._busyModel;
|
|
979
|
+
/**
|
|
980
|
+
* @type {?}
|
|
981
|
+
* @private
|
|
982
|
+
*/
|
|
983
|
+
Activity.prototype._activityContext;
|
|
892
984
|
}
|
|
985
|
+
(function (Activity) {
|
|
986
|
+
/**
|
|
987
|
+
* @record
|
|
988
|
+
* @template R, E
|
|
989
|
+
*/
|
|
990
|
+
function Callbacks() { }
|
|
991
|
+
Activity.Callbacks = Callbacks;
|
|
992
|
+
if (false) {
|
|
993
|
+
/** @type {?} */
|
|
994
|
+
Callbacks.prototype.onDone;
|
|
995
|
+
/** @type {?} */
|
|
996
|
+
Callbacks.prototype.onCancel;
|
|
997
|
+
}
|
|
998
|
+
})(Activity || (Activity = {}));
|
|
893
999
|
|
|
894
1000
|
/**
|
|
895
1001
|
* @fileoverview added by tsickle
|
|
@@ -910,11 +1016,19 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
910
1016
|
this.injector = injector;
|
|
911
1017
|
}
|
|
912
1018
|
Object.defineProperty(ActivityOutletComponent.prototype, "activityContext", {
|
|
1019
|
+
get: /**
|
|
1020
|
+
* @return {?}
|
|
1021
|
+
*/
|
|
1022
|
+
function () {
|
|
1023
|
+
return this._activityContext;
|
|
1024
|
+
},
|
|
913
1025
|
set: /**
|
|
914
1026
|
* @param {?} activityContext
|
|
915
1027
|
* @return {?}
|
|
916
1028
|
*/
|
|
917
1029
|
function (activityContext) {
|
|
1030
|
+
assert.isNil(this._activityContext);
|
|
1031
|
+
this._activityContext = activityContext;
|
|
918
1032
|
this.loadActivity(activityContext);
|
|
919
1033
|
},
|
|
920
1034
|
enumerable: true,
|
|
@@ -943,7 +1057,7 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
943
1057
|
providers: [
|
|
944
1058
|
{
|
|
945
1059
|
provide: InteractionContext,
|
|
946
|
-
useValue: this
|
|
1060
|
+
useValue: this.interactionContext
|
|
947
1061
|
},
|
|
948
1062
|
{ provide: ACTIVITY_DATA, useValue: activityContext.activityData }
|
|
949
1063
|
],
|
|
@@ -954,6 +1068,9 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
954
1068
|
this.viewContainerRef.clear();
|
|
955
1069
|
this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
|
|
956
1070
|
this.activityComponentRef.instance.initialise(activityContext);
|
|
1071
|
+
if (this.activityContext.componentReady) {
|
|
1072
|
+
this.activityContext.componentReady(this.component);
|
|
1073
|
+
}
|
|
957
1074
|
};
|
|
958
1075
|
Object.defineProperty(ActivityOutletComponent.prototype, "component", {
|
|
959
1076
|
get: /**
|
|
@@ -965,71 +1082,6 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
965
1082
|
enumerable: true,
|
|
966
1083
|
configurable: true
|
|
967
1084
|
});
|
|
968
|
-
/**
|
|
969
|
-
* @param {?} alert
|
|
970
|
-
* @return {?}
|
|
971
|
-
*/
|
|
972
|
-
ActivityOutletComponent.prototype.alert = /**
|
|
973
|
-
* @param {?} alert
|
|
974
|
-
* @return {?}
|
|
975
|
-
*/
|
|
976
|
-
function (alert) {
|
|
977
|
-
return this.interactionContext.alert(alert);
|
|
978
|
-
};
|
|
979
|
-
/**
|
|
980
|
-
* @param {?} confirm
|
|
981
|
-
* @return {?}
|
|
982
|
-
*/
|
|
983
|
-
ActivityOutletComponent.prototype.confirm = /**
|
|
984
|
-
* @param {?} confirm
|
|
985
|
-
* @return {?}
|
|
986
|
-
*/
|
|
987
|
-
function (confirm) {
|
|
988
|
-
return this.interactionContext.confirm(confirm);
|
|
989
|
-
};
|
|
990
|
-
/**
|
|
991
|
-
* @template D1, R1, E1
|
|
992
|
-
* @param {?} confirm
|
|
993
|
-
* @param {?} activityType
|
|
994
|
-
* @param {?=} data
|
|
995
|
-
* @return {?}
|
|
996
|
-
*/
|
|
997
|
-
ActivityOutletComponent.prototype.confirmThen = /**
|
|
998
|
-
* @template D1, R1, E1
|
|
999
|
-
* @param {?} confirm
|
|
1000
|
-
* @param {?} activityType
|
|
1001
|
-
* @param {?=} data
|
|
1002
|
-
* @return {?}
|
|
1003
|
-
*/
|
|
1004
|
-
function (confirm, activityType, data) {
|
|
1005
|
-
return this.interactionContext.confirmThen(confirm, activityType, data);
|
|
1006
|
-
};
|
|
1007
|
-
/**
|
|
1008
|
-
* @template D1, R1, E1
|
|
1009
|
-
* @param {?} activityType
|
|
1010
|
-
* @param {?=} data
|
|
1011
|
-
* @return {?}
|
|
1012
|
-
*/
|
|
1013
|
-
ActivityOutletComponent.prototype.startActivity = /**
|
|
1014
|
-
* @template D1, R1, E1
|
|
1015
|
-
* @param {?} activityType
|
|
1016
|
-
* @param {?=} data
|
|
1017
|
-
* @return {?}
|
|
1018
|
-
*/
|
|
1019
|
-
function (activityType, data) {
|
|
1020
|
-
return this.interactionContext.startActivity(activityType, data);
|
|
1021
|
-
};
|
|
1022
|
-
/**
|
|
1023
|
-
* @return {?}
|
|
1024
|
-
*/
|
|
1025
|
-
ActivityOutletComponent.prototype.notifyReady = /**
|
|
1026
|
-
* @return {?}
|
|
1027
|
-
*/
|
|
1028
|
-
function () {
|
|
1029
|
-
if (this.activityComponentRef.instance['onActivityReady']) {
|
|
1030
|
-
this.activityComponentRef.instance['onActivityReady']();
|
|
1031
|
-
}
|
|
1032
|
-
};
|
|
1033
1085
|
ActivityOutletComponent.decorators = [
|
|
1034
1086
|
{ type: Component, args: [{
|
|
1035
1087
|
selector: 'angular-ui-powerups-activity-outlet',
|
|
@@ -1052,6 +1104,11 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
1052
1104
|
if (false) {
|
|
1053
1105
|
/** @type {?} */
|
|
1054
1106
|
ActivityOutletComponent.prototype.interactionContext;
|
|
1107
|
+
/**
|
|
1108
|
+
* @type {?}
|
|
1109
|
+
* @private
|
|
1110
|
+
*/
|
|
1111
|
+
ActivityOutletComponent.prototype._activityContext;
|
|
1055
1112
|
/**
|
|
1056
1113
|
* @type {?}
|
|
1057
1114
|
* @private
|
|
@@ -1080,108 +1137,22 @@ if (false) {
|
|
|
1080
1137
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1081
1138
|
*/
|
|
1082
1139
|
/**
|
|
1140
|
+
* Deprecated. You can now extend the Activity class directly.
|
|
1141
|
+
* @abstract
|
|
1083
1142
|
* @template D, R, E
|
|
1084
1143
|
*/
|
|
1085
1144
|
var /**
|
|
1145
|
+
* Deprecated. You can now extend the Activity class directly.
|
|
1146
|
+
* @abstract
|
|
1086
1147
|
* @template D, R, E
|
|
1087
1148
|
*/
|
|
1088
1149
|
AbstractActivity = /** @class */ (function (_super) {
|
|
1089
1150
|
__extends(AbstractActivity, _super);
|
|
1090
1151
|
function AbstractActivity() {
|
|
1091
|
-
|
|
1092
|
-
_this._busyModel = new DelegatingValueModel().withDefault(false);
|
|
1093
|
-
return _this;
|
|
1152
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1094
1153
|
}
|
|
1095
|
-
/**
|
|
1096
|
-
* @param {?} activityContext
|
|
1097
|
-
* @return {?}
|
|
1098
|
-
*/
|
|
1099
|
-
AbstractActivity.prototype.initialise = /**
|
|
1100
|
-
* @param {?} activityContext
|
|
1101
|
-
* @return {?}
|
|
1102
|
-
*/
|
|
1103
|
-
function (activityContext) {
|
|
1104
|
-
assert$1.isNil(this.activityContext);
|
|
1105
|
-
this.activityContext = activityContext;
|
|
1106
|
-
};
|
|
1107
|
-
/**
|
|
1108
|
-
* @param {?=} result
|
|
1109
|
-
* @return {?}
|
|
1110
|
-
*/
|
|
1111
|
-
AbstractActivity.prototype.done = /**
|
|
1112
|
-
* @param {?=} result
|
|
1113
|
-
* @return {?}
|
|
1114
|
-
*/
|
|
1115
|
-
function (result) {
|
|
1116
|
-
return this.activityContext.onDone(result);
|
|
1117
|
-
};
|
|
1118
|
-
/**
|
|
1119
|
-
* @param {?=} error
|
|
1120
|
-
* @return {?}
|
|
1121
|
-
*/
|
|
1122
|
-
AbstractActivity.prototype.cancel = /**
|
|
1123
|
-
* @param {?=} error
|
|
1124
|
-
* @return {?}
|
|
1125
|
-
*/
|
|
1126
|
-
function (error) {
|
|
1127
|
-
this.activityContext.onCancel(error);
|
|
1128
|
-
};
|
|
1129
|
-
// @Trace()
|
|
1130
|
-
// @Trace()
|
|
1131
|
-
/**
|
|
1132
|
-
* @return {?}
|
|
1133
|
-
*/
|
|
1134
|
-
AbstractActivity.prototype.onActivityReady =
|
|
1135
|
-
// @Trace()
|
|
1136
|
-
/**
|
|
1137
|
-
* @return {?}
|
|
1138
|
-
*/
|
|
1139
|
-
function () {
|
|
1140
|
-
};
|
|
1141
|
-
Object.defineProperty(AbstractActivity.prototype, "busy", {
|
|
1142
|
-
get: /**
|
|
1143
|
-
* @return {?}
|
|
1144
|
-
*/
|
|
1145
|
-
function () {
|
|
1146
|
-
return this._busyModel.readonly;
|
|
1147
|
-
},
|
|
1148
|
-
enumerable: true,
|
|
1149
|
-
configurable: true
|
|
1150
|
-
});
|
|
1151
|
-
/**
|
|
1152
|
-
* @param {?} busyModel
|
|
1153
|
-
* @return {?}
|
|
1154
|
-
*/
|
|
1155
|
-
AbstractActivity.prototype.busyWhile = /**
|
|
1156
|
-
* @param {?} busyModel
|
|
1157
|
-
* @return {?}
|
|
1158
|
-
*/
|
|
1159
|
-
function (busyModel) {
|
|
1160
|
-
this._busyModel.setDelegate(busyModel);
|
|
1161
|
-
};
|
|
1162
|
-
/**
|
|
1163
|
-
* @return {?}
|
|
1164
|
-
*/
|
|
1165
|
-
AbstractActivity.prototype.isBusy = /**
|
|
1166
|
-
* @return {?}
|
|
1167
|
-
*/
|
|
1168
|
-
function () {
|
|
1169
|
-
return this._busyModel.value;
|
|
1170
|
-
};
|
|
1171
1154
|
return AbstractActivity;
|
|
1172
|
-
}(
|
|
1173
|
-
if (false) {
|
|
1174
|
-
/**
|
|
1175
|
-
* @type {?}
|
|
1176
|
-
* @private
|
|
1177
|
-
*/
|
|
1178
|
-
AbstractActivity.prototype._busyModel;
|
|
1179
|
-
/**
|
|
1180
|
-
* @type {?}
|
|
1181
|
-
* @private
|
|
1182
|
-
*/
|
|
1183
|
-
AbstractActivity.prototype.activityContext;
|
|
1184
|
-
}
|
|
1155
|
+
}(Activity));
|
|
1185
1156
|
|
|
1186
1157
|
/**
|
|
1187
1158
|
* @fileoverview added by tsickle
|
|
@@ -1371,16 +1342,174 @@ if (false) {
|
|
|
1371
1342
|
* @fileoverview added by tsickle
|
|
1372
1343
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1373
1344
|
*/
|
|
1345
|
+
/**
|
|
1346
|
+
* Note: this class is mutable and is stored in a list model. This is normally a big no no but
|
|
1347
|
+
* we're manually deriving other models from the list after view state changes. I.e. we not
|
|
1348
|
+
* using pectin chains on any of the mutable fields.
|
|
1349
|
+
* @template D, R, E
|
|
1350
|
+
*/
|
|
1351
|
+
var /**
|
|
1352
|
+
* Note: this class is mutable and is stored in a list model. This is normally a big no no but
|
|
1353
|
+
* we're manually deriving other models from the list after view state changes. I.e. we not
|
|
1354
|
+
* using pectin chains on any of the mutable fields.
|
|
1355
|
+
* @template D, R, E
|
|
1356
|
+
*/
|
|
1357
|
+
TabContext = /** @class */ (function () {
|
|
1358
|
+
function TabContext(activityData, activityClass, interactionContext, activityCallbacks) {
|
|
1359
|
+
this.activityData = activityData;
|
|
1360
|
+
this.activityClass = activityClass;
|
|
1361
|
+
this.interactionContext = interactionContext;
|
|
1362
|
+
this.activityCallbacks = activityCallbacks;
|
|
1363
|
+
this._complete = false;
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* @return {?}
|
|
1367
|
+
*/
|
|
1368
|
+
TabContext.prototype.isComponentRealised = /**
|
|
1369
|
+
* @return {?}
|
|
1370
|
+
*/
|
|
1371
|
+
function () {
|
|
1372
|
+
return !!this._component;
|
|
1373
|
+
};
|
|
1374
|
+
/**
|
|
1375
|
+
* @return {?}
|
|
1376
|
+
*/
|
|
1377
|
+
TabContext.prototype.isComplete = /**
|
|
1378
|
+
* @return {?}
|
|
1379
|
+
*/
|
|
1380
|
+
function () {
|
|
1381
|
+
return this._complete;
|
|
1382
|
+
};
|
|
1383
|
+
/**
|
|
1384
|
+
* @param {?} component
|
|
1385
|
+
* @return {?}
|
|
1386
|
+
*/
|
|
1387
|
+
TabContext.prototype.componentReady = /**
|
|
1388
|
+
* @param {?} component
|
|
1389
|
+
* @return {?}
|
|
1390
|
+
*/
|
|
1391
|
+
function (component) {
|
|
1392
|
+
assert.isNil(this._component);
|
|
1393
|
+
this._component = component;
|
|
1394
|
+
};
|
|
1395
|
+
Object.defineProperty(TabContext.prototype, "component", {
|
|
1396
|
+
get: /**
|
|
1397
|
+
* @return {?}
|
|
1398
|
+
*/
|
|
1399
|
+
function () {
|
|
1400
|
+
return this._component;
|
|
1401
|
+
},
|
|
1402
|
+
enumerable: true,
|
|
1403
|
+
configurable: true
|
|
1404
|
+
});
|
|
1405
|
+
// @Trace()
|
|
1406
|
+
// @Trace()
|
|
1407
|
+
/**
|
|
1408
|
+
* @param {?} result
|
|
1409
|
+
* @return {?}
|
|
1410
|
+
*/
|
|
1411
|
+
TabContext.prototype.onDone =
|
|
1412
|
+
// @Trace()
|
|
1413
|
+
/**
|
|
1414
|
+
* @param {?} result
|
|
1415
|
+
* @return {?}
|
|
1416
|
+
*/
|
|
1417
|
+
function (result) {
|
|
1418
|
+
this._complete = true;
|
|
1419
|
+
this.activityCallbacks.onDone(result);
|
|
1420
|
+
};
|
|
1421
|
+
// @Trace()
|
|
1422
|
+
// @Trace()
|
|
1423
|
+
/**
|
|
1424
|
+
* @param {?} error
|
|
1425
|
+
* @return {?}
|
|
1426
|
+
*/
|
|
1427
|
+
TabContext.prototype.onCancel =
|
|
1428
|
+
// @Trace()
|
|
1429
|
+
/**
|
|
1430
|
+
* @param {?} error
|
|
1431
|
+
* @return {?}
|
|
1432
|
+
*/
|
|
1433
|
+
function (error) {
|
|
1434
|
+
this._complete = true;
|
|
1435
|
+
this.activityCallbacks.onCancel(error);
|
|
1436
|
+
};
|
|
1437
|
+
return TabContext;
|
|
1438
|
+
}());
|
|
1439
|
+
if (false) {
|
|
1440
|
+
/**
|
|
1441
|
+
* @type {?}
|
|
1442
|
+
* @private
|
|
1443
|
+
*/
|
|
1444
|
+
TabContext.prototype._complete;
|
|
1445
|
+
/**
|
|
1446
|
+
* @type {?}
|
|
1447
|
+
* @private
|
|
1448
|
+
*/
|
|
1449
|
+
TabContext.prototype._component;
|
|
1450
|
+
/** @type {?} */
|
|
1451
|
+
TabContext.prototype.activityData;
|
|
1452
|
+
/** @type {?} */
|
|
1453
|
+
TabContext.prototype.activityClass;
|
|
1454
|
+
/** @type {?} */
|
|
1455
|
+
TabContext.prototype.interactionContext;
|
|
1456
|
+
/** @type {?} */
|
|
1457
|
+
TabContext.prototype.activityCallbacks;
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* @template D, R, E
|
|
1461
|
+
*/
|
|
1374
1462
|
var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
1375
1463
|
__extends(ActivityContainerComponent, _super);
|
|
1376
1464
|
function ActivityContainerComponent() {
|
|
1377
1465
|
var _this = _super.call(this) || this;
|
|
1378
|
-
_this.
|
|
1379
|
-
_this.
|
|
1466
|
+
_this.activityFinishedEvents = new MutableStream();
|
|
1467
|
+
_this.activityTabs = new MutableListModel();
|
|
1380
1468
|
_this.finished = false;
|
|
1381
1469
|
_this._activityList = new MutableListModel();
|
|
1470
|
+
var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
|
|
1471
|
+
chain(_this.activityFinishedEvents).throttle(50).subscribe((/**
|
|
1472
|
+
* @return {?}
|
|
1473
|
+
*/
|
|
1474
|
+
function () { return _this.onActivityFinished(); }));
|
|
1382
1475
|
return _this;
|
|
1383
1476
|
}
|
|
1477
|
+
Object.defineProperty(ActivityContainerComponent.prototype, "initialActivityOutletContext", {
|
|
1478
|
+
get: /**
|
|
1479
|
+
* @return {?}
|
|
1480
|
+
*/
|
|
1481
|
+
function () {
|
|
1482
|
+
return this.activityTabs.length > 0 ? this.activityTabs.value[0] : null;
|
|
1483
|
+
},
|
|
1484
|
+
set: /**
|
|
1485
|
+
* @param {?} initialContext
|
|
1486
|
+
* @return {?}
|
|
1487
|
+
*/
|
|
1488
|
+
function (initialContext) {
|
|
1489
|
+
var _this = this;
|
|
1490
|
+
assert.isNil(this.initialActivityOutletContext);
|
|
1491
|
+
this.activityTabs.push(new TabContext(initialContext.activityData, initialContext.activityClass, this, {
|
|
1492
|
+
onDone: (/**
|
|
1493
|
+
* @param {?} result
|
|
1494
|
+
* @return {?}
|
|
1495
|
+
*/
|
|
1496
|
+
function (result) {
|
|
1497
|
+
_this.finished = true;
|
|
1498
|
+
return initialContext.onDone(result);
|
|
1499
|
+
}),
|
|
1500
|
+
onCancel: (/**
|
|
1501
|
+
* @param {?} error
|
|
1502
|
+
* @return {?}
|
|
1503
|
+
*/
|
|
1504
|
+
function (error) {
|
|
1505
|
+
_this.finished = true;
|
|
1506
|
+
return initialContext.onCancel(error);
|
|
1507
|
+
})
|
|
1508
|
+
}));
|
|
1509
|
+
},
|
|
1510
|
+
enumerable: true,
|
|
1511
|
+
configurable: true
|
|
1512
|
+
});
|
|
1384
1513
|
/**
|
|
1385
1514
|
* @return {?}
|
|
1386
1515
|
*/
|
|
@@ -1416,94 +1545,28 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1416
1545
|
*/
|
|
1417
1546
|
function () {
|
|
1418
1547
|
var _this = this;
|
|
1419
|
-
var
|
|
1420
|
-
|
|
1421
|
-
* @param {?} c
|
|
1548
|
+
var _a = Dsl.disposeWith(this), chain = _a.chain, observe = _a.observe;
|
|
1549
|
+
observe.valuesFrom(this.outlets.changes).subscribe((/**
|
|
1422
1550
|
* @return {?}
|
|
1423
1551
|
*/
|
|
1424
|
-
function (
|
|
1425
|
-
observe.valuesFrom(this.outlets.changes).subscribe((/**
|
|
1426
|
-
* @param {?} change
|
|
1552
|
+
function () { return setTimeout((/**
|
|
1427
1553
|
* @return {?}
|
|
1428
1554
|
*/
|
|
1429
|
-
function (
|
|
1430
|
-
_this.safelyUpdateActivityList(change.map((/**
|
|
1431
|
-
* @param {?} c
|
|
1432
|
-
* @return {?}
|
|
1433
|
-
*/
|
|
1434
|
-
function (c) { return c.component; })));
|
|
1435
|
-
}));
|
|
1555
|
+
function () { return _this.updateActivityList(); })); }));
|
|
1436
1556
|
observe.valuesFrom(this.tabs.animationDone).subscribe((/**
|
|
1437
1557
|
* @return {?}
|
|
1438
1558
|
*/
|
|
1439
1559
|
function () { return _this.onAnimationFinished(); }));
|
|
1560
|
+
this.updateActivityList();
|
|
1440
1561
|
};
|
|
1441
1562
|
/**
|
|
1442
|
-
*
|
|
1443
|
-
* @param activities
|
|
1444
|
-
*/
|
|
1445
|
-
/**
|
|
1446
|
-
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1447
|
-
* @private
|
|
1448
|
-
* @param {?} activities
|
|
1449
|
-
* @return {?}
|
|
1450
|
-
*/
|
|
1451
|
-
ActivityContainerComponent.prototype.safelyUpdateActivityList = /**
|
|
1452
|
-
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1453
|
-
* @private
|
|
1454
|
-
* @param {?} activities
|
|
1455
|
-
* @return {?}
|
|
1456
|
-
*/
|
|
1457
|
-
function (activities) {
|
|
1458
|
-
var _this = this;
|
|
1459
|
-
setTimeout((/**
|
|
1460
|
-
* @return {?}
|
|
1461
|
-
*/
|
|
1462
|
-
function () { return _this._activityList.value = activities; }));
|
|
1463
|
-
};
|
|
1464
|
-
/**
|
|
1465
|
-
* @template D, R, E
|
|
1466
|
-
* @param {?} initialContext
|
|
1467
|
-
* @return {?}
|
|
1468
|
-
*/
|
|
1469
|
-
ActivityContainerComponent.prototype.initialise = /**
|
|
1470
|
-
* @template D, R, E
|
|
1471
|
-
* @param {?} initialContext
|
|
1472
|
-
* @return {?}
|
|
1473
|
-
*/
|
|
1474
|
-
function (initialContext) {
|
|
1475
|
-
/** @type {?} */
|
|
1476
|
-
var self = this;
|
|
1477
|
-
this.initialActivityOutletContext = {
|
|
1478
|
-
activityClass: initialContext.activityClass,
|
|
1479
|
-
activityData: initialContext.activityData,
|
|
1480
|
-
onDone: (/**
|
|
1481
|
-
* @param {?} result
|
|
1482
|
-
* @return {?}
|
|
1483
|
-
*/
|
|
1484
|
-
function (result) {
|
|
1485
|
-
self.finished = true;
|
|
1486
|
-
return initialContext.onDone(result);
|
|
1487
|
-
}),
|
|
1488
|
-
onCancel: (/**
|
|
1489
|
-
* @param {?} error
|
|
1490
|
-
* @return {?}
|
|
1491
|
-
*/
|
|
1492
|
-
function (error) {
|
|
1493
|
-
self.finished = true;
|
|
1494
|
-
return initialContext.onCancel(error);
|
|
1495
|
-
}),
|
|
1496
|
-
interactionContext: this
|
|
1497
|
-
};
|
|
1498
|
-
};
|
|
1499
|
-
/**
|
|
1500
|
-
* @template D, R, E
|
|
1563
|
+
* @template D1, R1, E1
|
|
1501
1564
|
* @param {?} activityType
|
|
1502
1565
|
* @param {?=} data
|
|
1503
1566
|
* @return {?}
|
|
1504
1567
|
*/
|
|
1505
1568
|
ActivityContainerComponent.prototype.startActivity = /**
|
|
1506
|
-
* @template
|
|
1569
|
+
* @template D1, R1, E1
|
|
1507
1570
|
* @param {?} activityType
|
|
1508
1571
|
* @param {?=} data
|
|
1509
1572
|
* @return {?}
|
|
@@ -1519,41 +1582,26 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1519
1582
|
*/
|
|
1520
1583
|
function (resolve, reject) {
|
|
1521
1584
|
/** @type {?} */
|
|
1522
|
-
var context = {
|
|
1523
|
-
interactionContext: self,
|
|
1524
|
-
activityClass: activityType,
|
|
1525
|
-
activityData: data,
|
|
1585
|
+
var context = new TabContext(data, activityType, self, {
|
|
1526
1586
|
onDone: (/**
|
|
1527
1587
|
* @param {?} result
|
|
1528
1588
|
* @return {?}
|
|
1529
1589
|
*/
|
|
1530
1590
|
function (result) {
|
|
1531
|
-
self.obsoleteTabs.push(context);
|
|
1532
|
-
// animating on the next tick gives chained done's a chance to
|
|
1533
|
-
// finished before we start an animations
|
|
1534
1591
|
resolve(result);
|
|
1535
|
-
|
|
1536
|
-
* @return {?}
|
|
1537
|
-
*/
|
|
1538
|
-
function () { return self.animateTabs(); }));
|
|
1592
|
+
self.activityFinishedEvents.publish({});
|
|
1539
1593
|
}),
|
|
1540
1594
|
onCancel: (/**
|
|
1541
1595
|
* @param {?} error
|
|
1542
1596
|
* @return {?}
|
|
1543
1597
|
*/
|
|
1544
1598
|
function (error) {
|
|
1545
|
-
self.obsoleteTabs.push(context);
|
|
1546
|
-
// finished before we start an animations
|
|
1547
1599
|
reject(error);
|
|
1548
|
-
|
|
1549
|
-
setTimeout((/**
|
|
1550
|
-
* @return {?}
|
|
1551
|
-
*/
|
|
1552
|
-
function () { return self.animateTabs(); }));
|
|
1600
|
+
self.activityFinishedEvents.publish({});
|
|
1553
1601
|
})
|
|
1554
|
-
};
|
|
1555
|
-
self.
|
|
1556
|
-
self.tabs.selectedIndex = _this.
|
|
1602
|
+
});
|
|
1603
|
+
self.activityTabs.push(context);
|
|
1604
|
+
self.tabs.selectedIndex = _this.activityTabs.length;
|
|
1557
1605
|
}));
|
|
1558
1606
|
};
|
|
1559
1607
|
/**
|
|
@@ -1579,63 +1627,151 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1579
1627
|
return this.startActivity(ConfirmationDialogComponent, confirm);
|
|
1580
1628
|
};
|
|
1581
1629
|
/**
|
|
1582
|
-
* @template
|
|
1583
|
-
* @param {?} confirm
|
|
1584
|
-
* @param {?} activityType
|
|
1585
|
-
* @param {?=} data
|
|
1630
|
+
* @template D1, R1, E1
|
|
1631
|
+
* @param {?} confirm
|
|
1632
|
+
* @param {?} activityType
|
|
1633
|
+
* @param {?=} data
|
|
1634
|
+
* @return {?}
|
|
1635
|
+
*/
|
|
1636
|
+
ActivityContainerComponent.prototype.confirmThen = /**
|
|
1637
|
+
* @template D1, R1, E1
|
|
1638
|
+
* @param {?} confirm
|
|
1639
|
+
* @param {?} activityType
|
|
1640
|
+
* @param {?=} data
|
|
1641
|
+
* @return {?}
|
|
1642
|
+
*/
|
|
1643
|
+
function (confirm, activityType, data) {
|
|
1644
|
+
return this.startActivity(ConfirmThenDialogComponent, {
|
|
1645
|
+
confirm: confirm,
|
|
1646
|
+
activityType: activityType,
|
|
1647
|
+
data: data
|
|
1648
|
+
});
|
|
1649
|
+
};
|
|
1650
|
+
// @Trace()
|
|
1651
|
+
// @Trace()
|
|
1652
|
+
/**
|
|
1653
|
+
* @private
|
|
1654
|
+
* @return {?}
|
|
1655
|
+
*/
|
|
1656
|
+
ActivityContainerComponent.prototype.onActivityFinished =
|
|
1657
|
+
// @Trace()
|
|
1658
|
+
/**
|
|
1659
|
+
* @private
|
|
1660
|
+
* @return {?}
|
|
1661
|
+
*/
|
|
1662
|
+
function () {
|
|
1663
|
+
// don't do anything if job already queued up.
|
|
1664
|
+
if (!this.finished) {
|
|
1665
|
+
if (this.synchroniseSelectedTabIndex()) {
|
|
1666
|
+
this.cleanupStaleActivities();
|
|
1667
|
+
}
|
|
1668
|
+
this.updateActivityList();
|
|
1669
|
+
}
|
|
1670
|
+
};
|
|
1671
|
+
// @Trace()
|
|
1672
|
+
// @Trace()
|
|
1673
|
+
/**
|
|
1674
|
+
* @private
|
|
1675
|
+
* @return {?}
|
|
1676
|
+
*/
|
|
1677
|
+
ActivityContainerComponent.prototype.cleanupStaleActivities =
|
|
1678
|
+
// @Trace()
|
|
1679
|
+
/**
|
|
1680
|
+
* @private
|
|
1681
|
+
* @return {?}
|
|
1682
|
+
*/
|
|
1683
|
+
function () {
|
|
1684
|
+
var _this = this;
|
|
1685
|
+
// clean up old tabs
|
|
1686
|
+
if (this.tabs.selectedIndex < this.activityTabs.length - 1) {
|
|
1687
|
+
this.activityTabs.runInTransaction((/**
|
|
1688
|
+
* @param {?} draft
|
|
1689
|
+
* @return {?}
|
|
1690
|
+
*/
|
|
1691
|
+
function (draft) {
|
|
1692
|
+
draft.value = draft.value.slice(0, 1 + _this.tabs.selectedIndex);
|
|
1693
|
+
}));
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
/**
|
|
1697
|
+
* Synchronises the selected tab index. Returns true if there was no change to the selected index.
|
|
1698
|
+
*/
|
|
1699
|
+
// @Trace()
|
|
1700
|
+
/**
|
|
1701
|
+
* Synchronises the selected tab index. Returns true if there was no change to the selected index.
|
|
1702
|
+
* @private
|
|
1703
|
+
* @return {?}
|
|
1704
|
+
*/
|
|
1705
|
+
// @Trace()
|
|
1706
|
+
ActivityContainerComponent.prototype.synchroniseSelectedTabIndex = /**
|
|
1707
|
+
* Synchronises the selected tab index. Returns true if there was no change to the selected index.
|
|
1708
|
+
* @private
|
|
1709
|
+
* @return {?}
|
|
1710
|
+
*/
|
|
1711
|
+
// @Trace()
|
|
1712
|
+
function () {
|
|
1713
|
+
/** @type {?} */
|
|
1714
|
+
var previousIndex = this.tabs.selectedIndex;
|
|
1715
|
+
/** @type {?} */
|
|
1716
|
+
var newIndex = this.activityTabs.query().findIndex((/**
|
|
1717
|
+
* @param {?} t
|
|
1718
|
+
* @return {?}
|
|
1719
|
+
*/
|
|
1720
|
+
function (t) { return t.isComplete(); })) - 1;
|
|
1721
|
+
this.tabs.selectedIndex = newIndex;
|
|
1722
|
+
return previousIndex === newIndex;
|
|
1723
|
+
};
|
|
1724
|
+
// @Trace()
|
|
1725
|
+
// @Trace()
|
|
1726
|
+
/**
|
|
1727
|
+
* @private
|
|
1586
1728
|
* @return {?}
|
|
1587
1729
|
*/
|
|
1588
|
-
ActivityContainerComponent.prototype.
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
* @
|
|
1592
|
-
* @param {?=} data
|
|
1730
|
+
ActivityContainerComponent.prototype.onAnimationFinished =
|
|
1731
|
+
// @Trace()
|
|
1732
|
+
/**
|
|
1733
|
+
* @private
|
|
1593
1734
|
* @return {?}
|
|
1594
1735
|
*/
|
|
1595
|
-
function (
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
data: data
|
|
1600
|
-
});
|
|
1736
|
+
function () {
|
|
1737
|
+
this.getSelectedOutlet().component.onActivityReady();
|
|
1738
|
+
this.cleanupStaleActivities();
|
|
1739
|
+
this.updateActivityList();
|
|
1601
1740
|
};
|
|
1602
1741
|
/**
|
|
1603
1742
|
* @private
|
|
1604
1743
|
* @return {?}
|
|
1605
1744
|
*/
|
|
1606
|
-
ActivityContainerComponent.prototype.
|
|
1745
|
+
ActivityContainerComponent.prototype.updateActivityList = /**
|
|
1607
1746
|
* @private
|
|
1608
1747
|
* @return {?}
|
|
1609
1748
|
*/
|
|
1610
1749
|
function () {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
* @param {?} tab
|
|
1750
|
+
this._activityList.value = this.activityTabs.value.filter((/**
|
|
1751
|
+
* @param {?} t
|
|
1614
1752
|
* @return {?}
|
|
1615
1753
|
*/
|
|
1616
|
-
function (
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1754
|
+
function (t) { return !t.isComplete() && t.isComponentRealised(); })).map((/**
|
|
1755
|
+
* @param {?} t
|
|
1756
|
+
* @return {?}
|
|
1757
|
+
*/
|
|
1758
|
+
function (t) { return t.component; }));
|
|
1621
1759
|
};
|
|
1622
1760
|
/**
|
|
1623
1761
|
* @private
|
|
1624
1762
|
* @return {?}
|
|
1625
1763
|
*/
|
|
1626
|
-
ActivityContainerComponent.prototype.
|
|
1764
|
+
ActivityContainerComponent.prototype.getSelectedOutlet = /**
|
|
1627
1765
|
* @private
|
|
1628
1766
|
* @return {?}
|
|
1629
1767
|
*/
|
|
1630
1768
|
function () {
|
|
1631
|
-
|
|
1632
|
-
this.tabs.selectedIndex = this.activityOutletTabs.length - this.obsoleteTabs.length;
|
|
1633
|
-
}
|
|
1769
|
+
return this.outlets.toArray()[this.tabs.selectedIndex];
|
|
1634
1770
|
};
|
|
1635
1771
|
ActivityContainerComponent.decorators = [
|
|
1636
1772
|
{ type: Component, args: [{
|
|
1637
1773
|
selector: 'angular-ui-powerups-activity-container',
|
|
1638
|
-
template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"true\">\n <mat-tab
|
|
1774
|
+
template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"true\">\n <mat-tab *ngFor=\"let tab of activityTabs.value\">\n <angular-ui-powerups-activity-outlet [interactionContext]=\"this\"\n [activityContext]=\"tab\"></angular-ui-powerups-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
|
|
1639
1775
|
styles: [":host{display:block}"]
|
|
1640
1776
|
}] }
|
|
1641
1777
|
];
|
|
@@ -1648,25 +1784,21 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1648
1784
|
outlets: [{ type: ViewChildren, args: [ActivityOutletComponent,] }]
|
|
1649
1785
|
};
|
|
1650
1786
|
return ActivityContainerComponent;
|
|
1651
|
-
}(
|
|
1787
|
+
}(InteractionContext));
|
|
1652
1788
|
if (false) {
|
|
1789
|
+
/**
|
|
1790
|
+
* @type {?}
|
|
1791
|
+
* @private
|
|
1792
|
+
*/
|
|
1793
|
+
ActivityContainerComponent.prototype.activityFinishedEvents;
|
|
1653
1794
|
/** @type {?} */
|
|
1654
1795
|
ActivityContainerComponent.prototype.parentInteractionContext;
|
|
1655
1796
|
/** @type {?} */
|
|
1656
|
-
ActivityContainerComponent.prototype.initialActivityOutletContext;
|
|
1657
|
-
/** @type {?} */
|
|
1658
|
-
ActivityContainerComponent.prototype.currentActivity;
|
|
1659
|
-
/** @type {?} */
|
|
1660
1797
|
ActivityContainerComponent.prototype.tabs;
|
|
1661
1798
|
/** @type {?} */
|
|
1662
1799
|
ActivityContainerComponent.prototype.outlets;
|
|
1663
1800
|
/** @type {?} */
|
|
1664
|
-
ActivityContainerComponent.prototype.
|
|
1665
|
-
/**
|
|
1666
|
-
* @type {?}
|
|
1667
|
-
* @private
|
|
1668
|
-
*/
|
|
1669
|
-
ActivityContainerComponent.prototype.obsoleteTabs;
|
|
1801
|
+
ActivityContainerComponent.prototype.activityTabs;
|
|
1670
1802
|
/**
|
|
1671
1803
|
* @type {?}
|
|
1672
1804
|
* @private
|
|
@@ -1678,24 +1810,6 @@ if (false) {
|
|
|
1678
1810
|
*/
|
|
1679
1811
|
ActivityContainerComponent.prototype._activityList;
|
|
1680
1812
|
}
|
|
1681
|
-
(function (ActivityContainerComponent) {
|
|
1682
|
-
/**
|
|
1683
|
-
* @record
|
|
1684
|
-
* @template D, R, E
|
|
1685
|
-
*/
|
|
1686
|
-
function ActivityContext() { }
|
|
1687
|
-
ActivityContainerComponent.ActivityContext = ActivityContext;
|
|
1688
|
-
if (false) {
|
|
1689
|
-
/** @type {?} */
|
|
1690
|
-
ActivityContext.prototype.activityClass;
|
|
1691
|
-
/** @type {?} */
|
|
1692
|
-
ActivityContext.prototype.activityData;
|
|
1693
|
-
/** @type {?} */
|
|
1694
|
-
ActivityContext.prototype.onDone;
|
|
1695
|
-
/** @type {?} */
|
|
1696
|
-
ActivityContext.prototype.onCancel;
|
|
1697
|
-
}
|
|
1698
|
-
})(ActivityContainerComponent || (ActivityContainerComponent = {}));
|
|
1699
1813
|
|
|
1700
1814
|
/**
|
|
1701
1815
|
* @fileoverview added by tsickle
|
|
@@ -1703,19 +1817,68 @@ if (false) {
|
|
|
1703
1817
|
*/
|
|
1704
1818
|
/** @type {?} */
|
|
1705
1819
|
var DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
|
|
1820
|
+
var Guard = /** @class */ (function (_super) {
|
|
1821
|
+
__extends(Guard, _super);
|
|
1822
|
+
function Guard() {
|
|
1823
|
+
return _super.call(this, { initialValue: false }) || this;
|
|
1824
|
+
}
|
|
1825
|
+
Object.defineProperty(Guard.prototype, "value", {
|
|
1826
|
+
get: /**
|
|
1827
|
+
* @return {?}
|
|
1828
|
+
*/
|
|
1829
|
+
function () {
|
|
1830
|
+
return this.store.read();
|
|
1831
|
+
},
|
|
1832
|
+
enumerable: true,
|
|
1833
|
+
configurable: true
|
|
1834
|
+
});
|
|
1835
|
+
/**
|
|
1836
|
+
* @template R
|
|
1837
|
+
* @param {?} fun
|
|
1838
|
+
* @return {?}
|
|
1839
|
+
*/
|
|
1840
|
+
Guard.prototype.whileTrue = /**
|
|
1841
|
+
* @template R
|
|
1842
|
+
* @param {?} fun
|
|
1843
|
+
* @return {?}
|
|
1844
|
+
*/
|
|
1845
|
+
function (fun) {
|
|
1846
|
+
this.startTransaction().commit(true);
|
|
1847
|
+
try {
|
|
1848
|
+
return fun();
|
|
1849
|
+
}
|
|
1850
|
+
finally {
|
|
1851
|
+
this.startTransaction().commit(false);
|
|
1852
|
+
}
|
|
1853
|
+
};
|
|
1854
|
+
/**
|
|
1855
|
+
* @template R
|
|
1856
|
+
* @param {?} fun
|
|
1857
|
+
* @param {?=} defaultValue
|
|
1858
|
+
* @return {?}
|
|
1859
|
+
*/
|
|
1860
|
+
Guard.prototype.runIfFalse = /**
|
|
1861
|
+
* @template R
|
|
1862
|
+
* @param {?} fun
|
|
1863
|
+
* @param {?=} defaultValue
|
|
1864
|
+
* @return {?}
|
|
1865
|
+
*/
|
|
1866
|
+
function (fun, defaultValue) {
|
|
1867
|
+
if (defaultValue === void 0) { defaultValue = null; }
|
|
1868
|
+
return !this.value ? fun() : defaultValue;
|
|
1869
|
+
};
|
|
1870
|
+
return Guard;
|
|
1871
|
+
}(ValueModel));
|
|
1706
1872
|
var DialogInteractionService = /** @class */ (function (_super) {
|
|
1707
1873
|
__extends(DialogInteractionService, _super);
|
|
1708
|
-
function DialogInteractionService(dialogService,
|
|
1874
|
+
function DialogInteractionService(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1709
1875
|
var _this = _super.call(this) || this;
|
|
1710
1876
|
_this.dialogService = dialogService;
|
|
1711
|
-
_this.router = router;
|
|
1712
1877
|
_this.dialogServiceDefaults = dialogServiceDefaults;
|
|
1713
1878
|
_this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
1714
1879
|
_this._activityList = new DelegatingListModel();
|
|
1715
|
-
_this.
|
|
1880
|
+
_this.startingGuard = new Guard();
|
|
1716
1881
|
assert$1.notNil(dialogService);
|
|
1717
|
-
var _a = Dsl.disposeWith(_this), chain = _a.chain, observe = _a.observe;
|
|
1718
|
-
_this.currentActivity = chain(_this.activityList).last();
|
|
1719
1882
|
return _this;
|
|
1720
1883
|
}
|
|
1721
1884
|
/**
|
|
@@ -1725,7 +1888,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1725
1888
|
* @return {?}
|
|
1726
1889
|
*/
|
|
1727
1890
|
function () {
|
|
1728
|
-
return this.
|
|
1891
|
+
return !!this.currentActivityId;
|
|
1729
1892
|
};
|
|
1730
1893
|
/**
|
|
1731
1894
|
* @return {?}
|
|
@@ -1734,7 +1897,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1734
1897
|
* @return {?}
|
|
1735
1898
|
*/
|
|
1736
1899
|
function () {
|
|
1737
|
-
this.currentActivity.
|
|
1900
|
+
this.currentActivity.cancel(null);
|
|
1738
1901
|
};
|
|
1739
1902
|
Object.defineProperty(DialogInteractionService.prototype, "activityList", {
|
|
1740
1903
|
get: /**
|
|
@@ -1787,56 +1950,59 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1787
1950
|
*/
|
|
1788
1951
|
function (a) { return a.constructor.name; })).join(', '));
|
|
1789
1952
|
}
|
|
1790
|
-
this.
|
|
1791
|
-
/** @type {?} */
|
|
1792
|
-
var self = this;
|
|
1793
|
-
/** @type {?} */
|
|
1794
|
-
var config = __assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults, {
|
|
1795
|
-
data: data,
|
|
1796
|
-
disableClose: disableClose,
|
|
1797
|
-
panelClass: 'dialog-interaction-service'
|
|
1798
|
-
});
|
|
1799
|
-
/** @type {?} */
|
|
1800
|
-
var matDialogRef = (/** @type {?} */ (this.dialogService.open(ActivityContainerComponent, config)));
|
|
1801
|
-
return new Promise((/**
|
|
1802
|
-
* @param {?} resolve
|
|
1803
|
-
* @param {?} reject
|
|
1953
|
+
return this.startingGuard.whileTrue((/**
|
|
1804
1954
|
* @return {?}
|
|
1805
1955
|
*/
|
|
1806
|
-
function (
|
|
1956
|
+
function () {
|
|
1957
|
+
_this.currentActivityId = v1();
|
|
1807
1958
|
/** @type {?} */
|
|
1808
|
-
var
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
onDone: /**
|
|
1815
|
-
* @param {?} result
|
|
1816
|
-
* @return {?}
|
|
1817
|
-
*/
|
|
1818
|
-
function (result) {
|
|
1819
|
-
// TODO: should I be calling resolve after close?
|
|
1820
|
-
resolve(result);
|
|
1821
|
-
matDialogRef.close(result);
|
|
1822
|
-
},
|
|
1823
|
-
onCancel: /**
|
|
1824
|
-
* @param {?} error
|
|
1825
|
-
* @return {?}
|
|
1826
|
-
*/
|
|
1827
|
-
function (error) {
|
|
1828
|
-
// TODO: should I be calling reject after close?
|
|
1829
|
-
reject(error);
|
|
1830
|
-
matDialogRef.close(error);
|
|
1831
|
-
}
|
|
1959
|
+
var self = _this;
|
|
1960
|
+
/** @type {?} */
|
|
1961
|
+
var config = __assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, _this.matDialogDefaultConfig, _this.dialogServiceDefaults, {
|
|
1962
|
+
data: data,
|
|
1963
|
+
disableClose: disableClose,
|
|
1964
|
+
panelClass: 'dialog-interaction-service'
|
|
1832
1965
|
});
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1966
|
+
/** @type {?} */
|
|
1967
|
+
var matDialogRef = (/** @type {?} */ (_this.dialogService.open(ActivityContainerComponent, config)));
|
|
1968
|
+
return new Promise((/**
|
|
1969
|
+
* @param {?} resolve
|
|
1970
|
+
* @param {?} reject
|
|
1971
|
+
* @return {?}
|
|
1972
|
+
*/
|
|
1973
|
+
function (resolve, reject) {
|
|
1974
|
+
/** @type {?} */
|
|
1975
|
+
var activityContainer = matDialogRef.componentInstance;
|
|
1976
|
+
activityContainer.parentInteractionContext = _this;
|
|
1977
|
+
self.safelyUpdateActivityListDelegate(activityContainer.activityList);
|
|
1978
|
+
activityContainer.initialActivityOutletContext = {
|
|
1979
|
+
activityClass: activityType,
|
|
1980
|
+
activityData: data,
|
|
1981
|
+
onDone: /**
|
|
1982
|
+
* @param {?} result
|
|
1983
|
+
* @return {?}
|
|
1984
|
+
*/
|
|
1985
|
+
function (result) {
|
|
1986
|
+
resolve(result);
|
|
1987
|
+
matDialogRef.close(result);
|
|
1988
|
+
},
|
|
1989
|
+
onCancel: /**
|
|
1990
|
+
* @param {?} error
|
|
1991
|
+
* @return {?}
|
|
1992
|
+
*/
|
|
1993
|
+
function (error) {
|
|
1994
|
+
reject(error);
|
|
1995
|
+
matDialogRef.close(error);
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
matDialogRef.updateSize();
|
|
1999
|
+
})).finally((/**
|
|
2000
|
+
* @return {?}
|
|
2001
|
+
*/
|
|
2002
|
+
function () {
|
|
2003
|
+
_this.currentActivityId = null;
|
|
2004
|
+
self.safelyUpdateActivityListDelegate(null);
|
|
2005
|
+
}));
|
|
1840
2006
|
}));
|
|
1841
2007
|
};
|
|
1842
2008
|
/**
|
|
@@ -1911,16 +2077,13 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1911
2077
|
/** @nocollapse */
|
|
1912
2078
|
DialogInteractionService.ctorParameters = function () { return [
|
|
1913
2079
|
{ type: MatDialog },
|
|
1914
|
-
{ type: Router },
|
|
1915
2080
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
|
|
1916
2081
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
|
|
1917
2082
|
]; };
|
|
1918
|
-
/** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(
|
|
2083
|
+
/** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
|
|
1919
2084
|
return DialogInteractionService;
|
|
1920
2085
|
}(InteractionContext));
|
|
1921
2086
|
if (false) {
|
|
1922
|
-
/** @type {?} */
|
|
1923
|
-
DialogInteractionService.prototype.currentActivity;
|
|
1924
2087
|
/**
|
|
1925
2088
|
* @type {?}
|
|
1926
2089
|
* @private
|
|
@@ -1930,17 +2093,17 @@ if (false) {
|
|
|
1930
2093
|
* @type {?}
|
|
1931
2094
|
* @private
|
|
1932
2095
|
*/
|
|
1933
|
-
DialogInteractionService.prototype.
|
|
2096
|
+
DialogInteractionService.prototype.startingGuard;
|
|
1934
2097
|
/**
|
|
1935
2098
|
* @type {?}
|
|
1936
2099
|
* @private
|
|
1937
2100
|
*/
|
|
1938
|
-
DialogInteractionService.prototype.
|
|
2101
|
+
DialogInteractionService.prototype.currentActivityId;
|
|
1939
2102
|
/**
|
|
1940
2103
|
* @type {?}
|
|
1941
2104
|
* @private
|
|
1942
2105
|
*/
|
|
1943
|
-
DialogInteractionService.prototype.
|
|
2106
|
+
DialogInteractionService.prototype.dialogService;
|
|
1944
2107
|
/** @type {?} */
|
|
1945
2108
|
DialogInteractionService.prototype.dialogServiceDefaults;
|
|
1946
2109
|
/** @type {?} */
|
|
@@ -2530,10 +2693,92 @@ if (false) {
|
|
|
2530
2693
|
* @fileoverview added by tsickle
|
|
2531
2694
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2532
2695
|
*/
|
|
2696
|
+
var NavigationSession = /** @class */ (function () {
|
|
2697
|
+
function NavigationSession(isPopState, initialUrl) {
|
|
2698
|
+
this.isPopState = isPopState;
|
|
2699
|
+
this.initialUrl = initialUrl;
|
|
2700
|
+
this._alreadyAccepted = [];
|
|
2701
|
+
console.log('NavigationSession', { isPopState: isPopState, initialUrl: initialUrl });
|
|
2702
|
+
}
|
|
2703
|
+
/**
|
|
2704
|
+
* @param {?} placeComponent
|
|
2705
|
+
* @return {?}
|
|
2706
|
+
*/
|
|
2707
|
+
NavigationSession.prototype.alreadyAccepted = /**
|
|
2708
|
+
* @param {?} placeComponent
|
|
2709
|
+
* @return {?}
|
|
2710
|
+
*/
|
|
2711
|
+
function (placeComponent) {
|
|
2712
|
+
return this._alreadyAccepted.includes(placeComponent);
|
|
2713
|
+
};
|
|
2714
|
+
/**
|
|
2715
|
+
* @param {?} component
|
|
2716
|
+
* @return {?}
|
|
2717
|
+
*/
|
|
2718
|
+
NavigationSession.prototype.rememberAcceptanceOf = /**
|
|
2719
|
+
* @param {?} component
|
|
2720
|
+
* @return {?}
|
|
2721
|
+
*/
|
|
2722
|
+
function (component) {
|
|
2723
|
+
this._alreadyAccepted.push(component);
|
|
2724
|
+
};
|
|
2725
|
+
return NavigationSession;
|
|
2726
|
+
}());
|
|
2727
|
+
if (false) {
|
|
2728
|
+
/**
|
|
2729
|
+
* @type {?}
|
|
2730
|
+
* @private
|
|
2731
|
+
*/
|
|
2732
|
+
NavigationSession.prototype._alreadyAccepted;
|
|
2733
|
+
/** @type {?} */
|
|
2734
|
+
NavigationSession.prototype.isPopState;
|
|
2735
|
+
/** @type {?} */
|
|
2736
|
+
NavigationSession.prototype.initialUrl;
|
|
2737
|
+
}
|
|
2533
2738
|
var PlaceRouter = /** @class */ (function () {
|
|
2534
|
-
function PlaceRouter(router) {
|
|
2739
|
+
function PlaceRouter(router, angularLocation) {
|
|
2740
|
+
var _this = this;
|
|
2535
2741
|
this.router = router;
|
|
2742
|
+
this._navigationSession = new MutableValueModel();
|
|
2743
|
+
angularLocation.onUrlChange((/**
|
|
2744
|
+
* @param {?} url
|
|
2745
|
+
* @return {?}
|
|
2746
|
+
*/
|
|
2747
|
+
function (url) {
|
|
2748
|
+
console.log("### " + url);
|
|
2749
|
+
}));
|
|
2750
|
+
this.router.events.subscribe((/**
|
|
2751
|
+
* @param {?} event
|
|
2752
|
+
* @return {?}
|
|
2753
|
+
*/
|
|
2754
|
+
function (event) {
|
|
2755
|
+
// console.log(`${event.constructor.name}`, location.pathname, angularLocation.getState());
|
|
2756
|
+
// NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
|
|
2757
|
+
// NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
|
|
2758
|
+
// NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
|
|
2759
|
+
if (event instanceof NavigationStart && !_this.navigationSession) {
|
|
2760
|
+
_this._navigationSession.value = new NavigationSession(event.navigationTrigger === 'popstate', _this.router.routerState.snapshot.url);
|
|
2761
|
+
}
|
|
2762
|
+
if (event instanceof NavigationEnd) {
|
|
2763
|
+
console.log('navigation ended');
|
|
2764
|
+
_this._navigationSession.value = null;
|
|
2765
|
+
}
|
|
2766
|
+
if (event instanceof NavigationError) {
|
|
2767
|
+
console.log('navigation errored');
|
|
2768
|
+
_this._navigationSession.value = null;
|
|
2769
|
+
}
|
|
2770
|
+
}));
|
|
2536
2771
|
}
|
|
2772
|
+
Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
|
|
2773
|
+
get: /**
|
|
2774
|
+
* @return {?}
|
|
2775
|
+
*/
|
|
2776
|
+
function () {
|
|
2777
|
+
return this._navigationSession.value;
|
|
2778
|
+
},
|
|
2779
|
+
enumerable: true,
|
|
2780
|
+
configurable: true
|
|
2781
|
+
});
|
|
2537
2782
|
/**
|
|
2538
2783
|
* @param {?} activatedRoute
|
|
2539
2784
|
* @param {?} previous
|
|
@@ -2576,7 +2821,6 @@ var PlaceRouter = /** @class */ (function () {
|
|
|
2576
2821
|
var commands = (weHaveARouteId) ?
|
|
2577
2822
|
[urlSegments[0].path, sanitised.getFormattedRouteId(), sanitised.getFormattedParameters()] :
|
|
2578
2823
|
[urlSegments[0].path, sanitised.getFormattedParameters()];
|
|
2579
|
-
console.log("redirect path", commands);
|
|
2580
2824
|
return this.router.createUrlTree(commands);
|
|
2581
2825
|
};
|
|
2582
2826
|
/**
|
|
@@ -2620,12 +2864,18 @@ var PlaceRouter = /** @class */ (function () {
|
|
|
2620
2864
|
];
|
|
2621
2865
|
/** @nocollapse */
|
|
2622
2866
|
PlaceRouter.ctorParameters = function () { return [
|
|
2623
|
-
{ type: Router }
|
|
2867
|
+
{ type: Router },
|
|
2868
|
+
{ type: Location }
|
|
2624
2869
|
]; };
|
|
2625
|
-
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router)); }, token: PlaceRouter, providedIn: "root" });
|
|
2870
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location)); }, token: PlaceRouter, providedIn: "root" });
|
|
2626
2871
|
return PlaceRouter;
|
|
2627
2872
|
}());
|
|
2628
2873
|
if (false) {
|
|
2874
|
+
/**
|
|
2875
|
+
* @type {?}
|
|
2876
|
+
* @private
|
|
2877
|
+
*/
|
|
2878
|
+
PlaceRouter.prototype._navigationSession;
|
|
2629
2879
|
/**
|
|
2630
2880
|
* @type {?}
|
|
2631
2881
|
* @private
|
|
@@ -3705,8 +3955,8 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
|
|
|
3705
3955
|
_this.placeHistory = placeHistory;
|
|
3706
3956
|
_this.animate = true;
|
|
3707
3957
|
_this._activePlace = new MutableValueModel();
|
|
3708
|
-
_this._incomingRouteChange = new Guard();
|
|
3709
|
-
_this._inOutletUpdate = new Guard();
|
|
3958
|
+
_this._incomingRouteChange = new Guard$1();
|
|
3959
|
+
_this._inOutletUpdate = new Guard$1();
|
|
3710
3960
|
_this._activatedRouteModel = new MutableValueModel();
|
|
3711
3961
|
_this._placeDefinition = new MutableValueModel();
|
|
3712
3962
|
_this._resolvedParameters = new MutableValueModel();
|
|
@@ -4409,16 +4659,15 @@ function Result() { }
|
|
|
4409
4659
|
*/
|
|
4410
4660
|
function ActivityOutletContext() { }
|
|
4411
4661
|
if (false) {
|
|
4412
|
-
/** @type {?} */
|
|
4413
|
-
ActivityOutletContext.prototype.interactionContext;
|
|
4414
4662
|
/** @type {?} */
|
|
4415
4663
|
ActivityOutletContext.prototype.activityClass;
|
|
4416
4664
|
/** @type {?} */
|
|
4417
4665
|
ActivityOutletContext.prototype.activityData;
|
|
4418
|
-
/**
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4666
|
+
/**
|
|
4667
|
+
* @param {?} component
|
|
4668
|
+
* @return {?}
|
|
4669
|
+
*/
|
|
4670
|
+
ActivityOutletContext.prototype.componentReady = function (component) { };
|
|
4422
4671
|
}
|
|
4423
4672
|
|
|
4424
4673
|
/**
|
|
@@ -4581,33 +4830,12 @@ if (false) {
|
|
|
4581
4830
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4582
4831
|
*/
|
|
4583
4832
|
var LeavePlaceGuard = /** @class */ (function () {
|
|
4584
|
-
function LeavePlaceGuard(router, injector, interactionContext,
|
|
4833
|
+
function LeavePlaceGuard(router, injector, placeRouter, interactionContext, angularLocation) {
|
|
4585
4834
|
this.router = router;
|
|
4586
4835
|
this.injector = injector;
|
|
4836
|
+
this.placeRouter = placeRouter;
|
|
4587
4837
|
this.interactionContext = interactionContext;
|
|
4588
|
-
this.
|
|
4589
|
-
// TODO: should probably replace this with a RouteTracker thingy.
|
|
4590
|
-
this._alreadyAccepted = [];
|
|
4591
|
-
console.log('***** Created new guard ******');
|
|
4592
|
-
/** @type {?} */
|
|
4593
|
-
var self = this;
|
|
4594
|
-
this.router.events.subscribe((/**
|
|
4595
|
-
* @param {?} event
|
|
4596
|
-
* @return {?}
|
|
4597
|
-
*/
|
|
4598
|
-
function (event) {
|
|
4599
|
-
// NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
|
|
4600
|
-
// NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
|
|
4601
|
-
// NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
|
|
4602
|
-
if (event instanceof NavigationEnd) {
|
|
4603
|
-
console.log('navigation ended');
|
|
4604
|
-
self._alreadyAccepted = [];
|
|
4605
|
-
}
|
|
4606
|
-
if (event instanceof NavigationError) {
|
|
4607
|
-
console.log('navigation errored');
|
|
4608
|
-
self._alreadyAccepted = [];
|
|
4609
|
-
}
|
|
4610
|
-
}));
|
|
4838
|
+
this.angularLocation = angularLocation;
|
|
4611
4839
|
}
|
|
4612
4840
|
/**
|
|
4613
4841
|
* @param {?} component
|
|
@@ -4624,105 +4852,45 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4624
4852
|
* @return {?}
|
|
4625
4853
|
*/
|
|
4626
4854
|
function (component, currentRoute, currentState, nextState) {
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
|
|
4653
|
-
// parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
|
|
4654
|
-
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4655
|
-
// canDeactivate {
|
|
4656
|
-
// staticPath: "/hero-stats",
|
|
4657
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4658
|
-
// nextStateUrl: "/route-parameters/-1"
|
|
4659
|
-
// }
|
|
4660
|
-
// canDeactivate {
|
|
4661
|
-
// staticPath: "/route-parameters",
|
|
4662
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4663
|
-
// nextStateUrl: "/route-parameters/-1"
|
|
4664
|
-
// }
|
|
4665
|
-
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
|
|
4666
|
-
// parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
|
|
4667
|
-
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4668
|
-
// canDeactivate {
|
|
4669
|
-
// staticPath: "/hero-stats",
|
|
4670
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4671
|
-
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
4672
|
-
// }
|
|
4673
|
-
// HACK: this will break with child routes...
|
|
4674
|
-
if (this.alreadyAccepted(component)) {
|
|
4675
|
-
return true;
|
|
4676
|
-
}
|
|
4677
|
-
else {
|
|
4678
|
-
if (!nextState.url.startsWith(placeDefinitionPath)) {
|
|
4679
|
-
/** @type {?} */
|
|
4680
|
-
var self_1 = this;
|
|
4681
|
-
return Promise.resolve(component.canDeactivate())
|
|
4682
|
-
.then((/**
|
|
4683
|
-
* @param {?} canLeave
|
|
4684
|
-
* @return {?}
|
|
4685
|
-
*/
|
|
4686
|
-
function (canLeave) {
|
|
4687
|
-
if (!canLeave) {
|
|
4688
|
-
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4689
|
-
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4690
|
-
_this.location.go(currentState.url);
|
|
4691
|
-
return false;
|
|
4692
|
-
}
|
|
4693
|
-
else {
|
|
4694
|
-
if (_this.interactionContext.isActive()) {
|
|
4695
|
-
_this.interactionContext.currentActivity.value.cancel(null);
|
|
4696
|
-
return false;
|
|
4855
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4856
|
+
var placeDefinitionPath, self_1, canLeave;
|
|
4857
|
+
return __generator(this, function (_a) {
|
|
4858
|
+
switch (_a.label) {
|
|
4859
|
+
case 0:
|
|
4860
|
+
placeDefinitionPath = "/" + component.placeDefinition.path;
|
|
4861
|
+
if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
|
|
4862
|
+
return [2 /*return*/, true];
|
|
4863
|
+
case 1:
|
|
4864
|
+
if (!!nextState.url.startsWith(placeDefinitionPath)) return [3 /*break*/, 3];
|
|
4865
|
+
self_1 = this;
|
|
4866
|
+
return [4 /*yield*/, component.canDeactivate()];
|
|
4867
|
+
case 2:
|
|
4868
|
+
canLeave = _a.sent();
|
|
4869
|
+
// component is happy to leave but we need to check if it's left an interaction
|
|
4870
|
+
// open. If so we close and stay where we are.
|
|
4871
|
+
if (canLeave && this.interactionContext.isActive()) {
|
|
4872
|
+
canLeave = false;
|
|
4873
|
+
console.log("cancelling", { activity: this.interactionContext.currentActivity });
|
|
4874
|
+
this.interactionContext.currentActivity.cancel(null);
|
|
4875
|
+
}
|
|
4876
|
+
// If we're still leaving then remember it since angular will call this method multiple
|
|
4877
|
+
// times if any route parameters are changed along the way.
|
|
4878
|
+
if (canLeave) {
|
|
4879
|
+
self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
|
|
4697
4880
|
}
|
|
4698
4881
|
else {
|
|
4699
|
-
|
|
4882
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4883
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4884
|
+
if (this.placeRouter.navigationSession.isPopState) {
|
|
4885
|
+
console.log('cancelled during popstate');
|
|
4886
|
+
this.angularLocation.go(this.placeRouter.navigationSession.initialUrl);
|
|
4887
|
+
}
|
|
4700
4888
|
}
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
function (canDeactivate) {
|
|
4707
|
-
if (canDeactivate) {
|
|
4708
|
-
self_1._alreadyAccepted.push(component);
|
|
4709
|
-
}
|
|
4710
|
-
return canDeactivate;
|
|
4711
|
-
}));
|
|
4712
|
-
}
|
|
4713
|
-
return true;
|
|
4714
|
-
}
|
|
4715
|
-
};
|
|
4716
|
-
/**
|
|
4717
|
-
* @param {?} placeComponent
|
|
4718
|
-
* @return {?}
|
|
4719
|
-
*/
|
|
4720
|
-
LeavePlaceGuard.prototype.alreadyAccepted = /**
|
|
4721
|
-
* @param {?} placeComponent
|
|
4722
|
-
* @return {?}
|
|
4723
|
-
*/
|
|
4724
|
-
function (placeComponent) {
|
|
4725
|
-
return this._alreadyAccepted.includes(placeComponent);
|
|
4889
|
+
return [2 /*return*/, canLeave];
|
|
4890
|
+
case 3: return [2 /*return*/, true];
|
|
4891
|
+
}
|
|
4892
|
+
});
|
|
4893
|
+
});
|
|
4726
4894
|
};
|
|
4727
4895
|
LeavePlaceGuard.decorators = [
|
|
4728
4896
|
{ type: Injectable, args: [{
|
|
@@ -4733,16 +4901,11 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4733
4901
|
LeavePlaceGuard.ctorParameters = function () { return [
|
|
4734
4902
|
{ type: Router },
|
|
4735
4903
|
{ type: Injector },
|
|
4904
|
+
{ type: PlaceRouter },
|
|
4736
4905
|
{ type: InteractionContext },
|
|
4737
4906
|
{ type: Location }
|
|
4738
4907
|
]; };
|
|
4739
|
-
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext), ɵɵinject(Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4740
|
-
__decorate([
|
|
4741
|
-
Trace(),
|
|
4742
|
-
__metadata("design:type", Function),
|
|
4743
|
-
__metadata("design:paramtypes", [PlaceComponent]),
|
|
4744
|
-
__metadata("design:returntype", Boolean)
|
|
4745
|
-
], LeavePlaceGuard.prototype, "alreadyAccepted", null);
|
|
4908
|
+
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(InteractionContext), ɵɵinject(Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4746
4909
|
return LeavePlaceGuard;
|
|
4747
4910
|
}());
|
|
4748
4911
|
if (false) {
|
|
@@ -4750,21 +4913,21 @@ if (false) {
|
|
|
4750
4913
|
* @type {?}
|
|
4751
4914
|
* @private
|
|
4752
4915
|
*/
|
|
4753
|
-
LeavePlaceGuard.prototype.
|
|
4916
|
+
LeavePlaceGuard.prototype.router;
|
|
4754
4917
|
/**
|
|
4755
4918
|
* @type {?}
|
|
4756
4919
|
* @private
|
|
4757
4920
|
*/
|
|
4758
|
-
LeavePlaceGuard.prototype.
|
|
4921
|
+
LeavePlaceGuard.prototype.injector;
|
|
4759
4922
|
/**
|
|
4760
4923
|
* @type {?}
|
|
4761
4924
|
* @private
|
|
4762
4925
|
*/
|
|
4763
|
-
LeavePlaceGuard.prototype.
|
|
4926
|
+
LeavePlaceGuard.prototype.placeRouter;
|
|
4764
4927
|
/** @type {?} */
|
|
4765
4928
|
LeavePlaceGuard.prototype.interactionContext;
|
|
4766
4929
|
/** @type {?} */
|
|
4767
|
-
LeavePlaceGuard.prototype.
|
|
4930
|
+
LeavePlaceGuard.prototype.angularLocation;
|
|
4768
4931
|
}
|
|
4769
4932
|
|
|
4770
4933
|
/**
|
|
@@ -5073,5 +5236,5 @@ var ParameterType;
|
|
|
5073
5236
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5074
5237
|
*/
|
|
5075
5238
|
|
|
5076
|
-
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CloseInteractionGuard, CommandDirective, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NumberInputComponent, ParameterDefinition, ParameterSnapshot, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, RouteParameter, RouteParameterList, RouteParameterValue, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, leftRightPlaceAnimation, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb,
|
|
5239
|
+
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CloseInteractionGuard, CommandDirective, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NumberInputComponent, ParameterDefinition, ParameterSnapshot, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, RouteParameter, RouteParameterList, RouteParameterValue, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, leftRightPlaceAnimation, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, Activity as ɵba, ConfirmThenDialogComponent as ɵbc, AlertDialogComponent as ɵbd, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbf, DialogInteractionService as ɵbg, DisposableComponent as ɵc, NumberInputComponent as ɵd, AbstractInputComponent as ɵe, StringInputComponent as ɵf, PasswordInputComponent as ɵg, SelectInputComponent as ɵh, PlaceModule as ɵi, EmptyStateComponent as ɵj, BusyOverlayComponent as ɵk, PlaceOutletComponent as ɵl, leftRightPlaceAnimation as ɵm, LEFT_RIGHT_PLACE_ANIMATION as ɵn, PlaceRouter as ɵo, PlaceHistory as ɵp, TabbedPlaceNavigationComponent as ɵq, AbstractPlaceNavigationComponent as ɵr, ListPlaceNavComponent as ɵs, InteractionModule as ɵt, ActivityContainerComponent as ɵu, InteractionContext as ɵv, ActivityOutletComponent as ɵw, ConfirmationDialogComponent as ɵx, AbstractActivity as ɵy, ACTIVITY_DATA as ɵz };
|
|
5077
5240
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|