@coolon/angular-ui-powerups 0.0.34 → 0.0.36

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.
@@ -1,11 +1,11 @@
1
1
  import { DOCUMENT, CommonModule } from '@angular/common';
2
- import { EventEmitter, Input, Output, HostListener, Component, Directive, ElementRef, Inject, NgZone, InjectionToken, ViewChild, Injector, ComponentFactoryResolver, ViewContainerRef, Injectable, ɵɵdefineInjectable, ɵɵinject, NgModule, INJECTOR } from '@angular/core';
2
+ import { EventEmitter, Input, Output, HostListener, Component, Directive, ElementRef, Inject, NgZone, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, NgModule, INJECTOR } from '@angular/core';
3
3
  import { FormsModule } from '@angular/forms';
4
4
  import { MatDialog, MatButtonModule, MatDialogModule, MatTabsModule, MatProgressSpinnerModule, MatInputModule, MatFormFieldModule, MatSelectModule } from '@angular/material';
5
5
  import { BrowserModule } from '@angular/platform-browser';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import { __decorate, __metadata, __awaiter } from 'tslib';
8
- import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, assert, UnaryCommand, lang, Dsl, Logger, ListModel, StoreInListModel, EventListenerList, DelegatingValueModel, MutableListModel, StoreInValueModel, Trace, MutableValueModel, TransactionObserver, Binding, OptionsHelper, ValueHolder } from '@coolon/pectin';
8
+ import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, assert, UnaryCommand, lang, Dsl, Logger, ListModel, StoreInListModel, EventListenerList, DelegatingValueModel, Trace, MutableListModel, StoreInValueModel, MutableValueModel, TransactionObserver, Binding, OptionsHelper, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { Deferred } from '@coolon/pectin/lib/promise/deferred.class';
11
11
  import { assert as assert$1, Klass, Opts } from '@coolon/typescript-utilities';
@@ -683,6 +683,205 @@ if (false) {
683
683
  InteractionContext.prototype.alert = function (alert) { };
684
684
  }
685
685
 
