@clr/angular 16.3.2 → 16.3.4

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, take, first, switchMap } from 'rxjs/operators';
6
+ import { map, tap, startWith, distinctUntilChanged, filter, skipUntil, 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';
@@ -361,8 +361,8 @@ const commonStringsDefault = {
361
361
  * Password Input
362
362
  * Screen-reader text for the hide/show password field button
363
363
  */
364
- passwordHide: 'Hide password',
365
- passwordShow: 'Show password',
364
+ passwordHide: 'Hide password for {LABEL}',
365
+ passwordShow: 'Show password for {LABEL}',
366
366
  /**
367
367
  * Datagrid footer; sr-only text after the number of selected rows.
368
368
  */
@@ -960,6 +960,12 @@ class StepperModel extends AccordionModel {
960
960
  }
961
961
  });
962
962
  }
963
+ setPanelValid(panelId) {
964
+ this._panels[panelId].status = AccordionStatus.Complete;
965
+ }
966
+ setPanelInvalid(panelId) {
967
+ this._panels[panelId].status = AccordionStatus.Error;
968
+ }
963
969
  setPanelsWithErrors(ids) {
964
970
  ids.forEach(id => this.setPanelError(id));
965
971
  }
@@ -1043,6 +1049,14 @@ class StepperService extends AccordionService {
1043
1049
  this.accordion.resetPanels();
1044
1050
  this.emitUpdatedPanels();
1045
1051
  }
