@coolon/angular-ui-powerups 0.0.62 → 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 +738 -582
- 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 +15 -10
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +99 -86
- package/esm2015/lib/place/guards/leave-place.guard.js +95 -115
- 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 +24 -21
- package/esm5/lib/interaction/services/dialog-interaction.service.js +120 -85
- package/esm5/lib/place/guards/leave-place.guard.js +53 -123
- package/esm5/lib/place/place-router.js +96 -6
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +591 -449
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +711 -556
- 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 +7 -7
- package/lib/interaction/services/dialog-interaction.service.d.ts +5 -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,35 +808,37 @@ InteractionContext = /** @class */ (function (_super) {
|
|
|
807
808
|
function InteractionContext() {
|
|
808
809
|
return _super.call(this) || this;
|
|
809
810
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
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
|
+
});
|
|
824
827
|
return InteractionContext;
|
|
825
828
|
}(GarbageCollector));
|
|
826
829
|
if (false) {
|
|
827
|
-
/**
|
|
828
|
-
* Returns the activity that is currently active.
|
|
829
|
-
* This model is only updated in the next tick after the view has been updated.
|
|
830
|
-
* @type {?}
|
|
831
|
-
*/
|
|
832
|
-
InteractionContext.prototype.currentActivity;
|
|
833
830
|
/**
|
|
834
831
|
* Returns the current list of activities that are in progress.
|
|
835
832
|
* This model is only updated in the next tick after the view has been updated.
|
|
836
833
|
* @type {?}
|
|
837
834
|
*/
|
|
838
835
|
InteractionContext.prototype.activityList;
|
|
836
|
+
/**
|
|
837
|
+
* Returns true if an activity is currently running.
|
|
838
|
+
* @abstract
|
|
839
|
+
* @return {?}
|
|
840
|
+
*/
|
|
841
|
+
InteractionContext.prototype.isActive = function () { };
|
|
839
842
|
/**
|
|
840
843
|
* @abstract
|
|
841
844
|
* @template D, R, E
|
|
@@ -875,29 +878,121 @@ if (false) {
|
|
|
875
878
|
/** @type {?} */
|
|
876
879
|
var ACTIVITY_DATA = new InjectionToken('InteractionActivityData');
|
|
877
880
|
/**
|
|
878
|
-
* @
|
|
881
|
+
* @abstract
|
|
879
882
|
* @template D, R, E
|
|
880
883
|
*/
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
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
|
+
}
|
|
885
892
|
/**
|
|
886
893
|
* @param {?} activityContext
|
|
887
894
|
* @return {?}
|
|
888
895
|
*/
|
|
889
|
-
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
|
+
};
|
|
904
|
+
/**
|
|
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
|
+
};
|
|
890
915
|
/**
|
|
891
|
-
* @param {
|
|
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
|
|
892
950
|
* @return {?}
|
|
893
951
|
*/
|
|
894
|
-
Activity.prototype.
|
|
952
|
+
Activity.prototype.busyWhile = /**
|
|
953
|
+
* @param {?} busyModel
|
|
954
|
+
* @return {?}
|
|
955
|
+
*/
|
|
956
|
+
function (busyModel) {
|
|
957
|
+
this._busyModel.setDelegate(busyModel);
|
|
958
|
+
};
|
|
895
959
|
/**
|
|
896
|
-
* @param {?} e
|
|
897
960
|
* @return {?}
|
|
898
961
|
*/
|
|
899
|
-
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;
|
|
900
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 = {}));
|
|
901
996
|
|
|
902
997
|
/**
|
|
903
998
|
* @fileoverview added by tsickle
|
|
@@ -918,11 +1013,19 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
918
1013
|
this.injector = injector;
|
|
919
1014
|
}
|
|
920
1015
|
Object.defineProperty(ActivityOutletComponent.prototype, "activityContext", {
|
|
1016
|
+
get: /**
|
|
1017
|
+
* @return {?}
|
|
1018
|
+
*/
|
|
1019
|
+
function () {
|
|
1020
|
+
return this._activityContext;
|
|
1021
|
+
},
|
|
921
1022
|
set: /**
|
|
922
1023
|
* @param {?} activityContext
|
|
923
1024
|
* @return {?}
|
|
924
1025
|
*/
|
|
925
1026
|
function (activityContext) {
|
|
1027
|
+
assert.isNil(this._activityContext);
|
|
1028
|
+
this._activityContext = activityContext;
|
|
926
1029
|
this.loadActivity(activityContext);
|
|
927
1030
|
},
|
|
928
1031
|
enumerable: true,
|
|
@@ -951,7 +1054,7 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
951
1054
|
providers: [
|
|
952
1055
|
{
|
|
953
1056
|
provide: InteractionContext,
|
|
954
|
-
useValue: this
|
|
1057
|
+
useValue: this.interactionContext
|
|
955
1058
|
},
|
|
956
1059
|
{ provide: ACTIVITY_DATA, useValue: activityContext.activityData }
|
|
957
1060
|
],
|
|
@@ -962,6 +1065,9 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
962
1065
|
this.viewContainerRef.clear();
|
|
963
1066
|
this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
|
|
964
1067
|
this.activityComponentRef.instance.initialise(activityContext);
|
|
1068
|
+
if (this.activityContext.componentReady) {
|
|
1069
|
+
this.activityContext.componentReady(this.component);
|
|
1070
|
+
}
|
|
965
1071
|
};
|
|
966
1072
|
Object.defineProperty(ActivityOutletComponent.prototype, "component", {
|
|
967
1073
|
get: /**
|
|
@@ -973,71 +1079,6 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
973
1079
|
enumerable: true,
|
|
974
1080
|
configurable: true
|
|
975
1081
|
});
|
|
976
|
-
/**
|
|
977
|
-
* @param {?} alert
|
|
978
|
-
* @return {?}
|
|
979
|
-
*/
|
|
980
|
-
ActivityOutletComponent.prototype.alert = /**
|
|
981
|
-
* @param {?} alert
|
|
982
|
-
* @return {?}
|
|
983
|
-
*/
|
|
984
|
-
function (alert) {
|
|
985
|
-
return this.interactionContext.alert(alert);
|
|
986
|
-
};
|
|
987
|
-
/**
|
|
988
|
-
* @param {?} confirm
|
|
989
|
-
* @return {?}
|
|
990
|
-
*/
|
|
991
|
-
ActivityOutletComponent.prototype.confirm = /**
|
|
992
|
-
* @param {?} confirm
|
|
993
|
-
* @return {?}
|
|
994
|
-
*/
|
|
995
|
-
function (confirm) {
|
|
996
|
-
return this.interactionContext.confirm(confirm);
|
|
997
|
-
};
|
|
998
|
-
/**
|
|
999
|
-
* @template D1, R1, E1
|
|
1000
|
-
* @param {?} confirm
|
|
1001
|
-
* @param {?} activityType
|
|
1002
|
-
* @param {?=} data
|
|
1003
|
-
* @return {?}
|
|
1004
|
-
*/
|
|
1005
|
-
ActivityOutletComponent.prototype.confirmThen = /**
|
|
1006
|
-
* @template D1, R1, E1
|
|
1007
|
-
* @param {?} confirm
|
|
1008
|
-
* @param {?} activityType
|
|
1009
|
-
* @param {?=} data
|
|
1010
|
-
* @return {?}
|
|
1011
|
-
*/
|
|
1012
|
-
function (confirm, activityType, data) {
|
|
1013
|
-
return this.interactionContext.confirmThen(confirm, activityType, data);
|
|
1014
|
-
};
|
|
1015
|
-
/**
|
|
1016
|
-
* @template D1, R1, E1
|
|
1017
|
-
* @param {?} activityType
|
|
1018
|
-
* @param {?=} data
|
|
1019
|
-
* @return {?}
|
|
1020
|
-
*/
|
|
1021
|
-
ActivityOutletComponent.prototype.startActivity = /**
|
|
1022
|
-
* @template D1, R1, E1
|
|
1023
|
-
* @param {?} activityType
|
|
1024
|
-
* @param {?=} data
|
|
1025
|
-
* @return {?}
|
|
1026
|
-
*/
|
|
1027
|
-
function (activityType, data) {
|
|
1028
|
-
return this.interactionContext.startActivity(activityType, data);
|
|
1029
|
-
};
|
|
1030
|
-
/**
|
|
1031
|
-
* @return {?}
|
|
1032
|
-
*/
|
|
1033
|
-
ActivityOutletComponent.prototype.notifyReady = /**
|
|
1034
|
-
* @return {?}
|
|
1035
|
-
*/
|
|
1036
|
-
function () {
|
|
1037
|
-
if (this.activityComponentRef.instance['onActivityReady']) {
|
|
1038
|
-
this.activityComponentRef.instance['onActivityReady']();
|
|
1039
|
-
}
|
|
1040
|
-
};
|
|
1041
1082
|
ActivityOutletComponent.decorators = [
|
|
1042
1083
|
{ type: Component, args: [{
|
|
1043
1084
|
selector: 'angular-ui-powerups-activity-outlet',
|
|
@@ -1060,6 +1101,11 @@ var ActivityOutletComponent = /** @class */ (function () {
|
|
|
1060
1101
|
if (false) {
|
|
1061
1102
|
/** @type {?} */
|
|
1062
1103
|
ActivityOutletComponent.prototype.interactionContext;
|
|
1104
|
+
/**
|
|
1105
|
+
* @type {?}
|
|
1106
|
+
* @private
|
|
1107
|
+
*/
|
|
1108
|
+
ActivityOutletComponent.prototype._activityContext;
|
|
1063
1109
|
/**
|
|
1064
1110
|
* @type {?}
|
|
1065
1111
|
* @private
|
|
@@ -1088,108 +1134,22 @@ if (false) {
|
|
|
1088
1134
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1089
1135
|
*/
|
|
1090
1136
|
/**
|
|
1137
|
+
* Deprecated. You can now extend the Activity class directly.
|
|
1138
|
+
* @abstract
|
|
1091
1139
|
* @template D, R, E
|
|
1092
1140
|
*/
|
|
1093
1141
|
var /**
|
|
1142
|
+
* Deprecated. You can now extend the Activity class directly.
|
|
1143
|
+
* @abstract
|
|
1094
1144
|
* @template D, R, E
|
|
1095
1145
|
*/
|
|
1096
1146
|
AbstractActivity = /** @class */ (function (_super) {
|
|
1097
1147
|
__extends(AbstractActivity, _super);
|
|
1098
1148
|
function AbstractActivity() {
|
|
1099
|
-
|
|
1100
|
-
_this._busyModel = new DelegatingValueModel().withDefault(false);
|
|
1101
|
-
return _this;
|
|
1149
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1102
1150
|
}
|
|
1103
|
-
/**
|
|
1104
|
-
* @param {?} activityContext
|
|
1105
|
-
* @return {?}
|
|
1106
|
-
*/
|
|
1107
|
-
AbstractActivity.prototype.initialise = /**
|
|
1108
|
-
* @param {?} activityContext
|
|
1109
|
-
* @return {?}
|
|
1110
|
-
*/
|
|
1111
|
-
function (activityContext) {
|
|
1112
|
-
assert$1.isNil(this.activityContext);
|
|
1113
|
-
this.activityContext = activityContext;
|
|
1114
|
-
};
|
|
1115
|
-
/**
|
|
1116
|
-
* @param {?=} result
|
|
1117
|
-
* @return {?}
|
|
1118
|
-
*/
|
|
1119
|
-
AbstractActivity.prototype.done = /**
|
|
1120
|
-
* @param {?=} result
|
|
1121
|
-
* @return {?}
|
|
1122
|
-
*/
|
|
1123
|
-
function (result) {
|
|
1124
|
-
return this.activityContext.onDone(result);
|
|
1125
|
-
};
|
|
1126
|
-
/**
|
|
1127
|
-
* @param {?=} error
|
|
1128
|
-
* @return {?}
|
|
1129
|
-
*/
|
|
1130
|
-
AbstractActivity.prototype.cancel = /**
|
|
1131
|
-
* @param {?=} error
|
|
1132
|
-
* @return {?}
|
|
1133
|
-
*/
|
|
1134
|
-
function (error) {
|
|
1135
|
-
this.activityContext.onCancel(error);
|
|
1136
|
-
};
|
|
1137
|
-
// @Trace()
|
|
1138
|
-
// @Trace()
|
|
1139
|
-
/**
|
|
1140
|
-
* @return {?}
|
|
1141
|
-
*/
|
|
1142
|
-
AbstractActivity.prototype.onActivityReady =
|
|
1143
|
-
// @Trace()
|
|
1144
|
-
/**
|
|
1145
|
-
* @return {?}
|
|
1146
|
-
*/
|
|
1147
|
-
function () {
|
|
1148
|
-
};
|
|
1149
|
-
Object.defineProperty(AbstractActivity.prototype, "busy", {
|
|
1150
|
-
get: /**
|
|
1151
|
-
* @return {?}
|
|
1152
|
-
*/
|
|
1153
|
-
function () {
|
|
1154
|
-
return this._busyModel.readonly;
|
|
1155
|
-
},
|
|
1156
|
-
enumerable: true,
|
|
1157
|
-
configurable: true
|
|
1158
|
-
});
|
|
1159
|
-
/**
|
|
1160
|
-
* @param {?} busyModel
|
|
1161
|
-
* @return {?}
|
|
1162
|
-
*/
|
|
1163
|
-
AbstractActivity.prototype.busyWhile = /**
|
|
1164
|
-
* @param {?} busyModel
|
|
1165
|
-
* @return {?}
|
|
1166
|
-
*/
|
|
1167
|
-
function (busyModel) {
|
|
1168
|
-
this._busyModel.setDelegate(busyModel);
|
|
1169
|
-
};
|
|
1170
|
-
/**
|
|
1171
|
-
* @return {?}
|
|
1172
|
-
*/
|
|
1173
|
-
AbstractActivity.prototype.isBusy = /**
|
|
1174
|
-
* @return {?}
|
|
1175
|
-
*/
|
|
1176
|
-
function () {
|
|
1177
|
-
return this._busyModel.value;
|
|
1178
|
-
};
|
|
1179
1151
|
return AbstractActivity;
|
|
1180
|
-
}(
|
|
1181
|
-
if (false) {
|
|
1182
|
-
/**
|
|
1183
|
-
* @type {?}
|
|
1184
|
-
* @private
|
|
1185
|
-
*/
|
|
1186
|
-
AbstractActivity.prototype._busyModel;
|
|
1187
|
-
/**
|
|
1188
|
-
* @type {?}
|
|
1189
|
-
* @private
|
|
1190
|
-
*/
|
|
1191
|
-
AbstractActivity.prototype.activityContext;
|
|
1192
|
-
}
|
|
1152
|
+
}(Activity));
|
|
1193
1153
|
|
|
1194
1154
|
/**
|
|
1195
1155
|
* @fileoverview added by tsickle
|
|
@@ -1379,16 +1339,174 @@ if (false) {
|
|
|
1379
1339
|
* @fileoverview added by tsickle
|
|
1380
1340
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1381
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
|
+
*/
|
|
1382
1459
|
var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
1383
1460
|
__extends(ActivityContainerComponent, _super);
|
|
1384
1461
|
function ActivityContainerComponent() {
|
|
1385
1462
|
var _this = _super.call(this) || this;
|
|
1386
|
-
_this.
|
|
1387
|
-
_this.
|
|
1463
|
+
_this.activityFinishedEvents = new MutableStream();
|
|
1464
|
+
_this.activityTabs = new MutableListModel();
|
|
1388
1465
|
_this.finished = false;
|
|
1389
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(); }));
|
|
1390
1472
|
return _this;
|
|
1391
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
|
+
});
|
|
1392
1510
|
/**
|
|
1393
1511
|
* @return {?}
|
|
1394
1512
|
*/
|
|
@@ -1424,94 +1542,28 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1424
1542
|
*/
|
|
1425
1543
|
function () {
|
|
1426
1544
|
var _this = this;
|
|
1427
|
-
var
|
|
1428
|
-
|
|
1429
|
-
* @param {?} c
|
|
1545
|
+
var _a = Dsl.disposeWith(this), chain = _a.chain, observe = _a.observe;
|
|
1546
|
+
observe.valuesFrom(this.outlets.changes).subscribe((/**
|
|
1430
1547
|
* @return {?}
|
|
1431
1548
|
*/
|
|
1432
|
-
function (
|
|
1433
|
-
observe.valuesFrom(this.outlets.changes).subscribe((/**
|
|
1434
|
-
* @param {?} change
|
|
1549
|
+
function () { return setTimeout((/**
|
|
1435
1550
|
* @return {?}
|
|
1436
1551
|
*/
|
|
1437
|
-
function (
|
|
1438
|
-
_this.safelyUpdateActivityList(change.map((/**
|
|
1439
|
-
* @param {?} c
|
|
1440
|
-
* @return {?}
|
|
1441
|
-
*/
|
|
1442
|
-
function (c) { return c.component; })));
|
|
1443
|
-
}));
|
|
1552
|
+
function () { return _this.updateActivityList(); })); }));
|
|
1444
1553
|
observe.valuesFrom(this.tabs.animationDone).subscribe((/**
|
|
1445
1554
|
* @return {?}
|
|
1446
1555
|
*/
|
|
1447
1556
|
function () { return _this.onAnimationFinished(); }));
|
|
1557
|
+
this.updateActivityList();
|
|
1448
1558
|
};
|
|
1449
1559
|
/**
|
|
1450
|
-
*
|
|
1451
|
-
* @param activities
|
|
1452
|
-
*/
|
|
1453
|
-
/**
|
|
1454
|
-
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1455
|
-
* @private
|
|
1456
|
-
* @param {?} activities
|
|
1457
|
-
* @return {?}
|
|
1458
|
-
*/
|
|
1459
|
-
ActivityContainerComponent.prototype.safelyUpdateActivityList = /**
|
|
1460
|
-
* Update in the next tick to avoid changing state in the current change detection cycle.
|
|
1461
|
-
* @private
|
|
1462
|
-
* @param {?} activities
|
|
1463
|
-
* @return {?}
|
|
1464
|
-
*/
|
|
1465
|
-
function (activities) {
|
|
1466
|
-
var _this = this;
|
|
1467
|
-
setTimeout((/**
|
|
1468
|
-
* @return {?}
|
|
1469
|
-
*/
|
|
1470
|
-
function () { return _this._activityList.value = activities; }));
|
|
1471
|
-
};
|
|
1472
|
-
/**
|
|
1473
|
-
* @template D, R, E
|
|
1474
|
-
* @param {?} initialContext
|
|
1475
|
-
* @return {?}
|
|
1476
|
-
*/
|
|
1477
|
-
ActivityContainerComponent.prototype.initialise = /**
|
|
1478
|
-
* @template D, R, E
|
|
1479
|
-
* @param {?} initialContext
|
|
1480
|
-
* @return {?}
|
|
1481
|
-
*/
|
|
1482
|
-
function (initialContext) {
|
|
1483
|
-
/** @type {?} */
|
|
1484
|
-
var self = this;
|
|
1485
|
-
this.initialActivityOutletContext = {
|
|
1486
|
-
activityClass: initialContext.activityClass,
|
|
1487
|
-
activityData: initialContext.activityData,
|
|
1488
|
-
onDone: (/**
|
|
1489
|
-
* @param {?} result
|
|
1490
|
-
* @return {?}
|
|
1491
|
-
*/
|
|
1492
|
-
function (result) {
|
|
1493
|
-
self.finished = true;
|
|
1494
|
-
return initialContext.onDone(result);
|
|
1495
|
-
}),
|
|
1496
|
-
onCancel: (/**
|
|
1497
|
-
* @param {?} error
|
|
1498
|
-
* @return {?}
|
|
1499
|
-
*/
|
|
1500
|
-
function (error) {
|
|
1501
|
-
self.finished = true;
|
|
1502
|
-
return initialContext.onCancel(error);
|
|
1503
|
-
}),
|
|
1504
|
-
interactionContext: this
|
|
1505
|
-
};
|
|
1506
|
-
};
|
|
1507
|
-
/**
|
|
1508
|
-
* @template D, R, E
|
|
1560
|
+
* @template D1, R1, E1
|
|
1509
1561
|
* @param {?} activityType
|
|
1510
1562
|
* @param {?=} data
|
|
1511
1563
|
* @return {?}
|
|
1512
1564
|
*/
|
|
1513
1565
|
ActivityContainerComponent.prototype.startActivity = /**
|
|
1514
|
-
* @template
|
|
1566
|
+
* @template D1, R1, E1
|
|
1515
1567
|
* @param {?} activityType
|
|
1516
1568
|
* @param {?=} data
|
|
1517
1569
|
* @return {?}
|
|
@@ -1527,41 +1579,26 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1527
1579
|
*/
|
|
1528
1580
|
function (resolve, reject) {
|
|
1529
1581
|
/** @type {?} */
|
|
1530
|
-
var context = {
|
|
1531
|
-
interactionContext: self,
|
|
1532
|
-
activityClass: activityType,
|
|
1533
|
-
activityData: data,
|
|
1582
|
+
var context = new TabContext(data, activityType, self, {
|
|
1534
1583
|
onDone: (/**
|
|
1535
1584
|
* @param {?} result
|
|
1536
1585
|
* @return {?}
|
|
1537
1586
|
*/
|
|
1538
1587
|
function (result) {
|
|
1539
|
-
self.obsoleteTabs.push(context);
|
|
1540
|
-
// animating on the next tick gives chained done's a chance to
|
|
1541
|
-
// finished before we start an animations
|
|
1542
1588
|
resolve(result);
|
|
1543
|
-
|
|
1544
|
-
* @return {?}
|
|
1545
|
-
*/
|
|
1546
|
-
function () { return self.animateTabs(); }));
|
|
1589
|
+
self.activityFinishedEvents.publish({});
|
|
1547
1590
|
}),
|
|
1548
1591
|
onCancel: (/**
|
|
1549
1592
|
* @param {?} error
|
|
1550
1593
|
* @return {?}
|
|
1551
1594
|
*/
|
|
1552
1595
|
function (error) {
|
|
1553
|
-
self.obsoleteTabs.push(context);
|
|
1554
|
-
// finished before we start an animations
|
|
1555
1596
|
reject(error);
|
|
1556
|
-
|
|
1557
|
-
setTimeout((/**
|
|
1558
|
-
* @return {?}
|
|
1559
|
-
*/
|
|
1560
|
-
function () { return self.animateTabs(); }));
|
|
1597
|
+
self.activityFinishedEvents.publish({});
|
|
1561
1598
|
})
|
|
1562
|
-
};
|
|
1563
|
-
self.
|
|
1564
|
-
self.tabs.selectedIndex = _this.
|
|
1599
|
+
});
|
|
1600
|
+
self.activityTabs.push(context);
|
|
1601
|
+
self.tabs.selectedIndex = _this.activityTabs.length;
|
|
1565
1602
|
}));
|
|
1566
1603
|
};
|
|
1567
1604
|
/**
|
|
@@ -1587,63 +1624,151 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1587
1624
|
return this.startActivity(ConfirmationDialogComponent, confirm);
|
|
1588
1625
|
};
|
|
1589
1626
|
/**
|
|
1590
|
-
* @template
|
|
1591
|
-
* @param {?} confirm
|
|
1592
|
-
* @param {?} activityType
|
|
1593
|
-
* @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
|
|
1594
1725
|
* @return {?}
|
|
1595
1726
|
*/
|
|
1596
|
-
ActivityContainerComponent.prototype.
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
* @
|
|
1600
|
-
* @param {?=} data
|
|
1727
|
+
ActivityContainerComponent.prototype.onAnimationFinished =
|
|
1728
|
+
// @Trace()
|
|
1729
|
+
/**
|
|
1730
|
+
* @private
|
|
1601
1731
|
* @return {?}
|
|
1602
1732
|
*/
|
|
1603
|
-
function (
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
data: data
|
|
1608
|
-
});
|
|
1733
|
+
function () {
|
|
1734
|
+
this.getSelectedOutlet().component.onActivityReady();
|
|
1735
|
+
this.cleanupStaleActivities();
|
|
1736
|
+
this.updateActivityList();
|
|
1609
1737
|
};
|
|
1610
1738
|
/**
|
|
1611
1739
|
* @private
|
|
1612
1740
|
* @return {?}
|
|
1613
1741
|
*/
|
|
1614
|
-
ActivityContainerComponent.prototype.
|
|
1742
|
+
ActivityContainerComponent.prototype.updateActivityList = /**
|
|
1615
1743
|
* @private
|
|
1616
1744
|
* @return {?}
|
|
1617
1745
|
*/
|
|
1618
1746
|
function () {
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
* @param {?} tab
|
|
1747
|
+
this._activityList.value = this.activityTabs.value.filter((/**
|
|
1748
|
+
* @param {?} t
|
|
1622
1749
|
* @return {?}
|
|
1623
1750
|
*/
|
|
1624
|
-
function (
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1751
|
+
function (t) { return !t.isComplete() && t.isComponentRealised(); })).map((/**
|
|
1752
|
+
* @param {?} t
|
|
1753
|
+
* @return {?}
|
|
1754
|
+
*/
|
|
1755
|
+
function (t) { return t.component; }));
|
|
1629
1756
|
};
|
|
1630
1757
|
/**
|
|
1631
1758
|
* @private
|
|
1632
1759
|
* @return {?}
|
|
1633
1760
|
*/
|
|
1634
|
-
ActivityContainerComponent.prototype.
|
|
1761
|
+
ActivityContainerComponent.prototype.getSelectedOutlet = /**
|
|
1635
1762
|
* @private
|
|
1636
1763
|
* @return {?}
|
|
1637
1764
|
*/
|
|
1638
1765
|
function () {
|
|
1639
|
-
|
|
1640
|
-
this.tabs.selectedIndex = this.activityOutletTabs.length - this.obsoleteTabs.length;
|
|
1641
|
-
}
|
|
1766
|
+
return this.outlets.toArray()[this.tabs.selectedIndex];
|
|
1642
1767
|
};
|
|
1643
1768
|
ActivityContainerComponent.decorators = [
|
|
1644
1769
|
{ type: Component, args: [{
|
|
1645
1770
|
selector: 'angular-ui-powerups-activity-container',
|
|
1646
|
-
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",
|
|
1647
1772
|
styles: [":host{display:block}"]
|
|
1648
1773
|
}] }
|
|
1649
1774
|
];
|
|
@@ -1656,25 +1781,21 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1656
1781
|
outlets: [{ type: ViewChildren, args: [ActivityOutletComponent,] }]
|
|
1657
1782
|
};
|
|
1658
1783
|
return ActivityContainerComponent;
|
|
1659
|
-
}(
|
|
1784
|
+
}(InteractionContext));
|
|
1660
1785
|
if (false) {
|
|
1786
|
+
/**
|
|
1787
|
+
* @type {?}
|
|
1788
|
+
* @private
|
|
1789
|
+
*/
|
|
1790
|
+
ActivityContainerComponent.prototype.activityFinishedEvents;
|
|
1661
1791
|
/** @type {?} */
|
|
1662
1792
|
ActivityContainerComponent.prototype.parentInteractionContext;
|
|
1663
1793
|
/** @type {?} */
|
|
1664
|
-
ActivityContainerComponent.prototype.initialActivityOutletContext;
|
|
1665
|
-
/** @type {?} */
|
|
1666
|
-
ActivityContainerComponent.prototype.currentActivity;
|
|
1667
|
-
/** @type {?} */
|
|
1668
1794
|
ActivityContainerComponent.prototype.tabs;
|
|
1669
1795
|
/** @type {?} */
|
|
1670
1796
|
ActivityContainerComponent.prototype.outlets;
|
|
1671
1797
|
/** @type {?} */
|
|
1672
|
-
ActivityContainerComponent.prototype.
|
|
1673
|
-
/**
|
|
1674
|
-
* @type {?}
|
|
1675
|
-
* @private
|
|
1676
|
-
*/
|
|
1677
|
-
ActivityContainerComponent.prototype.obsoleteTabs;
|
|
1798
|
+
ActivityContainerComponent.prototype.activityTabs;
|
|
1678
1799
|
/**
|
|
1679
1800
|
* @type {?}
|
|
1680
1801
|
* @private
|
|
@@ -1686,24 +1807,6 @@ if (false) {
|
|
|
1686
1807
|
*/
|
|
1687
1808
|
ActivityContainerComponent.prototype._activityList;
|
|
1688
1809
|
}
|
|
1689
|
-
(function (ActivityContainerComponent) {
|
|
1690
|
-
/**
|
|
1691
|
-
* @record
|
|
1692
|
-
* @template D, R, E
|
|
1693
|
-
*/
|
|
1694
|
-
function ActivityContext() { }
|
|
1695
|
-
ActivityContainerComponent.ActivityContext = ActivityContext;
|
|
1696
|
-
if (false) {
|
|
1697
|
-
/** @type {?} */
|
|
1698
|
-
ActivityContext.prototype.activityClass;
|
|
1699
|
-
/** @type {?} */
|
|
1700
|
-
ActivityContext.prototype.activityData;
|
|
1701
|
-
/** @type {?} */
|
|
1702
|
-
ActivityContext.prototype.onDone;
|
|
1703
|
-
/** @type {?} */
|
|
1704
|
-
ActivityContext.prototype.onCancel;
|
|
1705
|
-
}
|
|
1706
|
-
})(ActivityContainerComponent || (ActivityContainerComponent = {}));
|
|
1707
1810
|
|
|
1708
1811
|
/**
|
|
1709
1812
|
* @fileoverview added by tsickle
|
|
@@ -1711,43 +1814,79 @@ if (false) {
|
|
|
1711
1814
|
*/
|
|
1712
1815
|
/** @type {?} */
|
|
1713
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));
|
|
1714
1869
|
var DialogInteractionService = /** @class */ (function (_super) {
|
|
1715
1870
|
__extends(DialogInteractionService, _super);
|
|
1716
|
-
function DialogInteractionService(dialogService,
|
|
1871
|
+
function DialogInteractionService(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1717
1872
|
var _this = _super.call(this) || this;
|
|
1718
1873
|
_this.dialogService = dialogService;
|
|
1719
|
-
_this.router = router;
|
|
1720
1874
|
_this.dialogServiceDefaults = dialogServiceDefaults;
|
|
1721
1875
|
_this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
1722
1876
|
_this._activityList = new DelegatingListModel();
|
|
1723
|
-
_this.
|
|
1877
|
+
_this.startingGuard = new Guard();
|
|
1724
1878
|
assert$1.notNil(dialogService);
|
|
1725
|
-
var _a = Dsl.disposeWith(_this), chain = _a.chain, observe = _a.observe;
|
|
1726
|
-
_this.currentActivity = chain(_this.activityList).last();
|
|
1727
1879
|
return _this;
|
|
1728
|
-
// observe.valuesFrom(this.router.events)
|
|
1729
|
-
// .tap((event:RouterEvent) => {
|
|
1730
|
-
// const nav = router.getCurrentNavigation();
|
|
1731
|
-
// console.log({
|
|
1732
|
-
// previousUrl: nav.previousNavigation && nav.previousNavigation.finalUrl,
|
|
1733
|
-
// initialUrl: nav.initialUrl,
|
|
1734
|
-
// finalUrl: nav.finalUrl,
|
|
1735
|
-
// });
|
|
1736
|
-
//
|
|
1737
|
-
// })
|
|
1738
|
-
// .filter(event => event instanceof NavigationStart)
|
|
1739
|
-
// .subscribe((event: NavigationStart) => {
|
|
1740
|
-
// console.log(event.navigationTrigger);
|
|
1741
|
-
// if (event.navigationTrigger === 'popstate' && this.isActive()) {
|
|
1742
|
-
// const prev = router.getCurrentNavigation().previousNavigation.finalUrl;
|
|
1743
|
-
// // this.router.navigateByUrl(prev.toString(), {
|
|
1744
|
-
// // replaceUrl: true,
|
|
1745
|
-
// // skipLocationChange: false
|
|
1746
|
-
// // });
|
|
1747
|
-
// // this.cancelActivity();
|
|
1748
|
-
// }
|
|
1749
|
-
// });
|
|
1750
1880
|
}
|
|
1881
|
+
/**
|
|
1882
|
+
* @return {?}
|
|
1883
|
+
*/
|
|
1884
|
+
DialogInteractionService.prototype.isActive = /**
|
|
1885
|
+
* @return {?}
|
|
1886
|
+
*/
|
|
1887
|
+
function () {
|
|
1888
|
+
return !!this.currentActivityId;
|
|
1889
|
+
};
|
|
1751
1890
|
/**
|
|
1752
1891
|
* @return {?}
|
|
1753
1892
|
*/
|
|
@@ -1755,7 +1894,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1755
1894
|
* @return {?}
|
|
1756
1895
|
*/
|
|
1757
1896
|
function () {
|
|
1758
|
-
this.currentActivity.
|
|
1897
|
+
this.currentActivity.cancel(null);
|
|
1759
1898
|
};
|
|
1760
1899
|
Object.defineProperty(DialogInteractionService.prototype, "activityList", {
|
|
1761
1900
|
get: /**
|
|
@@ -1808,56 +1947,59 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1808
1947
|
*/
|
|
1809
1948
|
function (a) { return a.constructor.name; })).join(', '));
|
|
1810
1949
|
}
|
|
1811
|
-
this.
|
|
1812
|
-
/** @type {?} */
|
|
1813
|
-
var self = this;
|
|
1814
|
-
/** @type {?} */
|
|
1815
|
-
var config = __assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults, {
|
|
1816
|
-
data: data,
|
|
1817
|
-
disableClose: disableClose,
|
|
1818
|
-
panelClass: 'dialog-interaction-service'
|
|
1819
|
-
});
|
|
1820
|
-
/** @type {?} */
|
|
1821
|
-
var matDialogRef = (/** @type {?} */ (this.dialogService.open(ActivityContainerComponent, config)));
|
|
1822
|
-
return new Promise((/**
|
|
1823
|
-
* @param {?} resolve
|
|
1824
|
-
* @param {?} reject
|
|
1950
|
+
return this.startingGuard.whileTrue((/**
|
|
1825
1951
|
* @return {?}
|
|
1826
1952
|
*/
|
|
1827
|
-
function (
|
|
1953
|
+
function () {
|
|
1954
|
+
_this.currentActivityId = v1();
|
|
1828
1955
|
/** @type {?} */
|
|
1829
|
-
var
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
onDone: /**
|
|
1836
|
-
* @param {?} result
|
|
1837
|
-
* @return {?}
|
|
1838
|
-
*/
|
|
1839
|
-
function (result) {
|
|
1840
|
-
// TODO: should I be calling resolve after close?
|
|
1841
|
-
resolve(result);
|
|
1842
|
-
matDialogRef.close(result);
|
|
1843
|
-
},
|
|
1844
|
-
onCancel: /**
|
|
1845
|
-
* @param {?} error
|
|
1846
|
-
* @return {?}
|
|
1847
|
-
*/
|
|
1848
|
-
function (error) {
|
|
1849
|
-
// TODO: should I be calling reject after close?
|
|
1850
|
-
reject(error);
|
|
1851
|
-
matDialogRef.close(error);
|
|
1852
|
-
}
|
|
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'
|
|
1853
1962
|
});
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
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
|
+
}));
|
|
1861
2003
|
}));
|
|
1862
2004
|
};
|
|
1863
2005
|
/**
|
|
@@ -1932,16 +2074,13 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
1932
2074
|
/** @nocollapse */
|
|
1933
2075
|
DialogInteractionService.ctorParameters = function () { return [
|
|
1934
2076
|
{ type: MatDialog },
|
|
1935
|
-
{ type: Router },
|
|
1936
2077
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
|
|
1937
2078
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
|
|
1938
2079
|
]; };
|
|
1939
|
-
/** @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" });
|
|
1940
2081
|
return DialogInteractionService;
|
|
1941
2082
|
}(InteractionContext));
|
|
1942
2083
|
if (false) {
|
|
1943
|
-
/** @type {?} */
|
|
1944
|
-
DialogInteractionService.prototype.currentActivity;
|
|
1945
2084
|
/**
|
|
1946
2085
|
* @type {?}
|
|
1947
2086
|
* @private
|
|
@@ -1951,17 +2090,17 @@ if (false) {
|
|
|
1951
2090
|
* @type {?}
|
|
1952
2091
|
* @private
|
|
1953
2092
|
*/
|
|
1954
|
-
DialogInteractionService.prototype.
|
|
2093
|
+
DialogInteractionService.prototype.startingGuard;
|
|
1955
2094
|
/**
|
|
1956
2095
|
* @type {?}
|
|
1957
2096
|
* @private
|
|
1958
2097
|
*/
|
|
1959
|
-
DialogInteractionService.prototype.
|
|
2098
|
+
DialogInteractionService.prototype.currentActivityId;
|
|
1960
2099
|
/**
|
|
1961
2100
|
* @type {?}
|
|
1962
2101
|
* @private
|
|
1963
2102
|
*/
|
|
1964
|
-
DialogInteractionService.prototype.
|
|
2103
|
+
DialogInteractionService.prototype.dialogService;
|
|
1965
2104
|
/** @type {?} */
|
|
1966
2105
|
DialogInteractionService.prototype.dialogServiceDefaults;
|
|
1967
2106
|
/** @type {?} */
|
|
@@ -2551,10 +2690,92 @@ if (false) {
|
|
|
2551
2690
|
* @fileoverview added by tsickle
|
|
2552
2691
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2553
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
|
+
}
|
|
2554
2735
|
var PlaceRouter = /** @class */ (function () {
|
|
2555
|
-
function PlaceRouter(router) {
|
|
2736
|
+
function PlaceRouter(router, angularLocation) {
|
|
2737
|
+
var _this = this;
|
|
2556
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
|
+
}));
|
|
2557
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
|
+
});
|
|
2558
2779
|
/**
|
|
2559
2780
|
* @param {?} activatedRoute
|
|
2560
2781
|
* @param {?} previous
|
|
@@ -2597,7 +2818,6 @@ var PlaceRouter = /** @class */ (function () {
|
|
|
2597
2818
|
var commands = (weHaveARouteId) ?
|
|
2598
2819
|
[urlSegments[0].path, sanitised.getFormattedRouteId(), sanitised.getFormattedParameters()] :
|
|
2599
2820
|
[urlSegments[0].path, sanitised.getFormattedParameters()];
|
|
2600
|
-
console.log("redirect path", commands);
|
|
2601
2821
|
return this.router.createUrlTree(commands);
|
|
2602
2822
|
};
|
|
2603
2823
|
/**
|
|
@@ -2641,12 +2861,18 @@ var PlaceRouter = /** @class */ (function () {
|
|
|
2641
2861
|
];
|
|
2642
2862
|
/** @nocollapse */
|
|
2643
2863
|
PlaceRouter.ctorParameters = function () { return [
|
|
2644
|
-
{ type: Router }
|
|
2864
|
+
{ type: Router },
|
|
2865
|
+
{ type: Location }
|
|
2645
2866
|
]; };
|
|
2646
|
-
/** @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" });
|
|
2647
2868
|
return PlaceRouter;
|
|
2648
2869
|
}());
|
|
2649
2870
|
if (false) {
|
|
2871
|
+
/**
|
|
2872
|
+
* @type {?}
|
|
2873
|
+
* @private
|
|
2874
|
+
*/
|
|
2875
|
+
PlaceRouter.prototype._navigationSession;
|
|
2650
2876
|
/**
|
|
2651
2877
|
* @type {?}
|
|
2652
2878
|
* @private
|
|
@@ -3726,8 +3952,8 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
|
|
|
3726
3952
|
_this.placeHistory = placeHistory;
|
|
3727
3953
|
_this.animate = true;
|
|
3728
3954
|
_this._activePlace = new MutableValueModel();
|
|
3729
|
-
_this._incomingRouteChange = new Guard();
|
|
3730
|
-
_this._inOutletUpdate = new Guard();
|
|
3955
|
+
_this._incomingRouteChange = new Guard$1();
|
|
3956
|
+
_this._inOutletUpdate = new Guard$1();
|
|
3731
3957
|
_this._activatedRouteModel = new MutableValueModel();
|
|
3732
3958
|
_this._placeDefinition = new MutableValueModel();
|
|
3733
3959
|
_this._resolvedParameters = new MutableValueModel();
|
|
@@ -4430,16 +4656,15 @@ function Result() { }
|
|
|
4430
4656
|
*/
|
|
4431
4657
|
function ActivityOutletContext() { }
|
|
4432
4658
|
if (false) {
|
|
4433
|
-
/** @type {?} */
|
|
4434
|
-
ActivityOutletContext.prototype.interactionContext;
|
|
4435
4659
|
/** @type {?} */
|
|
4436
4660
|
ActivityOutletContext.prototype.activityClass;
|
|
4437
4661
|
/** @type {?} */
|
|
4438
4662
|
ActivityOutletContext.prototype.activityData;
|
|
4439
|
-
/**
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4663
|
+
/**
|
|
4664
|
+
* @param {?} component
|
|
4665
|
+
* @return {?}
|
|
4666
|
+
*/
|
|
4667
|
+
ActivityOutletContext.prototype.componentReady = function (component) { };
|
|
4443
4668
|
}
|
|
4444
4669
|
|
|
4445
4670
|
/**
|
|
@@ -4602,33 +4827,12 @@ if (false) {
|
|
|
4602
4827
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4603
4828
|
*/
|
|
4604
4829
|
var LeavePlaceGuard = /** @class */ (function () {
|
|
4605
|
-
function LeavePlaceGuard(router, injector, interactionContext,
|
|
4830
|
+
function LeavePlaceGuard(router, injector, placeRouter, interactionContext, angularLocation) {
|
|
4606
4831
|
this.router = router;
|
|
4607
4832
|
this.injector = injector;
|
|
4833
|
+
this.placeRouter = placeRouter;
|
|
4608
4834
|
this.interactionContext = interactionContext;
|
|
4609
|
-
this.
|
|
4610
|
-
// TODO: should probably replace this with a RouteTracker thingy.
|
|
4611
|
-
this._alreadyAccepted = [];
|
|
4612
|
-
console.log('***** Created new guard ******');
|
|
4613
|
-
/** @type {?} */
|
|
4614
|
-
var self = this;
|
|
4615
|
-
this.router.events.subscribe((/**
|
|
4616
|
-
* @param {?} event
|
|
4617
|
-
* @return {?}
|
|
4618
|
-
*/
|
|
4619
|
-
function (event) {
|
|
4620
|
-
// NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
|
|
4621
|
-
// NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
|
|
4622
|
-
// NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
|
|
4623
|
-
if (event instanceof NavigationEnd) {
|
|
4624
|
-
console.log("navigation ended");
|
|
4625
|
-
self._alreadyAccepted = [];
|
|
4626
|
-
}
|
|
4627
|
-
if (event instanceof NavigationError) {
|
|
4628
|
-
console.log("navigation errored");
|
|
4629
|
-
self._alreadyAccepted = [];
|
|
4630
|
-
}
|
|
4631
|
-
}));
|
|
4835
|
+
this.angularLocation = angularLocation;
|
|
4632
4836
|
}
|
|
4633
4837
|
/**
|
|
4634
4838
|
* @param {?} component
|
|
@@ -4645,89 +4849,45 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4645
4849
|
* @return {?}
|
|
4646
4850
|
*/
|
|
4647
4851
|
function (component, currentRoute, currentState, nextState) {
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
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);
|
|
4877
|
+
}
|
|
4878
|
+
else {
|
|
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
|
+
}
|
|
4885
|
+
}
|
|
4886
|
+
return [2 /*return*/, canLeave];
|
|
4887
|
+
case 3: return [2 /*return*/, true];
|
|
4888
|
+
}
|
|
4889
|
+
});
|
|
4656
4890
|
});
|
|
4657
|
-
// Example of the above when navigating to a different child route.
|
|
4658
|
-
// canDeactivate {staticPath: "/hero-details",
|
|
4659
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
|
|
4660
|
-
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
|
|
4661
|
-
// }
|
|
4662
|
-
// Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
|
|
4663
|
-
// canDeactivate {
|
|
4664
|
-
// staticPath: "/hero-stats",
|
|
4665
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4666
|
-
// nextStateUrl: "/route-parameters/"
|
|
4667
|
-
// }
|
|
4668
|
-
// canDeactivate {
|
|
4669
|
-
// staticPath: "/route-parameters",
|
|
4670
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4671
|
-
// nextStateUrl: "/route-parameters/"
|
|
4672
|
-
// }
|
|
4673
|
-
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
|
|
4674
|
-
// parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
|
|
4675
|
-
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4676
|
-
// canDeactivate {
|
|
4677
|
-
// staticPath: "/hero-stats",
|
|
4678
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4679
|
-
// nextStateUrl: "/route-parameters/-1"
|
|
4680
|
-
// }
|
|
4681
|
-
// canDeactivate {
|
|
4682
|
-
// staticPath: "/route-parameters",
|
|
4683
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4684
|
-
// nextStateUrl: "/route-parameters/-1"
|
|
4685
|
-
// }
|
|
4686
|
-
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
|
|
4687
|
-
// parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
|
|
4688
|
-
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4689
|
-
// canDeactivate {
|
|
4690
|
-
// staticPath: "/hero-stats",
|
|
4691
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4692
|
-
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
4693
|
-
// }
|
|
4694
|
-
// HACK: this will break with child routes...
|
|
4695
|
-
if (this.alreadyAccepted(component)) {
|
|
4696
|
-
return true;
|
|
4697
|
-
}
|
|
4698
|
-
else {
|
|
4699
|
-
if (!nextState.url.startsWith(placeDefinitionPath)) {
|
|
4700
|
-
/** @type {?} */
|
|
4701
|
-
var self_1 = this;
|
|
4702
|
-
return Promise.resolve(component.canDeactivate()).then((/**
|
|
4703
|
-
* @param {?} canLeave
|
|
4704
|
-
* @return {?}
|
|
4705
|
-
*/
|
|
4706
|
-
function (canLeave) {
|
|
4707
|
-
if (!canLeave) {
|
|
4708
|
-
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4709
|
-
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4710
|
-
_this.location.go(currentState.url);
|
|
4711
|
-
}
|
|
4712
|
-
else {
|
|
4713
|
-
self_1._alreadyAccepted.push(component);
|
|
4714
|
-
}
|
|
4715
|
-
return canLeave;
|
|
4716
|
-
}));
|
|
4717
|
-
}
|
|
4718
|
-
return true;
|
|
4719
|
-
}
|
|
4720
|
-
};
|
|
4721
|
-
/**
|
|
4722
|
-
* @param {?} placeComponent
|
|
4723
|
-
* @return {?}
|
|
4724
|
-
*/
|
|
4725
|
-
LeavePlaceGuard.prototype.alreadyAccepted = /**
|
|
4726
|
-
* @param {?} placeComponent
|
|
4727
|
-
* @return {?}
|
|
4728
|
-
*/
|
|
4729
|
-
function (placeComponent) {
|
|
4730
|
-
return this._alreadyAccepted.includes(placeComponent);
|
|
4731
4891
|
};
|
|
4732
4892
|
LeavePlaceGuard.decorators = [
|
|
4733
4893
|
{ type: Injectable, args: [{
|
|
@@ -4738,16 +4898,11 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
4738
4898
|
LeavePlaceGuard.ctorParameters = function () { return [
|
|
4739
4899
|
{ type: Router },
|
|
4740
4900
|
{ type: Injector },
|
|
4901
|
+
{ type: PlaceRouter },
|
|
4741
4902
|
{ type: InteractionContext },
|
|
4742
4903
|
{ type: Location }
|
|
4743
4904
|
]; };
|
|
4744
|
-
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext), ɵɵinject(Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4745
|
-
__decorate([
|
|
4746
|
-
Trace(),
|
|
4747
|
-
__metadata("design:type", Function),
|
|
4748
|
-
__metadata("design:paramtypes", [PlaceComponent]),
|
|
4749
|
-
__metadata("design:returntype", Boolean)
|
|
4750
|
-
], 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" });
|
|
4751
4906
|
return LeavePlaceGuard;
|
|
4752
4907
|
}());
|
|
4753
4908
|
if (false) {
|
|
@@ -4755,21 +4910,21 @@ if (false) {
|
|
|
4755
4910
|
* @type {?}
|
|
4756
4911
|
* @private
|
|
4757
4912
|
*/
|
|
4758
|
-
LeavePlaceGuard.prototype.
|
|
4913
|
+
LeavePlaceGuard.prototype.router;
|
|
4759
4914
|
/**
|
|
4760
4915
|
* @type {?}
|
|
4761
4916
|
* @private
|
|
4762
4917
|
*/
|
|
4763
|
-
LeavePlaceGuard.prototype.
|
|
4918
|
+
LeavePlaceGuard.prototype.injector;
|
|
4764
4919
|
/**
|
|
4765
4920
|
* @type {?}
|
|
4766
4921
|
* @private
|
|
4767
4922
|
*/
|
|
4768
|
-
LeavePlaceGuard.prototype.
|
|
4923
|
+
LeavePlaceGuard.prototype.placeRouter;
|
|
4769
4924
|
/** @type {?} */
|
|
4770
4925
|
LeavePlaceGuard.prototype.interactionContext;
|
|
4771
4926
|
/** @type {?} */
|
|
4772
|
-
LeavePlaceGuard.prototype.
|
|
4927
|
+
LeavePlaceGuard.prototype.angularLocation;
|
|
4773
4928
|
}
|
|
4774
4929
|
|
|
4775
4930
|
/**
|
|
@@ -5078,5 +5233,5 @@ var ParameterType;
|
|
|
5078
5233
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5079
5234
|
*/
|
|
5080
5235
|
|
|
5081
|
-
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 };
|
|
5082
5237
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|