gentera-rdnd 0.2.3 → 0.2.4
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/ng-package.json +12 -0
- package/package.json +6 -14
- package/src/lib/components/button/button.component.html +21 -0
- package/src/lib/components/button/button.component.scss +41 -0
- package/src/lib/components/button/button.component.ts +82 -0
- package/src/lib/components/input/Readme.md +33 -0
- package/src/lib/components/input/input.component.html +50 -0
- package/src/lib/components/input/input.component.scss +86 -0
- package/src/lib/components/input/input.component.ts +133 -0
- package/src/lib/components/modal/modal.component.html +51 -0
- package/src/lib/components/modal/modal.component.scss +50 -0
- package/src/lib/components/modal/modal.component.ts +41 -0
- package/src/lib/components/rdnd-active-indicator/rdnd-active-indicator.component.css +24 -0
- package/src/lib/components/rdnd-active-indicator/rdnd-active-indicator.component.html +12 -0
- package/src/lib/components/rdnd-active-indicator/rdnd-active-indicator.component.ts +18 -0
- package/src/lib/components/rdnd-loader/rdnd-loader.component.html +129 -0
- package/src/lib/components/rdnd-loader/rdnd-loader.component.scss +33 -0
- package/src/lib/components/rdnd-loader/rdnd-loader.component.ts +27 -0
- package/src/lib/components/rdnd-navbar/rdnd-navbar.component.html +19 -0
- package/src/lib/components/rdnd-navbar/rdnd-navbar.component.scss +40 -0
- package/src/lib/components/rdnd-navbar/rdnd-navbar.component.ts +59 -0
- package/src/lib/components/rdnd-sidebar/rdnd-sidebar.component.html +144 -0
- package/src/lib/components/rdnd-sidebar/rdnd-sidebar.component.scss +221 -0
- package/src/lib/components/rdnd-sidebar/rdnd-sidebar.component.ts +65 -0
- package/src/lib/components/screen-title/screen-title.component.html +5 -0
- package/src/lib/components/screen-title/screen-title.component.scss +15 -0
- package/src/lib/components/screen-title/screen-title.component.ts +20 -0
- package/src/lib/config/rdnd-config.token.ts +6 -0
- package/src/lib/gentera-rdnd.component.ts +16 -0
- package/src/lib/gentera-rdnd.service.ts +9 -0
- package/src/lib/hooks/button.service.ts +31 -0
- package/src/lib/hooks/input.service.ts +73 -0
- package/src/lib/hooks/modal.service.ts +112 -0
- package/src/lib/services/storage.service.ts +31 -0
- package/src/lib/styles/colors.scss +63 -0
- package/src/lib/styles/colors.ts +55 -0
- package/src/lib/styles/fonts.scss +93 -0
- package/src/lib/styles/sizes.scss +10 -0
- package/src/lib/styles/themes.ts +114 -0
- package/src/lib/styles/z_indexes.scss +3 -0
- package/src/lib/types/Loader-config.types.ts +8 -0
- package/src/lib/types/Sidebar.types.ts +6 -0
- package/src/public-api.ts +31 -0
- package/tsconfig.lib.json +25 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/fesm2022/gentera-rdnd.mjs +0 -794
- package/fesm2022/gentera-rdnd.mjs.map +0 -1
- package/index.d.ts +0 -552
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gentera-rdnd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Librería Angular para componentes reutilizables en Gentera",
|
|
6
|
+
"author": "Ruben Redondo Barroso",
|
|
4
7
|
"peerDependencies": {
|
|
5
8
|
"@angular/common": "^20.2.1",
|
|
6
9
|
"@angular/core": "^20.2.1",
|
|
@@ -9,16 +12,5 @@
|
|
|
9
12
|
"dependencies": {
|
|
10
13
|
"tslib": "^2.3.0"
|
|
11
14
|
},
|
|
12
|
-
"sideEffects": false
|
|
13
|
-
|
|
14
|
-
"typings": "index.d.ts",
|
|
15
|
-
"exports": {
|
|
16
|
-
"./package.json": {
|
|
17
|
-
"default": "./package.json"
|
|
18
|
-
},
|
|
19
|
-
".": {
|
|
20
|
-
"types": "./index.d.ts",
|
|
21
|
-
"default": "./fesm2022/gentera-rdnd.mjs"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
15
|
+
"sideEffects": false
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<button
|
|
2
|
+
[ngClass]="{
|
|
3
|
+
'full': size === 'full',
|
|
4
|
+
'contained': size === 'contained',
|
|
5
|
+
'bordered': borders,
|
|
6
|
+
'disabled': disabled
|
|
7
|
+
}"
|
|
8
|
+
[style.background]="disabled ? themes.disabled.default : theme.default"
|
|
9
|
+
[style.color]="theme.fontColor"
|
|
10
|
+
[style.border]="borders ? '1px solid ' + theme.border : 'none'"
|
|
11
|
+
[style.cursor]="disabled ? 'not-allowed' : 'pointer'"
|
|
12
|
+
[attr.type]="type"
|
|
13
|
+
[disabled]="disabled"
|
|
14
|
+
|
|
15
|
+
(mouseleave)="onMouseLeave()"
|
|
16
|
+
(click)="handleClick($event)"
|
|
17
|
+
(mouseenter)="onMouseEnter()"
|
|
18
|
+
>
|
|
19
|
+
<fa-icon *ngIf="icon" [icon]="icon" class="icon"></fa-icon>
|
|
20
|
+
{{ text }}
|
|
21
|
+
</button>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
button {
|
|
2
|
+
height: 36px;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
gap: 4px;
|
|
7
|
+
padding: 10px;
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
transition: all 0.3s ease;
|
|
10
|
+
|
|
11
|
+
&.full {
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&.contained {
|
|
16
|
+
width: fit-content;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.bordered {
|
|
20
|
+
border-radius: 5px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.disabled {
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
background-color: #ddd;
|
|
26
|
+
border-color: transparent !important;
|
|
27
|
+
color: #9E9E9E !important;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.icon {
|
|
31
|
+
transition: all 0.3s ease;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
opacity: 0.8;
|
|
36
|
+
}
|
|
37
|
+
&:active {
|
|
38
|
+
transform: scale(0.99);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
|
+
import {Observable, Subscription} from 'rxjs';
|
|
4
|
+
import {FaIconComponent} from "@fortawesome/angular-fontawesome";
|
|
5
|
+
import {NgClass, NgIf} from "@angular/common";
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import {themes} from "../../styles/themes";
|
|
8
|
+
import {ButtonService, ButtonServiceType} from "../../hooks/button.service";
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'rdnd-button',
|
|
15
|
+
templateUrl: './button.component.html',
|
|
16
|
+
standalone: true,
|
|
17
|
+
imports: [
|
|
18
|
+
FaIconComponent,
|
|
19
|
+
NgIf,
|
|
20
|
+
NgClass
|
|
21
|
+
],
|
|
22
|
+
styleUrls: ['./button.component.scss']
|
|
23
|
+
})
|
|
24
|
+
export class RdndButton implements OnInit, OnDestroy {
|
|
25
|
+
@Input() id!: string;
|
|
26
|
+
@Input() icon?: IconDefinition;
|
|
27
|
+
@Input() text: string = 'Enviar';
|
|
28
|
+
@Input() theme: any = themes.magenta;
|
|
29
|
+
@Input() size: 'contained' | 'full' = 'full';
|
|
30
|
+
@Input() type: 'button' | 'submit' | 'reset' = 'submit';
|
|
31
|
+
@Input() borders: boolean = true;
|
|
32
|
+
@Input() disabled: boolean = false;
|
|
33
|
+
|
|
34
|
+
@Output() callback: EventEmitter<void> = new EventEmitter<void>();
|
|
35
|
+
|
|
36
|
+
protected readonly themes = themes;
|
|
37
|
+
private subscription!: Subscription;
|
|
38
|
+
hoverBackgroundColor: string = this.theme.default;
|
|
39
|
+
|
|
40
|
+
buttonControl!: ButtonServiceType ;
|
|
41
|
+
|
|
42
|
+
constructor(private buttonService: ButtonService) {
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ngOnInit(): void {
|
|
46
|
+
this.buttonControl = this.buttonService.useButton(this.id);
|
|
47
|
+
|
|
48
|
+
this.subscription = new Subscription( () =>
|
|
49
|
+
this.buttonControl.disabled$.subscribe((isDisabled: boolean) => {
|
|
50
|
+
this.disabled = isDisabled;
|
|
51
|
+
})
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
ngOnDestroy(): void {
|
|
57
|
+
if(this.subscription){
|
|
58
|
+
this.subscription.unsubscribe();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
handleClick(event: MouseEvent): void {
|
|
63
|
+
event.stopPropagation();
|
|
64
|
+
if (!this.disabled && this.type !== 'submit') {
|
|
65
|
+
this.callback.emit();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
onMouseEnter() {
|
|
70
|
+
if (!this.disabled) {
|
|
71
|
+
this.hoverBackgroundColor = this.theme.hover;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
onMouseLeave() {
|
|
76
|
+
if (!this.disabled) {
|
|
77
|
+
this.hoverBackgroundColor = this.theme.default;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
protected readonly event = event;
|
|
82
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# 📥 Componente: `rdnd-input`
|
|
2
|
+
|
|
3
|
+
Este componente representa un campo de entrada (`input`) reutilizable con soporte para validaciones, tipos de entrada (`text`, `password`, `number`), íconos de error, y control de visibilidad de contraseñas.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ✅ Uso básico
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<rdnd-input
|
|
11
|
+
[id]="'usuario'"
|
|
12
|
+
[name]="'usuario'"
|
|
13
|
+
[type]="'text'"
|
|
14
|
+
[placeholder]="'Ingresa tu usuario'"
|
|
15
|
+
[value]="usuario"
|
|
16
|
+
[validators]="[Validators.required]"
|
|
17
|
+
(valueChange)="usuario = $event"
|
|
18
|
+
></rdnd-input>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## ✅ Ejemplo de uso avanzado
|
|
23
|
+
```html
|
|
24
|
+
<rdnd-input
|
|
25
|
+
id="input-login-username"
|
|
26
|
+
name="login-username"
|
|
27
|
+
type="text"
|
|
28
|
+
placeholder="Contraseña"
|
|
29
|
+
[value]="clave"
|
|
30
|
+
[validators]="[Validators.required, Validators.minLength(6)]"
|
|
31
|
+
(valueChange)="clave = $event"
|
|
32
|
+
(onBlur)="validarClave($event)"
|
|
33
|
+
></rdnd-input>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<div [ngClass]="{ 'disabled': disabled }" class="input-container">
|
|
2
|
+
<!-- Ícono de error que aparece por encima del campo si hay error -->
|
|
3
|
+
<span *ngIf="hasError()" class="error-icon" (click)="toggleErrorDisplay()">ⓘ</span>
|
|
4
|
+
|
|
5
|
+
<!-- Botón de mostrar/ocultar contraseña centrado verticalmente -->
|
|
6
|
+
<button *ngIf="type === 'password'" type="button" (click)="handleTogglePassword()" class="toggle-button">
|
|
7
|
+
<fa-icon [icon]="faEyeSlash" class="icon" [class.active]="showPassword"></fa-icon>
|
|
8
|
+
</button>
|
|
9
|
+
|
|
10
|
+
@if (showLabel) {
|
|
11
|
+
<label class="text-small dark-gray">{{ placeholder }}</label>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<!-- Input compatible con FormControl o signals -->
|
|
16
|
+
<input
|
|
17
|
+
*ngIf="control; else signalInput"
|
|
18
|
+
[type]="type === 'password' && showPassword ? 'text' : type"
|
|
19
|
+
[formControl]="control"
|
|
20
|
+
[placeholder]="showLabel ? '' : placeholder"
|
|
21
|
+
[disabled]="disabled"
|
|
22
|
+
(keydown)="handleKeyDown($event)"
|
|
23
|
+
(paste)="handlePaste($event)"
|
|
24
|
+
(focus)="handleFocus($event)"
|
|
25
|
+
(blur)="handleBlur($event)"
|
|
26
|
+
[ngClass]="{ 'error-border': hasError() }"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<!-- Input para signals -->
|
|
30
|
+
<ng-template #signalInput>
|
|
31
|
+
<input
|
|
32
|
+
[type]="type === 'password' && showPassword ? 'text' : type"
|
|
33
|
+
[value]="value"
|
|
34
|
+
[placeholder]="showLabel ? '' : placeholder"
|
|
35
|
+
[disabled]="disabled"
|
|
36
|
+
(input)="handleChange($event)"
|
|
37
|
+
(keydown)="handleKeyDown($event)"
|
|
38
|
+
(paste)="handlePaste($event)"
|
|
39
|
+
(focus)="handleFocus($event)"
|
|
40
|
+
(blur)="handleBlur($event)"
|
|
41
|
+
[ngClass]="{ 'error-border': false }"
|
|
42
|
+
/>
|
|
43
|
+
</ng-template>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<!-- Mensaje de error que aparece solo cuando se clickea en el ícono de error -->
|
|
47
|
+
<div *ngIf="control?.invalid && control?.dirty && showError" class="error-message">
|
|
48
|
+
{{ getErrorMessage() }}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.input-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
min-width: 100%;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
position: relative;
|
|
6
|
+
display: block;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
input {
|
|
10
|
+
position: relative;
|
|
11
|
+
width: 100%;
|
|
12
|
+
min-width: 100%;
|
|
13
|
+
padding: 7px 35px 7px 8px;
|
|
14
|
+
border-radius: 3px;
|
|
15
|
+
font-family: 'Poppins', sans-serif;
|
|
16
|
+
height: 36px;
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
border: 1px solid #ccc;
|
|
19
|
+
outline: none;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
transition: all 0.3s ease;
|
|
22
|
+
background-color: white !important;
|
|
23
|
+
appearance: none;
|
|
24
|
+
-moz-appearance: textfield;
|
|
25
|
+
-webkit-appearance: textfield;
|
|
26
|
+
|
|
27
|
+
&:-webkit-autofill {
|
|
28
|
+
background-color: white !important;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.error-border {
|
|
32
|
+
border-color: red;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input:focus {
|
|
37
|
+
border: 1px solid blue;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.error-icon {
|
|
41
|
+
position: absolute;
|
|
42
|
+
right: 8px;
|
|
43
|
+
top: 1px;
|
|
44
|
+
bottom: 1px;
|
|
45
|
+
font-size: 24px;
|
|
46
|
+
color: red;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
align-items: center;
|
|
52
|
+
z-index: 3;
|
|
53
|
+
background-color: white;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.error-message {
|
|
57
|
+
position: absolute;
|
|
58
|
+
bottom: 0;
|
|
59
|
+
left: 0;
|
|
60
|
+
//background-color: #ffdddd;
|
|
61
|
+
color: red;
|
|
62
|
+
padding: 0 0 0 8px;
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
font-size: 12px;
|
|
65
|
+
font-family: sans-serif;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.toggle-button {
|
|
70
|
+
position: absolute;
|
|
71
|
+
right: 8px;
|
|
72
|
+
top: 50%;
|
|
73
|
+
transform: translateY(-50%);
|
|
74
|
+
background: transparent;
|
|
75
|
+
border: none;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
z-index: 2;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.icon {
|
|
81
|
+
transition: opacity 0.3s ease;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.icon.active {
|
|
85
|
+
opacity: 0.5;
|
|
86
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges} from '@angular/core';
|
|
2
|
+
import {FormControl, ReactiveFormsModule, ValidationErrors, ValidatorFn, Validators} from '@angular/forms';
|
|
3
|
+
import {faEyeSlash} from '@fortawesome/free-solid-svg-icons';
|
|
4
|
+
import {NgClass, NgIf} from '@angular/common';
|
|
5
|
+
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
|
|
6
|
+
import {InputService} from "../../hooks/input.service";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'rdnd-input',
|
|
11
|
+
templateUrl: './input.component.html',
|
|
12
|
+
standalone: true,
|
|
13
|
+
imports: [
|
|
14
|
+
NgIf,
|
|
15
|
+
NgClass,
|
|
16
|
+
FontAwesomeModule,
|
|
17
|
+
ReactiveFormsModule
|
|
18
|
+
],
|
|
19
|
+
styleUrls: ['./input.component.scss']
|
|
20
|
+
})
|
|
21
|
+
export class RdndInput implements OnInit, OnChanges {
|
|
22
|
+
@Input() id!: string;
|
|
23
|
+
@Input() name!: string;
|
|
24
|
+
@Input() type: 'text' | 'password' | 'number' = 'text';
|
|
25
|
+
@Input() placeholder: string = '';
|
|
26
|
+
@Input() showLabel: boolean = false;
|
|
27
|
+
@Input() control?: FormControl;
|
|
28
|
+
@Input() value: string = '';
|
|
29
|
+
@Input() validators: ValidatorFn[] = [];
|
|
30
|
+
@Input() disabled: boolean = false;
|
|
31
|
+
|
|
32
|
+
@Output() valueChange = new EventEmitter<string>();
|
|
33
|
+
@Output() onKeyDown = new EventEmitter<KeyboardEvent>();
|
|
34
|
+
@Output() onPaste = new EventEmitter<ClipboardEvent>();
|
|
35
|
+
@Output() onFocus = new EventEmitter<FocusEvent>();
|
|
36
|
+
@Output() onBlur = new EventEmitter<FocusEvent>();
|
|
37
|
+
|
|
38
|
+
faEyeSlash = faEyeSlash;
|
|
39
|
+
showPassword: boolean = false;
|
|
40
|
+
showError: boolean = false;
|
|
41
|
+
|
|
42
|
+
constructor(private inputService: InputService) {
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
ngOnInit() {
|
|
47
|
+
if (this.control) {
|
|
48
|
+
this.control.addValidators(this.validators);
|
|
49
|
+
this.control.valueChanges.subscribe((value) => {
|
|
50
|
+
this.valueChange.emit(value);
|
|
51
|
+
this.inputService.updateInputState(this.control!, this.id);
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
this.control = new FormControl(this.value, this.validators);
|
|
55
|
+
this.control.valueChanges.subscribe((value) => {
|
|
56
|
+
this.valueChange.emit(value);
|
|
57
|
+
this.inputService.updateInputState(this.control!, this.id);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
63
|
+
if (this.control) {
|
|
64
|
+
this.control.addValidators(this.validators);
|
|
65
|
+
this.control.valueChanges.subscribe((value) => {
|
|
66
|
+
this.valueChange.emit(value);
|
|
67
|
+
this.inputService.updateInputState(this.control!, this.id);
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
this.control = new FormControl(this.value, this.validators);
|
|
71
|
+
this.control.valueChanges.subscribe((value) => {
|
|
72
|
+
this.valueChange.emit(value);
|
|
73
|
+
this.inputService.updateInputState(this.control!, this.id);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
getErrorMessage(): string | null {
|
|
81
|
+
if (this.control && this.control.errors) {
|
|
82
|
+
const errorKeys = Object.keys(this.control.errors);
|
|
83
|
+
if (errorKeys.length > 0) {
|
|
84
|
+
const firstErrorKey = errorKeys[0];
|
|
85
|
+
return (this.control.errors as ValidationErrors)[firstErrorKey];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
toggleErrorDisplay() {
|
|
92
|
+
this.showError = !this.showError;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
hasError(): boolean {
|
|
96
|
+
return !!this.control && this.control.invalid && (this.control.dirty || this.control.touched);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
handleTogglePassword(): void {
|
|
100
|
+
this.showPassword = !this.showPassword;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
handleChange(event: Event) {
|
|
104
|
+
const e = event.target as HTMLInputElement
|
|
105
|
+
this.valueChange.emit(e.value);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
handleKeyDown(event: KeyboardEvent): void {
|
|
109
|
+
const allowRegex = /^[a-zA-Z!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/
|
|
110
|
+
|
|
111
|
+
if (
|
|
112
|
+
this.type === 'number' && !(
|
|
113
|
+
['Backspace', 'Shift', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)
|
|
114
|
+
) && !(event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
115
|
+
) {
|
|
116
|
+
event.key.match(allowRegex) ? event.preventDefault() : this.onKeyDown.emit(event);
|
|
117
|
+
} else {
|
|
118
|
+
this.onKeyDown.emit(event);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
handlePaste(event: ClipboardEvent): void {
|
|
123
|
+
this.onPaste.emit(event);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
handleFocus(event: FocusEvent): void {
|
|
127
|
+
this.onFocus.emit(event);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
handleBlur(event: FocusEvent): void {
|
|
131
|
+
this.onBlur.emit(event);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<div class="modal-wrapper">
|
|
2
|
+
|
|
3
|
+
<div class="container" (click)="$event.stopPropagation()">
|
|
4
|
+
|
|
5
|
+
<div class="content">
|
|
6
|
+
|
|
7
|
+
@if (icon != undefined) {
|
|
8
|
+
<fa-icon [icon]="icon" class="icon" [style.color]="theme.default"
|
|
9
|
+
/>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
<span class="subtitle align-center">{{ title }}</span>
|
|
13
|
+
|
|
14
|
+
<div class="text align-center" [innerHTML]="content">
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@if (type !== 'question') {
|
|
19
|
+
<rdnd-button
|
|
20
|
+
[id]="'btn-modal'"
|
|
21
|
+
[type]="'button'"
|
|
22
|
+
(callback)="closeModal(true)"
|
|
23
|
+
[text]="'Aceptar'"
|
|
24
|
+
[theme]="theme"
|
|
25
|
+
[size]="'full'"
|
|
26
|
+
/>
|
|
27
|
+
} @else {
|
|
28
|
+
<rdnd-button
|
|
29
|
+
[id]="'btn-modal-accept'"
|
|
30
|
+
[type]="'button'"
|
|
31
|
+
(callback)="closeModal(true)"
|
|
32
|
+
[text]="confirmText"
|
|
33
|
+
[theme]="theme"
|
|
34
|
+
[size]="'full'"
|
|
35
|
+
/>
|
|
36
|
+
<rdnd-button
|
|
37
|
+
[id]="'btn-modal-cancel'"
|
|
38
|
+
[type]="'button'"
|
|
39
|
+
(callback)="closeModal(false)"
|
|
40
|
+
[text]="cancelText"
|
|
41
|
+
[theme]="themes.borderedMagenta"
|
|
42
|
+
[size]="'full'"
|
|
43
|
+
/>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@use "../../styles/z_indexes";
|
|
2
|
+
@use "../../styles/sizes";
|
|
3
|
+
@use "../../styles/fonts";
|
|
4
|
+
@use "../../styles/colors";
|
|
5
|
+
|
|
6
|
+
.modal-wrapper {
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
right: 0;
|
|
12
|
+
z-index: z_indexes.$z-index-modal;
|
|
13
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
14
|
+
backdrop-filter: blur(5px);
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
padding: 16px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.modal-wrapper .container {
|
|
22
|
+
width: 100%;
|
|
23
|
+
max-width: sizes.$screen-max-width-small;
|
|
24
|
+
background-color: white;
|
|
25
|
+
padding: 32px 16px;
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
position: relative;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.modal-wrapper .container .content {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: 8px;
|
|
34
|
+
width: 100%;
|
|
35
|
+
max-width: 380px;
|
|
36
|
+
margin: auto;
|
|
37
|
+
|
|
38
|
+
.icon {
|
|
39
|
+
margin: auto;
|
|
40
|
+
font-size: 40px;
|
|
41
|
+
line-height: normal;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
p {
|
|
45
|
+
margin: 14px 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
import {IconDefinition} from '@fortawesome/free-solid-svg-icons';
|
|
4
|
+
import {themes} from "../../styles/themes";
|
|
5
|
+
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
|
|
6
|
+
import {RdndButton} from "../button/button.component";
|
|
7
|
+
import {RdndScreenTitle} from "../screen-title/screen-title.component";
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'rdnd-modal',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [
|
|
13
|
+
CommonModule,
|
|
14
|
+
FontAwesomeModule,
|
|
15
|
+
RdndButton,
|
|
16
|
+
RdndScreenTitle,
|
|
17
|
+
],
|
|
18
|
+
templateUrl: './modal.component.html',
|
|
19
|
+
styleUrl: './modal.component.scss'
|
|
20
|
+
})
|
|
21
|
+
export class RdndModal {
|
|
22
|
+
@Input() title: string = '';
|
|
23
|
+
@Input() type: 'success' | 'error' | 'question' | 'warning' | 'info' = 'success';
|
|
24
|
+
@Input() theme: any = themes.magenta;
|
|
25
|
+
@Input() confirmText: string = '';
|
|
26
|
+
@Input() cancelText: string = '';
|
|
27
|
+
@Output() close = new EventEmitter<boolean>();
|
|
28
|
+
|
|
29
|
+
protected readonly themes = themes;
|
|
30
|
+
|
|
31
|
+
icon?: IconDefinition;
|
|
32
|
+
content: string = '';
|
|
33
|
+
|
|
34
|
+
closeModal(result: boolean) {
|
|
35
|
+
this.close.emit(result);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
constructor() {
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.rdnd-active-indicator-wrapper {
|
|
2
|
+
width: 70px;
|
|
3
|
+
height: 24px;
|
|
4
|
+
padding: 1px 4px;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
place-content: center;
|
|
9
|
+
place-items: center;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
&.active {
|
|
12
|
+
background-color: #19C496;
|
|
13
|
+
color: #156a29;
|
|
14
|
+
}
|
|
15
|
+
&.inactive {
|
|
16
|
+
background-color: #f16683;
|
|
17
|
+
color: #77113a;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
span {
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {Component, Input} from '@angular/core';
|
|
2
|
+
import {NgClass} from "@angular/common";
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'rdnd-active-indicator',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [
|
|
8
|
+
NgClass
|
|
9
|
+
],
|
|
10
|
+
templateUrl: './rdnd-active-indicator.component.html',
|
|
11
|
+
styleUrl: './rdnd-active-indicator.component.css'
|
|
12
|
+
})
|
|
13
|
+
export class RdndActiveIndicator {
|
|
14
|
+
@Input() isActive: boolean = false;
|
|
15
|
+
@Input() activeDisplay?: string = "Activo";
|
|
16
|
+
@Input() inactiveDisplay?: string = "Inactivo";
|
|
17
|
+
|
|
18
|
+
}
|