@clr/angular 15.5.1 → 15.6.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,
@@ -15323,7 +15339,8 @@ class ClrDatagridActionOverflow {
15323
15339
  this.rowActionService.register();
15324
15340
  this.subscriptions.push(this.smartToggleService.openChange.subscribe(openState => {
15325
15341
  this.open = openState;
15326
- if (openState) {
15342
+ }), this.smartToggleService.popoverVisible.subscribe(visible => {
15343
+ if (visible) {
15327
15344
  this.initializeFocus();
15328
15345
  }
15329
15346
  }));
@@ -15350,16 +15367,12 @@ class ClrDatagridActionOverflow {
15350
15367
  }
15351
15368
  initializeFocus() {
15352
15369
  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
- });
15370
+ const buttons = Array.from(document.querySelectorAll('button.action-item'));
15371
+ if (buttons.length) {
15372
+ this.keyFocus.current = 0;
15373
+ this.keyFocus.focusableItems = buttons;
15374
+ this.keyFocus.focusCurrent();
15375
+ }
15363
15376
  }
15364
15377
  }
15365
15378
  }
@@ -21797,7 +21810,7 @@ class ClrVerticalNav {
21797
21810
  }
21798
21811
  }
21799
21812
  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" }] });
21813
+ 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
21814
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrVerticalNav, decorators: [{
21802
21815
  type: Component,
21803
21816
  args: [{ selector: 'clr-vertical-nav', providers: [VerticalNavService, VerticalNavIconService, VerticalNavGroupRegistrationService], host: {
@@ -21805,7 +21818,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
21805
21818
  '[class.is-collapsed]': 'collapsed',
21806
21819
  '[class.has-nav-groups]': 'hasNavGroups',
21807
21820
  '[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" }]
21821
+ }, 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
21822
  }], ctorParameters: function () { return [{ type: VerticalNavService }, { type: VerticalNavIconService }, { type: VerticalNavGroupRegistrationService }, { type: ClrCommonStringsService }]; }, propDecorators: { _collapsedChanged: [{
21810
21823
  type: Output,
21811
21824
  args: ['clrVerticalNavCollapsedChange']