@fylib/adapter-angular 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/dist/base/base-component.d.ts +18 -0
- package/dist/base/base-component.js +36 -0
- package/dist/base/interaction.utils.d.ts +7 -0
- package/dist/base/interaction.utils.js +34 -0
- package/dist/base/interaction.utils.test.d.ts +1 -0
- package/dist/base/interaction.utils.test.js +25 -0
- package/dist/components/accordion.component.d.ts +32 -0
- package/dist/components/accordion.component.js +337 -0
- package/dist/components/badge.component.d.ts +10 -0
- package/dist/components/badge.component.js +112 -0
- package/dist/components/button.component.d.ts +33 -0
- package/dist/components/button.component.js +272 -0
- package/dist/components/card.component.d.ts +29 -0
- package/dist/components/card.component.js +236 -0
- package/dist/components/chart.component.d.ts +39 -0
- package/dist/components/chart.component.js +307 -0
- package/dist/components/icon.component.d.ts +18 -0
- package/dist/components/icon.component.js +144 -0
- package/dist/components/input.component.d.ts +50 -0
- package/dist/components/input.component.js +383 -0
- package/dist/components/modal.component.d.ts +46 -0
- package/dist/components/modal.component.js +404 -0
- package/dist/components/nav-link.component.d.ts +11 -0
- package/dist/components/nav-link.component.js +121 -0
- package/dist/components/notification-menu.component.d.ts +68 -0
- package/dist/components/notification-menu.component.js +695 -0
- package/dist/components/select.component.d.ts +52 -0
- package/dist/components/select.component.js +395 -0
- package/dist/components/table.component.d.ts +55 -0
- package/dist/components/table.component.js +643 -0
- package/dist/components/text.component.d.ts +8 -0
- package/dist/components/text.component.js +58 -0
- package/dist/components/toast.component.d.ts +27 -0
- package/dist/components/toast.component.js +260 -0
- package/dist/directives/animation.directive.d.ts +5 -0
- package/dist/directives/animation.directive.js +34 -0
- package/dist/directives/theme-vars.directive.d.ts +7 -0
- package/dist/directives/theme-vars.directive.js +70 -0
- package/dist/directives/wallpaper.directive.d.ts +28 -0
- package/dist/directives/wallpaper.directive.js +195 -0
- package/dist/effects/confetti.plugin.d.ts +1 -0
- package/dist/effects/confetti.plugin.js +151 -0
- package/dist/effects/extra-effects.plugin.d.ts +3 -0
- package/dist/effects/extra-effects.plugin.js +288 -0
- package/dist/effects/hearts.plugin.d.ts +1 -0
- package/dist/effects/hearts.plugin.js +172 -0
- package/dist/effects/register-all.d.ts +1 -0
- package/dist/effects/register-all.js +16 -0
- package/dist/effects/ui-effects.plugin.d.ts +1 -0
- package/dist/effects/ui-effects.plugin.js +134 -0
- package/dist/icons/providers/fontawesome.provider.d.ts +3 -0
- package/dist/icons/providers/fontawesome.provider.js +25 -0
- package/dist/icons/providers/mdi.provider.d.ts +3 -0
- package/dist/icons/providers/mdi.provider.js +13 -0
- package/dist/icons/providers/phosphor.provider.d.ts +3 -0
- package/dist/icons/providers/phosphor.provider.js +17 -0
- package/dist/icons/registry.d.ts +22 -0
- package/dist/icons/registry.js +12 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +29 -0
- package/dist/layouts/layout.component.d.ts +24 -0
- package/dist/layouts/layout.component.js +255 -0
- package/dist/layouts/slot.component.d.ts +61 -0
- package/dist/layouts/slot.component.js +937 -0
- package/dist/providers.d.ts +12 -0
- package/dist/providers.js +18 -0
- package/dist/services/fylib.service.d.ts +31 -0
- package/dist/services/fylib.service.js +214 -0
- package/dist/services/notification.service.d.ts +27 -0
- package/dist/services/notification.service.js +118 -0
- package/dist/services/sse.service.d.ts +16 -0
- package/dist/services/sse.service.js +109 -0
- package/dist/services/webclient.service.d.ts +38 -0
- package/dist/services/webclient.service.js +144 -0
- package/package.json +43 -0
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Component, Input, Output, EventEmitter, ViewEncapsulation, inject, ContentChild, TemplateRef } from '@angular/core';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import { TableDefinition } from '@fylib/catalog';
|
|
13
|
+
import { FyLibService } from '../services/fylib.service';
|
|
14
|
+
import { BaseFyComponent } from '../base/base-component';
|
|
15
|
+
import { FyIconComponent } from './icon.component';
|
|
16
|
+
import { FyInputComponent } from './input.component';
|
|
17
|
+
import { FyButtonComponent } from './button.component';
|
|
18
|
+
let FyTableComponent = class FyTableComponent extends BaseFyComponent {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(inject(FyLibService), 'fy-table');
|
|
21
|
+
this.data = TableDefinition.defaultProps.data;
|
|
22
|
+
this.columns = TableDefinition.defaultProps.columns;
|
|
23
|
+
this.loading = false;
|
|
24
|
+
this.showHeader = TableDefinition.defaultProps.showHeader;
|
|
25
|
+
this.showFooter = TableDefinition.defaultProps.showFooter;
|
|
26
|
+
this.showPagination = TableDefinition.defaultProps.showPagination;
|
|
27
|
+
this.showSearch = TableDefinition.defaultProps.showSearch;
|
|
28
|
+
this.currentPage = TableDefinition.defaultProps.currentPage;
|
|
29
|
+
this.pageSize = TableDefinition.defaultProps.pageSize;
|
|
30
|
+
this.totalItems = TableDefinition.defaultProps.totalItems;
|
|
31
|
+
this.searchTargets = TableDefinition.defaultProps.searchTargets || [];
|
|
32
|
+
this.rowClickable = false;
|
|
33
|
+
this.variant = TableDefinition.defaultProps.variant;
|
|
34
|
+
this.stickyHeader = TableDefinition.defaultProps.stickyHeader;
|
|
35
|
+
this.scrollable = TableDefinition.defaultProps.scrollable;
|
|
36
|
+
this.activeAnimations = null;
|
|
37
|
+
this.activeEffects = null;
|
|
38
|
+
this.customStyles = null;
|
|
39
|
+
this.fySearch = new EventEmitter();
|
|
40
|
+
this.fySort = new EventEmitter();
|
|
41
|
+
this.fyPageChange = new EventEmitter();
|
|
42
|
+
this.fyRowClick = new EventEmitter();
|
|
43
|
+
this.sortKey = null;
|
|
44
|
+
this.sortDirection = null;
|
|
45
|
+
this.searchTerm = '';
|
|
46
|
+
}
|
|
47
|
+
get paginatedData() {
|
|
48
|
+
let list = this.data || [];
|
|
49
|
+
// Filter locally if searchTargets are provided
|
|
50
|
+
if (this.searchTerm && this.searchTargets && this.searchTargets.length > 0) {
|
|
51
|
+
const term = this.searchTerm.toLowerCase();
|
|
52
|
+
list = list.filter(item => this.searchTargets.some(target => String(item[target] || '').toLowerCase().includes(term)));
|
|
53
|
+
}
|
|
54
|
+
// Pagination logic
|
|
55
|
+
if (this.showPagination) {
|
|
56
|
+
const start = (this.currentPage - 1) * this.pageSize;
|
|
57
|
+
return list.slice(start, start + this.pageSize);
|
|
58
|
+
}
|
|
59
|
+
return list;
|
|
60
|
+
}
|
|
61
|
+
get filteredTotal() {
|
|
62
|
+
if (this.searchTerm && this.searchTargets && this.searchTargets.length > 0) {
|
|
63
|
+
const term = this.searchTerm.toLowerCase();
|
|
64
|
+
return (this.data || []).filter(item => this.searchTargets.some(target => String(item[target] || '').toLowerCase().includes(term))).length;
|
|
65
|
+
}
|
|
66
|
+
return (this.data || []).length;
|
|
67
|
+
}
|
|
68
|
+
ngOnInit() {
|
|
69
|
+
if (this.isAnimationsActive(this.activeAnimations)) {
|
|
70
|
+
const anim = this.resolveAnim('enter', undefined, TableDefinition.features?.animations?.enter);
|
|
71
|
+
if (anim)
|
|
72
|
+
this.fylib.playAnimation(anim);
|
|
73
|
+
this.triggerByEvent('fy-table.enter', undefined, this.activeEffects);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
get visibleColumns() {
|
|
77
|
+
return this.columns.filter(c => !c.hidden);
|
|
78
|
+
}
|
|
79
|
+
get totalColumns() {
|
|
80
|
+
let count = this.visibleColumns.length;
|
|
81
|
+
if (this.actions && this.actions.length > 0)
|
|
82
|
+
count++;
|
|
83
|
+
return count;
|
|
84
|
+
}
|
|
85
|
+
get totalPages() {
|
|
86
|
+
const total = this.showSearch ? this.filteredTotal : (this.totalItems || (this.data?.length || 0));
|
|
87
|
+
return Math.ceil(total / this.pageSize) || 1;
|
|
88
|
+
}
|
|
89
|
+
get startItem() {
|
|
90
|
+
return (this.currentPage - 1) * this.pageSize + 1;
|
|
91
|
+
}
|
|
92
|
+
get endItem() {
|
|
93
|
+
const total = this.showSearch ? this.filteredTotal : (this.totalItems || (this.data?.length || 0));
|
|
94
|
+
return Math.min(this.currentPage * this.pageSize, total);
|
|
95
|
+
}
|
|
96
|
+
get displayTotal() {
|
|
97
|
+
return this.showSearch ? this.filteredTotal : (this.totalItems || (this.data?.length || 0));
|
|
98
|
+
}
|
|
99
|
+
get animationClassSuffix() {
|
|
100
|
+
const anim = this.resolveAnim('enter', undefined, TableDefinition.features?.animations?.enter);
|
|
101
|
+
return this.composeAnimClasses(anim);
|
|
102
|
+
}
|
|
103
|
+
onSearch(value) {
|
|
104
|
+
this.searchTerm = value;
|
|
105
|
+
this.currentPage = 1; // Reset to first page on search
|
|
106
|
+
this.fySearch.emit(value);
|
|
107
|
+
}
|
|
108
|
+
onSort(col) {
|
|
109
|
+
if (!col.sortable)
|
|
110
|
+
return;
|
|
111
|
+
if (this.sortKey === col.key) {
|
|
112
|
+
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : (this.sortDirection === 'desc' ? null : 'asc');
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this.sortKey = col.key;
|
|
116
|
+
this.sortDirection = 'asc';
|
|
117
|
+
}
|
|
118
|
+
this.fySort.emit({ ...col, direction: this.sortDirection });
|
|
119
|
+
}
|
|
120
|
+
getSortIcon(col) {
|
|
121
|
+
if (this.sortKey !== col.key || !this.sortDirection)
|
|
122
|
+
return 'caret-up-down';
|
|
123
|
+
return this.sortDirection === 'asc' ? 'caret-up' : 'caret-down';
|
|
124
|
+
}
|
|
125
|
+
onPageChange(page) {
|
|
126
|
+
if (page < 1 || page > this.totalPages)
|
|
127
|
+
return;
|
|
128
|
+
this.currentPage = page;
|
|
129
|
+
this.fyPageChange.emit(page);
|
|
130
|
+
}
|
|
131
|
+
onRowClick(row) {
|
|
132
|
+
if (!this.rowClickable)
|
|
133
|
+
return;
|
|
134
|
+
if (this.isAnimationsActive(this.activeAnimations)) {
|
|
135
|
+
this.triggerByEvent('fy-table.rowClick', undefined, this.activeEffects);
|
|
136
|
+
}
|
|
137
|
+
this.fyRowClick.emit(row);
|
|
138
|
+
}
|
|
139
|
+
onActionClick(event, action, row) {
|
|
140
|
+
event.stopPropagation();
|
|
141
|
+
action.onClick?.(row);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
__decorate([
|
|
145
|
+
Input(),
|
|
146
|
+
__metadata("design:type", Array)
|
|
147
|
+
], FyTableComponent.prototype, "data", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
Input(),
|
|
150
|
+
__metadata("design:type", Array)
|
|
151
|
+
], FyTableComponent.prototype, "columns", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
Input(),
|
|
154
|
+
__metadata("design:type", String)
|
|
155
|
+
], FyTableComponent.prototype, "title", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
Input(),
|
|
158
|
+
__metadata("design:type", String)
|
|
159
|
+
], FyTableComponent.prototype, "subtitle", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
Input(),
|
|
162
|
+
__metadata("design:type", String)
|
|
163
|
+
], FyTableComponent.prototype, "footer", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
Input(),
|
|
166
|
+
__metadata("design:type", Boolean)
|
|
167
|
+
], FyTableComponent.prototype, "loading", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
Input(),
|
|
170
|
+
__metadata("design:type", Boolean)
|
|
171
|
+
], FyTableComponent.prototype, "showHeader", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
Input(),
|
|
174
|
+
__metadata("design:type", Boolean)
|
|
175
|
+
], FyTableComponent.prototype, "showFooter", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
Input(),
|
|
178
|
+
__metadata("design:type", Boolean)
|
|
179
|
+
], FyTableComponent.prototype, "showPagination", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
Input(),
|
|
182
|
+
__metadata("design:type", Boolean)
|
|
183
|
+
], FyTableComponent.prototype, "showSearch", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
Input(),
|
|
186
|
+
__metadata("design:type", Number)
|
|
187
|
+
], FyTableComponent.prototype, "currentPage", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
Input(),
|
|
190
|
+
__metadata("design:type", Number)
|
|
191
|
+
], FyTableComponent.prototype, "pageSize", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
Input(),
|
|
194
|
+
__metadata("design:type", Number)
|
|
195
|
+
], FyTableComponent.prototype, "totalItems", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
Input(),
|
|
198
|
+
__metadata("design:type", Array)
|
|
199
|
+
], FyTableComponent.prototype, "searchTargets", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
Input(),
|
|
202
|
+
__metadata("design:type", Array)
|
|
203
|
+
], FyTableComponent.prototype, "actions", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
Input(),
|
|
206
|
+
__metadata("design:type", Boolean)
|
|
207
|
+
], FyTableComponent.prototype, "rowClickable", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
Input(),
|
|
210
|
+
__metadata("design:type", Object)
|
|
211
|
+
], FyTableComponent.prototype, "variant", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
Input(),
|
|
214
|
+
__metadata("design:type", Boolean)
|
|
215
|
+
], FyTableComponent.prototype, "stickyHeader", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
Input(),
|
|
218
|
+
__metadata("design:type", Boolean)
|
|
219
|
+
], FyTableComponent.prototype, "scrollable", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
Input(),
|
|
222
|
+
__metadata("design:type", String)
|
|
223
|
+
], FyTableComponent.prototype, "maxHeight", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
Input(),
|
|
226
|
+
__metadata("design:type", Object)
|
|
227
|
+
], FyTableComponent.prototype, "activeAnimations", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
Input(),
|
|
230
|
+
__metadata("design:type", Object)
|
|
231
|
+
], FyTableComponent.prototype, "activeEffects", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
Input(),
|
|
234
|
+
__metadata("design:type", Object)
|
|
235
|
+
], FyTableComponent.prototype, "customStyles", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
Output(),
|
|
238
|
+
__metadata("design:type", Object)
|
|
239
|
+
], FyTableComponent.prototype, "fySearch", void 0);
|
|
240
|
+
__decorate([
|
|
241
|
+
Output(),
|
|
242
|
+
__metadata("design:type", Object)
|
|
243
|
+
], FyTableComponent.prototype, "fySort", void 0);
|
|
244
|
+
__decorate([
|
|
245
|
+
Output(),
|
|
246
|
+
__metadata("design:type", Object)
|
|
247
|
+
], FyTableComponent.prototype, "fyPageChange", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
Output(),
|
|
250
|
+
__metadata("design:type", Object)
|
|
251
|
+
], FyTableComponent.prototype, "fyRowClick", void 0);
|
|
252
|
+
__decorate([
|
|
253
|
+
ContentChild('cellTemplate'),
|
|
254
|
+
__metadata("design:type", TemplateRef)
|
|
255
|
+
], FyTableComponent.prototype, "cellTemplate", void 0);
|
|
256
|
+
FyTableComponent = __decorate([
|
|
257
|
+
Component({
|
|
258
|
+
selector: 'fy-table',
|
|
259
|
+
standalone: true,
|
|
260
|
+
imports: [
|
|
261
|
+
CommonModule,
|
|
262
|
+
FyIconComponent,
|
|
263
|
+
FyInputComponent,
|
|
264
|
+
FyButtonComponent
|
|
265
|
+
],
|
|
266
|
+
template: `
|
|
267
|
+
<div
|
|
268
|
+
class="fy-table-container"
|
|
269
|
+
[class.fy-table--scrollable]="scrollable"
|
|
270
|
+
[class.fy-table--sticky]="stickyHeader"
|
|
271
|
+
[class]="composeAnimClasses(animationClassSuffix)"
|
|
272
|
+
[style]="getHostStyles(customStyles)"
|
|
273
|
+
|
|
274
|
+
>
|
|
275
|
+
<!-- Header / Search / Title -->
|
|
276
|
+
@if (showHeader || title || showSearch) {
|
|
277
|
+
<header class="fy-table__header">
|
|
278
|
+
@if (title || subtitle) {
|
|
279
|
+
<div class="fy-table__header-main">
|
|
280
|
+
@if (title) { <h3 class="fy-table__title">{{ title }}</h3> }
|
|
281
|
+
@if (subtitle) { <p class="fy-table__subtitle">{{ subtitle }}</p> }
|
|
282
|
+
</div>
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
<div class="fy-table__header-tools">
|
|
286
|
+
@if (showSearch) {
|
|
287
|
+
<div class="fy-table__search">
|
|
288
|
+
<fy-input
|
|
289
|
+
placeholder="Pesquisar..."
|
|
290
|
+
iconLeftName="search"
|
|
291
|
+
size="sm"
|
|
292
|
+
(fyInput)="onSearch($event)"
|
|
293
|
+
></fy-input>
|
|
294
|
+
</div>
|
|
295
|
+
}
|
|
296
|
+
<ng-content select="[fy-table-tools]"></ng-content>
|
|
297
|
+
</div>
|
|
298
|
+
</header>
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
<!-- Table Content -->
|
|
302
|
+
<div class="fy-table__content" [style.maxHeight]="maxHeight">
|
|
303
|
+
<table class="fy-table" [class]="'fy-table--' + variant">
|
|
304
|
+
<thead>
|
|
305
|
+
<tr>
|
|
306
|
+
@for (col of visibleColumns; track col.key) {
|
|
307
|
+
<th
|
|
308
|
+
[style.width]="col.width"
|
|
309
|
+
[class.fy-table__th--sortable]="col.sortable"
|
|
310
|
+
[style.textAlign]="col.align || 'left'"
|
|
311
|
+
(click)="onSort(col)"
|
|
312
|
+
>
|
|
313
|
+
<div class="fy-table__th-content">
|
|
314
|
+
@if (col.iconName) {
|
|
315
|
+
<fy-icon
|
|
316
|
+
[name]="col.iconName"
|
|
317
|
+
[set]="col.iconSet"
|
|
318
|
+
class="fy-table__th-icon"
|
|
319
|
+
></fy-icon>
|
|
320
|
+
}
|
|
321
|
+
<span>{{ col.label }}</span>
|
|
322
|
+
@if (col.sortable) {
|
|
323
|
+
<fy-icon
|
|
324
|
+
[name]="getSortIcon(col)"
|
|
325
|
+
class="fy-table__sort-icon"
|
|
326
|
+
></fy-icon>
|
|
327
|
+
}
|
|
328
|
+
</div>
|
|
329
|
+
</th>
|
|
330
|
+
}
|
|
331
|
+
@if (actions && actions.length > 0) {
|
|
332
|
+
<th class="fy-table__th--actions">
|
|
333
|
+
Ações
|
|
334
|
+
</th>
|
|
335
|
+
}
|
|
336
|
+
</tr>
|
|
337
|
+
</thead>
|
|
338
|
+
<tbody>
|
|
339
|
+
@if (loading) {
|
|
340
|
+
<tr class="fy-table__row--loading">
|
|
341
|
+
<td [attr.colspan]="totalColumns" class="fy-table__td--loading">
|
|
342
|
+
<div class="fy-table__loader"></div>
|
|
343
|
+
</td>
|
|
344
|
+
</tr>
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
@if (!loading && (!data || data.length === 0)) {
|
|
348
|
+
<tr class="fy-table__row--empty">
|
|
349
|
+
<td [attr.colspan]="totalColumns" class="fy-table__td--empty">
|
|
350
|
+
Nenhum registro encontrado.
|
|
351
|
+
</td>
|
|
352
|
+
</tr>
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
@if (!loading) {
|
|
356
|
+
@for (row of paginatedData; track $index) {
|
|
357
|
+
<tr
|
|
358
|
+
class="fy-table__row"
|
|
359
|
+
[class.fy-table__row--clickable]="rowClickable"
|
|
360
|
+
(click)="onRowClick(row)"
|
|
361
|
+
>
|
|
362
|
+
@for (col of visibleColumns; track col.key) {
|
|
363
|
+
<td
|
|
364
|
+
[style.textAlign]="col.align || 'left'"
|
|
365
|
+
>
|
|
366
|
+
<!-- Custom Cell Template -->
|
|
367
|
+
@if (cellTemplate) {
|
|
368
|
+
<ng-container *ngTemplateOutlet="cellTemplate; context: { $implicit: row, column: col }"></ng-container>
|
|
369
|
+
} @else {
|
|
370
|
+
{{ row[col.key] }}
|
|
371
|
+
}
|
|
372
|
+
</td>
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
@if (actions && actions.length > 0) {
|
|
376
|
+
<td class="fy-table__td--actions">
|
|
377
|
+
<div class="fy-table__actions-group">
|
|
378
|
+
@for (action of actions; track action.label) {
|
|
379
|
+
<fy-button
|
|
380
|
+
[iconName]="action.iconName"
|
|
381
|
+
[label]="action.label"
|
|
382
|
+
[variant]="action.variant || 'ghost'"
|
|
383
|
+
size="sm"
|
|
384
|
+
(fyClick)="onActionClick($event, action, row)"
|
|
385
|
+
></fy-button>
|
|
386
|
+
}
|
|
387
|
+
</div>
|
|
388
|
+
</td>
|
|
389
|
+
}
|
|
390
|
+
</tr>
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
</tbody>
|
|
394
|
+
</table>
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
<!-- Footer / Pagination -->
|
|
398
|
+
@if (showFooter || showPagination || footer) {
|
|
399
|
+
<footer class="fy-table__footer">
|
|
400
|
+
@if (footer || showPagination) {
|
|
401
|
+
<div class="fy-table__footer-info">
|
|
402
|
+
@if (footer) { <span>{{ footer }}</span> }
|
|
403
|
+
@if (showPagination) {
|
|
404
|
+
<span class="fy-table__pagination-summary">
|
|
405
|
+
Mostrando {{ startItem }} - {{ endItem }} de {{ displayTotal }}
|
|
406
|
+
</span>
|
|
407
|
+
}
|
|
408
|
+
</div>
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
@if (showPagination) {
|
|
412
|
+
<div class="fy-table__pagination">
|
|
413
|
+
<fy-button
|
|
414
|
+
variant="ghost"
|
|
415
|
+
size="sm"
|
|
416
|
+
iconName="caret-left"
|
|
417
|
+
[disabled]="currentPage === 1"
|
|
418
|
+
(fyClick)="onPageChange(currentPage - 1)"
|
|
419
|
+
></fy-button>
|
|
420
|
+
|
|
421
|
+
<div class="fy-table__pages">
|
|
422
|
+
<span class="fy-table__page-info">{{ currentPage }} / {{ totalPages }}</span>
|
|
423
|
+
</div>
|
|
424
|
+
|
|
425
|
+
<fy-button
|
|
426
|
+
variant="ghost"
|
|
427
|
+
size="sm"
|
|
428
|
+
iconName="caret-right"
|
|
429
|
+
[disabled]="currentPage === totalPages"
|
|
430
|
+
(fyClick)="onPageChange(currentPage + 1)"
|
|
431
|
+
></fy-button>
|
|
432
|
+
</div>
|
|
433
|
+
}
|
|
434
|
+
</footer>
|
|
435
|
+
}
|
|
436
|
+
</div>
|
|
437
|
+
`,
|
|
438
|
+
styles: [`
|
|
439
|
+
.fy-table-container {
|
|
440
|
+
display: flex;
|
|
441
|
+
flex-direction: column;
|
|
442
|
+
width: 100%;
|
|
443
|
+
background: var(--fy-effects-table-background, #fff);
|
|
444
|
+
border: 1px solid var(--fy-effects-table-borderColor, rgba(0,0,0,0.08));
|
|
445
|
+
border-radius: var(--fy-borderRadius-lg, 12px);
|
|
446
|
+
overflow: hidden;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.fy-table__header {
|
|
450
|
+
padding: var(--fy-spacing-md);
|
|
451
|
+
display: flex;
|
|
452
|
+
justify-content: space-between;
|
|
453
|
+
align-items: center;
|
|
454
|
+
border-bottom: 1px solid var(--fy-effects-table-borderColor);
|
|
455
|
+
gap: 16px;
|
|
456
|
+
flex-wrap: wrap;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.fy-table__header-tools {
|
|
460
|
+
display: flex;
|
|
461
|
+
gap: 12px;
|
|
462
|
+
align-items: center;
|
|
463
|
+
flex: 1;
|
|
464
|
+
justify-content: flex-end;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.fy-table__header-tools ::ng-deep [fy-table-tools] {
|
|
468
|
+
display: flex;
|
|
469
|
+
gap: 8px;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.fy-table__actions-group {
|
|
473
|
+
display: flex;
|
|
474
|
+
gap: 6px;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
@media (max-width: 640px) {
|
|
478
|
+
.fy-table__header-tools {
|
|
479
|
+
justify-content: flex-start;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.fy-table__header-tools ::ng-deep [fy-table-tools] {
|
|
483
|
+
width: 100%;
|
|
484
|
+
overflow-x: auto;
|
|
485
|
+
padding-bottom: 4px;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.fy-table__header-tools ::ng-deep [fy-table-tools] fy-button .fy-button__label {
|
|
489
|
+
display: none;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.fy-table__header-tools ::ng-deep [fy-table-tools] fy-button .fy-button {
|
|
493
|
+
padding: var(--fy-spacing-sm);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.fy-table__title {
|
|
498
|
+
margin: 0;
|
|
499
|
+
font-size: var(--fy-typography-fontSize-lg);
|
|
500
|
+
font-weight: var(--fy-typography-fontWeight-bold);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.fy-table__subtitle {
|
|
504
|
+
margin: 4px 0 0;
|
|
505
|
+
font-size: var(--fy-typography-fontSize-sm);
|
|
506
|
+
color: var(--fy-colors-secondary);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.fy-table__header-tools {
|
|
510
|
+
display: flex;
|
|
511
|
+
gap: 12px;
|
|
512
|
+
align-items: center;
|
|
513
|
+
flex: 1;
|
|
514
|
+
justify-content: flex-end;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.fy-table__search {
|
|
518
|
+
max-width: 300px;
|
|
519
|
+
width: 100%;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.fy-table__content {
|
|
523
|
+
width: 100%;
|
|
524
|
+
overflow-x: auto;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.fy-table {
|
|
528
|
+
width: 100%;
|
|
529
|
+
border-collapse: collapse;
|
|
530
|
+
text-align: left;
|
|
531
|
+
font-size: var(--fy-typography-fontSize-md);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.fy-table th {
|
|
535
|
+
padding: var(--fy-spacing-md);
|
|
536
|
+
background: var(--fy-effects-table-headerBackground, rgba(0,0,0,0.02));
|
|
537
|
+
color: var(--fy-colors-text);
|
|
538
|
+
font-weight: var(--fy-typography-fontWeight-bold);
|
|
539
|
+
border-bottom: 1px solid var(--fy-effects-table-borderColor);
|
|
540
|
+
white-space: nowrap;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.fy-table td {
|
|
544
|
+
padding: var(--fy-spacing-md);
|
|
545
|
+
border-bottom: 1px solid var(--fy-effects-table-borderColor);
|
|
546
|
+
color: var(--fy-colors-text);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.fy-table__row:last-child td {
|
|
550
|
+
border-bottom: none;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.fy-table__row:hover {
|
|
554
|
+
background: var(--fy-effects-table-rowHoverBackground, rgba(0,0,0,0.01));
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.fy-table__row--clickable {
|
|
558
|
+
cursor: pointer;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.fy-table--striped tbody tr:nth-child(even) {
|
|
562
|
+
background: var(--fy-effects-table-stripedBackground, rgba(0,0,0,0.005));
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.fy-table--bordered td,
|
|
566
|
+
.fy-table--bordered th {
|
|
567
|
+
border: 1px solid var(--fy-effects-table-borderColor);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.fy-table--compact td,
|
|
571
|
+
.fy-table--compact th {
|
|
572
|
+
padding: var(--fy-spacing-sm);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.fy-table__th-content {
|
|
576
|
+
display: flex;
|
|
577
|
+
align-items: center;
|
|
578
|
+
gap: 8px;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.fy-table__th--sortable {
|
|
582
|
+
cursor: pointer;
|
|
583
|
+
user-select: none;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.fy-table__th--sortable:hover {
|
|
587
|
+
background: rgba(0,0,0,0.04);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.fy-table__footer {
|
|
591
|
+
padding: var(--fy-spacing-md);
|
|
592
|
+
display: flex;
|
|
593
|
+
justify-content: space-between;
|
|
594
|
+
align-items: center;
|
|
595
|
+
border-top: 1px solid var(--fy-effects-table-borderColor);
|
|
596
|
+
background: var(--fy-effects-table-headerBackground);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.fy-table__pagination {
|
|
600
|
+
display: flex;
|
|
601
|
+
align-items: center;
|
|
602
|
+
gap: 12px;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.fy-table__page-info {
|
|
606
|
+
font-size: var(--fy-typography-fontSize-sm);
|
|
607
|
+
font-weight: var(--fy-typography-fontWeight-bold);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.fy-table__loader {
|
|
611
|
+
width: 24px;
|
|
612
|
+
height: 24px;
|
|
613
|
+
border: 3px solid var(--fy-colors-primary);
|
|
614
|
+
border-bottom-color: transparent;
|
|
615
|
+
border-radius: 50%;
|
|
616
|
+
margin: 24px auto;
|
|
617
|
+
animation: fy-spin 0.8s linear infinite;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
@keyframes fy-spin {
|
|
621
|
+
from { transform: rotate(0deg); }
|
|
622
|
+
to { transform: rotate(360deg); }
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
@media (max-width: 640px) {
|
|
626
|
+
.fy-table__header {
|
|
627
|
+
flex-direction: column;
|
|
628
|
+
align-items: stretch;
|
|
629
|
+
}
|
|
630
|
+
.fy-table__search {
|
|
631
|
+
max-width: 100%;
|
|
632
|
+
}
|
|
633
|
+
.fy-table__footer {
|
|
634
|
+
flex-direction: column;
|
|
635
|
+
gap: 16px;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
`],
|
|
639
|
+
encapsulation: ViewEncapsulation.None
|
|
640
|
+
}),
|
|
641
|
+
__metadata("design:paramtypes", [])
|
|
642
|
+
], FyTableComponent);
|
|
643
|
+
export { FyTableComponent };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Component, Input, ViewEncapsulation, signal, effect, inject } from '@angular/core';
|
|
11
|
+
import { FyLibService } from '../services/fylib.service';
|
|
12
|
+
import { cryptoEngine } from '@fylib/crypto';
|
|
13
|
+
let FyTextComponent = class FyTextComponent {
|
|
14
|
+
set text(v) { this._raw.set(v ?? ''); }
|
|
15
|
+
constructor() {
|
|
16
|
+
this.fylib = inject(FyLibService);
|
|
17
|
+
this._raw = signal('');
|
|
18
|
+
this.cryptoEnabled = false;
|
|
19
|
+
this.value = signal('');
|
|
20
|
+
effect(async () => {
|
|
21
|
+
const raw = this._raw();
|
|
22
|
+
const cfg = this.fylib.config().crypto;
|
|
23
|
+
if (this.cryptoEnabled && cfg?.enabled) {
|
|
24
|
+
try {
|
|
25
|
+
const dec = await cryptoEngine.decrypt(raw, cfg);
|
|
26
|
+
this.value.set(dec);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
this.value.set(raw);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.value.set(raw);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
__decorate([
|
|
39
|
+
Input(),
|
|
40
|
+
__metadata("design:type", String),
|
|
41
|
+
__metadata("design:paramtypes", [String])
|
|
42
|
+
], FyTextComponent.prototype, "text", null);
|
|
43
|
+
__decorate([
|
|
44
|
+
Input(),
|
|
45
|
+
__metadata("design:type", Boolean)
|
|
46
|
+
], FyTextComponent.prototype, "cryptoEnabled", void 0);
|
|
47
|
+
FyTextComponent = __decorate([
|
|
48
|
+
Component({
|
|
49
|
+
selector: 'fy-text',
|
|
50
|
+
standalone: true,
|
|
51
|
+
template: `
|
|
52
|
+
<span>{{ value() }}</span>
|
|
53
|
+
`,
|
|
54
|
+
encapsulation: ViewEncapsulation.None
|
|
55
|
+
}),
|
|
56
|
+
__metadata("design:paramtypes", [])
|
|
57
|
+
], FyTextComponent);
|
|
58
|
+
export { FyTextComponent };
|