@clr/angular 12.0.8 → 12.0.9

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.
@@ -17849,6 +17849,7 @@
17849
17849
  var _this = this;
17850
17850
  this.parentHost = parentHost;
17851
17851
  this.updateAnchor = false;
17852
+ this.recentlyOpened = false;
17852
17853
  this.popoverOptions = {};
17853
17854
  /*
17854
17855
  * Until https://github.com/angular/angular/issues/8785 is supported, we don't have any way to instantiate
@@ -17865,6 +17866,7 @@
17865
17866
  if (change) {
17866
17867
  _this.anchor();
17867
17868
  _this.attachESCListener();
17869
+ _this.setRecentlyOpened();
17868
17870
  }
17869
17871
  else {
17870
17872
  _this.release();
@@ -17874,6 +17876,7 @@
17874
17876
  if (this.toggleService.open) {
17875
17877
  this.anchor();
17876
17878
  this.attachESCListener();
17879
+ this.setRecentlyOpened();
17877
17880
  }
17878
17881
  }
17879
17882
  AbstractPopover.prototype.anchor = function () {
@@ -17939,7 +17942,7 @@
17939
17942
  this.ignoredElementClickListener = this.renderer.listen(this.ignoredElement, 'click', function (event) { return (_this.ignore = event); });
17940
17943
  }
17941
17944
  this.documentClickListener = this.renderer.listen('document', 'click', function (event) {
17942
- if (event === _this.ignore) {
17945
+ if (event === _this.ignore || _this.recentlyOpened) {
17943
17946
  delete _this.ignore;
17944
17947
  }
17945
17948
  else {
@@ -17964,6 +17967,13 @@
17964
17967
  }
17965
17968
  }
17966
17969
  };
17970
+ AbstractPopover.prototype.setRecentlyOpened = function () {
17971
+ var _this = this;
17972
+ this.recentlyOpened = true;
17973
+ setTimeout(function () {
17974
+ _this.recentlyOpened = false;
17975
+ });
17976
+ };
17967
17977
  return AbstractPopover;
17968
17978
  }());
17969
17979
  AbstractPopover.decorators = [
@@ -20368,7 +20378,7 @@
20368
20378
  { type: i0.Component, args: [{
20369
20379
  selector: 'clr-modal',
20370
20380
  viewProviders: [ScrollingService],
20371
- template: "<!--\n ~ Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved.\n ~ This software is released under MIT license.\n ~ The full license information can be found in LICENSE in the root directory of this project.\n -->\n\n<div clrFocusTrap class=\"modal\" *ngIf=\"_open\">\n <!--fixme: revisit when ngClass works with exit animation-->\n <div\n [@fadeDown]=\"skipAnimation\"\n (@fadeDown.done)=\"fadeDone($event)\"\n class=\"modal-dialog\"\n [class.modal-sm]=\"size == 'sm'\"\n [class.modal-lg]=\"size == 'lg'\"\n [class.modal-xl]=\"size == 'xl'\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-hidden]=\"!_open\"\n [attr.aria-labelledby]=\"modalId\"\n >\n <div class=\"clr-sr-only\">{{commonStrings.keys.modalContentStart}}</div>\n <div class=\"modal-content-wrapper\">\n <!-- only used in wizards -->\n <ng-content select=\".modal-nav\"></ng-content>\n\n <div class=\"modal-content\">\n <div class=\"modal-header--accessible\">\n <div class=\"modal-title-wrapper\" id=\"{{modalId}}\" clrFocusOnViewInit>\n <ng-content select=\".modal-title\"></ng-content>\n </div>\n <button\n type=\"button\"\n [attr.aria-label]=\"commonStrings.keys.close\"\n class=\"close\"\n *ngIf=\"closable\"\n (click)=\"close()\"\n >\n <cds-icon shape=\"window-close\"></cds-icon>\n </button>\n </div>\n <ng-content select=\".modal-body\"></ng-content>\n <ng-content select=\".modal-footer\"></ng-content>\n </div>\n </div>\n <div class=\"clr-sr-only\">{{commonStrings.keys.modalContentEnd}}</div>\n </div>\n\n <div [@fade] class=\"modal-backdrop\" aria-hidden=\"true\" (click)=\"staticBackdrop || close()\"></div>\n</div>\n",
20381
+ template: "<!--\n ~ Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n ~ This software is released under MIT license.\n ~ The full license information can be found in LICENSE in the root directory of this project.\n -->\n\n<div clrFocusTrap class=\"modal\" *ngIf=\"_open\">\n <!--fixme: revisit when ngClass works with exit animation-->\n <div\n [@fadeDown]=\"skipAnimation\"\n (@fadeDown.done)=\"fadeDone($event)\"\n class=\"modal-dialog\"\n [class.modal-sm]=\"size == 'sm'\"\n [class.modal-lg]=\"size == 'lg'\"\n [class.modal-xl]=\"size == 'xl'\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-hidden]=\"!_open\"\n [attr.aria-labelledby]=\"modalId\"\n >\n <div class=\"clr-sr-only\">{{commonStrings.keys.modalContentStart}}</div>\n <div class=\"modal-content-wrapper\">\n <!-- only used in wizards -->\n <ng-content select=\".modal-nav\"></ng-content>\n\n <div class=\"modal-content\">\n <div class=\"modal-header--accessible\">\n <div class=\"modal-title-wrapper\" id=\"{{modalId}}\" clrFocusOnViewInit>\n <ng-content select=\".modal-title\"></ng-content>\n </div>\n <button\n type=\"button\"\n [attr.aria-label]=\"commonStrings.keys.close\"\n class=\"close\"\n *ngIf=\"closable\"\n (click)=\"close()\"\n >\n <cds-icon shape=\"window-close\"></cds-icon>\n </button>\n </div>\n <div class=\"modal-body-wrapper\">\n <ng-content select=\".modal-body\"></ng-content>\n </div>\n <ng-content select=\".modal-footer\"></ng-content>\n </div>\n </div>\n <div class=\"clr-sr-only\">{{commonStrings.keys.modalContentEnd}}</div>\n </div>\n\n <div [@fade] class=\"modal-backdrop\" aria-hidden=\"true\" (click)=\"staticBackdrop || close()\"></div>\n</div>\n",
20372
20382
  animations: [
20373
20383
  animations.trigger('fadeDown', [
20374
20384
  animations.transition('* => false', [animations.style({ opacity: 0, transform: 'translate(0, -25%)' }), animations.animate('0.2s ease-in-out')]),
@@ -20403,7 +20413,7 @@
20403
20413
  };
20404
20414
 
20405
20415
  /*
20406
- * Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved.
20416
+ * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
20407
20417
  * This software is released under MIT license.
20408
20418
  * The full license information can be found in LICENSE in the root directory of this project.
20409
20419
  */
