@dev-tcloud/tcloud-ui 6.15.0 → 6.18.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/docs/tcloud-ui-accordion.md +345 -0
- package/docs/tcloud-ui-actions.md +88 -0
- package/docs/tcloud-ui-alert-banner.md +104 -0
- package/docs/tcloud-ui-array-to-text.md +361 -0
- package/docs/tcloud-ui-breadcrumb.md +103 -0
- package/docs/tcloud-ui-bytes.md +109 -0
- package/docs/tcloud-ui-calendar.md +387 -0
- package/docs/tcloud-ui-card-accordion.md +266 -0
- package/docs/tcloud-ui-card-title.md +47 -0
- package/docs/tcloud-ui-card.md +40 -0
- package/docs/tcloud-ui-choice-issues.md +59 -0
- package/docs/tcloud-ui-cnpj.md +102 -0
- package/docs/tcloud-ui-container.md +171 -0
- package/docs/tcloud-ui-cpf.md +102 -0
- package/docs/tcloud-ui-currency.md +271 -0
- package/docs/tcloud-ui-data-list.md +91 -0
- package/docs/tcloud-ui-datebr.md +139 -0
- package/docs/tcloud-ui-datepicker-time.md +191 -0
- package/docs/tcloud-ui-datepicker.md +186 -0
- package/docs/tcloud-ui-dropdown-multi.md +444 -0
- package/docs/tcloud-ui-dropdown.md +369 -0
- package/docs/tcloud-ui-el-copy.md +113 -0
- package/docs/tcloud-ui-empty-content.md +412 -0
- package/docs/tcloud-ui-faq.md +496 -0
- package/docs/tcloud-ui-filter-bar.md +86 -0
- package/docs/tcloud-ui-filters.md +337 -0
- package/docs/tcloud-ui-hover-parent.md +467 -0
- package/docs/tcloud-ui-icon-button.md +104 -0
- package/docs/tcloud-ui-input-container.md +520 -0
- package/docs/tcloud-ui-input-password.md +258 -0
- package/docs/tcloud-ui-input-search.md +314 -0
- package/docs/tcloud-ui-label-token.md +286 -0
- package/docs/tcloud-ui-legend.md +72 -0
- package/docs/tcloud-ui-line-step-circle.md +98 -0
- package/docs/tcloud-ui-line-step-title.md +194 -0
- package/docs/tcloud-ui-linha-logo.md +550 -0
- package/docs/tcloud-ui-loading.md +88 -0
- package/docs/tcloud-ui-message.md +539 -0
- package/docs/tcloud-ui-modal.md +196 -0
- package/docs/tcloud-ui-monthname.md +123 -0
- package/docs/tcloud-ui-multi-input.md +290 -0
- package/docs/tcloud-ui-multi-select.md +311 -0
- package/docs/tcloud-ui-multiples-values.md +157 -0
- package/docs/tcloud-ui-not-found.md +88 -0
- package/docs/tcloud-ui-number-step.md +134 -0
- package/docs/tcloud-ui-pagination.md +579 -0
- package/docs/tcloud-ui-progress-bar.md +65 -0
- package/docs/tcloud-ui-radio.md +83 -0
- package/docs/tcloud-ui-reorder-items.md +418 -0
- package/docs/tcloud-ui-respective.md +167 -0
- package/docs/tcloud-ui-scroll-box.md +109 -0
- package/docs/tcloud-ui-search-bar.md +88 -0
- package/docs/tcloud-ui-search-in-object.md +143 -0
- package/docs/tcloud-ui-search-input.md +74 -0
- package/docs/tcloud-ui-skeleton-loading.md +394 -0
- package/docs/tcloud-ui-slide-toggle.md +210 -0
- package/docs/tcloud-ui-statusinfo.md +138 -0
- package/docs/tcloud-ui-tab-group.md +376 -0
- package/docs/tcloud-ui-tab-menu.md +109 -0
- package/docs/tcloud-ui-table.md +96 -0
- package/docs/tcloud-ui-tag.md +379 -0
- package/docs/tcloud-ui-tc-badge.md +168 -0
- package/docs/tcloud-ui-tc-btn.md +189 -0
- package/docs/tcloud-ui-tc-colors.md +204 -0
- package/docs/tcloud-ui-tc-form-control.md +200 -0
- package/docs/tcloud-ui-tc-text.md +139 -0
- package/docs/tcloud-ui-tc-title.md +118 -0
- package/docs/tcloud-ui-tcloud-form.md +55 -0
- package/docs/tcloud-ui-toast.md +83 -0
- package/docs/tcloud-ui-tooltip.md +88 -0
- package/docs/tcloud-ui-topology.md +232 -0
- package/docs/tcloud-ui-upload-area.md +195 -0
- package/docs/tcloud-ui-welcome.md +112 -0
- package/docs/tcloud-ui-wizard-steps.md +103 -0
- package/js/tcloud-ui-app.js +11 -0
- package/package.json +1 -1
- package/scss/tcloud-revitalizacao/components/_tcloud-ui-table.scss +95 -0
- package/scss/tcloud-revitalizacao/tc-rev-styles.scss +1 -1
- package/scss/tcloud-revitalizacao/components/_tc-rev-table.scss +0 -57
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Label Token
|
|
2
|
+
|
|
3
|
+
## Características
|
|
4
|
+
- Componente standalone que exibe valores de token/chave com visualização alternada.
|
|
5
|
+
- Modo mascarado padrão: exibe `#*#*#*#*#*#*#*#*#` ao invés do valor real.
|
|
6
|
+
- Botão toggle para visualizar/ocultar o valor real.
|
|
7
|
+
- Suporte a cópia automática para clipboard com feedback visual.
|
|
8
|
+
- Ícone de checkmark por 3 segundos após copiar.
|
|
9
|
+
- Emite evento ao copiar com o valor copiado.
|
|
10
|
+
- Ideal para exibição de tokens, senhas, chaves de API, etc.
|
|
11
|
+
|
|
12
|
+
## Instalação
|
|
13
|
+
```ts
|
|
14
|
+
import { TCloudUiLabelTokenComponent } from 'projects/tcloud-ui/src/public-api';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'app-example',
|
|
18
|
+
standalone: true,
|
|
19
|
+
imports: [TCloudUiLabelTokenComponent],
|
|
20
|
+
template: `<tcloud-ui-label-token [value]="token" [copy]="true"></tcloud-ui-label-token>`
|
|
21
|
+
})
|
|
22
|
+
export class ExampleComponent {
|
|
23
|
+
token: string = 'seu_token_aqui';
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Propriedades (API)
|
|
28
|
+
### Inputs
|
|
29
|
+
| Nome | Tipo | Descrição | Valor Default |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
| value | any | Valor a ser exibido/mascarado. | '' |
|
|
32
|
+
| copy | boolean | Se true, exibe botão para copiar o valor para clipboard. | false |
|
|
33
|
+
|
|
34
|
+
### Outputs
|
|
35
|
+
| Nome | Tipo de Evento | Descrição |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| onClick | EventEmitter<any> | Emite quando o texto é copiado. Retorna o valor copiado. |
|
|
38
|
+
|
|
39
|
+
## Exemplos de Uso
|
|
40
|
+
### Uso Básico - Apenas Visualizar/Ocultar
|
|
41
|
+
```html
|
|
42
|
+
<tcloud-ui-label-token [value]="token"></tcloud-ui-label-token>
|
|
43
|
+
|
|
44
|
+
<p>Token: {{ token }}</p>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Componente:
|
|
48
|
+
```ts
|
|
49
|
+
export class ExampleComponent {
|
|
50
|
+
token: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Com Funcionamento de Cópia
|
|
55
|
+
```html
|
|
56
|
+
<tcloud-ui-label-token
|
|
57
|
+
[value]="apiKey"
|
|
58
|
+
[copy]="true"
|
|
59
|
+
(onClick)="onTokenCopied($event)">
|
|
60
|
+
</tcloud-ui-label-token>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Componente:
|
|
64
|
+
```ts
|
|
65
|
+
export class ExampleComponent {
|
|
66
|
+
apiKey: string = 'sk_live_51234567890abcdefgh';
|
|
67
|
+
|
|
68
|
+
onTokenCopied(value: string) {
|
|
69
|
+
console.log('Chave de API copiada:', value);
|
|
70
|
+
// Mostrar notificação de sucesso
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Para Exibição de Token de Segurança
|
|
76
|
+
```html
|
|
77
|
+
<div class="security-token">
|
|
78
|
+
<label>Token de Segurança:</label>
|
|
79
|
+
<tcloud-ui-label-token
|
|
80
|
+
[value]="securityToken"
|
|
81
|
+
[copy]="true">
|
|
82
|
+
</tcloud-ui-label-token>
|
|
83
|
+
</div>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Componente:
|
|
87
|
+
```ts
|
|
88
|
+
export class SecurityComponent {
|
|
89
|
+
securityToken: string = 'SEC_2024_xyz789abc123';
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Uso Avançado
|
|
94
|
+
### Com Múltiplos Tokens
|
|
95
|
+
```ts
|
|
96
|
+
export class TokenManagementComponent {
|
|
97
|
+
tokens = [
|
|
98
|
+
{ name: 'API Key', value: 'api_key_12345' },
|
|
99
|
+
{ name: 'Refresh Token', value: 'refresh_token_67890' },
|
|
100
|
+
{ name: 'Access Token', value: 'access_token_abcde' }
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
copiedToken: string | null = null;
|
|
104
|
+
|
|
105
|
+
onTokenCopied(token: string) {
|
|
106
|
+
this.copiedToken = token;
|
|
107
|
+
// Feedback visual
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
this.copiedToken = null;
|
|
110
|
+
}, 3000);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```html
|
|
116
|
+
<div class="token-list">
|
|
117
|
+
<div *ngFor="let item of tokens" class="token-item">
|
|
118
|
+
<label>{{ item.name }}:</label>
|
|
119
|
+
<tcloud-ui-label-token
|
|
120
|
+
[value]="item.value"
|
|
121
|
+
[copy]="true"
|
|
122
|
+
(onClick)="onTokenCopied($event)">
|
|
123
|
+
</tcloud-ui-label-token>
|
|
124
|
+
<span *ngIf="copiedToken === item.value" class="copy-feedback">
|
|
125
|
+
✓ Copiado
|
|
126
|
+
</span>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Em Formulário de Credenciais
|
|
132
|
+
```ts
|
|
133
|
+
export class CredentialsComponent {
|
|
134
|
+
credentials = {
|
|
135
|
+
username: 'admin@example.com',
|
|
136
|
+
password: 'P@ssw0rd123!',
|
|
137
|
+
apiToken: 'token_abc123xyz789'
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
showDetails: boolean = false;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```html
|
|
145
|
+
<form *ngIf="showDetails">
|
|
146
|
+
<div>
|
|
147
|
+
<label>Usuário:</label>
|
|
148
|
+
<tcloud-ui-label-token
|
|
149
|
+
[value]="credentials.username"
|
|
150
|
+
[copy]="true">
|
|
151
|
+
</tcloud-ui-label-token>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<div>
|
|
155
|
+
<label>Senha:</label>
|
|
156
|
+
<tcloud-ui-label-token
|
|
157
|
+
[value]="credentials.password"
|
|
158
|
+
[copy]="true">
|
|
159
|
+
</tcloud-ui-label-token>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div>
|
|
163
|
+
<label>Token de API:</label>
|
|
164
|
+
<tcloud-ui-label-token
|
|
165
|
+
[value]="credentials.apiToken"
|
|
166
|
+
[copy]="true">
|
|
167
|
+
</tcloud-ui-label-token>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<button (click)="showDetails = false">Fechar</button>
|
|
171
|
+
</form>
|
|
172
|
+
|
|
173
|
+
<button *ngIf="!showDetails" (click)="showDetails = true">
|
|
174
|
+
Mostrar Credenciais
|
|
175
|
+
</button>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Com Validação de Cópia
|
|
179
|
+
```ts
|
|
180
|
+
export class TokenWithValidationComponent {
|
|
181
|
+
apiKey: string = 'sk_live_abcdef123456789';
|
|
182
|
+
copyStatus: 'idle' | 'success' | 'error' = 'idle';
|
|
183
|
+
|
|
184
|
+
onTokenCopied(value: string) {
|
|
185
|
+
try {
|
|
186
|
+
// Validação adicional se necessário
|
|
187
|
+
if (value && value.length > 0) {
|
|
188
|
+
this.copyStatus = 'success';
|
|
189
|
+
console.log('Token copiado com sucesso:', value);
|
|
190
|
+
} else {
|
|
191
|
+
this.copyStatus = 'error';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
setTimeout(() => {
|
|
195
|
+
this.copyStatus = 'idle';
|
|
196
|
+
}, 3000);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
this.copyStatus = 'error';
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```html
|
|
205
|
+
<div class="token-wrapper">
|
|
206
|
+
<tcloud-ui-label-token
|
|
207
|
+
[value]="apiKey"
|
|
208
|
+
[copy]="true"
|
|
209
|
+
(onClick)="onTokenCopied($event)">
|
|
210
|
+
</tcloud-ui-label-token>
|
|
211
|
+
|
|
212
|
+
<div [ngClass]="'status-' + copyStatus">
|
|
213
|
+
<span *ngIf="copyStatus === 'success'">✓ Copiado!</span>
|
|
214
|
+
<span *ngIf="copyStatus === 'error'">✗ Erro ao copiar</span>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Em Listagem com Ações
|
|
220
|
+
```ts
|
|
221
|
+
export class TokenListComponent {
|
|
222
|
+
savedTokens = [
|
|
223
|
+
{ id: 1, name: 'Production API', token: 'prod_key_xyz', createdAt: new Date() },
|
|
224
|
+
{ id: 2, name: 'Development API', token: 'dev_key_abc', createdAt: new Date() },
|
|
225
|
+
{ id: 3, name: 'Testing Token', token: 'test_key_123', createdAt: new Date() }
|
|
226
|
+
];
|
|
227
|
+
|
|
228
|
+
deleteToken(id: number) {
|
|
229
|
+
this.savedTokens = this.savedTokens.filter(t => t.id !== id);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
regenerateToken(id: number) {
|
|
233
|
+
const token = this.savedTokens.find(t => t.id === id);
|
|
234
|
+
if (token) {
|
|
235
|
+
token.token = this.generateNewToken();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private generateNewToken(): string {
|
|
240
|
+
return 'token_' + Math.random().toString(36).substring(2, 15);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
```html
|
|
246
|
+
<table class="token-table">
|
|
247
|
+
<thead>
|
|
248
|
+
<tr>
|
|
249
|
+
<th>Nome</th>
|
|
250
|
+
<th>Token</th>
|
|
251
|
+
<th>Criado em</th>
|
|
252
|
+
<th>Ações</th>
|
|
253
|
+
</tr>
|
|
254
|
+
</thead>
|
|
255
|
+
<tbody>
|
|
256
|
+
<tr *ngFor="let item of savedTokens">
|
|
257
|
+
<td>{{ item.name }}</td>
|
|
258
|
+
<td>
|
|
259
|
+
<tcloud-ui-label-token
|
|
260
|
+
[value]="item.token"
|
|
261
|
+
[copy]="true">
|
|
262
|
+
</tcloud-ui-label-token>
|
|
263
|
+
</td>
|
|
264
|
+
<td>{{ item.createdAt | date: 'dd/MM/yyyy HH:mm' }}</td>
|
|
265
|
+
<td>
|
|
266
|
+
<button (click)="regenerateToken(item.id)">Regenerar</button>
|
|
267
|
+
<button (click)="deleteToken(item.id)">Deletar</button>
|
|
268
|
+
</td>
|
|
269
|
+
</tr>
|
|
270
|
+
</tbody>
|
|
271
|
+
</table>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Comportamento
|
|
275
|
+
- **Estado Padrão**: O token é exibido mascarado como `#*#*#*#*#*#*#*#*#`
|
|
276
|
+
- **Ao Clicar no Olho**: Alterna entre visualizar o valor real ou mascarado
|
|
277
|
+
- **Ao Copiar**: O valor real é copiado para clipboard, e o ícone muda para checkmark por 3 segundos
|
|
278
|
+
- **Feedback Visual**: O checkmark permanece visível durante 3 segundos antes de voltar ao ícone de cópia
|
|
279
|
+
|
|
280
|
+
## Casos de Uso
|
|
281
|
+
- Exibição segura de tokens JWT
|
|
282
|
+
- Gerenciamento de chaves de API
|
|
283
|
+
- Mostra de senhas e credenciais
|
|
284
|
+
- Tokens de verificação por email
|
|
285
|
+
- Códigos de autenticação
|
|
286
|
+
- Chaves de criptografia
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Legend
|
|
2
|
+
|
|
3
|
+
## Características
|
|
4
|
+
|
|
5
|
+
O `TCloudUiLegendComponent` é um componente Angular standalone que exibe uma legenda visual de status com dois indicadores (sucesso e erro). Utiliza dots coloridos para representar estados distintos.
|
|
6
|
+
|
|
7
|
+
Funcionalidades principais:
|
|
8
|
+
- Exibição de legenda com dois status: sucesso (verde) e erro (vermelho).
|
|
9
|
+
- Labels configuráveis via Angular Signals (`input.required`).
|
|
10
|
+
- Estratégia de detecção de mudanças `OnPush` para melhor performance.
|
|
11
|
+
- Acessibilidade com `role="group"` e `aria-label`.
|
|
12
|
+
|
|
13
|
+
## Instalação
|
|
14
|
+
|
|
15
|
+
Importe o `TCloudUiLegendComponent` no componente standalone:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { TCloudUiLegendComponent } from 'tcloud-ui';
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'app-exemplo',
|
|
22
|
+
standalone: true,
|
|
23
|
+
imports: [TCloudUiLegendComponent],
|
|
24
|
+
template: '...'
|
|
25
|
+
})
|
|
26
|
+
export class ExemploComponent {}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Propriedades (API)
|
|
30
|
+
|
|
31
|
+
### Inputs
|
|
32
|
+
|
|
33
|
+
| Nome | Tipo | Descrição | Valor Default |
|
|
34
|
+
|-------------|----------|--------------------------------------------------|---------------|
|
|
35
|
+
| sucessLabel | `string` | Label exibido ao lado do dot de sucesso (verde). | **Obrigatório** |
|
|
36
|
+
| errorLabel | `string` | Label exibido ao lado do dot de erro (vermelho). | **Obrigatório** |
|
|
37
|
+
|
|
38
|
+
> Ambos os inputs utilizam `input.required<string>()` (Angular Signals), portanto são obrigatórios.
|
|
39
|
+
|
|
40
|
+
## Exemplos de Uso
|
|
41
|
+
|
|
42
|
+
### Uso Básico
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<tcloud-ui-legend sucessLabel="Ativo" errorLabel="Inativo"></tcloud-ui-legend>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Uso com Labels Customizados
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<tcloud-ui-legend sucessLabel="Aprovado" errorLabel="Rejeitado"></tcloud-ui-legend>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Uso Avançado — Binding Dinâmico
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
@Component({
|
|
58
|
+
selector: 'app-exemplo',
|
|
59
|
+
standalone: true,
|
|
60
|
+
imports: [TCloudUiLegendComponent],
|
|
61
|
+
template: `
|
|
62
|
+
<tcloud-ui-legend
|
|
63
|
+
[sucessLabel]="successText"
|
|
64
|
+
[errorLabel]="errorText">
|
|
65
|
+
</tcloud-ui-legend>
|
|
66
|
+
`
|
|
67
|
+
})
|
|
68
|
+
export class ExemploComponent {
|
|
69
|
+
successText = 'Com lock';
|
|
70
|
+
errorText = 'Sem lock';
|
|
71
|
+
}
|
|
72
|
+
```
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# TCloud UI Line Step Circle
|
|
2
|
+
|
|
3
|
+
Componente Angular standalone para exibir trilhas de passos em linha com estados de progresso, passo ativo e passos inativos.
|
|
4
|
+
|
|
5
|
+
## Características
|
|
6
|
+
|
|
7
|
+
- ✅ Suporte a `step` variável para definir a quantidade total de passos (padrão: 7)
|
|
8
|
+
- ✅ Recalcula a trilha sempre que `active`, `inactives` ou `complete` mudam
|
|
9
|
+
- ✅ Garante que `active` não ultrapasse o total de passos; força `complete` quando necessário
|
|
10
|
+
- ✅ Destaca o passo ativo e marca passos desabilitados via `inactives`
|
|
11
|
+
- ✅ Disponível no `TCloudUiModule` ou importável como componente standalone
|
|
12
|
+
|
|
13
|
+
## Instalação
|
|
14
|
+
|
|
15
|
+
O componente já está disponível no módulo agregador:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { TCloudUiModule } from 'projects/tcloud-ui/src/public-api';
|
|
19
|
+
|
|
20
|
+
@NgModule({
|
|
21
|
+
imports: [TCloudUiModule]
|
|
22
|
+
})
|
|
23
|
+
export class MyModule { }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Ou importe apenas o componente standalone:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { TCloudUiLineStepCircleComponent } from 'projects/tcloud-ui/src/lib/_modules/tcloud-ui-line-step-circle/tcloud-ui-line-step-circle.component';
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
standalone: true,
|
|
33
|
+
imports: [TCloudUiLineStepCircleComponent]
|
|
34
|
+
})
|
|
35
|
+
export class MyStandaloneComponent {}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Uso Básico
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
export class ExampleComponent {
|
|
42
|
+
stepActive = 2;
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<tcloud-ui-line-step-circle
|
|
48
|
+
[step]="5"
|
|
49
|
+
[active]="stepActive">
|
|
50
|
+
</tcloud-ui-line-step-circle>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Uso Avançado
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
export class WizardComponent {
|
|
57
|
+
totalSteps = 6;
|
|
58
|
+
stepActive = 3;
|
|
59
|
+
disabledSteps = [2, 5];
|
|
60
|
+
isComplete = false;
|
|
61
|
+
|
|
62
|
+
next() {
|
|
63
|
+
if (this.stepActive < this.totalSteps) {
|
|
64
|
+
this.stepActive++;
|
|
65
|
+
} else {
|
|
66
|
+
this.isComplete = true; // marca trilha como concluída
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<tcloud-ui-line-step-circle
|
|
74
|
+
[step]="totalSteps"
|
|
75
|
+
[active]="stepActive"
|
|
76
|
+
[inactives]="disabledSteps"
|
|
77
|
+
[complete]="isComplete">
|
|
78
|
+
</tcloud-ui-line-step-circle>
|
|
79
|
+
|
|
80
|
+
<button (click)="next()">Avançar</button>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## API
|
|
84
|
+
|
|
85
|
+
### Componente: `tcloud-ui-line-step-circle`
|
|
86
|
+
|
|
87
|
+
#### Inputs
|
|
88
|
+
|
|
89
|
+
| Propriedade | Tipo | Padrão | Descrição | Obrigatório |
|
|
90
|
+
|-------------|------|--------|-----------|-------------|
|
|
91
|
+
| `step` | `number` | `7` | Quantidade total de passos renderizados. | ❌ |
|
|
92
|
+
| `active` | `number` | `0` | Índice (1-based) do último passo alcançado; clampa para `step` quando ultrapassa. | ❌ |
|
|
93
|
+
| `inactives` | `number[]` | `[]` | Lista 1-based de passos marcados como inativos/indisponíveis. | ❌ |
|
|
94
|
+
| `complete` | `boolean` | `false` | Indica conclusão da trilha; mantém todos os passos com estado de progresso. | ❌ |
|
|
95
|
+
|
|
96
|
+
#### Outputs
|
|
97
|
+
|
|
98
|
+
Nenhum output público disponível.
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Line Step Title
|
|
2
|
+
|
|
3
|
+
## Características
|
|
4
|
+
- Componente standalone que exibe uma barra de progresso com títulos de etapas.
|
|
5
|
+
- Progresso controlável de duas formas: pela propriedade `completed` de cada step ou pelo `@Input currentStep`.
|
|
6
|
+
- Animação de entrada na barra de progresso (1.5s ease).
|
|
7
|
+
- Contagem de etapas opcional com numeração automática.
|
|
8
|
+
- Cálculo automático de progresso baseado nos steps completados.
|
|
9
|
+
- Barra de progresso com largura proporcional ao número de etapas concluídas.
|
|
10
|
+
- Interface `LineStepTitleData` para tipagem dos dados.
|
|
11
|
+
|
|
12
|
+
## Instalação
|
|
13
|
+
```ts
|
|
14
|
+
import { TCloudUiLineStepTitleComponent, LineStepTitleData } from 'projects/tcloud-ui/src/public-api';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'app-example',
|
|
18
|
+
standalone: true,
|
|
19
|
+
imports: [TCloudUiLineStepTitleComponent],
|
|
20
|
+
template: `<tcloud-ui-line-step-title [steps]="steps"></tcloud-ui-line-step-title>`
|
|
21
|
+
})
|
|
22
|
+
export class ExampleComponent {
|
|
23
|
+
steps: LineStepTitleData[] = [
|
|
24
|
+
{ title: 'Etapa 1', completed: true },
|
|
25
|
+
{ title: 'Etapa 2', completed: false }
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Propriedades (API)
|
|
31
|
+
### Inputs
|
|
32
|
+
| Nome | Tipo | Descrição | Valor Default |
|
|
33
|
+
| --- | --- | --- | --- |
|
|
34
|
+
| steps | LineStepTitleData[] | Array de etapas a serem exibidas. | (obrigatório) |
|
|
35
|
+
| currentStep | number | Número do step atual (controle externo). Sobrescreve a propriedade `completed` dos steps. | undefined |
|
|
36
|
+
| showStepCounter | boolean | Se true, exibe numeração automática ao lado do título (ex: "1. Etapa"). | true |
|
|
37
|
+
|
|
38
|
+
### Outputs
|
|
39
|
+
| Nome | Tipo de Evento | Descrição |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| (não possui) | - | Componente não emite eventos. |
|
|
42
|
+
|
|
43
|
+
## Interface LineStepTitleData
|
|
44
|
+
```ts
|
|
45
|
+
export interface LineStepTitleData {
|
|
46
|
+
title: string; // Título da etapa
|
|
47
|
+
completed?: boolean; // Se true, etapa está concluída
|
|
48
|
+
id?: any; // Identificador opcional
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Exemplos de Uso
|
|
53
|
+
### Uso Básico - Controlado por `completed`
|
|
54
|
+
```ts
|
|
55
|
+
export class ExampleComponent {
|
|
56
|
+
steps: LineStepTitleData[] = [
|
|
57
|
+
{ title: 'Provisionamento', completed: true },
|
|
58
|
+
{ title: 'Clonar base produtiva', completed: false },
|
|
59
|
+
{ title: 'Migração de Dados', completed: false },
|
|
60
|
+
{ title: 'Atualizar aplicação', completed: false },
|
|
61
|
+
{ title: 'Concluir Migração', completed: false },
|
|
62
|
+
{ title: 'Quarentena', completed: false }
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<tcloud-ui-line-step-title [steps]="steps"></tcloud-ui-line-step-title>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Controlado por `currentStep`
|
|
72
|
+
```html
|
|
73
|
+
<!-- Marca as primeiras 4 etapas como completas -->
|
|
74
|
+
<tcloud-ui-line-step-title
|
|
75
|
+
[steps]="steps"
|
|
76
|
+
[currentStep]="4">
|
|
77
|
+
</tcloud-ui-line-step-title>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Sem Numeração
|
|
81
|
+
```html
|
|
82
|
+
<tcloud-ui-line-step-title
|
|
83
|
+
[steps]="steps"
|
|
84
|
+
[showStepCounter]="false">
|
|
85
|
+
</tcloud-ui-line-step-title>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Uso Avançado
|
|
89
|
+
### Avançar Steps Dinamicamente
|
|
90
|
+
```ts
|
|
91
|
+
export class StepComponent {
|
|
92
|
+
steps: LineStepTitleData[] = [
|
|
93
|
+
{ title: 'Provisionamento', completed: true },
|
|
94
|
+
{ title: 'Clonar base produtiva', completed: false },
|
|
95
|
+
{ title: 'Migração de Dados', completed: false },
|
|
96
|
+
{ title: 'Atualizar aplicação', completed: false },
|
|
97
|
+
{ title: 'Concluir Migração', completed: false },
|
|
98
|
+
{ title: 'Quarentena', completed: false }
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
nextStep(): void {
|
|
102
|
+
const lastCompletedStep = this.steps.filter(x => x.completed).length;
|
|
103
|
+
this.steps.forEach((x, index) => {
|
|
104
|
+
if (index === lastCompletedStep) {
|
|
105
|
+
x.completed = true;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
resetSteps(): void {
|
|
111
|
+
this.steps.forEach(x => x.completed = false);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<tcloud-ui-line-step-title [steps]="steps"></tcloud-ui-line-step-title>
|
|
118
|
+
|
|
119
|
+
<button (click)="nextStep()">Avançar</button>
|
|
120
|
+
<button (click)="resetSteps()">Resetar</button>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Com `currentStep` Dinâmico
|
|
124
|
+
```ts
|
|
125
|
+
export class DynamicStepComponent {
|
|
126
|
+
currentStep: number = 1;
|
|
127
|
+
|
|
128
|
+
steps: LineStepTitleData[] = [
|
|
129
|
+
{ title: 'Dados Pessoais' },
|
|
130
|
+
{ title: 'Endereço' },
|
|
131
|
+
{ title: 'Pagamento' },
|
|
132
|
+
{ title: 'Confirmação' }
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
advance(): void {
|
|
136
|
+
if (this.currentStep < this.steps.length) {
|
|
137
|
+
this.currentStep++;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
goBack(): void {
|
|
142
|
+
if (this.currentStep > 0) {
|
|
143
|
+
this.currentStep--;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```html
|
|
150
|
+
<tcloud-ui-line-step-title
|
|
151
|
+
[steps]="steps"
|
|
152
|
+
[currentStep]="currentStep">
|
|
153
|
+
</tcloud-ui-line-step-title>
|
|
154
|
+
|
|
155
|
+
<button (click)="goBack()" [disabled]="currentStep <= 0">Voltar</button>
|
|
156
|
+
<button (click)="advance()" [disabled]="currentStep >= steps.length">Avançar</button>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Com ID e Controle por Evento Externo
|
|
160
|
+
```ts
|
|
161
|
+
export class StepWithIdComponent {
|
|
162
|
+
steps: LineStepTitleData[] = [
|
|
163
|
+
{ id: 'provision', title: 'Provisionamento', completed: false },
|
|
164
|
+
{ id: 'clone', title: 'Clonar Base', completed: false },
|
|
165
|
+
{ id: 'migrate', title: 'Migração', completed: false },
|
|
166
|
+
{ id: 'finish', title: 'Finalizar', completed: false }
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
completeStep(id: string): void {
|
|
170
|
+
const step = this.steps.find(s => s.id === id);
|
|
171
|
+
if (step) {
|
|
172
|
+
step.completed = true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```html
|
|
179
|
+
<tcloud-ui-line-step-title [steps]="steps"></tcloud-ui-line-step-title>
|
|
180
|
+
|
|
181
|
+
<button (click)="completeStep('provision')">Completar Provisionamento</button>
|
|
182
|
+
<button (click)="completeStep('clone')">Completar Clone</button>
|
|
183
|
+
<button (click)="completeStep('migrate')">Completar Migração</button>
|
|
184
|
+
<button (click)="completeStep('finish')">Completar Finalização</button>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Modos de Controle
|
|
188
|
+
O componente suporta dois modos de controle do progresso:
|
|
189
|
+
|
|
190
|
+
1. **Via `completed`**: Cada step define individualmente se está concluído. O progresso é calculado como `completedSteps / totalSteps * 100%`.
|
|
191
|
+
|
|
192
|
+
2. **Via `currentStep`**: Um número externo define quantas etapas estão completas. Sobrescreve a propriedade `completed` dos steps. O progresso é calculado como `currentStep / totalSteps * 100%`.
|
|
193
|
+
|
|
194
|
+
Se ambos forem informados, `currentStep` tem prioridade.
|