@ascentgl/ads-ui 20.0.28 → 20.0.29

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Input, Component, NgModule, input, output, computed, ChangeDetectionStrategy, signal, effect, ViewChild, ElementRef, HostListener, Directive, EventEmitter, Output, inject, Pipe, contentChild, TemplateRef, Inject, Optional, ChangeDetectorRef, Injectable, viewChild } from '@angular/core';
2
+ import { Input, Component, NgModule, input, output, computed, ChangeDetectionStrategy, signal, effect, ViewChild, ElementRef, HostListener, Directive, EventEmitter, Output, inject, DestroyRef, Pipe, contentChild, TemplateRef, Inject, Optional, ChangeDetectorRef, Injectable, viewChild } from '@angular/core';
3
3
  import * as i1 from '@ascentgl/ads-icons';
4
4
  import { AdsIconModule, AdsIconRegistry } from '@ascentgl/ads-icons';
5
5
  import { adsIconUserCircle, adsIconBell, adsIconChevronRight, adsIconCross, adsIconPlus, adsIconWarning, adsIconLock, adsIconPlusCircle, adsIconSearch, adsIconSortDescending, adsIconCheckCircleFilled, adsIconVisibilityEye, adsIconVisibilityEyeNone, adsIconStatusProcessing, adsIconInformation, adsIconChevronDown, adsIconLoading, adsIconDatepicker, adsIconTimepicker, adsIconCheck, adsIconChevronUp, adsIconMenuMoreInfo, adsIconHamburgerMenu } from '@ascentgl/ads-icons/icons';
@@ -12,11 +12,11 @@ import { RouterModule, RouterLinkActive, RouterLink, RouterOutlet, NavigationSta
12
12
  import * as i7 from '@angular/material/button';
13
13
  import { MatButtonModule, MatIconButton, MatButton } from '@angular/material/button';
14
14
  import * as i4 from '@angular/forms';
15
- import { FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
15
+ import { FormControl, Validators, ReactiveFormsModule, TouchedChangeEvent } from '@angular/forms';
16
16
  import * as i4$1 from '@angular/cdk/overlay';
17
17
  import { OverlayModule } from '@angular/cdk/overlay';
18
18
  import { Subject, asapScheduler, timer, of, Subscription, combineLatest } from 'rxjs';
19
- import { takeUntil, map, tap, debounce, filter } from 'rxjs/operators';
19
+ import { takeUntil, filter, map, tap, debounce } from 'rxjs/operators';
20
20
  import * as i3 from '@angular/platform-browser';
21
21
  import { DomHelper, AdsGestureModule, ObjectHelper } from '@ascentgl/ads-utils';
22
22
  import * as i2$1 from '@angular/material/progress-spinner';
@@ -2305,6 +2305,15 @@ class AbstractBaseComponent {
2305
2305
  */
2306
2306
  if (control instanceof FormControl) {
2307
2307
  this.valueControl = control;
2308
+ const subscription = this.valueControl.events
2309
+ .pipe(filter((event) => event instanceof TouchedChangeEvent))
2310
+ .subscribe((event) => {
2311
+ if (event.touched) {
2312
+ this.syncState();
2313
+ this.displayControl.updateValueAndValidity({ emitEvent: false });
2314
+ }
2315
+ });
2316
+ this.destroyRef.onDestroy(() => subscription.unsubscribe());
2308
2317
  }
2309
2318
  else {
2310
2319
  throw Error('Control must be a "FormControl" instance');
@@ -2327,6 +2336,7 @@ class AbstractBaseComponent {
2327
2336
  this.showFooter = true;
2328
2337
  /** @ignore */
2329
2338
  this.registry = inject(AdsIconRegistry);
2339
+ this.destroyRef = inject(DestroyRef);
2330
2340
  /** Component width. Must include units of measure: px, %, em, rem, etc. */
2331
2341
  this.width = '100%';
2332
2342
  /** @ignore */
@@ -2390,7 +2400,12 @@ class AbstractBaseComponent {
2390
2400
  /** @ignore */
2391
2401
  syncState() {
2392
2402
  if (this.displayControl.disabled !== this.valueControl.disabled) {
2393
- this.valueControl.disabled ? this.displayControl.disable() : this.displayControl.enable();
2403
+ if (this.valueControl.disabled) {
2404
+ this.displayControl.disable();
2405
+ }
2406
+ else {
2407
+ this.displayControl.enable();
2408
+ }
2394
2409
  }
2395
2410
  if (this.valueControl.pristine) {
2396
2411
  this.displayControl.markAsPristine();