@coolon/angular-ui-powerups 0.0.59 → 0.0.61

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.
Files changed (40) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +198 -37
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.d.ts +5 -4
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +6 -5
  8. package/esm2015/index.js +2 -2
  9. package/esm2015/lib/interaction/abstract-activity.js +2 -18
  10. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +16 -1
  11. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +22 -9
  12. package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +92 -0
  13. package/esm2015/lib/interaction/index.js +2 -1
  14. package/esm2015/lib/interaction/interaction-context.js +11 -1
  15. package/esm2015/lib/interaction/interaction.module.js +5 -2
  16. package/esm2015/lib/interaction/services/dialog-interaction.service.js +16 -1
  17. package/esm2015/public_api.js +2 -2
  18. package/esm5/coolon-angular-ui-powerups.js +6 -5
  19. package/esm5/index.js +2 -2
  20. package/esm5/lib/interaction/abstract-activity.js +9 -28
  21. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +23 -1
  22. package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +36 -9
  23. package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +107 -0
  24. package/esm5/lib/interaction/index.js +2 -1
  25. package/esm5/lib/interaction/interaction-context.js +11 -1
  26. package/esm5/lib/interaction/interaction.module.js +5 -2
  27. package/esm5/lib/interaction/services/dialog-interaction.service.js +23 -1
  28. package/esm5/public_api.js +2 -2
  29. package/fesm2015/coolon-angular-ui-powerups.js +150 -24
  30. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  31. package/fesm5/coolon-angular-ui-powerups.js +195 -35
  32. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  33. package/lib/interaction/abstract-activity.d.ts +0 -1
  34. package/lib/interaction/components/activity-container/activity-container.component.d.ts +1 -0
  35. package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +2 -0
  36. package/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.d.ts +22 -0
  37. package/lib/interaction/index.d.ts +1 -0
  38. package/lib/interaction/interaction-context.d.ts +7 -0
  39. package/lib/interaction/services/dialog-interaction.service.d.ts +1 -0
  40. package/package.json +1 -1
@@ -5,7 +5,7 @@ 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 { __decorate, __metadata, __awaiter } from 'tslib';
8
- import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, Trace, DelegatingValueModel, MutableListModel, StoreInValueModel, Binding, MutableValueModel, Guard, OptionsHelper, ValueHolder } from '@coolon/pectin';
8
+ import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingValueModel, MutableListModel, StoreInValueModel, Binding, MutableValueModel, Guard, OptionsHelper, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { assert as assert$1, Klass, Opts } from '@coolon/typescript-utilities';
11
11
  import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
