@clr/angular 15.5.1 → 15.7.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.
@@ -3,7 +3,7 @@ import { Directive, NgModule, Optional, Input, Injectable, Component, ChangeDete
3
3
  import * as i5 from '@angular/common';
4
4
  import { CommonModule, isPlatformBrowser, DOCUMENT, NgForOf, getLocaleDayNames, FormStyle, TranslationWidth, getLocaleMonthNames, getLocaleFirstDayOfWeek, getLocaleDateFormat, FormatWidth } from '@angular/common';
5
5
  import { ClarityIcons, angleIcon, exclamationCircleIcon, checkCircleIcon, ellipsisHorizontalIcon, windowCloseIcon, eventIcon, calendarIcon, eyeHideIcon, eyeIcon, ellipsisVerticalIcon, viewColumnsIcon, arrowIcon, timesIcon, stepForward2Icon, angleDoubleIcon, filterGridCircleIcon, filterGridIcon, infoCircleIcon, exclamationTriangleIcon, circleIcon, dotCircleIcon, errorStandardIcon, successStandardIcon } from '@cds/core/icon';
6
- import { map, tap, startWith, distinctUntilChanged, pairwise, filter, debounceTime, takeUntil, delay, take, first, switchMap } from 'rxjs/operators';
6
+ import { map, tap, startWith, distinctUntilChanged, pairwise, filter, debounceTime, takeUntil, take, first, switchMap } from 'rxjs/operators';
7
7
  import * as i3 from 'rxjs';
8
8
  import { Subject, BehaviorSubject, Observable, fromEvent, isObservable, of, ReplaySubject, combineLatest, merge } from 'rxjs';
9
9
  import { trigger, transition, style, animate, state, keyframes } from '@angular/animations';
@@ -1422,10 +1422,14 @@ class ClrPopoverToggleService {
1422
1422
  this._openChange = new Subject();
1423
1423
  this._openEventChange = new Subject();
1424
1424
  this._popoverAligned = new Subject();
1425
+ this._popoverVisible = new Subject();
1425
1426
  }
1426
1427
  get openChange() {
1427
1428
  return this._openChange.asObservable();
1428
1429
  }
1430
+ get popoverVisible() {
1431
+ return this._popoverVisible.asObservable();
1432
+ }
1429
1433
  get openEvent() {
1430
1434
  return this._openEvent;
1431
1435
  }
@@ -1462,6 +1466,9 @@ class ClrPopoverToggleService {
1462
1466
  this.openEvent = event;
1463
1467
  this.open = !this.open;
1464
1468
  }
1469
+ popoverVisibleEmit(visible) {
1470
+ this._popoverVisible.next(visible);
1471
+ }
1465
1472
  popoverAlignedEmit(popoverNode) {
1466
1473
  this._popoverAligned.next(popoverNode);
1467
1474
  }
@@ -1956,6 +1963,13 @@ class ClrPopoverPositionService {
1956
1963
  // When primary axis is HORIZONTAL and there are two viewport violations
1957
1964
  this.handleHorizontalAxisTwoViolations(errorSum);
1958
1965
  }
1966
+ /**
1967
+ * Adjusts popover position based on scroll value by adding the negative 'top' value of currentContentCoords to yOffset for proper alignment.
1968
+ * - The negative value means that the 'top' of the content is scrolled out of view at the top of the viewport.
1969
+ */
1970
+ if (this.currentContentCoords.top < 0) {
1971
+ this.contentOffsets.yOffset += Math.abs(this.currentContentCoords.top);
1972
+ }
1959
1973
  return this.contentOffsets;
1960
1974
  }
1961
1975
  handleVerticalAxisOneViolation(errorSum) {
@@ -2153,6 +2167,7 @@ class ClrPopoverContent {
2153
2167
  this.shouldRealign = false;
2154
2168
  if (this.view) {
2155
2169
  this.renderer.setStyle(this.view.rootNodes[0], 'opacity', '1');
2170
+ this.smartOpenService.popoverVisibleEmit(true);
2156
2171
  }
2157
2172
  }));
2158
2173
  }
@@ -2200,6 +2215,7 @@ class ClrPopoverContent {
2200
2215
  this.view.rootNodes.forEach(node => this.renderer.removeChild(this.document.body, node));
2201
2216
  this.container.clear();
2202
2217
  delete this.view;
2218
+ this.smartOpenService.popoverVisibleEmit(false);
2203
2219
  }
