tailjng 0.0.20 → 0.0.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailjng",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.2.0",
6
6
  "@angular/core": "^19.2.0",
@@ -3,13 +3,12 @@ import { Component, EventEmitter, Input, Output, OnDestroy, OnInit, ViewChild, E
3
3
  import { FormsModule } from '@angular/forms';
4
4
  import { LucideAngularModule } from 'lucide-angular';
5
5
  import { Subject, Subscription, debounceTime, filter, forkJoin } from 'rxjs';
6
- import { FilterButton, FilterSelect, JUploadFilterService, JAlertDialogService, JAlertToastService, JGenericCrudService, JIconsService, LoadingState, JExcelService, JExcelFilterService } from 'tailjng';
6
+ import { TableColumn, FilterButton, FilterSelect, JUploadFilterService, JAlertDialogService, JAlertToastService, JGenericCrudService, JIconsService, LoadingState, JExcelService, JExcelFilterService } from 'tailjng';
7
7
  import { JDropdownSelectComponent } from '../../select/select-dropdown/dropdown-select.component';
8
8
  import { JMultiTableSelectComponent } from '../../select/select-multi-table/multi-table-select.component';
9
9
  import { JSwitchCheckboxComponent } from '../../checkbox/checkbox-switch/switch-checkbox.component';
10
10
  import { JDialogComponent } from '../../dialog/dialog.component';
11
11
  import { JButtonComponent } from '../../button/button.component';
12
- import { TableColumn } from '../../../interfaces/crud/crud.interface';
13
12
 
14
13
  @Component({
15
14
  selector: 'JFilter',
@@ -19,7 +18,7 @@ import { TableColumn } from '../../../interfaces/crud/crud.interface';
19
18
  styleUrls: ['./complete-filter.component.scss'],
20
19
  providers: [JDialogComponent]
21
20
  })
22
- export class JFilterComponent implements OnInit, OnDestroy {
21
+ export class JCompleteFilterComponent implements OnInit, OnDestroy {
23
22
 
24
23
  @Output() afterUpload = new EventEmitter<void>();
25
24
 
@@ -2,12 +2,12 @@ import { NgClass } from '@angular/common';
2
2
  import { Component, Input } from '@angular/core';
3
3
 
4
4
  @Component({
5
- selector: 'JContainerForm',
5
+ selector: 'JFormContainer',
6
6
  imports: [NgClass],
7
7
  templateUrl: './container-form.component.html',
8
8
  styleUrl: './container-form.component.css'
9
9
  })
10
- export class JContainerFormComponent {
10
+ export class JFormContainerComponent {
11
11
 
12
12
  @Input() columns: number = 1;
13
13
  @Input() rows: boolean = false;
@@ -0,0 +1,7 @@
1
+ @if (hasErrors) {
2
+ <div class="flex flex-col text-red-600 dark:text-red-300 text-sm">
3
+ @for (message of errors; track $index) {
4
+ <span [class]="classes">{{ message }}</span>
5
+ }
6
+ </div>
7
+ }
@@ -0,0 +1,29 @@
1
+ import { Component, Input } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { AbstractControl } from '@angular/forms';
4
+
5
+ @Component({
6
+ selector: 'JFormValidation',
7
+ standalone: true,
8
+ imports: [CommonModule],
9
+ templateUrl: './validation-form.component.html',
10
+ styleUrl: './validation-form.component.scss'
11
+ })
12
+ export class JFormValidationComponent {
13
+
14
+ @Input() control!: AbstractControl | null;
15
+ @Input() errorMessages: { [key: string]: string } = {};
16
+ @Input() classes: string = '';
17
+
18
+ get hasErrors(): boolean {
19
+ return !!this.control && this.control.invalid && this.control.touched;
20
+ }
21
+
22
+ get errors(): string[] {
23
+ if (!this.control || !this.control.errors) return [];
24
+ return Object.keys(this.control.errors)
25
+ .filter(errorKey => this.errorMessages[errorKey])
26
+ .map(errorKey => this.errorMessages[errorKey]);
27
+ }
28
+
29
+ }