b2b-tools 0.0.3 → 0.1.1
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/LICENCE +21 -0
- package/README.md +120 -25
- package/ng-package.json +7 -0
- package/package.json +13 -24
- package/src/lib/b2b-tools.spec.ts +23 -0
- package/src/lib/b2b-tools.ts +15 -0
- package/src/lib/components/advanced-card/advanced-card.css +265 -0
- package/src/lib/components/advanced-card/advanced-card.html +117 -0
- package/src/lib/components/advanced-card/advanced-card.ts +75 -0
- package/src/lib/components/advanced-card/index.ts +2 -0
- package/src/lib/components/advanced-card/types/card.types.ts +37 -0
- package/src/lib/components/advanced-card/types/index.ts +1 -0
- package/src/lib/components/advanced-table/advanced-table.component.css +81 -0
- package/src/lib/components/advanced-table/advanced-table.component.html +56 -0
- package/src/lib/components/advanced-table/advanced-table.component.ts +469 -0
- package/src/lib/components/advanced-table/index.ts +2 -0
- package/src/lib/components/advanced-table/parts/table-grid/table-grid.component.css +274 -0
- package/src/lib/components/advanced-table/parts/table-grid/table-grid.component.html +168 -0
- package/src/lib/components/advanced-table/parts/table-grid/table-grid.component.ts +224 -0
- package/src/lib/components/advanced-table/parts/table-modal-image/table-modal-image.component.css +49 -0
- package/src/lib/components/advanced-table/parts/table-modal-image/table-modal-image.component.html +14 -0
- package/src/lib/components/advanced-table/parts/table-modal-image/table-modal-image.component.ts +22 -0
- package/src/lib/components/advanced-table/parts/table-pagination/table-pagination.component.css +147 -0
- package/src/lib/components/advanced-table/parts/table-pagination/table-pagination.component.html +95 -0
- package/src/lib/components/advanced-table/parts/table-pagination/table-pagination.component.ts +61 -0
- package/src/lib/components/advanced-table/parts/table-toolbar/table-toolbar.component.css +32 -0
- package/src/lib/components/advanced-table/parts/table-toolbar/table-toolbar.component.html +17 -0
- package/src/lib/components/advanced-table/parts/table-toolbar/table-toolbar.component.ts +30 -0
- package/src/lib/components/advanced-table/types/index.ts +2 -0
- package/src/lib/components/advanced-table/types/table.types.ts +101 -0
- package/src/lib/components/advanced-table/types/time-zone.types.ts +91 -0
- package/src/lib/components/index.ts +2 -0
- package/src/public-api.ts +4 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/fesm2022/b2b-tools.mjs +0 -761
- package/fesm2022/b2b-tools.mjs.map +0 -1
- package/types/b2b-tools.d.ts +0 -431
package/fesm2022/b2b-tools.mjs
DELETED
|
@@ -1,761 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, ChangeDetectionStrategy, Component, inject, computed, signal, effect } from '@angular/core';
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
|
-
import { DomSanitizer } from '@angular/platform-browser';
|
|
5
|
-
|
|
6
|
-
class TableModalImageComponent {
|
|
7
|
-
open = input(false, ...(ngDevMode ? [{ debugName: "open" }] : []));
|
|
8
|
-
src = input('', ...(ngDevMode ? [{ debugName: "src" }] : []));
|
|
9
|
-
alt = input('', ...(ngDevMode ? [{ debugName: "alt" }] : []));
|
|
10
|
-
close = output();
|
|
11
|
-
onClose() {
|
|
12
|
-
this.close.emit();
|
|
13
|
-
}
|
|
14
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: TableModalImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: TableModalImageComponent, isStandalone: true, selector: "table-modal-image", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close" }, ngImport: i0, template: "@if (open()) {\r\n <div class=\"dt-modal-backdrop\" (click)=\"onClose()\">\r\n <div class=\"dt-modal\" (click)=\"$event.stopPropagation()\">\r\n <div class=\"dt-modal-header\">\r\n <span class=\"dt-modal-title\">{{ alt() }}</span>\r\n <button type=\"button\" class=\"dt-btn\" (click)=\"onClose()\">Cerrar</button>\r\n </div>\r\n\r\n <div class=\"dt-modal-body\">\r\n <img class=\"dt-modal-img\" [src]=\"src()\" [alt]=\"alt()\" />\r\n </div>\r\n </div>\r\n </div>\r\n}\r\n", styles: [".dt-modal-backdrop{position:fixed;inset:0;background:#0000008c;display:flex;justify-content:center;align-items:center;padding:18px;z-index:9999}.dt-modal{width:min(900px,95vw);max-height:90vh;background:var(--white);border-radius:var(--radius-md);border:var(--border);overflow:hidden;display:flex;flex-direction:column}.dt-modal-header{padding:12px;border-bottom:var(--border);display:flex;justify-content:space-between;align-items:center;background:var(--gray-white)}.dt-modal-title{font-weight:600;color:var(--black);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dt-modal-body{padding:12px;overflow:auto}.dt-modal-img{width:100%;height:auto;border-radius:var(--radius-sm)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
16
|
-
}
|
|
17
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: TableModalImageComponent, decorators: [{
|
|
18
|
-
type: Component,
|
|
19
|
-
args: [{ selector: 'table-modal-image', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (open()) {\r\n <div class=\"dt-modal-backdrop\" (click)=\"onClose()\">\r\n <div class=\"dt-modal\" (click)=\"$event.stopPropagation()\">\r\n <div class=\"dt-modal-header\">\r\n <span class=\"dt-modal-title\">{{ alt() }}</span>\r\n <button type=\"button\" class=\"dt-btn\" (click)=\"onClose()\">Cerrar</button>\r\n </div>\r\n\r\n <div class=\"dt-modal-body\">\r\n <img class=\"dt-modal-img\" [src]=\"src()\" [alt]=\"alt()\" />\r\n </div>\r\n </div>\r\n </div>\r\n}\r\n", styles: [".dt-modal-backdrop{position:fixed;inset:0;background:#0000008c;display:flex;justify-content:center;align-items:center;padding:18px;z-index:9999}.dt-modal{width:min(900px,95vw);max-height:90vh;background:var(--white);border-radius:var(--radius-md);border:var(--border);overflow:hidden;display:flex;flex-direction:column}.dt-modal-header{padding:12px;border-bottom:var(--border);display:flex;justify-content:space-between;align-items:center;background:var(--gray-white)}.dt-modal-title{font-weight:600;color:var(--black);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dt-modal-body{padding:12px;overflow:auto}.dt-modal-img{width:100%;height:auto;border-radius:var(--radius-sm)}\n"] }]
|
|
20
|
-
}], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }], src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], close: [{ type: i0.Output, args: ["close"] }] } });
|
|
21
|
-
|
|
22
|
-
const SVG_ICONS = {
|
|
23
|
-
edit: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h8.925l-2 2H5v14h14v-6.95l2-2V19q0 .825-.587 1.413T19 21zm4-6v-4.25l9.175-9.175q.3-.3.675-.45t.75-.15q.4 0 .763.15t.662.45L22.425 3q.275.3.425.663T23 4.4t-.137.738t-.438.662L13.25 15zM21.025 4.4l-1.4-1.4zM11 13h1.4l5.8-5.8l-.7-.7l-.725-.7L11 11.575zm6.5-6.5l-.725-.7zl.7.7z"/></svg>',
|
|
24
|
-
delete: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zM17 6H7v13h10zM9 17h2V8H9zm4 0h2V8h-2zM7 6v13z"/></svg>',
|
|
25
|
-
open: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"><path d="M7 3.625c-4.187 0-5.945 3.766-5.945 3.844S2.813 11.312 7 11.312s5.945-3.765 5.945-3.843S11.187 3.625 7 3.625M2.169 5.813L.61 4.252m4.525-.354L4.5 1.843m7.331 3.97l1.559-1.56m-4.525-.355L9.5 1.843"/><path d="M5.306 7.081a1.738 1.738 0 1 0 3.388.776a1.738 1.738 0 1 0-3.388-.776"/></g></svg>',
|
|
26
|
-
copy: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M9 18q-.825 0-1.412-.587T7 16V4q0-.825.588-1.412T9 2h9q.825 0 1.413.588T20 4v12q0 .825-.587 1.413T18 18zm-4 4q-.825 0-1.412-.587T3 20V6h2v14h11v2z"/></svg>'
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const TIME_ZONES = {
|
|
30
|
-
// AFRICA
|
|
31
|
-
CAIRO: { city: 'Cairo', timeZone: 'Africa/Cairo', name: 'Egypt', currency: 'EGP', locale: 'ar-EG', utcOffset: +2 },
|
|
32
|
-
CASABLANCA: { city: 'Casablanca', timeZone: 'Africa/Casablanca', name: 'Morocco', currency: 'MAD', locale: 'ar-MA', utcOffset: 0 },
|
|
33
|
-
JOHANNESBURG: { city: 'Johannesburg', timeZone: 'Africa/Johannesburg', name: 'South Africa', currency: 'ZAR', locale: 'en-ZA', utcOffset: +2 },
|
|
34
|
-
// AMERICA
|
|
35
|
-
BUENOS_AIRES: { city: 'Buenos Aires', timeZone: 'America/Argentina/Buenos_Aires', name: 'Argentina', currency: 'ARS', locale: 'es-AR', utcOffset: -3 },
|
|
36
|
-
SAO_PAULO: { city: 'Sao Paulo', timeZone: 'America/Sao_Paulo', name: 'Brazil', currency: 'BRL', locale: 'pt-BR', utcOffset: -3 },
|
|
37
|
-
TORONTO: { city: 'Toronto', timeZone: 'America/Toronto', name: 'Canada', currency: 'CAD', locale: 'en-CA', utcOffset: -5 },
|
|
38
|
-
VANCOUVER: { city: 'Vancouver', timeZone: 'America/Vancouver', name: 'Canada (Pacific)', currency: 'CAD', locale: 'en-CA', utcOffset: -8 },
|
|
39
|
-
BOGOTA: { city: 'Bogota', timeZone: 'America/Bogota', name: 'Colombia', currency: 'COP', locale: 'es-CO', utcOffset: -5 },
|
|
40
|
-
CANCUN: { city: 'Cancun', timeZone: 'America/Cancun', name: 'Mexico (Quintana Roo)', currency: 'MXN', locale: 'es-MX', utcOffset: -5 },
|
|
41
|
-
MEXICO_CITY: { city: 'Mexico City', timeZone: 'America/Mexico_City', name: 'Mexico', currency: 'MXN', locale: 'es-MX', utcOffset: -6 },
|
|
42
|
-
TIJUANA: { city: 'Tijuana', timeZone: 'America/Tijuana', name: 'Mexico (Pacific)', currency: 'MXN', locale: 'es-MX', utcOffset: -8 },
|
|
43
|
-
LIMA: { city: 'Lima', timeZone: 'America/Lima', name: 'Peru', currency: 'PEN', locale: 'es-PE', utcOffset: -5 },
|
|
44
|
-
SANTIAGO: { city: 'Santiago', timeZone: 'America/Santiago', name: 'Chile', currency: 'CLP', locale: 'es-CL', utcOffset: -4 },
|
|
45
|
-
CHICAGO: { city: 'Chicago', timeZone: 'America/Chicago', name: 'United States (Central)', currency: 'USD', locale: 'en-US', utcOffset: -6 },
|
|
46
|
-
DENVER: { city: 'Denver', timeZone: 'America/Denver', name: 'United States (Mountain)', currency: 'USD', locale: 'en-US', utcOffset: -7 },
|
|
47
|
-
LOS_ANGELES: { city: 'Los Angeles', timeZone: 'America/Los_Angeles', name: 'United States (Pacific)', currency: 'USD', locale: 'en-US', utcOffset: -8 },
|
|
48
|
-
NEW_YORK: { city: 'New York', timeZone: 'America/New_York', name: 'United States (Eastern)', currency: 'USD', locale: 'en-US', utcOffset: -5 },
|
|
49
|
-
// ASIA
|
|
50
|
-
SHANGHAI: { city: 'Shanghai', timeZone: 'Asia/Shanghai', name: 'China', currency: 'CNY', locale: 'zh-CN', utcOffset: +8 },
|
|
51
|
-
KOLKATA: { city: 'Kolkata', timeZone: 'Asia/Kolkata', name: 'India', currency: 'INR', locale: 'en-IN', utcOffset: +5.5 },
|
|
52
|
-
TOKYO: { city: 'Tokyo', timeZone: 'Asia/Tokyo', name: 'Japan', currency: 'JPY', locale: 'ja-JP', utcOffset: +9 },
|
|
53
|
-
SEOUL: { city: 'Seoul', timeZone: 'Asia/Seoul', name: 'South Korea', currency: 'KRW', locale: 'ko-KR', utcOffset: +9 },
|
|
54
|
-
DUBAI: { city: 'Dubai', timeZone: 'Asia/Dubai', name: 'United Arab Emirates', currency: 'AED', locale: 'ar-AE', utcOffset: +4 },
|
|
55
|
-
// EUROPE
|
|
56
|
-
BERLIN: { city: 'Berlin', timeZone: 'Europe/Berlin', name: 'Germany', currency: 'EUR', locale: 'de-DE', utcOffset: +1 },
|
|
57
|
-
PARIS: { city: 'Paris', timeZone: 'Europe/Paris', name: 'France', currency: 'EUR', locale: 'fr-FR', utcOffset: +1 },
|
|
58
|
-
ROME: { city: 'Rome', timeZone: 'Europe/Rome', name: 'Italy', currency: 'EUR', locale: 'it-IT', utcOffset: +1 },
|
|
59
|
-
MADRID: { city: 'Madrid', timeZone: 'Europe/Madrid', name: 'Spain', currency: 'EUR', locale: 'es-ES', utcOffset: +1 },
|
|
60
|
-
ZURICH: { city: 'Zurich', timeZone: 'Europe/Zurich', name: 'Switzerland', currency: 'CHF', locale: 'de-CH', utcOffset: +1 },
|
|
61
|
-
LONDON: { city: 'London', timeZone: 'Europe/London', name: 'United Kingdom', currency: 'GBP', locale: 'en-GB', utcOffset: 0 },
|
|
62
|
-
// OCEANIA
|
|
63
|
-
SYDNEY: { city: 'Sydney', timeZone: 'Australia/Sydney', name: 'Australia', currency: 'AUD', locale: 'en-AU', utcOffset: +10 },
|
|
64
|
-
AUCKLAND: { city: 'Auckland', timeZone: 'Pacific/Auckland', name: 'New Zealand', currency: 'NZD', locale: 'en-NZ', utcOffset: +12 },
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
class TableGridComponent {
|
|
68
|
-
sanitizer = inject(DomSanitizer);
|
|
69
|
-
// Inputs
|
|
70
|
-
config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
71
|
-
columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
72
|
-
rows = input([], ...(ngDevMode ? [{ debugName: "rows" }] : []));
|
|
73
|
-
gridTemplateColumns = input('', ...(ngDevMode ? [{ debugName: "gridTemplateColumns" }] : []));
|
|
74
|
-
columnQueries = input({}, ...(ngDevMode ? [{ debugName: "columnQueries" }] : []));
|
|
75
|
-
sortState = input(null, ...(ngDevMode ? [{ debugName: "sortState" }] : []));
|
|
76
|
-
selectedIdsSet = input(new Set(), ...(ngDevMode ? [{ debugName: "selectedIdsSet" }] : []));
|
|
77
|
-
timeZone = input(TIME_ZONES.MEXICO_CITY, ...(ngDevMode ? [{ debugName: "timeZone" }] : []));
|
|
78
|
-
// Outputs
|
|
79
|
-
headerSort = output();
|
|
80
|
-
columnQueryChange = output();
|
|
81
|
-
rowClick = output();
|
|
82
|
-
toggleRow = output();
|
|
83
|
-
toggleAllOnPage = output();
|
|
84
|
-
openImage = output();
|
|
85
|
-
actionClick = output();
|
|
86
|
-
bodyScroll = output();
|
|
87
|
-
// Derived
|
|
88
|
-
showSelectionColumn = computed(() => !!this.config().selectable, ...(ngDevMode ? [{ debugName: "showSelectionColumn" }] : []));
|
|
89
|
-
// Helpers
|
|
90
|
-
getRowIdKey() {
|
|
91
|
-
return this.config().rowIdKey ?? 'id';
|
|
92
|
-
}
|
|
93
|
-
getRowId(row) {
|
|
94
|
-
const getter = this.config().rowIdGetter;
|
|
95
|
-
if (getter)
|
|
96
|
-
return getter(row);
|
|
97
|
-
const key = this.getRowIdKey();
|
|
98
|
-
return row?.[key];
|
|
99
|
-
}
|
|
100
|
-
isSelected(row) {
|
|
101
|
-
return this.selectedIdsSet().has(this.getRowId(row));
|
|
102
|
-
}
|
|
103
|
-
isAllSelectedOnPage() {
|
|
104
|
-
const rows = this.rows();
|
|
105
|
-
if (!rows.length)
|
|
106
|
-
return false;
|
|
107
|
-
const set = this.selectedIdsSet();
|
|
108
|
-
return rows.every((r) => set.has(this.getRowId(r)));
|
|
109
|
-
}
|
|
110
|
-
getSortIcon(colKey) {
|
|
111
|
-
const sorted = this.sortState();
|
|
112
|
-
if (!sorted || sorted.key !== colKey)
|
|
113
|
-
return '↕';
|
|
114
|
-
return sorted.dir === 'asc' ? '↑' : '↓';
|
|
115
|
-
}
|
|
116
|
-
getDisplayText(row, column) {
|
|
117
|
-
const value = this.getCellValue(row, column);
|
|
118
|
-
if (column.formatter) {
|
|
119
|
-
try {
|
|
120
|
-
return column.formatter(value, row);
|
|
121
|
-
}
|
|
122
|
-
catch {
|
|
123
|
-
return '';
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
switch (column.type) {
|
|
127
|
-
case 'string':
|
|
128
|
-
return value == null ? '' : String(value);
|
|
129
|
-
case 'integer':
|
|
130
|
-
case 'decimal':
|
|
131
|
-
case 'currency': {
|
|
132
|
-
const currencyValue = Number(value);
|
|
133
|
-
if (!Number.isFinite(currencyValue))
|
|
134
|
-
return value == null ? '' : String(value);
|
|
135
|
-
if (column.type === 'currency') {
|
|
136
|
-
try {
|
|
137
|
-
return new Intl.NumberFormat(this.timeZone().locale, {
|
|
138
|
-
style: 'currency',
|
|
139
|
-
currency: column.options?.currency ?? this.timeZone().currency,
|
|
140
|
-
maximumFractionDigits: 2,
|
|
141
|
-
}).format(currencyValue);
|
|
142
|
-
}
|
|
143
|
-
catch {
|
|
144
|
-
return String(currencyValue);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return String(currencyValue);
|
|
148
|
-
}
|
|
149
|
-
case 'date':
|
|
150
|
-
case 'datetime': {
|
|
151
|
-
const dateTime = value instanceof Date ? value : new Date(String(value));
|
|
152
|
-
if (Number.isNaN(dateTime.getTime()))
|
|
153
|
-
return value == null ? '' : String(value);
|
|
154
|
-
const locale = this.timeZone().locale;
|
|
155
|
-
return column.type === 'datetime'
|
|
156
|
-
? dateTime.toLocaleString(locale)
|
|
157
|
-
: dateTime.toLocaleDateString(locale);
|
|
158
|
-
}
|
|
159
|
-
case 'boolean':
|
|
160
|
-
return value ? 'Sí' : 'No';
|
|
161
|
-
default:
|
|
162
|
-
return value == null ? '' : String(value);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
getImageSrc(row, col) {
|
|
166
|
-
return this.getCellString(row, col);
|
|
167
|
-
}
|
|
168
|
-
getImageAlt(row, col) {
|
|
169
|
-
const altFn = col.options?.image?.alt;
|
|
170
|
-
return altFn ? altFn(row) : col.label;
|
|
171
|
-
}
|
|
172
|
-
getStatusClass(row, col) {
|
|
173
|
-
const raw = this.getCellString(row, col);
|
|
174
|
-
return col.options?.status?.classMap?.[raw] ?? '';
|
|
175
|
-
}
|
|
176
|
-
getLinkHref(row, col) {
|
|
177
|
-
const getter = col.options?.link?.hrefGetter;
|
|
178
|
-
return getter ? getter(row) : this.getCellString(row, col);
|
|
179
|
-
}
|
|
180
|
-
getLinkLabel(row, col) {
|
|
181
|
-
const getter = col.options?.link?.labelGetter;
|
|
182
|
-
if (getter)
|
|
183
|
-
return getter(row);
|
|
184
|
-
const cellValue = this.getCellValue(row, col);
|
|
185
|
-
return cellValue == null ? '' : String(cellValue);
|
|
186
|
-
}
|
|
187
|
-
getColumnActions(col) {
|
|
188
|
-
return col.actions ?? [];
|
|
189
|
-
}
|
|
190
|
-
isActionVisible(action, row) {
|
|
191
|
-
return action.visible ? action.visible(row) : true;
|
|
192
|
-
}
|
|
193
|
-
isActionDisabled(action, row) {
|
|
194
|
-
return action.disabled ? action.disabled(row) : false;
|
|
195
|
-
}
|
|
196
|
-
emitAction(action, row, event) {
|
|
197
|
-
event.stopPropagation();
|
|
198
|
-
this.actionClick.emit({ actionId: action.id, row });
|
|
199
|
-
}
|
|
200
|
-
getActionSvg(action) {
|
|
201
|
-
const key = (action.icon ?? action.id).toLowerCase();
|
|
202
|
-
return this.sanitizer.bypassSecurityTrustHtml(SVG_ICONS[key] ?? '*');
|
|
203
|
-
}
|
|
204
|
-
onHeaderClickSort(column) {
|
|
205
|
-
if (!column.sortable)
|
|
206
|
-
return;
|
|
207
|
-
this.headerSort.emit(column);
|
|
208
|
-
}
|
|
209
|
-
onColumnQueryInput(key, value) {
|
|
210
|
-
this.columnQueryChange.emit({ key, value });
|
|
211
|
-
}
|
|
212
|
-
onRowClick(row) {
|
|
213
|
-
this.rowClick.emit(row);
|
|
214
|
-
}
|
|
215
|
-
onToggleRow(row) {
|
|
216
|
-
this.toggleRow.emit(row);
|
|
217
|
-
}
|
|
218
|
-
onToggleAllOnPage() {
|
|
219
|
-
this.toggleAllOnPage.emit();
|
|
220
|
-
}
|
|
221
|
-
onOpenImage(src, alt, event) {
|
|
222
|
-
event.stopPropagation();
|
|
223
|
-
this.openImage.emit({ src, alt });
|
|
224
|
-
}
|
|
225
|
-
onBodyScroll(event) {
|
|
226
|
-
this.bodyScroll.emit(event);
|
|
227
|
-
}
|
|
228
|
-
getCellValue(row, col) {
|
|
229
|
-
if (col.valueGetter) {
|
|
230
|
-
try {
|
|
231
|
-
return col.valueGetter(row);
|
|
232
|
-
}
|
|
233
|
-
catch {
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return row?.[col.key];
|
|
238
|
-
}
|
|
239
|
-
getCellString(row, col) {
|
|
240
|
-
const value = this.getCellValue(row, col);
|
|
241
|
-
return value == null ? '' : String(value);
|
|
242
|
-
}
|
|
243
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: TableGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
244
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: TableGridComponent, isStandalone: true, selector: "table-grid", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, gridTemplateColumns: { classPropertyName: "gridTemplateColumns", publicName: "gridTemplateColumns", isSignal: true, isRequired: false, transformFunction: null }, columnQueries: { classPropertyName: "columnQueries", publicName: "columnQueries", isSignal: true, isRequired: false, transformFunction: null }, sortState: { classPropertyName: "sortState", publicName: "sortState", isSignal: true, isRequired: false, transformFunction: null }, selectedIdsSet: { classPropertyName: "selectedIdsSet", publicName: "selectedIdsSet", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { headerSort: "headerSort", columnQueryChange: "columnQueryChange", rowClick: "rowClick", toggleRow: "toggleRow", toggleAllOnPage: "toggleAllOnPage", openImage: "openImage", actionClick: "actionClick", bodyScroll: "bodyScroll" }, ngImport: i0, template: "<div class=\"dt-grid\">\r\n <div class=\"dt-xscroll\">\r\n <!-- Header -->\r\n <div class=\"dt-row dt-header\" [style.gridTemplateColumns]=\"gridTemplateColumns()\">\r\n @if (showSelectionColumn()) {\r\n <div class=\"dt-cell dt-cell--header dt-cell--center dt-select-col\">\r\n @if ((config().selectionMode ?? 'multiple') === 'multiple') {\r\n <input\r\n type=\"checkbox\"\r\n [checked]=\"isAllSelectedOnPage()\"\r\n (change)=\"onToggleAllOnPage()\"\r\n aria-label=\"Seleccionar todo\"\r\n />\r\n }\r\n </div>\r\n }\r\n\r\n @for (col of columns(); track col.key) {\r\n <div\r\n class=\"dt-cell dt-cell--header\"\r\n [class.dt-cell--sortable]=\"!!col.sortable\"\r\n [attr.data-align]=\"col.align ?? 'left'\"\r\n (click)=\"onHeaderClickSort(col)\"\r\n role=\"button\"\r\n tabindex=\"0\"\r\n >\r\n <span class=\"dt-header-label\">{{ col.label }}</span>\r\n @if (col.sortable) {\r\n <span class=\"dt-sort\">{{ getSortIcon(col.key) }}</span>\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <!-- Filters row (under header) -->\r\n @if (config().columnFilters) {\r\n <div class=\"dt-row dt-filters\" [style.gridTemplateColumns]=\"gridTemplateColumns()\">\r\n @if (showSelectionColumn()) {\r\n <div class=\"dt-cell dt-cell--filter dt-select-col\"></div>\r\n }\r\n\r\n @for (col of columns(); track col.key) {\r\n <div class=\"dt-cell dt-cell--filter\" [attr.data-align]=\"col.align ?? 'left'\">\r\n @if (col.filterable) {\r\n <input\r\n type=\"text\"\r\n [value]=\"columnQueries()[col.key] ?? null\"\r\n (input)=\"onColumnQueryInput(col.key, $any($event.target).value)\"\r\n [placeholder]=\"'Filtrar ' + col.label\"\r\n />\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Body -->\r\n <div\r\n class=\"dt-body\"\r\n [style.maxHeight.px]=\"config().scroll?.heightPx ?? null\"\r\n (scroll)=\"onBodyScroll($event)\"\r\n >\r\n @if (rows().length === 0) {\r\n <div class=\"dt-empty\">\r\n {{ config().emptyText ?? 'Sin resultados' }}\r\n </div>\r\n } @else {\r\n @for (row of rows(); track getRowId(row)) {\r\n <div class=\"dt-row dt-data\" [style.gridTemplateColumns]=\"gridTemplateColumns()\">\r\n @if (showSelectionColumn()) {\r\n <div class=\"dt-cell dt-cell--center dt-select-col\">\r\n <input\r\n type=\"checkbox\"\r\n [checked]=\"isSelected(row)\"\r\n (change)=\"onToggleRow(row)\"\r\n aria-label=\"Seleccionar fila\"\r\n />\r\n </div>\r\n }\r\n\r\n @for (col of columns(); track col.key) {\r\n <div\r\n class=\"dt-cell\"\r\n [attr.data-align]=\"col.align ?? 'left'\"\r\n (click)=\"onRowClick(row)\"\r\n >\r\n @switch (col.type) {\r\n @case ('image') {\r\n @if ((col.options?.image?.hidden ?? false) === true) {\r\n <button\r\n type=\"button\"\r\n class=\"dt-link\"\r\n (click)=\"onOpenImage(getImageSrc(row, col), getImageAlt(row, col), $event)\"\r\n >\r\n Ver imagen\r\n </button>\r\n } @else {\r\n <img\r\n class=\"dt-img\"\r\n [class.dt-img--full]=\"!!col.options?.image?.showFull\"\r\n [src]=\"getImageSrc(row, col)\"\r\n [alt]=\"getImageAlt(row, col)\"\r\n (click)=\"\r\n (col.options?.image?.openInModal ?? true) &&\r\n onOpenImage(getImageSrc(row, col), getImageAlt(row, col), $event)\r\n \"\r\n />\r\n }\r\n }\r\n\r\n @case ('status') {\r\n <span class=\"dt-badge\" [attr.data-variant]=\"getStatusClass(row, col)\">\r\n {{ getDisplayText(row, col) }}\r\n </span>\r\n }\r\n\r\n @case ('link') {\r\n <a\r\n class=\"dt-link\"\r\n [href]=\"getLinkHref(row, col)\"\r\n [target]=\"col.options?.link?.target ?? '_blank'\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n {{ getLinkLabel(row, col) }}\r\n </a>\r\n }\r\n\r\n @case ('actions') {\r\n <div class=\"dt-actions\">\r\n @for (action of getColumnActions(col); track action.id) {\r\n @if (isActionVisible(action, row)) {\r\n <button\r\n type=\"button\"\r\n class=\"dt-action-btn\"\r\n [class.dt-action--edit]=\"action.id === 'edit'\"\r\n [class.dt-action--delete]=\"action.id === 'delete'\"\r\n [class.dt-action--open]=\"action.id === 'open'\"\r\n [class.dt-action--copy]=\"action.id === 'copy'\"\r\n [disabled]=\"isActionDisabled(action, row)\"\r\n [title]=\"action.tooltip ?? action.label\"\r\n (click)=\"emitAction(action, row, $event)\"\r\n >\r\n @if ((action.render ?? 'icon') === 'text') {\r\n <span class=\"dt-action-text\">{{ action.label }}</span>\r\n } @else {\r\n <span\r\n class=\"dt-action-svg\"\r\n [innerHTML]=\"getActionSvg(action)\"\r\n ></span>\r\n }\r\n </button>\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @default {\r\n <span class=\"dt-text\">{{ getDisplayText(row, col) }}</span>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".dt-grid{width:100%}.dt-row{display:grid;align-items:stretch;min-width:max-content}.dt-xscroll{overflow-x:auto;overflow-y:hidden}.dt-header{background:var(--gray-white);border-bottom:var(--border);font-weight:600;color:var(--black)}.dt-cell--header{-webkit-user-select:none;user-select:none}.dt-cell--sortable{cursor:pointer}.dt-filters{background:var(--xxs-light-gray);border-bottom:var(--border)}.dt-cell--filter{padding:8px 12px}input{width:100%;padding:7px 8px;border:1px solid var(--light-gray);border-radius:var(--radius-sm);background:var(--white);color:var(--black);outline:none}input::placeholder{color:var(--xs-dark-gray)}input:focus{border-color:var(--blue);box-shadow:var(--focus-ring)}.dt-body{overflow-y:auto;overflow-x:hidden;min-width:max-content}@media(max-heicg:900px){.dt-body{max-height:none!important;overflow-y:visible!important;overflow-x:auto!important}}.dt-cell{padding:10px 12px;min-height:30px;border-bottom:1px solid var(--xxs-light-gray);display:flex;align-items:center;gap:8px;color:var(--black)}.dt-cell[data-align=left]{justify-content:flex-start;text-align:left}.dt-cell[data-align=center]{justify-content:center;text-align:center}.dt-cell[data-align=right]{justify-content:flex-end;text-align:right}.dt-cell--center,.dt-select-col{justify-content:center}.dt-header-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.dt-sort{margin-left:auto;font-size:12px;opacity:.7;color:var(--xs-dark-gray)}.dt-data:hover{background:var(--gray)}.dt-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.dt-img{width:40px;height:40px;object-fit:cover;border-radius:var(--radius-sm);border:1px solid var(--xs-light-gray);cursor:pointer}.dt-img--full{width:100%;height:auto}.dt-link{color:var(--blue);text-decoration:none;background:transparent;border:none;cursor:pointer;padding:0;font:inherit}.dt-link:hover{text-decoration:underline}.dt-badge{padding:4px 10px;border-radius:999px;border:1px solid var(--xs-light-gray);font-size:12px;background:var(--xxs-light-gray)}.dt-badge[data-variant=success]{background:#208b6a1f;border-color:#208b6a59}.dt-badge[data-variant=warn]{background:#ffbc5733;border-color:#ffbc5773}.dt-badge[data-variant=error]{background:#e600181f;border-color:#e6001859}.dt-badge[data-variant=info]{background:#7390ec24;border-color:#7390ec59}.dt-empty{padding:18px 12px;color:var(--xs-dark-gray)}.dt-actions{display:inline-flex;align-items:center;gap:6px}.dt-action-svg{width:24px;height:24px;display:inline-flex}.dt-action-svg svg{width:24px;height:24px;color:inherit}.dt-action-btn{width:32px;height:32px;border:1px solid var(--xs-light-gray);border-radius:var(--radius-sm);background:var(--white);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--xs-dark-gray)}.dt-action-btn:hover:not(:disabled){background:var(--gray-white);border-color:var(--dark-gray)}.dt-action-btn.dt-action--edit{color:var(--blue)}.dt-action-btn.dt-action--edit:hover:not(:disabled){color:var(--white);background-color:var(--blue)}.dt-action-btn.dt-action--open{color:var(--blue-medium)}.dt-action-btn.dt-action--open:hover:not(:disabled){color:var(--blue-dark)}.dt-action-btn.dt-action--copy{color:var(--xs-dark-gray)}.dt-action-btn.dt-action--copy:hover:not(:disabled){color:var(--white);background-color:var(--xs-dark-gray)}.dt-action-btn.dt-action--delete{color:var(--red)}.dt-action-btn.dt-action--delete:hover:not(:disabled){color:var(--white);background-color:var(--red)}.dt-action-btn:disabled{color:var(--disabled-text);background:var(--soft-white);cursor:not-allowed}.dt-action-text{font-size:24px;padding:0 8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
245
|
-
}
|
|
246
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: TableGridComponent, decorators: [{
|
|
247
|
-
type: Component,
|
|
248
|
-
args: [{ selector: 'table-grid', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"dt-grid\">\r\n <div class=\"dt-xscroll\">\r\n <!-- Header -->\r\n <div class=\"dt-row dt-header\" [style.gridTemplateColumns]=\"gridTemplateColumns()\">\r\n @if (showSelectionColumn()) {\r\n <div class=\"dt-cell dt-cell--header dt-cell--center dt-select-col\">\r\n @if ((config().selectionMode ?? 'multiple') === 'multiple') {\r\n <input\r\n type=\"checkbox\"\r\n [checked]=\"isAllSelectedOnPage()\"\r\n (change)=\"onToggleAllOnPage()\"\r\n aria-label=\"Seleccionar todo\"\r\n />\r\n }\r\n </div>\r\n }\r\n\r\n @for (col of columns(); track col.key) {\r\n <div\r\n class=\"dt-cell dt-cell--header\"\r\n [class.dt-cell--sortable]=\"!!col.sortable\"\r\n [attr.data-align]=\"col.align ?? 'left'\"\r\n (click)=\"onHeaderClickSort(col)\"\r\n role=\"button\"\r\n tabindex=\"0\"\r\n >\r\n <span class=\"dt-header-label\">{{ col.label }}</span>\r\n @if (col.sortable) {\r\n <span class=\"dt-sort\">{{ getSortIcon(col.key) }}</span>\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <!-- Filters row (under header) -->\r\n @if (config().columnFilters) {\r\n <div class=\"dt-row dt-filters\" [style.gridTemplateColumns]=\"gridTemplateColumns()\">\r\n @if (showSelectionColumn()) {\r\n <div class=\"dt-cell dt-cell--filter dt-select-col\"></div>\r\n }\r\n\r\n @for (col of columns(); track col.key) {\r\n <div class=\"dt-cell dt-cell--filter\" [attr.data-align]=\"col.align ?? 'left'\">\r\n @if (col.filterable) {\r\n <input\r\n type=\"text\"\r\n [value]=\"columnQueries()[col.key] ?? null\"\r\n (input)=\"onColumnQueryInput(col.key, $any($event.target).value)\"\r\n [placeholder]=\"'Filtrar ' + col.label\"\r\n />\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Body -->\r\n <div\r\n class=\"dt-body\"\r\n [style.maxHeight.px]=\"config().scroll?.heightPx ?? null\"\r\n (scroll)=\"onBodyScroll($event)\"\r\n >\r\n @if (rows().length === 0) {\r\n <div class=\"dt-empty\">\r\n {{ config().emptyText ?? 'Sin resultados' }}\r\n </div>\r\n } @else {\r\n @for (row of rows(); track getRowId(row)) {\r\n <div class=\"dt-row dt-data\" [style.gridTemplateColumns]=\"gridTemplateColumns()\">\r\n @if (showSelectionColumn()) {\r\n <div class=\"dt-cell dt-cell--center dt-select-col\">\r\n <input\r\n type=\"checkbox\"\r\n [checked]=\"isSelected(row)\"\r\n (change)=\"onToggleRow(row)\"\r\n aria-label=\"Seleccionar fila\"\r\n />\r\n </div>\r\n }\r\n\r\n @for (col of columns(); track col.key) {\r\n <div\r\n class=\"dt-cell\"\r\n [attr.data-align]=\"col.align ?? 'left'\"\r\n (click)=\"onRowClick(row)\"\r\n >\r\n @switch (col.type) {\r\n @case ('image') {\r\n @if ((col.options?.image?.hidden ?? false) === true) {\r\n <button\r\n type=\"button\"\r\n class=\"dt-link\"\r\n (click)=\"onOpenImage(getImageSrc(row, col), getImageAlt(row, col), $event)\"\r\n >\r\n Ver imagen\r\n </button>\r\n } @else {\r\n <img\r\n class=\"dt-img\"\r\n [class.dt-img--full]=\"!!col.options?.image?.showFull\"\r\n [src]=\"getImageSrc(row, col)\"\r\n [alt]=\"getImageAlt(row, col)\"\r\n (click)=\"\r\n (col.options?.image?.openInModal ?? true) &&\r\n onOpenImage(getImageSrc(row, col), getImageAlt(row, col), $event)\r\n \"\r\n />\r\n }\r\n }\r\n\r\n @case ('status') {\r\n <span class=\"dt-badge\" [attr.data-variant]=\"getStatusClass(row, col)\">\r\n {{ getDisplayText(row, col) }}\r\n </span>\r\n }\r\n\r\n @case ('link') {\r\n <a\r\n class=\"dt-link\"\r\n [href]=\"getLinkHref(row, col)\"\r\n [target]=\"col.options?.link?.target ?? '_blank'\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n {{ getLinkLabel(row, col) }}\r\n </a>\r\n }\r\n\r\n @case ('actions') {\r\n <div class=\"dt-actions\">\r\n @for (action of getColumnActions(col); track action.id) {\r\n @if (isActionVisible(action, row)) {\r\n <button\r\n type=\"button\"\r\n class=\"dt-action-btn\"\r\n [class.dt-action--edit]=\"action.id === 'edit'\"\r\n [class.dt-action--delete]=\"action.id === 'delete'\"\r\n [class.dt-action--open]=\"action.id === 'open'\"\r\n [class.dt-action--copy]=\"action.id === 'copy'\"\r\n [disabled]=\"isActionDisabled(action, row)\"\r\n [title]=\"action.tooltip ?? action.label\"\r\n (click)=\"emitAction(action, row, $event)\"\r\n >\r\n @if ((action.render ?? 'icon') === 'text') {\r\n <span class=\"dt-action-text\">{{ action.label }}</span>\r\n } @else {\r\n <span\r\n class=\"dt-action-svg\"\r\n [innerHTML]=\"getActionSvg(action)\"\r\n ></span>\r\n }\r\n </button>\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @default {\r\n <span class=\"dt-text\">{{ getDisplayText(row, col) }}</span>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".dt-grid{width:100%}.dt-row{display:grid;align-items:stretch;min-width:max-content}.dt-xscroll{overflow-x:auto;overflow-y:hidden}.dt-header{background:var(--gray-white);border-bottom:var(--border);font-weight:600;color:var(--black)}.dt-cell--header{-webkit-user-select:none;user-select:none}.dt-cell--sortable{cursor:pointer}.dt-filters{background:var(--xxs-light-gray);border-bottom:var(--border)}.dt-cell--filter{padding:8px 12px}input{width:100%;padding:7px 8px;border:1px solid var(--light-gray);border-radius:var(--radius-sm);background:var(--white);color:var(--black);outline:none}input::placeholder{color:var(--xs-dark-gray)}input:focus{border-color:var(--blue);box-shadow:var(--focus-ring)}.dt-body{overflow-y:auto;overflow-x:hidden;min-width:max-content}@media(max-heicg:900px){.dt-body{max-height:none!important;overflow-y:visible!important;overflow-x:auto!important}}.dt-cell{padding:10px 12px;min-height:30px;border-bottom:1px solid var(--xxs-light-gray);display:flex;align-items:center;gap:8px;color:var(--black)}.dt-cell[data-align=left]{justify-content:flex-start;text-align:left}.dt-cell[data-align=center]{justify-content:center;text-align:center}.dt-cell[data-align=right]{justify-content:flex-end;text-align:right}.dt-cell--center,.dt-select-col{justify-content:center}.dt-header-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.dt-sort{margin-left:auto;font-size:12px;opacity:.7;color:var(--xs-dark-gray)}.dt-data:hover{background:var(--gray)}.dt-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.dt-img{width:40px;height:40px;object-fit:cover;border-radius:var(--radius-sm);border:1px solid var(--xs-light-gray);cursor:pointer}.dt-img--full{width:100%;height:auto}.dt-link{color:var(--blue);text-decoration:none;background:transparent;border:none;cursor:pointer;padding:0;font:inherit}.dt-link:hover{text-decoration:underline}.dt-badge{padding:4px 10px;border-radius:999px;border:1px solid var(--xs-light-gray);font-size:12px;background:var(--xxs-light-gray)}.dt-badge[data-variant=success]{background:#208b6a1f;border-color:#208b6a59}.dt-badge[data-variant=warn]{background:#ffbc5733;border-color:#ffbc5773}.dt-badge[data-variant=error]{background:#e600181f;border-color:#e6001859}.dt-badge[data-variant=info]{background:#7390ec24;border-color:#7390ec59}.dt-empty{padding:18px 12px;color:var(--xs-dark-gray)}.dt-actions{display:inline-flex;align-items:center;gap:6px}.dt-action-svg{width:24px;height:24px;display:inline-flex}.dt-action-svg svg{width:24px;height:24px;color:inherit}.dt-action-btn{width:32px;height:32px;border:1px solid var(--xs-light-gray);border-radius:var(--radius-sm);background:var(--white);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--xs-dark-gray)}.dt-action-btn:hover:not(:disabled){background:var(--gray-white);border-color:var(--dark-gray)}.dt-action-btn.dt-action--edit{color:var(--blue)}.dt-action-btn.dt-action--edit:hover:not(:disabled){color:var(--white);background-color:var(--blue)}.dt-action-btn.dt-action--open{color:var(--blue-medium)}.dt-action-btn.dt-action--open:hover:not(:disabled){color:var(--blue-dark)}.dt-action-btn.dt-action--copy{color:var(--xs-dark-gray)}.dt-action-btn.dt-action--copy:hover:not(:disabled){color:var(--white);background-color:var(--xs-dark-gray)}.dt-action-btn.dt-action--delete{color:var(--red)}.dt-action-btn.dt-action--delete:hover:not(:disabled){color:var(--white);background-color:var(--red)}.dt-action-btn:disabled{color:var(--disabled-text);background:var(--soft-white);cursor:not-allowed}.dt-action-text{font-size:24px;padding:0 8px}\n"] }]
|
|
249
|
-
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], gridTemplateColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridTemplateColumns", required: false }] }], columnQueries: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnQueries", required: false }] }], sortState: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortState", required: false }] }], selectedIdsSet: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedIdsSet", required: false }] }], timeZone: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeZone", required: false }] }], headerSort: [{ type: i0.Output, args: ["headerSort"] }], columnQueryChange: [{ type: i0.Output, args: ["columnQueryChange"] }], rowClick: [{ type: i0.Output, args: ["rowClick"] }], toggleRow: [{ type: i0.Output, args: ["toggleRow"] }], toggleAllOnPage: [{ type: i0.Output, args: ["toggleAllOnPage"] }], openImage: [{ type: i0.Output, args: ["openImage"] }], actionClick: [{ type: i0.Output, args: ["actionClick"] }], bodyScroll: [{ type: i0.Output, args: ["bodyScroll"] }] } });
|
|
250
|
-
|
|
251
|
-
class TablePaginationComponent {
|
|
252
|
-
Math = Math;
|
|
253
|
-
// Inputs
|
|
254
|
-
page = input(1, ...(ngDevMode ? [{ debugName: "page" }] : []));
|
|
255
|
-
pageSize = input(10, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
|
|
256
|
-
pageCount = input(1, ...(ngDevMode ? [{ debugName: "pageCount" }] : []));
|
|
257
|
-
totalCount = input(0, ...(ngDevMode ? [{ debugName: "totalCount" }] : []));
|
|
258
|
-
pageSizeOptions = input([10, 25, 50], ...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : []));
|
|
259
|
-
pagerItems = input([], ...(ngDevMode ? [{ debugName: "pagerItems" }] : []));
|
|
260
|
-
// Outputs
|
|
261
|
-
pageChange = output();
|
|
262
|
-
pageSizeChange = output();
|
|
263
|
-
startItem = computed(() => {
|
|
264
|
-
if (this.totalCount() <= 0)
|
|
265
|
-
return 0;
|
|
266
|
-
return (this.page() - 1) * this.pageSize() + 1;
|
|
267
|
-
}, ...(ngDevMode ? [{ debugName: "startItem" }] : []));
|
|
268
|
-
endItem = computed(() => {
|
|
269
|
-
if (this.totalCount() <= 0)
|
|
270
|
-
return 0;
|
|
271
|
-
return Math.min(this.page() * this.pageSize(), this.totalCount());
|
|
272
|
-
}, ...(ngDevMode ? [{ debugName: "endItem" }] : []));
|
|
273
|
-
goToPage(page) {
|
|
274
|
-
const clamped = Math.max(1, Math.min(this.pageCount(), page));
|
|
275
|
-
this.pageChange.emit(clamped);
|
|
276
|
-
}
|
|
277
|
-
prevPage() {
|
|
278
|
-
this.goToPage(this.page() - 1);
|
|
279
|
-
}
|
|
280
|
-
nextPage() {
|
|
281
|
-
this.goToPage(this.page() + 1);
|
|
282
|
-
}
|
|
283
|
-
onPageSizeSelect(size) {
|
|
284
|
-
if (!Number.isFinite(size) || size <= 0)
|
|
285
|
-
return;
|
|
286
|
-
this.pageSizeChange.emit(size);
|
|
287
|
-
}
|
|
288
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: TablePaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
289
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: TablePaginationComponent, isStandalone: true, selector: "table-pagination", inputs: { page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, pageCount: { classPropertyName: "pageCount", publicName: "pageCount", isSignal: true, isRequired: false, transformFunction: null }, totalCount: { classPropertyName: "totalCount", publicName: "totalCount", isSignal: true, isRequired: false, transformFunction: null }, pageSizeOptions: { classPropertyName: "pageSizeOptions", publicName: "pageSizeOptions", isSignal: true, isRequired: false, transformFunction: null }, pagerItems: { classPropertyName: "pagerItems", publicName: "pagerItems", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageChange: "pageChange", pageSizeChange: "pageSizeChange" }, ngImport: i0, template: "<div class=\"dt-pagination dt-pagination--classic\">\r\n <!-- Info -->\r\n <span class=\"dt-page-info dt-hide-sm\">\r\n Mostrando {{ startItem() }} \u2013 {{ endItem() }} de {{ totalCount() }}\r\n </span>\r\n\r\n <!-- Compact info (mobile) -->\r\n <span class=\"dt-page-compact dt-show-xs\">\r\n {{ page() }} / {{ pageCount() }}\r\n </span>\r\n\r\n <!-- Rows per page -->\r\n <div class=\"dt-rows dt-hide-md\">\r\n <span>Filas:</span>\r\n <select [value]=\"pageSize()\" (change)=\"onPageSizeSelect(+$any($event.target).value)\">\r\n @for (size of pageSizeOptions(); track size) {\r\n <option [value]=\"size\">{{ size }}</option>\r\n }\r\n </select>\r\n </div>\r\n\r\n <!-- Pager -->\r\n <div class=\"dt-pager\">\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-btn dt-hide-sm\"\r\n (click)=\"goToPage(1)\"\r\n [disabled]=\"page() === 1\"\r\n aria-label=\"Primera p\u00E1gina\"\r\n >\r\n <!-- svg -->\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path\r\n fill=\"currentColor\"\r\n d=\"m11 18l-6-6l6-6l1.4 1.4L7.825 12l4.575 4.6zm6.6 0l-6-6l6-6L19 7.4L14.425 12L19 16.6z\"\r\n />\r\n </svg>\r\n </button>\r\n\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-btn\"\r\n (click)=\"prevPage()\"\r\n [disabled]=\"page() === 1\"\r\n aria-label=\"P\u00E1gina anterior\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\" d=\"m14 18l-6-6l6-6l1.4 1.4l-4.6 4.6l4.6 4.6z\" />\r\n </svg>\r\n </button>\r\n\r\n <!-- n\u00FAmeros/ellipsis: se ocultar\u00E1n en XS por CSS -->\r\n @for (item of pagerItems(); track $index) {\r\n @if (item === '\u2026') {\r\n <span class=\"dt-pager-ellipsis dt-hide-xs\">\u2026</span>\r\n } @else {\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-chip dt-hide-xs\"\r\n [class.dt-pager-chip--active]=\"item === page()\"\r\n (click)=\"goToPage(item)\"\r\n >\r\n {{ item }}\r\n </button>\r\n }\r\n }\r\n\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-btn\"\r\n (click)=\"nextPage()\"\r\n [disabled]=\"page() === pageCount()\"\r\n aria-label=\"P\u00E1gina siguiente\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\" d=\"M12.6 12L8 7.4L9.4 6l6 6l-6 6L8 16.6z\" />\r\n </svg>\r\n </button>\r\n\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-btn dt-hide-sm\"\r\n (click)=\"goToPage(pageCount())\"\r\n [disabled]=\"page() === pageCount()\"\r\n aria-label=\"\u00DAltima p\u00E1gina\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path\r\n fill=\"currentColor\"\r\n d=\"M9.575 12L5 7.4L6.4 6l6 6l-6 6L5 16.6zm6.6 0L11.6 7.4L13 6l6 6l-6 6l-1.4-1.4z\"\r\n />\r\n </svg>\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".dt-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;font-size:13px}.dt-page-info{white-space:nowrap;color:var(--xs-dark-gray)}.dt-rows{display:flex;align-items:center;gap:6px;color:var(--xs-dark-gray)}.dt-rows select{padding:6px 28px 6px 8px;border-radius:var(--radius-sm);border:1px solid var(--light-gray);background:var(--white);font-size:13px;color:var(--black)}.dt-pager{display:flex;align-items:center;gap:4px}.dt-pager-btn,.dt-pager-chip{min-width:28px;height:28px;border-radius:var(--radius-sm);border:1px solid var(--xs-light-gray);background:var(--white);cursor:pointer;font-size:13px;display:inline-flex;align-items:center;justify-content:center;line-height:1;padding:0}.dt-pager-btn:hover:not(:disabled),.dt-pager-chip:hover:not(:disabled){border-color:var(--dark-gray);background:var(--gray-white);color:var(--xs-dark-gray)}.dt-pager-chip--active{background:#3361fa;color:var(--white);border-color:var(--blue);font-weight:600}.dt-pager-chip--active:hover:not(:disabled){background:#3361fa;color:var(--white);border-color:var(--blue)}.dt-pager-btn:disabled,.dt-pager-chip:disabled{opacity:1;color:var(--disabled-text);background:var(--soft-white);border-color:var(--disabled);cursor:not-allowed}.dt-pager-ellipsis{padding:0 6px;color:var(--xs-dark-gray)}.dt-hide-xs,.dt-hide-sm,.dt-hide-md{display:inline-flex}.dt-show-xs{display:none}.dt-page-compact{white-space:nowrap;color:var(--xs-dark-gray)}@media(max-width:1200px){.dt-hide-md{display:none!important}}@media(max-width:900px){.dt-hide-sm{display:none!important}.dt-pagination{justify-content:center}}@media(max-width:640px){.dt-hide-xs{display:none!important}.dt-show-xs{display:inline-flex!important}.dt-pagination{gap:10px}.dt-pager{gap:8px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
290
|
-
}
|
|
291
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: TablePaginationComponent, decorators: [{
|
|
292
|
-
type: Component,
|
|
293
|
-
args: [{ selector: 'table-pagination', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"dt-pagination dt-pagination--classic\">\r\n <!-- Info -->\r\n <span class=\"dt-page-info dt-hide-sm\">\r\n Mostrando {{ startItem() }} \u2013 {{ endItem() }} de {{ totalCount() }}\r\n </span>\r\n\r\n <!-- Compact info (mobile) -->\r\n <span class=\"dt-page-compact dt-show-xs\">\r\n {{ page() }} / {{ pageCount() }}\r\n </span>\r\n\r\n <!-- Rows per page -->\r\n <div class=\"dt-rows dt-hide-md\">\r\n <span>Filas:</span>\r\n <select [value]=\"pageSize()\" (change)=\"onPageSizeSelect(+$any($event.target).value)\">\r\n @for (size of pageSizeOptions(); track size) {\r\n <option [value]=\"size\">{{ size }}</option>\r\n }\r\n </select>\r\n </div>\r\n\r\n <!-- Pager -->\r\n <div class=\"dt-pager\">\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-btn dt-hide-sm\"\r\n (click)=\"goToPage(1)\"\r\n [disabled]=\"page() === 1\"\r\n aria-label=\"Primera p\u00E1gina\"\r\n >\r\n <!-- svg -->\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path\r\n fill=\"currentColor\"\r\n d=\"m11 18l-6-6l6-6l1.4 1.4L7.825 12l4.575 4.6zm6.6 0l-6-6l6-6L19 7.4L14.425 12L19 16.6z\"\r\n />\r\n </svg>\r\n </button>\r\n\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-btn\"\r\n (click)=\"prevPage()\"\r\n [disabled]=\"page() === 1\"\r\n aria-label=\"P\u00E1gina anterior\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\" d=\"m14 18l-6-6l6-6l1.4 1.4l-4.6 4.6l4.6 4.6z\" />\r\n </svg>\r\n </button>\r\n\r\n <!-- n\u00FAmeros/ellipsis: se ocultar\u00E1n en XS por CSS -->\r\n @for (item of pagerItems(); track $index) {\r\n @if (item === '\u2026') {\r\n <span class=\"dt-pager-ellipsis dt-hide-xs\">\u2026</span>\r\n } @else {\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-chip dt-hide-xs\"\r\n [class.dt-pager-chip--active]=\"item === page()\"\r\n (click)=\"goToPage(item)\"\r\n >\r\n {{ item }}\r\n </button>\r\n }\r\n }\r\n\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-btn\"\r\n (click)=\"nextPage()\"\r\n [disabled]=\"page() === pageCount()\"\r\n aria-label=\"P\u00E1gina siguiente\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\" d=\"M12.6 12L8 7.4L9.4 6l6 6l-6 6L8 16.6z\" />\r\n </svg>\r\n </button>\r\n\r\n <button\r\n type=\"button\"\r\n class=\"dt-pager-btn dt-hide-sm\"\r\n (click)=\"goToPage(pageCount())\"\r\n [disabled]=\"page() === pageCount()\"\r\n aria-label=\"\u00DAltima p\u00E1gina\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path\r\n fill=\"currentColor\"\r\n d=\"M9.575 12L5 7.4L6.4 6l6 6l-6 6L5 16.6zm6.6 0L11.6 7.4L13 6l6 6l-6 6l-1.4-1.4z\"\r\n />\r\n </svg>\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".dt-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;font-size:13px}.dt-page-info{white-space:nowrap;color:var(--xs-dark-gray)}.dt-rows{display:flex;align-items:center;gap:6px;color:var(--xs-dark-gray)}.dt-rows select{padding:6px 28px 6px 8px;border-radius:var(--radius-sm);border:1px solid var(--light-gray);background:var(--white);font-size:13px;color:var(--black)}.dt-pager{display:flex;align-items:center;gap:4px}.dt-pager-btn,.dt-pager-chip{min-width:28px;height:28px;border-radius:var(--radius-sm);border:1px solid var(--xs-light-gray);background:var(--white);cursor:pointer;font-size:13px;display:inline-flex;align-items:center;justify-content:center;line-height:1;padding:0}.dt-pager-btn:hover:not(:disabled),.dt-pager-chip:hover:not(:disabled){border-color:var(--dark-gray);background:var(--gray-white);color:var(--xs-dark-gray)}.dt-pager-chip--active{background:#3361fa;color:var(--white);border-color:var(--blue);font-weight:600}.dt-pager-chip--active:hover:not(:disabled){background:#3361fa;color:var(--white);border-color:var(--blue)}.dt-pager-btn:disabled,.dt-pager-chip:disabled{opacity:1;color:var(--disabled-text);background:var(--soft-white);border-color:var(--disabled);cursor:not-allowed}.dt-pager-ellipsis{padding:0 6px;color:var(--xs-dark-gray)}.dt-hide-xs,.dt-hide-sm,.dt-hide-md{display:inline-flex}.dt-show-xs{display:none}.dt-page-compact{white-space:nowrap;color:var(--xs-dark-gray)}@media(max-width:1200px){.dt-hide-md{display:none!important}}@media(max-width:900px){.dt-hide-sm{display:none!important}.dt-pagination{justify-content:center}}@media(max-width:640px){.dt-hide-xs{display:none!important}.dt-show-xs{display:inline-flex!important}.dt-pagination{gap:10px}.dt-pager{gap:8px}}\n"] }]
|
|
294
|
-
}], propDecorators: { page: [{ type: i0.Input, args: [{ isSignal: true, alias: "page", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], pageCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageCount", required: false }] }], totalCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "totalCount", required: false }] }], pageSizeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizeOptions", required: false }] }], pagerItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagerItems", required: false }] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageSizeChange: [{ type: i0.Output, args: ["pageSizeChange"] }] } });
|
|
295
|
-
|
|
296
|
-
class TableToolbarComponent {
|
|
297
|
-
// Inputs
|
|
298
|
-
enabled = input(true, ...(ngDevMode ? [{ debugName: "enabled" }] : []));
|
|
299
|
-
query = input('', ...(ngDevMode ? [{ debugName: "query" }] : []));
|
|
300
|
-
placeholder = input('Buscar...', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
301
|
-
showClear = input(true, ...(ngDevMode ? [{ debugName: "showClear" }] : []));
|
|
302
|
-
// Outputs
|
|
303
|
-
queryChange = output();
|
|
304
|
-
clear = output();
|
|
305
|
-
onInput(value) {
|
|
306
|
-
this.queryChange.emit(value);
|
|
307
|
-
}
|
|
308
|
-
onClear() {
|
|
309
|
-
this.clear.emit();
|
|
310
|
-
}
|
|
311
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: TableToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
312
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: TableToolbarComponent, isStandalone: true, selector: "table-toolbar", inputs: { enabled: { classPropertyName: "enabled", publicName: "enabled", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { queryChange: "queryChange", clear: "clear" }, ngImport: i0, template: "@if (enabled()) {\r\n <div class=\"dt-toolbar\">\r\n <input\r\n class=\"dt-input\"\r\n type=\"text\"\r\n [placeholder]=\"placeholder()\"\r\n [value]=\"query()\"\r\n (input)=\"onInput($any($event.target).value)\"\r\n />\r\n\r\n @if (showClear()) {\r\n <button type=\"button\" class=\"dt-btn\" (click)=\"onClear()\">\r\n Limpiar\r\n </button>\r\n }\r\n </div>\r\n}\r\n", styles: [".dt-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px}.dt-input{width:100%;max-width:360px;padding:8px 10px;border-radius:var(--radius-sm);border:var(--border);outline:none}.dt-input:focus{box-shadow:0 0 0 3px #2563eb26}.dt-btn{padding:8px 10px;border-radius:var(--radius-sm);border:var(--border);background:var(--white);cursor:pointer}.dt-btn:hover{filter:brightness(.98)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
313
|
-
}
|
|
314
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: TableToolbarComponent, decorators: [{
|
|
315
|
-
type: Component,
|
|
316
|
-
args: [{ selector: 'table-toolbar', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (enabled()) {\r\n <div class=\"dt-toolbar\">\r\n <input\r\n class=\"dt-input\"\r\n type=\"text\"\r\n [placeholder]=\"placeholder()\"\r\n [value]=\"query()\"\r\n (input)=\"onInput($any($event.target).value)\"\r\n />\r\n\r\n @if (showClear()) {\r\n <button type=\"button\" class=\"dt-btn\" (click)=\"onClear()\">\r\n Limpiar\r\n </button>\r\n }\r\n </div>\r\n}\r\n", styles: [".dt-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px}.dt-input{width:100%;max-width:360px;padding:8px 10px;border-radius:var(--radius-sm);border:var(--border);outline:none}.dt-input:focus{box-shadow:0 0 0 3px #2563eb26}.dt-btn{padding:8px 10px;border-radius:var(--radius-sm);border:var(--border);background:var(--white);cursor:pointer}.dt-btn:hover{filter:brightness(.98)}\n"] }]
|
|
317
|
-
}], propDecorators: { enabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "enabled", required: false }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], showClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClear", required: false }] }], queryChange: [{ type: i0.Output, args: ["queryChange"] }], clear: [{ type: i0.Output, args: ["clear"] }] } });
|
|
318
|
-
|
|
319
|
-
class AdvancedTable {
|
|
320
|
-
// Inputs
|
|
321
|
-
columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
322
|
-
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
323
|
-
config = input({
|
|
324
|
-
globalSearch: true,
|
|
325
|
-
columnFilters: false,
|
|
326
|
-
selectable: false,
|
|
327
|
-
selectionMode: 'multiple',
|
|
328
|
-
pagination: { enabled: false, pageSize: 10, pageSizeOptions: [10, 25, 50] },
|
|
329
|
-
scroll: { mode: 'none' },
|
|
330
|
-
emptyText: 'Sin resultados',
|
|
331
|
-
rowIdKey: 'id',
|
|
332
|
-
globalSearchVisibleOnly: true,
|
|
333
|
-
}, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
334
|
-
// Outputs
|
|
335
|
-
rowClick = output();
|
|
336
|
-
selectionChange = output();
|
|
337
|
-
actionClick = output();
|
|
338
|
-
// Signals
|
|
339
|
-
globalQuery = signal('', ...(ngDevMode ? [{ debugName: "globalQuery" }] : []));
|
|
340
|
-
columnQueries = signal({}, ...(ngDevMode ? [{ debugName: "columnQueries" }] : []));
|
|
341
|
-
sortState = signal(null, ...(ngDevMode ? [{ debugName: "sortState" }] : []));
|
|
342
|
-
page = signal(1, ...(ngDevMode ? [{ debugName: "page" }] : []));
|
|
343
|
-
visibleCount = signal(0, ...(ngDevMode ? [{ debugName: "visibleCount" }] : []));
|
|
344
|
-
modalOpen = signal(false, ...(ngDevMode ? [{ debugName: "modalOpen" }] : []));
|
|
345
|
-
modalImageSrc = signal('', ...(ngDevMode ? [{ debugName: "modalImageSrc" }] : []));
|
|
346
|
-
modalImageAlt = signal('', ...(ngDevMode ? [{ debugName: "modalImageAlt" }] : []));
|
|
347
|
-
selectedIdsSet = signal(new Set(), ...(ngDevMode ? [{ debugName: "selectedIdsSet" }] : []));
|
|
348
|
-
pageSize = signal(this.config().pagination?.pageSize ?? 10, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
|
|
349
|
-
// Computed Data
|
|
350
|
-
selectedIds = computed(() => Array.from(this.selectedIdsSet()), ...(ngDevMode ? [{ debugName: "selectedIds" }] : []));
|
|
351
|
-
visibleColumns = computed(() => (this.columns() ?? []).filter((c) => !c.hidden), ...(ngDevMode ? [{ debugName: "visibleColumns" }] : []));
|
|
352
|
-
showSelectionColumn = computed(() => !!this.config().selectable, ...(ngDevMode ? [{ debugName: "showSelectionColumn" }] : []));
|
|
353
|
-
gridTemplateColumns = computed(() => {
|
|
354
|
-
const cols = [];
|
|
355
|
-
if (this.showSelectionColumn())
|
|
356
|
-
cols.push('48px'); // selección
|
|
357
|
-
for (const c of this.visibleColumns()) {
|
|
358
|
-
cols.push(this.sizeToCss(c.size));
|
|
359
|
-
}
|
|
360
|
-
return cols.join(' ');
|
|
361
|
-
}, ...(ngDevMode ? [{ debugName: "gridTemplateColumns" }] : []));
|
|
362
|
-
filteredData = computed(() => {
|
|
363
|
-
const rows = this.data() ?? [];
|
|
364
|
-
const colsAll = this.columns() ?? [];
|
|
365
|
-
const colsVisible = this.visibleColumns();
|
|
366
|
-
const config = this.config();
|
|
367
|
-
const globalQuery = this.globalQuery().trim().toLowerCase();
|
|
368
|
-
const columnQueries = this.columnQueries();
|
|
369
|
-
const colsForGlobal = (config.globalSearchVisibleOnly ?? true) ? colsVisible : colsAll.filter((c) => !c.hidden);
|
|
370
|
-
return rows.filter((row) => {
|
|
371
|
-
// column filters (AND)
|
|
372
|
-
for (const [key, q] of Object.entries(columnQueries)) {
|
|
373
|
-
const query = (q ?? '').trim().toLowerCase();
|
|
374
|
-
if (!query)
|
|
375
|
-
continue;
|
|
376
|
-
const col = colsAll.find((c) => c.key === key);
|
|
377
|
-
if (!col)
|
|
378
|
-
continue;
|
|
379
|
-
const value = this.getCellValue(row, col);
|
|
380
|
-
const text = this.valueToSearchableText(value, col.type, row).toLowerCase();
|
|
381
|
-
if (!text.includes(query))
|
|
382
|
-
return false;
|
|
383
|
-
}
|
|
384
|
-
// global search (OR across columns)
|
|
385
|
-
if (config.globalSearch && globalQuery) {
|
|
386
|
-
let any = false;
|
|
387
|
-
for (const col of colsForGlobal) {
|
|
388
|
-
const value = this.getCellValue(row, col);
|
|
389
|
-
const text = this.valueToSearchableText(value, col.type, row).toLowerCase();
|
|
390
|
-
if (text.includes(globalQuery)) {
|
|
391
|
-
any = true;
|
|
392
|
-
break;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
if (!any)
|
|
396
|
-
return false;
|
|
397
|
-
}
|
|
398
|
-
return true;
|
|
399
|
-
});
|
|
400
|
-
}, ...(ngDevMode ? [{ debugName: "filteredData" }] : []));
|
|
401
|
-
sortedData = computed(() => {
|
|
402
|
-
const data = [...this.filteredData()];
|
|
403
|
-
const sort = this.sortState();
|
|
404
|
-
if (!sort)
|
|
405
|
-
return data;
|
|
406
|
-
const col = (this.columns() ?? []).find((c) => c.key === sort.key);
|
|
407
|
-
if (!col)
|
|
408
|
-
return data;
|
|
409
|
-
const dir = sort.dir === 'asc' ? 1 : -1;
|
|
410
|
-
data.sort((a, b) => {
|
|
411
|
-
const va = this.getCellValue(a, col);
|
|
412
|
-
const vb = this.getCellValue(b, col);
|
|
413
|
-
return dir * this.compareValues(va, vb, col.type);
|
|
414
|
-
});
|
|
415
|
-
return data;
|
|
416
|
-
}, ...(ngDevMode ? [{ debugName: "sortedData" }] : []));
|
|
417
|
-
pagedData = computed(() => {
|
|
418
|
-
const config = this.config();
|
|
419
|
-
const rows = this.sortedData();
|
|
420
|
-
const fixedN = config.fixedRowCount;
|
|
421
|
-
const cappedRows = typeof fixedN === 'number' && fixedN > 0 ? rows.slice(0, fixedN) : rows;
|
|
422
|
-
const mode = config.scroll?.mode ?? 'none';
|
|
423
|
-
if (mode === 'infinite') {
|
|
424
|
-
return cappedRows.slice(0, this.visibleCount());
|
|
425
|
-
}
|
|
426
|
-
// pagination
|
|
427
|
-
if (config.pagination?.enabled) {
|
|
428
|
-
const size = this.pageSize();
|
|
429
|
-
const page = this.page();
|
|
430
|
-
const start = (page - 1) * size;
|
|
431
|
-
return cappedRows.slice(start, start + size);
|
|
432
|
-
}
|
|
433
|
-
return cappedRows;
|
|
434
|
-
}, ...(ngDevMode ? [{ debugName: "pagedData" }] : []));
|
|
435
|
-
pagerItems = computed(() => {
|
|
436
|
-
const config = this.config();
|
|
437
|
-
if (!config.pagination?.enabled)
|
|
438
|
-
return [];
|
|
439
|
-
const totalPages = this.pageCount();
|
|
440
|
-
const current = this.page();
|
|
441
|
-
if (totalPages <= 1)
|
|
442
|
-
return [];
|
|
443
|
-
if (totalPages <= 7) {
|
|
444
|
-
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
445
|
-
}
|
|
446
|
-
const items = [];
|
|
447
|
-
const first = 1;
|
|
448
|
-
const last = totalPages;
|
|
449
|
-
const around = 1;
|
|
450
|
-
const start = Math.max(2, current - around);
|
|
451
|
-
const end = Math.min(last - 1, current + around);
|
|
452
|
-
items.push(first);
|
|
453
|
-
if (start > 2)
|
|
454
|
-
items.push('…');
|
|
455
|
-
for (let p = start; p <= end; p++) {
|
|
456
|
-
items.push(p);
|
|
457
|
-
}
|
|
458
|
-
if (end < last - 1)
|
|
459
|
-
items.push('…');
|
|
460
|
-
items.push(last);
|
|
461
|
-
return items;
|
|
462
|
-
}, ...(ngDevMode ? [{ debugName: "pagerItems" }] : []));
|
|
463
|
-
totalCount = computed(() => this.sortedData().length, ...(ngDevMode ? [{ debugName: "totalCount" }] : []));
|
|
464
|
-
pageCount = computed(() => {
|
|
465
|
-
const config = this.config();
|
|
466
|
-
if (!config.pagination?.enabled)
|
|
467
|
-
return 1;
|
|
468
|
-
return Math.max(1, Math.ceil(this.totalCount() / this.pageSize()));
|
|
469
|
-
}, ...(ngDevMode ? [{ debugName: "pageCount" }] : []));
|
|
470
|
-
isAllSelectedOnPage = computed(() => {
|
|
471
|
-
if (!this.showSelectionColumn())
|
|
472
|
-
return false;
|
|
473
|
-
const ids = this.pagedData().map((r) => this.getRowId(r));
|
|
474
|
-
if (ids.length === 0)
|
|
475
|
-
return false;
|
|
476
|
-
const set = this.selectedIdsSet();
|
|
477
|
-
return ids.every((id) => set.has(id));
|
|
478
|
-
}, ...(ngDevMode ? [{ debugName: "isAllSelectedOnPage" }] : []));
|
|
479
|
-
// Effects
|
|
480
|
-
infiniteScrollEffect = effect(() => {
|
|
481
|
-
const config = this.config();
|
|
482
|
-
const mode = config.scroll?.mode ?? 'none';
|
|
483
|
-
const batch = config.scroll?.batchSize ?? 50;
|
|
484
|
-
if (mode === 'infinite') {
|
|
485
|
-
this.visibleCount.set(batch);
|
|
486
|
-
}
|
|
487
|
-
else {
|
|
488
|
-
this.visibleCount.set(Number.MAX_SAFE_INTEGER);
|
|
489
|
-
}
|
|
490
|
-
}, ...(ngDevMode ? [{ debugName: "infiniteScrollEffect" }] : []));
|
|
491
|
-
selectionDataEffect = effect(() => {
|
|
492
|
-
this.selectionChange.emit(this.selectedIds());
|
|
493
|
-
}, ...(ngDevMode ? [{ debugName: "selectionDataEffect" }] : []));
|
|
494
|
-
pagesCountEffect = effect(() => {
|
|
495
|
-
const totalPages = this.pageCount();
|
|
496
|
-
if (this.page() > totalPages) {
|
|
497
|
-
this.page.set(totalPages);
|
|
498
|
-
}
|
|
499
|
-
}, ...(ngDevMode ? [{ debugName: "pagesCountEffect" }] : []));
|
|
500
|
-
// UI Actions
|
|
501
|
-
onHeaderClickSort(col) {
|
|
502
|
-
if (!col.sortable)
|
|
503
|
-
return;
|
|
504
|
-
const current = this.sortState();
|
|
505
|
-
if (!current || current.key !== col.key) {
|
|
506
|
-
this.sortState.set({ key: col.key, dir: 'asc' });
|
|
507
|
-
}
|
|
508
|
-
else if (current.dir === 'asc') {
|
|
509
|
-
this.sortState.set({ key: col.key, dir: 'desc' });
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
this.sortState.set(null);
|
|
513
|
-
}
|
|
514
|
-
this.page.set(1);
|
|
515
|
-
}
|
|
516
|
-
onBodyScroll(event) {
|
|
517
|
-
const config = this.config();
|
|
518
|
-
if ((config.scroll?.mode ?? 'none') !== 'infinite')
|
|
519
|
-
return;
|
|
520
|
-
const el = event.target;
|
|
521
|
-
const thresholdPx = 120;
|
|
522
|
-
const nearBottom = el.scrollTop + el.clientHeight >= el.scrollHeight - thresholdPx;
|
|
523
|
-
if (!nearBottom)
|
|
524
|
-
return;
|
|
525
|
-
const batch = config.scroll?.batchSize ?? 50;
|
|
526
|
-
const next = Math.min(this.sortedData().length, this.visibleCount() + batch);
|
|
527
|
-
this.visibleCount.set(next);
|
|
528
|
-
}
|
|
529
|
-
onPageSizeChange(size) {
|
|
530
|
-
if (!Number.isFinite(size) || size <= 0)
|
|
531
|
-
return;
|
|
532
|
-
this.pageSize.set(size);
|
|
533
|
-
this.page.set(1);
|
|
534
|
-
}
|
|
535
|
-
getCellValue(row, col) {
|
|
536
|
-
try {
|
|
537
|
-
return col.valueGetter ? col.valueGetter(row) : row?.[col.key];
|
|
538
|
-
}
|
|
539
|
-
catch {
|
|
540
|
-
return undefined;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
getRowId(row) {
|
|
544
|
-
const config = this.config();
|
|
545
|
-
if (config.rowIdGetter)
|
|
546
|
-
return config.rowIdGetter(row);
|
|
547
|
-
const key = config.rowIdKey ?? 'id';
|
|
548
|
-
const value = row?.[key];
|
|
549
|
-
return (value ?? JSON.stringify(row));
|
|
550
|
-
}
|
|
551
|
-
setGlobalQuery(query) {
|
|
552
|
-
this.globalQuery.set(query ?? '');
|
|
553
|
-
this.page.set(1);
|
|
554
|
-
this.resetInfiniteIfNeeded();
|
|
555
|
-
}
|
|
556
|
-
setColumnQuery(key, query) {
|
|
557
|
-
const next = { ...this.columnQueries() };
|
|
558
|
-
next[key] = query ?? '';
|
|
559
|
-
this.columnQueries.set(next);
|
|
560
|
-
this.page.set(1);
|
|
561
|
-
this.resetInfiniteIfNeeded();
|
|
562
|
-
}
|
|
563
|
-
clearFilters() {
|
|
564
|
-
this.globalQuery.set('');
|
|
565
|
-
this.columnQueries.set({});
|
|
566
|
-
this.page.set(1);
|
|
567
|
-
this.resetInfiniteIfNeeded();
|
|
568
|
-
}
|
|
569
|
-
onRowClick(row) {
|
|
570
|
-
this.rowClick.emit(row);
|
|
571
|
-
}
|
|
572
|
-
toggleRowSelection(row) {
|
|
573
|
-
const config = this.config();
|
|
574
|
-
if (!config.selectable)
|
|
575
|
-
return;
|
|
576
|
-
const id = this.getRowId(row);
|
|
577
|
-
const mode = config.selectionMode ?? 'multiple';
|
|
578
|
-
const set = new Set(this.selectedIdsSet());
|
|
579
|
-
if (mode === 'single') {
|
|
580
|
-
if (set.has(id))
|
|
581
|
-
set.clear();
|
|
582
|
-
else {
|
|
583
|
-
set.clear();
|
|
584
|
-
set.add(id);
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
else {
|
|
588
|
-
if (set.has(id))
|
|
589
|
-
set.delete(id);
|
|
590
|
-
else
|
|
591
|
-
set.add(id);
|
|
592
|
-
}
|
|
593
|
-
this.selectedIdsSet.set(set);
|
|
594
|
-
}
|
|
595
|
-
toggleSelectAllOnPage() {
|
|
596
|
-
const config = this.config();
|
|
597
|
-
if (!config.selectable)
|
|
598
|
-
return;
|
|
599
|
-
if ((config.selectionMode ?? 'multiple') === 'single')
|
|
600
|
-
return;
|
|
601
|
-
const ids = this.pagedData().map((r) => this.getRowId(r));
|
|
602
|
-
const set = new Set(this.selectedIdsSet());
|
|
603
|
-
const allSelected = ids.every((id) => set.has(id));
|
|
604
|
-
if (allSelected)
|
|
605
|
-
ids.forEach((id) => set.delete(id));
|
|
606
|
-
else
|
|
607
|
-
ids.forEach((id) => set.add(id));
|
|
608
|
-
this.selectedIdsSet.set(set);
|
|
609
|
-
}
|
|
610
|
-
prevPage() {
|
|
611
|
-
this.page.set(Math.max(1, this.page() - 1));
|
|
612
|
-
}
|
|
613
|
-
nextPage() {
|
|
614
|
-
this.page.set(Math.min(this.pageCount(), this.page() + 1));
|
|
615
|
-
}
|
|
616
|
-
goToPage(p) {
|
|
617
|
-
const clamped = Math.max(1, Math.min(this.pageCount(), p));
|
|
618
|
-
this.page.set(clamped);
|
|
619
|
-
}
|
|
620
|
-
openImageModal(src, alt) {
|
|
621
|
-
this.modalImageSrc.set(src);
|
|
622
|
-
this.modalImageAlt.set(alt);
|
|
623
|
-
this.modalOpen.set(true);
|
|
624
|
-
}
|
|
625
|
-
closeModal() {
|
|
626
|
-
this.modalOpen.set(false);
|
|
627
|
-
this.modalImageSrc.set('');
|
|
628
|
-
this.modalImageAlt.set('');
|
|
629
|
-
}
|
|
630
|
-
// Private functions
|
|
631
|
-
resetInfiniteIfNeeded() {
|
|
632
|
-
const config = this.config();
|
|
633
|
-
if ((config.scroll?.mode ?? 'none') !== 'infinite')
|
|
634
|
-
return;
|
|
635
|
-
const batch = config.scroll?.batchSize ?? 50;
|
|
636
|
-
this.visibleCount.set(batch);
|
|
637
|
-
}
|
|
638
|
-
sizeToCss(size) {
|
|
639
|
-
switch (size) {
|
|
640
|
-
case 'XS':
|
|
641
|
-
return '80px';
|
|
642
|
-
case 'SM':
|
|
643
|
-
return '120px';
|
|
644
|
-
case 'MD':
|
|
645
|
-
return '180px';
|
|
646
|
-
case 'LG':
|
|
647
|
-
return '260px';
|
|
648
|
-
case 'XL':
|
|
649
|
-
return '360px';
|
|
650
|
-
case 'AUTO':
|
|
651
|
-
default:
|
|
652
|
-
return '1fr';
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
toNumber(value) {
|
|
656
|
-
if (typeof value === 'number')
|
|
657
|
-
return value;
|
|
658
|
-
if (typeof value === 'string') {
|
|
659
|
-
return Number(value.replace(/,/g, '').trim());
|
|
660
|
-
}
|
|
661
|
-
return Number.NaN;
|
|
662
|
-
}
|
|
663
|
-
toDate(value) {
|
|
664
|
-
if (value instanceof Date && !Number.isNaN(value.getTime()))
|
|
665
|
-
return value;
|
|
666
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
667
|
-
const date = new Date(value);
|
|
668
|
-
return Number.isNaN(date.getTime()) ? null : date;
|
|
669
|
-
}
|
|
670
|
-
return null;
|
|
671
|
-
}
|
|
672
|
-
compareValues(firstValue, secondValue, type) {
|
|
673
|
-
const firstNull = firstValue == null || firstValue === '';
|
|
674
|
-
const secondNull = secondValue == null || secondValue === '';
|
|
675
|
-
if (firstNull && secondNull)
|
|
676
|
-
return 0;
|
|
677
|
-
if (firstNull)
|
|
678
|
-
return 1;
|
|
679
|
-
if (secondNull)
|
|
680
|
-
return -1;
|
|
681
|
-
let response = null;
|
|
682
|
-
switch (type) {
|
|
683
|
-
case 'integer':
|
|
684
|
-
case 'decimal':
|
|
685
|
-
case 'currency': {
|
|
686
|
-
const firstNumber = this.toNumber(firstValue);
|
|
687
|
-
const secondNumber = this.toNumber(secondValue);
|
|
688
|
-
if (!Number.isFinite(firstNumber) && !Number.isFinite(secondNumber))
|
|
689
|
-
response = 0;
|
|
690
|
-
else if (!Number.isFinite(firstNumber))
|
|
691
|
-
response = 1;
|
|
692
|
-
else if (!Number.isFinite(secondNumber))
|
|
693
|
-
response = -1;
|
|
694
|
-
else
|
|
695
|
-
response = firstNumber === secondNumber ? 0 : firstNumber < secondNumber ? -1 : 1;
|
|
696
|
-
break;
|
|
697
|
-
}
|
|
698
|
-
case 'date':
|
|
699
|
-
case 'datetime': {
|
|
700
|
-
const firstDate = this.toDate(firstValue);
|
|
701
|
-
const toCompareDate = this.toDate(secondValue);
|
|
702
|
-
if (!firstDate && !toCompareDate)
|
|
703
|
-
response = 0;
|
|
704
|
-
else if (!firstDate)
|
|
705
|
-
response = 1;
|
|
706
|
-
else if (!toCompareDate)
|
|
707
|
-
response = -1;
|
|
708
|
-
else {
|
|
709
|
-
const ta = firstDate.getTime();
|
|
710
|
-
const tb = toCompareDate.getTime();
|
|
711
|
-
response = ta === tb ? 0 : ta < tb ? -1 : 1;
|
|
712
|
-
}
|
|
713
|
-
break;
|
|
714
|
-
}
|
|
715
|
-
case 'boolean': {
|
|
716
|
-
const firstBool = firstValue === true ? 1 : 0;
|
|
717
|
-
const secondBool = secondValue === true ? 1 : 0;
|
|
718
|
-
response = firstBool - secondBool;
|
|
719
|
-
break;
|
|
720
|
-
}
|
|
721
|
-
default: {
|
|
722
|
-
const firstString = String(firstValue).toLowerCase();
|
|
723
|
-
const secondString = String(secondValue).toLowerCase();
|
|
724
|
-
response = firstString.localeCompare(secondString, 'es');
|
|
725
|
-
break;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
return response;
|
|
729
|
-
}
|
|
730
|
-
valueToSearchableText(value, type, row) {
|
|
731
|
-
if (value == null)
|
|
732
|
-
return '';
|
|
733
|
-
if (type === 'image')
|
|
734
|
-
return '';
|
|
735
|
-
if (type === 'boolean')
|
|
736
|
-
return value === true ? 'si true yes 1' : 'no false 0';
|
|
737
|
-
return String(value);
|
|
738
|
-
}
|
|
739
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: AdvancedTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
740
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: AdvancedTable, isStandalone: true, selector: "advanced-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rowClick: "rowClick", selectionChange: "selectionChange", actionClick: "actionClick" }, ngImport: i0, template: "<div class=\"dt-container\">\r\n <div class=\"dt-toolbar\">\r\n <!-- Search and Clean -->\r\n <table-toolbar\r\n [enabled]=\"config().globalSearch ?? true\"\r\n [query]=\"globalQuery()\"\r\n placeholder=\"Buscar...\"\r\n [showClear]=\"true\"\r\n (queryChange)=\"setGlobalQuery($event)\"\r\n (clear)=\"clearFilters()\"\r\n />\r\n\r\n <!-- Pagination -->\r\n @if (config().pagination?.enabled) {\r\n <table-pagination\r\n [page]=\"page()\"\r\n [pageSize]=\"pageSize()\"\r\n [pageCount]=\"pageCount()\"\r\n [totalCount]=\"totalCount()\"\r\n [pagerItems]=\"pagerItems()\"\r\n [pageSizeOptions]=\"config().pagination!.pageSizeOptions ?? [10, 25, 50]\"\r\n (pageChange)=\"goToPage($event)\"\r\n (pageSizeChange)=\"onPageSizeChange($event)\"\r\n />\r\n }\r\n </div>\r\n\r\n <div class=\"dt-grid\">\r\n <!-- Data Table -->\r\n <table-grid\r\n [config]=\"config()\"\r\n [columns]=\"visibleColumns()\"\r\n [rows]=\"pagedData()\"\r\n [gridTemplateColumns]=\"gridTemplateColumns()\"\r\n [columnQueries]=\"columnQueries()\"\r\n [sortState]=\"sortState()\"\r\n [selectedIdsSet]=\"selectedIdsSet()\"\r\n (headerSort)=\"onHeaderClickSort($event)\"\r\n (columnQueryChange)=\"setColumnQuery($event.key, $event.value)\"\r\n (rowClick)=\"onRowClick($event)\"\r\n (toggleRow)=\"toggleRowSelection($event)\"\r\n (toggleAllOnPage)=\"toggleSelectAllOnPage()\"\r\n (openImage)=\"openImageModal($event.src, $event.alt)\"\r\n (actionClick)=\"actionClick.emit($event)\"\r\n (bodyScroll)=\"onBodyScroll($event)\"\r\n />\r\n </div>\r\n\r\n <!-- Image Modal -->\r\n <table-modal-image\r\n [open]=\"modalOpen()\"\r\n [src]=\"modalImageSrc()\"\r\n [alt]=\"modalImageAlt()\"\r\n (close)=\"closeModal()\"\r\n />\r\n</div>\r\n", styles: [":host{display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;--black: #171717;--black-light: #343434;--black-dark: #000000;--black-navy: #191a21;--xs-dark-gray: #5A5A5A;--dark-gray: #9E9E9E;--medium-gray: #D5D5D5;--gray: #F8F8F8;--light-gray: #C6C6C6;--xs-light-gray: #DFDFDF;--gray-white: #F5F4F4;--xxs-light-gray: #F2F2F2;--soft-white: #EEEEEE;--green-success: #208B6A;--blue: #3360fa;--blue-info: #7390EC;--orange: #F77C00;--yellow-warning: #FFBC57;--red: #E60018;--white: #FFFFFF;--disabled: #C6C6C6;--disabled-text: #9E9E9E;--radius-sm: 4px;--radius-md: 6px;--border: 1px solid var(--xs-light-gray);--focus-ring: 0 0 0 3px rgba(51, 96, 250, .18)}.dt-container{border:var(--border);border-radius:var(--radius-md);background:var(--white);overflow:hidden}.dt-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:var(--border);background:var(--xxs-light-gray)}.dt-empty{padding:18px 12px;color:var(--xs-dark-gray)}@media(max-width:900px){.dt-toolbar{flex-wrap:wrap;align-items:flex-start;row-gap:10px;padding:10px 12px}.dt-toolbar>b2b-table-toolbar{flex:1 1 100%}.dt-toolbar>b2b-table-pagination{flex:1 1 100%;display:flex;justify-content:center}}\n"], dependencies: [{ kind: "component", type: TableModalImageComponent, selector: "table-modal-image", inputs: ["open", "src", "alt"], outputs: ["close"] }, { kind: "component", type: TableGridComponent, selector: "table-grid", inputs: ["config", "columns", "rows", "gridTemplateColumns", "columnQueries", "sortState", "selectedIdsSet", "timeZone"], outputs: ["headerSort", "columnQueryChange", "rowClick", "toggleRow", "toggleAllOnPage", "openImage", "actionClick", "bodyScroll"] }, { kind: "component", type: TablePaginationComponent, selector: "table-pagination", inputs: ["page", "pageSize", "pageCount", "totalCount", "pageSizeOptions", "pagerItems"], outputs: ["pageChange", "pageSizeChange"] }, { kind: "component", type: TableToolbarComponent, selector: "table-toolbar", inputs: ["enabled", "query", "placeholder", "showClear"], outputs: ["queryChange", "clear"] }] });
|
|
741
|
-
}
|
|
742
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: AdvancedTable, decorators: [{
|
|
743
|
-
type: Component,
|
|
744
|
-
args: [{ selector: 'advanced-table', imports: [
|
|
745
|
-
TableModalImageComponent,
|
|
746
|
-
TableGridComponent,
|
|
747
|
-
TablePaginationComponent,
|
|
748
|
-
TableToolbarComponent,
|
|
749
|
-
], template: "<div class=\"dt-container\">\r\n <div class=\"dt-toolbar\">\r\n <!-- Search and Clean -->\r\n <table-toolbar\r\n [enabled]=\"config().globalSearch ?? true\"\r\n [query]=\"globalQuery()\"\r\n placeholder=\"Buscar...\"\r\n [showClear]=\"true\"\r\n (queryChange)=\"setGlobalQuery($event)\"\r\n (clear)=\"clearFilters()\"\r\n />\r\n\r\n <!-- Pagination -->\r\n @if (config().pagination?.enabled) {\r\n <table-pagination\r\n [page]=\"page()\"\r\n [pageSize]=\"pageSize()\"\r\n [pageCount]=\"pageCount()\"\r\n [totalCount]=\"totalCount()\"\r\n [pagerItems]=\"pagerItems()\"\r\n [pageSizeOptions]=\"config().pagination!.pageSizeOptions ?? [10, 25, 50]\"\r\n (pageChange)=\"goToPage($event)\"\r\n (pageSizeChange)=\"onPageSizeChange($event)\"\r\n />\r\n }\r\n </div>\r\n\r\n <div class=\"dt-grid\">\r\n <!-- Data Table -->\r\n <table-grid\r\n [config]=\"config()\"\r\n [columns]=\"visibleColumns()\"\r\n [rows]=\"pagedData()\"\r\n [gridTemplateColumns]=\"gridTemplateColumns()\"\r\n [columnQueries]=\"columnQueries()\"\r\n [sortState]=\"sortState()\"\r\n [selectedIdsSet]=\"selectedIdsSet()\"\r\n (headerSort)=\"onHeaderClickSort($event)\"\r\n (columnQueryChange)=\"setColumnQuery($event.key, $event.value)\"\r\n (rowClick)=\"onRowClick($event)\"\r\n (toggleRow)=\"toggleRowSelection($event)\"\r\n (toggleAllOnPage)=\"toggleSelectAllOnPage()\"\r\n (openImage)=\"openImageModal($event.src, $event.alt)\"\r\n (actionClick)=\"actionClick.emit($event)\"\r\n (bodyScroll)=\"onBodyScroll($event)\"\r\n />\r\n </div>\r\n\r\n <!-- Image Modal -->\r\n <table-modal-image\r\n [open]=\"modalOpen()\"\r\n [src]=\"modalImageSrc()\"\r\n [alt]=\"modalImageAlt()\"\r\n (close)=\"closeModal()\"\r\n />\r\n</div>\r\n", styles: [":host{display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;--black: #171717;--black-light: #343434;--black-dark: #000000;--black-navy: #191a21;--xs-dark-gray: #5A5A5A;--dark-gray: #9E9E9E;--medium-gray: #D5D5D5;--gray: #F8F8F8;--light-gray: #C6C6C6;--xs-light-gray: #DFDFDF;--gray-white: #F5F4F4;--xxs-light-gray: #F2F2F2;--soft-white: #EEEEEE;--green-success: #208B6A;--blue: #3360fa;--blue-info: #7390EC;--orange: #F77C00;--yellow-warning: #FFBC57;--red: #E60018;--white: #FFFFFF;--disabled: #C6C6C6;--disabled-text: #9E9E9E;--radius-sm: 4px;--radius-md: 6px;--border: 1px solid var(--xs-light-gray);--focus-ring: 0 0 0 3px rgba(51, 96, 250, .18)}.dt-container{border:var(--border);border-radius:var(--radius-md);background:var(--white);overflow:hidden}.dt-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:var(--border);background:var(--xxs-light-gray)}.dt-empty{padding:18px 12px;color:var(--xs-dark-gray)}@media(max-width:900px){.dt-toolbar{flex-wrap:wrap;align-items:flex-start;row-gap:10px;padding:10px 12px}.dt-toolbar>b2b-table-toolbar{flex:1 1 100%}.dt-toolbar>b2b-table-pagination{flex:1 1 100%;display:flex;justify-content:center}}\n"] }]
|
|
750
|
-
}], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], rowClick: [{ type: i0.Output, args: ["rowClick"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], actionClick: [{ type: i0.Output, args: ["actionClick"] }] } });
|
|
751
|
-
|
|
752
|
-
/*
|
|
753
|
-
* Public API Surface of b2b-tools
|
|
754
|
-
*/
|
|
755
|
-
|
|
756
|
-
/**
|
|
757
|
-
* Generated bundle index. Do not edit.
|
|
758
|
-
*/
|
|
759
|
-
|
|
760
|
-
export { AdvancedTable, SVG_ICONS, TIME_ZONES };
|
|
761
|
-
//# sourceMappingURL=b2b-tools.mjs.map
|