2204
2220
  alignContent() {
2205
2221
  if (!this.view) {
@@ -3781,8 +3797,8 @@ class ClrButtonGroup {
3781
3797
  }
3782
3798
  handleFocusOnMenuOpen() {
3783
3799
  if (this.menuButtons.length) {
3784
- this.toggleService.openChange.pipe(delay(0), takeUntil(this.destroy$)).subscribe(isOpened => {
3785
- if (isOpened) {
3800
+ this.toggleService.popoverVisible.pipe(takeUntil(this.destroy$)).subscribe(visible => {
3801
+ if (visible) {
3786
3802
  this.focusHandler.initialize({
3787
3803
  menu: this.menu.nativeElement,
3788
3804
  menuToggle: this.menuToggle.nativeElement,
@@ -6667,10 +6683,15 @@ class ClrOptions {
6667
6683
  event.target !== this.focusHandler.textInput) {
6668
6684
  this.toggleService.open = false;
6669
6685
  }
6670
- }), this.items.changes.subscribe(() => {
6671
- setTimeout(() => {
6672
- this.focusHandler.focusFirstActive();
6673
- });
6686
+ }), this.items.changes.subscribe(items => {
6687
+ if (items.length) {
6688
+ setTimeout(() => {
6689
+ this.focusHandler.focusFirstActive();
6690
+ });
6691
+ }
6692
+ else {
6693
+ this.focusHandler.pseudoFocus.pop();
6694
+ }
6674
6695
  }));
6675
6696
  }
6676
6697
  ngOnDestroy() {
@@ -15323,7 +15344,8 @@ class ClrDatagridActionOverflow {
15323
15344
  this.rowActionService.register();
15324
15345
  this.subscriptions.push(this.smartToggleService.openChange.subscribe(openState => {
15325
15346
  this.open = openState;
15326
- if (openState) {
15347
+ }), this.smartToggleService.popoverVisible.subscribe(visible => {
15348
+ if (visible) {
15327
15349
  this.initializeFocus();
15328
15350
  }
15329
15351
  }));
@@ -15350,16 +15372,12 @@ class ClrDatagridActionOverflow {
15350
15372
  }
15351
15373
  initializeFocus() {
15352
15374
  if (isPlatformBrowser(this.platformId)) {
15353
- this.zone.runOutsideAngular(() => {
15354
- setTimeout(() => {
15355
- const buttons = Array.from(document.querySelectorAll('button.action-item'));
15356
- if (buttons.length) {
15357
- this.keyFocus.current = 0;
15358
- this.keyFocus.focusableItems = buttons;
15359
- this.keyFocus.focusCurrent();
15360
- }
15361
- });
15362
- });
15375
+ const buttons = Array.from(document.querySelectorAll('button.action-item'));
15376
+ if (buttons.length) {
15377
+ this.keyFocus.current = 0;
15378
+ this.keyFocus.focusableItems = buttons;
15379
+ this.keyFocus.focusCurrent();
15380
+ }
15363
15381
  }
15364
15382
  }
15365
15383
  }
@@ -21797,7 +21815,7 @@ class ClrVerticalNav {
21797
21815
  }
21798
21816
  }
21799
21817
  ClrVerticalNav.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrVerticalNav, deps: [{ token: VerticalNavService }, { token: VerticalNavIconService }, { token: VerticalNavGroupRegistrationService }, { token: ClrCommonStringsService }], target: i0.ɵɵFactoryTarget.Component });
21800
- ClrVerticalNav.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.2", type: ClrVerticalNav, selector: "clr-vertical-nav", inputs: { collapsible: ["clrVerticalNavCollapsible", "collapsible"], collapsed: ["clrVerticalNavCollapsed", "collapsed"] }, outputs: { _collapsedChanged: "clrVerticalNavCollapsedChange" }, host: { properties: { "class.is-collapsed": "collapsed", "class.has-nav-groups": "hasNavGroups", "class.has-icons": "hasIcons" }, classAttribute: "clr-vertical-nav" }, providers: [VerticalNavService, VerticalNavIconService, VerticalNavGroupRegistrationService], ngImport: i0, template: "<!--\n ~ Copyright (c) 2016-2023 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<button\n type=\"button\"\n class=\"nav-trigger\"\n [class.on-collapse]=\"collapsed\"\n [attr.aria-expanded]=\"ariaExpanded\"\n [attr.aria-label]=\"commonStrings.keys.verticalNavToggle\"\n (click)=\"toggleByButton()\"\n *ngIf=\"collapsible\"\n>\n <cds-icon\n shape=\"angle-double\"\n class=\"nav-trigger-icon\"\n [attr.direction]=\"(this.collapsed) ? 'right' : 'left'\"\n [attr.title]=\"(this.collapsed) ? commonStrings.keys.expand : commonStrings.keys.collapse\"\n ></cds-icon>\n</button>\n<div class=\"nav-content\">\n <ng-content></ng-content>\n <button\n (click)=\"collapsed = false\"\n class=\"nav-btn\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n [attr.aria-label]=\"commonStrings.keys.verticalNavToggle\"\n *ngIf=\"collapsible && collapsed\"\n ></button>\n</div>\n", dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: CdsIconCustomTag, selector: "cds-icon" }] });
21818
+ ClrVerticalNav.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.2", type: ClrVerticalNav, selector: "clr-vertical-nav", inputs: { collapsible: ["clrVerticalNavCollapsible", "collapsible"], collapsed: ["clrVerticalNavCollapsed", "collapsed"] }, outputs: { _collapsedChanged: "clrVerticalNavCollapsedChange" }, host: { properties: { "class.is-collapsed": "collapsed", "class.has-nav-groups": "hasNavGroups", "class.has-icons": "hasIcons" }, classAttribute: "clr-vertical-nav" }, providers: [VerticalNavService, VerticalNavIconService, VerticalNavGroupRegistrationService], ngImport: i0, template: "<!--\n ~ Copyright (c) 2016-2023 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<button\n type=\"button\"\n class=\"nav-trigger\"\n [class.on-collapse]=\"collapsed\"\n [attr.aria-expanded]=\"ariaExpanded\"\n [attr.aria-label]=\"commonStrings.keys.verticalNavToggle\"\n (click)=\"toggleByButton()\"\n *ngIf=\"collapsible\"\n>\n <cds-icon\n shape=\"angle-double\"\n class=\"nav-trigger-icon\"\n [attr.direction]=\"(this.collapsed) ? 'right' : 'left'\"\n [attr.title]=\"(this.collapsed) ? commonStrings.keys.expand : commonStrings.keys.collapse\"\n ></cds-icon>\n</button>\n<div class=\"nav-content\">\n <ng-content></ng-content>\n <button\n type=\"button\"\n (click)=\"collapsed = false\"\n class=\"nav-btn\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n [attr.aria-label]=\"commonStrings.keys.verticalNavToggle\"\n *ngIf=\"collapsible && collapsed\"\n ></button>\n</div>\n", dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: CdsIconCustomTag, selector: "cds-icon" }] });
21801
21819
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrVerticalNav, decorators: [{
21802
21820
  type: Component,
21803
21821
  args: [{ selector: 'clr-vertical-nav', providers: [VerticalNavService, VerticalNavIconService, VerticalNavGroupRegistrationService], host: {
@@ -21805,7 +21823,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
21805
21823
  '[class.is-collapsed]': 'collapsed',
21806
21824
  '[class.has-nav-groups]': 'hasNavGroups',
21807
21825
  '[class.has-icons]': 'hasIcons',
21808
- }, template: "<!--\n ~ Copyright (c) 2016-2023 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<button\n type=\"button\"\n class=\"nav-trigger\"\n [class.on-collapse]=\"collapsed\"\n [attr.aria-expanded]=\"ariaExpanded\"\n [attr.aria-label]=\"commonStrings.keys.verticalNavToggle\"\n (click)=\"toggleByButton()\"\n *ngIf=\"collapsible\"\n>\n <cds-icon\n shape=\"angle-double\"\n class=\"nav-trigger-icon\"\n [attr.direction]=\"(this.collapsed) ? 'right' : 'left'\"\n [attr.title]=\"(this.collapsed) ? commonStrings.keys.expand : commonStrings.keys.collapse\"\n ></cds-icon>\n</button>\n<div class=\"nav-content\">\n <ng-content></ng-content>\n <button\n (click)=\"collapsed = false\"\n class=\"nav-btn\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n [attr.aria-label]=\"commonStrings.keys.verticalNavToggle\"\n *ngIf=\"collapsible && collapsed\"\n ></button>\n</div>\n" }]
21826
+ }, template: "<!--\n ~ Copyright (c) 2016-2023 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<button\n type=\"button\"\n class=\"nav-trigger\"\n [class.on-collapse]=\"collapsed\"\n [attr.aria-expanded]=\"ariaExpanded\"\n [attr.aria-label]=\"commonStrings.keys.verticalNavToggle\"\n (click)=\"toggleByButton()\"\n *ngIf=\"collapsible\"\n>\n <cds-icon\n shape=\"angle-double\"\n class=\"nav-trigger-icon\"\n [attr.direction]=\"(this.collapsed) ? 'right' : 'left'\"\n [attr.title]=\"(this.collapsed) ? commonStrings.keys.expand : commonStrings.keys.collapse\"\n ></cds-icon>\n</button>\n<div class=\"nav-content\">\n <ng-content></ng-content>\n <button\n type=\"button\"\n (click)=\"collapsed = false\"\n class=\"nav-btn\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n [attr.aria-label]=\"commonStrings.keys.verticalNavToggle\"\n *ngIf=\"collapsible && collapsed\"\n ></button>\n</div>\n" }]
21809
21827
  }], ctorParameters: function () { return [{ type: VerticalNavService }, { type: VerticalNavIconService }, { type: VerticalNavGroupRegistrationService }, { type: ClrCommonStringsService }]; }, propDecorators: { _collapsedChanged: [{
21810
21828
  type: Output,
21811
21829
  args: ['clrVerticalNavCollapsedChange']