@clr/angular 17.11.4 → 17.11.6

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, infoCircleIcon, timesIcon, angleDoubleIcon, eventIcon, calendarIcon, folderOpenIcon, minusIcon, plusIcon, eyeHideIcon, eyeIcon, ellipsisVerticalIcon, viewColumnsIcon, arrowIcon, stepForward2Icon, filterGridCircleIcon, filterGridIcon, errorStandardIcon, helpIcon, infoStandardIcon, noteIcon, successStandardIcon, warningStandardIcon, circleIcon, dotCircleIcon } from '@cds/core/icon';
6
- import { map, tap, startWith, distinctUntilChanged, filter, skipUntil, debounceTime, takeUntil, take, first, switchMap as switchMap$1 } from 'rxjs/operators';
6
+ import { map, tap, startWith, distinctUntilChanged, filter, skipUntil, debounceTime, takeUntil, take, first, delay, switchMap as switchMap$1 } from 'rxjs/operators';
7
7
  import * as i3 from 'rxjs';
8
8
  import { Subject, BehaviorSubject, Observable, fromEvent, isObservable, of, shareReplay, combineLatest, startWith as startWith$1, switchMap, merge, map as map$1, EMPTY, ReplaySubject, tap as tap$1 } from 'rxjs';
9
9
  import * as i2 from '@angular/animations';
@@ -21002,7 +21002,7 @@ class Selection {
21002
21002
  }
21003
21003
  this.clearSelection();
21004
21004
  }));
