@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 { __extends, __decorate, __metadata, __assign, __awaiter, __generator } 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';
@@ -824,6 +824,16 @@ if (false) {
824
824
  * @return {?}
825
825
  */
826
826
  InteractionContext.prototype.confirm = function (confirm) { };
827
+ /**
828
+ * Presents the confirmation to the user and runs the activity only if the user confirms.
829
+ * @abstract
830
+ * @template D, R, E
831
+ * @param {?} confirm
832
+ * @param {?} activityType the activity to run if confirmed.
833
+ * @param {?=} data the activity data.
834
+ * @return {?}
835
+ */
836
+ InteractionContext.prototype.confirmThen = function (confirm, activityType, data) { };
827
837
  /**
828
838
  * @abstract
829
839
  * @param {?} alert
@@ -939,6 +949,23 @@ var ActivityOutletComponent = /** @class */ (function () {
939
949
  function (confirm) {
940
950
  return this.interactionContext.confirm(confirm);
941
951
  };
952
+ /**
953
+ * @template D1, R1, E1
954
+ * @param {?} confirm
955
+ * @param {?} activityType
956
+ * @param {?=} data
957
+ * @return {?}
958
+ */
959
+ ActivityOutletComponent.prototype.confirmThen = /**
960
+ * @template D1, R1, E1
961
+ * @param {?} confirm
962
+ * @param {?} activityType
963
+ * @param {?=} data
964
+ * @return {?}
965
+ */
966
+ function (confirm, activityType, data) {
967
+ return this.interactionContext.confirmThen(confirm, activityType, data);
968
+ };
942
969
  /**
943
970
  * @template D1, R1, E1
944
971
  * @param {?} activityType
@@ -982,12 +1009,6 @@ var ActivityOutletComponent = /** @class */ (function () {
982
1009
  interactionContext: [{ type: Input }],
983
1010
  activityContext: [{ type: Input }]
984
1011
  };
985
- __decorate([
986
- Trace(),
987
- __metadata("design:type", Function),
988
- __metadata("design:paramtypes", [Object]),
989
- __metadata("design:returntype", void 0)
990
- ], ActivityOutletComponent.prototype, "loadActivity", null);
991
1012
  return ActivityOutletComponent;
992
1013
  }());
993
1014
  if (false) {
@@ -1048,6 +1069,23 @@ if (false) {
1048
1069
  function (confirm) {
1049
1070
  return lang.notImplemented();
1050
1071
  };
1072
+ /**
1073
+ * @template D1, R1, E1
1074
+ * @param {?} confirm
1075
+ * @param {?} activityType
1076
+ * @param {?=} data
1077
+ * @return {?}
1078
+ */
1079
+ OutletInteractionContext.prototype.confirmThen = /**
1080
+ * @template D1, R1, E1
1081
+ * @param {?} confirm
1082
+ * @param {?} activityType
1083
+ * @param {?=} data
1084
+ * @return {?}
1085
+ */
1086
+ function (confirm, activityType, data) {
1087
+ return lang.notImplemented();
1088
+ };
1051
1089
  /**
1052
1090
  * @template D1, R1, E1
1053
1091
  * @param {?} activityType
@@ -1082,7 +1120,10 @@ if (false) {
1082
1120
  /**
1083
1121
  * @template D, R, E
1084
1122
  */
1085
- var AbstractActivity = /** @class */ (function (_super) {
1123
+ var /**
1124
+ * @template D, R, E
1125
+ */
1126
+ AbstractActivity = /** @class */ (function (_super) {
1086
1127
  __extends(AbstractActivity, _super);
1087
1128
  function AbstractActivity() {
1088
1129
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -1165,12 +1206,6 @@ var AbstractActivity = /** @class */ (function (_super) {
1165
1206
  function () {
1166
1207
  return this._busyModel.value;
1167
1208
  };
1168
- __decorate([
1169
- Trace(),
1170
- __metadata("design:type", Function),
1171
- __metadata("design:paramtypes", [Object]),
1172
- __metadata("design:returntype", void 0)
1173
- ], AbstractActivity.prototype, "initialise", null);
1174
1209
  return AbstractActivity;
1175
1210
  }(DisposableComponent));
1176
1211
  if (false) {
@@ -1223,6 +1258,106 @@ if (false) {
1223
1258
  AlertDialogComponent.prototype.alert;
1224
1259
  }
1225
1260
 
1261
+ /**
1262
+ * @fileoverview added by tsickle
1263
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1264
+ */
1265
+ /**
1266
+ * @template D, R, E
1267
+ */
1268
+ var ConfirmThenDialogComponent = /** @class */ (function (_super) {
1269
+ __extends(ConfirmThenDialogComponent, _super);
1270
+ function ConfirmThenDialogComponent(config, interactionContext) {
1271
+ var _this = _super.call(this) || this;
1272
+ _this.config = config;
1273
+ _this.interactionContext = interactionContext;
1274
+ assert.notNil(config);
1275
+ return _this;
1276
+ }
1277
+ /**
1278
+ * @return {?}
1279
+ */
1280
+ ConfirmThenDialogComponent.prototype.ngOnInit = /**
1281
+ * @return {?}
1282
+ */
1283
+ function () {
1284
+ };
1285
+ Object.defineProperty(ConfirmThenDialogComponent.prototype, "confirm", {
1286
+ get: /**
1287
+ * @return {?}
1288
+ */
1289
+ function () {
1290
+ return this.config.confirm;
1291
+ },
1292
+ enumerable: true,
1293
+ configurable: true
1294
+ });
1295
+ /**
1296
+ * @return {?}
1297
+ */
1298
+ ConfirmThenDialogComponent.prototype.isDestructive = /**
1299
+ * @return {?}
1300
+ */
1301
+ function () {
1302
+ return this.confirm.destructive && this.confirm.destructive();
1303
+ };
1304
+ /**
1305
+ * @return {?}
1306
+ */
1307
+ ConfirmThenDialogComponent.prototype.onConfirm = /**
1308
+ * @return {?}
1309
+ */
1310
+ function () {
1311
+ var _this = this;
1312
+ this.interactionContext.startActivity(this.config.activityType, this.config.data)
1313
+ .then((/**
1314
+ * @param {?} result
1315
+ * @return {?}
1316
+ */
1317
+ function (result) { return _this.done(result); }))
1318
+ .catch((/**
1319
+ * @param {?} error
1320
+ * @return {?}
1321
+ */
1322
+ function (error) { return _this.cancel(error); }));
1323
+ };
1324
+ ConfirmThenDialogComponent.decorators = [
1325
+ { type: Component, args: [{
1326
+ selector: 'angular-ui-powerups-confirmation-dialog',
1327
+ 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",
1328
+ styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1329
+ }] }
1330
+ ];
1331
+ /** @nocollapse */
1332
+ ConfirmThenDialogComponent.ctorParameters = function () { return [
1333
+ { type: undefined, decorators: [{ type: Inject, args: [ACTIVITY_DATA,] }] },
1334
+ { type: InteractionContext }
1335
+ ]; };
1336
+ return ConfirmThenDialogComponent;
1337
+ }(AbstractActivity));
1338
+ if (false) {
1339
+ /** @type {?} */
1340
+ ConfirmThenDialogComponent.prototype.config;
1341
+ /** @type {?} */
1342
+ ConfirmThenDialogComponent.prototype.interactionContext;
1343
+ }
1344
+ (function (ConfirmThenDialogComponent) {
1345
+ /**
1346
+ * @record
1347
+ * @template D, R, E
1348
+ */
1349
+ function Data() { }
1350
+ ConfirmThenDialogComponent.Data = Data;
1351
+ if (false) {
1352
+ /** @type {?} */
1353
+ Data.prototype.confirm;
1354
+ /** @type {?} */
1355
+ Data.prototype.activityType;
1356
+ /** @type {?} */
1357
+ Data.prototype.data;
1358
+ }
1359
+ })(ConfirmThenDialogComponent || (ConfirmThenDialogComponent = {}));
1360
+
1226
1361
  /**
1227
1362
  * @fileoverview added by tsickle
1228
1363
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -1422,6 +1557,27 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1422
1557
  function (confirm) {
1423
1558
  return this.startActivity(ConfirmationDialogComponent, confirm);
1424
1559
  };
1560
+ /**
1561
+ * @template D, R, E
1562
+ * @param {?} confirm
1563
+ * @param {?} activityType
1564
+ * @param {?=} data
1565
+ * @return {?}
1566
+ */
1567
+ ActivityContainerComponent.prototype.confirmThen = /**
1568
+ * @template D, R, E
1569
+ * @param {?} confirm
1570
+ * @param {?} activityType
1571
+ * @param {?=} data
1572
+ * @return {?}
1573
+ */
1574
+ function (confirm, activityType, data) {
1575
+ return this.startActivity(ConfirmThenDialogComponent, {
1576
+ confirm: confirm,
1577
+ activityType: activityType,
1578
+ data: data
1579
+ });
1580
+ };
1425
1581
  /**
1426
1582
  * @private
1427
1583
  * @return {?}
@@ -1627,6 +1783,27 @@ var DialogInteractionService = /** @class */ (function (_super) {
1627
1783
  function (confirm) {
1628
1784
  return this._startActivity(ConfirmationDialogComponent, confirm, true);
1629
1785
  };
1786
+ /**
1787
+ * @template D, R, E
1788
+ * @param {?} confirm
1789
+ * @param {?} activityType
1790
+ * @param {?=} data
1791
+ * @return {?}
1792
+ */
1793
+ DialogInteractionService.prototype.confirmThen = /**
1794
+ * @template D, R, E
1795
+ * @param {?} confirm
1796
+ * @param {?} activityType
1797
+ * @param {?=} data
1798
+ * @return {?}
1799
+ */
1800
+ function (confirm, activityType, data) {
1801
+ return this._startActivity(ConfirmThenDialogComponent, {
1802
+ confirm: confirm,
1803
+ activityType: activityType,
1804
+ data: data
1805
+ }, true);
1806
+ };
1630
1807
  DialogInteractionService.decorators = [
1631
1808
  { type: Injectable, args: [{
1632
1809
  providedIn: 'root'
@@ -1672,16 +1849,18 @@ var InteractionModule = /** @class */ (function () {
1672
1849
  declarations: [
1673
1850
  ActivityContainerComponent,
1674
1851
  ConfirmationDialogComponent,
1852
+ ConfirmThenDialogComponent,
1675
1853
  AlertDialogComponent,
1676
1854
  ActivityOutletComponent
1677
1855
  ],
1678
1856
  exports: [
1679
1857
  ActivityContainerComponent,
1680
- ActivityOutletComponent
1858
+ ActivityOutletComponent,
1681
1859
  ],
1682
1860
  entryComponents: [
1683
1861
  ActivityContainerComponent,
1684
1862
  ConfirmationDialogComponent,
1863
+ ConfirmThenDialogComponent,
1685
1864
  AlertDialogComponent
1686
1865
  ],
1687
1866
  providers: [
@@ -4598,5 +4777,5 @@ var ParameterType;
4598
4777
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4599
4778
  */
4600
4779
 
4601
- 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 };
4780
+ 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 };
4602
4781
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map