@coolon/angular-ui-powerups 0.0.60 → 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 (39) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +198 -18
  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 -9
  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 -9
  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 -15
  30. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  31. package/fesm5/coolon-angular-ui-powerups.js +195 -16
  32. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  33. package/lib/interaction/components/activity-container/activity-container.component.d.ts +1 -0
  34. package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +2 -0
  35. package/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.d.ts +22 -0
  36. package/lib/interaction/index.d.ts +1 -0
  37. package/lib/interaction/interaction-context.d.ts +7 -0
  38. package/lib/interaction/services/dialog-interaction.service.d.ts +1 -0
  39. 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
@@ -945,12 +969,6 @@ class AbstractActivity extends DisposableComponent {
945
969
  return this._busyModel.value;
946
970
  }
947
971
  }
948
- __decorate([
949
- Trace(),
950
- __metadata("design:type", Function),
951
- __metadata("design:paramtypes", [Object]),
952
- __metadata("design:returntype", void 0)
953
- ], AbstractActivity.prototype, "initialise", null);
954
972
  if (false) {
955
973
  /**
956
974
  * @type {?}
@@ -998,6 +1016,93 @@ if (false) {
998
1016
  AlertDialogComponent.prototype.alert;
999
1017
  }
1000
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
+
1001
1106
  /**
1002
1107
  * @fileoverview added by tsickle
1003
1108
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -1162,6 +1267,20 @@ class ActivityContainerComponent extends DisposableComponent {
1162
1267
  confirm(confirm) {
1163
1268
  return this.startActivity(ConfirmationDialogComponent, confirm);
1164
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
+ }
1165
1284
  /**
1166
1285
  * @private
1167
1286
  * @return {?}
@@ -1336,6 +1455,20 @@ class DialogInteractionService extends InteractionContext {
1336
1455
  confirm(confirm) {
1337
1456
  return this._startActivity(ConfirmationDialogComponent, confirm, true);
1338
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
+ }
1339
1472
  }
1340
1473
  DialogInteractionService.decorators = [
1341
1474
  { type: Injectable, args: [{
@@ -1379,16 +1512,18 @@ InteractionModule.decorators = [
1379
1512
  declarations: [
1380
1513
  ActivityContainerComponent,
1381
1514
  ConfirmationDialogComponent,
1515
+ ConfirmThenDialogComponent,
1382
1516
  AlertDialogComponent,
1383
1517
  ActivityOutletComponent
1384
1518
  ],
1385
1519
  exports: [
1386
1520
  ActivityContainerComponent,
1387
- ActivityOutletComponent
1521
+ ActivityOutletComponent,
1388
1522
  ],
1389
1523
  entryComponents: [
1390
1524
  ActivityContainerComponent,
1391
1525
  ConfirmationDialogComponent,
1526
+ ConfirmThenDialogComponent,
1392
1527
  AlertDialogComponent
1393
1528
  ],
1394
1529
  providers: [
@@ -3889,5 +4024,5 @@ var ParameterType;
3889
4024
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3890
4025
  */
3891
4026
 
3892
- 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 };
3893
4028
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map