1052
+ setPanelValid(panelId) {
1053
+ this.accordion.setPanelValid(panelId);
1054
+ this.emitUpdatedPanels();
1055
+ }
1056
+ setPanelInvalid(panelId) {
1057
+ this.accordion.setPanelInvalid(panelId);
1058
+ this.emitUpdatedPanels();
1059
+ }
1046
1060
  setPanelsWithErrors(ids) {
1047
1061
  this.accordion.setPanelsWithErrors(ids);
1048
1062
  this.emitUpdatedPanels();
@@ -1105,11 +1119,16 @@ class ClrStepperPanel extends ClrAccordionPanel {
1105
1119
  this.panel = this.panel.pipe(tap(panel => this.triggerAllFormControlValidationIfError(panel)));
1106
1120
  this.stepperService.disablePanel(this.id, true);
1107
1121
  this.listenToFocusChanges();
1122
+ // not all stepper panels are guaranteed to have a form (i.e. empty template-driven)
1108
1123
  if (this.formGroup) {
1109
- // not all stepper panels are guaranteed to have a form (i.e. empty template-driven)
1110
- this.subscriptions.push(this.formGroup.statusChanges.pipe(pairwise()).subscribe(([prevStatus, newStatus]) => {
1111
- if ('VALID' === prevStatus && 'INVALID' === newStatus) {
1112
- this.stepperService.navigateToNextPanel(this.id, this.formGroup.valid);
1124
+ // set panel status on form status change only after the form becomes invalid
1125
+ const invalidStatusTrigger = this.formGroup.statusChanges.pipe(filter(status => status === 'INVALID'));
1126
+ this.subscriptions.push(this.formGroup.statusChanges.pipe(skipUntil(invalidStatusTrigger), distinctUntilChanged()).subscribe(status => {
1127
+ if (status === 'VALID') {
1128
+ this.stepperService.setPanelValid(this.id);
1129
+ }
1130
+ else if (status === 'INVALID') {
1131
+ this.stepperService.setPanelInvalid(this.id);
1113
1132
  }
1114
1133
  }));
1115
1134
  }
@@ -3932,17 +3951,17 @@ class ClrLoadingButton {
3932
3951
  ClrLoadingButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrLoadingButton, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
3933
3952
  ClrLoadingButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.2", type: ClrLoadingButton, selector: "button[clrLoading]", inputs: { disabled: "disabled" }, outputs: { clrLoadingChange: "clrLoadingChange" }, host: { properties: { "attr.disabled": "disabled? '' : null" } }, providers: [{ provide: LoadingListener, useExisting: ClrLoadingButton }], ngImport: i0, template: `
3934
3953
  <span @parent [ngSwitch]="state">
3935
- <span *ngSwitchCase="buttonState.LOADING">
3954
+ <ng-container *ngSwitchCase="buttonState.LOADING">
3936
3955
  <span @spinner class="spinner spinner-inline"></span>
3937
- </span>
3938
- <span *ngSwitchCase="buttonState.SUCCESS">
3956
+ </ng-container>
3957
+ <ng-container *ngSwitchCase="buttonState.SUCCESS">
3939
3958
  <span
3940
3959
  @validated
3941
3960
  (@validated.done)="this.loadingStateChange(this.buttonState.DEFAULT)"
3942
3961
  class="spinner spinner-inline spinner-check"
3943
3962
  ></span>
3944
- </span>
3945
- <span *ngSwitchCase="buttonState.DEFAULT" @defaultButton>
3963
+ </ng-container>
3964
+ <span *ngSwitchCase="buttonState.DEFAULT" @defaultButton class="clr-loading-btn-content">
3946
3965
  <ng-content></ng-content>
3947
3966
  </span>
3948
3967
  </span>
@@ -3980,17 +3999,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
3980
3999
  selector: 'button[clrLoading]',
3981
4000
  template: `
3982
4001
  <span @parent [ngSwitch]="state">
3983
- <span *ngSwitchCase="buttonState.LOADING">
4002
+ <ng-container *ngSwitchCase="buttonState.LOADING">
3984
4003
  <span @spinner class="spinner spinner-inline"></span>
3985
- </span>
3986
- <span *ngSwitchCase="buttonState.SUCCESS">
4004
+ </ng-container>
4005
+ <ng-container *ngSwitchCase="buttonState.SUCCESS">
3987
4006
  <span
3988
4007
  @validated
3989
4008
  (@validated.done)="this.loadingStateChange(this.buttonState.DEFAULT)"
3990
4009
  class="spinner spinner-inline spinner-check"
3991
4010
  ></span>
3992
- </span>
3993
- <span *ngSwitchCase="buttonState.DEFAULT" @defaultButton>
4011
+ </ng-container>
4012
+ <span *ngSwitchCase="buttonState.DEFAULT" @defaultButton class="clr-loading-btn-content">
3994
4013
  <ng-content></ng-content>
3995
4014
  </span>
3996
4015
  </span>
@@ -7166,25 +7185,24 @@ class ClrOptionItems {
7166
7185
  if (!this._rawItems || this.filter === undefined || this.filter === null) {
7167
7186
  return;
7168
7187
  }
7188
+ const normalizedFilterValue = normalizeValue(this.filter);
7169
7189
  if (this.optionService.showAllOptions) {
7170
7190
  this.filteredItems = this._rawItems;
7171
7191
  }
7172
7192
  else if (this._filterField) {
7173
7193
  this.filteredItems = this._rawItems.filter(item => {
7174
7194
  const objValue = item[this._filterField];
7175
- return objValue ? objValue.toString().toLowerCase().indexOf(this.filter.toLowerCase().toString()) > -1 : false;
7195
+ return objValue ? normalizeValue(objValue).includes(normalizedFilterValue) : false;
7176
7196
  });
7177
7197
  }
7178
7198
  else {
7179
7199
  // Filter by all item object values
7180
7200
  this.filteredItems = this._rawItems.filter(item => {
7181
7201
  if (typeof item !== 'object') {
7182
- return item.toString().toLowerCase().indexOf(this.filter.toString().toLowerCase()) > -1;
7202
+ return normalizeValue(item).includes(normalizedFilterValue);
7183
7203
  }
7184
7204
  const objValues = Object.values(item).filter(value => {
7185
- return value !== null && value !== undefined
7186
- ? value.toString().toLowerCase().indexOf(this.filter.toString().toLowerCase()) > -1
7187
- : false;
7205
+ return value !== null && value !== undefined ? normalizeValue(value).includes(normalizedFilterValue) : false;
7188
7206
  });
7189
7207
  return objValues.length > 0;
7190
7208
  });
@@ -7209,6 +7227,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
7209
7227
  type: Input,
7210
7228
  args: ['clrOptionItemsField']
7211
7229
  }] } });
7230
+ function normalizeValue(value) {
7231
+ return value
7232
+ .toString()
7233
+ .normalize('NFD')
7234
+ .replace(/\p{Diacritic}/gu, '')
7235
+ .toLowerCase();
7236
+ }
7212
7237
 
7213
7238
  /*
7214
7239
  * Copyright (c) 2016-2023 VMware, Inc. All Rights Reserved.
@@ -10005,6 +10030,12 @@ class ClrPasswordContainer extends ClrAbstractContainer {
10005
10030
  this.show = !this.show;
10006
10031
  this.toggleService.next(this.show);
10007
10032
  }
10033
+ showPasswordText(label) {
10034
+ return this.commonStrings.parse(this.commonStrings.keys.passwordShow, { LABEL: label });
10035
+ }
10036
+ hidePasswordText(label) {
10037
+ return this.commonStrings.parse(this.commonStrings.keys.passwordHide, { LABEL: label });
10038
+ }
10008
10039
  }
10009
10040
  ClrPasswordContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrPasswordContainer, deps: [{ token: IfControlStateService }, { token: LayoutService, optional: true }, { token: ControlClassService }, { token: NgControlService }, { token: FocusService }, { token: TOGGLE_SERVICE }, { token: ClrCommonStringsService }], target: i0.ɵɵFactoryTarget.Component });
10010
10041
  ClrPasswordContainer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.2", type: ClrPasswordContainer, selector: "clr-password-container", inputs: { clrToggle: "clrToggle" }, host: { properties: { "class.clr-form-control": "true", "class.clr-form-control-disabled": "control?.disabled", "class.clr-row": "addGrid()" } }, providers: [
@@ -10030,7 +10061,7 @@ ClrPasswordContainer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", v
10030
10061
  >
10031
10062
  <cds-icon status="info" class="clr-password-eye-icon" [attr.shape]="show ? 'eye-hide' : 'eye'"></cds-icon>
10032
10063
  <span class="clr-sr-only">
10033
- {{ show ? commonStrings.keys.passwordHide : commonStrings.keys.passwordShow }}
10064
+ {{ show ? hidePasswordText(label?.labelText) : showPasswordText(label?.labelText) }}
10034
10065
  </span>
10035
10066
  </button>
10036
10067
  </div>
@@ -10074,7 +10105,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
10074
10105
  >
10075
10106
  <cds-icon status="info" class="clr-password-eye-icon" [attr.shape]="show ? 'eye-hide' : 'eye'"></cds-icon>
10076
10107
  <span class="clr-sr-only">
10077
- {{ show ? commonStrings.keys.passwordHide : commonStrings.keys.passwordShow }}
10108
+ {{ show ? hidePasswordText(label?.labelText) : showPasswordText(label?.labelText) }}
10078
10109
  </span>
10079
10110
  </button>
10080
10111
  </div>
@@ -13577,6 +13608,7 @@ class ClrSignpostTrigger {
13577
13608
  this.signpostIdService = signpostIdService;
13578
13609
  this.signpostFocusManager = signpostFocusManager;
13579
13610
  this.platformId = platformId;
13611
+ this.ariaExpanded = false;
13580
13612
  this.subscriptions = [];
13581
13613
  this.document = document;
13582
13614
  }