686
+ /**
687
+ * @fileoverview added by tsickle
688
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
689
+ */
690
+ /** @type {?} */
691
+ const ACTIVITY_DATA = new InjectionToken('InteractionActivityData');
692
+ /**
693
+ * @record
694
+ * @template D, R, E
695
+ */
696
+ function Activity() { }
697
+ if (false) {
698
+ /** @type {?} */
699
+ Activity.prototype.busy;
700
+ /**
701
+ * @param {?} callback
702
+ * @return {?}
703
+ */
704
+ Activity.prototype.onDone = function (callback) { };
705
+ /**
706
+ * @param {?} callback
707
+ * @return {?}
708
+ */
709
+ Activity.prototype.onCancel = function (callback) { };
710
+ }
711
+
712
+ /**
713
+ * @fileoverview added by tsickle
714
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
715
+ */
716
+ /**
717
+ * @template D, R, E
718
+ */
719
+ class ActivityOutletComponent {
720
+ /**
721
+ * @param {?} componentFactoryResolver
722
+ * @param {?} viewContainerRef
723
+ * @param {?} injector
724
+ */
725
+ constructor(componentFactoryResolver, viewContainerRef, injector) {
726
+ this.componentFactoryResolver = componentFactoryResolver;
727
+ this.viewContainerRef = viewContainerRef;
728
+ this.injector = injector;
729
+ }
730
+ /**
731
+ * @param {?} activityContext
732
+ * @return {?}
733
+ */
734
+ set activityContext(activityContext) {
735
+ this.loadActivity(activityContext);
736
+ }
737
+ ;
738
+ /**
739
+ * @return {?}
740
+ */
741
+ ngOnInit() {
742
+ }
743
+ /**
744
+ * @param {?} activityContext
745
+ * @return {?}
746
+ */
747
+ loadActivity(activityContext) {
748
+ /** @type {?} */
749
+ const injector = Injector.create({
750
+ providers: [
751
+ {
752
+ provide: InteractionContext,
753
+ useValue: this
754
+ },
755
+ { provide: ACTIVITY_DATA, useValue: activityContext.activityData }
756
+ ],
757
+ parent: this.injector
758
+ });
759
+ /** @type {?} */
760
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(activityContext.activityClass);
761
+ this.viewContainerRef.clear();
762
+ this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
763
+ this.activityComponentRef.instance.onDone(activityContext.onDone);
764
+ this.activityComponentRef.instance.onCancel(activityContext.onCancel);
765
+ }
766
+ /**
767
+ * @param {?} alert
768
+ * @return {?}
769
+ */
770
+ alert(alert) {
771
+ return this.interactionContext.alert(alert);
772
+ }
773
+ /**
774
+ * @param {?} confirm
775
+ * @return {?}
776
+ */
777
+ confirm(confirm) {
778
+ return this.interactionContext.confirm(confirm);
779
+ }
780
+ /**
781
+ * @template D1, R1, E1
782
+ * @param {?} activityType
783
+ * @param {?=} data
784
+ * @return {?}
785
+ */
786
+ startActivity(activityType, data) {
787
+ return this.interactionContext.startActivity(activityType, data);
788
+ }
789
+ /**
790
+ * @return {?}
791
+ */
792
+ notifyReady() {
793
+ if (this.activityComponentRef.instance['onActivityReady']) {
794
+ this.activityComponentRef.instance['onActivityReady']();
795
+ }
796
+ }
797
+ }
798
+ ActivityOutletComponent.decorators = [
799
+ { type: Component, args: [{
800
+ selector: 'angular-ui-powerups-activity-outlet',
801
+ template: '',
802
+ styles: [":host{display:block}"]
803
+ }] }
804
+ ];
805
+ /** @nocollapse */
806
+ ActivityOutletComponent.ctorParameters = () => [
807
+ { type: ComponentFactoryResolver },
808
+ { type: ViewContainerRef },
809
+ { type: Injector }
810
+ ];
811
+ ActivityOutletComponent.propDecorators = {
812
+ interactionContext: [{ type: Input }],
813
+ activityContext: [{ type: Input }]
814
+ };
815
+ if (false) {
816
+ /** @type {?} */
817
+ ActivityOutletComponent.prototype.interactionContext;
818
+ /**
819
+ * @type {?}
820
+ * @private
821
+ */
822
+ ActivityOutletComponent.prototype.activityComponentRef;
823
+ /**
824
+ * @type {?}
825
+ * @private
826
+ */
827
+ ActivityOutletComponent.prototype.componentFactoryResolver;
828
+ /**
829
+ * @type {?}
830
+ * @private
831
+ */
832
+ ActivityOutletComponent.prototype.viewContainerRef;
833
+ /**
834
+ * @type {?}
835
+ * @private
836
+ */
837
+ ActivityOutletComponent.prototype.injector;
838
+ /* Skipping unhandled member: ;*/
839
+ }
840
+ (function (ActivityOutletComponent) {
841
+ /**
842
+ * @template D, R, E
843
+ */
844
+ class OutletInteractionContext {
845
+ /**
846
+ * @param {?} context
847
+ */
848
+ constructor(context) {
849
+ this.context = context;
850
+ }
851
+ /**
852
+ * @param {?} alert
853
+ * @return {?}
854
+ */
855
+ alert(alert) {
856
+ return lang.notImplemented();
857
+ }
858
+ /**
859
+ * @param {?} confirm
860
+ * @return {?}
861
+ */
862
+ confirm(confirm) {
863
+ return lang.notImplemented();
864
+ }
865
+ /**
866
+ * @template D1, R1, E1
867
+ * @param {?} activityType
868
+ * @param {?=} data
869
+ * @return {?}
870
+ */
871
+ startActivity(activityType, data) {
872
+ return lang.notImplemented();
873
+ }
874
+ }
875
+ ActivityOutletComponent.OutletInteractionContext = OutletInteractionContext;
876
+ if (false) {
877
+ /**
878
+ * @type {?}
879
+ * @private
880
+ */
881
+ OutletInteractionContext.prototype.context;
882
+ }
883
+ })(ActivityOutletComponent || (ActivityOutletComponent = {}));
884
+
686
885
  /**
687
886
  * @fileoverview added by tsickle
688
887
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -744,6 +943,11 @@ class AbstractActivity extends DisposableComponent {
744
943
  */
