tailjng 0.0.62 → 0.1.0
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 +186 -32
- package/cli/component-manager.js +71 -20
- package/cli/execute/init-app.js +251 -0
- package/cli/file-operations.js +45 -29
- package/cli/index.js +66 -15
- package/cli/settings/components-list.js +4 -151
- package/cli/settings/header-generator.js +9 -10
- package/cli/settings/lib-utils.js +89 -0
- package/cli/settings/overwrite-policy.js +18 -0
- package/cli/settings/path-utils.js +14 -29
- package/cli/settings/project-utils.js +220 -0
- package/cli/settings/prompt-utils.js +66 -5
- package/cli/templates/app.generator.js +382 -0
- package/fesm2022/tailjng.mjs +232 -66
- package/fesm2022/tailjng.mjs.map +1 -1
- package/lib/services/static/colors.service.d.ts +17 -0
- package/lib/services/transformer/transform.service.d.ts +3 -3
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/registry/components.json +164 -0
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.css +17 -0
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.html +83 -51
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.ts +85 -53
- package/src/lib/components/alert/alert-toast/toast-alert.component.css +38 -4
- package/src/lib/components/alert/alert-toast/toast-alert.component.html +72 -40
- package/src/lib/components/alert/alert-toast/toast-alert.component.ts +84 -19
- package/src/lib/components/badge/badge.component.ts +1 -2
- package/src/lib/components/button/button.component.css +14 -0
- package/src/lib/components/button/button.component.html +17 -17
- package/src/lib/components/button/button.component.ts +139 -48
- package/src/lib/components/card/card-crud-complete/complete-crud-card.component.ts +5 -1
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.html +1 -1
- package/src/lib/components/filter/filter-complete/complete-filter.component.html +1 -1
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.html +8 -5
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.scss +12 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.component.css +4 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.component.html +1 -1
- package/src/lib/components/select/select-dropdown/dropdown-select.component.ts +3 -3
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.css +4 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.html +1 -1
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.ts +30 -20
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.html +504 -170
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.scss +92 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.ts +139 -5
- package/src/lib/components/table/table-crud-complete/expand-grid/table-expand-grid.builder.ts +116 -0
- package/src/lib/components/table/table-crud-complete/expand-grid/table-expand-grid.helper.ts +43 -0
- package/src/lib/components/table/table-crud-complete/expand-grid/table-expand-grid.types.ts +39 -0
- package/src/lib/components/table/table-crud-complete/index.ts +3 -0
- package/src/lib/components/toggle-radio/toggle-radio.component.css +4 -0
- package/src/lib/components/toggle-radio/toggle-radio.component.html +4 -4
- package/src/lib/components/toggle-radio/toggle-radio.component.ts +15 -6
- package/src/lib/components/tooltip/tooltip.service.ts +0 -30
- package/tailjng-0.1.0.tgz +0 -0
- package/src/lib/components/color/colors.service.ts +0 -187
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class JColorsService {
|
|
3
|
+
variants: {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
};
|
|
6
|
+
getVariantClass(type: string, hasShadow?: boolean, hasBorder?: boolean): string;
|
|
7
|
+
getAlertClass(type: string, monocromatic: boolean): "border-green-500 bg-green-50 dark:bg-[#15241f]" | "border-red-500 bg-red-50 dark:bg-[#21181c]" | "border-yellow-500 bg-yellow-50 dark:bg-[#1f1c1a]" | "border-blue-500 bg-blue-50 dark:bg-[#1a1a24]" | "border-purple-500 bg-purple-50 dark:bg-[#241732]" | "border-gray-500 bg-gray-50 dark:bg-[#15181e]" | "border-gray-500" | "bg-white dark:bg-foreground border-border dark:border-dark-border";
|
|
8
|
+
getIconClass(type: string, monocromatic: boolean): "text-green-500" | "text-red-500" | "text-yellow-500" | "text-blue-500" | "text-purple-500" | "text-gray-500" | "text-primary";
|
|
9
|
+
getButtonClass(type: string, monocromatic: boolean): {
|
|
10
|
+
[key: string]: boolean;
|
|
11
|
+
};
|
|
12
|
+
getButtonSecondaryClass(type: string, monocromatic: boolean): {
|
|
13
|
+
[key: string]: boolean;
|
|
14
|
+
};
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JColorsService, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<JColorsService>;
|
|
17
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JCalendarService } from './calendar.service';
|
|
2
|
-
import { CurrencyPipe } from '@angular/common';
|
|
3
2
|
import { TableColumn } from '../../interfaces/crud/crud.interface';
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
4
|
export declare class JTransformService {
|
|
6
|
-
private readonly currencyPipe;
|
|
7
5
|
private readonly calendarService;
|
|
8
|
-
|
|
6
|
+
/** Instanciado directamente — no requiere provider de CurrencyPipe en la app */
|
|
7
|
+
private readonly currencyPipe;
|
|
8
|
+
constructor(calendarService: JCalendarService);
|
|
9
9
|
/**
|
|
10
10
|
* Verify if the value is a valid JSON string.
|
|
11
11
|
* @param value
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './lib/interfaces/crud/params.interface';
|
|
|
4
4
|
export * from './lib/interfaces/crud/filter.interface';
|
|
5
5
|
export * from './lib/interfaces/crud/form.interface';
|
|
6
6
|
export * from './lib/interfaces/theme/theme-generator.interface';
|
|
7
|
+
export * from './lib/interfaces/alert/dialog-alert.interface';
|
|
7
8
|
export * from './lib/shared/form.shared';
|
|
8
9
|
export * from './lib/shared/dialog.shared';
|
|
9
10
|
export * from './lib/services/crud/converter-crud.service';
|
|
@@ -15,6 +16,7 @@ export * from './lib/services/transformer/calendar.service';
|
|
|
15
16
|
export * from './lib/services/transformer/transform.service';
|
|
16
17
|
export * from './lib/services/static/icons.service';
|
|
17
18
|
export * from './lib/services/static/theme.service';
|
|
19
|
+
export * from './lib/services/static/colors.service';
|
|
18
20
|
export * from './lib/services/alert/dialog-alert.service';
|
|
19
21
|
export * from './lib/services/alert/toast-alert.service';
|
|
20
22
|
export * from './lib/services/report/excel.service';
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
{
|
|
2
|
+
"components": {
|
|
3
|
+
"mode-toggle": {
|
|
4
|
+
"path": "src/lib/components/mode-toggle",
|
|
5
|
+
"dependencies": []
|
|
6
|
+
},
|
|
7
|
+
"tooltip": {
|
|
8
|
+
"path": "src/lib/components/tooltip",
|
|
9
|
+
"dependencies": []
|
|
10
|
+
},
|
|
11
|
+
"coach-mark": {
|
|
12
|
+
"path": "src/lib/components/coach-mark",
|
|
13
|
+
"dependencies": []
|
|
14
|
+
},
|
|
15
|
+
"badge": {
|
|
16
|
+
"path": "src/lib/components/badge",
|
|
17
|
+
"dependencies": ["tooltip"]
|
|
18
|
+
},
|
|
19
|
+
"label": {
|
|
20
|
+
"path": "src/lib/components/label",
|
|
21
|
+
"dependencies": ["tooltip"]
|
|
22
|
+
},
|
|
23
|
+
"toggle-radio": {
|
|
24
|
+
"path": "src/lib/components/toggle-radio",
|
|
25
|
+
"dependencies": []
|
|
26
|
+
},
|
|
27
|
+
"button": {
|
|
28
|
+
"path": "src/lib/components/button",
|
|
29
|
+
"dependencies": ["tooltip"]
|
|
30
|
+
},
|
|
31
|
+
"checkbox-input": {
|
|
32
|
+
"path": "src/lib/components/checkbox/checkbox-input",
|
|
33
|
+
"dependencies": ["tooltip"]
|
|
34
|
+
},
|
|
35
|
+
"checkbox-switch": {
|
|
36
|
+
"path": "src/lib/components/checkbox/checkbox-switch",
|
|
37
|
+
"dependencies": []
|
|
38
|
+
},
|
|
39
|
+
"alert-dialog": {
|
|
40
|
+
"path": "src/lib/components/alert/alert-dialog",
|
|
41
|
+
"dependencies": ["button"]
|
|
42
|
+
},
|
|
43
|
+
"alert-toast": {
|
|
44
|
+
"path": "src/lib/components/alert/alert-toast",
|
|
45
|
+
"dependencies": ["button"]
|
|
46
|
+
},
|
|
47
|
+
"progress-bar": {
|
|
48
|
+
"path": "src/lib/components/progress-bar",
|
|
49
|
+
"dependencies": []
|
|
50
|
+
},
|
|
51
|
+
"viewer-image": {
|
|
52
|
+
"path": "src/lib/components/viewer/viewer-image",
|
|
53
|
+
"dependencies": ["button"]
|
|
54
|
+
},
|
|
55
|
+
"viewer-pdf": {
|
|
56
|
+
"path": "src/lib/components/viewer/viewer-pdf",
|
|
57
|
+
"dependencies": []
|
|
58
|
+
},
|
|
59
|
+
"dialog": {
|
|
60
|
+
"path": "src/lib/components/dialog",
|
|
61
|
+
"dependencies": []
|
|
62
|
+
},
|
|
63
|
+
"input-file": {
|
|
64
|
+
"path": "src/lib/components/input/input-file",
|
|
65
|
+
"dependencies": []
|
|
66
|
+
},
|
|
67
|
+
"input-textarea": {
|
|
68
|
+
"path": "src/lib/components/input/input-textarea",
|
|
69
|
+
"dependencies": []
|
|
70
|
+
},
|
|
71
|
+
"input-range": {
|
|
72
|
+
"path": "src/lib/components/input/input-range",
|
|
73
|
+
"dependencies": []
|
|
74
|
+
},
|
|
75
|
+
"input": {
|
|
76
|
+
"path": "src/lib/components/input/input",
|
|
77
|
+
"dependencies": []
|
|
78
|
+
},
|
|
79
|
+
"select-multi-table": {
|
|
80
|
+
"path": "src/lib/components/select/select-multi-table",
|
|
81
|
+
"dependencies": ["button"]
|
|
82
|
+
},
|
|
83
|
+
"select-multi-dropdown": {
|
|
84
|
+
"path": "src/lib/components/select/select-multi-dropdown",
|
|
85
|
+
"dependencies": []
|
|
86
|
+
},
|
|
87
|
+
"select-dropdown": {
|
|
88
|
+
"path": "src/lib/components/select/select-dropdown",
|
|
89
|
+
"dependencies": []
|
|
90
|
+
},
|
|
91
|
+
"sidebar-static": {
|
|
92
|
+
"path": "src/lib/components/sidebar/sidebar-static",
|
|
93
|
+
"dependencies": ["checkbox-switch"]
|
|
94
|
+
},
|
|
95
|
+
"form-container": {
|
|
96
|
+
"path": "src/lib/components/form/form-container",
|
|
97
|
+
"dependencies": []
|
|
98
|
+
},
|
|
99
|
+
"form-validation": {
|
|
100
|
+
"path": "src/lib/components/form/form-validation",
|
|
101
|
+
"dependencies": []
|
|
102
|
+
},
|
|
103
|
+
"form-sidebar": {
|
|
104
|
+
"path": "src/lib/components/form/form-sidebar",
|
|
105
|
+
"dependencies": ["tooltip", "button", "checkbox-switch", "coach-mark"]
|
|
106
|
+
},
|
|
107
|
+
"paginator-complete": {
|
|
108
|
+
"path": "src/lib/components/paginator/paginator-complete",
|
|
109
|
+
"dependencies": ["button"]
|
|
110
|
+
},
|
|
111
|
+
"filter-complete": {
|
|
112
|
+
"path": "src/lib/components/filter/filter-complete",
|
|
113
|
+
"dependencies": ["select-dropdown", "select-multi-table", "button", "dialog", "checkbox-switch"]
|
|
114
|
+
},
|
|
115
|
+
"card-crud-complete": {
|
|
116
|
+
"path": "src/lib/components/card/card-crud-complete",
|
|
117
|
+
"dependencies": ["paginator-complete", "filter-complete"]
|
|
118
|
+
},
|
|
119
|
+
"card-complete": {
|
|
120
|
+
"path": "src/lib/components/card/card-complete",
|
|
121
|
+
"dependencies": ["paginator-complete", "filter-complete"]
|
|
122
|
+
},
|
|
123
|
+
"menu-options-table": {
|
|
124
|
+
"path": "src/lib/components/menu/menu-options-table",
|
|
125
|
+
"dependencies": ["button"]
|
|
126
|
+
},
|
|
127
|
+
"options-coach-menu": {
|
|
128
|
+
"path": "src/lib/components/menu/options-coach-menu",
|
|
129
|
+
"dependencies": ["button", "coach-mark"]
|
|
130
|
+
},
|
|
131
|
+
"table-crud-complete": {
|
|
132
|
+
"path": "src/lib/components/table/table-crud-complete",
|
|
133
|
+
"dependencies": [
|
|
134
|
+
"button",
|
|
135
|
+
"paginator-complete",
|
|
136
|
+
"filter-complete",
|
|
137
|
+
"checkbox-input",
|
|
138
|
+
"options-coach-menu",
|
|
139
|
+
"dialog",
|
|
140
|
+
"viewer-image",
|
|
141
|
+
"select-dropdown",
|
|
142
|
+
"input"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
"table-complete": {
|
|
146
|
+
"path": "src/lib/components/table/table-complete",
|
|
147
|
+
"dependencies": [
|
|
148
|
+
"button",
|
|
149
|
+
"paginator-complete",
|
|
150
|
+
"filter-complete",
|
|
151
|
+
"checkbox-input",
|
|
152
|
+
"options-coach-menu",
|
|
153
|
+
"dialog",
|
|
154
|
+
"viewer-image",
|
|
155
|
+
"select-dropdown",
|
|
156
|
+
"input"
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"theme-generator": {
|
|
160
|
+
"path": "src/lib/components/theme-generator",
|
|
161
|
+
"dependencies": ["input", "input-range", "button", "label", "form-container"]
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.j-alert-dialog-card {
|
|
2
|
+
min-height: 5.5rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.j-alert-dialog-watermark--lg {
|
|
6
|
+
filter: blur(0.15px);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.j-alert-dialog-watermark--sm {
|
|
10
|
+
filter: blur(0.1px);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (max-width: 450px) {
|
|
14
|
+
.j-alert-dialog-card {
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,69 +1,101 @@
|
|
|
1
1
|
@for (dialog of dialogs(); track dialog.config.title) {
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="j-alert-dialog fixed inset-0 z-999999 flex items-center justify-center bg-black/45 backdrop-blur-[2px] p-4"
|
|
4
|
+
role="dialog"
|
|
5
|
+
aria-modal="true"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
@modalTransition
|
|
9
|
+
class="j-alert-dialog-card relative w-full max-w-md overflow-hidden rounded-xl border border-border/40 dark:border-dark-border/40 backdrop-blur-xl shadow-xl shadow-black/10 dark:shadow-black/40"
|
|
10
|
+
[ngClass]="getDialogSurfaceClass(dialog.config.type)"
|
|
7
11
|
>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
<div
|
|
13
|
+
class="absolute left-0 top-0 bottom-0 w-1 z-[1]"
|
|
14
|
+
[ngClass]="getAccentBarClass(dialog.config.type)"
|
|
15
|
+
></div>
|
|
16
|
+
|
|
17
|
+
<!-- Icono decorativo grande -->
|
|
18
|
+
<div
|
|
19
|
+
class="j-alert-dialog-watermark j-alert-dialog-watermark--lg absolute -bottom-8 -left-5 z-0 pointer-events-none select-none"
|
|
20
|
+
[ngClass]="{ 'animate-spin': dialog.config.type === 'loading' }"
|
|
13
21
|
>
|
|
14
|
-
|
|
22
|
+
<lucide-icon
|
|
23
|
+
[name]="getIcon(dialog.config.type)"
|
|
24
|
+
[size]="104"
|
|
25
|
+
[ngClass]="getWatermarkIconClass(dialog.config.type)"
|
|
26
|
+
></lucide-icon>
|
|
15
27
|
</div>
|
|
16
28
|
|
|
17
|
-
<!--
|
|
18
|
-
<div
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
<!-- Icono decorativo pequeño -->
|
|
30
|
+
<div
|
|
31
|
+
class="j-alert-dialog-watermark j-alert-dialog-watermark--sm absolute top-2 right-3 z-0 pointer-events-none select-none"
|
|
32
|
+
[ngClass]="{ 'animate-spin': dialog.config.type === 'loading' }"
|
|
21
33
|
>
|
|
22
|
-
<lucide-icon
|
|
34
|
+
<lucide-icon
|
|
35
|
+
[name]="getIcon(dialog.config.type)"
|
|
36
|
+
[size]="32"
|
|
37
|
+
[ngClass]="getWatermarkIconClass(dialog.config.type, true)"
|
|
38
|
+
></lucide-icon>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<!-- Texto -->
|
|
42
|
+
<div
|
|
43
|
+
class="relative z-10 pl-5 pr-4 pt-4"
|
|
44
|
+
[class.pb-2]="hasActions(dialog)"
|
|
45
|
+
[class.pb-4]="!hasActions(dialog)"
|
|
46
|
+
>
|
|
47
|
+
<h3 class="m-0 text-sm font-semibold leading-tight text-foreground dark:text-white">
|
|
48
|
+
{{ dialog.config.title }}
|
|
49
|
+
</h3>
|
|
50
|
+
|
|
51
|
+
@if (dialog.config.description) {
|
|
52
|
+
<p
|
|
53
|
+
class="m-0 mt-1.5 text-xs leading-relaxed text-muted-foreground dark:text-dark-muted-foreground [&_b]:font-semibold [&_b]:text-foreground dark:[&_b]:text-white"
|
|
54
|
+
[innerHTML]="dialog.config.description"
|
|
55
|
+
></p>
|
|
56
|
+
}
|
|
23
57
|
</div>
|
|
24
|
-
|
|
25
|
-
<h3 class="text-lg font-semibold text-black dark:text-white pb-2">{{ dialog.config.title }}</h3>
|
|
26
|
-
<p class="text-black/80 dark:text-dark-muted-foreground" [innerHTML]="dialog.config.description"></p>
|
|
27
|
-
|
|
28
|
-
<div class="flex justify-end gap-2 mt-4">
|
|
29
58
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
59
|
+
<!-- Acciones alineadas a la card -->
|
|
60
|
+
@if (hasActions(dialog)) {
|
|
61
|
+
<div class="relative z-10 flex flex-wrap justify-end gap-1.5 pl-5 pr-4 pb-4">
|
|
62
|
+
@if (showRetryButton(dialog.config)) {
|
|
63
|
+
<JButton
|
|
64
|
+
size="sm"
|
|
65
|
+
(clicked)="handleAction('retry')"
|
|
66
|
+
[disabled]="dialog.isRetryLoading || dialog.isCancelLoading || dialog.isConfirmLoading"
|
|
67
|
+
[isLoading]="dialog.isRetryLoading"
|
|
68
|
+
[ngClasses]="getButtonSecondaryClass(dialog.config.type)"
|
|
37
69
|
>
|
|
38
|
-
|
|
70
|
+
{{ getRetryLabel(dialog.config) }}
|
|
39
71
|
</JButton>
|
|
40
|
-
|
|
72
|
+
}
|
|
41
73
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
74
|
+
@if (showCancelButton(dialog.config)) {
|
|
75
|
+
<JButton
|
|
76
|
+
size="sm"
|
|
77
|
+
(clicked)="handleAction('cancel')"
|
|
78
|
+
[disabled]="dialog.isRetryLoading || dialog.isCancelLoading || dialog.isConfirmLoading"
|
|
79
|
+
[isLoading]="dialog.isCancelLoading"
|
|
80
|
+
[ngClasses]="getButtonSecondaryClass(dialog.config.type)"
|
|
49
81
|
>
|
|
50
|
-
|
|
82
|
+
{{ getCancelLabel(dialog.config) }}
|
|
51
83
|
</JButton>
|
|
52
|
-
|
|
84
|
+
}
|
|
53
85
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
86
|
+
@if (showConfirmButton(dialog.config)) {
|
|
87
|
+
<JButton
|
|
88
|
+
size="sm"
|
|
89
|
+
(clicked)="handleAction('confirm')"
|
|
90
|
+
[disabled]="dialog.isRetryLoading || dialog.isCancelLoading || dialog.isConfirmLoading"
|
|
91
|
+
[isLoading]="dialog.isConfirmLoading"
|
|
92
|
+
[ngClasses]="getButtonClass(dialog.config.type)"
|
|
61
93
|
>
|
|
62
|
-
|
|
94
|
+
{{ getConfirmLabel(dialog.config) }}
|
|
63
95
|
</JButton>
|
|
64
|
-
|
|
65
|
-
|
|
96
|
+
}
|
|
97
|
+
</div>
|
|
98
|
+
}
|
|
66
99
|
</div>
|
|
67
|
-
|
|
68
100
|
</div>
|
|
69
|
-
|
|
101
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Component, inject, computed, Input } from
|
|
2
|
-
import { NgClass } from
|
|
3
|
-
import { trigger, transition, style, animate } from
|
|
4
|
-
import { JIconsService, JAlertDialogService } from
|
|
5
|
-
import { LucideAngularModule } from
|
|
6
|
-
import { JButtonComponent } from
|
|
7
|
-
import { JColorsService } from "../../color/colors.service";
|
|
1
|
+
import { Component, inject, computed, Input } from '@angular/core';
|
|
2
|
+
import { NgClass } from '@angular/common';
|
|
3
|
+
import { trigger, transition, style, animate } from '@angular/animations';
|
|
4
|
+
import { JIconsService, JAlertDialogService, AlertDialogProps, JColorsService } from 'tailjng';
|
|
5
|
+
import { LucideAngularModule } from 'lucide-angular';
|
|
6
|
+
import { JButtonComponent } from '../../button/button.component';
|
|
8
7
|
|
|
9
8
|
@Component({
|
|
10
9
|
selector: 'JAlertDialog',
|
|
@@ -12,13 +11,13 @@ import { JColorsService } from "../../color/colors.service";
|
|
|
12
11
|
templateUrl: './dialog-alert.component.html',
|
|
13
12
|
styleUrl: './dialog-alert.component.css',
|
|
14
13
|
animations: [
|
|
15
|
-
trigger(
|
|
16
|
-
transition(
|
|
17
|
-
style({
|
|
18
|
-
animate(
|
|
14
|
+
trigger('modalTransition', [
|
|
15
|
+
transition(':enter', [
|
|
16
|
+
style({ opacity: 0, transform: 'scale(0.96) translateY(0.5rem)' }),
|
|
17
|
+
animate('320ms cubic-bezier(0.16, 1, 0.3, 1)', style({ opacity: 1, transform: 'scale(1) translateY(0)' })),
|
|
19
18
|
]),
|
|
20
|
-
transition(
|
|
21
|
-
animate(
|
|
19
|
+
transition(':leave', [
|
|
20
|
+
animate('180ms cubic-bezier(0.4, 0, 1, 1)', style({ opacity: 0, transform: 'scale(0.98) translateY(0.25rem)' })),
|
|
22
21
|
]),
|
|
23
22
|
]),
|
|
24
23
|
],
|
|
@@ -28,76 +27,109 @@ export class JAlertDialogComponent {
|
|
|
28
27
|
@Input() monocromatic: boolean = false;
|
|
29
28
|
private readonly alertDialogService = inject(JAlertDialogService);
|
|
30
29
|
|
|
31
|
-
// Single computed property for dialogs
|
|
32
30
|
dialogs = computed(() => this.alertDialogService.dialogs());
|
|
33
31
|
|
|
34
32
|
constructor(
|
|
35
33
|
private readonly colorsService: JColorsService,
|
|
36
|
-
private readonly iconsService: JIconsService
|
|
34
|
+
private readonly iconsService: JIconsService,
|
|
37
35
|
) { }
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Get the icon for the specified type.
|
|
42
|
-
* @param type The type of the icon.
|
|
43
|
-
* @returns The icon for the specified type.
|
|
44
|
-
*/
|
|
45
37
|
getIcon(type: string) {
|
|
46
38
|
return this.iconsService.icons[type as keyof typeof this.iconsService.icons] || this.iconsService.icons.info;
|
|
47
39
|
}
|
|
48
40
|
|
|
49
|
-
|
|
41
|
+
handleAction(action: 'confirm' | 'cancel' | 'retry') {
|
|
42
|
+
this.alertDialogService.executeAction(action);
|
|
43
|
+
}
|
|
50
44
|
|
|
51
45
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @param action The action to execute.
|
|
46
|
+
* Fondo suave del dialog (mismo criterio que JAlertToast).
|
|
54
47
|
*/
|
|
55
|
-
|
|
56
|
-
this.
|
|
48
|
+
getDialogSurfaceClass(type: string): string {
|
|
49
|
+
if (this.monocromatic) {
|
|
50
|
+
return 'bg-white/95 dark:bg-foreground/95';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const surfaces: Record<string, string> = {
|
|
54
|
+
success: 'bg-green-50/95 dark:bg-[#15241f]/95',
|
|
55
|
+
error: 'bg-red-50/95 dark:bg-[#21181c]/95',
|
|
56
|
+
warning: 'bg-yellow-50/95 dark:bg-[#1f1c1a]/95',
|
|
57
|
+
info: 'bg-blue-50/95 dark:bg-[#1a1a24]/95',
|
|
58
|
+
question: 'bg-purple-50/95 dark:bg-[#241732]/95',
|
|
59
|
+
loading: 'bg-gray-50/95 dark:bg-[#15181e]/95',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return surfaces[type] ?? 'bg-white/95 dark:bg-foreground/95';
|
|
57
63
|
}
|
|
58
64
|
|
|
65
|
+
getAccentBarClass(type: string): string {
|
|
66
|
+
if (this.monocromatic) return 'bg-primary';
|
|
59
67
|
|
|
68
|
+
const accents: Record<string, string> = {
|
|
69
|
+
success: 'bg-green-500',
|
|
70
|
+
error: 'bg-red-500',
|
|
71
|
+
warning: 'bg-yellow-500',
|
|
72
|
+
info: 'bg-blue-500',
|
|
73
|
+
question: 'bg-purple-500',
|
|
74
|
+
loading: 'bg-gray-500',
|
|
75
|
+
};
|
|
60
76
|
|
|
61
|
-
|
|
62
|
-
* Get the class for the toast
|
|
63
|
-
* @param type The type of the toast.
|
|
64
|
-
* @returns The class for the toast.
|
|
65
|
-
*/
|
|
66
|
-
getDialogClass(type: string) {
|
|
67
|
-
return this.colorsService.getAlertClass(type, this.monocromatic);
|
|
77
|
+
return accents[type] ?? 'bg-primary';
|
|
68
78
|
}
|
|
69
79
|
|
|
80
|
+
getWatermarkIconClass(type: string, subtle = false): string {
|
|
81
|
+
if (subtle) {
|
|
82
|
+
return `${this.getIconClass(type)} opacity-[0.12] dark:opacity-[0.2]`;
|
|
83
|
+
}
|
|
84
|
+
return `${this.getIconClass(type)} opacity-[0.2] dark:opacity-[0.3]`;
|
|
85
|
+
}
|
|
70
86
|
|
|
87
|
+
hasActions(dialog: { config: AlertDialogProps }): boolean {
|
|
88
|
+
const { config } = dialog;
|
|
89
|
+
return (
|
|
90
|
+
this.showConfirmButton(config) ||
|
|
91
|
+
this.showCancelButton(config) ||
|
|
92
|
+
this.showRetryButton(config)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
71
95
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
* @param type The type of the icon.
|
|
75
|
-
* @returns The class for the icon.
|
|
76
|
-
*/
|
|
77
|
-
getIconClass(type: string) {
|
|
78
|
-
return this.colorsService.getIconClass(type, this.monocromatic);
|
|
96
|
+
showConfirmButton(config: AlertDialogProps): boolean {
|
|
97
|
+
return config.type !== 'loading';
|
|
79
98
|
}
|
|
80
99
|
|
|
100
|
+
showCancelButton(config: AlertDialogProps): boolean {
|
|
101
|
+
if (config.type === 'success') return false;
|
|
102
|
+
if (config.type === 'question' || config.type === 'loading') return true;
|
|
103
|
+
return 'onCancel' in config;
|
|
104
|
+
}
|
|
81
105
|
|
|
106
|
+
showRetryButton(config: AlertDialogProps): boolean {
|
|
107
|
+
return config.type === 'error' && 'onRetry' in config;
|
|
108
|
+
}
|
|
82
109
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* @param type The type of the button.
|
|
86
|
-
* @returns The class for the button.
|
|
87
|
-
*/
|
|
88
|
-
getButtonClass(type: string): { [key: string]: boolean } {
|
|
89
|
-
return this.colorsService.getButtonClass(type, this.monocromatic);
|
|
110
|
+
getConfirmLabel(config: AlertDialogProps): string {
|
|
111
|
+
return 'titleBtnConfirm' in config ? (config.titleBtnConfirm ?? 'Confirmar') : 'Confirmar';
|
|
90
112
|
}
|
|
91
113
|
|
|
114
|
+
getCancelLabel(config: AlertDialogProps): string {
|
|
115
|
+
return 'titleBtnCancel' in config ? (config.titleBtnCancel ?? 'Cancelar') : 'Cancelar';
|
|
116
|
+
}
|
|
92
117
|
|
|
118
|
+
getRetryLabel(config: AlertDialogProps): string {
|
|
119
|
+
return config.type === 'error' && 'titleBtnRetry' in config
|
|
120
|
+
? (config.titleBtnRetry ?? 'Reintentar')
|
|
121
|
+
: 'Reintentar';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
getIconClass(type: string) {
|
|
125
|
+
return this.colorsService.getIconClass(type, this.monocromatic);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
getButtonClass(type: string): { [key: string]: boolean } {
|
|
129
|
+
return this.colorsService.getButtonClass(type, this.monocromatic);
|
|
130
|
+
}
|
|
93
131
|
|
|
94
|
-
/**
|
|
95
|
-
* Get the class for the secondary button
|
|
96
|
-
* @param type The type of the button.
|
|
97
|
-
* @returns The class for the secondary button.
|
|
98
|
-
*/
|
|
99
132
|
getButtonSecondaryClass(type: string): { [key: string]: boolean } {
|
|
100
133
|
return this.colorsService.getButtonSecondaryClass(type, this.monocromatic);
|
|
101
134
|
}
|
|
102
|
-
|
|
103
135
|
}
|
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
@media (max-width: 450px) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
.j-toast {
|
|
3
|
+
width: calc(100vw - 2rem) !important;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.j-toast {
|
|
8
|
+
min-height: 4.5rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.j-toast-watermark--lg {
|
|
12
|
+
filter: blur(0.15px);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.j-toast-watermark--sm {
|
|
16
|
+
filter: blur(0.1px);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.j-toast-timeline {
|
|
20
|
+
border-bottom-left-radius: 0.75rem;
|
|
21
|
+
border-bottom-right-radius: 0.75rem;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.j-toast-progress {
|
|
26
|
+
animation-name: j-toast-progress-shrink;
|
|
27
|
+
animation-timing-function: linear;
|
|
28
|
+
animation-fill-mode: forwards;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes j-toast-progress-shrink {
|
|
32
|
+
from {
|
|
33
|
+
transform: scaleX(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
to {
|
|
37
|
+
transform: scaleX(0);
|
|
38
|
+
}
|
|
39
|
+
}
|