@coolon/angular-ui-powerups 3.3.1 → 3.3.3

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 (35) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +42 -24
  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/components/table/table-row-menu/table-row-menu.component.js +2 -2
  13. package/esm2015/lib/components/table/table-row-menu/table-row-menu.component.js.map +1 -1
  14. package/esm2015/lib/components/table/table-row-menu/table-row-menu.component.metadata.json +1 -1
  15. package/esm2015/lib/directives/command.directive.js +36 -17
  16. package/esm2015/lib/directives/command.directive.js.map +1 -1
  17. package/esm2015/lib/directives/command.directive.metadata.json +1 -1
  18. package/esm2015/lib/directives/focus-binding.js +1 -1
  19. package/esm2015/lib/directives/focus-binding.js.map +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/place/components/abstract-place-navigation.component.js +1 -1
  23. package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
  24. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +1 -1
  25. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  26. package/esm2015/lib/place/place-component.js +1 -1
  27. package/esm2015/lib/place/place-component.js.map +1 -1
  28. package/fesm2015/coolon-angular-ui-powerups.js +45 -28
  29. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  30. package/lib/directives/command.directive.d.ts +5 -1
  31. package/package.json +1 -1
  32. package/schematics/bootstrap-app/index.js +4 -0
  33. package/schematics/bootstrap-app/index.js.map +1 -1
  34. package/schematics/ng-add/index.js +3 -2
  35. 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.3.3](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.3.2...v3.3.3) (2020-10-15)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * added missing import to bootstrap ([c5ad944](https://bitbucket.org/coolon/angular-ui-powerups/commit/c5ad944ff9dabfa214a39233a5c1a0454402573a))
11
+ * material buttons and menu items not disabling correctly ([1d449a7](https://bitbucket.org/coolon/angular-ui-powerups/commit/1d449a7720671ed4d86feb9c461bd3b148679e01))
12
+
13
+ ### [3.3.2](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.3.1...v3.3.2) (2020-10-13)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * table-row-menu not displaying faces correctly ([7968363](https://bitbucket.org/coolon/angular-ui-powerups/commit/79683633ef4e8bc9bc4302a834cfa66f22673ae4))
19
+
5
20
  ### [3.3.1](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.3.0...v3.3.1) (2020-09-22)
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);
@@ -3551,7 +3569,7 @@
3551
3569
  TableRowMenuComponent.decorators = [
3552
3570
  { type: i0.Component, args: [{
3553
3571
  selector: 'aup-table-row-menu',
3554
- template: "\n <aup-tool-bar>\n <aup-command *ngFor=\"let action of actions\" [command]=\"action.factory.create(value)\"\n [face]=\"action.faceModel\"></aup-command>\n </aup-tool-bar>\n <ng-container *ngIf=\"moreActions.length > 0\">\n <aup-more-menu>\n <aup-command *ngFor=\"let action of moreActions\" [command]=\"action.factory.create(value)\"\n [face]=\"action.faceModel\"></aup-command>\n </aup-more-menu>\n </ng-container>\n ",
3572
+ template: "\n <aup-tool-bar>\n <aup-command *ngFor=\"let action of actions\" [command]=\"action.factory.create(value)\"\n [face]=\"action.face\"></aup-command>\n </aup-tool-bar>\n <ng-container *ngIf=\"moreActions.length > 0\">\n <aup-more-menu>\n <aup-command *ngFor=\"let action of moreActions\" [command]=\"action.factory.create(value)\"\n [face]=\"action.face\"></aup-command>\n </aup-more-menu>\n </ng-container>\n ",
3555
3573
  styles: [":host {\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n }"]
3556
3574
  },] }
3557
3575
  ];
@@ -4703,7 +4721,7 @@
4703
4721
  var componentRef = overlayRef.attach(this.outputPortal);
4704
4722
  this.interactionContext = componentRef.instance;
4705
4723
  return new Promise(function (resolve, reject) {
4706
- // HACK: afterViewInit won't have been called yet. Need to add when.valueOf(interactionContext.ready).becomesTruthy(...)
4724
+ // HACK: afterViewInit won't have been called yet. Need to add when(interactionContext.ready).becomesTruthy(...)
4707
4725
  setTimeout(function () {
4708
4726
  _this.interactionContext.startActivity(activityType, data)
4709
4727
  .then(resolve)
@@ -5355,7 +5373,7 @@
5355
5373
  this.visitModel.value = visit;
5356
5374
  pectin.DebugContext.getOrCreate(this.visitModel).tag(this.placeDefinition.component.name + ".visitModel");
5357
5375
  this.placeDefinition.getVisitParameterDefs().forEach(function (parameterDef) { return _this.installBinding(parameterDef); });
5358
- when.valueOf(this.visitModel).changes(function (current, previous) {
5376
+ when(this.visitModel).changes(function (current, previous) {
5359
5377
  notifyVisitChanged(current, previous);
5360
5378
  }, { unless: this._inVisitUpdate });
5361
5379
  };
@@ -7180,7 +7198,7 @@
7180
7198
  this.onAnimationFinishedJob = finishPlaceLoad;
7181
7199
  }
7182
7200
  var _a = pectin.Dsl.disposeWith(activePlace), when = _a.when, chain = _a.chain, valueOf = _a.valueOf;
7183
- when.valueOf(this.routerVisitModel)
7201
+ when(this.routerVisitModel)
7184
7202
  .changes(function (visit) {
7185
7203
  activePlace.updateVisit(visit);
7186
7204
  }, {
@@ -7268,7 +7286,7 @@
7268
7286
  _this.commandFactory = pectin.Command.createFactory(function (placeDefinition) {
7269
7287
  _this.placeOutlet.navigate(new Visit(placeDefinition));
7270
7288
  });
7271
- when.valueOf(_this.placeOutletModel).changes(function (outlet) {
7289
+ when(_this.placeOutletModel).changes(function (outlet) {
7272
7290
  // NOTE: this updates during a change cycle and causes our isActiveMethod to return 2 different
7273
7291
  // values in the one change detection cycle. So instead we delay the update to a different
7274
7292
  // tick.