745
944
  () => this.finalizeAndDispose()));
746
945
  }
946
+ /**
947
+ * @return {?}
948
+ */
949
+ onActivityReady() {
950
+ }
747
951
  /**
748
952
  * @private
749
953
  * @return {?}
@@ -787,6 +991,12 @@ class AbstractActivity extends DisposableComponent {
787
991
  return this._busyModel.value;
788
992
  }
789
993
  }
994
+ __decorate([
995
+ Trace(),
996
+ __metadata("design:type", Function),
997
+ __metadata("design:paramtypes", []),
998
+ __metadata("design:returntype", void 0)
999
+ ], AbstractActivity.prototype, "onActivityReady", null);
790
1000
  if (false) {
791
1001
  /**
792
1002
  * @type {?}
@@ -810,32 +1020,6 @@ if (false) {
810
1020
  AbstractActivity.prototype._busyModel;
811
1021
  }
812
1022
 
813
- /**
814
- * @fileoverview added by tsickle
815
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
816
- */
817
- /** @type {?} */
818
- const ACTIVITY_DATA = new InjectionToken('InteractionActivityData');
819
- /**
820
- * @record
821
- * @template D, R, E
822
- */
823
- function Activity() { }
824
- if (false) {
825
- /** @type {?} */
826
- Activity.prototype.busy;
827
- /**
828
- * @param {?} callback
829
- * @return {?}
830
- */
831
- Activity.prototype.onDone = function (callback) { };
832
- /**
833
- * @param {?} callback
834
- * @return {?}
835
- */
836
- Activity.prototype.onCancel = function (callback) { };
837
- }
838
-
839
1023
  /**
840
1024
  * @fileoverview added by tsickle
841
1025
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -921,6 +1105,8 @@ class ActivityContainerComponent extends DisposableComponent {
921
1105
  super();
922
1106
  this.activityTabs = new MutableListModel();
923
1107
  this.obsoleteTabs = [];
1108
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
1109
+ this.lastActivityTab = chain(this.activityTabs).last().otherwise(this.initialActivity);
924
1110
  }
925
1111
  /**
926
1112
  * @return {?}
@@ -935,7 +1121,7 @@ class ActivityContainerComponent extends DisposableComponent {
935
1121
  observe.valuesFrom(this.tabs.animationDone).subscribe((/**
936
1122
  * @return {?}
937
1123
  */
938
- () => this.cleanUpTabs()));
1124
+ () => this.onAnimationFinished()));
939
1125
  }
940
1126
  /**
941
1127
  * @template D, R, E
@@ -990,7 +1176,8 @@ class ActivityContainerComponent extends DisposableComponent {
990
1176
  * @private
991
1177
  * @return {?}
992
1178
  */
