@clr/angular 16.3.0 → 16.3.2

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.
@@ -1955,12 +1955,12 @@ class ClrPopoverPositionService {
1955
1955
  *
1956
1956
  * Note, more than 3 viewport violations and there isn't anything we can do to help. Also when there are two
1957
1957
  * violations, we can't help if the violations are TOP+BOTTOM || LEFT+RIGHT => There is no transformation we
1958
- * can make to the postion that will help.
1958
+ * can make to the position that will help.
1959
1959
  *
1960
1960
  * Some examples:
1961
1961
  * There is only one error and Primary axis is VERTICAL
1962
1962
  * - this.handleVerticalAxisOneViolation has a switch that will use the error sum to apply the correct
1963
- * transform to the postion based on the reduction of visibilityViolations.
1963
+ * transform to the position based on the reduction of visibilityViolations.
1964
1964
  *
1965
1965
  * There are two errors and Primary axis is HORIZONTAL
1966
1966
  * - handleHorizontalAxisTwoViolations has a switch that uses the error sum to apply both transforms needed to
@@ -1992,6 +1992,14 @@ class ClrPopoverPositionService {
1992
1992
  if (this.currentContentCoords.top < 0) {
1993
1993
  this.contentOffsets.yOffset += Math.abs(this.currentContentCoords.top);
1994
1994
  }
1995
+ /**
1996
+ * This detects the condition where the popover is flipped because it would violate the bottom of the viewport, but flipping it results in the
1997
+ * popover rendering above the top of the body (y coordinate outside the body). In that event, it should be rendered within the body
1998
+ * as much as possible, so this logic sets the top of popover to render touching the top of the body.
1999
+ */
2000
+ if (this.contentOffsets.yOffset + this.currentAnchorCoords.y < 0) {
2001
+ this.contentOffsets.yOffset = 0 - this.currentContentCoords.top;
2002
+ }
1995
2003
  return this.contentOffsets;
1996
2004
  }
1997
2005
  handleVerticalAxisOneViolation(errorSum) {
@@ -3817,16 +3825,14 @@ class ClrButtonGroup {
3817
3825
  this.menuButtons = tempInMenuButtons;
3818
3826
  }
3819
3827
  handleFocusOnMenuOpen() {
3820
- if (this.menuButtons.length) {
3821
- this.toggleService.popoverVisible.pipe(takeUntil(this.destroy$)).subscribe(visible => {
3822
- if (visible) {
3823
- this.focusHandler.initialize({
3824
- menu: this.menu.nativeElement,
3825
- menuToggle: this.menuToggle.nativeElement,
3826
- });
3827
- }
3828
- });
3829
- }
3828
+ this.toggleService.popoverVisible.pipe(takeUntil(this.destroy$)).subscribe(visible => {
3829
+ if (visible) {
3830
+ this.focusHandler.initialize({
3831
+ menu: this.menu.nativeElement,
3832
+ menuToggle: this.menuToggle.nativeElement,
3833
+ });
3834
+ }
3835
+ });
3830
3836
  }
3831
3837
  }
3832
3838
  ClrButtonGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrButtonGroup, deps: [{ token: ButtonInGroupService }, { token: ClrPopoverToggleService }, { token: ClrCommonStringsService }, { token: ClrDestroyService }, { token: ButtonGroupFocusHandler }], target: i0.ɵɵFactoryTarget.Component });
@@ -3925,7 +3931,7 @@ class ClrLoadingButton {
3925
3931
  }
3926
3932
  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 });