21005
- this.subscriptions.push(_items.allChanges.subscribe(updatedItems => {
21005
+ this.subscriptions.push(_items.allChanges.pipe(delay(0)).subscribe(updatedItems => {
21006
21006
  // Reset the lockedRefs;
21007
21007
  const updateLockedRef = [];
21008
21008
  switch (this.selectionType) {
@@ -21034,15 +21034,9 @@ class Selection {
21034
21034
  if (_items.smart && !newSingle) {
21035
21035
  selectionUpdated = true;
21036
21036
  }
21037
- // TODO: Discussed this with Eudes and this is fine for now.
21038
- // But we need to figure out a different pattern for the
21039
- // child triggering the parent change detection problem.
21040
- // Using setTimeout for now to fix this.
21041
- setTimeout(() => {
21042
- if (selectionUpdated) {
21043
- this.currentSingle = newSingle;
21044
- }
21045
- }, 0);
21037
+ if (selectionUpdated) {
21038
+ this.currentSingle = newSingle;
21039
+ }
21046
21040
  break;
21047
21041
  }
21048
21042
  case SelectionType.Multi: {
@@ -21087,15 +21081,9 @@ class Selection {
21087
21081
  selectionUpdated = true;
21088
21082
  }
21089
21083
  }
21090
- // TODO: Discussed this with Eudes and this is fine for now.
21091
- // But we need to figure out a different pattern for the
21092
- // child triggering the parent change detection problem.
21093
- // Using setTimeout for now to fix this.
21094
- setTimeout(() => {
21095
- if (selectionUpdated) {
21096
- this.current = leftOver;
21097
- }
21098
- }, 0);
21084
+ if (selectionUpdated) {
21085
+ this.current = leftOver;
21086
+ }
21099
21087
  }
21100
21088
  break;
21101
21089
  }
@@ -21189,6 +21177,9 @@ class Selection {
21189
21177
  case SelectionType.None:
21190
21178
  break;
21191
21179
  case SelectionType.Single:
21180
+ if (selected) {
21181
+ this.currentSingle = item;
21182
+ }
21192
21183
  // in single selection, set currentSingle method should be used
21193
21184
  break;
21194
21185
  case SelectionType.Multi:
@@ -21803,11 +21794,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
21803
21794
  * This software is released under MIT license.
21804
21795
  * The full license information can be found in LICENSE in the root directory of this project.
21805
21796
  */
21806
- const defaultCdkFixedSizeVirtualScrollInputs = {
21807
- itemSize: 32,
21808
- minBufferPx: 200,
21809
- maxBufferPx: 400,
21810
- };
21811
21797
  class ClrDatagridVirtualScrollDirective {
21812
21798
  constructor(changeDetectorRef, iterableDiffers, items, ngZone, renderer2, templateRef, viewContainerRef, directionality, scrollDispatcher, viewportRuler, datagrid, columnsService, injector) {
21813
21799
  this.changeDetectorRef = changeDetectorRef;
@@ -21826,15 +21812,20 @@ class ClrDatagridVirtualScrollDirective {
21826
21812
  this.renderedRangeChange = new EventEmitter();
21827
21813
  this.persistItems = true;
21828
21814
  this.shouldUpdateAriaRowIndexes = false;
21829
- this._cdkFixedSizeVirtualScrollInputs = { ...defaultCdkFixedSizeVirtualScrollInputs };
21815
+ this._isUserProvidedItemSize = false;
21816
+ this._itemSize = 33;
21817
+ this._minBufferPx = 200;
21818
+ this._maxBufferPx = 400;
21830
21819
  this.subscriptions = [];
21831
21820
  this.topIndex = 0;
21832
21821
  // @deprecated remove the mutation observer when `datagrid-compact` class is deleted
21833
21822
  this.mutationChanges = new MutationObserver((mutations) => {
21834
21823
  mutations.forEach((mutation) => {
21835
21824
  // it is possible this to be called twice because the old class is removed and the new added
21836
- if (mutation.target.classList.contains('datagrid-compact') && this.itemSize > 24) {
21837
- this.itemSize = 24;
21825
+ if (!this._isUserProvidedItemSize &&
21826
+ mutation.target.classList.contains('datagrid-compact') &&
21827
+ this.itemSize > 25) {
21828
+ this.updateItemSize(25);
21838
21829
  }
21839
21830
  });
21840
21831
  });
@@ -21847,16 +21838,21 @@ class ClrDatagridVirtualScrollDirective {
21847
21838
  this.datagridElementRef = datagrid.el;
21848
21839
  // default
21849
21840
  this.cdkVirtualForTemplateCacheSize = 20;
21850
- const rowHeightToken = window.getComputedStyle(document.body).getPropertyValue('--clr-table-row-height');
21851
- const rowHeightValue = +/calc\(([0-9]+) \* calc\(\(1rem \/ 20\) \* 1\)\)/.exec(rowHeightToken)?.[1];
21841
+ const cellHeightToken = window.getComputedStyle(document.body).getPropertyValue('--clr-table-cell-height');
21842
+ const cellHeightValue = +/calc\(([0-9]+) \* calc\(\(1rem \/ 20\) \* 1\)\)/.exec(cellHeightToken)?.[1];
21843
+ const borderWidthToken = window.getComputedStyle(document.body).getPropertyValue('--clr-table-borderwidth');
21844
+ const borderWidthValue = +/calc\(([0-9]+) \* \(1rem \/ 20\)\)/.exec(borderWidthToken)?.[1];
21845
+ // initially rowHeightValue is calculated based on `--clr-table-row-height` that had a discreet value.
21846
+ // currently `--clr-table-row-height` is calculated based on `--clr-table-cell-height` + `--clr-table-borderwidth`
21847
+ const rowHeightValue = cellHeightValue + borderWidthValue;
21852
21848
  if (rowHeightValue && this.itemSize > rowHeightValue) {
21853
- this.itemSize = rowHeightValue;
21849
+ this.updateItemSize(rowHeightValue);
21854
21850
  }
21855
21851
  this.mutationChanges.observe(this.datagridElementRef.nativeElement, {
21856
21852
  attributeFilter: ['class'],
21857
21853
  attributeOldValue: true,
21858
21854
  });
21859
- this.virtualScrollStrategy = new FixedSizeVirtualScrollStrategy(this._cdkFixedSizeVirtualScrollInputs.itemSize, this._cdkFixedSizeVirtualScrollInputs.minBufferPx, this._cdkFixedSizeVirtualScrollInputs.maxBufferPx);
21855
+ this.virtualScrollStrategy = new FixedSizeVirtualScrollStrategy(this.itemSize, this.minBufferPx, this.maxBufferPx);
21860
21856
  }
21861
21857
  get totalContentHeight() {
21862
21858
  return this.virtualScrollViewport?._totalContentHeight || '';
@@ -21891,24 +21887,24 @@ class ClrDatagridVirtualScrollDirective {
21891
21887
  this.updateCdkVirtualForInputs();
21892
21888
  }
21893
21889
  get itemSize() {
21894
- return this._cdkFixedSizeVirtualScrollInputs.itemSize;
21890
+ return this._itemSize;
21895
21891
  }
21896
21892
  set itemSize(value) {
21897
- this._cdkFixedSizeVirtualScrollInputs.itemSize = coerceNumberProperty(value);
21898
- this.updateFixedSizeVirtualScrollInputs();
21893
+ this._isUserProvidedItemSize = true;
21894
+ this.updateItemSize(value);
21899
21895
  }
21900
21896
  get minBufferPx() {
21901
- return this._cdkFixedSizeVirtualScrollInputs.minBufferPx;
21897
+ return this._minBufferPx;
21902
21898
  }
21903
21899
  set minBufferPx(value) {
21904
- this._cdkFixedSizeVirtualScrollInputs.minBufferPx = coerceNumberProperty(value);
21900
+ this._minBufferPx = coerceNumberProperty(value);
21905
21901
  this.updateFixedSizeVirtualScrollInputs();
21906
21902
  }
21907
21903
  get maxBufferPx() {
21908
- return this._cdkFixedSizeVirtualScrollInputs.maxBufferPx;
21904
+ return this._maxBufferPx;
21909
21905
  }
21910
21906
  set maxBufferPx(value) {
21911
- this._cdkFixedSizeVirtualScrollInputs.maxBufferPx = coerceNumberProperty(value);
21907
+ this._maxBufferPx = coerceNumberProperty(value);
21912
21908
  this.updateFixedSizeVirtualScrollInputs();
21913
21909
  }
21914
21910
  set dataRange(range) {
@@ -21979,6 +21975,10 @@ class ClrDatagridVirtualScrollDirective {
21979
21975
  scrollToIndex(index, behavior = 'auto') {
21980
21976
  this.virtualScrollViewport?.scrollToIndex(index, behavior);
21981
21977
  }
21978
+ updateItemSize(value) {
21979
+ this._itemSize = coerceNumberProperty(value);
21980
+ this.updateFixedSizeVirtualScrollInputs();
21981
+ }
21982
21982
  updateDataRange(skip, data) {
21983
21983
  let items = this.cdkVirtualForOf;
21984
21984
  if (!this.persistItems || !items || items?.length !== this.totalItems) {
@@ -21998,7 +21998,7 @@ class ClrDatagridVirtualScrollDirective {
21998
21998
  }
21999
21999
  updateFixedSizeVirtualScrollInputs() {
22000
22000
  if (this.virtualScrollStrategy) {
22001
- this.virtualScrollStrategy.updateItemAndBufferSize(this._cdkFixedSizeVirtualScrollInputs.itemSize, this._cdkFixedSizeVirtualScrollInputs.minBufferPx, this._cdkFixedSizeVirtualScrollInputs.maxBufferPx);
22001
+ this.virtualScrollStrategy.updateItemAndBufferSize(this.itemSize, this.minBufferPx, this.maxBufferPx);
22002
22002
  }
22003
22003
  }
22004
22004
  updateAriaRowCount(rowCount) {
@@ -23673,6 +23673,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
23673
23673
  args: ['clrIfDetail']
23674
23674
  }] } });
23675
23675
 
23676
+ /*
23677
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23678
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23679
+ * This software is released under MIT license.
23680
+ * The full license information can be found in LICENSE in the root directory of this project.
23681
+ */
23682
+
23683
+ /*
23684
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23685
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23686
+ * This software is released under MIT license.
23687
+ * The full license information can be found in LICENSE in the root directory of this project.
23688
+ */
23689
+
23690
+ /*
23691
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23692
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23693
+ * This software is released under MIT license.
23694
+ * The full license information can be found in LICENSE in the root directory of this project.
23695
+ */
23696
+
23697
+ /*
23698
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23699
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23700
+ * This software is released under MIT license.
23701
+ * The full license information can be found in LICENSE in the root directory of this project.
23702
+ */
23703
+
23704
+ /*
23705
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23706
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23707
+ * This software is released under MIT license.
23708
+ * The full license information can be found in LICENSE in the root directory of this project.
23709
+ */
23710
+
23711
+ /*
23712
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23713
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23714
+ * This software is released under MIT license.
23715
+ * The full license information can be found in LICENSE in the root directory of this project.
23716
+ */
23717
+
23718
+ /*
23719
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23720
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23721
+ * This software is released under MIT license.
23722
+ * The full license information can be found in LICENSE in the root directory of this project.
23723
+ */
23724
+
23725
+ /*
23726
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23727
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23728
+ * This software is released under MIT license.
23729
+ * The full license information can be found in LICENSE in the root directory of this project.
23730
+ */
23731
+
23732
+ /*
23733
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23734
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23735
+ * This software is released under MIT license.
23736
+ * The full license information can be found in LICENSE in the root directory of this project.
23737
+ */
23738
+
23739
+ /*
23740
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23741
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23742
+ * This software is released under MIT license.
23743
+ * The full license information can be found in LICENSE in the root directory of this project.
23744
+ */
23745
+
23746
+ /*
23747
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23748
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23749
+ * This software is released under MIT license.
23750
+ * The full license information can be found in LICENSE in the root directory of this project.
23751
+ */
23752
+
23753
+ /*
23754
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23755
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23756
+ * This software is released under MIT license.
23757
+ * The full license information can be found in LICENSE in the root directory of this project.
23758
+ */
23759
+
23676
23760
  /*
23677
23761
  * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23678
23762
  * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
@@ -23684,6 +23768,11 @@ class ClrDatagridPageSize {
23684
23768
  this.page = page;
23685
23769
  this.pageSizeOptionsId = uniqueIdFactory();
23686
23770
  }
23771
+ set label(label) {
23772
+ if (label) {
23773
+ label.disableGrid();
23774
+ }
23775
+ }
23687
23776
  ngOnInit() {
23688
23777
  if (!this.pageSizeOptions || this.pageSizeOptions.length === 0) {
23689
23778
  this.pageSizeOptions = [this.page.size];
@@ -23691,7 +23780,7 @@ class ClrDatagridPageSize {
23691
23780
  }
23692
23781
  }
23693
23782
  ClrDatagridPageSize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrDatagridPageSize, deps: [{ token: Page }], target: i0.ɵɵFactoryTarget.Component });
23694
- ClrDatagridPageSize.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.2", type: ClrDatagridPageSize, selector: "clr-dg-page-size", inputs: { pageSizeOptions: ["clrPageSizeOptions", "pageSizeOptions"], pageSizeOptionsId: ["clrPageSizeOptionsId", "pageSizeOptionsId"] }, ngImport: i0, template: `
23783
+ ClrDatagridPageSize.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.2", type: ClrDatagridPageSize, selector: "clr-dg-page-size", inputs: { pageSizeOptions: ["clrPageSizeOptions", "pageSizeOptions"], pageSizeOptionsId: ["clrPageSizeOptionsId", "pageSizeOptionsId"] }, viewQueries: [{ propertyName: "label", first: true, predicate: ClrLabel, descendants: true, static: true }], ngImport: i0, template: `
23695
23784
  <label [for]="pageSizeOptionsId"><ng-content></ng-content></label>
23696
23785
  <div class="clr-select-wrapper">
23697
23786
  <select [id]="pageSizeOptionsId" [class.clr-page-size-select]="true" [(ngModel)]="page.size">
@@ -23718,6 +23807,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
23718
23807
  }], pageSizeOptionsId: [{
23719
23808
  type: Input,
23720
23809
  args: ['clrPageSizeOptionsId']
23810
+ }], label: [{
23811
+ type: ViewChild,
23812
+ args: [ClrLabel, { static: true }]
23721
23813
  }] } });
23722
23814
 
23723
23815
  /*
@@ -31081,90 +31173,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
31081
31173
  * The full license information can be found in LICENSE in the root directory of this project.
31082
31174
  */
31083
31175
 
31084
- /*
31085
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31086
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31087
- * This software is released under MIT license.
31088
- * The full license information can be found in LICENSE in the root directory of this project.
31089
- */
31090
-
31091
- /*
31092
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31093
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31094
- * This software is released under MIT license.
31095
- * The full license information can be found in LICENSE in the root directory of this project.
31096
- */
31097
-
31098
- /*
31099
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31100
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31101
- * This software is released under MIT license.
31102
- * The full license information can be found in LICENSE in the root directory of this project.
31103
- */
31104
-
31105
- /*
31106
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31107
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31108
- * This software is released under MIT license.
31109
- * The full license information can be found in LICENSE in the root directory of this project.
31110
- */
31111
-
31112
- /*
31113
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31114
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31115
- * This software is released under MIT license.
31116
- * The full license information can be found in LICENSE in the root directory of this project.
31117
- */
31118
-
31119
- /*
31120
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31121
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31122
- * This software is released under MIT license.
31123
- * The full license information can be found in LICENSE in the root directory of this project.
31124
- */
31125
-
31126
- /*
31127
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31128
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31129
- * This software is released under MIT license.
31130
- * The full license information can be found in LICENSE in the root directory of this project.
31131
- */
31132
-
31133
- /*
31134
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31135
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31136
- * This software is released under MIT license.
31137
- * The full license information can be found in LICENSE in the root directory of this project.
31138
- */
31139
-
31140
- /*
31141
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31142
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31143
- * This software is released under MIT license.
31144
- * The full license information can be found in LICENSE in the root directory of this project.
31145
- */
31146
-
31147
- /*
31148
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31149
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31150
- * This software is released under MIT license.
31151
- * The full license information can be found in LICENSE in the root directory of this project.
31152
- */
31153
-
31154
- /*
31155
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31156
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31157
- * This software is released under MIT license.
31158
- * The full license information can be found in LICENSE in the root directory of this project.
31159
- */
31160
-
31161
- /*
31162
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31163
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31164
- * This software is released under MIT license.
31165
- * The full license information can be found in LICENSE in the root directory of this project.
31166
- */
31167
-
31168
31176
  /**
31169
31177
  * Generated bundle index. Do not edit.
31170
31178
  */