@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
@@ -1008,6 +1008,16 @@
1008
1008
  * @return {?}
1009
1009
  */
1010
1010
  InteractionContext.prototype.confirm = function (confirm) { };
1011
+ /**
1012
+ * Presents the confirmation to the user and runs the activity only if the user confirms.
1013
+ * @abstract
1014
+ * @template D, R, E
1015
+ * @param {?} confirm
1016
+ * @param {?} activityType the activity to run if confirmed.
1017
+ * @param {?=} data the activity data.
1018
+ * @return {?}
1019
+ */
1020
+ InteractionContext.prototype.confirmThen = function (confirm, activityType, data) { };
1011
1021
  /**
1012
1022
  * @abstract
1013
1023
  * @param {?} alert
@@ -1123,6 +1133,23 @@
1123
1133
  function (confirm) {
1124
1134
  return this.interactionContext.confirm(confirm);
1125
1135
  };
1136
+ /**
1137
+ * @template D1, R1, E1
1138
+ * @param {?} confirm
1139
+ * @param {?} activityType
1140
+ * @param {?=} data
1141
+ * @return {?}
1142
+ */
1143
+ ActivityOutletComponent.prototype.confirmThen = /**
1144
+ * @template D1, R1, E1
1145
+ * @param {?} confirm
1146
+ * @param {?} activityType
1147
+ * @param {?=} data
1148
+ * @return {?}
1149
+ */
1150
+ function (confirm, activityType, data) {
1151
+ return this.interactionContext.confirmThen(confirm, activityType, data);
1152
+ };
1126
1153
  /**
1127
1154
  * @template D1, R1, E1
1128
1155
  * @param {?} activityType
@@ -1166,12 +1193,6 @@
1166
1193
  interactionContext: [{ type: core.Input }],
1167
1194
  activityContext: [{ type: core.Input }]
1168
1195
  };
1169
- __decorate([
1170
- pectin.Trace(),
1171
- __metadata("design:type", Function),
1172
- __metadata("design:paramtypes", [Object]),
1173
- __metadata("design:returntype", void 0)
1174
- ], ActivityOutletComponent.prototype, "loadActivity", null);
1175
1196
  return ActivityOutletComponent;
1176
1197
  }());
1177
1198
  if (false) {
@@ -1232,6 +1253,23 @@
1232
1253
  function (confirm) {
1233
1254
  return pectin.lang.notImplemented();
1234
1255
  };
1256
+ /**
1257
+ * @template D1, R1, E1
1258
+ * @param {?} confirm
1259
+ * @param {?} activityType
1260
+ * @param {?=} data
1261
+ * @return {?}
1262
+ */
1263
+ OutletInteractionContext.prototype.confirmThen = /**
1264
+ * @template D1, R1, E1
1265
+ * @param {?} confirm
1266
+ * @param {?} activityType
1267
+ * @param {?=} data
1268
+ * @return {?}
1269
+ */
1270
+ function (confirm, activityType, data) {
1271
+ return pectin.lang.notImplemented();
1272
+ };
1235
1273
  /**
1236
1274
  * @template D1, R1, E1
1237
1275
  * @param {?} activityType
@@ -1266,7 +1304,10 @@
1266
1304
  /**
1267
1305
  * @template D, R, E
1268
1306
  */
