ng-tailwind 7.0.0 → 7.0.1
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.
- package/base/ngt-control-value-accessor.d.ts +2 -1
- package/components/forms/reactive/ngt-reactive-date/ngt-reactive-date.component.d.ts +2 -0
- package/components/forms/reactive/ngt-reactive-dropzone/ngt-reactive-dropzone.component.d.ts +2 -6
- package/components/forms/reactive/ngt-reactive-dropzone/services/ngt-reactive-dropzone-state.service.d.ts +0 -2
- package/fesm2022/ng-tailwind.mjs +75 -51
- package/fesm2022/ng-tailwind.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
}
|
package/components/forms/reactive/ngt-reactive-dropzone/ngt-reactive-dropzone.component.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AfterViewInit, ChangeDetectorRef, ElementRef, Injector,
|
|
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
|
|
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>;
|
package/fesm2022/ng-tailwind.mjs
CHANGED
|
@@ -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
|
-
|
|
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 (
|
|
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);
|
|
@@ -9488,10 +9490,15 @@ class NgtReactiveInputComponent extends NgtControlValueAccessor {
|
|
|
9488
9490
|
}
|
|
9489
9491
|
}
|
|
9490
9492
|
setupSubscriptions() {
|
|
9491
|
-
|
|
9492
|
-
this.
|
|
9493
|
-
|
|
9494
|
-
|
|
9493
|
+
if (this.formControl) {
|
|
9494
|
+
this.subscriptions.push(this.formControl.events.subscribe((event) => {
|
|
9495
|
+
if (event instanceof TouchedChangeEvent) {
|
|
9496
|
+
this.touched.set(true);
|
|
9497
|
+
}
|
|
9498
|
+
this.formControlHasErrors.set(!!this.formControl?.errors);
|
|
9499
|
+
this.formControlIsDirty.set(this.formControl?.dirty);
|
|
9500
|
+
}));
|
|
9501
|
+
}
|
|
9495
9502
|
const unlistenKeydown = this.renderer.listen(this.inputElement.nativeElement, "keydown", (event) => {
|
|
9496
9503
|
if (this.getNativeValue()?.length >= this.maxLength()) {
|
|
9497
9504
|
/** Backspace and delete */
|
|
@@ -9554,6 +9561,11 @@ class NgtReactiveInputComponent extends NgtControlValueAccessor {
|
|
|
9554
9561
|
this.formControl.setValidators(syncValidators);
|
|
9555
9562
|
this.formControl.setAsyncValidators(asyncValidators);
|
|
9556
9563
|
this.formControl.updateValueAndValidity();
|
|
9564
|
+
if (this.value) {
|
|
9565
|
+
this.markAsDirty();
|
|
9566
|
+
this.formControlHasErrors.set(!!this.formControl.errors);
|
|
9567
|
+
this.formControlIsDirty.set(true);
|
|
9568
|
+
}
|
|
9557
9569
|
}
|
|
9558
9570
|
setupMask(previousMask) {
|
|
9559
9571
|
const currentMask = this.mask();
|
|
@@ -9676,7 +9688,7 @@ class NgtReactiveInputComponent extends NgtControlValueAccessor {
|
|
|
9676
9688
|
this.inputPaddingClass(),
|
|
9677
9689
|
this.ngtStyle.compile(['h', 'text', 'color.border', 'color.bg', 'color.text', 'rounded', 'cursor'])
|
|
9678
9690
|
];
|
|
9679
|
-
if (this.formControlHasErrors() && this.formControlIsDirty()) {
|
|
9691
|
+
if (this.formControlHasErrors() && this.formControlIsDirty() && this.touched()) {
|
|
9680
9692
|
classes.push('input-has-error border-red-700');
|
|
9681
9693
|
}
|
|
9682
9694
|
return classes.join(' ');
|
|
@@ -9850,13 +9862,15 @@ class NgtReactiveTextareaComponent extends NgtControlValueAccessor {
|
|
|
9850
9862
|
this.setupSubscriptions();
|
|
9851
9863
|
}
|
|
9852
9864
|
setupSubscriptions() {
|
|
9853
|
-
if (
|
|
9854
|
-
|
|
9865
|
+
if (this.formControl) {
|
|
9866
|
+
this.subscriptions.push(this.formControl.events.subscribe((event) => {
|
|
9867
|
+
if (event instanceof TouchedChangeEvent) {
|
|
9868
|
+
this.touched.set(true);
|
|
9869
|
+
}
|
|
9870
|
+
this.formControlHasErrors.set(!!this.formControl?.errors);
|
|
9871
|
+
this.formControlIsDirty.set(this.formControl?.dirty);
|
|
9872
|
+
}));
|
|
9855
9873
|
}
|
|
9856
|
-
this.subscriptions.push(this.formControl.statusChanges.subscribe(() => {
|
|
9857
|
-
this.formControlHasErrors.set(!!this.formControl?.errors);
|
|
9858
|
-
this.formControlIsDirty.set(this.formControl?.dirty);
|
|
9859
|
-
}));
|
|
9860
9874
|
const unlistenKeydown = this.renderer.listen(this.textareaElement.nativeElement, 'keydown', (event) => {
|
|
9861
9875
|
if (this.getNativeValue()?.length >= this.maxLength()) {
|
|
9862
9876
|
/** Backspace and delete */
|
|
@@ -9892,6 +9906,11 @@ class NgtReactiveTextareaComponent extends NgtControlValueAccessor {
|
|
|
9892
9906
|
this.formControl.setValidators(syncValidators);
|
|
9893
9907
|
this.formControl.setAsyncValidators(asyncValidators);
|
|
9894
9908
|
this.formControl.updateValueAndValidity();
|
|
9909
|
+
if (this.value) {
|
|
9910
|
+
this.markAsDirty();
|
|
9911
|
+
this.formControlHasErrors.set(!!this.formControl.errors);
|
|
9912
|
+
this.formControlIsDirty.set(true);
|
|
9913
|
+
}
|
|
9895
9914
|
}
|
|
9896
9915
|
setupNgtStylizable() {
|
|
9897
9916
|
this.ngtStyle = this.ngtStylizableDirective
|
|
@@ -9930,7 +9949,7 @@ class NgtReactiveTextareaComponent extends NgtControlValueAccessor {
|
|
|
9930
9949
|
'flex border appearance-none focus:outline-none leading-tight w-full px-4 py-3',
|
|
9931
9950
|
this.ngtStyle.compile(['text', 'color.border', 'color.bg', 'color.text', 'rounded'])
|
|
9932
9951
|
];
|
|
9933
|
-
if (this.formControlHasErrors() && this.formControlIsDirty()) {
|
|
9952
|
+
if (this.formControlHasErrors() && this.formControlIsDirty() && this.touched()) {
|
|
9934
9953
|
classes.push('input-has-error border-red-700');
|
|
9935
9954
|
}
|
|
9936
9955
|
return classes.join(' ');
|
|
@@ -10496,9 +10515,14 @@ class NgtReactiveSelectComponent extends NgtControlValueAccessor {
|
|
|
10496
10515
|
if (!this.getElementTitle() || this.getElementTitle() === 'null') {
|
|
10497
10516
|
this.ngSelectComponent.element.parentElement.parentElement.parentElement.title = '';
|
|
10498
10517
|
}
|
|
10499
|
-
|
|
10500
|
-
this.
|
|
10501
|
-
|
|
10518
|
+
if (this.formControl) {
|
|
10519
|
+
this.subscriptions.push(this.formControl.events.subscribe((event) => {
|
|
10520
|
+
if (event instanceof TouchedChangeEvent) {
|
|
10521
|
+
this.touched.set(true);
|
|
10522
|
+
}
|
|
10523
|
+
this.stateService.updateFormControlState(this.formControl);
|
|
10524
|
+
}));
|
|
10525
|
+
}
|
|
10502
10526
|
}
|
|
10503
10527
|
ngOnDestroy() {
|
|
10504
10528
|
this.searchService.clearSearchTimeout();
|
|
@@ -10635,6 +10659,11 @@ class NgtReactiveSelectComponent extends NgtControlValueAccessor {
|
|
|
10635
10659
|
const syncValidators = this.validationService.getSyncValidators(config);
|
|
10636
10660
|
this.formControl.setValidators(syncValidators);
|
|
10637
10661
|
this.formControl.updateValueAndValidity();
|
|
10662
|
+
if (this.value) {
|
|
10663
|
+
this.markAsDirty();
|
|
10664
|
+
this.stateService.formControlHasErrors.set(!!this.formControl.errors);
|
|
10665
|
+
this.stateService.formControlIsDirty.set(true);
|
|
10666
|
+
}
|
|
10638
10667
|
}
|
|
10639
10668
|
setupNgtStylizable() {
|
|
10640
10669
|
if (this.ngtStylizableDirective) {
|
|
@@ -10700,7 +10729,7 @@ class NgtReactiveSelectComponent extends NgtControlValueAccessor {
|
|
|
10700
10729
|
if (this.isDisabledState()) {
|
|
10701
10730
|
selectClass += ' select-border-disabled';
|
|
10702
10731
|
}
|
|
10703
|
-
else if (this.stateService.formControlHasErrors() && this.stateService.formControlIsDirty()) {
|
|
10732
|
+
else if (this.stateService.formControlHasErrors() && this.stateService.formControlIsDirty() && this.touched()) {
|
|
10704
10733
|
selectClass += ' select-border-error';
|
|
10705
10734
|
}
|
|
10706
10735
|
else {
|
|
@@ -10942,6 +10971,7 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
|
|
|
10942
10971
|
this.nativeValue = signal(null);
|
|
10943
10972
|
this.formControlHasErrors = signal(false);
|
|
10944
10973
|
this.formControlIsDirty = signal(false);
|
|
10974
|
+
this.subscriptions = [];
|
|
10945
10975
|
this.setupNgtStylizable();
|
|
10946
10976
|
this.registerEffects();
|
|
10947
10977
|
}
|
|
@@ -10954,6 +10984,7 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
|
|
|
10954
10984
|
}
|
|
10955
10985
|
ngOnDestroy() {
|
|
10956
10986
|
this.evDatePicker?.flatpickr?.['calendarContainer']?.remove();
|
|
10987
|
+
this.destroySubscriptions();
|
|
10957
10988
|
}
|
|
10958
10989
|
change(value) {
|
|
10959
10990
|
if (!value || (Array.isArray(value) && !value.length)) {
|
|
@@ -11054,10 +11085,15 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
|
|
|
11054
11085
|
});
|
|
11055
11086
|
}
|
|
11056
11087
|
setupSubscriptions() {
|
|
11057
|
-
this.formControl
|
|
11058
|
-
this.
|
|
11059
|
-
|
|
11060
|
-
|
|
11088
|
+
if (this.formControl) {
|
|
11089
|
+
this.subscriptions.push(this.formControl.events.subscribe((event) => {
|
|
11090
|
+
if (event instanceof TouchedChangeEvent) {
|
|
11091
|
+
this.touched.set(true);
|
|
11092
|
+
}
|
|
11093
|
+
this.formControlHasErrors.set(!!this.formControl?.errors);
|
|
11094
|
+
this.formControlIsDirty.set(this.formControl?.dirty);
|
|
11095
|
+
}));
|
|
11096
|
+
}
|
|
11061
11097
|
}
|
|
11062
11098
|
registerEffects() {
|
|
11063
11099
|
effect(() => this.setupValidators());
|
|
@@ -11072,6 +11108,11 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
|
|
|
11072
11108
|
}
|
|
11073
11109
|
this.formControl.setValidators(syncValidators);
|
|
11074
11110
|
this.formControl.updateValueAndValidity();
|
|
11111
|
+
if (this.value) {
|
|
11112
|
+
this.markAsDirty();
|
|
11113
|
+
this.formControlHasErrors.set(!!this.formControl.errors);
|
|
11114
|
+
this.formControlIsDirty.set(true);
|
|
11115
|
+
}
|
|
11075
11116
|
}
|
|
11076
11117
|
setupDateInputMask() {
|
|
11077
11118
|
if (this.locale() == NgtReactiveDateLocale.BRAZIL) {
|
|
@@ -11126,7 +11167,7 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
|
|
|
11126
11167
|
'overflow-hidden border',
|
|
11127
11168
|
this.ngtStyle.compile(['h', 'color.text', 'px', 'py', 'text', 'rounded', 'color.bg', 'color.border'])
|
|
11128
11169
|
];
|
|
11129
|
-
if (this.formControlHasErrors() && this.formControlIsDirty()) {
|
|
11170
|
+
if (this.formControlHasErrors() && this.formControlIsDirty() && this.touched()) {
|
|
11130
11171
|
classes.push('border-error');
|
|
11131
11172
|
}
|
|
11132
11173
|
return classes.join(' ');
|
|
@@ -11134,6 +11175,10 @@ class NgtReactiveDateComponent extends NgtControlValueAccessor {
|
|
|
11134
11175
|
hasChangeBetweenValues(a, b) {
|
|
11135
11176
|
return JSON.stringify(a) != JSON.stringify(b);
|
|
11136
11177
|
}
|
|
11178
|
+
destroySubscriptions() {
|
|
11179
|
+
this.subscriptions.forEach(subscription => subscription.unsubscribe());
|
|
11180
|
+
this.subscriptions = [];
|
|
11181
|
+
}
|
|
11137
11182
|
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
11183
|
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
11184
|
NgtValueAccessorProvider(NgtReactiveDateComponent),
|
|
@@ -11721,9 +11766,6 @@ class NgtReactiveDropzoneStateService {
|
|
|
11721
11766
|
this.componentReady = signal(false);
|
|
11722
11767
|
this.loading = signal(false);
|
|
11723
11768
|
this.shining = signal(false);
|
|
11724
|
-
// Form State
|
|
11725
|
-
this.formControlHasErrors = signal(false);
|
|
11726
|
-
this.formControlIsDirty = signal(false);
|
|
11727
11769
|
}
|
|
11728
11770
|
reset() {
|
|
11729
11771
|
this.dropzoneHeight.set('180px');
|
|
@@ -11733,8 +11775,6 @@ class NgtReactiveDropzoneStateService {
|
|
|
11733
11775
|
this.loading.set(false);
|
|
11734
11776
|
this.shining.set(false);
|
|
11735
11777
|
this.showFileViewer.set(false);
|
|
11736
|
-
this.formControlHasErrors.set(false);
|
|
11737
|
-
this.formControlIsDirty.set(false);
|
|
11738
11778
|
}
|
|
11739
11779
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgtReactiveDropzoneStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
11740
11780
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgtReactiveDropzoneStateService }); }
|
|
@@ -11805,7 +11845,6 @@ class NgtReactiveDropzoneComponent extends NgtControlValueAccessor {
|
|
|
11805
11845
|
this.fileViewerFileSize = signal(0);
|
|
11806
11846
|
/** Internal Control */
|
|
11807
11847
|
this.ngxElementId = uuid();
|
|
11808
|
-
this.subscriptions = [];
|
|
11809
11848
|
this.registerEffects();
|
|
11810
11849
|
}
|
|
11811
11850
|
get dropzoneHeight() {
|
|
@@ -11819,9 +11858,6 @@ class NgtReactiveDropzoneComponent extends NgtControlValueAccessor {
|
|
|
11819
11858
|
this.setupComponent();
|
|
11820
11859
|
setTimeout(() => this.stateService.componentReady.set(true), 500);
|
|
11821
11860
|
}
|
|
11822
|
-
ngOnDestroy() {
|
|
11823
|
-
this.destroySubscriptions();
|
|
11824
|
-
}
|
|
11825
11861
|
onSelectFiles(event) {
|
|
11826
11862
|
const errorResult = this.errorService.validateRejectedFiles(event);
|
|
11827
11863
|
if (errorResult.hasError) {
|
|
@@ -11978,7 +12014,6 @@ class NgtReactiveDropzoneComponent extends NgtControlValueAccessor {
|
|
|
11978
12014
|
}
|
|
11979
12015
|
setupComponent() {
|
|
11980
12016
|
this.setupValidators();
|
|
11981
|
-
this.setupSubscriptions();
|
|
11982
12017
|
if (this.value) {
|
|
11983
12018
|
this.fileService.resetFilesLoad(Array.isArray(this.value) ? this.value : [this.value]);
|
|
11984
12019
|
this.loadFilePreview(Array.isArray(this.value) ? this.value : [this.value]);
|
|
@@ -11996,24 +12031,13 @@ class NgtReactiveDropzoneComponent extends NgtControlValueAccessor {
|
|
|
11996
12031
|
this.formControl.setValidators(syncValidators);
|
|
11997
12032
|
this.formControl.setAsyncValidators(asyncValidators);
|
|
11998
12033
|
this.formControl.updateValueAndValidity();
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
if (!this.formControl) {
|
|
12002
|
-
return;
|
|
12034
|
+
if (this.value) {
|
|
12035
|
+
this.markAsDirty();
|
|
12003
12036
|
}
|
|
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
12037
|
}
|
|
12010
12038
|
hasChangesBetweenValues(a, b) {
|
|
12011
12039
|
return JSON.stringify(a) !== JSON.stringify(b);
|
|
12012
12040
|
}
|
|
12013
|
-
destroySubscriptions() {
|
|
12014
|
-
this.subscriptions.forEach(subscription => subscription.unsubscribe());
|
|
12015
|
-
this.subscriptions = [];
|
|
12016
|
-
}
|
|
12017
12041
|
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
12042
|
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
12043
|
NgtValueAccessorProvider(NgtReactiveDropzoneComponent),
|