@coolon/angular-ui-powerups 3.3.2 → 3.4.0

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 (38) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +43 -32
  3. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  8. package/esm2015/lib/components/switch-case/switch-case.component.js +1 -1
  9. package/esm2015/lib/components/switch-case/switch-case.component.js.map +1 -1
  10. package/esm2015/lib/components/table/table-model.js +1 -1
  11. package/esm2015/lib/components/table/table-model.js.map +1 -1
  12. package/esm2015/lib/directives/command.directive.js +36 -17
  13. package/esm2015/lib/directives/command.directive.js.map +1 -1
  14. package/esm2015/lib/directives/command.directive.metadata.json +1 -1
  15. package/esm2015/lib/directives/focus-binding.js +1 -1
  16. package/esm2015/lib/directives/focus-binding.js.map +1 -1
  17. package/esm2015/lib/interaction/components/activity-actions/activity-actions.component.js +2 -10
  18. package/esm2015/lib/interaction/components/activity-actions/activity-actions.component.js.map +1 -1
  19. package/esm2015/lib/interaction/components/activity-actions/activity-actions.component.metadata.json +1 -1
  20. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +1 -1
  21. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -1
  22. package/esm2015/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  23. package/esm2015/lib/place/components/abstract-place-navigation.component.js +1 -1
  24. package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
  25. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +1 -1
  26. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  27. package/esm2015/lib/place/place-component.js +1 -1
  28. package/esm2015/lib/place/place-component.js.map +1 -1
  29. package/fesm2015/coolon-angular-ui-powerups.js +45 -35
  30. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  31. package/lib/directives/command.directive.d.ts +5 -1
  32. package/lib/interaction/components/activity-actions/activity-actions.component.d.ts +8 -4
  33. package/package.json +1 -1
  34. package/schematics/bootstrap-app/index.js +4 -0
  35. package/schematics/bootstrap-app/index.js.map +1 -1
  36. package/schematics/bootstrap-app/templates/i18n/aup/components.yml.template +70 -0
  37. package/schematics/ng-add/index.js +3 -2
  38. package/schematics/ng-add/index.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.4.0](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.3.3...v3.4.0) (2020-10-17)
