ng-tailwind 7.0.0 → 7.0.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.
@@ -1,8 +1,9 @@
1
- import { EventEmitter, Injector } from '@angular/core';
1
+ import { EventEmitter, Injector, WritableSignal } from '@angular/core';
2
2
  import { AbstractControl, ControlValueAccessor } from '@angular/forms';
3
3
  export declare abstract class NgtControlValueAccessor implements ControlValueAccessor {
4
4
  onValueChangeEvent: EventEmitter<any>;
5
5
  formControl: AbstractControl;
6
+ touched: WritableSignal<boolean>;
6
7
  protected injector: Injector;
7
8
  private ignore;
8
9
  private _value;
@@ -67,6 +67,7 @@ export declare class NgtReactiveDateComponent extends NgtControlValueAccessor im
67
67
  private readonly formControlHasErrors;
68
68
  private readonly formControlIsDirty;
69
69
  private lastInputedDateString;
70
+ private subscriptions;
70
71
  constructor(ngtStylizableDirective: NgtStylizableDirective, ngtForm: NgtReactiveFormComponent, ngtSection: NgtSectionComponent, ngtModal: NgtModalComponent, formatterService: NgtReactiveDateFormatterService, injector: Injector);
71
72
  ngOnInit(): void;
72
73
  ngAfterViewInit(): void;
@@ -89,6 +90,7 @@ export declare class NgtReactiveDateComponent extends NgtControlValueAccessor im
89
90
  private getFormattedNativeValue;
90
91
  private getContainerClasses;
91
92
  private hasChangeBetweenValues;
93
+ private destroySubscriptions;
92
94
  static ɵfac: i0.ɵɵFactoryDeclaration<NgtReactiveDateComponent, [{ optional: true; self: true; }, { optional: true; skipSelf: true; }, { optional: true; skipSelf: true; }, { optional: true; skipSelf: true; }, null, null]>;
93
95
  static ɵcmp: i0.ɵɵComponentDeclaration<NgtReactiveDateComponent, "ngt-reactive-date", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "helpTitle": { "alias": "helpTitle"; "required": false; "isSignal": true; }; "helpText": { "alias": "helpText"; "required": false; "isSignal": true; }; "helpTextColor": { "alias": "helpTextColor"; "required": false; "isSignal": true; }; "dateFormat": { "alias": "dateFormat"; "required": false; "isSignal": true; }; "internalDateFormat": { "alias": "internalDateFormat"; "required": false; "isSignal": true; }; "showCalendarIcon": { "alias": "showCalendarIcon"; "required": false; "isSignal": true; }; "helperReverseYPosition": { "alias": "helperReverseYPosition"; "required": false; "isSignal": true; }; "shining": { "alias": "shining"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "minuteIncrement": { "alias": "minuteIncrement"; "required": false; "isSignal": true; }; "defaultDate": { "alias": "defaultDate"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "allowInput": { "alias": "allowInput"; "required": false; "isSignal": true; }; "allowClear": { "alias": "allowClear"; "required": false; "isSignal": true; }; "enableTime": { "alias": "enableTime"; "required": false; "isSignal": true; }; "time_24hr": { "alias": "time_24hr"; "required": false; "isSignal": true; }; "noCalendar": { "alias": "noCalendar"; "required": false; "isSignal": true; }; "isDisabled": { "alias": "isDisabled"; "required": false; "isSignal": true; }; "isReadonly": { "alias": "isReadonly"; "required": false; "isSignal": true; }; "isRequired": { "alias": "isRequired"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
94
96
  }
@@ -1,4 +1,4 @@
1
- import { AfterViewInit, ChangeDetectorRef, ElementRef, Injector, OnDestroy, Signal, WritableSignal } from '@angular/core';
1
+ import { AfterViewInit, ChangeDetectorRef, ElementRef, Injector, Signal, WritableSignal } from '@angular/core';
2
2
  import { AsyncValidatorFn, ValidatorFn } from '@angular/forms';
3
3
  import { NgxDropzoneChangeEvent, NgxDropzoneComponent } from 'ngx-dropzone';
4
4
  import { NgtControlValueAccessor } from '../../../../base/ngt-control-value-accessor';
@@ -13,7 +13,7 @@ import { NgtReactiveDropzoneViewerService } from './services/ngt-reactive-dropzo
13
13
  import { NgtReactiveDropzoneStateService } from './services/ngt-reactive-dropzone-state.service';
14
14
  import { NgtDropzoneFileViewerComponent } from '../../../shared/ngt-dropzone-file-viewer/ngt-dropzone-file-viewer.component';
15
15
  import * as i0 from "@angular/core";
16
- export declare class NgtReactiveDropzoneComponent extends NgtControlValueAccessor implements AfterViewInit, OnDestroy {
16
+ export declare class NgtReactiveDropzoneComponent extends NgtControlValueAccessor implements AfterViewInit {
17
17
  private ngtForm;
18
18
  private ngtSection;
19
19
  private ngtModal;
@@ -76,12 +76,10 @@ export declare class NgtReactiveDropzoneComponent extends NgtControlValueAccesso
76
76
  fileViewerFileSize: WritableSignal<number>;
77
77
  /** Internal Control */
78
78
  readonly ngxElementId: string;
79
- private subscriptions;
80
79
  constructor(ngtForm: NgtReactiveFormComponent, ngtSection: NgtSectionComponent, ngtModal: NgtModalComponent, validationService: NgtReactiveDropzoneValidationService, fileService: NgtReactiveDropzoneFileService, errorService: NgtReactiveDropzoneErrorService, viewerService: NgtReactiveDropzoneViewerService, stateService: NgtReactiveDropzoneStateService, changeDetector: ChangeDetectorRef, injector: Injector);
81
80
  get dropzoneHeight(): string;
82
81
  get uploadedResources(): any[];
83
82
  ngAfterViewInit(): void;
84
- ngOnDestroy(): void;
85
83
  onSelectFiles(event: NgxDropzoneChangeEvent): void;
86
84
  onImageClick(element: HTMLElement, index?: number): void;
87
85
  onFileClick(url: string, name: string, size: number): void;
@@ -102,9 +100,7 @@ export declare class NgtReactiveDropzoneComponent extends NgtControlValueAccesso
102
100
  private registerEffects;
103
101
  private setupComponent;
104
102
  private setupValidators;
105
- private setupSubscriptions;
106
103
  private hasChangesBetweenValues;
107
- private destroySubscriptions;
108
104
  static ɵfac: i0.ɵɵFactoryDeclaration<NgtReactiveDropzoneComponent, [{ optional: true; skipSelf: true; }, { optional: true; skipSelf: true; }, { optional: true; skipSelf: true; }, null, null, null, null, null, null, null]>;
109
105
  static ɵcmp: i0.ɵɵComponentDeclaration<NgtReactiveDropzoneComponent, "ngt-reactive-dropzone", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "helpTextColor": { "alias": "helpTextColor"; "required": false; "isSignal": true; }; "helpText": { "alias": "helpText"; "required": false; "isSignal": true; }; "helpTitle": { "alias": "helpTitle"; "required": false; "isSignal": true; }; "resources": { "alias": "resources"; "required": false; "isSignal": true; }; "multipleSelection": { "alias": "multipleSelection"; "required": false; "isSignal": true; }; "itemsLimit": { "alias": "itemsLimit"; "required": false; "isSignal": true; }; "showFileName": { "alias": "showFileName"; "required": false; "isSignal": true; }; "disableClick": { "alias": "disableClick"; "required": false; "isSignal": true; }; "isDisabled": { "alias": "isDisabled"; "required": false; "isSignal": true; }; "viewMode": { "alias": "viewMode"; "required": false; "isSignal": true; }; "removable": { "alias": "removable"; "required": false; "isSignal": true; }; "canDownloadFile": { "alias": "canDownloadFile"; "required": false; "isSignal": true; }; "verticalExpandable": { "alias": "verticalExpandable"; "required": false; "isSignal": true; }; "hideNgxDropzone": { "alias": "hideNgxDropzone"; "required": false; "isSignal": true; }; "acceptedFiles": { "alias": "acceptedFiles"; "required": false; "isSignal": true; }; "unacceptedFiles": { "alias": "unacceptedFiles"; "required": false; "isSignal": true; }; "maxFileSize": { "alias": "maxFileSize"; "required": false; "isSignal": true; }; "previewType": { "alias": "previewType"; "required": false; "isSignal": true; }; "remoteResource": { "alias": "remoteResource"; "required": false; "isSignal": true; }; "isRequired": { "alias": "isRequired"; "required": false; "isSignal": true; }; "customSyncValidators": { "alias": "customSyncValidators"; "required": false; "isSignal": true; }; "customAsyncValidators": { "alias": "customAsyncValidators"; "required": false; "isSignal": true; }; }, { "onFileSelected": "onFileSelected"; "onFileSelectError": "onFileSelectError"; "onFileUploadFail": "onFileUploadFail"; "onFileRemoved": "onFileRemoved"; "onFileUploadInit": "onFileUploadInit"; "onFileUploaded": "onFileUploaded"; "onFilePreviewLoaded": "onFilePreviewLoaded"; }, never, never, true, never>;
110
106
  }
@@ -9,8 +9,6 @@ export declare class NgtReactiveDropzoneStateService {
9
9
  readonly componentReady: WritableSignal<boolean>;
10
10
  readonly loading: WritableSignal<boolean>;
11
11
  readonly shining: WritableSignal<boolean>;
12
- readonly formControlHasErrors: WritableSignal<boolean>;
13
- readonly formControlIsDirty: WritableSignal<boolean>;
14
12
  reset(): void;
15
13
  static ɵfac: i0.ɵɵFactoryDeclaration<NgtReactiveDropzoneStateService, never>;
16
14
  static ɵprov: i0.ɵɵInjectableDeclaration<NgtReactiveDropzoneStateService>;
@@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
4
  import { Input, Directive, NgModule, ElementRef, ViewChild, ViewEncapsulation, Component, input, Optional, ChangeDetectionStrategy, EventEmitter, Output, Host, output, signal, computed, effect, SkipSelf, Self, forwardRef, TemplateRef, ContentChild, HostBinding, HostListener, Injectable, untracked } from '@angular/core';
5
5
  import * as i2 from '@angular/forms';
6
- import { ReactiveFormsModule, NgControl, NG_VALUE_ACCESSOR, NgForm, ControlContainer, Validators, FormsModule } from '@angular/forms';
6
+ import { ReactiveFormsModule, NgControl, NG_VALUE_ACCESSOR, NgForm, ControlContainer, Validators, FormsModule, TouchedChangeEvent } from '@angular/forms';
7
7
  import * as i1$1 from '@angular/router';
8
8
  import { RouterModule } from '@angular/router';
9
9
  import * as i1 from 'angular-svg-icon';
@@ -985,8 +985,12 @@ class NgtReactiveFormComponent {
985
985
  this.destroySubscriptions();
986
986
  }
987
987
  onSubmit() {
988
+ this.form().markAllAsTouched();
988
989
  this.isSubmitted = true;
989
- this.canShowInvalidFormMessage.set(!this.form().valid);
990
+ if (!this.form().valid) {
991
+ NgtReactiveFormComponent.onSubmitInvalidForm.emit(this.form());
992
+ this.canShowInvalidFormMessage.set(!this.isDisabledState());
993
+ }
990
994
  }
991
995
  setFormState(state, triggerChange = true) {
992
996
  this.formState.set(state);
@@ -1048,11 +1052,7 @@ class NgtReactiveFormComponent {
1048
1052
  }
1049
1053
  subcribeFormGroupStatusChanges() {
1050
1054
  return this.form().statusChanges.subscribe(() => {
1051
- if (!this.form().valid && this.isSubmitted) {
1052
- NgtReactiveFormComponent.onSubmitInvalidForm.emit(this.form());
1053
- this.canShowInvalidFormMessage.set(!this.isDisabledState());
1054
- }
1055
- else if (this.canShowInvalidFormMessage()) {
1055
+ if (this.form().valid && this.canShowInvalidFormMessage()) {
1056
1056
  this.canShowInvalidFormMessage.set(false);
1057
1057
  }
1058
1058
  });
@@ -1908,6 +1908,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1908
1908
  class NgtControlValueAccessor {
1909
1909
  constructor() {
1910
1910
  this.onValueChangeEvent = new EventEmitter;
1911
+ this.touched = signal(false);
1911
1912
  this.ignore = '{{{{INITIAL_VALUE_IGNORE}}}}';
1912
1913
  this._value = signal(this.ignore);
1913
1914
  this.onChange = (_) => { };
@@ -1915,6 +1916,7 @@ class NgtControlValueAccessor {
1915
1916
  if (!this.formControl) {
1916
1917
  this.formControl = this.getControl();
1917
1918
  }
1919
+ this.touched.set(true);
1918
1920
  this.formControl?.markAsTouched();
1919
1921
  };
1920
1922
  this.registerOnTouched(this.onTouched);
@@ -9406,10 +9408,9 @@ class NgtReactiveInputComponent extends NgtControlValueAccessor {
9406
9408
  if (value && typeof value === 'string' && this.mask() == InputMaskEnum.DECIMAL) {
9407
9409
  this.value = parseFloat(value);
9408
9410
  }
9409
- if (!this.getNativeValue() || (this.validateMinValueOnMask())) {
9411
+ if (this.hasChangesBetweenValues()) {
9410
9412
  this.setNativeValue(value ?? '');
9411
9413
  }
9412
- this.onValueChangeEvent.emit(this.value);
9413
9414
  }
9414
9415
  setFocus() {
9415
9416
  this.inputElement.nativeElement.focus();
@@ -9488,10 +9489,15 @@ class NgtReactiveInputComponent extends NgtControlValueAccessor {
9488
9489
  }
9489
9490
  }
9490
9491
  setupSubscriptions() {
9491
- this.subscriptions.push(this.formControl.statusChanges.subscribe(() => {
9492
- this.formControlHasErrors.set(!!this.formControl?.errors);
9493
- this.formControlIsDirty.set(this.formControl?.dirty);
9494
- }));
9492
+ if (this.formControl) {
9493
+ this.subscriptions.push(this.formControl.events.subscribe((event) => {
9494
+ if (event instanceof TouchedChangeEvent) {
9495
+ this.touched.set(event.touched);
9496
+ }
9497
+ this.formControlHasErrors.set(!!this.formControl?.errors);
9498
+ this.formControlIsDirty.set(this.formControl?.dirty);
9499
+ }));
9500
+ }
9495
9501
  const unlistenKeydown = this.renderer.listen(this.inputElement.nativeElement, "keydown", (event) => {
9496
9502
  if (this.getNativeValue()?.length >= this.maxLength()) {
9497
9503
  /** Backspace and delete */
@@ -9554,6 +9560,11 @@ class NgtReactiveInputComponent extends NgtControlValueAccessor {
9554
9560
  this.formControl.setValidators(syncValidators);
9555
9561
  this.formControl.setAsyncValidators(asyncValidators);
9556
9562
  this.formControl.updateValueAndValidity();
9563
+ if (this.value) {
9564
+ this.markAsDirty();
9565
+ this.formControlHasErrors.set(!!this.formControl.errors);
9566
+ this.formControlIsDirty.set(true);
9567
+ }
9557
9568
  }
9558
9569
  setupMask(previousMask) {
9559
9570
  const currentMask = this.mask();
@@ -9676,7 +9687,7 @@ class NgtReactiveInputComponent extends NgtControlValueAccessor {
9676
9687
  this.inputPaddingClass(),
9677
9688
  this.ngtStyle.compile(['h', 'text', 'color.border', 'color.bg', 'color.text', 'rounded', 'cursor'])
9678
9689
  ];
9679
- if (this.formControlHasErrors() && this.formControlIsDirty()) {
9690
+ if (this.formControlHasErrors() && this.formControlIsDirty() && this.touched()) {
9680
9691
  classes.push('input-has-error border-red-700');
9681
9692
  }
9682
9693
  return classes.join(' ');
@@ -9850,13 +9861,15 @@ class NgtReactiveTextareaComponent extends NgtControlValueAccessor {
9850
9861
  this.setupSubscriptions();
9851
9862
  }
9852
9863
  setupSubscriptions() {
9853
- if (!this.formControl) {
9854
- return;
9864
+ if (this.formControl) {
9865
+ this.subscriptions.push(this.formControl.events.subscribe((event) => {
9866
+ if (event instanceof TouchedChangeEvent) {
9867
+ this.touched.set(event.touched);
9868
+ }
9869
+ this.formControlHasErrors.set(!!this.formControl?.errors);
9870
+ this.formControlIsDirty.set(this.formControl?.dirty);
9871
+ }));
9855
9872
  }
9856
- this.subscriptions.push(this.formControl.statusChanges.subscribe(() => {
9857
- this.formControlHasErrors.set(!!this.formControl?.errors);
9858
- this.formControlIsDirty.set(this.formControl?.dirty);
9859
- }));
9860
9873
  const unlistenKeydown = this.renderer.listen(this.textareaElement.nativeElement, 'keydown', (event) => {
9861
9874
  if (this.getNativeValue()?.length >= this.maxLength()) {
9862
9875
  /** Backspace and delete */
@@ -9892,6 +9905,11 @@ class NgtReactiveTextareaComponent extends NgtControlValueAccessor {
9892
9905
  this.formControl.setValidators(syncValidators);
9893
9906
  this.formControl.setAsyncValidators(asyncValidators);
9894
9907
  this.formControl.updateValueAndValidity();
9908
+ if (this.value) {
9909
+ this.markAsDirty();
9910
+ this.formControlHasErrors.set(!!this.formControl.errors);
9911
+ this.formControlIsDirty.set(true);
9912
+ }
9895
9913
  }
9896
9914
  setupNgtStylizable() {
9897
9915
  this.ngtStyle = this.ngtStylizableDirective
@@ -9930,7 +9948,7 @@ class NgtReactiveTextareaComponent extends NgtControlValueAccessor {
9930
9948
  'flex border appearance-none focus:outline-none leading-tight w-full px-4 py-3',
9931
9949
  this.ngtStyle.compile(['text', 'color.border', 'color.bg', 'color.text', 'rounded'])
9932
9950
  ];
9933
- if (this.formControlHasErrors() && this.formControlIsDirty()) {
9951
+ if (this.formControlHasErrors() && this.formControlIsDirty() && this.touched()) {
9934
9952
  classes.push('input-has-error border-red-700');
9935
9953
  }
9936
9954
  return classes.join(' ');
@@ -10496,9 +10514,14 @@ class NgtReactiveSelectComponent extends NgtControlValueAccessor {
10496
10514
  if (!this.getElementTitle() || this.getElementTitle() === 'null') {
10497
10515
  this.ngSelectComponent.element.parentElement.parentElement.parentElement.title = '';
10498
10516
  }
10499
- this.subscriptions.push(this.formControl.statusChanges.subscribe(() => {
10500
- this.stateService.updateFormControlState(this.formControl);
10501
- }));
10517
+ if (this.formControl) {
10518
+ this.subscriptions.push(this.formControl.events.subscribe((event) => {
10519
+ if (event instanceof TouchedChangeEvent) {
10520
+ this.touched.set(event.touched);
10521
+ }
10522
+ this.stateService.updateFormControlState(this.formControl);
10523
+ }));
10524
+ }
10502
10525
  }
10503
10526
  ngOnDestroy() {
10504
10527
  this.searchService.clearSearchTimeout();
@@ -10635,6 +10658,11 @@ class NgtReactiveSelectComponent extends NgtControlValueAccessor {
10635
10658
  const syncValidators = this.validationService.getSyncValidators(config);
10636
10659
  this.formControl.setValidators(syncValidators);
10637
10660
  this.formControl.updateValueAndValidity();
10661
+ if (this.value) {
10662
+ this.markAsDirty();
10663
+ this.stateService.formControlHasErrors.set(!!this.formControl.errors);
10664
+ this.stateService.formControlIsDirty.set(true);
10665
+ }
10638
10666
  }
10639
10667
  setupNgtStylizable() {
10640
10668
  if (this.ngtStylizableDirective) {
@@ -10700,7 +10728,7 @@ class NgtReactiveSelectComponent extends NgtControlValueAccessor {
10700
10728
  if (this.isDisabledState()) {
10701
10729
  selectClass += ' select-border-disabled';
10702
10730
  }
10703
- else if (this.stateService.formControlHasErrors() && this.stateService.formControlIsDirty()) {
10731
+ else if (this.stateService.formControlHasErrors() && this.stateService.formControlIsDirty() && this.touched()) {
10704
10732
  selectClass += ' select-border-error';
10705
10733
  }
10706
10734
  else {
@@ -10942,6 +10970,7 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
10942
10970
  this.nativeValue = signal(null);
10943
10971
  this.formControlHasErrors = signal(false);
10944
10972
  this.formControlIsDirty = signal(false);
10973
+ this.subscriptions = [];
10945
10974
  this.setupNgtStylizable();
10946
10975
  this.registerEffects();
10947
10976
  }
@@ -10954,6 +10983,7 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
10954
10983
  }
10955
10984
  ngOnDestroy() {
10956
10985
  this.evDatePicker?.flatpickr?.['calendarContainer']?.remove();
10986
+ this.destroySubscriptions();
10957
10987
  }
10958
10988
  change(value) {
10959
10989
  if (!value || (Array.isArray(value) && !value.length)) {
@@ -11054,10 +11084,15 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
11054
11084
  });
11055
11085
  }
11056
11086
  setupSubscriptions() {
11057
- this.formControl?.statusChanges.subscribe(() => {
11058
- this.formControlHasErrors.set(!!this.formControl?.errors);
11059
- this.formControlIsDirty.set(this.formControl?.dirty);
11060
- });
11087
+ if (this.formControl) {
11088
+ this.subscriptions.push(this.formControl.events.subscribe((event) => {
11089
+ if (event instanceof TouchedChangeEvent) {
11090
+ this.touched.set(event.touched);
11091
+ }
11092
+ this.formControlHasErrors.set(!!this.formControl?.errors);
11093
+ this.formControlIsDirty.set(this.formControl?.dirty);
11094
+ }));
11095
+ }
11061
11096
  }
11062
11097
  registerEffects() {
11063
11098
  effect(() => this.setupValidators());
@@ -11072,6 +11107,11 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
11072
11107
  }
11073
11108
  this.formControl.setValidators(syncValidators);
11074
11109
  this.formControl.updateValueAndValidity();
11110
+ if (this.value) {
11111
+ this.markAsDirty();
11112
+ this.formControlHasErrors.set(!!this.formControl.errors);
11113
+ this.formControlIsDirty.set(true);
11114
+ }
11075
11115
  }
11076
11116
  setupDateInputMask() {
11077
11117
  if (this.locale() == NgtReactiveDateLocale.BRAZIL) {
@@ -11126,7 +11166,7 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
11126
11166
  'overflow-hidden border',
11127
11167
  this.ngtStyle.compile(['h', 'color.text', 'px', 'py', 'text', 'rounded', 'color.bg', 'color.border'])
11128
11168
  ];
11129
- if (this.formControlHasErrors() && this.formControlIsDirty()) {
11169
+ if (this.formControlHasErrors() && this.formControlIsDirty() && this.touched()) {
11130
11170
  classes.push('border-error');
11131
11171
  }
11132
11172
  return classes.join(' ');
@@ -11134,6 +11174,10 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
11134
11174
  hasChangeBetweenValues(a, b) {
11135
11175
  return JSON.stringify(a) != JSON.stringify(b);
11136
11176
  }
11177
+ destroySubscriptions() {
11178
+ this.subscriptions.forEach(subscription => subscription.unsubscribe());
11179
+ this.subscriptions = [];
11180
+ }
11137
11181
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgtReactiveDateComponent, deps: [{ token: NgtStylizableDirective, optional: true, self: true }, { token: NgtReactiveFormComponent, optional: true, skipSelf: true }, { token: NgtSectionComponent, optional: true, skipSelf: true }, { token: NgtModalComponent, optional: true, skipSelf: true }, { token: NgtReactiveDateFormatterService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
11138
11182
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: NgtReactiveDateComponent, isStandalone: true, selector: "ngt-reactive-date", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, helpTitle: { classPropertyName: "helpTitle", publicName: "helpTitle", isSignal: true, isRequired: false, transformFunction: null }, helpText: { classPropertyName: "helpText", publicName: "helpText", isSignal: true, isRequired: false, transformFunction: null }, helpTextColor: { classPropertyName: "helpTextColor", publicName: "helpTextColor", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "dateFormat", isSignal: true, isRequired: false, transformFunction: null }, internalDateFormat: { classPropertyName: "internalDateFormat", publicName: "internalDateFormat", isSignal: true, isRequired: false, transformFunction: null }, showCalendarIcon: { classPropertyName: "showCalendarIcon", publicName: "showCalendarIcon", isSignal: true, isRequired: false, transformFunction: null }, helperReverseYPosition: { classPropertyName: "helperReverseYPosition", publicName: "helperReverseYPosition", isSignal: true, isRequired: false, transformFunction: null }, shining: { classPropertyName: "shining", publicName: "shining", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, minuteIncrement: { classPropertyName: "minuteIncrement", publicName: "minuteIncrement", isSignal: true, isRequired: false, transformFunction: null }, defaultDate: { classPropertyName: "defaultDate", publicName: "defaultDate", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, allowInput: { classPropertyName: "allowInput", publicName: "allowInput", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, enableTime: { classPropertyName: "enableTime", publicName: "enableTime", isSignal: true, isRequired: false, transformFunction: null }, time_24hr: { classPropertyName: "time_24hr", publicName: "time_24hr", isSignal: true, isRequired: false, transformFunction: null }, noCalendar: { classPropertyName: "noCalendar", publicName: "noCalendar", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isReadonly: { classPropertyName: "isReadonly", publicName: "isReadonly", isSignal: true, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
11139
11183
  NgtValueAccessorProvider(NgtReactiveDateComponent),
@@ -11721,9 +11765,6 @@ class NgtReactiveDropzoneStateService {
11721
11765
  this.componentReady = signal(false);
11722
11766
  this.loading = signal(false);
11723
11767
  this.shining = signal(false);
11724
- // Form State
11725
- this.formControlHasErrors = signal(false);
11726
- this.formControlIsDirty = signal(false);
11727
11768
  }
11728
11769
  reset() {
11729
11770
  this.dropzoneHeight.set('180px');
@@ -11733,8 +11774,6 @@ class NgtReactiveDropzoneStateService {
11733
11774
  this.loading.set(false);
11734
11775
  this.shining.set(false);
11735
11776
  this.showFileViewer.set(false);
11736
- this.formControlHasErrors.set(false);
11737
- this.formControlIsDirty.set(false);
11738
11777
  }
11739
11778
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgtReactiveDropzoneStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
11740
11779
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgtReactiveDropzoneStateService }); }
@@ -11805,7 +11844,6 @@ class NgtReactiveDropzoneComponent extends NgtControlValueAccessor {
11805
11844
  this.fileViewerFileSize = signal(0);
11806
11845
  /** Internal Control */
11807
11846
  this.ngxElementId = uuid();
11808
- this.subscriptions = [];
11809
11847
  this.registerEffects();
11810
11848
  }
11811
11849
  get dropzoneHeight() {
@@ -11819,9 +11857,6 @@ class NgtReactiveDropzoneComponent extends NgtControlValueAccessor {
11819
11857
  this.setupComponent();
11820
11858
  setTimeout(() => this.stateService.componentReady.set(true), 500);
11821
11859
  }
11822
- ngOnDestroy() {
11823
- this.destroySubscriptions();
11824
- }
11825
11860
  onSelectFiles(event) {
11826
11861
  const errorResult = this.errorService.validateRejectedFiles(event);
11827
11862
  if (errorResult.hasError) {
@@ -11978,7 +12013,6 @@ class NgtReactiveDropzoneComponent extends NgtControlValueAccessor {
11978
12013
  }
11979
12014
  setupComponent() {
11980
12015
  this.setupValidators();
11981
- this.setupSubscriptions();
11982
12016
  if (this.value) {
11983
12017
  this.fileService.resetFilesLoad(Array.isArray(this.value) ? this.value : [this.value]);
11984
12018
  this.loadFilePreview(Array.isArray(this.value) ? this.value : [this.value]);
@@ -11996,24 +12030,13 @@ class NgtReactiveDropzoneComponent extends NgtControlValueAccessor {
11996
12030
  this.formControl.setValidators(syncValidators);
11997
12031
  this.formControl.setAsyncValidators(asyncValidators);
11998
12032
  this.formControl.updateValueAndValidity();
11999
- }
12000
- setupSubscriptions() {
12001
- if (!this.formControl) {
12002
- return;
12033
+ if (this.value) {
12034
+ this.markAsDirty();
12003
12035
  }
12004
- this.destroySubscriptions();
12005
- this.subscriptions.push(this.formControl.statusChanges.subscribe(() => {
12006
- this.stateService.formControlHasErrors.set(!!this.formControl?.errors);
12007
- this.stateService.formControlIsDirty.set(this.formControl?.dirty || false);
12008
- }));
12009
12036
  }
12010
12037
  hasChangesBetweenValues(a, b) {
12011
12038
  return JSON.stringify(a) !== JSON.stringify(b);
12012
12039
  }
12013
- destroySubscriptions() {
12014
- this.subscriptions.forEach(subscription => subscription.unsubscribe());
12015
- this.subscriptions = [];
12016
- }
12017
12040
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgtReactiveDropzoneComponent, deps: [{ token: NgtReactiveFormComponent, optional: true, skipSelf: true }, { token: NgtSectionComponent, optional: true, skipSelf: true }, { token: NgtModalComponent, optional: true, skipSelf: true }, { token: NgtReactiveDropzoneValidationService }, { token: NgtReactiveDropzoneFileService }, { token: NgtReactiveDropzoneErrorService }, { token: NgtReactiveDropzoneViewerService }, { token: NgtReactiveDropzoneStateService }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
12018
12041
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: NgtReactiveDropzoneComponent, isStandalone: true, selector: "ngt-reactive-dropzone", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, helpTextColor: { classPropertyName: "helpTextColor", publicName: "helpTextColor", isSignal: true, isRequired: false, transformFunction: null }, helpText: { classPropertyName: "helpText", publicName: "helpText", isSignal: true, isRequired: false, transformFunction: null }, helpTitle: { classPropertyName: "helpTitle", publicName: "helpTitle", isSignal: true, isRequired: false, transformFunction: null }, resources: { classPropertyName: "resources", publicName: "resources", isSignal: true, isRequired: false, transformFunction: null }, multipleSelection: { classPropertyName: "multipleSelection", publicName: "multipleSelection", isSignal: true, isRequired: false, transformFunction: null }, itemsLimit: { classPropertyName: "itemsLimit", publicName: "itemsLimit", isSignal: true, isRequired: false, transformFunction: null }, showFileName: { classPropertyName: "showFileName", publicName: "showFileName", isSignal: true, isRequired: false, transformFunction: null }, disableClick: { classPropertyName: "disableClick", publicName: "disableClick", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, viewMode: { classPropertyName: "viewMode", publicName: "viewMode", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, canDownloadFile: { classPropertyName: "canDownloadFile", publicName: "canDownloadFile", isSignal: true, isRequired: false, transformFunction: null }, verticalExpandable: { classPropertyName: "verticalExpandable", publicName: "verticalExpandable", isSignal: true, isRequired: false, transformFunction: null }, hideNgxDropzone: { classPropertyName: "hideNgxDropzone", publicName: "hideNgxDropzone", isSignal: true, isRequired: false, transformFunction: null }, acceptedFiles: { classPropertyName: "acceptedFiles", publicName: "acceptedFiles", isSignal: true, isRequired: false, transformFunction: null }, unacceptedFiles: { classPropertyName: "unacceptedFiles", publicName: "unacceptedFiles", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, previewType: { classPropertyName: "previewType", publicName: "previewType", isSignal: true, isRequired: false, transformFunction: null }, remoteResource: { classPropertyName: "remoteResource", publicName: "remoteResource", isSignal: true, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: true, isRequired: false, transformFunction: null }, customSyncValidators: { classPropertyName: "customSyncValidators", publicName: "customSyncValidators", isSignal: true, isRequired: false, transformFunction: null }, customAsyncValidators: { classPropertyName: "customAsyncValidators", publicName: "customAsyncValidators", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onFileSelected: "onFileSelected", onFileSelectError: "onFileSelectError", onFileUploadFail: "onFileUploadFail", onFileRemoved: "onFileRemoved", onFileUploadInit: "onFileUploadInit", onFileUploaded: "onFileUploaded", onFilePreviewLoaded: "onFilePreviewLoaded" }, providers: [
12019
12042
  NgtValueAccessorProvider(NgtReactiveDropzoneComponent),