@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';
@@ -1412,10 +1412,14 @@ class ClrPopoverToggleService {
1412
1412
  this._openChange = new Subject();
1413
1413
  this._openEventChange = new Subject();
1414
1414
  this._popoverAligned = new Subject();
1415
+ this._popoverVisible = new Subject();
1415
1416
  }
1416
1417
  get openChange() {
1417
1418
  return this._openChange.asObservable();
1418
1419
  }
1420
+ get popoverVisible() {
1421
+ return this._popoverVisible.asObservable();
1422
+ }
1419
1423
  get openEvent() {
1420
1424
  return this._openEvent;
1421
1425
  }
@@ -1452,6 +1456,9 @@ class ClrPopoverToggleService {
1452
1456
  this.openEvent = event;
1453
1457
  this.open = !this.open;
1454
1458
  }
1459
+ popoverVisibleEmit(visible) {
1460
+ this._popoverVisible.next(visible);
1461
+ }
1455
1462
  popoverAlignedEmit(popoverNode) {
1456
1463
  this._popoverAligned.next(popoverNode);
1457
1464
  }
@@ -1953,6 +1960,13 @@ class ClrPopoverPositionService {
1953
1960
  // When primary axis is HORIZONTAL and there are two viewport violations
1954
1961
  this.handleHorizontalAxisTwoViolations(errorSum);
1955
1962
  }
1963
+ /**
1964
+ * Adjusts popover position based on scroll value by adding the negative 'top' value of currentContentCoords to yOffset for proper alignment.
1965
+ * - The negative value means that the 'top' of the content is scrolled out of view at the top of the viewport.
1966
+ */
1967
+ if (this.currentContentCoords.top < 0) {
1968
+ this.contentOffsets.yOffset += Math.abs(this.currentContentCoords.top);
1969
+ }
1956
1970
  return this.contentOffsets;
1957
1971
  }
1958
1972
  handleVerticalAxisOneViolation(errorSum) {
@@ -2148,6 +2162,7 @@ class ClrPopoverContent {
2148
2162
  this.shouldRealign = false;
2149
2163
  if (this.view) {
2150
2164
  this.renderer.setStyle(this.view.rootNodes[0], 'opacity', '1');
2165
+ this.smartOpenService.popoverVisibleEmit(true);
2151
2166
  }
2152
2167
  }));
2153
2168
  }
@@ -2195,6 +2210,7 @@ class ClrPopoverContent {
2195
2210
  this.view.rootNodes.forEach(node => this.renderer.removeChild(this.document.body, node));
2196
2211
  this.container.clear();
2197
2212
  delete this.view;
2213
+ this.smartOpenService.popoverVisibleEmit(false);
2198
2214
  }
2199
2215
  alignContent() {
2200
2216
  if (!this.view) {
@@ -3777,8 +3793,8 @@ class ClrButtonGroup {
3777
3793
  }
3778
3794
  handleFocusOnMenuOpen() {
3779
3795
  if (this.menuButtons.length) {
3780
- this.toggleService.openChange.pipe(delay(0), takeUntil(this.destroy$)).subscribe(isOpened => {
3781
- if (isOpened) {
3796
+ this.toggleService.popoverVisible.pipe(takeUntil(this.destroy$)).subscribe(visible => {
3797
+ if (visible) {
3782
3798
  this.focusHandler.initialize({
3783
3799
  menu: this.menu.nativeElement,
3784
3800
  menuToggle: this.menuToggle.nativeElement,
@@ -6628,10 +6644,15 @@ class ClrOptions {
6628
6644
  event.target !== this.focusHandler.textInput) {
6629
6645
  this.toggleService.open = false;
6630
6646
  }
6631
- }), this.items.changes.subscribe(() => {
6632
- setTimeout(() => {
6633
- this.focusHandler.focusFirstActive();
6634
- });
6647
+ }), this.items.changes.subscribe(items => {
6648
+ if (items.length) {
6649
+ setTimeout(() => {
6650
+ this.focusHandler.focusFirstActive();
6651
+ });
6652
+ }
6653
+ else {
6654
+ this.focusHandler.pseudoFocus.pop();
6655
+ }
6635
6656
  }));
6636
6657
  }
6637
6658
  ngOnDestroy() {
@@ -15216,7 +15237,8 @@ class ClrDatagridActionOverflow {
15216
15237
  this.rowActionService.register();
15217
15238
  this.subscriptions.push(this.smartToggleService.openChange.subscribe(openState => {
15218
15239
  this.open = openState;
15219
- if (openState) {
15240
+ }), this.smartToggleService.popoverVisible.subscribe(visible => {
15241
+ if (visible) {
15220
15242
  this.initializeFocus();
15221
15243
  }
15222
15244
  }));
@@ -15243,16 +15265,12 @@ class ClrDatagridActionOverflow {
15243
15265
  }
15244
15266
  initializeFocus() {
15245
15267
  if (isPlatformBrowser(this.platformId)) {
15246
- this.zone.runOutsideAngular(() => {
15247
- setTimeout(() => {
15248
- const buttons = Array.from(document.querySelectorAll('button.action-item'));
15249
- if (buttons.length) {
15250
- this.keyFocus.current = 0;
15251
- this.keyFocus.focusableItems = buttons;
15252
- this.keyFocus.focusCurrent();
15253
- }
15254
- });
15255
- });
15268
+ const buttons = Array.from(document.querySelectorAll('button.action-item'));
15269
+ if (buttons.length) {
15270
+ this.keyFocus.current = 0;
15271
+ this.keyFocus.focusableItems = buttons;
15272
+ this.keyFocus.focusCurrent();
15273
+ }
15256
15274
  }
15257
15275
  }
15258
15276
  }
@@ -21645,7 +21663,7 @@ class ClrVerticalNav {
21645
21663
  }
21646
21664
  }
21647
21665
  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 });
21648
- 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" }] });
21666
+ 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" }] });
21649
21667
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrVerticalNav, decorators: [{
21650
21668
  type: Component,
21651
21669
  args: [{ selector: 'clr-vertical-nav', providers: [VerticalNavService, VerticalNavIconService, VerticalNavGroupRegistrationService], host: {
@@ -21653,7 +21671,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
21653
21671
  '[class.is-collapsed]': 'collapsed',
21654
21672
  '[class.has-nav-groups]': 'hasNavGroups',
21655
21673
  '[class.has-icons]': 'hasIcons',
21656
- }, 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" }]
21674
+ }, 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" }]
21657
21675
  }], ctorParameters: function () { return [{ type: VerticalNavService }, { type: VerticalNavIconService }, { type: VerticalNavGroupRegistrationService }, { type: ClrCommonStringsService }]; }, propDecorators: { _collapsedChanged: [{
21658
21676
  type: Output,
21659
21677
  args: ['clrVerticalNavCollapsedChange']