@coolon/angular-ui-powerups 0.0.63 → 0.0.65
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 +722 -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 +71 -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 +110 -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 +582 -439
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +695 -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 +13 -6
- 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,121 @@ 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 () {
|
|
889
|
+
function Activity() {
|
|
890
|
+
this._busyModel = new DelegatingValueModel().withDefault(false);
|
|
891
|
+
}
|
|
877
892
|
/**
|
|
878
893
|
* @param {?} activityContext
|
|
879
894
|
* @return {?}
|
|
880
895
|
*/
|
|
881
|
-
Activity.prototype.initialise =
|
|
896
|
+
Activity.prototype.initialise = /**
|
|
897
|
+
* @param {?} activityContext
|
|
898
|
+
* @return {?}
|
|
899
|
+
*/
|
|
900
|
+
function (activityContext) {
|
|
901
|
+
assert$1.isNil(this._activityContext);
|
|
902
|
+
this._activityContext = activityContext;
|
|
903
|
+
};
|
|
882
904
|
/**
|
|
883
|
-
* @param {
|
|
905
|
+
* @param {?=} result
|
|
906
|
+
* @return {?}
|
|
907
|
+
*/
|
|
908
|
+
Activity.prototype.done = /**
|
|
909
|
+
* @param {?=} result
|
|
910
|
+
* @return {?}
|
|
911
|
+
*/
|
|
912
|
+
function (result) {
|
|
913
|
+
return this._activityContext.onDone(result);
|
|
914
|
+
};
|
|
915
|
+
/**
|
|
916
|
+
* @param {?=} error
|
|
917
|
+
* @return {?}
|
|
918
|
+
*/
|
|
919
|
+
Activity.prototype.cancel = /**
|
|
920
|
+
* @param {?=} error
|
|
921
|
+
* @return {?}
|
|
922
|
+
*/
|
|
923
|
+
function (error) {
|
|
924
|
+
this._activityContext.onCancel(error);
|
|
925
|
+
};
|
|
926
|
+
// @Trace()
|
|
927
|
+
// @Trace()
|
|
928
|
+
/**
|
|
929
|
+
* @return {?}
|
|
930
|
+
*/
|
|
931
|
+
Activity.prototype.onActivityReady =
|
|
932
|
+
// @Trace()
|
|
933
|
+
/**
|
|
934
|
+
* @return {?}
|
|
935
|
+
*/
|
|
936
|
+
function () {
|
|
937
|
+
};
|
|
938
|
+
Object.defineProperty(Activity.prototype, "busy", {
|
|
939
|
+
get: /**
|
|
940
|
+
* @return {?}
|
|
941
|
+
*/
|
|
942
|
+
function () {
|
|
943
|
+
return this._busyModel.readonly;
|
|
944
|
+
},
|
|
945
|
+
enumerable: true,
|
|
946
|
+
configurable: true
|
|
947
|
+
});
|
|
948
|
+
/**
|
|
949
|
+
* @param {?} busyModel
|
|
884
950
|
* @return {?}
|
|
885
951
|
*/
|
|
886
|
-
Activity.prototype.
|
|
952
|
+
Activity.prototype.busyWhile = /**
|
|
953
|
+
* @param {?} busyModel
|
|
954
|
+
* @return {?}
|
|
955
|
+
*/
|
|
956
|
+
function (busyModel) {
|
|
957
|
+
this._busyModel.setDelegate(busyModel);
|
|
958
|
+
};
|
|
887
959
|
/**
|
|
888
|
-
* @param {?} e
|
|
889
960
|
* @return {?}
|
|
890
961
|
*/
|
|
891
|
-
Activity.prototype.
|
|
962
|
+
Activity.prototype.isBusy = /**
|
|
963
|
+
* @return {?}
|
|
964
|
+
*/
|
|
965
|
+
function () {
|
|
966
|
+
return this._busyModel.value;
|
|
967
|
+
};
|
|
968
|
+
return Activity;
|
|
969
|
+
}());
|
|
970
|
+
if (false) {
|
|
971
|
+
/**
|
|
972
|
+
* @type {?}
|
|
973
|
+
* @private
|
|
974
|
+
*/
|
|
975
|
+
Activity.prototype._busyModel;
|
|
976
|
+
/**
|
|
977
|
+
* @type {?}
|
|
978
|
+
* @private
|
|
979
|
+
*/
|
|
980
|
+
Activity.prototype._activityContext;
|
|
892
981
|
}
|
|
982
|
+
(function (Activity) {
|
|
983
|
+
/**
|
|
984
|
+
* @record
|
|
985
|
+
* @template R, E
|
|
986
|
+
*/
|
|
987
|
+
function Callbacks() { }
|
|
988
|
+
Activity.Callbacks = Callbacks;
|
|
989
|
+
if (false) {
|
|
990
|
+
/** @type {?} */
|
|
991
|
+
Callbacks.prototype.onDone;
|
|
992
|
+
/** @type {?} */
|
|
993
|
+
Callbacks.prototype.onCancel;
|
|
994
|
+
}
|
|
995
|
+
})(Activity || (Activity = {}));
|
|
893
996
|
|
|
894
997
|
/**
|
|
895
998
|
* @fileoverview added by tsickle
|
|
@@ -910,11 +1013,19 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
910
1013
|
this.injector = injector;
|
|
911
1014
|
}
|
|
912
1015
|
Object.defineProperty(ActivityOutletComponent.prototype, "activityContext", {
|
|
1016
|
+
get: /**
|
|
1017
|
+
* @return {?}
|
|
1018
|
+
*/
|
|
1019
|
+
function () {
|
|
1020
|
+
return this._activityContext;
|
|
1021
|
+
},
|
|
913
1022
|
set: /**
|
|
914
1023
|
* @param {?} activityContext
|
|
915
1024
|
* @return {?}
|
|
916
1025
|
*/
|
|
917
1026
|
function (activityContext) {
|
|
1027
|
+
assert.isNil(this._activityContext);
|
|
1028
|
+
this._activityContext = activityContext;
|
|
918
1029
|
this.loadActivity(activityContext);
|
|
919
1030
|
},
|
|
920
1031
|
enumerable: true,
|
|
@@ -943,7 +1054,7 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
943
1054
|
providers: [
|
|
944
1055
|
{
|
|
945
1056
|
provide: InteractionContext,
|
|
946
|
-
useValue: this
|
|
1057
|
+
useValue: this.interactionContext
|
|
947
1058
|
},
|
|
948
1059
|
{ provide: ACTIVITY_DATA, useValue: activityContext.activityData }
|
|
949
1060
|
],
|
|
@@ -954,6 +1065,9 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
954
1065
|
this.viewContainerRef.clear();
|
|
955
1066
|
this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
|
|
956
1067
|
this.activityComponentRef.instance.initialise(activityContext);
|
|
1068
|
+
if (this.activityContext.componentReady) {
|
|
1069
|
+
this.activityContext.componentReady(this.component);
|
|
1070
|
+
}
|
|
957
1071
|
};
|
|
958
1072
|
Object.defineProperty(ActivityOutletComponent.prototype, "component", {
|
|
959
1073
|
get: /**
|
|
@@ -965,71 +1079,6 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
965
1079
|
enumerable: true,
|
|
966
1080
|
configurable: true
|
|
967
1081
|
});
|
|
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
1082
|
ActivityOutletComponent.decorators = [
|
|
1034
1083
|
{ type: Component, args: [{
|
|
1035
1084
|
selector: 'angular-ui-powerups-activity-outlet',
|
|
@@ -1052,6 +1101,11 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
1052
1101
|
if (false) {
|
|
1053
1102
|
/** @type {?} */
|
|
1054
1103
|
ActivityOutletComponent.prototype.interactionContext;
|
|
1104
|
+
/**
|
|
1105
|
+
* @type {?}
|
|
1106
|
+
* @private
|
|
1107
|
+
*/
|
|
1108
|
+
ActivityOutletComponent.prototype._activityContext;
|
|
1055
1109
|
/**
|
|
1056
1110
|
* @type {?}
|
|
1057
1111
|
* @private
|
|
@@ -1080,108 +1134,22 @@ if (false) {
|
|
|
1080
1134
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1081
1135
|
*/
|
|
1082
1136
|
/**
|
|
1137
|
+
* Deprecated. You can now extend the Activity class directly.
|
|
1138
|
+
* @abstract
|
|
1083
1139
|
* @template D, R, E
|
|
1084
1140
|
*/
|
|
1085
1141
|
var /**
|
|
1142
|
+
* Deprecated. You can now extend the Activity class directly.
|
|
1143
|
+
* @abstract
|
|
1086
1144
|
* @template D, R, E
|
|
1087
1145
|
*/
|
|
1088
1146
|
AbstractActivity = /** @class */ (function (_super) {
|
|
1089
1147
|
__extends(AbstractActivity, _super);
|
|
1090
1148
|
function AbstractActivity() {
|
|
1091
|
-
|
|
1092
|
-
_this._busyModel = new DelegatingValueModel().withDefault(false);
|
|
1093
|
-
return _this;
|
|
1149
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1094
1150
|
}
|
|
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
1151
|
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
|
-
}
|
|
1152
|
+
}(Activity));
|
|
1185
1153
|
|
|
1186
1154
|
/**
|
|
1187
1155
|
* @fileoverview added by tsickle
|
|
@@ -1371,16 +1339,174 @@ if (false) {
|
|
|
1371
1339
|
* @fileoverview added by tsickle
|
|
1372
1340
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1373
1341
|
*/
|
|
1342
|
+
/**
|
|
1343
|
+
* Note: this class is mutable and is stored in a list model. This is normally a big no no but
|
|
1344
|
+
* we're manually deriving other models from the list after view state changes. I.e. we not
|
|
1345
|
+
* using pectin chains on any of the mutable fields.
|
|
1346
|
+
* @template D, R, E
|
|
1347
|
+
*/
|
|
1348
|
+
var /**
|
|
1349
|
+
* Note: this class is mutable and is stored in a list model. This is normally a big no no but
|
|
1350
|
+
* we're manually deriving other models from the list after view state changes. I.e. we not
|
|
1351
|
+
* using pectin chains on any of the mutable fields.
|
|
1352
|
+
* @template D, R, E
|
|
1353
|
+
*/
|
|
1354
|
+
TabContext = /** @class */ (function () {
|
|
1355
|
+
function TabContext(activityData, activityClass, interactionContext, activityCallbacks) {
|
|
1356
|
+
this.activityData = activityData;
|
|
1357
|
+
this.activityClass = activityClass;
|
|
1358
|
+
this.interactionContext = interactionContext;
|
|
1359
|
+
this.activityCallbacks = activityCallbacks;
|
|
1360
|
+
this._complete = false;
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* @return {?}
|
|
1364
|
+
*/
|
|
1365
|
+
TabContext.prototype.isComponentRealised = /**
|
|
1366
|
+
* @return {?}
|
|
1367
|
+
*/
|
|
1368
|
+
function () {
|
|
1369
|
+
return !!this._component;
|
|
1370
|
+
};
|
|
1371
|
+
/**
|
|
1372
|
+
* @return {?}
|
|
1373
|
+
*/
|
|
1374
|
+
TabContext.prototype.isComplete = /**
|
|
1375
|
+
* @return {?}
|
|
1376
|
+
*/
|
|
1377
|
+
function () {
|
|
1378
|
+
return this._complete;
|
|
1379
|
+
};
|
|
1380
|
+
/**
|
|
1381
|
+
* @param {?} component
|
|
1382
|
+
* @return {?}
|
|
1383
|
+
*/
|
|
1384
|
+
TabContext.prototype.componentReady = /**
|
|
1385
|
+
* @param {?} component
|
|
1386
|
+
* @return {?}
|
|
1387
|
+
*/
|
|
1388
|
+
function (component) {
|
|
1389
|
+
assert.isNil(this._component);
|
|
1390
|
+
this._component = component;
|
|
1391
|
+
};
|
|
1392
|
+
Object.defineProperty(TabContext.prototype, "component", {
|
|
1393
|
+
get: /**
|
|
1394
|
+
* @return {?}
|
|
1395
|
+
*/
|
|
1396
|
+
function () {
|
|
1397
|
+
return this._component;
|
|
1398
|
+
},
|
|
1399
|
+
enumerable: true,
|
|
1400
|
+
configurable: true
|
|
1401
|
+
});
|
|
1402
|
+
// @Trace()
|
|
1403
|
+
// @Trace()
|
|
1404
|
+
/**
|
|
1405
|
+
* @param {?} result
|
|
1406
|
+
* @return {?}
|
|
1407
|
+
*/
|
|
1408
|
+
TabContext.prototype.onDone =
|
|
1409
|
+
// @Trace()
|
|
1410
|
+
/**
|
|
1411
|
+
* @param {?} result
|
|
1412
|
+
* @return {?}
|
|
1413
|
+
*/
|
|
1414
|
+
function (result) {
|
|
1415
|
+
this._complete = true;
|
|
1416
|
+
this.activityCallbacks.onDone(result);
|
|
1417
|
+
};
|
|
1418
|
+
// @Trace()
|
|
1419
|
+
// @Trace()
|
|
1420
|
+
/**
|
|
1421
|
+
* @param {?} error
|
|
1422
|
+
* @return {?}
|
|
1423
|
+
*/
|
|
1424
|
+
TabContext.prototype.onCancel =
|
|
1425
|
+
// @Trace()
|
|
1426
|
+
/**
|
|
1427
|
+
* @param {?} error
|
|
1428
|
+
* @return {?}
|
|
1429
|
+
*/
|
|
1430
|
+
function (error) {
|
|
1431
|
+
this._complete = true;
|
|
1432
|
+
this.activityCallbacks.onCancel(error);
|
|
1433
|
+
};
|
|
1434
|
+
return TabContext;
|
|
1435
|
+
}());
|
|
1436
|
+
if (false) {
|
|
1437
|
+
/**
|
|
1438
|
+
* @type {?}
|
|
1439
|
+
* @private
|
|
1440
|
+
*/
|
|
1441
|
+
TabContext.prototype._complete;
|
|
1442
|
+
/**
|
|
1443
|
+
* @type {?}
|
|
1444
|
+
* @private
|
|
1445
|
+
*/
|
|
1446
|
+
TabContext.prototype._component;
|
|
1447
|
+
/** @type {?} */
|
|
1448
|
+
TabContext.prototype.activityData;
|
|
1449
|
+
/** @type {?} */
|
|
1450
|
+
TabContext.prototype.activityClass;
|
|
1451
|
+
/** @type {?} */
|
|
1452
|
+
TabContext.prototype.interactionContext;
|
|
1453
|
+
/** @type {?} */
|
|
1454
|
+
TabContext.prototype.activityCallbacks;
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* @template D, R, E
|
|
1458
|
+
*/
|
|
1374
1459
|
var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
1375
1460
|
__extends(ActivityContainerComponent, _super);
|
|
1376
1461
|
function ActivityContainerComponent() {
|
|
1377
1462
|
var _this = _super.call(this) || this;
|
|
1378
|
-
_this.
|
|
1379
|
-
_this.
|
|
1463
|
+
_this.activityFinishedEvents = new MutableStream();
|
|
1464
|
+
_this.activityTabs = new MutableListModel();
|
|
1380
1465
|
_this.finished = false;
|
|
1381
1466
|
_this._activityList = new MutableListModel();
|
|
1467
|
+
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;
|
|
1468
|
+
chain(_this.activityFinishedEvents).throttle(50).subscribe((/**
|
|
1469
|
+
* @return {?}
|
|
1470
|
+
*/
|
|
1471
|
+
function () { return _this.onActivityFinished(); }));
|
|
1382
1472
|
return _this;
|
|
1383
1473
|
}
|
|
1474
|
+
Object.defineProperty(ActivityContainerComponent.prototype, "initialActivityOutletContext", {
|
|
1475
|
+
get: /**
|
|
1476
|
+
* @return {?}
|
|
1477
|
+
*/
|
|
1478
|
+
function () {
|
|
1479
|
+
return this.activityTabs.length > 0 ? this.activityTabs.value[0] : null;
|
|
1480
|
+
},
|
|
1481
|
+
set: /**
|
|
1482
|
+
* @param {?} initialContext
|
|
1483
|
+
* @return {?}
|
|
1484
|
+
*/
|
|
1485
|
+
function (initialContext) {
|
|
1486
|
+
var _this = this;
|
|
1487
|
+
assert.isNil(this.initialActivityOutletContext);
|
|
1488
|
+
this.activityTabs.push(new TabContext(initialContext.activityData, initialContext.activityClass, this, {
|
|
1489
|
+
onDone: (/**
|
|
1490
|
+
* @param {?} result
|
|
1491
|
+
* @return {?}
|
|
1492
|
+
*/
|
|
1493
|
+
function (result) {
|
|
1494
|
+
_this.finished = true;
|
|
1495
|
+
return initialContext.onDone(result);
|
|
1496
|
+
}),
|
|
1497
|
+
onCancel: (/**
|
|
1498
|
+
* @param {?} error
|
|
1499
|
+
* @return {?}
|
|
1500
|
+
*/
|
|
1501
|
+
function (error) {
|
|
1502
|
+
_this.finished = true;
|
|
1503
|
+
return initialContext.onCancel(error);
|
|
1504
|
+
})
|
|
1505
|
+
}));
|
|
1506
|
+
},
|
|
1507
|
+
enumerable: true,
|
|
1508
|
+
configurable: true
|
|
1509
|
+
});
|
|
1384
1510
|
/**
|
|
1385
1511
|
* @return {?}
|
|
1386
1512
|
*/
|
|
@@ -1416,94 +1542,28 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1416
1542
|
*/
|
|
1417
1543
|
function () {
|
|
1418
1544
|
var _this = this;
|
|
1419
|
-
var
|
|
1420
|
-
|
|
1421
|
-
* @param {?} c
|
|
1545
|
+
var _a = Dsl.disposeWith(this), chain = _a.chain, observe = _a.observe;
|
|
1546
|
+
observe.valuesFrom(this.outlets.changes).subscribe((/**
|
|
1422
1547
|
* @return {?}
|
|
1423
1548
|
*/
|
|
1424
|
-
function (
|
|
1425
|
-
observe.valuesFrom(this.outlets.changes).subscribe((/**
|
|
1426
|
-
* @param {?} change
|
|
1549
|
+
function () { return setTimeout((/**
|
|
1427
1550
|
* @return {?}
|
|
1428
1551
|
*/
|
|
1429
|
-
function (
|
|
1430
|
-
_this.safelyUpdateActivityList(change.map((/**
|
|
1431
|
-
* @param {?} c
|
|
1432
|
-
* @return {?}
|
|
1433
|
-
*/
|
|
1434
|
-
function (c) { return c.component; })));
|
|
1435
|
-
}));
|
|
1552
|
+
function () { return _this.updateActivityList(); })); }));
|
|
1436
1553
|
observe.valuesFrom(this.tabs.animationDone).subscribe((/**
|
|
1437
1554
|
* @return {?}
|
|
1438
1555
|
*/
|
|
1439
1556
|
function () { return _this.onAnimationFinished(); }));
|
|
1557
|
+
this.updateActivityList();
|
|
1440
1558
|
};
|
|
1441
1559
|
/**
|
|
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
|
|
1560
|
+
* @template D1, R1, E1
|
|
1501
1561
|
* @param {?} activityType
|
|
1502
1562
|
* @param {?=} data
|
|
1503
1563
|
* @return {?}
|
|
1504
1564
|
*/
|
|
1505
1565
|
ActivityContainerComponent.prototype.startActivity = /**
|
|
1506
|
-
* @template
|
|
1566
|
+
* @template D1, R1, E1
|
|
1507
1567
|
* @param {?} activityType
|
|
1508
1568
|
* @param {?=} data
|
|
1509
1569
|
* @return {?}
|
|
@@ -1519,41 +1579,26 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1519
1579
|
*/
|
|
1520
1580
|
function (resolve, reject) {
|
|
1521
1581
|
/** @type {?} */
|
|
1522
|
-
var context = {
|
|
1523
|
-
interactionContext: self,
|
|
1524
|
-
activityClass: activityType,
|
|
1525
|
-
activityData: data,
|
|
1582
|
+
var context = new TabContext(data, activityType, self, {
|
|
1526
1583
|
onDone: (/**
|
|
1527
1584
|
* @param {?} result
|
|
1528
1585
|
* @return {?}
|
|
1529
1586
|
*/
|
|
1530
1587
|
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
1588
|
resolve(result);
|
|
1535
|
-
|
|
1536
|
-
* @return {?}
|
|
1537
|
-
*/
|
|
1538
|
-
function () { return self.animateTabs(); }));
|
|
1589
|
+
self.activityFinishedEvents.publish({});
|
|
1539
1590
|
}),
|
|
1540
1591
|
onCancel: (/**
|
|
1541
1592
|
* @param {?} error
|
|
1542
1593
|
* @return {?}
|
|
1543
1594
|
*/
|
|
1544
1595
|
function (error) {
|
|
1545
|
-
self.obsoleteTabs.push(context);
|
|
1546
|
-
// finished before we start an animations
|
|
1547
1596
|
reject(error);
|
|
1548
|
-
|
|
1549
|
-
setTimeout((/**
|
|
1550
|
-
* @return {?}
|
|
1551
|
-
*/
|
|
1552
|
-
function () { return self.animateTabs(); }));
|
|
1597
|
+
self.activityFinishedEvents.publish({});
|
|
1553
1598
|
})
|
|
1554
|
-
};
|
|
1555
|
-
self.
|
|
1556
|
-
self.tabs.selectedIndex = _this.
|
|
1599
|
+
});
|
|
1600
|
+
self.activityTabs.push(context);
|
|
1601
|
+
self.tabs.selectedIndex = _this.activityTabs.length;
|
|
1557
1602
|
}));
|
|
1558
1603
|
};
|
|
1559
1604
|
/**
|
|
@@ -1579,63 +1624,151 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1579
1624
|
return this.startActivity(ConfirmationDialogComponent, confirm);
|
|
1580
1625
|
};
|
|
1581
1626
|
/**
|
|
1582
|
-
* @template
|
|
1583
|
-
* @param {?} confirm
|
|
1584
|
-
* @param {?} activityType
|
|
1585
|
-
* @param {?=} data
|
|
1627
|
+
* @template D1, R1, E1
|
|
1628
|
+
* @param {?} confirm
|
|
1629
|
+
* @param {?} activityType
|
|
1630
|
+
* @param {?=} data
|
|
1631
|
+
* @return {?}
|
|
1632
|
+
*/
|
|
1633
|
+
ActivityContainerComponent.prototype.confirmThen = /**
|
|
1634
|
+
* @template D1, R1, E1
|
|
1635
|
+
* @param {?} confirm
|
|
1636
|
+
* @param {?} activityType
|
|
1637
|
+
* @param {?=} data
|
|
1638
|
+
* @return {?}
|
|
1639
|
+
*/
|
|
1640
|
+
function (confirm, activityType, data) {
|
|
1641
|
+
return this.startActivity(ConfirmThenDialogComponent, {
|
|
1642
|
+
confirm: confirm,
|
|
1643
|
+
activityType: activityType,
|
|
1644
|
+
data: data
|
|
1645
|
+
});
|
|
1646
|
+
};
|
|
1647
|
+
// @Trace()
|
|
1648
|
+
// @Trace()
|
|
1649
|
+
/**
|
|
1650
|
+
* @private
|
|
1651
|
+
* @return {?}
|
|
1652
|
+
*/
|
|
1653
|
+
ActivityContainerComponent.prototype.onActivityFinished =
|
|
1654
|
+
// @Trace()
|
|
1655
|
+
/**
|
|
1656
|
+
* @private
|
|
1657
|
+
* @return {?}
|
|
1658
|
+
*/
|
|
1659
|
+
function () {
|
|
1660
|
+
// don't do anything if job already queued up.
|
|
1661
|
+
if (!this.finished) {
|
|
1662
|
+
if (this.synchroniseSelectedTabIndex()) {
|
|
1663
|
+
this.cleanupStaleActivities();
|
|
1664
|
+
}
|
|
1665
|
+
this.updateActivityList();
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
// @Trace()
|
|
1669
|
+
// @Trace()
|
|
1670
|
+
/**
|
|
1671
|
+
* @private
|
|
1672
|
+
* @return {?}
|
|
1673
|
+
*/
|
|
1674
|
+
ActivityContainerComponent.prototype.cleanupStaleActivities =
|
|
1675
|
+
// @Trace()
|
|
1676
|
+
/**
|
|
1677
|
+
* @private
|
|
1678
|
+
* @return {?}
|
|
1679
|
+
*/
|
|
1680
|
+
function () {
|
|
1681
|
+
var _this = this;
|
|
1682
|
+
// clean up old tabs
|
|
1683
|
+
if (this.tabs.selectedIndex < this.activityTabs.length - 1) {
|
|
1684
|
+
this.activityTabs.runInTransaction((/**
|
|
1685
|
+
* @param {?} draft
|
|
1686
|
+
* @return {?}
|
|
1687
|
+
*/
|
|
1688
|
+
function (draft) {
|
|
1689
|
+
draft.value = draft.value.slice(0, 1 + _this.tabs.selectedIndex);
|
|
1690
|
+
}));
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
/**
|
|
1694
|
+
* Synchronises the selected tab index. Returns true if there was no change to the selected index.
|
|
1695
|
+
*/
|
|
1696
|
+
// @Trace()
|
|
1697
|
+
/**
|
|
1698
|
+
* Synchronises the selected tab index. Returns true if there was no change to the selected index.
|
|
1699
|
+
* @private
|
|
1700
|
+
* @return {?}
|
|
1701
|
+
*/
|
|
1702
|
+
// @Trace()
|
|
1703
|
+
ActivityContainerComponent.prototype.synchroniseSelectedTabIndex = /**
|
|
1704
|
+
* Synchronises the selected tab index. Returns true if there was no change to the selected index.
|
|
1705
|
+
* @private
|
|
1706
|
+
* @return {?}
|
|
1707
|
+
*/
|
|
1708
|
+
// @Trace()
|
|
1709
|
+
function () {
|
|
1710
|
+
/** @type {?} */
|
|
1711
|
+
var previousIndex = this.tabs.selectedIndex;
|
|
1712
|
+
/** @type {?} */
|
|
1713
|
+
var newIndex = this.activityTabs.query().findIndex((/**
|
|
1714
|
+
* @param {?} t
|
|
1715
|
+
* @return {?}
|
|
1716
|
+
*/
|
|
1717
|
+
function (t) { return t.isComplete(); })) - 1;
|
|
1718
|
+
this.tabs.selectedIndex = newIndex;
|
|
1719
|
+
return previousIndex === newIndex;
|
|
1720
|
+
};
|
|
1721
|
+
// @Trace()
|
|
1722
|
+
// @Trace()
|
|
1723
|
+
/**
|
|
1724
|
+
* @private
|
|
1586
1725
|
* @return {?}
|
|
1587
1726
|
*/
|
|
1588
|
-
ActivityContainerComponent.prototype.
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
* @
|
|
1592
|
-
* @param {?=} data
|
|
1727
|
+
ActivityContainerComponent.prototype.onAnimationFinished =
|
|
1728
|
+
// @Trace()
|
|
1729
|
+
/**
|
|
1730
|
+
* @private
|
|
1593
1731
|
* @return {?}
|
|
1594
1732
|
*/
|
|
1595
|
-
function (
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
data: data
|
|
1600
|
-
});
|
|
1733
|
+
function () {
|
|
1734
|
+
this.getSelectedOutlet().component.onActivityReady();
|
|
1735
|
+
this.cleanupStaleActivities();
|
|
1736
|
+
this.updateActivityList();
|
|
1601
1737
|
};
|
|
1602
1738
|
/**
|
|
1603
1739
|
* @private
|
|
1604
1740
|
* @return {?}
|
|
1605
1741
|
*/
|
|
1606
|
-
ActivityContainerComponent.prototype.
|
|
1742
|
+
ActivityContainerComponent.prototype.updateActivityList = /**
|
|
1607
1743
|
* @private
|
|
1608
1744
|
* @return {?}
|
|
1609
1745
|
*/
|
|
1610
1746
|
function () {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
* @param {?} tab
|
|
1747
|
+
this._activityList.value = this.activityTabs.value.filter((/**
|
|
1748
|
+
* @param {?} t
|
|
1614
1749
|
* @return {?}
|
|
1615
1750
|
*/
|
|
1616
|
-
function (
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1751
|
+
function (t) { return !t.isComplete() && t.isComponentRealised(); })).map((/**
|
|
1752
|
+
* @param {?} t
|
|
1753
|
+
* @return {?}
|
|
1754
|
+
*/
|
|
1755
|
+
function (t) { return t.component; }));
|
|
1621
1756
|
};
|
|
1622
1757
|
/**
|
|
1623
1758
|
* @private
|
|
1624
1759
|
* @return {?}
|
|
1625
1760
|
*/
|
|
1626
|
-
ActivityContainerComponent.prototype.
|
|
1761
|
+
ActivityContainerComponent.prototype.getSelectedOutlet = /**
|
|
1627
1762
|
* @private
|
|
1628
1763
|
* @return {?}
|
|
1629
1764
|
*/
|
|
1630
1765
|
function () {
|
|
1631
|
-
|
|
1632
|
-
this.tabs.selectedIndex = this.activityOutletTabs.length - this.obsoleteTabs.length;
|
|
1633
|
-
}
|
|
1766
|
+
return this.outlets.toArray()[this.tabs.selectedIndex];
|
|
1634
1767
|
};
|
|
1635
1768
|
ActivityContainerComponent.decorators = [
|
|
1636
1769
|
{ type: Component, args: [{
|
|
1637
1770
|
selector: 'angular-ui-powerups-activity-container',
|
|
1638
|
-
template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"true\">\n <mat-tab
|
|
1771
|
+
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
1772
|
styles: [":host{display:block}"]
|
|
1640
1773
|
}] }
|
|
1641
1774
|
];
|
|
@@ -1648,25 +1781,21 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1648
1781
|
outlets: [{ type: ViewChildren, args: [ActivityOutletComponent,] }]
|
|
1649
1782
|
};
|
|
1650
1783
|
return ActivityContainerComponent;
|
|
1651
|
-
}(
|
|
1784
|
+
}(InteractionContext));
|
|
1652
1785
|
if (false) {
|
|
1786
|
+
/**
|
|
1787
|
+
* @type {?}
|
|
1788
|
+
* @private
|
|
1789
|
+
*/
|
|
1790
|
+
ActivityContainerComponent.prototype.activityFinishedEvents;
|
|
1653
1791
|
/** @type {?} */
|
|
1654
1792
|
ActivityContainerComponent.prototype.parentInteractionContext;
|
|
1655
1793
|
/** @type {?} */
|
|
1656
|
-
ActivityContainerComponent.prototype.initialActivityOutletContext;
|
|
1657
|
-
/** @type {?} */
|
|
1658
|
-
ActivityContainerComponent.prototype.currentActivity;
|
|
1659
|
-
/** @type {?} */
|
|
1660
1794
|
ActivityContainerComponent.prototype.tabs;
|
|
1661
1795
|
/** @type {?} */
|
|
1662
1796
|
ActivityContainerComponent.prototype.outlets;
|
|
1663
1797
|
/** @type {?} */
|
|
1664
|
-
ActivityContainerComponent.prototype.
|
|
1665
|
-
/**
|
|
1666
|
-
* @type {?}
|
|
1667
|
-
* @private
|
|
1668
|
-
*/
|
|
1669
|
-
ActivityContainerComponent.prototype.obsoleteTabs;
|
|
1798
|
+
ActivityContainerComponent.prototype.activityTabs;
|
|
1670
1799
|
/**
|
|
1671
1800
|
* @type {?}
|
|
1672
1801
|
* @private
|
|
@@ -1678,24 +1807,6 @@ if (false) {
|
|
|
1678
1807
|
*/
|
|
1679
1808
|
ActivityContainerComponent.prototype._activityList;
|
|
1680
1809
|
}
|
|
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
1810
|
|
|
1700
1811
|
/**
|
|
1701
1812
|
* @fileoverview added by tsickle
|
|
@@ -1703,19 +1814,68 @@ if (false) {
|
|
|
1703
1814
|
*/
|
|
1704
1815
|
/** @type {?} */
|
|
1705
1816
|
var DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
|
|
1817
|
+
var Guard = /** @class */ (function (_super) {
|
|
1818
|
+
__extends(Guard, _super);
|
|
1819
|
+
function Guard() {
|
|
1820
|
+
return _super.call(this, { initialValue: false }) || this;
|
|
1821
|
+
}
|
|
1822
|
+
Object.defineProperty(Guard.prototype, "value", {
|
|
1823
|
+
get: /**
|
|
1824
|
+
* @return {?}
|
|
1825
|
+
*/
|
|
1826
|
+
function () {
|
|
1827
|
+
return this.store.read();
|
|
1828
|
+
},
|
|
1829
|
+
enumerable: true,
|
|
1830
|
+
configurable: true
|
|
1831
|
+
});
|
|
1832
|
+
/**
|
|
1833
|
+
* @template R
|
|
1834
|
+
* @param {?} fun
|
|
1835
|
+
* @return {?}
|
|
1836
|
+
*/
|
|
1837
|
+
Guard.prototype.whileTrue = /**
|
|
1838
|
+
* @template R
|
|
1839
|
+
* @param {?} fun
|
|
1840
|
+
* @return {?}
|
|
1841
|
+
*/
|
|
1842
|
+
function (fun) {
|
|
1843
|
+
this.startTransaction().commit(true);
|
|
1844
|
+
try {
|
|
1845
|
+
return fun();
|
|
1846
|
+
}
|
|
1847
|
+
finally {
|
|
1848
|
+
this.startTransaction().commit(false);
|
|
1849
|
+
}
|
|
1850
|
+
};
|
|
1851
|
+
/**
|
|
1852
|
+
* @template R
|
|
1853
|
+
* @param {?} fun
|
|
1854
|
+
* @param {?=} defaultValue
|
|
1855
|
+
* @return {?}
|
|
1856
|
+
*/
|
|
1857
|
+
Guard.prototype.runIfFalse = /**
|
|
1858
|
+
* @template R
|
|
1859
|
+
* @param {?} fun
|
|
1860
|
+
* @param {?=} defaultValue
|
|
1861
|
+
* @return {?}
|
|
1862
|
+
*/
|
|
1863
|
+
function (fun, defaultValue) {
|
|
1864
|
+
if (defaultValue === void 0) { defaultValue = null; }
|
|
1865
|
+
return !this.value ? fun() : defaultValue;
|
|
1866
|
+
};
|
|
1867
|
+
return Guard;
|
|
1868
|
+
}(ValueModel));
|
|
1706
1869
|
var DialogInteractionService = /** @class */ (function (_super) {
|
|
1707
1870
|
__extends(DialogInteractionService, _super);
|
|
1708
|
-
function DialogInteractionService(dialogService,
|
|
1871
|
+
function DialogInteractionService(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1709
1872
|
var _this = _super.call(this) || this;
|
|
1710
1873
|
_this.dialogService = dialogService;
|
|
1711
|
-
_this.router = router;
|
|
1712
1874
|
_this.dialogServiceDefaults = dialogServiceDefaults;
|
|
1713
1875
|
_this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
1714
1876
|
_this._activityList = new DelegatingListModel();
|
|
1715
|
-
_this.
|
|
1877
|
+
_this.startingGuard = new Guard();
|
|
1716
1878
|
assert$1.notNil(dialogService);
|
|
1717
|
-
var _a = Dsl.disposeWith(_this), chain = _a.chain, observe = _a.observe;
|
|
1718
|
-
_this.currentActivity = chain(_this.activityList).last();
|
|
1719
1879
|
return _this;
|
|
1720
1880
|
}
|
|
1721
1881
|
/**
|
|
@@ -1725,7 +1885,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1725
1885
|
* @return {?}
|
|
1726
1886
|
*/
|
|
1727
1887
|
function () {
|
|
1728
|
-
return this.
|
|
1888
|
+
return !!this.currentActivityId;
|
|
1729
1889
|
};
|
|
1730
1890
|
/**
|
|
1731
1891
|
* @return {?}
|
|
@@ -1734,7 +1894,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1734
1894
|
* @return {?}
|
|
1735
1895
|
*/
|
|
1736
1896
|
function () {
|
|
1737
|
-
this.currentActivity.
|
|
1897
|
+
this.currentActivity.cancel(null);
|
|
1738
1898
|
};
|
|
1739
1899
|
Object.defineProperty(DialogInteractionService.prototype, "activityList", {
|
|
1740
1900
|
get: /**
|
|
@@ -1787,56 +1947,59 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1787
1947
|
*/
|
|
1788
1948
|
function (a) { return a.constructor.name; })).join(', '));
|
|
1789
1949
|
}
|
|
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
|
|
1950
|
+
return this.startingGuard.whileTrue((/**
|
|
1804
1951
|
* @return {?}
|
|
1805
1952
|
*/
|
|
1806
|
-
function (
|
|
1953
|
+
function () {
|
|
1954
|
+
_this.currentActivityId = v1();
|
|
1807
1955
|
/** @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
|
-
}
|
|
1956
|
+
var self = _this;
|
|
1957
|
+
/** @type {?} */
|
|
1958
|
+
var config = __assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, _this.matDialogDefaultConfig, _this.dialogServiceDefaults, {
|
|
1959
|
+
data: data,
|
|
1960
|
+
disableClose: disableClose,
|
|
1961
|
+
panelClass: 'dialog-interaction-service'
|
|
1832
1962
|
});
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1963
|
+
/** @type {?} */
|
|
1964
|
+
var matDialogRef = (/** @type {?} */ (_this.dialogService.open(ActivityContainerComponent, config)));
|
|
1965
|
+
return new Promise((/**
|
|
1966
|
+
* @param {?} resolve
|
|
1967
|
+
* @param {?} reject
|
|
1968
|
+
* @return {?}
|
|
1969
|
+
*/
|
|
1970
|
+
function (resolve, reject) {
|
|
1971
|
+
/** @type {?} */
|
|
1972
|
+
var activityContainer = matDialogRef.componentInstance;
|
|
1973
|
+
activityContainer.parentInteractionContext = _this;
|
|
1974
|
+
self.safelyUpdateActivityListDelegate(activityContainer.activityList);
|
|
1975
|
+
activityContainer.initialActivityOutletContext = {
|
|
1976
|
+
activityClass: activityType,
|
|
1977
|
+
activityData: data,
|
|
1978
|
+
onDone: /**
|
|
1979
|
+
* @param {?} result
|
|
1980
|
+
* @return {?}
|
|
1981
|
+
*/
|
|
1982
|
+
function (result) {
|
|
1983
|
+
resolve(result);
|
|
1984
|
+
matDialogRef.close(result);
|
|
1985
|
+
},
|
|
1986
|
+
onCancel: /**
|
|
1987
|
+
* @param {?} error
|
|
1988
|
+
* @return {?}
|
|
1989
|
+
*/
|
|
1990
|
+
function (error) {
|
|
1991
|
+
reject(error);
|
|
1992
|
+
matDialogRef.close(error);
|
|
1993
|
+
}
|
|
1994
|
+
};
|
|
1995
|
+
matDialogRef.updateSize();
|
|
1996
|
+
})).finally((/**
|
|
1997
|
+
* @return {?}
|
|
1998
|
+
*/
|
|
1999
|
+
function () {
|
|
2000
|
+
_this.currentActivityId = null;
|
|
2001
|
+
self.safelyUpdateActivityListDelegate(null);
|
|
2002
|
+
}));
|
|
1840
2003
|
}));
|
|
1841
2004
|
};
|
|
1842
2005
|
/**
|
|
@@ -1911,16 +2074,13 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1911
2074
|
/** @nocollapse */
|
|
1912
2075
|
DialogInteractionService.ctorParameters = function () { return [
|
|
1913
2076
|
{ type: MatDialog },
|
|
1914
|
-
{ type: Router },
|
|
1915
2077
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
|
|
1916
2078
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
|
|
1917
2079
|
]; };
|
|
1918
|
-
/** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(
|
|
2080
|
+
/** @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
2081
|
return DialogInteractionService;
|
|
1920
2082
|
}(InteractionContext));
|
|
1921
2083
|
if (false) {
|
|
1922
|
-
/** @type {?} */
|
|
1923
|
-
DialogInteractionService.prototype.currentActivity;
|
|
1924
2084
|
/**
|
|
1925
2085
|
* @type {?}
|
|
1926
2086
|
* @private
|
|
@@ -1930,17 +2090,17 @@ if (false) {
|
|
|
1930
2090
|
* @type {?}
|
|
1931
2091
|
* @private
|
|
1932
2092
|
*/
|
|
1933
|
-
DialogInteractionService.prototype.
|
|
2093
|
+
DialogInteractionService.prototype.startingGuard;
|
|
1934
2094
|
/**
|
|
1935
2095
|
* @type {?}
|
|
1936
2096
|
* @private
|
|
1937
2097
|
*/
|
|
1938
|
-
DialogInteractionService.prototype.
|
|
2098
|
+
DialogInteractionService.prototype.currentActivityId;
|
|
1939
2099
|
/**
|
|
1940
2100
|
* @type {?}
|
|
1941
2101
|
* @private
|
|
1942
2102
|
*/
|
|
1943
|
-
DialogInteractionService.prototype.
|
|
2103
|
+
DialogInteractionService.prototype.dialogService;
|
|
1944
2104
|
/** @type {?} */
|
|
1945
2105
|
DialogInteractionService.prototype.dialogServiceDefaults;
|
|
1946
2106
|
/** @type {?} */
|
|
@@ -2530,10 +2690,92 @@ if (false) {
|
|
|
2530
2690
|
* @fileoverview added by tsickle
|
|
2531
2691
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2532
2692
|
*/
|
|
2693
|
+
var NavigationSession = /** @class */ (function () {
|
|
2694
|
+
function NavigationSession(isPopState, initialUrl) {
|
|
2695
|
+
this.isPopState = isPopState;
|
|
2696
|
+
this.initialUrl = initialUrl;
|
|
2697
|
+
this._alreadyAccepted = [];
|
|
2698
|
+
console.log('NavigationSession', { isPopState: isPopState, initialUrl: initialUrl });
|
|
2699
|
+
}
|
|
2700
|
+
/**
|
|
2701
|
+
* @param {?} placeComponent
|
|
2702
|
+
* @return {?}
|
|
2703
|
+
*/
|
|
2704
|
+
NavigationSession.prototype.alreadyAccepted = /**
|
|
2705
|
+
* @param {?} placeComponent
|
|
2706
|
+
* @return {?}
|
|
2707
|
+
*/
|
|
2708
|
+
function (placeComponent) {
|
|
2709
|
+
return this._alreadyAccepted.includes(placeComponent);
|
|
2710
|
+
};
|
|
2711
|
+
/**
|
|
2712
|
+
* @param {?} component
|
|
2713
|
+
* @return {?}
|
|
2714
|
+
*/
|
|
2715
|
+
NavigationSession.prototype.rememberAcceptanceOf = /**
|
|
2716
|
+
* @param {?} component
|
|
2717
|
+
* @return {?}
|
|
2718
|
+
*/
|
|
2719
|
+
function (component) {
|
|
2720
|
+
this._alreadyAccepted.push(component);
|
|
2721
|
+
};
|
|
2722
|
+
return NavigationSession;
|
|
2723
|
+
}());
|
|
2724
|
+
if (false) {
|
|
2725
|
+
/**
|
|
2726
|
+
* @type {?}
|
|
2727
|
+
* @private
|
|
2728
|
+
*/
|
|
2729
|
+
NavigationSession.prototype._alreadyAccepted;
|
|
2730
|
+
/** @type {?} */
|
|
2731
|
+
NavigationSession.prototype.isPopState;
|
|
2732
|
+
/** @type {?} */
|
|
2733
|
+
NavigationSession.prototype.initialUrl;
|
|
2734
|
+
}
|
|
2533
2735
|
var PlaceRouter = /** @class */ (function () {
|
|
2534
|
-
function PlaceRouter(router) {
|
|
2736
|
+
function PlaceRouter(router, angularLocation) {
|
|
2737
|
+
var _this = this;
|
|
2535
2738
|
this.router = router;
|
|
2739
|
+
this._navigationSession = new MutableValueModel();
|
|
2740
|
+
angularLocation.onUrlChange((/**
|
|
2741
|
+
* @param {?} url
|
|
2742
|
+
* @return {?}
|
|
2743
|
+
*/
|
|
2744
|
+
function (url) {
|
|
2745
|
+
console.log("### " + url);
|
|
2746
|
+
}));
|
|
2747
|
+
this.router.events.subscribe((/**
|
|
2748
|
+
* @param {?} event
|
|
2749
|
+
* @return {?}
|
|
2750
|
+
*/
|
|
2751
|
+
function (event) {
|
|
2752
|
+
// console.log(`${event.constructor.name}`, location.pathname, angularLocation.getState());
|
|
2753
|
+
// NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
|
|
2754
|
+
// NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
|
|
2755
|
+
// NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
|
|
2756
|
+
if (event instanceof NavigationStart && !_this.navigationSession) {
|
|
2757
|
+
_this._navigationSession.value = new NavigationSession(event.navigationTrigger === 'popstate', _this.router.routerState.snapshot.url);
|
|
2758
|
+
}
|
|
2759
|
+
if (event instanceof NavigationEnd) {
|
|
2760
|
+
console.log('navigation ended');
|
|
2761
|
+
_this._navigationSession.value = null;
|
|
2762
|
+
}
|
|
2763
|
+
if (event instanceof NavigationError) {
|
|
2764
|
+
console.log('navigation errored');
|
|
2765
|
+
_this._navigationSession.value = null;
|
|
2766
|
+
}
|
|
2767
|
+
}));
|
|
2536
2768
|
}
|
|
2769
|
+
Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
|
|
2770
|
+
get: /**
|
|
2771
|
+
* @return {?}
|
|
2772
|
+
*/
|
|
2773
|
+
function () {
|
|
2774
|
+
return this._navigationSession.value;
|
|
2775
|
+
},
|
|
2776
|
+
enumerable: true,
|
|
2777
|
+
configurable: true
|
|
2778
|
+
});
|
|
2537
2779
|
/**
|
|
2538
2780
|
* @param {?} activatedRoute
|
|
2539
2781
|
* @param {?} previous
|
|
@@ -2576,7 +2818,6 @@ var PlaceRouter = /** @class */ (function () {
|
|
|
2576
2818
|
var commands = (weHaveARouteId) ?
|
|
2577
2819
|
[urlSegments[0].path, sanitised.getFormattedRouteId(), sanitised.getFormattedParameters()] :
|
|
2578
2820
|
[urlSegments[0].path, sanitised.getFormattedParameters()];
|
|
2579
|
-
console.log("redirect path", commands);
|
|
2580
2821
|
return this.router.createUrlTree(commands);
|
|
2581
2822
|
};
|
|
2582
2823
|
/**
|
|
@@ -2620,12 +2861,18 @@ var PlaceRouter = /** @class */ (function () {
|
|
|
2620
2861
|
];
|
|
2621
2862
|
/** @nocollapse */
|
|
2622
2863
|
PlaceRouter.ctorParameters = function () { return [
|
|
2623
|
-
{ type: Router }
|
|
2864
|
+
{ type: Router },
|
|
2865
|
+
{ type: Location }
|
|
2624
2866
|
]; };
|
|
2625
|
-
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router)); }, token: PlaceRouter, providedIn: "root" });
|
|
2867
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location)); }, token: PlaceRouter, providedIn: "root" });
|
|
2626
2868
|
return PlaceRouter;
|
|
2627
2869
|
}());
|
|
2628
2870
|
if (false) {
|
|
2871
|
+
/**
|
|
2872
|
+
* @type {?}
|
|
2873
|
+
* @private
|
|
2874
|
+
*/
|
|
2875
|
+
PlaceRouter.prototype._navigationSession;
|
|
2629
2876
|
/**
|
|
2630
2877
|
* @type {?}
|
|
2631
2878
|
* @private
|
|
@@ -3705,8 +3952,8 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
|
|
|
3705
3952
|
_this.placeHistory = placeHistory;
|
|
3706
3953
|
_this.animate = true;
|
|
3707
3954
|
_this._activePlace = new MutableValueModel();
|
|
3708
|
-
_this._incomingRouteChange = new Guard();
|
|
3709
|
-
_this._inOutletUpdate = new Guard();
|
|
3955
|
+
_this._incomingRouteChange = new Guard$1();
|
|
3956
|
+
_this._inOutletUpdate = new Guard$1();
|
|
3710
3957
|
_this._activatedRouteModel = new MutableValueModel();
|
|
3711
3958
|
_this._placeDefinition = new MutableValueModel();
|
|
3712
3959
|
_this._resolvedParameters = new MutableValueModel();
|
|
@@ -4409,16 +4656,15 @@ function Result() { }
|
|
|
4409
4656
|
*/
|
|
4410
4657
|
function ActivityOutletContext() { }
|
|
4411
4658
|
if (false) {
|
|
4412
|
-
/** @type {?} */
|
|
4413
|
-
ActivityOutletContext.prototype.interactionContext;
|
|
4414
4659
|
/** @type {?} */
|
|
4415
4660
|
ActivityOutletContext.prototype.activityClass;
|
|
4416
4661
|
/** @type {?} */
|
|
4417
4662
|
ActivityOutletContext.prototype.activityData;
|
|
4418
|
-
/**
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4663
|
+
/**
|
|
4664
|
+
* @param {?} component
|
|
4665
|
+
* @return {?}
|
|
4666
|
+
*/
|
|
4667
|
+
ActivityOutletContext.prototype.componentReady = function (component) { };
|
|
4422
4668
|
}
|
|
4423
4669
|
|
|
4424
4670
|
/**
|
|
@@ -4581,33 +4827,12 @@ if (false) {
|
|
|
4581
4827
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4582
4828
|
*/
|
|
4583
4829
|
var LeavePlaceGuard = /** @class */ (function () {
|
|
4584
|
-
function LeavePlaceGuard(router, injector, interactionContext,
|
|
4830
|
+
function LeavePlaceGuard(router, injector, placeRouter, interactionContext, angularLocation) {
|
|
4585
4831
|
this.router = router;
|
|
4586
4832
|
this.injector = injector;
|
|
4833
|
+
this.placeRouter = placeRouter;
|
|
4587
4834
|
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
|
-
}));
|
|
4835
|
+
this.angularLocation = angularLocation;
|
|
4611
4836
|
}
|
|
4612
4837
|
/**
|
|
4613
4838
|
* @param {?} component
|
|
@@ -4624,105 +4849,45 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4624
4849
|
* @return {?}
|
|
4625
4850
|
*/
|
|
4626
4851
|
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;
|
|
4852
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4853
|
+
var placeDefinitionPath, self_1, canLeave;
|
|
4854
|
+
return __generator(this, function (_a) {
|
|
4855
|
+
switch (_a.label) {
|
|
4856
|
+
case 0:
|
|
4857
|
+
placeDefinitionPath = "/" + component.placeDefinition.path;
|
|
4858
|
+
if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
|
|
4859
|
+
return [2 /*return*/, true];
|
|
4860
|
+
case 1:
|
|
4861
|
+
if (!!nextState.url.startsWith(placeDefinitionPath)) return [3 /*break*/, 3];
|
|
4862
|
+
self_1 = this;
|
|
4863
|
+
return [4 /*yield*/, component.canDeactivate()];
|
|
4864
|
+
case 2:
|
|
4865
|
+
canLeave = _a.sent();
|
|
4866
|
+
// component is happy to leave but we need to check if it's left an interaction
|
|
4867
|
+
// open. If so we close and stay where we are.
|
|
4868
|
+
if (canLeave && this.interactionContext.isActive()) {
|
|
4869
|
+
canLeave = false;
|
|
4870
|
+
console.log("cancelling", { activity: this.interactionContext.currentActivity });
|
|
4871
|
+
this.interactionContext.currentActivity.cancel(null);
|
|
4872
|
+
}
|
|
4873
|
+
// If we're still leaving then remember it since angular will call this method multiple
|
|
4874
|
+
// times if any route parameters are changed along the way.
|
|
4875
|
+
if (canLeave) {
|
|
4876
|
+
self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
|
|
4697
4877
|
}
|
|
4698
4878
|
else {
|
|
4699
|
-
|
|
4879
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4880
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4881
|
+
if (this.placeRouter.navigationSession.isPopState) {
|
|
4882
|
+
console.log('cancelled during popstate');
|
|
4883
|
+
this.angularLocation.go(this.placeRouter.navigationSession.initialUrl);
|
|
4884
|
+
}
|
|
4700
4885
|
}
|
|
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);
|
|
4886
|
+
return [2 /*return*/, canLeave];
|
|
4887
|
+
case 3: return [2 /*return*/, true];
|
|
4888
|
+
}
|
|
4889
|
+
});
|
|
4890
|
+
});
|
|
4726
4891
|
};
|
|
4727
4892
|
LeavePlaceGuard.decorators = [
|
|
4728
4893
|
{ type: Injectable, args: [{
|
|
@@ -4733,16 +4898,11 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4733
4898
|
LeavePlaceGuard.ctorParameters = function () { return [
|
|
4734
4899
|
{ type: Router },
|
|
4735
4900
|
{ type: Injector },
|
|
4901
|
+
{ type: PlaceRouter },
|
|
4736
4902
|
{ type: InteractionContext },
|
|
4737
4903
|
{ type: Location }
|
|
4738
4904
|
]; };
|
|
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);
|
|
4905
|
+
/** @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
4906
|
return LeavePlaceGuard;
|
|
4747
4907
|
}());
|
|
4748
4908
|
if (false) {
|
|
@@ -4750,21 +4910,21 @@ if (false) {
|
|
|
4750
4910
|
* @type {?}
|
|
4751
4911
|
* @private
|
|
4752
4912
|
*/
|
|
4753
|
-
LeavePlaceGuard.prototype.
|
|
4913
|
+
LeavePlaceGuard.prototype.router;
|
|
4754
4914
|
/**
|
|
4755
4915
|
* @type {?}
|
|
4756
4916
|
* @private
|
|
4757
4917
|
*/
|
|
4758
|
-
LeavePlaceGuard.prototype.
|
|
4918
|
+
LeavePlaceGuard.prototype.injector;
|
|
4759
4919
|
/**
|
|
4760
4920
|
* @type {?}
|
|
4761
4921
|
* @private
|
|
4762
4922
|
*/
|
|
4763
|
-
LeavePlaceGuard.prototype.
|
|
4923
|
+
LeavePlaceGuard.prototype.placeRouter;
|
|
4764
4924
|
/** @type {?} */
|
|
4765
4925
|
LeavePlaceGuard.prototype.interactionContext;
|
|
4766
4926
|
/** @type {?} */
|
|
4767
|
-
LeavePlaceGuard.prototype.
|
|
4927
|
+
LeavePlaceGuard.prototype.angularLocation;
|
|
4768
4928
|
}
|
|
4769
4929
|
|
|
4770
4930
|
/**
|
|
@@ -5073,5 +5233,5 @@ var ParameterType;
|
|
|
5073
5233
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5074
5234
|
*/
|
|
5075
5235
|
|
|
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,
|
|
5236
|
+
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
5237
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|