@@ -673,6 +673,16 @@ if (false) {
673
673
  * @return {?}
674
674
  */
675
675
  InteractionContext.prototype.confirm = function (confirm) { };
676
+ /**
677
+ * Presents the confirmation to the user and runs the activity only if the user confirms.
678
+ * @abstract
679
+ * @template D, R, E
680
+ * @param {?} confirm
681
+ * @param {?} activityType the activity to run if confirmed.
682
+ * @param {?=} data the activity data.
683
+ * @return {?}
684
+ */
685
+ InteractionContext.prototype.confirmThen = function (confirm, activityType, data) { };
676
686
  /**
677
687
  * @abstract
678
688
  * @param {?} alert
@@ -774,6 +784,16 @@ class ActivityOutletComponent {
774
784
  confirm(confirm) {
775
785
  return this.interactionContext.confirm(confirm);
776
786
  }
787
+ /**
788
+ * @template D1, R1, E1
789
+ * @param {?} confirm
790
+ * @param {?} activityType
791
+ * @param {?=} data
792
+ * @return {?}
793
+ */
794
+ confirmThen(confirm, activityType, data) {
795
+ return this.interactionContext.confirmThen(confirm, activityType, data);
796
+ }
777
797
  /**
778
798
  * @template D1, R1, E1
779
799
  * @param {?} activityType
@@ -809,12 +829,6 @@ ActivityOutletComponent.propDecorators = {
809
829
  interactionContext: [{ type: Input }],
810
830
  activityContext: [{ type: Input }]
811
831
  };
812
- __decorate([
813
- Trace(),
814
- __metadata("design:type", Function),
815
- __metadata("design:paramtypes", [Object]),
816
- __metadata("design:returntype", void 0)
817
- ], ActivityOutletComponent.prototype, "loadActivity", null);
818
832
  if (false) {
819
833
  /** @type {?} */
820
834
  ActivityOutletComponent.prototype.interactionContext;
@@ -865,6 +879,16 @@ if (false) {
865
879
  confirm(confirm) {
866
880
  return lang.notImplemented();
867
881
  }
882
+ /**
883
+ * @template D1, R1, E1
884
+ * @param {?} confirm
885
+ * @param {?} activityType
886
+ * @param {?=} data
887
+ * @return {?}
888
+ */
889
+ confirmThen(confirm, activityType, data) {
890
+ return lang.notImplemented();
891
+ }
868
892
  /**
869
893
  * @template D1, R1, E1
870
894
  * @param {?} activityType
@@ -919,15 +943,6 @@ class AbstractActivity extends DisposableComponent {
919
943
  cancel(error) {
920
944
  this.activityContext.onCancel(error);
921
945
  }
922
- /**
923
- * @return {?}
924
- */
925
- get data() {
926
- return this.activityContext.activityData;
927
- }
928
- // get interactionContext(): InteractionContext {
929
- // return this.activityContext.interactionContext;
930
- // }
931
946
  // @Trace()
932
947
  /**
933
948
  * @return {?}
@@ -954,12 +969,6 @@ class AbstractActivity extends DisposableComponent {
954
969
  return this._busyModel.value;
955
970
  }
956
971
  }
957
- __decorate([
958
- Trace(),
959
- __metadata("design:type", Function),
960
- __metadata("design:paramtypes", [Object]),
961
- __metadata("design:returntype", void 0)
962
- ], AbstractActivity.prototype, "initialise", null);
963
972
  if (false) {
964
973
  /**
965
974
  * @type {?}
@@ -1007,6 +1016,93 @@ if (false) {
1007
1016
  AlertDialogComponent.prototype.alert;
1008
1017
  }
1009
1018
 
1019
+ /**
1020
+ * @fileoverview added by tsickle
1021
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1022
+ */
1023
+ /**
1024
+ * @template D, R, E
1025
+ */
1026
+ class ConfirmThenDialogComponent extends AbstractActivity {
1027
+ /**
1028
+ * @param {?} config
1029
+ * @param {?} interactionContext
1030
+ */
1031
+ constructor(config, interactionContext) {
1032
+ super();
1033
+ this.config = config;
1034
+ this.interactionContext = interactionContext;
1035
+ assert.notNil(config);
1036
+ }
1037
+ /**
1038
+ * @return {?}
1039
+ */
1040
+ ngOnInit() {
1041
+ }
1042
+ /**
1043
+ * @return {?}
1044
+ */
1045
+ get confirm() {
1046
+ return this.config.confirm;
1047
+ }
1048
+ /**
1049
+ * @return {?}
1050
+ */
1051
+ isDestructive() {
1052
+ return this.confirm.destructive && this.confirm.destructive();
1053
+ }
1054
+ /**
1055
+ * @return {?}
1056
+ */
1057
+ onConfirm() {
1058
+ this.interactionContext.startActivity(this.config.activityType, this.config.data)
1059
+ .then((/**
1060
+ * @param {?} result
1061
+ * @return {?}
1062
+ */
1063
+ (result) => this.done(result)))
1064
+ .catch((/**
1065
+ * @param {?} error
1066
+ * @return {?}
1067
+ */
1068
+ error => this.cancel(error)));
1069
+ }
1070
+ }
1071
+ ConfirmThenDialogComponent.decorators = [
1072
+ { type: Component, args: [{
1073
+ selector: 'angular-ui-powerups-confirmation-dialog',
1074
+ template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\">{{confirm.ok()}}</button>\n</p>\n\n",
1075
+ styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1076
+ }] }
1077
+ ];
1078
+ /** @nocollapse */
1079
+ ConfirmThenDialogComponent.ctorParameters = () => [
1080
+ { type: undefined, decorators: [{ type: Inject, args: [ACTIVITY_DATA,] }] },
1081
+ { type: InteractionContext }
1082
+ ];
1083
+ if (false) {
1084
+ /** @type {?} */
1085
+ ConfirmThenDialogComponent.prototype.config;
1086
+ /** @type {?} */
1087
+ ConfirmThenDialogComponent.prototype.interactionContext;
1088
+ }
1089
+ (function (ConfirmThenDialogComponent) {
1090
+ /**
1091
+ * @record
1092
+ * @template D, R, E
1093
+ */
1094
+ function Data() { }
1095
+ ConfirmThenDialogComponent.Data = Data;
1096
+ if (false) {
1097
+ /** @type {?} */
1098
+ Data.prototype.confirm;
1099
+ /** @type {?} */
1100
+ Data.prototype.activityType;
1101
+ /** @type {?} */
1102
+ Data.prototype.data;
1103
+ }
1104
+ })(ConfirmThenDialogComponent || (ConfirmThenDialogComponent = {}));
1105
+
1010
1106
  /**
1011
1107
  * @fileoverview added by tsickle
1012
1108
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -1171,6 +1267,20 @@ class ActivityContainerComponent extends DisposableComponent {
1171
1267
  confirm(confirm) {
1172
1268
  return this.startActivity(ConfirmationDialogComponent, confirm);
1173
1269
  }
1270
+ /**
1271
+ * @template D, R, E
1272
+ * @param {?} confirm
1273
+ * @param {?} activityType
1274
+ * @param {?=} data
1275
+ * @return {?}
1276
+ */
1277
+ confirmThen(confirm, activityType, data) {
1278
+ return this.startActivity(ConfirmThenDialogComponent, {
1279
+ confirm,
1280
+ activityType: activityType,
1281
+ data: data
1282
+ });
1283
+ }
1174
1284
  /**
1175
1285
  * @private
1176
1286
  * @return {?}
@@ -1345,6 +1455,20 @@ class DialogInteractionService extends InteractionContext {
1345
1455
  confirm(confirm) {
1346
1456
  return this._startActivity(ConfirmationDialogComponent, confirm, true);
1347
1457
  }
1458
+ /**
1459
+ * @template D, R, E
1460
+ * @param {?} confirm
1461
+ * @param {?} activityType
1462
+ * @param {?=} data
1463
+ * @return {?}
1464
+ */
1465
+ confirmThen(confirm, activityType, data) {
1466
+ return this._startActivity(ConfirmThenDialogComponent, {
1467
+ confirm,
1468
+ activityType: activityType,
1469
+ data: data
1470
+ }, true);
1471
+ }
1348
1472
  }
1349
1473
  DialogInteractionService.decorators = [
1350
1474
  { type: Injectable, args: [{
@@ -1388,16 +1512,18 @@ InteractionModule.decorators = [
1388
1512
  declarations: [
1389
1513
  ActivityContainerComponent,
1390
1514
  ConfirmationDialogComponent,
1515
+ ConfirmThenDialogComponent,
1391
1516
  AlertDialogComponent,
1392
1517
  ActivityOutletComponent
1393
1518
  ],
1394
1519
  exports: [
1395
1520
  ActivityContainerComponent,
1396
- ActivityOutletComponent
1521
+ ActivityOutletComponent,
1397
1522
  ],
1398
1523
  entryComponents: [
1399
1524
  ActivityContainerComponent,
1400
1525
  ConfirmationDialogComponent,
1526
+ ConfirmThenDialogComponent,
1401
1527
  AlertDialogComponent
1402
1528
  ],
1403
1529
  providers: [
@@ -3898,5 +4024,5 @@ var ParameterType;
3898
4024
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3899
4025
  */
3900
4026
 
3901
- export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, 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, AlertDialogComponent as ɵba, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbc, DialogInteractionService as ɵbd, InteractionContext as ɵbe, 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, ActivityOutletComponent as ɵv, ConfirmationDialogComponent as ɵw, AbstractActivity as ɵx, ACTIVITY_DATA as ɵy };
4027
+ export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, 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, ConfirmThenDialogComponent as ɵba, InteractionContext as ɵbb, AlertDialogComponent as ɵbc, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbe, DialogInteractionService as ɵbf, 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, ActivityOutletComponent as ɵv, ConfirmationDialogComponent as ɵw, AbstractActivity as ɵx, ACTIVITY_DATA as ɵy };
3902
4028
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map