3927
3933
  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: `
3928
- <ng-container [ngSwitch]="state">
3934
+ <span @parent [ngSwitch]="state">
3929
3935
  <span *ngSwitchCase="buttonState.LOADING">
3930
3936
  <span @spinner class="spinner spinner-inline"></span>
3931
3937
  </span>
@@ -3939,8 +3945,13 @@ ClrLoadingButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versi
3939
3945
  <span *ngSwitchCase="buttonState.DEFAULT" @defaultButton>
3940
3946
  <ng-content></ng-content>
3941
3947
  </span>
3942
- </ng-container>
3948
+ </span>
3943
3949
  `, isInline: true, dependencies: [{ kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], animations: [
3950
+ trigger('parent', [
3951
+ // Skip :enter animation on first render.
3952
+ // The button text/content should only be faded when transitioning to or from a non-default state.
3953
+ transition(':enter', []),
3954
+ ]),
3944
3955
  trigger('defaultButton', [
3945
3956
  transition(':enter', [style({ opacity: 0 }), animate('200ms 100ms ease-in', style({ opacity: 1 }))]),
3946
3957
  // TODO: see if we can get leave animation to work before spinner's enter animation
@@ -3968,7 +3979,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
3968
3979
  args: [{
3969
3980
  selector: 'button[clrLoading]',
3970
3981
  template: `
3971
- <ng-container [ngSwitch]="state">
3982
+ <span @parent [ngSwitch]="state">
3972
3983
  <span *ngSwitchCase="buttonState.LOADING">
3973
3984
  <span @spinner class="spinner spinner-inline"></span>
3974
3985
  </span>
@@ -3982,10 +3993,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
3982
3993
  <span *ngSwitchCase="buttonState.DEFAULT" @defaultButton>
3983
3994
  <ng-content></ng-content>
3984
3995
  </span>
3985
- </ng-container>
3996
+ </span>
3986
3997
  `,
3987
3998
  providers: [{ provide: LoadingListener, useExisting: ClrLoadingButton }],
3988
3999
  animations: [
4000
+ trigger('parent', [
4001
+ // Skip :enter animation on first render.
4002
+ // The button text/content should only be faded when transitioning to or from a non-default state.
4003
+ transition(':enter', []),
4004
+ ]),
3989
4005
  trigger('defaultButton', [
3990
4006
  transition(':enter', [style({ opacity: 0 }), animate('200ms 100ms ease-in', style({ opacity: 1 }))]),
3991
4007
  // TODO: see if we can get leave animation to work before spinner's enter animation
@@ -8402,7 +8418,7 @@ class DateIOService {
8402
8418
  return '';
8403
8419
  }
8404
8420
  getDateValueFromDateString(date) {
8405
- if (!date) {
8421
+ if (!date || typeof date !== 'string') {
8406
8422
  return null;
8407
8423
  }
8408
8424
  const dateParts = date.match(USER_INPUT_REGEX);
@@ -9608,9 +9624,11 @@ class ClrDateInput extends WrappedFormControl {
9608
9624
  }
9609
9625
  set min(dateString) {
9610
9626
  this.dateIOService.setMinDate(dateString);
9627
+ this.triggerControlValidation();
9611
9628
  }
9612
9629
  set max(dateString) {
9613
9630
  this.dateIOService.setMaxDate(dateString);
9631
+ this.triggerControlValidation();
9614
9632
  }
9615
9633
  get disabled() {
9616
9634
  if (this.dateFormControlService) {
@@ -9675,6 +9693,13 @@ class ClrDateInput extends WrappedFormControl {
9675
9693
  this.focusService.focused = focus;
9676
9694
  }
9677
9695
  }
9696
+ triggerControlValidation() {
9697
+ if (this.datepickerHasFormControl()) {
9698
+ // Set `emitEvent` to false to prevent unnecessary value change event. Status change event will be emitted by `setErrors` below.
9699
+ this.control.control?.updateValueAndValidity({ emitEvent: false });
9700
+ this.control.control?.setErrors(this.control.control.errors);
9701
+ }
9702
+ }
9678
9703
  populateServicesFromContainerComponent() {
9679
9704
  if (!this.container) {
9680
9705
  this.dateIOService = this.getProviderFromContainer(DateIOService);
@@ -19954,7 +19979,7 @@ class ClrAlert {
19954
19979
  }
19955
19980
  const isCurrentAlert = this.multiAlertService?.currentAlert === this;
19956
19981
  this._closed = true;
19957
- if (this.multiAlertService) {
19982
+ if (this.multiAlertService?.activeAlerts) {
19958
19983
  this.multiAlertService.close(isCurrentAlert);
19959
19984
  }
19960
19985
  this._closedChanged.emit(true);