@telcomdev/ui 0.0.1 → 0.0.3
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 +171 -1
- package/fesm2022/telcomdev-ui.mjs +467 -28
- package/fesm2022/telcomdev-ui.mjs.map +1 -1
- package/package.json +8 -2
- package/types/telcomdev-ui.d.ts +266 -6
package/README.md
CHANGED
|
@@ -1,11 +1,169 @@
|
|
|
1
1
|
# Telcomdev UI
|
|
2
2
|
|
|
3
|
+
## Iconos
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { TdIcon, TdIconoRegistry } from '@telcomdev/ui';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
imports: [TdIcon],
|
|
10
|
+
})
|
|
11
|
+
export class App {
|
|
12
|
+
constructor(registry: TdIconoRegistry) {
|
|
13
|
+
registry.registrar({
|
|
14
|
+
estrella: 'M12 2 15 9 22 9 17 14 19 22 12 17 5 22 7 14 2 9 9 9Z',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<td-icon nombre="security" tamano="24px" />
|
|
22
|
+
<td-icon nombre="estrella" titulo="Favorito" />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
El icono hereda el color CSS mediante `currentColor`. Si el nombre no existe, se muestra
|
|
26
|
+
`folder`.
|
|
27
|
+
|
|
28
|
+
## Data table
|
|
29
|
+
|
|
30
|
+
`TdDataTable` usa `@angular/cdk/scrolling` para virtualizar las filas. La aplicación
|
|
31
|
+
consumidora mantiene la responsabilidad de consultar, paginar y modificar datos.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import {
|
|
35
|
+
TdDataTable,
|
|
36
|
+
TdDataTableAccion,
|
|
37
|
+
TdDataTableAccionEvento,
|
|
38
|
+
TdDataTableBoton,
|
|
39
|
+
TdDataTableColumna,
|
|
40
|
+
} from '@telcomdev/ui';
|
|
41
|
+
|
|
42
|
+
@Component({
|
|
43
|
+
imports: [TdDataTable],
|
|
44
|
+
})
|
|
45
|
+
export class Establecimientos {
|
|
46
|
+
columnas: TdDataTableColumna<Establecimiento>[] = [
|
|
47
|
+
{ clave: 'nombre', encabezado: 'Nombre', ancho: '1fr' },
|
|
48
|
+
{ clave: 'codigoSunat', encabezado: 'Código Sunat', ancho: '8rem' },
|
|
49
|
+
{ clave: 'direccion', encabezado: 'Dirección', ancho: '1.5fr' },
|
|
50
|
+
{ clave: 'esPrincipal', encabezado: 'Principal', tipo: 'booleano' },
|
|
51
|
+
{ clave: 'activo', encabezado: 'Estado', tipo: 'estado' },
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
acciones: TdDataTableAccion<Establecimiento>[] = [
|
|
55
|
+
{ id: 'editar', etiqueta: 'Editar', icono: 'edit' },
|
|
56
|
+
{ id: 'eliminar', etiqueta: 'Eliminar', icono: 'delete', tono: 'peligro' },
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
botones: TdDataTableBoton[] = [
|
|
60
|
+
{ id: 'pdf', etiqueta: 'Exportar PDF', icono: 'pdf', tono: 'peligro' },
|
|
61
|
+
{ id: 'excel', etiqueta: 'Exportar Excel', icono: 'description', tono: 'exito' },
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
ejecutar(evento: TdDataTableAccionEvento<Establecimiento>) {
|
|
65
|
+
// evento.accion.id, evento.fila y evento.indice
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<td-data-table
|
|
72
|
+
campoId="establecimientoId"
|
|
73
|
+
textoAgregar="Agregar establecimiento"
|
|
74
|
+
[datos]="lista()"
|
|
75
|
+
[columnas]="columnas"
|
|
76
|
+
[acciones]="acciones"
|
|
77
|
+
[botones]="botones"
|
|
78
|
+
[total]="totalEstablecimientos()"
|
|
79
|
+
[cargando]="cargando()"
|
|
80
|
+
[puedeCargarMas]="paginaActual() < totalPaginas()"
|
|
81
|
+
(busquedaChange)="buscar($event)"
|
|
82
|
+
(agregar)="abrirModal(0)"
|
|
83
|
+
(accion)="ejecutar($event)"
|
|
84
|
+
(botonClick)="exportar($event)"
|
|
85
|
+
(cargarMas)="paginaSiguiente()"
|
|
86
|
+
>
|
|
87
|
+
<select tdDataTableFilters [(ngModel)]="estado">
|
|
88
|
+
<option value="">Todos los estados</option>
|
|
89
|
+
<option value="activo">Activos</option>
|
|
90
|
+
<option value="inactivo">Inactivos</option>
|
|
91
|
+
</select>
|
|
92
|
+
|
|
93
|
+
<input tdDataTableFilters type="date" [(ngModel)]="fecha" />
|
|
94
|
+
|
|
95
|
+
<button tdDataTableActions type="button">Acción personalizada</button>
|
|
96
|
+
</td-data-table>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Incluye búsqueda con debounce, scroll virtual, carga incremental, chips de estado,
|
|
100
|
+
acciones condicionales, tema oscuro, estado vacío y skeleton de carga. Los elementos
|
|
101
|
+
marcados con `tdDataTableFilters` se colocan junto al buscador. Los elementos
|
|
102
|
+
`tdDataTableActions` aparecen junto al contador y al botón Agregar.
|
|
103
|
+
|
|
104
|
+
## Header
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { TdHeader } from '@telcomdev/ui';
|
|
108
|
+
|
|
109
|
+
@Component({
|
|
110
|
+
imports: [TdHeader],
|
|
111
|
+
})
|
|
112
|
+
export class App {
|
|
113
|
+
sidebarAbierto = true;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<td-header
|
|
119
|
+
[menuAbierto]="sidebarAbierto"
|
|
120
|
+
[oscuro]="oscuro"
|
|
121
|
+
usuario="Andrea Torres"
|
|
122
|
+
cargo="Administradora"
|
|
123
|
+
[notificaciones]="notificaciones"
|
|
124
|
+
(menuToggle)="sidebarAbierto = !sidebarAbierto"
|
|
125
|
+
(notificacionSeleccionada)="abrirNotificacion($event)"
|
|
126
|
+
(verTodasNotificaciones)="verNotificaciones()"
|
|
127
|
+
(accionPerfil)="ejecutarAccionPerfil($event)"
|
|
128
|
+
>
|
|
129
|
+
<button tdHeaderActions type="button">Acción adicional</button>
|
|
130
|
+
</td-header>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
El header incluye dropdowns funcionales de notificaciones y perfil, avatar por iniciales,
|
|
134
|
+
modo responsive y tema oscuro. Las acciones `tdHeaderActions` aparecen a la derecha.
|
|
135
|
+
|
|
136
|
+
## Footer
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import { TdFooter } from '@telcomdev/ui';
|
|
140
|
+
|
|
141
|
+
@Component({
|
|
142
|
+
imports: [TdFooter],
|
|
143
|
+
})
|
|
144
|
+
export class App {}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<td-footer
|
|
149
|
+
empresa="TelcomDev"
|
|
150
|
+
texto="Todos los derechos reservados."
|
|
151
|
+
version="1.0.0"
|
|
152
|
+
[oscuro]="oscuro"
|
|
153
|
+
>
|
|
154
|
+
<a tdFooterLinks href="/privacidad">Privacidad</a>
|
|
155
|
+
<span tdFooterActions>Angular 21</span>
|
|
156
|
+
</td-footer>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
El footer calcula el año actual por defecto y admite el modo `compacto`.
|
|
160
|
+
|
|
3
161
|
## Sidebar
|
|
4
162
|
|
|
5
163
|
`TdSidebar` es standalone y no depende de Angular Material ni Tailwind.
|
|
6
164
|
|
|
7
165
|
```ts
|
|
8
|
-
import { MenuSidebar, TdSidebar } from 'telcomdev
|
|
166
|
+
import { MenuSidebar, TdSidebar } from '@telcomdev/ui';
|
|
9
167
|
|
|
10
168
|
@Component({
|
|
11
169
|
imports: [TdSidebar],
|
|
@@ -32,6 +190,7 @@ export class App {
|
|
|
32
190
|
subtitulo="Central Platform"
|
|
33
191
|
[menu]="menu"
|
|
34
192
|
[(abierto)]="abierto"
|
|
193
|
+
modoCerrado="oculto"
|
|
35
194
|
[oscuro]="oscuro"
|
|
36
195
|
[cargando]="false"
|
|
37
196
|
error=""
|
|
@@ -39,6 +198,17 @@ export class App {
|
|
|
39
198
|
/>
|
|
40
199
|
```
|
|
41
200
|
|
|
201
|
+
El botón para abrir o cerrar debe vivir en el header de la aplicación:
|
|
202
|
+
|
|
203
|
+
```html
|
|
204
|
+
<button type="button" (click)="abierto = !abierto">
|
|
205
|
+
<td-icon [nombre]="abierto ? 'close' : 'menu'" />
|
|
206
|
+
</button>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`modoCerrado` acepta `compacto` para conservar una barra de iconos u `oculto` para cerrar
|
|
210
|
+
completamente el sidebar.
|
|
211
|
+
|
|
42
212
|
La aplicación consumidora obtiene el menú desde su propia API. El componente ordena cada
|
|
43
213
|
nivel por `orden`, usa `folder` cuando no recibe icono y renderiza los submenús
|
|
44
214
|
recursivamente.
|