tailjng 0.1.6 → 0.1.7
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/README.md +12 -4
- package/cli/execute/init-app.js +5 -2
- package/cli/execute/sync-app.js +14 -2
- package/cli/settings/colors-config-utils.js +43 -8
- package/cli/settings/icons-config-utils.js +62 -0
- package/cli/settings/path-utils.js +32 -2
- package/cli/settings/project-utils.js +7 -1
- package/cli/templates/app.generator.js +2 -2
- package/fesm2022/tailjng.mjs +247 -80
- package/fesm2022/tailjng.mjs.map +1 -1
- package/lib/services/static/theme.service.d.ts +39 -1
- package/lib/utils/theme/theme-variables.util.d.ts +31 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -1
- package/registry/components.json +41 -18
- package/src/colors.safelist.css +2 -2
- package/src/lib/components/.config/README.md +11 -0
- package/src/lib/components/.config/colors/README.md +38 -0
- package/src/lib/components/{colors-config → .config/colors}/colors.config.ts +5 -5
- package/src/lib/components/{colors-config → .config/colors}/colors.safelist.css +2 -2
- package/src/lib/components/.config/icons/README.md +26 -0
- package/src/lib/components/.config/icons/icons.lucide.ts +134 -0
- package/src/lib/components/.config/input/README.md +24 -0
- package/src/lib/components/.config/input/input.classes.ts +119 -0
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.css +244 -2
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.html +25 -38
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.ts +66 -56
- package/src/lib/components/alert/alert-dialog/dialog-alert.types.ts +19 -0
- package/src/lib/components/alert/alert-toast/toast-alert.component.css +630 -12
- package/src/lib/components/alert/alert-toast/toast-alert.component.html +103 -102
- package/src/lib/components/alert/alert-toast/toast-alert.component.ts +485 -128
- package/src/lib/components/alert/alert-toast/toast-alert.types.ts +25 -0
- package/src/lib/components/badge/badge.component.html +34 -21
- package/src/lib/components/badge/badge.component.ts +140 -31
- package/src/lib/components/button/button.component.html +16 -10
- package/src/lib/components/button/button.component.ts +162 -22
- package/src/lib/components/card/card-complete/complete-card.component.html +2 -2
- package/src/lib/components/card/card-complete/complete-card.component.ts +26 -16
- package/src/lib/components/card/card-crud-complete/complete-crud-card.component.html +2 -2
- package/src/lib/components/card/card-crud-complete/complete-crud-card.component.ts +26 -16
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.css +97 -0
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.html +54 -46
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.ts +135 -64
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.types.ts +3 -0
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.css +112 -0
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.html +28 -25
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.ts +67 -15
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.types.ts +1 -0
- package/src/lib/components/coach-mark/coach-mark.component.html +4 -22
- package/src/lib/components/coach-mark/coach-mark.component.scss +1 -1
- package/src/lib/components/coach-mark/coach-mark.component.ts +51 -18
- package/src/lib/components/coach-mark/coach-mark.directive.ts +133 -78
- package/src/lib/components/coach-mark/coach-mark.types.ts +12 -0
- package/src/lib/components/dialog/dialog.component.css +103 -1
- package/src/lib/components/dialog/dialog.component.html +46 -66
- package/src/lib/components/dialog/dialog.component.ts +136 -110
- package/src/lib/components/dialog/dialog.types.ts +19 -0
- package/src/lib/components/filter/filter-complete/complete-filter.component.html +16 -19
- package/src/lib/components/filter/filter-complete/complete-filter.component.scss +35 -0
- package/src/lib/components/filter/filter-complete/complete-filter.component.ts +58 -34
- package/src/lib/components/filter/filter-complete/complete-filter.types.ts +7 -0
- package/src/lib/components/filter/filter-complete/complete-filter.util.ts +16 -0
- package/src/lib/components/form/form-container/container-form.component.css +4 -0
- package/src/lib/components/form/form-container/container-form.component.html +2 -2
- package/src/lib/components/form/form-container/container-form.component.ts +72 -16
- package/src/lib/components/form/form-container/container-form.types.ts +42 -0
- package/src/lib/components/form/form-container/form-col-span.directive.ts +25 -0
- package/src/lib/components/form/form-sidebar/sidebar-form.component.css +276 -0
- package/src/lib/components/form/form-sidebar/sidebar-form.component.html +117 -125
- package/src/lib/components/form/form-sidebar/sidebar-form.component.ts +109 -34
- package/src/lib/components/form/form-sidebar/sidebar-form.types.ts +3 -0
- package/src/lib/components/{toggle-radio/toggle-radio.component.css → form/form-validation/validation-form.component.css} +0 -1
- package/src/lib/components/form/form-validation/validation-form.component.html +10 -6
- package/src/lib/components/form/form-validation/validation-form.component.ts +99 -12
- package/src/lib/components/form/form-validation/validation-form.types.ts +33 -0
- package/src/lib/components/icon/icon.component.html +8 -5
- package/src/lib/components/icon/icon.component.ts +111 -9
- package/src/lib/components/input/input/input.component.html +19 -16
- package/src/lib/components/input/input/input.component.ts +130 -53
- package/src/lib/components/input/input/input.types.ts +8 -0
- package/src/lib/components/input/input-file/file-input.component.html +65 -56
- package/src/lib/components/input/input-file/file-input.component.ts +276 -173
- package/src/lib/components/input/input-file/file-input.types.ts +2 -0
- package/src/lib/components/input/input-range/range-input.component.css +67 -0
- package/src/lib/components/input/input-range/range-input.component.html +50 -58
- package/src/lib/components/input/input-range/range-input.component.ts +148 -60
- package/src/lib/components/input/input-range/range-input.types.ts +7 -0
- package/src/lib/components/input/input-textarea/textarea-input.component.html +16 -7
- package/src/lib/components/input/input-textarea/textarea-input.component.ts +140 -50
- package/src/lib/components/input/input-textarea/textarea-input.types.ts +2 -0
- package/src/lib/components/label/label.component.html +17 -16
- package/src/lib/components/label/label.component.ts +70 -16
- package/src/lib/components/label/label.types.ts +2 -0
- package/src/lib/components/menu/menu-options-table/menu-options-defaults.ts +34 -0
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.html +34 -20
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.ts +211 -58
- package/src/lib/components/menu/menu-options-table/options-table-menu.types.ts +38 -0
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.html +49 -52
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.ts +112 -24
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.types.ts +9 -0
- package/src/lib/components/mode-toggle/mode-toggle.component.html +11 -16
- package/src/lib/components/mode-toggle/mode-toggle.component.ts +69 -33
- package/src/lib/components/paginator/paginator-complete/complete-paginator.component.html +4 -4
- package/src/lib/components/paginator/paginator-complete/complete-paginator.component.ts +31 -7
- package/src/lib/components/paginator/paginator-complete/complete-paginator.types.ts +12 -0
- package/src/lib/components/paginator/paginator-complete/complete-paginator.util.ts +36 -0
- package/src/lib/components/progress-bar/progress-bar.component.css +11 -0
- package/src/lib/components/progress-bar/progress-bar.component.html +41 -40
- package/src/lib/components/progress-bar/progress-bar.component.ts +95 -11
- package/src/lib/components/progress-bar/progress-bar.types.ts +2 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.component.css +6 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.component.html +54 -44
- package/src/lib/components/select/select-dropdown/dropdown-select.component.ts +450 -509
- package/src/lib/components/select/select-dropdown/dropdown-select.types.ts +43 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.util.ts +179 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.css +6 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.html +131 -42
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.ts +491 -475
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.types.ts +22 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.util.ts +20 -0
- package/src/lib/components/select/select-multi-table/multi-table-select.component.css +10 -0
- package/src/lib/components/select/select-multi-table/multi-table-select.component.html +76 -60
- package/src/lib/components/select/select-multi-table/multi-table-select.component.ts +250 -313
- package/src/lib/components/select/select-multi-table/multi-table-select.types.ts +10 -0
- package/src/lib/components/select/select-multi-table/multi-table-select.util.ts +5 -0
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.css +212 -0
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.html +62 -53
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.ts +84 -27
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.types.ts +2 -0
- package/src/lib/components/table/table-complete/complete-table.component.html +15 -17
- package/src/lib/components/table/table-complete/complete-table.component.ts +190 -338
- package/src/lib/components/table/table-complete/complete-table.types.ts +28 -0
- package/src/lib/components/table/table-complete/complete-table.util.ts +236 -0
- package/src/lib/components/table/table-complete/index.ts +2 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.animations.ts +34 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.html +73 -128
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.ts +542 -829
- package/src/lib/components/table/table-crud-complete/complete-crud-table.types.ts +57 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.util.ts +723 -0
- package/src/lib/components/table/table-crud-complete/index.ts +3 -0
- package/src/lib/components/theme-generator/theme-generator.component.css +21 -0
- package/src/lib/components/theme-generator/theme-generator.component.html +146 -116
- package/src/lib/components/theme-generator/theme-generator.component.ts +44 -24
- package/src/lib/components/toggle-radio/shared/toggle-options.types.ts +8 -0
- package/src/lib/components/toggle-radio/shared/toggle-options.util.ts +44 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.css +135 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.html +52 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.ts +198 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.types.ts +1 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.css +108 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.html +37 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.ts +193 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.types.ts +1 -0
- package/src/lib/components/tooltip/tooltip.directive.ts +12 -9
- package/src/lib/components/tooltip/tooltip.service.ts +331 -133
- package/src/lib/components/tooltip/tooltip.types.ts +9 -0
- package/src/lib/components/viewer/viewer-image/image-viewer.component.css +90 -4
- package/src/lib/components/viewer/viewer-image/image-viewer.component.html +52 -103
- package/src/lib/components/viewer/viewer-image/image-viewer.component.ts +182 -177
- package/src/lib/components/viewer/viewer-image/image-viewer.types.ts +3 -0
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.css +177 -0
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.html +74 -24
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.ts +168 -15
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.types.ts +1 -0
- package/src/styles.css +2 -2
- package/lib/services/static/icons.service.d.ts +0 -65
- package/src/lib/components/colors-config/README.md +0 -38
- package/src/lib/components/form/form-sidebar/sidebar-form.component.scss +0 -0
- package/src/lib/components/form/form-validation/validation-form.component.scss +0 -0
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.scss +0 -0
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.scss +0 -12
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.scss +0 -0
- package/src/lib/components/toggle-radio/toggle-radio.component.html +0 -51
- package/src/lib/components/toggle-radio/toggle-radio.component.ts +0 -222
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.scss +0 -0
- package/tailjng-0.1.6.tgz +0 -0
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Component, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
|
-
import { LucideAngularModule } from 'lucide-angular';
|
|
5
4
|
import { Params } from '@angular/router';
|
|
6
5
|
import { animate, state, style, transition, trigger } from '@angular/animations';
|
|
7
|
-
import { EnableBoolean, FilterButton, FilterSelect, JAlertToastService, JConverterCrudService, JGenericCrudService,
|
|
6
|
+
import { EnableBoolean, FilterButton, FilterSelect, JAlertToastService, JConverterCrudService, JGenericCrudService, LoadingState, LoadingStates, OptionsTable, SortDirection, TableColumn } from 'tailjng';
|
|
8
7
|
import { JCompletePaginatorComponent } from '../../paginator/paginator-complete/complete-paginator.component';
|
|
9
8
|
import { JCompleteFilterComponent } from '../../filter/filter-complete/complete-filter.component';
|
|
9
|
+
import { Icons } from '../../.config/icons/icons.lucide';
|
|
10
|
+
import { JIconComponent } from '../../icon/icon.component';
|
|
10
11
|
|
|
11
12
|
@Component({
|
|
12
13
|
selector: 'JCompleteCard',
|
|
13
14
|
standalone: true,
|
|
14
|
-
imports: [CommonModule, FormsModule, JCompletePaginatorComponent, JCompleteFilterComponent,
|
|
15
|
+
imports: [CommonModule, FormsModule, JCompletePaginatorComponent, JCompleteFilterComponent, JIconComponent],
|
|
15
16
|
templateUrl: './complete-card.component.html',
|
|
16
17
|
styleUrl: './complete-card.component.scss',
|
|
17
18
|
animations: [
|
|
@@ -19,12 +20,10 @@ import { JCompleteFilterComponent } from '../../filter/filter-complete/complete-
|
|
|
19
20
|
state('collapsed', style({
|
|
20
21
|
height: '0',
|
|
21
22
|
opacity: 0,
|
|
22
|
-
overflow: 'hidden',
|
|
23
|
-
})),
|
|
23
|
+
overflow: 'hidden'})),
|
|
24
24
|
state('expanded', style({
|
|
25
25
|
height: '*',
|
|
26
|
-
opacity: 1,
|
|
27
|
-
})),
|
|
26
|
+
opacity: 1})),
|
|
28
27
|
transition('collapsed <=> expanded', [
|
|
29
28
|
animate('0.3s ease-in-out')
|
|
30
29
|
])
|
|
@@ -32,6 +31,7 @@ import { JCompleteFilterComponent } from '../../filter/filter-complete/complete-
|
|
|
32
31
|
]
|
|
33
32
|
})
|
|
34
33
|
export class JCompleteCardComponent implements OnInit {
|
|
34
|
+
readonly Icons = Icons;
|
|
35
35
|
|
|
36
36
|
Math = Math;
|
|
37
37
|
|
|
@@ -46,11 +46,11 @@ export class JCompleteCardComponent implements OnInit {
|
|
|
46
46
|
sort: 'idle',
|
|
47
47
|
aditionalButtons: {},
|
|
48
48
|
checked: 'idle',
|
|
49
|
-
action: 'idle'
|
|
50
|
-
};
|
|
49
|
+
action: 'idle'};
|
|
51
50
|
|
|
52
51
|
@Input() endpoint!: string;
|
|
53
52
|
mainEndpoint!: string;
|
|
53
|
+
@Input() staticData: any[] = [];
|
|
54
54
|
@Input() columns: TableColumn<any>[] = [];
|
|
55
55
|
@Input() defaultFilters: { [key: string]: any } = {};
|
|
56
56
|
@Input() isPaginator = true;
|
|
@@ -114,7 +114,6 @@ export class JCompleteCardComponent implements OnInit {
|
|
|
114
114
|
titleChecked!: string;
|
|
115
115
|
|
|
116
116
|
constructor(
|
|
117
|
-
public readonly iconsService: JIconsService,
|
|
118
117
|
private readonly genericService: JGenericCrudService,
|
|
119
118
|
private readonly alertToastService: JAlertToastService,
|
|
120
119
|
private readonly converterService: JConverterCrudService,
|
|
@@ -169,6 +168,20 @@ export class JCompleteCardComponent implements OnInit {
|
|
|
169
168
|
// Emit search parameters
|
|
170
169
|
this.loadedParams.emit(params);
|
|
171
170
|
|
|
171
|
+
if (this.staticData.length > 0) {
|
|
172
|
+
this.data = this.staticData.map(item => ({ ...item }));
|
|
173
|
+
this.totalItems = this.data.length;
|
|
174
|
+
this.updateDisplayData();
|
|
175
|
+
this.generatePagination();
|
|
176
|
+
this.setLoadingState(loadingType, 'success');
|
|
177
|
+
this.dataLoaded.emit();
|
|
178
|
+
if (loadingType === 'sort') {
|
|
179
|
+
this.sortingColumn = null;
|
|
180
|
+
}
|
|
181
|
+
onFinally?.();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
172
185
|
// Simulating API wait
|
|
173
186
|
// setTimeout(() => {
|
|
174
187
|
this.genericService.findAll<any>({ endpoint: this.endpoint, params }).subscribe({
|
|
@@ -244,8 +257,7 @@ export class JCompleteCardComponent implements OnInit {
|
|
|
244
257
|
this.alertToastService.AlertToast({
|
|
245
258
|
type: "success",
|
|
246
259
|
title: "Registro actualizado!",
|
|
247
|
-
description: response.message
|
|
248
|
-
});
|
|
260
|
+
description: response.message});
|
|
249
261
|
}
|
|
250
262
|
})
|
|
251
263
|
}
|
|
@@ -359,11 +371,9 @@ export class JCompleteCardComponent implements OnInit {
|
|
|
359
371
|
limit: this.itemsPerPage,
|
|
360
372
|
sort: {
|
|
361
373
|
column: this.sortColumn,
|
|
362
|
-
direction: this.sortDirection,
|
|
363
|
-
},
|
|
374
|
+
direction: this.sortDirection},
|
|
364
375
|
filters: this.filters,
|
|
365
|
-
defaultFilters: this.defaultFilters
|
|
366
|
-
});
|
|
376
|
+
defaultFilters: this.defaultFilters});
|
|
367
377
|
|
|
368
378
|
if (this.searchQuery && this.searchQuery.trim() !== '') {
|
|
369
379
|
const baseSearchKeys = this.columns
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
@if (isLoading('initialLoad') && displayData.length === 0) {
|
|
47
47
|
<div class="w-full flex justify-center items-center h-100 bg-white dark:bg-foreground rounded-[20px] border border-border dark:border-dark-border">
|
|
48
48
|
<div class="flex flex-col gap-3 items-center justify-center py-4">
|
|
49
|
-
<
|
|
49
|
+
<JIcon [icon]="Icons.Loader2" size="30" iconClass="text-primary animate-spin" [ariaHidden]="true" />
|
|
50
50
|
<p>Cargando datos...</p>
|
|
51
51
|
</div>
|
|
52
52
|
</div>
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
|
|
87
87
|
} @else if (!isLoading('pagination')) {
|
|
88
88
|
<div class="j-crud-card w-full flex flex-col gap-3 justify-center items-center h-100 bg-white dark:bg-foreground rounded-[20px] border border-border dark:border-dark-border hover:border-primary/50 hover:dark:border-primary">
|
|
89
|
-
<
|
|
89
|
+
<JIcon [icon]="Icons.Info" size="35" iconClass="text-primary" [ariaHidden]="true" />
|
|
90
90
|
<p class="text-black dark:text-white">No hay datos disponibles</p>
|
|
91
91
|
</div>
|
|
92
92
|
}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import { Component, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
|
-
import { LucideAngularModule } from 'lucide-angular';
|
|
5
4
|
import { Params } from '@angular/router';
|
|
6
5
|
import { animate, state, style, transition, trigger } from '@angular/animations';
|
|
7
|
-
import { EnableBoolean, FilterButton, FilterSelect, JAlertToastService, JConverterCrudService, JGenericCrudService,
|
|
6
|
+
import { EnableBoolean, FilterButton, FilterSelect, JAlertToastService, JConverterCrudService, JGenericCrudService, LoadingState, LoadingStates, OptionsTable, SortDirection, TableColumn } from 'tailjng';
|
|
8
7
|
import { JCompletePaginatorComponent } from '../../paginator/paginator-complete/complete-paginator.component';
|
|
9
8
|
import { JCompleteFilterComponent } from '../../filter/filter-complete/complete-filter.component';
|
|
9
|
+
import { Icons } from '../../.config/icons/icons.lucide';
|
|
10
|
+
import { JIconComponent } from '../../icon/icon.component';
|
|
10
11
|
|
|
11
12
|
@Component({
|
|
12
13
|
selector: 'JCompleteCrudCard',
|
|
13
14
|
standalone: true,
|
|
14
|
-
imports: [CommonModule, FormsModule, JCompletePaginatorComponent, JCompleteFilterComponent,
|
|
15
|
+
imports: [CommonModule, FormsModule, JCompletePaginatorComponent, JCompleteFilterComponent, JIconComponent],
|
|
15
16
|
templateUrl: './complete-crud-card.component.html',
|
|
16
17
|
styleUrl: './complete-crud-card.component.scss',
|
|
17
18
|
animations: [
|
|
18
19
|
trigger('slideToggle', [
|
|
19
20
|
state('collapsed', style({
|
|
20
21
|
height: '0',
|
|
21
|
-
opacity: 0,
|
|
22
|
-
})),
|
|
22
|
+
opacity: 0})),
|
|
23
23
|
state('expanded', style({
|
|
24
24
|
height: '*',
|
|
25
|
-
opacity: 1,
|
|
26
|
-
})),
|
|
25
|
+
opacity: 1})),
|
|
27
26
|
transition('collapsed <=> expanded', [
|
|
28
27
|
animate('0.3s ease-in-out')
|
|
29
28
|
])
|
|
@@ -31,6 +30,7 @@ import { JCompleteFilterComponent } from '../../filter/filter-complete/complete-
|
|
|
31
30
|
]
|
|
32
31
|
})
|
|
33
32
|
export class JCompleteCrudCardComponent implements OnInit {
|
|
33
|
+
readonly Icons = Icons;
|
|
34
34
|
|
|
35
35
|
Math = Math;
|
|
36
36
|
|
|
@@ -44,13 +44,13 @@ export class JCompleteCrudCardComponent implements OnInit {
|
|
|
44
44
|
sort: 'idle',
|
|
45
45
|
aditionalButtons: {},
|
|
46
46
|
checked: 'idle',
|
|
47
|
-
action: 'idle'
|
|
48
|
-
};
|
|
47
|
+
action: 'idle'};
|
|
49
48
|
|
|
50
49
|
@Input() endpoint!: string;
|
|
51
50
|
// Clave alternativa de response.data cuando difiere del mainEndpoint (ej. reminders en reminder/mine)
|
|
52
51
|
@Input() responseKey?: string;
|
|
53
52
|
mainEndpoint!: string;
|
|
53
|
+
@Input() staticData: any[] = [];
|
|
54
54
|
@Input() columns: TableColumn<any>[] = [];
|
|
55
55
|
@Input() defaultFilters: { [key: string]: any } = {};
|
|
56
56
|
@Input() isPaginator = true;
|
|
@@ -114,7 +114,6 @@ export class JCompleteCrudCardComponent implements OnInit {
|
|
|
114
114
|
titleChecked!: string;
|
|
115
115
|
|
|
116
116
|
constructor(
|
|
117
|
-
public readonly iconsService: JIconsService,
|
|
118
117
|
private readonly genericService: JGenericCrudService,
|
|
119
118
|
private readonly alertToastService: JAlertToastService,
|
|
120
119
|
private readonly converterService: JConverterCrudService,
|
|
@@ -175,6 +174,20 @@ export class JCompleteCrudCardComponent implements OnInit {
|
|
|
175
174
|
|
|
176
175
|
const params = this.getQueryParams();
|
|
177
176
|
|
|
177
|
+
if (this.staticData.length > 0) {
|
|
178
|
+
this.data = this.staticData.map(item => ({ ...item }));
|
|
179
|
+
this.totalItems = this.data.length;
|
|
180
|
+
this.updateDisplayData();
|
|
181
|
+
this.generatePagination();
|
|
182
|
+
this.setLoadingState(loadingType, 'success');
|
|
183
|
+
this.dataLoaded.emit();
|
|
184
|
+
if (loadingType === 'sort') {
|
|
185
|
+
this.sortingColumn = null;
|
|
186
|
+
}
|
|
187
|
+
onFinally?.();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
178
191
|
// Simulating API wait
|
|
179
192
|
// setTimeout(() => {
|
|
180
193
|
this.genericService.findAll<any>({ endpoint: this.endpoint, params }).subscribe({
|
|
@@ -250,8 +263,7 @@ export class JCompleteCrudCardComponent implements OnInit {
|
|
|
250
263
|
this.alertToastService.AlertToast({
|
|
251
264
|
type: "success",
|
|
252
265
|
title: "Registro actualizado!",
|
|
253
|
-
description: response.message
|
|
254
|
-
});
|
|
266
|
+
description: response.message});
|
|
255
267
|
}
|
|
256
268
|
})
|
|
257
269
|
}
|
|
@@ -365,11 +377,9 @@ export class JCompleteCrudCardComponent implements OnInit {
|
|
|
365
377
|
limit: this.itemsPerPage,
|
|
366
378
|
sort: {
|
|
367
379
|
column: this.sortColumn,
|
|
368
|
-
direction: this.sortDirection,
|
|
369
|
-
},
|
|
380
|
+
direction: this.sortDirection},
|
|
370
381
|
filters: this.filters,
|
|
371
|
-
defaultFilters: this.defaultFilters
|
|
372
|
-
});
|
|
382
|
+
defaultFilters: this.defaultFilters});
|
|
373
383
|
|
|
374
384
|
if (this.searchQuery && this.searchQuery.trim() !== '') {
|
|
375
385
|
const baseSearchKeys = this.columns
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
.j-checkbox-root {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.j-checkbox-label {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
gap: 0.5rem;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
user-select: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.j-checkbox-control {
|
|
16
|
+
position: relative;
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.j-checkbox-input {
|
|
23
|
+
position: absolute;
|
|
24
|
+
inset: 0;
|
|
25
|
+
z-index: 1;
|
|
26
|
+
margin: 0;
|
|
27
|
+
opacity: 0;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.j-checkbox-input:disabled {
|
|
32
|
+
cursor: not-allowed;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.j-checkbox-input:focus-visible + .j-checkbox-box {
|
|
36
|
+
outline: 2px solid var(--color-ring);
|
|
37
|
+
outline-offset: 2px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.j-checkbox-box {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
width: 1.375rem;
|
|
45
|
+
height: 1.375rem;
|
|
46
|
+
border: 1.5px solid var(--color-border);
|
|
47
|
+
border-radius: 0.375rem;
|
|
48
|
+
background-color: var(--color-background);
|
|
49
|
+
transition:
|
|
50
|
+
background-color 0.15s ease,
|
|
51
|
+
border-color 0.15s ease,
|
|
52
|
+
box-shadow 0.15s ease;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host-context(.dark) .j-checkbox-box,
|
|
56
|
+
:host-context(html.dark) .j-checkbox-box {
|
|
57
|
+
border-color: var(--color-dark-border);
|
|
58
|
+
background-color: var(--color-dark-background);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.j-checkbox-box--checked {
|
|
62
|
+
border-color: var(--color-primary);
|
|
63
|
+
background-color: var(--color-primary);
|
|
64
|
+
color: var(--color-primary-foreground);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host-context(.dark) .j-checkbox-box--checked,
|
|
68
|
+
:host-context(html.dark) .j-checkbox-box--checked {
|
|
69
|
+
border-color: var(--color-dark-primary);
|
|
70
|
+
background-color: var(--color-dark-primary);
|
|
71
|
+
color: var(--color-dark-primary-foreground);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.j-checkbox-box--disabled {
|
|
75
|
+
opacity: 0.5;
|
|
76
|
+
cursor: not-allowed;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.j-checkbox-title {
|
|
80
|
+
font-size: 0.75rem;
|
|
81
|
+
line-height: 1.25;
|
|
82
|
+
color: var(--color-foreground);
|
|
83
|
+
opacity: 0.85;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:host-context(.dark) .j-checkbox-title,
|
|
87
|
+
:host-context(html.dark) .j-checkbox-title {
|
|
88
|
+
color: var(--color-dark-foreground);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.j-checkbox-title--disabled {
|
|
92
|
+
opacity: 0.45;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.j-checkbox-label:has(.j-checkbox-input:disabled) {
|
|
96
|
+
cursor: not-allowed;
|
|
97
|
+
}
|
|
@@ -1,52 +1,60 @@
|
|
|
1
|
-
<div
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
[
|
|
5
|
-
'flex-col': titlePosition === 'top' || titlePosition === 'bottom',
|
|
6
|
-
'flex-row align-center': titlePosition === 'left' || titlePosition === 'right'
|
|
7
|
-
}"
|
|
1
|
+
<div
|
|
2
|
+
class="j-checkbox-root"
|
|
3
|
+
[jTooltip]="tooltip"
|
|
4
|
+
[jTooltipPosition]="tooltipPosition"
|
|
8
5
|
>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
<label class="j-checkbox-label" [ngClass]="layoutClasses">
|
|
7
|
+
@if (showTitleBefore) {
|
|
8
|
+
<span
|
|
9
|
+
class="j-checkbox-title"
|
|
10
|
+
[ngClass]="titleClasses"
|
|
11
|
+
[style.font-size]="titleSize"
|
|
12
|
+
>
|
|
13
|
+
{{ title }}
|
|
14
|
+
</span>
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<span
|
|
26
|
-
class="inline-flex items-center justify-center w-[25px] h-[25px] border rounded transition-all duration-200 ease-in-out relative"
|
|
27
|
-
[class]="classes"
|
|
28
|
-
[ngClass]="{
|
|
29
|
-
'bg-primary border-primary dark:bg-dark-primary dark:border-dark-primary': innerValue,
|
|
30
|
-
'bg-white border-primary dark:border-dark-border': !innerValue,
|
|
31
|
-
'opacity-50 cursor-not-allowed': disabled,
|
|
32
|
-
'cursor-pointer': !disabled
|
|
33
|
-
}"
|
|
34
|
-
>
|
|
35
|
-
<lucide-icon
|
|
36
|
-
[name]="icon"
|
|
37
|
-
[size]="iconSize"
|
|
38
|
-
class="text-white"
|
|
39
|
-
[ngClass]="{'opacity-0': !innerValue, 'opacity-100': innerValue}"
|
|
40
|
-
></lucide-icon>
|
|
41
|
-
</span>
|
|
17
|
+
<span class="j-checkbox-control" [class]="classes">
|
|
18
|
+
<input
|
|
19
|
+
type="checkbox"
|
|
20
|
+
class="j-checkbox-input"
|
|
21
|
+
[checked]="checked"
|
|
22
|
+
[disabled]="isDisabled"
|
|
23
|
+
(change)="onCheckboxChangeHandler($event)"
|
|
24
|
+
/>
|
|
42
25
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
<span [ngClass]="boxClasses" aria-hidden="true">
|
|
27
|
+
@if (isLoading) {
|
|
28
|
+
<JIcon
|
|
29
|
+
[icon]="Icons.Loader2"
|
|
30
|
+
[size]="iconSize"
|
|
31
|
+
iconClass="animate-spin text-primary dark:text-dark-primary"
|
|
32
|
+
[ariaHidden]="true"
|
|
33
|
+
/>
|
|
34
|
+
} @else {
|
|
35
|
+
<JIcon
|
|
36
|
+
[icon]="icon"
|
|
37
|
+
[size]="iconSize"
|
|
38
|
+
[inheritParentColor]="true"
|
|
39
|
+
[ngClasses]="{
|
|
40
|
+
'opacity-0 scale-75': !checked,
|
|
41
|
+
'opacity-100 scale-100': checked,
|
|
42
|
+
}"
|
|
43
|
+
iconClass="transition-all duration-150"
|
|
44
|
+
[ariaHidden]="true"
|
|
45
|
+
/>
|
|
49
46
|
}
|
|
50
|
-
|
|
47
|
+
</span>
|
|
48
|
+
</span>
|
|
51
49
|
|
|
50
|
+
@if (showTitleAfter) {
|
|
51
|
+
<span
|
|
52
|
+
class="j-checkbox-title"
|
|
53
|
+
[ngClass]="titleClasses"
|
|
54
|
+
[style.font-size]="titleSize"
|
|
55
|
+
>
|
|
56
|
+
{{ title }}
|
|
57
|
+
</span>
|
|
58
|
+
}
|
|
59
|
+
</label>
|
|
52
60
|
</div>
|