@@ -20414,19 +20424,21 @@
20414
20424
  * the overflow scroll being focused.
20415
20425
  */
20416
20426
  var ClrModalBody = /** @class */ (function () {
20417
- function ClrModalBody(ngZone, renderer, host) {
20427
+ function ClrModalBody(renderer, host, ngZone) {
20418
20428
  var _this = this;
20429
+ this.renderer = renderer;
20430
+ this.host = host;
20419
20431
  this.tabindex = '0';
20420
20432
  this.unlisteners = [];
20421
- renderer.setAttribute(host.nativeElement, 'tabindex', this.tabindex);
20422
20433
  ngZone.runOutsideAngular(function () {
20423
- _this.unlisteners.push(renderer.listen(host.nativeElement, 'mouseup', function () {
20434
+ new ResizeObserver(function () { return _this.addOrRemoveTabIndex(); }).observe(_this.host.nativeElement);
20435
+ _this.unlisteners.push(_this.renderer.listen(_this.host.nativeElement, 'mouseup', function () {
20424
20436
  // set the tabindex binding back when click is completed with mouseup
20425
- renderer.setAttribute(host.nativeElement, 'tabindex', _this.tabindex);
20426
- }), renderer.listen(host.nativeElement, 'mousedown', function () {
20437
+ _this.addOrRemoveTabIndex();
20438
+ }), _this.renderer.listen(_this.host.nativeElement, 'mousedown', function () {
20427
20439
  // tabindex = 0 binding should be removed
20428
20440
  // so it won't be focused when click starts with mousedown
20429
- renderer.removeAttribute(host.nativeElement, 'tabindex');
20441
+ _this.removeTabIndex();
20430
20442
  }));
20431
20443
  });
20432
20444
  }
@@ -20435,15 +20447,30 @@
20435
20447
  this.unlisteners.pop()();
20436
20448
  }
20437
20449
  };
20450
+ ClrModalBody.prototype.addTabIndex = function () {
20451
+ this.renderer.setAttribute(this.host.nativeElement, 'tabindex', this.tabindex);
20452
+ };
20453
+ ClrModalBody.prototype.removeTabIndex = function () {
20454
+ this.renderer.removeAttribute(this.host.nativeElement, 'tabindex');
20455
+ };
20456
+ ClrModalBody.prototype.addOrRemoveTabIndex = function () {
20457
+ var modalBody = this.host.nativeElement.parentElement;
20458
+ if (modalBody.clientHeight < modalBody.scrollHeight) {
20459
+ this.addTabIndex();
20460
+ }
20461
+ else {
20462
+ this.removeTabIndex();
20463
+ }
20464
+ };
20438
20465
  return ClrModalBody;
20439
20466
  }());
20440
20467
  ClrModalBody.decorators = [
20441
20468
  { type: i0.Directive, args: [{ selector: '.modal-body' },] }
20442
20469
  ];
20443
20470
  ClrModalBody.ctorParameters = function () { return [
20444
- { type: i0.NgZone },
20445
20471
  { type: i0.Renderer2 },
20446
- { type: i0.ElementRef }
20472
+ { type: i0.ElementRef },
20473
+ { type: i0.NgZone }
20447
20474
  ]; };
20448
20475
 
20449
20476
  /*
@@ -23752,10 +23779,11 @@
23752
23779
  };
23753
23780
  AccordionModel.prototype.togglePanel = function (panelId, open) {
23754
23781
  var panelIsOpen = this._panels[panelId].open;
23755
- if (this.strategy === AccordionStrategy.Default) {
23782
+ var newOpenState = open !== undefined ? open : !panelIsOpen;
23783
+ if (newOpenState && this.strategy === AccordionStrategy.Default) {
23756
23784
  this.closeAllPanels();
23757
23785
  }
23758
- this._panels[panelId].open = open !== undefined ? open : !panelIsOpen;
23786
+ this._panels[panelId].open = newOpenState;
23759
23787
  };
23760
23788
  AccordionModel.prototype.disablePanel = function (panelId, disabled) {
23761
23789
  this._panels[panelId].disabled = disabled;