1269
- var AbstractActivity = /** @class */ (function (_super) {
1307
+ var /**
1308
+ * @template D, R, E
1309
+ */
1310
+ AbstractActivity = /** @class */ (function (_super) {
1270
1311
  __extends(AbstractActivity, _super);
1271
1312
  function AbstractActivity() {
1272
1313
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -1307,31 +1348,12 @@
1307
1348
  function (error) {
1308
1349
  this.activityContext.onCancel(error);
1309
1350
  };
1310
- Object.defineProperty(AbstractActivity.prototype, "data", {
1311
- get: /**
1312
- * @return {?}
1313
- */
1314
- function () {
1315
- return this.activityContext.activityData;
1316
- },
1317
- enumerable: true,
1318
- configurable: true
1319
- });
1320
- // get interactionContext(): InteractionContext {
1321
- // return this.activityContext.interactionContext;
1322
- // }
1323
1351
  // @Trace()
1324
- // get interactionContext(): InteractionContext {
1325
- // return this.activityContext.interactionContext;
1326
- // }
1327
1352
  // @Trace()
1328
1353
  /**
1329
1354
  * @return {?}
1330
1355
  */
1331
1356
  AbstractActivity.prototype.onActivityReady =
1332
- // get interactionContext(): InteractionContext {
1333
- // return this.activityContext.interactionContext;
1334
- // }
1335
1357
  // @Trace()
1336
1358
  /**
1337
1359
  * @return {?}
@@ -1368,12 +1390,6 @@
1368
1390
  function () {
1369
1391
  return this._busyModel.value;
1370
1392
  };
1371
- __decorate([
1372
- pectin.Trace(),
1373
- __metadata("design:type", Function),
1374
- __metadata("design:paramtypes", [Object]),
1375
- __metadata("design:returntype", void 0)
1376
- ], AbstractActivity.prototype, "initialise", null);
1377
1393
  return AbstractActivity;
1378
1394
  }(DisposableComponent));
1379
1395
  if (false) {
@@ -1426,6 +1442,106 @@
1426
1442
  AlertDialogComponent.prototype.alert;
1427
1443
  }
1428
1444
 
1445
+ /**
1446
+ * @fileoverview added by tsickle
1447
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1448
+ */
1449
+ /**
1450
+ * @template D, R, E
1451
+ */
1452
+ exports.ɵba = /** @class */ (function (_super) {
1453
+ __extends(ConfirmThenDialogComponent, _super);
1454
+ function ConfirmThenDialogComponent(config, interactionContext) {
1455
+ var _this = _super.call(this) || this;
1456
+ _this.config = config;
1457
+ _this.interactionContext = interactionContext;
1458
+ pectin.assert.notNil(config);
1459
+ return _this;
1460
+ }
1461
+ /**
1462
+ * @return {?}
1463
+ */
1464
+ ConfirmThenDialogComponent.prototype.ngOnInit = /**
1465
+ * @return {?}
1466
+ */
1467
+ function () {
1468
+ };
1469
+ Object.defineProperty(ConfirmThenDialogComponent.prototype, "confirm", {
1470
+ get: /**
1471
+ * @return {?}
1472
+ */
1473
+ function () {
1474
+ return this.config.confirm;
1475
+ },
1476
+ enumerable: true,
1477
+ configurable: true
1478
+ });
1479
+ /**
1480
+ * @return {?}
1481
+ */
1482
+ ConfirmThenDialogComponent.prototype.isDestructive = /**
1483
+ * @return {?}
1484
+ */
1485
+ function () {
1486
+ return this.confirm.destructive && this.confirm.destructive();
1487
+ };
1488
+ /**
1489
+ * @return {?}
1490
+ */
1491
+ ConfirmThenDialogComponent.prototype.onConfirm = /**
1492
+ * @return {?}
1493
+ */
1494
+ function () {
1495
+ var _this = this;
1496
+ this.interactionContext.startActivity(this.config.activityType, this.config.data)
1497
+ .then((/**
1498
+ * @param {?} result
1499
+ * @return {?}
1500
+ */
1501
+ function (result) { return _this.done(result); }))
1502
+ .catch((/**
1503
+ * @param {?} error
1504
+ * @return {?}
1505
+ */
1506
+ function (error) { return _this.cancel(error); }));
1507
+ };
1508
+ ConfirmThenDialogComponent.decorators = [
1509
+ { type: core.Component, args: [{
1510
+ selector: 'angular-ui-powerups-confirmation-dialog',
1511
+ 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",
1512
+ styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1513
+ }] }
1514
+ ];
1515
+ /** @nocollapse */
1516
+ ConfirmThenDialogComponent.ctorParameters = function () { return [
1517
+ { type: undefined, decorators: [{ type: core.Inject, args: [ACTIVITY_DATA,] }] },
1518
+ { type: InteractionContext }
1519
+ ]; };
1520
+ return ConfirmThenDialogComponent;
1521
+ }(AbstractActivity));
1522
+ if (false) {
1523
+ /** @type {?} */
1524
+ exports.ɵba.prototype.config;
1525
+ /** @type {?} */
1526
+ exports.ɵba.prototype.interactionContext;
1527
+ }
1528
+ (function (ConfirmThenDialogComponent) {
1529
+ /**
1530
+ * @record
1531
+ * @template D, R, E
1532
+ */
1533
+ function Data() { }
1534
+ ConfirmThenDialogComponent.Data = Data;
1535
+ if (false) {
1536
+ /** @type {?} */
1537
+ Data.prototype.confirm;
1538
+ /** @type {?} */
1539
+ Data.prototype.activityType;
1540
+ /** @type {?} */
1541
+ Data.prototype.data;
1542
+ }
1543
+ })(exports.ɵba || (exports.ɵba = {}));
1544
+
1429
1545
  /**
1430
1546
  * @fileoverview added by tsickle
1431
1547
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -1625,6 +1741,27 @@
1625
1741
  function (confirm) {
1626
1742
  return this.startActivity(ConfirmationDialogComponent, confirm);
1627
1743
  };
1744
+ /**
1745
+ * @template D, R, E
1746
+ * @param {?} confirm
1747
+ * @param {?} activityType
1748
+ * @param {?=} data
1749
+ * @return {?}
1750
+ */
1751
+ ActivityContainerComponent.prototype.confirmThen = /**
1752
+ * @template D, R, E
1753
+ * @param {?} confirm
1754
+ * @param {?} activityType
1755
+ * @param {?=} data
1756
+ * @return {?}
1757
+ */
1758
+ function (confirm, activityType, data) {
1759
+ return this.startActivity(exports.ɵba, {
1760
+ confirm: confirm,
1761
+ activityType: activityType,
1762
+ data: data
1763
+ });
1764
+ };
1628
1765
  /**
1629
1766
  * @private
1630
1767
  * @return {?}
@@ -1830,6 +1967,27 @@
1830
1967
  function (confirm) {
1831
1968
  return this._startActivity(ConfirmationDialogComponent, confirm, true);
1832
1969
  };
1970
+ /**
1971
+ * @template D, R, E
1972
+ * @param {?} confirm
1973
+ * @param {?} activityType
1974
+ * @param {?=} data
1975
+ * @return {?}
1976
+ */
1977
+ DialogInteractionService.prototype.confirmThen = /**
1978
+ * @template D, R, E
1979
+ * @param {?} confirm
1980
+ * @param {?} activityType
1981
+ * @param {?=} data
1982
+ * @return {?}
1983
+ */
1984
+ function (confirm, activityType, data) {
1985
+ return this._startActivity(exports.ɵba, {
1986
+ confirm: confirm,
1987
+ activityType: activityType,
1988
+ data: data
1989
+ }, true);
1990
+ };
1833
1991
  DialogInteractionService.decorators = [
1834
1992
  { type: core.Injectable, args: [{
1835
1993
  providedIn: 'root'
@@ -1875,16 +2033,18 @@
1875
2033
  declarations: [
1876
2034
  exports.ɵu,
1877
2035
  ConfirmationDialogComponent,
2036
+ exports.ɵba,
1878
2037
  AlertDialogComponent,
1879
2038
  exports.ɵv
1880
2039
  ],
1881
2040
  exports: [
1882
2041
  exports.ɵu,
1883
- exports.ɵv
2042
+ exports.ɵv,
1884
2043
  ],
1885
2044
  entryComponents: [
1886
2045
  exports.ɵu,
1887
2046
  ConfirmationDialogComponent,
2047
+ exports.ɵba,
1888
2048
  AlertDialogComponent
1889
2049
  ],
1890
2050
  providers: [
@@ -4791,6 +4951,7 @@
4791
4951
  exports.AngularUiPowerupsModule = AngularUiPowerupsModule;
4792
4952
  exports.BusyOverlayComponent = BusyOverlayComponent;
4793
4953
  exports.CommandDirective = CommandDirective;
4954
+ exports.ConfirmThenDialogComponent = exports.ɵba;
4794
4955
  exports.ConfirmationDialogComponent = ConfirmationDialogComponent;
4795
4956
  exports.DEFINITION_META_DATA_KEY = DEFINITION_META_DATA_KEY;
4796
4957
  exports.DIALOG_INTERACTION_SERVICE_DEFAULTS = DIALOG_INTERACTION_SERVICE_DEFAULTS;
@@ -4827,10 +4988,10 @@
4827
4988
  exports.slideDownAndUpAnimation = slideDownAndUpAnimation;
4828
4989
  exports.ɵa = CommandDirective;
4829
4990
  exports.ɵb = FocusBindingDirective;
4830
- exports.ɵba = AlertDialogComponent;
4831
- exports.ɵbc = DIALOG_INTERACTION_SERVICE_DEFAULTS;
4832
- exports.ɵbd = DialogInteractionService;
4833
- exports.ɵbe = InteractionContext;
4991
+ exports.ɵbb = InteractionContext;
4992
+ exports.ɵbc = AlertDialogComponent;
4993
+ exports.ɵbe = DIALOG_INTERACTION_SERVICE_DEFAULTS;
4994
+ exports.ɵbf = DialogInteractionService;
4834
4995
  exports.ɵc = DisposableComponent;
4835
4996
  exports.ɵd = NumberInputComponent;
4836
4997
  exports.ɵe = AbstractInputComponent;