@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,337 @@
|
|
|
1
|
+
# Filters
|
|
2
|
+
|
|
3
|
+
## Características
|
|
4
|
+
- Componente standalone para filtragem dinâmica de dados em listas e tabelas.
|
|
5
|
+
- Suporta múltiplos tipos de filtros: texto, número, select, booleano, data, datetime.
|
|
6
|
+
- Busca em propriedades aninhadas usando notação de ponto (ex: `product.name`).
|
|
7
|
+
- Suporte a arrays com notação `[]` (ex: `list[].description`, `subitem[].list[].description`).
|
|
8
|
+
- Filtros com operadores de condição: `equal`, `gte` (>=), `lte` (<=), `lt` (<), `gt` (>), `notEqual`.
|
|
9
|
+
- Suporte a filtros de intervalo de datas (`start`/`stop`) com opções rápidas (7 dias, 15 dias, etc).
|
|
10
|
+
- Normalização de busca: ignora maiúsculas, minúsculas e acentos (configurável).
|
|
11
|
+
- Submissão automática de filtros ao alterar valores ou via botão (configurável).
|
|
12
|
+
- Detecção automática de layout (classic ou modern).
|
|
13
|
+
- Eventos: `result`, `onFilter`, `onChange`, `onSubmit`.
|
|
14
|
+
|
|
15
|
+
## Instalação
|
|
16
|
+
```ts
|
|
17
|
+
import { TCloudUiFiltersComponent } from 'projects/tcloud-ui/src/public-api';
|
|
18
|
+
import { TCDataFilters, TCFiltersType, TCCondition } from 'projects/tcloud-ui/src/public-api';
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'app-example',
|
|
22
|
+
standalone: true,
|
|
23
|
+
imports: [TCloudUiFiltersComponent],
|
|
24
|
+
template: `
|
|
25
|
+
<tcloud-ui-filters
|
|
26
|
+
[data]="items"
|
|
27
|
+
[filters]="filterConfig"
|
|
28
|
+
(result)="filteredResult = $event">
|
|
29
|
+
</tcloud-ui-filters>
|
|
30
|
+
`
|
|
31
|
+
})
|
|
32
|
+
export class ExampleComponent {
|
|
33
|
+
items: any[] = [...];
|
|
34
|
+
filterConfig: TCDataFilters[] = [...];
|
|
35
|
+
filteredResult: any[] = [];
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Propriedades (API)
|
|
40
|
+
### Inputs
|
|
41
|
+
| Nome | Tipo | Descrição | Valor Default |
|
|
42
|
+
| --- | --- | --- | --- |
|
|
43
|
+
| data | any[] | Array de dados a serem filtrados. | undefined |
|
|
44
|
+
| filters | TCDataFilters[] | Array de configurações de filtros. | undefined |
|
|
45
|
+
| submitText | string | Texto do botão de submit. | 'Filtrar' |
|
|
46
|
+
| btnSubmitClass | string | Classe CSS do botão de submit. | 'tc-btn-primary' |
|
|
47
|
+
| useOnChangeSubmit | boolean | Se true, filtra automaticamente ao alterar qualquer input. | true |
|
|
48
|
+
| useButtonSubmit | boolean | Se true, exibe botão de submit e não filtra automaticamente. | false |
|
|
49
|
+
| useNormalizeCaseSensitive | boolean | Se true, ignora maiúsculas, minúsculas e acentos na busca. | true |
|
|
50
|
+
| useRangeDate | boolean | Se true, ativa suporte a filtros de intervalo de datas. | true |
|
|
51
|
+
| useFilterAccept | boolean | Se true, valida filtros de aceitação. | false |
|
|
52
|
+
| border | boolean | Se true, exibe borda no container de filtros. | true |
|
|
53
|
+
|
|
54
|
+
### Outputs
|
|
55
|
+
| Nome | Tipo de Evento | Descrição |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| result | EventEmitter<any[]> | Emite array de dados filtrados atualizado. |
|
|
58
|
+
| onFilter | EventEmitter<any> | Emite ao aplicar filtro. Retorna configuração de filtro. |
|
|
59
|
+
| onChange | EventEmitter<any> | Emite ao alterar valor de input. |
|
|
60
|
+
| onSubmit | EventEmitter<TCDataFilters[]> | Emite ao submeter filtros com configuração final. |
|
|
61
|
+
|
|
62
|
+
## Interface TCDataFilters
|
|
63
|
+
```ts
|
|
64
|
+
{
|
|
65
|
+
description: string; // Rótulo do filtro
|
|
66
|
+
searchIn: string; // Caminho da propriedade (dot notation, aceita [])
|
|
67
|
+
type?: TCFiltersType; // Tipo de filtro (default: text)
|
|
68
|
+
width?: string; // Largura (ex: '20%', '200px')
|
|
69
|
+
placeholder?: string; // Placeholder do input
|
|
70
|
+
notIn?: boolean; // Se true, inverte a busca (NOT IN)
|
|
71
|
+
condition?: TCCondition; // Operador: equal, gte, lte, lt, gt, notEqual
|
|
72
|
+
id?: string; // ID único (obrigatório para 'start'/'stop' em datas)
|
|
73
|
+
value?: any; // Valor selecionado
|
|
74
|
+
searchText?: any; // Texto de busca (internal)
|
|
75
|
+
accept?: boolean; // Flag de aceitação
|
|
76
|
+
data?: TCDataOptions[]; // Opções para select
|
|
77
|
+
defaultValuePeriodStartStop?: string; // Valor padrão para intervalo (7-days, 30-days, etc)
|
|
78
|
+
useOptionsDateTime?: boolean; // Se true, exibe atalhos de tempo
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Tipos de Filtro (TCFiltersType)
|
|
83
|
+
- **text**: Input de texto (busca parcial)
|
|
84
|
+
- **number**: Input numérico com operador de condição
|
|
85
|
+
- **select**: Select com opções predefinidas
|
|
86
|
+
- **boolean**: Checkbox (true/false)
|
|
87
|
+
- **hidden**: Campo oculto
|
|
88
|
+
- **date-local**: Data no formato local (DD/MM/YYYY)
|
|
89
|
+
- **datetime-local**: Data e hora (DD/MM/YYYY HH:mm)
|
|
90
|
+
- **date**: Usando input type="date" do browser
|
|
91
|
+
- **datetime**: Usando input type="datetime" do browser
|
|
92
|
+
|
|
93
|
+
## Operadores de Condição (TCCondition)
|
|
94
|
+
- **equal**: Igualdade (=)
|
|
95
|
+
- **gte**: Maior ou igual (>=)
|
|
96
|
+
- **lte**: Menor ou igual (<=)
|
|
97
|
+
- **gt**: Maior que (>)
|
|
98
|
+
- **lt**: Menor que (<)
|
|
99
|
+
- **notEqual**: Diferente (!=)
|
|
100
|
+
|
|
101
|
+
## Exemplos de Uso
|
|
102
|
+
### Uso Básico - Filtro de Texto Simples
|
|
103
|
+
```ts
|
|
104
|
+
export class ExampleComponent {
|
|
105
|
+
items = [
|
|
106
|
+
{ id: 1, name: 'João', city: 'São Paulo' },
|
|
107
|
+
{ id: 2, name: 'Maria', city: 'Rio de Janeiro' }
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
filters: TCDataFilters[] = [
|
|
111
|
+
{ description: 'Nome', searchIn: 'name', placeholder: 'Digite o nome', width: '50%' },
|
|
112
|
+
{ description: 'Cidade', searchIn: 'city', placeholder: 'Digite a cidade', width: '50%' }
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
result: any[] = [];
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```html
|
|
120
|
+
<tcloud-ui-filters
|
|
121
|
+
[data]="items"
|
|
122
|
+
[filters]="filters"
|
|
123
|
+
(result)="result = $event">
|
|
124
|
+
</tcloud-ui-filters>
|
|
125
|
+
|
|
126
|
+
<table>
|
|
127
|
+
<tr *ngFor="let item of result">
|
|
128
|
+
<td>{{ item.id }}</td>
|
|
129
|
+
<td>{{ item.name }}</td>
|
|
130
|
+
<td>{{ item.city }}</td>
|
|
131
|
+
</tr>
|
|
132
|
+
</table>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Com Filtro Select
|
|
136
|
+
```ts
|
|
137
|
+
filters: TCDataFilters[] = [
|
|
138
|
+
{
|
|
139
|
+
description: 'Status',
|
|
140
|
+
searchIn: 'status',
|
|
141
|
+
type: TCFiltersType.select,
|
|
142
|
+
width: '30%',
|
|
143
|
+
data: [
|
|
144
|
+
{ description: 'Ativo', value: 'active' },
|
|
145
|
+
{ description: 'Inativo', value: 'inactive' },
|
|
146
|
+
{ description: 'Pendente', value: 'pending' }
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
];
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Com Filtro Booleano
|
|
153
|
+
```ts
|
|
154
|
+
filters: TCDataFilters[] = [
|
|
155
|
+
{
|
|
156
|
+
description: 'Exibir apenas ativos',
|
|
157
|
+
searchIn: 'active',
|
|
158
|
+
type: TCFiltersType.boolean,
|
|
159
|
+
width: '20%'
|
|
160
|
+
}
|
|
161
|
+
];
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Com Filtro Numérico e Condições
|
|
165
|
+
```ts
|
|
166
|
+
filters: TCDataFilters[] = [
|
|
167
|
+
{
|
|
168
|
+
description: 'Valor maior ou igual',
|
|
169
|
+
searchIn: 'price',
|
|
170
|
+
type: TCFiltersType.number,
|
|
171
|
+
condition: TCCondition.gte,
|
|
172
|
+
placeholder: 'Mínimo',
|
|
173
|
+
width: '20%'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
description: 'Valor menor ou igual',
|
|
177
|
+
searchIn: 'price',
|
|
178
|
+
type: TCFiltersType.number,
|
|
179
|
+
condition: TCCondition.lte,
|
|
180
|
+
placeholder: 'Máximo',
|
|
181
|
+
width: '20%'
|
|
182
|
+
}
|
|
183
|
+
];
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Com Busca em Propriedades Aninhadas
|
|
187
|
+
```ts
|
|
188
|
+
items = [
|
|
189
|
+
{
|
|
190
|
+
id: 1,
|
|
191
|
+
name: 'Produto A',
|
|
192
|
+
product: { category: 'Eletrônicos', brand: 'LG' }
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: 2,
|
|
196
|
+
name: 'Produto B',
|
|
197
|
+
product: { category: 'Móveis', brand: 'Ikea' }
|
|
198
|
+
}
|
|
199
|
+
];
|
|
200
|
+
|
|
201
|
+
filters: TCDataFilters[] = [
|
|
202
|
+
{ description: 'Categoria', searchIn: 'product.category', width: '30%' },
|
|
203
|
+
{ description: 'Marca', searchIn: 'product.brand', width: '30%' }
|
|
204
|
+
];
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Uso Avançado
|
|
208
|
+
### Com Busca em Arrays Aninhados
|
|
209
|
+
```ts
|
|
210
|
+
items = [
|
|
211
|
+
{
|
|
212
|
+
id: 1,
|
|
213
|
+
name: 'Item 1',
|
|
214
|
+
tags: ['importante', 'urgente'],
|
|
215
|
+
details: [
|
|
216
|
+
{ type: 'email', value: 'test@example.com' },
|
|
217
|
+
{ type: 'phone', value: '123456' }
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
];
|
|
221
|
+
|
|
222
|
+
filters: TCDataFilters[] = [
|
|
223
|
+
{ description: 'Tags', searchIn: 'tags[]', width: '30%' },
|
|
224
|
+
{ description: 'Detalhes', searchIn: 'details[].value', width: '30%' }
|
|
225
|
+
];
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Com Filtro de Intervalo de Datas
|
|
229
|
+
```ts
|
|
230
|
+
filters: TCDataFilters[] = [
|
|
231
|
+
{
|
|
232
|
+
description: 'Data Inicial',
|
|
233
|
+
id: 'start',
|
|
234
|
+
searchIn: 'createdDate',
|
|
235
|
+
type: TCFiltersType.browserdate,
|
|
236
|
+
condition: TCCondition.gte,
|
|
237
|
+
width: '25%',
|
|
238
|
+
useOptionsDateTime: true
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
description: 'Data Final',
|
|
242
|
+
id: 'stop',
|
|
243
|
+
searchIn: 'createdDate',
|
|
244
|
+
type: TCFiltersType.browserdatetime,
|
|
245
|
+
condition: TCCondition.lte,
|
|
246
|
+
width: '25%'
|
|
247
|
+
}
|
|
248
|
+
];
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
```html
|
|
252
|
+
<tcloud-ui-filters
|
|
253
|
+
[data]="items"
|
|
254
|
+
[filters]="filters"
|
|
255
|
+
[useRangeDate]="true"
|
|
256
|
+
(result)="result = $event">
|
|
257
|
+
</tcloud-ui-filters>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Submissão Manual com Botão
|
|
261
|
+
```ts
|
|
262
|
+
filters: TCDataFilters[] = [...];
|
|
263
|
+
|
|
264
|
+
// Desativa submit automático
|
|
265
|
+
useOnChangeSubmit = false;
|
|
266
|
+
useButtonSubmit = true;
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
```html
|
|
270
|
+
<tcloud-ui-filters
|
|
271
|
+
[data]="items"
|
|
272
|
+
[filters]="filters"
|
|
273
|
+
[useOnChangeSubmit]="false"
|
|
274
|
+
[useButtonSubmit]="true"
|
|
275
|
+
submitText="Buscar"
|
|
276
|
+
(result)="result = $event">
|
|
277
|
+
</tcloud-ui-filters>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Com Eventos
|
|
281
|
+
```html
|
|
282
|
+
<tcloud-ui-filters
|
|
283
|
+
[data]="items"
|
|
284
|
+
[filters]="filters"
|
|
285
|
+
(result)="result = $event"
|
|
286
|
+
(onFilter)="onFilterChange($event)"
|
|
287
|
+
(onChange)="onValueChange($event)"
|
|
288
|
+
(onSubmit)="onSubmitFilters($event)">
|
|
289
|
+
</tcloud-ui-filters>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Componente:
|
|
293
|
+
```ts
|
|
294
|
+
export class ExampleComponent {
|
|
295
|
+
onFilterChange(event: any) {
|
|
296
|
+
console.log('Filtro aplicado:', event);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
onValueChange(event: any) {
|
|
300
|
+
console.log('Valor alterado:', event);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
onSubmitFilters(filters: TCDataFilters[]) {
|
|
304
|
+
console.log('Filtros submetidos:', filters);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Filtro com Negação (NOT IN)
|
|
310
|
+
```ts
|
|
311
|
+
filters: TCDataFilters[] = [
|
|
312
|
+
{
|
|
313
|
+
description: 'Excluir Nome',
|
|
314
|
+
searchIn: 'name',
|
|
315
|
+
notIn: true, // Busca inversa
|
|
316
|
+
width: '30%'
|
|
317
|
+
}
|
|
318
|
+
];
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Sem Normalização de Busca
|
|
322
|
+
```html
|
|
323
|
+
<tcloud-ui-filters
|
|
324
|
+
[data]="items"
|
|
325
|
+
[filters]="filters"
|
|
326
|
+
[useNormalizeCaseSensitive]="false">
|
|
327
|
+
</tcloud-ui-filters>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Sem Borda
|
|
331
|
+
```html
|
|
332
|
+
<tcloud-ui-filters
|
|
333
|
+
[data]="items"
|
|
334
|
+
[filters]="filters"
|
|
335
|
+
[border]="false">
|
|
336
|
+
</tcloud-ui-filters>
|
|
337
|
+
```
|