@clr/angular 17.11.5 → 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';
@@ -21185,7 +21185,7 @@ class Selection {
21185
21185
  }
21186
21186
  this.clearSelection();
21187
21187
  }));
21188
- this.subscriptions.push(_items.allChanges.subscribe(updatedItems => {
21188
+ this.subscriptions.push(_items.allChanges.pipe(delay(0)).subscribe(updatedItems => {
21189
21189
  // Reset the lockedRefs;
21190
21190
  const updateLockedRef = [];
21191
21191
  switch (this.selectionType) {
@@ -21217,15 +21217,9 @@ class Selection {
21217
21217
  if (_items.smart && !newSingle) {
21218
21218
  selectionUpdated = true;
21219
21219
  }
21220
- // TODO: Discussed this with Eudes and this is fine for now.
21221
- // But we need to figure out a different pattern for the
21222
- // child triggering the parent change detection problem.
21223
- // Using setTimeout for now to fix this.
21224
- setTimeout(() => {
21225
- if (selectionUpdated) {
21226
- this.currentSingle = newSingle;
21227
- }
21228
- }, 0);
21220
+ if (selectionUpdated) {
21221
+ this.currentSingle = newSingle;
21222
+ }
21229
21223
  break;
21230
21224
  }
21231
21225
  case SelectionType.Multi: {
@@ -21270,15 +21264,9 @@ class Selection {
21270
21264
  selectionUpdated = true;
21271
21265
  }
21272
21266
  }
21273
- // TODO: Discussed this with Eudes and this is fine for now.
21274
- // But we need to figure out a different pattern for the
21275
- // child triggering the parent change detection problem.
21276
- // Using setTimeout for now to fix this.
21277
- setTimeout(() => {
21278
- if (selectionUpdated) {
21279
- this.current = leftOver;
21280
- }
21281
- }, 0);
21267
+ if (selectionUpdated) {
21268
+ this.current = leftOver;
21269
+ }
21282
21270
  }
21283
21271
  break;
21284
21272
  }
@@ -21372,6 +21360,9 @@ class Selection {
21372
21360
  case SelectionType.None:
21373
21361
  break;
21374
21362
  case SelectionType.Single:
21363
+ if (selected) {
21364
+ this.currentSingle = item;
21365
+ }
21375
21366
  // in single selection, set currentSingle method should be used
21376
21367
  break;
21377
21368
  case SelectionType.Multi:
@@ -21989,14 +21980,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
21989
21980
  * This software is released under MIT license.
21990
21981
  * The full license information can be found in LICENSE in the root directory of this project.
21991
21982
  */
21992
- const defaultCdkFixedSizeVirtualScrollInputs = {
21993
- itemSize: 32,
21994
- minBufferPx: 200,
21995
- maxBufferPx: 400,
21996
- };
21997
21983
  class ClrDatagridVirtualScrollDirective {
21998
21984
  constructor(changeDetectorRef, iterableDiffers, items, ngZone, renderer2, templateRef, viewContainerRef, directionality, scrollDispatcher, viewportRuler, datagrid, columnsService, injector) {
21999
- var _a;
21985
+ var _a, _b;
22000
21986
  this.changeDetectorRef = changeDetectorRef;
22001
21987
  this.iterableDiffers = iterableDiffers;
22002
21988
  this.items = items;
@@ -22013,15 +21999,20 @@ class ClrDatagridVirtualScrollDirective {
22013
21999
  this.renderedRangeChange = new EventEmitter();
22014
22000
  this.persistItems = true;
22015
22001
  this.shouldUpdateAriaRowIndexes = false;
22016
- this._cdkFixedSizeVirtualScrollInputs = Object.assign({}, defaultCdkFixedSizeVirtualScrollInputs);
22002
+ this._isUserProvidedItemSize = false;
22003
+ this._itemSize = 33;
22004
+ this._minBufferPx = 200;
22005
+ this._maxBufferPx = 400;
22017
22006
  this.subscriptions = [];
22018
22007
  this.topIndex = 0;
22019
22008
  // @deprecated remove the mutation observer when `datagrid-compact` class is deleted
22020
22009
  this.mutationChanges = new MutationObserver((mutations) => {
22021
22010
  mutations.forEach((mutation) => {
22022
22011
  // it is possible this to be called twice because the old class is removed and the new added
22023
- if (mutation.target.classList.contains('datagrid-compact') && this.itemSize > 24) {
22024
- this.itemSize = 24;
22012
+ if (!this._isUserProvidedItemSize &&
22013
+ mutation.target.classList.contains('datagrid-compact') &&
22014
+ this.itemSize > 25) {
22015
+ this.updateItemSize(25);
22025
22016
  }
22026
22017
  });
22027
22018
  });
@@ -22034,16 +22025,21 @@ class ClrDatagridVirtualScrollDirective {
22034
22025
  this.datagridElementRef = datagrid.el;
22035
22026
  // default
22036
22027
  this.cdkVirtualForTemplateCacheSize = 20;
22037
- const rowHeightToken = window.getComputedStyle(document.body).getPropertyValue('--clr-table-row-height');
22038
- const rowHeightValue = +((_a = /calc\(([0-9]+) \* calc\(\(1rem \/ 20\) \* 1\)\)/.exec(rowHeightToken)) === null || _a === void 0 ? void 0 : _a[1]);
22028
+ const cellHeightToken = window.getComputedStyle(document.body).getPropertyValue('--clr-table-cell-height');
22029
+ const cellHeightValue = +((_a = /calc\(([0-9]+) \* calc\(\(1rem \/ 20\) \* 1\)\)/.exec(cellHeightToken)) === null || _a === void 0 ? void 0 : _a[1]);
22030
+ const borderWidthToken = window.getComputedStyle(document.body).getPropertyValue('--clr-table-borderwidth');
22031
+ const borderWidthValue = +((_b = /calc\(([0-9]+) \* \(1rem \/ 20\)\)/.exec(borderWidthToken)) === null || _b === void 0 ? void 0 : _b[1]);
22032
+ // initially rowHeightValue is calculated based on `--clr-table-row-height` that had a discreet value.
22033
+ // currently `--clr-table-row-height` is calculated based on `--clr-table-cell-height` + `--clr-table-borderwidth`
22034
+ const rowHeightValue = cellHeightValue + borderWidthValue;
22039
22035
  if (rowHeightValue && this.itemSize > rowHeightValue) {
22040
- this.itemSize = rowHeightValue;
22036
+ this.updateItemSize(rowHeightValue);
22041
22037
  }
22042
22038
  this.mutationChanges.observe(this.datagridElementRef.nativeElement, {
22043
22039
  attributeFilter: ['class'],
22044
22040
  attributeOldValue: true,
22045
22041
  });
22046
- this.virtualScrollStrategy = new FixedSizeVirtualScrollStrategy(this._cdkFixedSizeVirtualScrollInputs.itemSize, this._cdkFixedSizeVirtualScrollInputs.minBufferPx, this._cdkFixedSizeVirtualScrollInputs.maxBufferPx);
22042
+ this.virtualScrollStrategy = new FixedSizeVirtualScrollStrategy(this.itemSize, this.minBufferPx, this.maxBufferPx);
22047
22043
  }
22048
22044
  get totalContentHeight() {
22049
22045
  var _a;
@@ -22080,24 +22076,24 @@ class ClrDatagridVirtualScrollDirective {
22080
22076
  this.updateCdkVirtualForInputs();
22081
22077
  }
22082
22078
  get itemSize() {
22083
- return this._cdkFixedSizeVirtualScrollInputs.itemSize;
22079
+ return this._itemSize;
22084
22080
  }
22085
22081
  set itemSize(value) {
22086
- this._cdkFixedSizeVirtualScrollInputs.itemSize = coerceNumberProperty(value);
22087
- this.updateFixedSizeVirtualScrollInputs();
22082
+ this._isUserProvidedItemSize = true;
22083
+ this.updateItemSize(value);
22088
22084
  }
22089
22085
  get minBufferPx() {
22090
- return this._cdkFixedSizeVirtualScrollInputs.minBufferPx;
22086
+ return this._minBufferPx;
22091
22087
  }
22092
22088
  set minBufferPx(value) {
22093
- this._cdkFixedSizeVirtualScrollInputs.minBufferPx = coerceNumberProperty(value);
22089
+ this._minBufferPx = coerceNumberProperty(value);
22094
22090
  this.updateFixedSizeVirtualScrollInputs();
22095
22091
  }
22096
22092
  get maxBufferPx() {
22097
- return this._cdkFixedSizeVirtualScrollInputs.maxBufferPx;
22093
+ return this._maxBufferPx;
22098
22094
  }
22099
22095
  set maxBufferPx(value) {
22100
- this._cdkFixedSizeVirtualScrollInputs.maxBufferPx = coerceNumberProperty(value);
22096
+ this._maxBufferPx = coerceNumberProperty(value);
22101
22097
  this.updateFixedSizeVirtualScrollInputs();
22102
22098
  }
22103
22099
  set dataRange(range) {
@@ -22171,6 +22167,10 @@ class ClrDatagridVirtualScrollDirective {
22171
22167
  var _a;
22172
22168
  (_a = this.virtualScrollViewport) === null || _a === void 0 ? void 0 : _a.scrollToIndex(index, behavior);
22173
22169
  }
22170
+ updateItemSize(value) {
22171
+ this._itemSize = coerceNumberProperty(value);
22172
+ this.updateFixedSizeVirtualScrollInputs();
22173
+ }
22174
22174
  updateDataRange(skip, data) {
22175
22175
  let items = this.cdkVirtualForOf;
22176
22176
  if (!this.persistItems || !items || (items === null || items === void 0 ? void 0 : items.length) !== this.totalItems) {
@@ -22190,7 +22190,7 @@ class ClrDatagridVirtualScrollDirective {
22190
22190
  }
22191
22191
  updateFixedSizeVirtualScrollInputs() {
22192
22192
  if (this.virtualScrollStrategy) {
22193
- this.virtualScrollStrategy.updateItemAndBufferSize(this._cdkFixedSizeVirtualScrollInputs.itemSize, this._cdkFixedSizeVirtualScrollInputs.minBufferPx, this._cdkFixedSizeVirtualScrollInputs.maxBufferPx);
22193
+ this.virtualScrollStrategy.updateItemAndBufferSize(this.itemSize, this.minBufferPx, this.maxBufferPx);
22194
22194
  }
22195
22195
  }
22196
22196
  updateAriaRowCount(rowCount) {
@@ -23879,6 +23879,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
23879
23879
  args: ['clrIfDetail']
23880
23880
  }] } });
23881
23881
 
23882
+ /*
23883
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23884
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23885
+ * This software is released under MIT license.
23886
+ * The full license information can be found in LICENSE in the root directory of this project.
23887
+ */
23888
+
23889
+ /*
23890
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23891
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23892
+ * This software is released under MIT license.
23893
+ * The full license information can be found in LICENSE in the root directory of this project.
23894
+ */
23895
+
23896
+ /*
23897
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23898
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23899
+ * This software is released under MIT license.
23900
+ * The full license information can be found in LICENSE in the root directory of this project.
23901
+ */
23902
+
23903
+ /*
23904
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23905
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23906
+ * This software is released under MIT license.
23907
+ * The full license information can be found in LICENSE in the root directory of this project.
23908
+ */
23909
+
23910
+ /*
23911
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23912
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23913
+ * This software is released under MIT license.
23914
+ * The full license information can be found in LICENSE in the root directory of this project.
23915
+ */
23916
+
23917
+ /*
23918
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23919
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23920
+ * This software is released under MIT license.
23921
+ * The full license information can be found in LICENSE in the root directory of this project.
23922
+ */
23923
+
23924
+ /*
23925
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23926
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23927
+ * This software is released under MIT license.
23928
+ * The full license information can be found in LICENSE in the root directory of this project.
23929
+ */
23930
+
23931
+ /*
23932
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23933
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23934
+ * This software is released under MIT license.
23935
+ * The full license information can be found in LICENSE in the root directory of this project.
23936
+ */
23937
+
23938
+ /*
23939
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23940
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23941
+ * This software is released under MIT license.
23942
+ * The full license information can be found in LICENSE in the root directory of this project.
23943
+ */
23944
+
23945
+ /*
23946
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23947
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23948
+ * This software is released under MIT license.
23949
+ * The full license information can be found in LICENSE in the root directory of this project.
23950
+ */
23951
+
23952
+ /*
23953
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23954
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23955
+ * This software is released under MIT license.
23956
+ * The full license information can be found in LICENSE in the root directory of this project.
23957
+ */
23958
+
23959
+ /*
23960
+ * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23961
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
23962
+ * This software is released under MIT license.
23963
+ * The full license information can be found in LICENSE in the root directory of this project.
23964
+ */
23965
+
23882
23966
  /*
23883
23967
  * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
23884
23968
  * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
@@ -23890,6 +23974,11 @@ class ClrDatagridPageSize {
23890
23974
  this.page = page;
23891
23975
  this.pageSizeOptionsId = uniqueIdFactory();
23892
23976
  }
23977
+ set label(label) {
23978
+ if (label) {
23979
+ label.disableGrid();
23980
+ }
23981
+ }
23893
23982
  ngOnInit() {
23894
23983
  if (!this.pageSizeOptions || this.pageSizeOptions.length === 0) {
23895
23984
  this.pageSizeOptions = [this.page.size];
@@ -23897,7 +23986,7 @@ class ClrDatagridPageSize {
23897
23986
  }
23898
23987
  }
23899
23988
  ClrDatagridPageSize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrDatagridPageSize, deps: [{ token: Page }], target: i0.ɵɵFactoryTarget.Component });
23900
- 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: `
23989
+ 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: `
23901
23990
  <label [for]="pageSizeOptionsId"><ng-content></ng-content></label>
23902
23991
  <div class="clr-select-wrapper">
23903
23992
  <select [id]="pageSizeOptionsId" [class.clr-page-size-select]="true" [(ngModel)]="page.size">
@@ -23924,6 +24013,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
23924
24013
  }], pageSizeOptionsId: [{
23925
24014
  type: Input,
23926
24015
  args: ['clrPageSizeOptionsId']
24016
+ }], label: [{
24017
+ type: ViewChild,
24018
+ args: [ClrLabel, { static: true }]
23927
24019
  }] } });
23928
24020
 
23929
24021
  /*
@@ -31263,90 +31355,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
31263
31355
  * The full license information can be found in LICENSE in the root directory of this project.
31264
31356
  */
31265
31357
 
31266
- /*
31267
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31268
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31269
- * This software is released under MIT license.
31270
- * The full license information can be found in LICENSE in the root directory of this project.
31271
- */
31272
-
31273
- /*
31274
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31275
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31276
- * This software is released under MIT license.
31277
- * The full license information can be found in LICENSE in the root directory of this project.
31278
- */
31279
-
31280
- /*
31281
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31282
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31283
- * This software is released under MIT license.
31284
- * The full license information can be found in LICENSE in the root directory of this project.
31285
- */
31286
-
31287
- /*
31288
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31289
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31290
- * This software is released under MIT license.
31291
- * The full license information can be found in LICENSE in the root directory of this project.
31292
- */
31293
-
31294
- /*
31295
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31296
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31297
- * This software is released under MIT license.
31298
- * The full license information can be found in LICENSE in the root directory of this project.
31299
- */
31300
-
31301
- /*
31302
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31303
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31304
- * This software is released under MIT license.
31305
- * The full license information can be found in LICENSE in the root directory of this project.
31306
- */
31307
-
31308
- /*
31309
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31310
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31311
- * This software is released under MIT license.
31312
- * The full license information can be found in LICENSE in the root directory of this project.
31313
- */
31314
-
31315
- /*
31316
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31317
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31318
- * This software is released under MIT license.
31319
- * The full license information can be found in LICENSE in the root directory of this project.
31320
- */
31321
-
31322
- /*
31323
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31324
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31325
- * This software is released under MIT license.
31326
- * The full license information can be found in LICENSE in the root directory of this project.
31327
- */
31328
-
31329
- /*
31330
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31331
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31332
- * This software is released under MIT license.
31333
- * The full license information can be found in LICENSE in the root directory of this project.
31334
- */
31335
-
31336
- /*
31337
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31338
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31339
- * This software is released under MIT license.
31340
- * The full license information can be found in LICENSE in the root directory of this project.
31341
- */
31342
-
31343
- /*
31344
- * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
31345
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
31346
- * This software is released under MIT license.
31347
- * The full license information can be found in LICENSE in the root directory of this project.
31348
- */
31349
-
31350
31358
  /**
31351
31359
  * Generated bundle index. Do not edit.
31352
31360
  */