6
+
7
+
8
+ ### Features
9
+
10
+ * updated aup-activity-actions to use faces ([a3e4990](https://bitbucket.org/coolon/angular-ui-powerups/commit/a3e4990664c5296d9c6f9eb79e55f8510afe6fca))
11
+
12
+ ### [3.3.3](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.3.2...v3.3.3) (2020-10-15)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * added missing import to bootstrap ([c5ad944](https://bitbucket.org/coolon/angular-ui-powerups/commit/c5ad944ff9dabfa214a39233a5c1a0454402573a))
18
+ * material buttons and menu items not disabling correctly ([1d449a7](https://bitbucket.org/coolon/angular-ui-powerups/commit/1d449a7720671ed4d86feb9c461bd3b148679e01))
19
+
5
20
  ### [3.3.2](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.3.1...v3.3.2) (2020-10-13)
6
21
 
7
22
 
@@ -313,11 +313,14 @@
313
313
 
314
314
  var CommandDirective = /** @class */ (function (_super) {
315
315
  __extends(CommandDirective, _super);
316
- function CommandDirective(elementRef) {
316
+ function CommandDirective(elementRef, matButton, matMenuItem) {
317
317
  var _this = _super.call(this) || this;
318
318
  _this.elementRef = elementRef;
319
319
  _this._commandEnabled = new pectin.DelegatingValueModel().withDefault(false);
320
320
  _this._commandParameterProvided = false;
321
+ // Material buttons and menu items don't respond to the disabled binding so we
322
+ // need to inject them from our host element and handle them manually.
323
+ _this.matControl = matButton || matMenuItem;
321
324
  return _this;
322
325
  }
323
326
  Object.defineProperty(CommandDirective.prototype, "pectinCommand", {
@@ -357,23 +360,36 @@
357
360
  };
358
361
  CommandDirective.prototype.ngAfterViewInit = function () {
359
362
  var _this = this;
360
- // for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
361
- // we need to do this.
362
363
  var when = pectin.Dsl.disposeWith(this).when;
363
- when.valueOf(this._commandEnabled).changes(function (enabled) {
364
- if (enabled) {
365
- _this.elementRef.nativeElement.removeAttribute('disabled');
366
- if (_this.elementRef.nativeElement.tagName === 'A') {
367
- _this.elementRef.nativeElement.setAttribute('href', 'javascript:void');
368
- }
364
+ when(this._commandEnabled).changes(function (enabled) { return _this.updateEnabledState(enabled); }, {
365
+ initialValue: 'triggerChange'
366
+ });
367
+ };
368
+ CommandDirective.prototype.updateEnabledState = function (enabled) {
369
+ var _this = this;
370
+ // for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
371
+ // we need to do this. The set timeout is required to prevent the button getting a expression changed
372
+ // when it's clicked.
373
+ if (this.matControl) {
374
+ setTimeout(function () {
375
+ _this.matControl.disabled = !enabled;
376
+ }, 0);
377
+ }
378
+ if (!enabled) {
379
+ // Note:
380
+ // We can't use a host binding here for disabled as the directive can be used on arbitrary
381
+ // components (e.g. divs) and the compiler will barf if we use the host binding.
382
+ this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
383
+ if (this.elementRef.nativeElement.tagName === 'A') {
384
+ this.elementRef.nativeElement.removeAttribute('href');
369
385
  }
370
- else {
371
- _this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
372
- if (_this.elementRef.nativeElement.tagName === 'A') {
373
- _this.elementRef.nativeElement.removeAttribute('href');
374
- }
386
+ }
387
+ else {
388
+ this.elementRef.nativeElement.removeAttribute('disabled');
389
+ if (this.elementRef.nativeElement.tagName === 'A') {
390
+ this.elementRef.nativeElement.setAttribute('href', 'javascript:void');
375
391
  }
376
- }, { initialValue: 'triggerChange' });
392
+ }
377
393
  };
378
394
  CommandDirective.prototype.ngOnDestroy = function () {
379
395
  this.dispose();
@@ -402,7 +418,9 @@
402
418
  },] }
403
419
  ];
404
420
  CommandDirective.ctorParameters = function () { return [
405
- { type: i0.ElementRef, decorators: [{ type: i0.Inject, args: [i0.ElementRef,] }] }
421
+ { type: i0.ElementRef, decorators: [{ type: i0.Inject, args: [i0.ElementRef,] }] },
422
+ { type: button.MatButton, decorators: [{ type: i0.Host }, { type: i0.Optional }] },
423
+ { type: menu.MatMenuItem, decorators: [{ type: i0.Host }, { type: i0.Optional }] }
406
424
  ]; };
407
425
  CommandDirective.propDecorators = {
408
426
  pectinCommand: [{ type: i0.Input }],
@@ -436,7 +454,7 @@
436
454
  _this.document = document;
437
455
  // TODO: Make this also track the current enabled/disabled state.
438
456
  var when = pectin.Dsl.disposeWith(_this).when;
439
- when.valueOf(_this.focusContext.focused).changes(function (focused) {
457
+ when(_this.focusContext.focused).changes(function (focused) {
440
458
  if (focused && !_this.alreadyHasFocus()) {
441
459
  _this.tryAndFocus();
442
460
  }
@@ -2405,7 +2423,7 @@
2405
2423
  var subscription = this.switchCaseOptions.changes.subscribe(function (change) { return _this.updateSelection(); });
2406
2424
  this.onDispose(function () { return subscription.unsubscribe(); });
2407
2425
  var _a = pectin.Dsl.disposeWith(this), chain = _a.chain, when = _a.when;
2408
- when.valueOf(this.switchModel).changes(function () { return _this.updateSelection(); }, { initialValue: 'triggerChange' });
2426
+ when(this.switchModel).changes(function () { return _this.updateSelection(); }, { initialValue: 'triggerChange' });
2409
2427
  this.cdr.detectChanges();
2410
2428
  };
2411
2429
  SwitchCaseComponent.prototype.updateSelection = function () {
@@ -3256,7 +3274,7 @@
3256
3274
  else {
3257
3275
  var editSession_1 = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
3258
3276
  var when = pectin.Dsl.disposeWith(editSession_1).when;
3259
- when.valueOf(editSession_1.liveRowValue).changes(function (editedValue) {
3277
+ when(editSession_1.liveRowValue).changes(function (editedValue) {
3260
3278
  _this._rowsBeingEdited.replaceOrPush(editedValue);
3261
3279
  }, { initialValue: 'triggerChangeUnlessNil' });
3262
3280
  this._editorSessions.push(editSession_1);
@@ -3844,12 +3862,6 @@
3844
3862
  });
3845
3863
  ActivityActionsComponent.prototype.ngOnInit = function () {
3846
3864
  };
3847
- ActivityActionsComponent.prototype.hasConfirmText = function () {
3848
- return !___default['default'].isEmpty(this.confirmText);
3849
- };
3850
- ActivityActionsComponent.prototype.hasCancelText = function () {
3851
- return !___default['default'].isEmpty(this.cancelText);
3852
- };
3853
3865
  ActivityActionsComponent.prototype.hasConfirmCommand = function () {
3854
3866
  return pectin.DelegatingCommand.hasDelegate(this.confirmCommand);
3855
3867
  };
@@ -3861,15 +3873,14 @@
3861
3873
  ActivityActionsComponent.decorators = [
3862
3874
  { type: i0.Component, args: [{
3863
3875
  selector: 'aup-activity-actions',
3864
- template: "<ng-container *ngIf=\"hasCancelCommand()\">\n <button class=\"cancel\" *ngIf=\"!hasCancelText()\" mat-icon-button [pectinCommand]=\"cancelCommand\">\n <aup-icon icon=\"mat:clear\"></aup-icon>\n </button>\n <button class=\"cancel\" *ngIf=\"hasCancelText()\" mat-button [pectinCommand]=\"cancelCommand\">{{cancelText}}</button>\n</ng-container>\n<ng-container *ngIf=\"hasConfirmCommand()\">\n <button class=\"confirm\" *ngIf=\"!hasConfirmText()\" mat-icon-button [pectinCommand]=\"confirmCommand\">\n <aup-icon icon=\"mat:done\"></aup-icon>\n </button>\n <button class=\"confirm\" *ngIf=\"hasConfirmText()\" mat-button [pectinCommand]=\"confirmCommand\">{{confirmText}}</button>\n</ng-container>\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n",
3876
+ template: "<ng-container *ngIf=\"hasCancelCommand()\">\n <aup-command class=\"cancel\" [command]=\"cancelCommand\" [face]=\"style.cancel\"></aup-command>\n</ng-container>\n<ng-container *ngIf=\"hasConfirmCommand()\">\n <aup-command class=\"confirm\" [command]=\"confirmCommand\" [face]=\"style.confirm\"></aup-command>\n</ng-container>\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n",
3865
3877
  styles: [":host{-ms-grid-columns:auto auto 1fr;-ms-grid-rows:auto;align-items:center;display:-ms-grid;display:grid;grid-template-areas:\"cancel confirm content\";grid-template-columns:auto auto 1fr;grid-template-rows:auto;justify-content:end}:host.align-end{-ms-grid-columns:1fr auto auto;grid-template-areas:\"content cancel confirm\";grid-template-columns:1fr auto auto}:host.align-stretch{-ms-grid-columns:auto 1fr auto;grid-template-areas:\"cancel content confirm\";grid-template-columns:auto 1fr auto}.cancel{-ms-grid-column:1;-ms-grid-row:1;grid-area:cancel}:host.align-end>.cancel{-ms-grid-column:2;-ms-grid-row:1}:host.align-stretch>.cancel{-ms-grid-column:1;-ms-grid-row:1}.confirm{-ms-grid-column:2;-ms-grid-row:1;grid-area:confirm}.column,:host.align-end>.confirm,:host.align-stretch>.confirm{-ms-grid-column:3;-ms-grid-row:1}.column{grid-area:content;text-align:left}:host.align-end>.column{-ms-grid-column:1;-ms-grid-row:1}:host.align-stretch>.column{-ms-grid-column:2;-ms-grid-row:1}"]
3866
3878
  },] }
3867
3879
  ];
3868
3880
  ActivityActionsComponent.propDecorators = {
3869
3881
  confirmCommand: [{ type: i0.Input }],
3870
- confirmText: [{ type: i0.Input }],
3871
3882
  cancelCommand: [{ type: i0.Input }],
3872
- cancelText: [{ type: i0.Input }],
3883
+ style: [{ type: i0.Input }],
3873
3884
  align: [{ type: i0.Input }],
3874
3885
  alignEnd: [{ type: i0.HostBinding, args: ['class.align-end',] }],
3875
3886
  alignStretch: [{ type: i0.HostBinding, args: ['class.align-stretch',] }]
@@ -4703,7 +4714,7 @@
4703
4714
  var componentRef = overlayRef.attach(this.outputPortal);
4704
4715
  this.interactionContext = componentRef.instance;
4705
4716
  return new Promise(function (resolve, reject) {
4706
- // HACK: afterViewInit won't have been called yet. Need to add when.valueOf(interactionContext.ready).becomesTruthy(...)
4717
+ // HACK: afterViewInit won't have been called yet. Need to add when(interactionContext.ready).becomesTruthy(...)
4707
4718
  setTimeout(function () {
4708
4719
  _this.interactionContext.startActivity(activityType, data)
4709
4720
  .then(resolve)
@@ -5355,7 +5366,7 @@
5355
5366
  this.visitModel.value = visit;
5356
5367
  pectin.DebugContext.getOrCreate(this.visitModel).tag(this.placeDefinition.component.name + ".visitModel");
5357
5368
  this.placeDefinition.getVisitParameterDefs().forEach(function (parameterDef) { return _this.installBinding(parameterDef); });
5358
- when.valueOf(this.visitModel).changes(function (current, previous) {
5369
+ when(this.visitModel).changes(function (current, previous) {
5359
5370
  notifyVisitChanged(current, previous);
5360
5371
  }, { unless: this._inVisitUpdate });
5361
5372
  };
@@ -7180,7 +7191,7 @@
7180
7191
  this.onAnimationFinishedJob = finishPlaceLoad;
7181
7192
  }
7182
7193
  var _a = pectin.Dsl.disposeWith(activePlace), when = _a.when, chain = _a.chain, valueOf = _a.valueOf;
7183
- when.valueOf(this.routerVisitModel)
7194
+ when(this.routerVisitModel)
7184
7195
  .changes(function (visit) {
7185
7196
  activePlace.updateVisit(visit);
7186
7197
  }, {
@@ -7268,7 +7279,7 @@
7268
7279
  _this.commandFactory = pectin.Command.createFactory(function (placeDefinition) {
7269
7280
  _this.placeOutlet.navigate(new Visit(placeDefinition));
7270
7281
  });
7271
- when.valueOf(_this.placeOutletModel).changes(function (outlet) {
7282
+ when(_this.placeOutletModel).changes(function (outlet) {
7272
7283
  // NOTE: this updates during a change cycle and causes our isActiveMethod to return 2 different
7273
7284
  // values in the one change detection cycle. So instead we delay the update to a different
7274
7285
  // tick.