993
- cleanUpTabs() {
1179
+ onAnimationFinished() {
1180
+ // TODO: notify selected tab they are ready. activty.afterAnimationComplete
994
1181
  this.activityTabs.value = this.activityTabs.value.filter((/**
995
1182
  * @param {?} tab
996
1183
  * @return {?}
@@ -998,6 +1185,7 @@ class ActivityContainerComponent extends DisposableComponent {
998
1185
  tab => {
999
1186
  return !this.obsoleteTabs.includes(tab);
1000
1187
  }));
1188
+ this.outlets.last.notifyReady();
1001
1189
  }
1002
1190
  }
1003
1191
  ActivityContainerComponent.decorators = [
@@ -1012,7 +1200,8 @@ ActivityContainerComponent.ctorParameters = () => [];
1012
1200
  ActivityContainerComponent.propDecorators = {
1013
1201
  parentInteractionContext: [{ type: Input }],
1014
1202
  initialActivity: [{ type: Input }],
1015
- tabs: [{ type: ViewChild, args: ['tabs', { static: true },] }]
1203
+ tabs: [{ type: ViewChild, args: ['tabs', { static: true },] }],
1204
+ outlets: [{ type: ViewChildren, args: [ActivityOutletComponent,] }]
1016
1205
  };
1017
1206
  if (false) {
1018
1207
  /** @type {?} */
@@ -1022,12 +1211,19 @@ if (false) {
1022
1211
  /** @type {?} */
1023
1212
  ActivityContainerComponent.prototype.tabs;
1024
1213
  /** @type {?} */
1214
+ ActivityContainerComponent.prototype.outlets;
1215
+ /** @type {?} */
1025
1216
  ActivityContainerComponent.prototype.activityTabs;
1026
1217
  /**
1027
1218
  * @type {?}
1028
1219
  * @private
1029
1220
  */
1030
1221
  ActivityContainerComponent.prototype.obsoleteTabs;
1222
+ /**
1223
+ * @type {?}
1224
+ * @private
1225
+ */
1226
+ ActivityContainerComponent.prototype.lastActivityTab;
1031
1227
  }
1032
1228
  (function (ActivityContainerComponent) {
1033
1229
  /**
@@ -1048,171 +1244,6 @@ if (false) {
1048
1244
  }
1049
1245
  })(ActivityContainerComponent || (ActivityContainerComponent = {}));
1050
1246
 
1051
- /**
1052
- * @fileoverview added by tsickle
1053
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1054
- */
1055
- /**
1056
- * @template D, R, E
1057
- */
1058
- class ActivityOutletComponent {
1059
- /**
1060
- * @param {?} componentFactoryResolver
1061
- * @param {?} viewContainerRef
1062
- * @param {?} injector
1063
- */
1064
- constructor(componentFactoryResolver, viewContainerRef, injector) {
1065
- this.componentFactoryResolver = componentFactoryResolver;
1066
- this.viewContainerRef = viewContainerRef;
1067
- this.injector = injector;
1068
- }
1069
- /**
1070
- * @param {?} activityContext
1071
- * @return {?}
1072
- */
1073
- set activityContext(activityContext) {
1074
- this.loadActivity(activityContext);
1075
- }
1076
- ;
1077
- /**
1078
- * @return {?}
1079
- */
1080
- ngOnInit() {
1081
- }
1082
- /**
1083
- * @param {?} activityContext
1084
- * @return {?}
1085
- */
1086
- loadActivity(activityContext) {
1087
- /** @type {?} */
1088
- const injector = Injector.create({
1089
- providers: [
1090
- {
1091
- provide: InteractionContext,
1092
- useValue: this
1093
- },
1094
- { provide: ACTIVITY_DATA, useValue: activityContext.activityData }
1095
- ],
1096
- parent: this.injector
1097
- });
1098
- /** @type {?} */
1099
- const componentFactory = this.componentFactoryResolver.resolveComponentFactory(activityContext.activityClass);
1100
- this.viewContainerRef.clear();
1101
- this.activityComponent = this.viewContainerRef.createComponent(componentFactory, 0, injector);
1102
- this.activityComponent.instance.onDone(activityContext.onDone);
1103
- this.activityComponent.instance.onCancel(activityContext.onCancel);
1104
- }
1105
- /**
1106
- * @param {?} alert
1107
- * @return {?}
1108
- */
1109
- alert(alert) {
1110
- return this.interactionContext.alert(alert);
1111
- }
1112
- /**
1113
- * @param {?} confirm
1114
- * @return {?}
1115
- */
1116
- confirm(confirm) {
1117
- return this.interactionContext.confirm(confirm);
1118
- }
1119
- /**
1120
- * @template D1, R1, E1
1121
- * @param {?} activityType
1122
- * @param {?=} data
1123
- * @return {?}
1124
- */
1125
- startActivity(activityType, data) {
1126
- return this.interactionContext.startActivity(activityType, data);
1127
- }
1128
- }
1129
- ActivityOutletComponent.decorators = [
1130
- { type: Component, args: [{
1131
- selector: 'angular-ui-powerups-activity-outlet',
1132
- template: '',
1133
- styles: [":host{display:block}"]
1134
- }] }
1135
- ];
1136
- /** @nocollapse */
1137
- ActivityOutletComponent.ctorParameters = () => [
1138
- { type: ComponentFactoryResolver },
1139
- { type: ViewContainerRef },
1140
- { type: Injector }
1141
- ];
1142
- ActivityOutletComponent.propDecorators = {
1143
- interactionContext: [{ type: Input }],
1144
- activityContext: [{ type: Input }]
1145
- };
1146
- if (false) {
1147
- /** @type {?} */
1148
- ActivityOutletComponent.prototype.interactionContext;
1149
- /**
1150
- * @type {?}
1151
- * @private
1152
- */
1153
- ActivityOutletComponent.prototype.activityComponent;
1154
- /**
1155
- * @type {?}
1156
- * @private
1157
- */
1158
- ActivityOutletComponent.prototype.componentFactoryResolver;
1159
- /**
1160
- * @type {?}
1161
- * @private
1162
- */
1163
- ActivityOutletComponent.prototype.viewContainerRef;
1164
- /**
1165
- * @type {?}
1166
- * @private
1167
- */
1168
- ActivityOutletComponent.prototype.injector;
1169
- /* Skipping unhandled member: ;*/
1170
- }
1171
- (function (ActivityOutletComponent) {
1172
- /**
1173
- * @template D, R, E
1174
- */
1175
- class OutletInteractionContext {
1176
- /**
1177
- * @param {?} context
1178
- */
1179
- constructor(context) {
1180
- this.context = context;
1181
- }
1182
- /**
1183
- * @param {?} alert
1184
- * @return {?}
1185
- */
1186
- alert(alert) {
1187
- return lang.notImplemented();
1188
- }
1189
- /**
1190
- * @param {?} confirm
1191
- * @return {?}
1192
- */
1193
- confirm(confirm) {
1194
- return lang.notImplemented();
1195
- }
1196
- /**
1197
- * @template D1, R1, E1
1198
- * @param {?} activityType
1199
- * @param {?=} data
1200
- * @return {?}
1201
- */
1202
- startActivity(activityType, data) {
1203
- return lang.notImplemented();
1204
- }
1205
- }
1206
- ActivityOutletComponent.OutletInteractionContext = OutletInteractionContext;
1207
- if (false) {
1208
- /**
1209
- * @type {?}
1210
- * @private
1211
- */
1212
- OutletInteractionContext.prototype.context;
1213
- }
1214
- })(ActivityOutletComponent || (ActivityOutletComponent = {}));
1215
-
1216
1247
  /**
1217
1248
  * @fileoverview added by tsickle
1218
1249
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -3266,5 +3297,5 @@ class VisitSnapshot {
3266
3297
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3267
3298
  */
3268
3299
 
3269
- export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, NumberInputComponent, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceService, Point, ResizeAwareComponent, ResolvedRouteParameterSnapshot, RouteId, RouteParameter, RouteParameterBindings, RouteParameterList, RouteParameterSanitiser, Sanitiser, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, VisitSnapshot, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, 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, LEFT_RIGHT_PLACE_ANIMATION as ɵm, PlaceService as ɵn, TabbedPlaceNavigationComponent as ɵo, InteractionModule as ɵp, ActivityContainerComponent as ɵq, ConfirmationDialogComponent as ɵr, AbstractActivity as ɵs, ACTIVITY_DATA as ɵt, AlertDialogComponent as ɵv, ActivityOutletComponent as ɵx, DialogInteractionService as ɵy, InteractionContext as ɵz };
3300
+ export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, NumberInputComponent, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceService, Point, ResizeAwareComponent, ResolvedRouteParameterSnapshot, RouteId, RouteParameter, RouteParameterBindings, RouteParameterList, RouteParameterSanitiser, Sanitiser, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, VisitSnapshot, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, 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, LEFT_RIGHT_PLACE_ANIMATION as ɵm, PlaceService as ɵn, TabbedPlaceNavigationComponent as ɵo, InteractionModule as ɵp, ActivityContainerComponent as ɵq, ActivityOutletComponent as ɵr, ConfirmationDialogComponent as ɵs, AbstractActivity as ɵt, ACTIVITY_DATA as ɵu, AlertDialogComponent as ɵw, DialogInteractionService as ɵy, InteractionContext as ɵz };
3270
3301
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map