shirkasoft-ui-components 1.14.0 → 2.0.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/README.md +4 -8
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-button.mjs +363 -69
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
- package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-config.mjs +905 -843
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1624 -1440
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +484 -300
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +1028 -533
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-knob.mjs +389 -201
- package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -314
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +517 -327
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +1014 -819
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +1916 -1698
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -175
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +175 -49
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +687 -402
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +310 -124
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme.mjs +141 -174
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -203
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +179 -109
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +95 -134
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -165
- package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components.mjs +0 -9
- package/package.json +5 -5
- package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
- package/types/shirkasoft-ui-components-button.d.ts +142 -49
- package/types/shirkasoft-ui-components-chart.d.ts +59 -44
- package/types/shirkasoft-ui-components-config.d.ts +193 -204
- package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -66
- package/types/shirkasoft-ui-components-date-picker.d.ts +527 -398
- package/types/shirkasoft-ui-components-fieldset.d.ts +135 -60
- package/types/shirkasoft-ui-components-file-upload.d.ts +176 -112
- package/types/shirkasoft-ui-components-icons.d.ts +1302 -1294
- package/types/shirkasoft-ui-components-knob.d.ts +144 -78
- package/types/shirkasoft-ui-components-loading.d.ts +155 -64
- package/types/shirkasoft-ui-components-modal.d.ts +134 -136
- package/types/shirkasoft-ui-components-notification.d.ts +63 -59
- package/types/shirkasoft-ui-components-price-input.d.ts +198 -113
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
- package/types/shirkasoft-ui-components-select.d.ts +301 -196
- package/types/shirkasoft-ui-components-sidebar.d.ts +198 -93
- package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
- package/types/shirkasoft-ui-components-table.d.ts +849 -660
- package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
- package/types/shirkasoft-ui-components-tag.d.ts +54 -23
- package/types/shirkasoft-ui-components-text-field.d.ts +231 -127
- package/types/shirkasoft-ui-components-theme-picker.d.ts +92 -58
- package/types/shirkasoft-ui-components-theme.d.ts +56 -64
- package/types/shirkasoft-ui-components-timeline.d.ts +325 -150
- package/types/shirkasoft-ui-components-toggle.d.ts +73 -49
- package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
- package/types/shirkasoft-ui-components-utils.d.ts +15 -16
- package/types/shirkasoft-ui-components-wizard.d.ts +236 -87
- package/types/shirkasoft-ui-components.d.ts +1 -2
- package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
|
@@ -1,1706 +1,1924 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import * as i1 from
|
|
4
|
-
import { CommonModule } from
|
|
5
|
-
import {
|
|
6
|
-
import * as i2 from
|
|
7
|
-
import {
|
|
8
|
-
import { Subject, debounceTime } from
|
|
9
|
-
import {
|
|
10
|
-
import { TagComponent } from
|
|
11
|
-
import { TooltipComponent } from
|
|
12
|
-
import { getIcon, isIconResolver
|
|
13
|
-
import { ShkConfigService,
|
|
14
|
-
|
|
15
|
-
/** Match modes offered by each filter kind that has a match mode selector. */
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, HostListener, Injector, afterEveryRender, afterNextRender, computed, effect, inject, input, linkedSignal, model, output, signal, untracked } from "@angular/core";
|
|
3
|
+
import * as i1 from "@angular/common";
|
|
4
|
+
import { CommonModule } from "@angular/common";
|
|
5
|
+
import { takeUntilDestroyed, toSignal } from "@angular/core/rxjs-interop";
|
|
6
|
+
import * as i2 from "@jsverse/transloco";
|
|
7
|
+
import { TranslocoModule, TranslocoService } from "@jsverse/transloco";
|
|
8
|
+
import { Subject, debounceTime } from "rxjs";
|
|
9
|
+
import { LucideCircleCheck, LucideCircleX, LucideFunnelX, LucideInfo, LucideOctagonAlert, LucidePlus, LucideTrash2, LucideTriangleAlert, ShkIconDirective } from "shirkasoft-ui-components/icons";
|
|
10
|
+
import { TagComponent } from "shirkasoft-ui-components/tag";
|
|
11
|
+
import { TooltipComponent } from "shirkasoft-ui-components/tooltip";
|
|
12
|
+
import { PortalDirective, getIcon, isIconResolver } from "shirkasoft-ui-components/utils";
|
|
13
|
+
import { ShkConfigService, formatCurrency, formatDate, formatDateStyle, resolveDateFormat } from "shirkasoft-ui-components/config";
|
|
16
14
|
const MATCH_MODES = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
text: [
|
|
16
|
+
"startsWith",
|
|
17
|
+
"contains",
|
|
18
|
+
"notContains",
|
|
19
|
+
"endsWith",
|
|
20
|
+
"equals",
|
|
21
|
+
"notEquals"
|
|
22
|
+
],
|
|
23
|
+
numeric: [
|
|
24
|
+
"equals",
|
|
25
|
+
"notEquals",
|
|
26
|
+
"lt",
|
|
27
|
+
"lte",
|
|
28
|
+
"gt",
|
|
29
|
+
"gte"
|
|
30
|
+
],
|
|
31
|
+
date: [
|
|
32
|
+
"dateIs",
|
|
33
|
+
"dateIsNot",
|
|
34
|
+
"dateBefore",
|
|
35
|
+
"dateAfter"
|
|
36
|
+
]
|
|
20
37
|
};
|
|
21
|
-
/** Fallback labels used when the `table.filter.*` translations are missing. */
|
|
22
38
|
const FILTER_LABELS = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
startsWith: "Empieza con",
|
|
40
|
+
contains: "Contiene",
|
|
41
|
+
notContains: "No contiene",
|
|
42
|
+
endsWith: "Termina con",
|
|
43
|
+
equals: "Igual a",
|
|
44
|
+
notEquals: "Distinto de",
|
|
45
|
+
lt: "Menor que",
|
|
46
|
+
lte: "Menor o igual que",
|
|
47
|
+
gt: "Mayor que",
|
|
48
|
+
gte: "Mayor o igual que",
|
|
49
|
+
dateIs: "La fecha es",
|
|
50
|
+
dateIsNot: "La fecha no es",
|
|
51
|
+
dateBefore: "La fecha es anterior a",
|
|
52
|
+
dateAfter: "La fecha es posterior a",
|
|
53
|
+
matchAll: "Coincidir todas",
|
|
54
|
+
matchAny: "Coincidir alguna",
|
|
55
|
+
addRule: "Agregar regla",
|
|
56
|
+
removeRule: "Quitar regla",
|
|
57
|
+
apply: "Aplicar",
|
|
58
|
+
clear: "Limpiar",
|
|
59
|
+
any: "Cualquiera",
|
|
60
|
+
selectedCount: "{{count}} seleccionados",
|
|
61
|
+
yes: "Sí",
|
|
62
|
+
no: "No"
|
|
47
63
|
};
|
|
48
|
-
/**
|
|
49
|
-
* Shirkasoft UI Components.
|
|
50
|
-
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
51
|
-
* Belongs to Shirkasoft.
|
|
52
|
-
*/
|
|
53
|
-
/** Counter used to generate unique element ids per table instance. */
|
|
54
|
-
/**
|
|
55
|
-
* Angular `DatePipe` named formats accepted in `Column.dateFormat`:
|
|
56
|
-
* `[dateStyle, timeStyle?]` rendered with `Intl`.
|
|
57
|
-
*/
|
|
58
64
|
const NAMED_DATE_STYLES = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
shortDate: ["short"],
|
|
66
|
+
mediumDate: ["medium"],
|
|
67
|
+
longDate: ["long"],
|
|
68
|
+
fullDate: ["full"],
|
|
69
|
+
short: ["short", "short"],
|
|
70
|
+
medium: ["medium", "medium"],
|
|
71
|
+
long: ["long", "long"],
|
|
72
|
+
full: ["full", "full"]
|
|
67
73
|
};
|
|
68
74
|
let nextTableId = 0;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
reset() {
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
getTagIcon(col, rowData) {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.27", type: TableComponent, isStandalone: true, selector: "shk-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, rowsPerPage: { classPropertyName: "rowsPerPage", publicName: "rowsPerPage", isSignal: true, isRequired: false, transformFunction: null }, rowsPerPageOptions: { classPropertyName: "rowsPerPageOptions", publicName: "rowsPerPageOptions", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, showActionRow: { classPropertyName: "showActionRow", publicName: "showActionRow", isSignal: true, isRequired: false, transformFunction: null }, customTemplates: { classPropertyName: "customTemplates", publicName: "customTemplates", isSignal: true, isRequired: false, transformFunction: null }, headerActions: { classPropertyName: "headerActions", publicName: "headerActions", isSignal: true, isRequired: false, transformFunction: null }, rowActions: { classPropertyName: "rowActions", publicName: "rowActions", isSignal: true, isRequired: false, transformFunction: null }, hasShadow: { classPropertyName: "hasShadow", publicName: "hasShadow", isSignal: true, isRequired: false, transformFunction: null }, defaultSortField: { classPropertyName: "defaultSortField", publicName: "defaultSortField", isSignal: true, isRequired: false, transformFunction: null }, defaultSortOrder: { classPropertyName: "defaultSortOrder", publicName: "defaultSortOrder", isSignal: true, isRequired: false, transformFunction: null }, showSearch: { classPropertyName: "showSearch", publicName: "showSearch", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, globalFilterFields: { classPropertyName: "globalFilterFields", publicName: "globalFilterFields", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, serverSide: { classPropertyName: "serverSide", publicName: "serverSide", isSignal: true, isRequired: false, transformFunction: null }, totalRecords: { classPropertyName: "totalRecords", publicName: "totalRecords", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, activeFilter: { classPropertyName: "activeFilter", publicName: "activeFilter", isSignal: true, isRequired: false, transformFunction: null }, showGridlines: { classPropertyName: "showGridlines", publicName: "showGridlines", isSignal: true, isRequired: false, transformFunction: null }, resizableColumns: { classPropertyName: "resizableColumns", publicName: "resizableColumns", isSignal: true, isRequired: false, transformFunction: null }, rowValidations: { classPropertyName: "rowValidations", publicName: "rowValidations", isSignal: true, isRequired: false, transformFunction: null }, columnWidths: { classPropertyName: "columnWidths", publicName: "columnWidths", isSignal: true, isRequired: false, transformFunction: null }, stateKey: { classPropertyName: "stateKey", publicName: "stateKey", isSignal: true, isRequired: false, transformFunction: null }, stateStorage: { classPropertyName: "stateStorage", publicName: "stateStorage", isSignal: true, isRequired: false, transformFunction: null }, rowHover: { classPropertyName: "rowHover", publicName: "rowHover", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, showPageReport: { classPropertyName: "showPageReport", publicName: "showPageReport", isSignal: true, isRequired: false, transformFunction: null }, showRowsPerPage: { classPropertyName: "showRowsPerPage", publicName: "showRowsPerPage", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, isRowSelectable: { classPropertyName: "isRowSelectable", publicName: "isRowSelectable", isSignal: true, isRequired: false, transformFunction: null }, selectOnRowClick: { classPropertyName: "selectOnRowClick", publicName: "selectOnRowClick", isSignal: true, isRequired: false, transformFunction: null }, bulkActions: { classPropertyName: "bulkActions", publicName: "bulkActions", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { columnWidths: "columnWidthsChange", selection: "selectionChange", refresh: "refresh", pageChange: "pageChange", filterChange: "filterChange", searchChange: "searchChange", filterClick: "filterClick", columnResize: "columnResize" }, host: { listeners: { "document:click": "onDocumentClick()", "document:keydown.escape": "onEscape()" } }, ngImport: i0, template: "<div class=\"space-y-2 min-[1440px]:space-y-3 mt-2 min-[1440px]:mt-3 animate-fade-in pb-8\">\n @if (\n showSearch() ||\n (showClearButton() && hasFilterableColumns()) ||\n filters().length > 0 ||\n headerActions().length > 0 ||\n (selectable() && bulkActions().length > 0 && selection().length > 0)\n ) {\n <div class=\"card p-2 min-[1440px]:p-2.5 flex flex-row items-center justify-between gap-2\">\n <div class=\"flex items-center gap-2 min-[1440px]:gap-3 flex-1 min-w-0\">\n @if (showSearch()) {\n <div class=\"relative w-full md:w-52 min-[1440px]:w-56\">\n <label [for]=\"uid + '-search'\" class=\"sr-only\">{{\n searchPlaceholder() || ('common.search_placeholder' | transloco)\n }}</label>\n <div class=\"absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none\">\n <svg\n [shkIcon]=\"getIcon('search')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400\"\n ></svg>\n </div>\n <input\n [id]=\"uid + '-search'\"\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($any($event.target).value)\"\n [placeholder]=\"searchPlaceholder() || ('common.search_placeholder' | transloco)\"\n class=\"block w-full pl-8 pr-3 py-1.5 text-xs border _shk-border rounded-md leading-5 _shk-bg-surface-50 placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)] _shk-text-surface-700 focus:outline-none focus:bg-white dark:focus:[background-color:var(--shk-surface-100)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)]\"\n />\n </div>\n }\n @if (showClearButton() && (hasFilterableColumns() || showSearch())) {\n <shk-tooltip [text]=\"tr('table.clearFilters', 'Limpiar b\u00FAsqueda, filtros y orden')\">\n <button\n type=\"button\"\n (click)=\"clearAll()\"\n [disabled]=\"!hasActiveFilters()\"\n class=\"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border _shk-border _shk-text-surface-600 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed whitespace-nowrap\"\n >\n <svg [shkIcon]=\"icons.clear\" class=\"w-3.5 h-3.5\"></svg>\n {{ tr('table.clear', 'Limpiar') }}\n </button>\n </shk-tooltip>\n }\n @if (filters().length > 0) {\n <div\n class=\"flex _shk-bg-surface-100 p-0.5 rounded-md ml-auto\"\n role=\"group\"\n >\n @for (f of filters(); track f.value) {\n <button\n type=\"button\"\n (click)=\"onFilterClick(f.value)\"\n [attr.aria-pressed]=\"f.value === activeFilter()\"\n class=\"px-2.5 min-[1440px]:px-3 py-1 text-xs font-medium rounded _shk-text-surface-700 transition-all\"\n [class]=\"\n f.value === activeFilter()\n ? 'bg-white shadow-sm dark:[background-color:var(--shk-surface-700)]'\n : ''\n \"\n >\n {{ f.label }}\n </button>\n }\n </div>\n }\n </div>\n @if (selectable() && selection().length > 0 && bulkActions().length > 0) {\n <div\n class=\"flex items-center gap-1.5 shrink-0\"\n role=\"toolbar\"\n [attr.aria-label]=\"'table.selected' | transloco: { count: selection().length }\"\n >\n <span\n class=\"text-xs font-medium _shk-text-surface-600 whitespace-nowrap\"\n aria-live=\"polite\"\n >{{ 'table.selected' | transloco: { count: selection().length } }}</span\n >\n <button\n type=\"button\"\n (click)=\"clearSelection()\"\n [attr.aria-label]=\"'table.clearSelection' | transloco\"\n class=\"table-action-btn rounded-md _shk-text-surface-500 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n @for (action of visibleBulkActions(); track $index) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isBulkActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"runBulkAction(action)\"\n >\n @if (action.icon) {\n <svg [shkIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n </div>\n }\n @if (headerActions().length > 0) {\n <div class=\"flex items-center gap-1.5 shrink-0\">\n @for (action of headerActions(); track $index) {\n @if (isHeaderActionVisible(action)) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isHeaderActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"action.onClick()\"\n >\n @if (action.icon) {\n <svg [shkIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n }\n </div>\n }\n </div>\n }\n <div class=\"card p-0 overflow-hidden table-card\" [class.shadow-lg]=\"hasShadow()\">\n <div class=\"table-scroll-wrapper _shk-scrollbar\">\n <table\n class=\"shk-data-table\"\n [class.shk-gridlines]=\"showGridlines()\"\n [class.shk-row-hover]=\"rowHover()\"\n >\n <thead>\n <tr>\n @if (selectable()) {\n <th\n scope=\"col\"\n data-shk-select\n class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center _shk-bg-surface-50 border-b _shk-border\"\n >\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"allPageSelected()\"\n [indeterminate]=\"somePageSelected()\"\n [disabled]=\"loading() || selectablePageRows().length === 0\"\n (change)=\"toggleSelectAllPage()\"\n [attr.aria-label]=\"'table.selectAll' | transloco\"\n />\n </th>\n }\n @for (col of columnsWithActions(); track col.field) {\n <th\n scope=\"col\"\n (click)=\"onHeaderClick(col)\"\n (keydown)=\"onHeaderKeydown($event, col)\"\n [tabindex]=\"col.field !== 'actions' && col.sortable ? 0 : -1\"\n [attr.role]=\"col.field !== 'actions' && col.sortable ? 'button' : null\"\n [attr.aria-sort]=\"getAriaSort(col)\"\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [style.cursor]=\"col.field !== 'actions' && col.sortable ? 'pointer' : 'default'\"\n [style.width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : null)\"\n [style.min-width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : col.minWidth) || null\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n class=\"relative px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-left text-[10px] min-[1440px]:text-xs font-bold _shk-text-surface-500 uppercase tracking-wider _shk-bg-surface-50 border-b _shk-border focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n >\n @if (col.field !== 'actions') {\n <div class=\"flex items-center justify-between gap-2\">\n <span>{{ col.header }}</span>\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (col.sortable) {\n <shk-tooltip [text]=\"'table.tooltips.sort' | transloco\">\n @if (sortField() === col.field) {\n <svg\n [shkIcon]=\"getIcon(sortOrder() === 1 ? 'arrow-up' : 'arrow-down')\"\n class=\"w-3.5 h-3.5 _shk-text-primary\"\n ></svg>\n } @else {\n <svg\n [shkIcon]=\"getIcon('arrow-up-down')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400\"\n ></svg>\n }\n </shk-tooltip>\n }\n @if (col.filter) {\n <shk-tooltip [text]=\"'table.tooltips.filter' | transloco\">\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleFilter(col, $event)\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [attr.aria-expanded]=\"openFilterField() === col.field\"\n aria-haspopup=\"dialog\"\n class=\"_shk-text-surface-400 hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n >\n <svg\n [shkIcon]=\"getIcon('filter')\"\n class=\"w-3.5 h-3.5\"\n [class._shk-text-primary]=\"hasFilterValue(col.field) || openFilterField() === col.field\"\n ></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n </div>\n\n\n <!-- Column filter menu -->\n @if (col.filter && openFilterField() === col.field && filterDraft(); as draft) {\n <div\n shkPortal\n class=\"shk-filter-overlay fixed z-[9999] w-[240px] overflow-y-auto normal-case tracking-normal font-normal text-xs _shk-text-surface-700 bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border rounded-lg shadow-lg\"\n role=\"dialog\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [style.top.px]=\"filterPopupPosition().top\"\n [style.left.px]=\"filterPopupPosition().left\"\n [style.max-height.px]=\"filterPopupPosition().maxHeight\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"closeFilters()\"\n >\n @if (col.filterMenuTitle) {\n <div class=\"px-2 pt-2 font-semibold _shk-text-surface-800\">\n {{ col.filterMenuTitle }}\n </div>\n }\n @if (showOperatorFor(col)) {\n <div class=\"p-2 border-b _shk-border\">\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"filterLabel('matchAll') + ' / ' + filterLabel('matchAny')\"\n (change)=\"setDraftOperator($any($event.target).value)\"\n >\n <option value=\"and\" [selected]=\"draft.operator === 'and'\">\n {{ filterLabel('matchAll') }}\n </option>\n <option value=\"or\" [selected]=\"draft.operator === 'or'\">\n {{ filterLabel('matchAny') }}\n </option>\n </select>\n </div>\n }\n\n @switch (filterKind(col)) {\n @case ('select') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: false }\"\n ></ng-container>\n }\n @case ('multiselect') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: true }\"\n ></ng-container>\n }\n @case ('boolean') {\n @let boolValue = draft.rules[0].value;\n <div class=\"p-2\">\n <button\n type=\"button\"\n role=\"checkbox\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n class=\"inline-flex items-center gap-2 rounded-md focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n [attr.aria-checked]=\"\n boolValue === true ? 'true' : boolValue === false ? 'false' : 'mixed'\n \"\n (click)=\"cycleBoolean(col)\"\n >\n <span\n class=\"shk-checkbox-box\"\n [class.shk-checked]=\"boolValue === true || boolValue === false\"\n >\n @if (boolValue === true) {\n <svg [shkIcon]=\"getIcon('check')\"></svg>\n } @else if (boolValue === false) {\n <svg [shkIcon]=\"getIcon('x')\"></svg>\n }\n </span>\n <span>{{\n boolValue === true\n ? filterLabel('yes')\n : boolValue === false\n ? filterLabel('no')\n : filterLabel('any')\n }}</span>\n </button>\n </div>\n }\n @case ('range') {\n @let rv = rangeValue(col);\n @let bounds = rangeBounds(col);\n <div class=\"p-2\">\n <div class=\"shk-range\">\n <div class=\"shk-range-track\"></div>\n <div\n class=\"shk-range-fill\"\n [style.left.%]=\"rangePercent(col, rv[0])\"\n [style.width.%]=\"rangePercent(col, rv[1]) - rangePercent(col, rv[0])\"\n ></div>\n <input\n type=\"range\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[0]\"\n [style.z-index]=\"rv[0] >= bounds[1] ? 3 : null\"\n [attr.aria-label]=\"col.header + ' min'\"\n (input)=\"onRangeInput(col, 0, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 0, $any($event.target).value, true)\"\n />\n <input\n type=\"range\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[1]\"\n [attr.aria-label]=\"col.header + ' max'\"\n (input)=\"onRangeInput(col, 1, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 1, $any($event.target).value, true)\"\n />\n </div>\n <div class=\"flex items-center justify-between px-0.5 _shk-text-surface-500\">\n <span>{{ rv[0] }}</span>\n <span>{{ rv[1] }}</span>\n </div>\n </div>\n }\n @default {\n <!-- text / numeric / date: one block per rule -->\n @for (rule of draft.rules; track $index; let i = $index) {\n <div\n class=\"flex flex-col gap-1.5 p-2\"\n [class.border-b]=\"i < draft.rules.length - 1\"\n [class._shk-border]=\"i < draft.rules.length - 1\"\n >\n @if (showMatchModesFor(col)) {\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"col.header\"\n (change)=\"setDraftMatchMode(col, i, $any($event.target).value)\"\n >\n @for (mode of matchModesFor(col); track mode) {\n <option [value]=\"mode\" [selected]=\"mode === rule.matchMode\">\n {{ matchModeLabel(mode) }}\n </option>\n }\n </select>\n }\n <input\n [id]=\"uid + '-filter-' + safeId(col.field) + '-' + i\"\n [type]=\"filterKind(col) === 'numeric' ? 'number' : filterKind(col) === 'date' ? 'date' : 'text'\"\n [attr.step]=\"filterKind(col) === 'numeric' ? 'any' : null\"\n class=\"shk-filter-input\"\n [value]=\"rule.value ?? ''\"\n [placeholder]=\"col.filterPlaceholder || ('common.search_placeholder' | transloco)\"\n [attr.aria-label]=\"col.header\"\n (input)=\"onRuleInput(col, i, $any($event.target).value)\"\n (keydown.enter)=\"applyFilter(col)\"\n />\n @if (draft.rules.length > 1) {\n <button\n type=\"button\"\n class=\"inline-flex items-center justify-center gap-1 py-1 rounded-md [color:var(--shk-error-600)] hover:[background-color:var(--shk-error-50)] transition-colors\"\n (click)=\"removeRule(i)\"\n >\n <svg [shkIcon]=\"icons.trash\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('removeRule') }}\n </button>\n }\n </div>\n }\n @if (canAddRule(col)) {\n <div class=\"px-2 pb-1\">\n <button\n type=\"button\"\n class=\"w-full inline-flex items-center justify-center gap-1 py-1 rounded-md _shk-text-primary hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"addRule(col)\"\n >\n <svg [shkIcon]=\"getIcon('plus')\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('addRule') }}\n </button>\n </div>\n }\n }\n }\n\n <div class=\"flex items-center justify-between gap-2 p-2 border-t _shk-border\">\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md border _shk-border _shk-text-surface-600 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"clearFilter(col.field)\"\n >\n {{ filterLabel('clear') }}\n </button>\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors\"\n (click)=\"applyFilter(col)\"\n >\n {{ filterLabel('apply') }}\n </button>\n </div>\n </div>\n }\n } @else {\n <div class=\"flex items-center justify-center\">\n <span>{{ col.header }}</span>\n </div>\n }\n @if (isResizable()) {\n <span\n class=\"shk-col-resizer\"\n [class.shk-resizing]=\"resizingField() === col.field\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n [attr.aria-label]=\"tr('table.resizeColumn', 'Redimensionar columna') + ': ' + col.header\"\n [attr.aria-valuenow]=\"resizedWidthPx(col)\"\n (pointerdown)=\"startResize($event, col)\"\n (click)=\"$event.stopPropagation()\"\n (dblclick)=\"$event.stopPropagation(); resetColumnWidth(col)\"\n (keydown)=\"onResizerKeydown($event, col)\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n @if (loading()) {\n <tbody class=\"border-b _shk-border\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div\n class=\"flex items-center justify-center\"\n role=\"status\"\n [attr.aria-label]=\"'common.loading' | transloco\"\n >\n <svg\n [shkIcon]=\"getIcon('loader')\"\n class=\"w-6 h-6 animate-spin _shk-text-primary\"\n ></svg>\n </div>\n </td>\n </tr>\n </tbody>\n } @else if (effectiveDisplayedData().length === 0) {\n <tbody class=\"border-b _shk-border\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div class=\"flex flex-col items-center\">\n <div\n class=\"w-16 h-16 _shk-bg-surface-100 rounded-full flex items-center justify-center mb-4\"\n >\n <svg\n [shkIcon]=\"getIcon('inbox')\"\n class=\"w-8 h-8 _shk-text-surface-400\"\n ></svg>\n </div>\n <p\n class=\"text-lg font-semibold _shk-text-surface-600\"\n >\n {{ emptyMessage() || ('common.no_records' | transloco) }}\n </p>\n </div>\n </td>\n </tr>\n </tbody>\n } @else {\n <tbody>\n @for (rowData of effectiveDisplayedData(); track trackByRow(rowData, $index)) {\n @let rowSeverityValue = rowSeverity(rowData);\n <tr\n [attr.aria-selected]=\"selectable() ? isRowSelected(rowData) : null\"\n [class.shk-row-selected]=\"selectable() && isRowSelected(rowData)\"\n [class.shk-row-low]=\"rowSeverityValue === 'low'\"\n [class.shk-row-moderate]=\"rowSeverityValue === 'moderate'\"\n [class.shk-row-critical]=\"rowSeverityValue === 'critical'\"\n [class.cursor-pointer]=\"selectable() && selectOnRowClick() && canSelectRow(rowData)\"\n (click)=\"onRowClick($event, rowData)\"\n class=\"shk-data-row transition-colors duration-200 border-b _shk-border\"\n >\n @if (selectable()) {\n <td data-shk-select class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center\">\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"isRowSelected(rowData)\"\n [disabled]=\"!canSelectRow(rowData)\"\n (change)=\"toggleRowSelection(rowData)\"\n [attr.aria-label]=\"'table.selectRow' | transloco: { index: first() + $index + 1 }\"\n />\n </td>\n }\n @for (col of columnsWithActions(); track col.field) {\n <td\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [class]=\"\n 'px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)] ' +\n (col.field === 'actions' ? 'whitespace-nowrap' : 'whitespace-normal break-words')\n \"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n >\n @if (col.field !== 'actions') {\n @switch (col.template) {\n @case ('tag') {\n <shk-tag\n [value]=\"getTagValue(col, rowData)\"\n [severity]=\"getTagSeverity(col, rowData)\"\n [rounded]=\"getTagRounded(col, rowData)\"\n [icon]=\"getTagIcon(col, rowData)\"\n [style]=\"getTagStyle(col, rowData)\"\n />\n }\n @case ('progress') {\n <div\n class=\"shk-progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"getProgress(col, rowData)\"\n [attr.aria-label]=\"col.header\"\n >\n <div [style.width.%]=\"getProgress(col, rowData)\"></div>\n </div>\n }\n @case ('boolean') {\n @if (resolveField(rowData, col.field)) {\n <svg\n [shkIcon]=\"icons.yes\"\n class=\"w-4 h-4 [color:var(--shk-success-600)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('yes')\"\n ></svg>\n } @else {\n <svg\n [shkIcon]=\"icons.no\"\n class=\"w-4 h-4 [color:var(--shk-error-500)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('no')\"\n ></svg>\n }\n }\n @case ('date') {\n {{ formatDateCell(resolveField(rowData, col.field), col) }}\n }\n @case ('currency') {\n {{ formatCurrencyCell(resolveField(rowData, col.field), col) }}\n }\n @default {\n @if (col.image) {\n <div class=\"flex items-center gap-2\">\n @if (col.image(rowData); as src) {\n <img\n [src]=\"src\"\n alt=\"\"\n [width]=\"col.imageWidth || 24\"\n class=\"shrink-0 rounded-sm\"\n />\n }\n <span>\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n </span>\n </div>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n }\n }\n }\n } @else {\n <div class=\"flex items-center justify-start gap-px\">\n @for (action of getVisibleRowActions(rowData); track $index) {\n @if (isRowActionVisible(action, rowData)) {\n <div class=\"relative group\">\n <shk-tooltip\n [text]=\"getRowActionLabel(action, rowData)\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData)\"\n [class]=\"\n 'table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md ' +\n getRowActionClass(action, rowData)\n \"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [attr.aria-label]=\"getRowActionLabel(action, rowData)\"\n >\n <svg\n [shkIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n </div>\n }\n }\n @if (getHiddenRowActions(rowData).length > 0) {\n <div class=\"relative\">\n <shk-tooltip\n [text]=\"'common.more_options' | transloco\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleActionsDropdown(rowData, $event)\"\n class=\"table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md\"\n [attr.aria-label]=\"'common.more_options' | transloco\"\n [attr.aria-expanded]=\"isActionsDropdownOpen(rowData)\"\n >\n <svg\n [shkIcon]=\"getIcon('ellipsis-vertical')\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n @if (isActionsDropdownOpen(rowData)) {\n <div\n shkPortal\n class=\"fixed z-[9999] min-w-[160px] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border rounded-md shadow-lg py-1\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n >\n @for (action of getHiddenRowActions(rowData); track $index) {\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData); toggleActionsDropdown(rowData)\"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [class]=\"\n 'w-full flex items-center gap-2 px-3 py-2 text-xs text-left _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors ' +\n getRowActionClass(action, rowData)\n \"\n >\n <svg\n [shkIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-3.5 h-3.5 shrink-0\"\n ></svg>\n <span>{{ getRowActionLabel(action, rowData) }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n @if (rowSeverityValue) {\n <div class=\"relative group\">\n <shk-tooltip [text]=\"rowValidationTitle(rowData) || ''\" position=\"top\">\n <span\n class=\"shk-row-validation-btn\"\n [class.shk-sev-low]=\"rowSeverityValue === 'low'\"\n [class.shk-sev-moderate]=\"rowSeverityValue === 'moderate'\"\n [class.shk-sev-critical]=\"rowSeverityValue === 'critical'\"\n tabindex=\"0\"\n role=\"note\"\n [attr.aria-label]=\"rowValidationLabel(rowData)\"\n >\n <svg [shkIcon]=\"rowValidationIcon(rowData)\"></svg>\n </span>\n </shk-tooltip>\n </div>\n }\n </div>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n }\n </table>\n\n <!-- Text content of a cell: format() \u00B7 custom template \u00B7 raw value -->\n <ng-template #cellText let-rowData let-col=\"col\">\n @if (col.format) {\n <span>{{ col.format(rowData) }}</span>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplates()[col.field] || defaultTemplate;\n context: { $implicit: rowData, field: col.field }\n \"\n ></ng-container>\n }\n </ng-template>\n <ng-template #defaultTemplate let-rowData let-field=\"field\">\n {{ resolveField(rowData, field) }}\n </ng-template>\n\n <!-- Option list of the select / multiselect filters -->\n <ng-template #optionList let-col let-draft=\"draft\" let-multiple=\"multiple\">\n <div class=\"p-2 space-y-1.5\">\n @let selectedLabel = multiple ? selectedOptionsLabel(col) : selectedSingleLabel(col);\n <button\n type=\"button\"\n class=\"shk-filter-select flex items-center justify-between gap-2 text-left\"\n style=\"background-image: none\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [attr.aria-expanded]=\"multiselectOpen()\"\n (click)=\"multiselectOpen.set(!multiselectOpen())\"\n >\n <span class=\"truncate\" [class._shk-text-surface-400]=\"!selectedLabel\">\n {{ selectedLabel || tr('table.filterAll', 'Todos') }}\n </span>\n <svg\n [shkIcon]=\"getIcon('chevron-down')\"\n class=\"w-3.5 h-3.5 shrink-0 _shk-text-surface-400 transition-transform\"\n [class.rotate-180]=\"multiselectOpen()\"\n ></svg>\n </button>\n @if (multiselectOpen()) {\n <div\n class=\"max-h-52 overflow-y-auto p-0.5 border _shk-border rounded-md _shk-scrollbar\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple\"\n >\n @for (opt of col.filterOptions || []; track $index) {\n @let isSelected = multiple\n ? isOptionSelected(opt.value)\n : draft.rules[0].value != null && draft.rules[0].value == opt.value;\n <button\n type=\"button\"\n role=\"option\"\n class=\"w-full flex items-center gap-2 px-2 py-1.5 rounded text-left transition-colors hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [class._shk-bg-primary-soft]=\"isSelected\"\n [class._shk-text-primary-700]=\"isSelected\"\n [attr.aria-selected]=\"isSelected\"\n (click)=\"multiple ? toggleOption(col, opt.value) : selectOption(col, opt.value)\"\n >\n @if (multiple) {\n <span class=\"shk-checkbox-box\" [class.shk-checked]=\"isSelected\">\n @if (isSelected) {\n <svg [shkIcon]=\"getIcon('check')\"></svg>\n }\n </span>\n }\n @if (opt.image) {\n <img [src]=\"opt.image\" alt=\"\" width=\"22\" class=\"shrink-0 rounded-sm\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n </ng-template>\n </div>\n <div\n class=\"table-pagination flex items-center justify-between gap-4 px-2 min-[1440px]:px-3 py-2 border-t _shk-border\"\n >\n <div class=\"text-xs _shk-text-surface-600\">\n @if (showPageReport()) {\n {{ pageReport() }}\n }\n </div>\n <div\n class=\"flex items-center gap-0.5\"\n role=\"navigation\"\n >\n <button\n type=\"button\"\n (click)=\"goToFirst()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.firstPage', 'Primera p\u00E1gina')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevrons-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"prev()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.prevPage', 'P\u00E1gina anterior')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span\n class=\"px-2 text-xs font-medium _shk-text-surface-700\"\n >{{ currentPage() }} / {{ totalPages() }}</span\n >\n <button\n type=\"button\"\n (click)=\"next()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.nextPage', 'P\u00E1gina siguiente')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"goToLast()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.lastPage', '\u00DAltima p\u00E1gina')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevrons-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n <div\n class=\"flex items-center gap-1.5 text-xs _shk-text-surface-600\"\n >\n @if (showRowsPerPage()) {\n <label [for]=\"uid + '-rows-per-page'\">{{ 'table.rows' | transloco }}</label>\n <select\n [id]=\"uid + '-rows-per-page'\"\n (change)=\"onRowsPerPageChange($any($event.target).value)\"\n class=\"border _shk-border rounded px-2 py-1 text-xs bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 focus:outline-none focus:[border-color:var(--shk-primary-500)]\"\n >\n @for (opt of rowsPerPageOptions(); track opt) {\n <option [value]=\"opt\" [selected]=\"opt === rowsPerPageLocal()\">{{ opt }}</option>\n }\n </select>\n }\n </div>\n </div>\n </div>\n</div>\n", styles: ["input:focus{outline:none}input[type=text]{font-weight:400!important}table th{white-space:nowrap}table td{white-space:normal;overflow-wrap:break-word}.shk-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.375rem;transition:background-color .15s ease,color .15s ease}.shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.shk-page-btn:focus-visible{outline:none;box-shadow:0 0 0 2px color-mix(in srgb,var(--shk-primary-500) 45%,transparent)}td button svg{width:1.125rem!important;height:1.125rem!important}td button:disabled{opacity:.4;cursor:not-allowed}.table-action-btn svg{width:1rem!important;height:1rem!important;min-width:1rem!important;min-height:1rem!important}.table-action-btn{padding:.5rem!important;min-width:2rem!important;min-height:2rem!important;display:inline-flex!important;align-items:center!important;justify-content:center!important}.table-scroll-wrapper{width:100%;overflow-x:auto;overflow-y:hidden;border-radius:inherit;-webkit-overflow-scrolling:touch;container-type:inline-size}.table-card,.table-pagination{container-type:inline-size}@container (max-width: 640px){.table-pagination{flex-direction:column;align-items:center;gap:.5rem}.table-pagination>div{justify-content:center}}.table-scroll-wrapper table{table-layout:auto;width:100%}@container (max-width: 768px){.table-scroll-wrapper{scroll-snap-type:x mandatory}.table-scroll-wrapper table{table-layout:auto;width:100%}.table-scroll-wrapper th:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px)}.table-scroll-wrapper td:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px);max-width:var(--shk-col-width, 140px)}.table-scroll-wrapper th,.table-scroll-wrapper td{scroll-snap-align:start}}th[data-shk-select],td[data-shk-select]{width:2.5rem;min-width:2.5rem}.shk-table-checkbox{width:.875rem;height:.875rem;cursor:pointer;vertical-align:middle;accent-color:var(--shk-primary-500)}.shk-table-checkbox:disabled{opacity:.4;cursor:not-allowed}tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-50) 60%,transparent)}tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 90%,transparent)}:host-context(.dark) tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-900) 20%,transparent)}:host-context(.dark) tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 30%,transparent)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.shk-data-table tr.shk-row-low{background-color:color-mix(in srgb,var(--shk-info-600) 22%,transparent)}.shk-data-table tr.shk-row-moderate{background-color:color-mix(in srgb,var(--shk-warning-400) 32%,transparent)}.shk-data-table tr.shk-row-critical{background-color:color-mix(in srgb,var(--shk-error-500) 20%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-low{background-color:color-mix(in srgb,var(--shk-info-600) 26%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-moderate{background-color:color-mix(in srgb,var(--shk-warning-400) 34%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-critical{background-color:color-mix(in srgb,var(--shk-error-500) 24%,transparent)}.shk-row-validation-btn{display:inline-flex;align-items:center;justify-content:center;padding:.25rem;border-radius:.375rem;cursor:help;color:var(--shk-surface-500)}.shk-row-validation-btn svg{width:1rem!important;height:1rem!important}.shk-row-validation-btn.shk-sev-low{color:var(--shk-info-600)}.shk-row-validation-btn.shk-sev-moderate{color:var(--shk-warning-600)}:host-context(.dark) .shk-row-validation-btn.shk-sev-moderate{color:var(--shk-warning-400)}.shk-row-validation-btn.shk-sev-critical{color:var(--shk-error-500)}.shk-row-validation-btn:focus-visible{outline:2px solid currentColor;outline-offset:1px}table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 30%,transparent)}:host-context(.dark) table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 10%,transparent)}table.shk-gridlines th,table.shk-gridlines td{border-right:1px solid var(--shk-surface-200)}table.shk-gridlines th:last-child,table.shk-gridlines td:last-child{border-right:0}:host-context(.dark) table.shk-gridlines th,:host-context(.dark) table.shk-gridlines td{border-right-color:var(--shk-surface-200)}.shk-col-resizer{position:absolute;top:0;right:-4px;z-index:1;width:8px;height:100%;cursor:col-resize;touch-action:none}.shk-col-resizer:after{content:\"\";position:absolute;top:20%;bottom:20%;left:3px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.shk-col-resizer:hover:after,.shk-col-resizer:focus-visible:after,.shk-col-resizer.shk-resizing:after{background-color:var(--shk-primary-500)}.shk-col-resizer:focus-visible{outline:none}th:last-child .shk-col-resizer{right:0}.shk-filter-input,.shk-filter-select{width:100%;padding:.375rem .625rem;font-size:.75rem;line-height:1.25rem;border-radius:.375rem;border:1px solid var(--shk-surface-200);background-color:#fff;color:var(--shk-surface-700)}.dark .shk-filter-input,.dark .shk-filter-select{background-color:var(--shk-surface-100);border-color:var(--shk-surface-200);color-scheme:dark}.shk-filter-input::placeholder{color:var(--shk-surface-400)}select.shk-filter-select{appearance:none;padding-right:1.75rem;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .5rem center;cursor:pointer}button.shk-filter-select{cursor:pointer}.shk-filter-input:focus,.shk-filter-select:focus{outline:none;border-color:var(--shk-primary-500);box-shadow:0 0 0 1px var(--shk-primary-500)}.shk-checkbox-box{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:.875rem;height:.875rem;border-radius:.1875rem;border:1px solid var(--shk-surface-300);background-color:#fff;color:#fff}.dark .shk-checkbox-box{background-color:var(--shk-surface-100)}.shk-checkbox-box.shk-checked{background-color:var(--shk-primary-500);border-color:var(--shk-primary-500)}.shk-checkbox-box svg{width:.625rem;height:.625rem}.shk-range{position:relative;height:1rem;margin:.5rem .375rem .375rem}.shk-range-track,.shk-range-fill{position:absolute;top:50%;height:.1875rem;transform:translateY(-50%);border-radius:9999px}.shk-range-track{left:0;right:0;background-color:var(--shk-surface-200)}.shk-range-fill{background-color:var(--shk-primary-500)}.shk-range input[type=range]{position:absolute;inset:0;width:100%;margin:0;background:transparent;pointer-events:none;appearance:none;-webkit-appearance:none}.shk-range input[type=range]::-webkit-slider-thumb{pointer-events:auto;-webkit-appearance:none;width:.875rem;height:.875rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-range input[type=range]::-moz-range-thumb{pointer-events:auto;width:.625rem;height:.625rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-progress{height:.375rem;min-width:5rem;border-radius:9999px;background-color:var(--shk-surface-200);overflow:hidden}.shk-progress>div{height:100%;border-radius:inherit;background-color:var(--shk-primary-500)}\n"], dependencies: [{ kind: "directive", type: PortalDirective, selector: "[shkPortal]" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: ShkIconDirective, selector: "svg[shkIcon]", inputs: ["shkIcon", "size", "strokeWidth", "color"] }, { kind: "component", type: TagComponent, selector: "shk-tag", inputs: ["value", "severity", "rounded", "icon", "style", "styleClass"] }, { kind: "component", type: TooltipComponent, selector: "shk-tooltip", inputs: ["text", "position", "mode", "offset"] }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
], template: "<div class=\"space-y-2 min-[1440px]:space-y-3 mt-2 min-[1440px]:mt-3 animate-fade-in pb-8\">\n @if (\n showSearch() ||\n (showClearButton() && hasFilterableColumns()) ||\n filters().length > 0 ||\n headerActions().length > 0 ||\n (selectable() && bulkActions().length > 0 && selection().length > 0)\n ) {\n <div class=\"card p-2 min-[1440px]:p-2.5 flex flex-row items-center justify-between gap-2\">\n <div class=\"flex items-center gap-2 min-[1440px]:gap-3 flex-1 min-w-0\">\n @if (showSearch()) {\n <div class=\"relative w-full md:w-52 min-[1440px]:w-56\">\n <label [for]=\"uid + '-search'\" class=\"sr-only\">{{\n searchPlaceholder() || ('common.search_placeholder' | transloco)\n }}</label>\n <div class=\"absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none\">\n <svg\n [shkIcon]=\"getIcon('search')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400\"\n ></svg>\n </div>\n <input\n [id]=\"uid + '-search'\"\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($any($event.target).value)\"\n [placeholder]=\"searchPlaceholder() || ('common.search_placeholder' | transloco)\"\n class=\"block w-full pl-8 pr-3 py-1.5 text-xs border _shk-border rounded-md leading-5 _shk-bg-surface-50 placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)] _shk-text-surface-700 focus:outline-none focus:bg-white dark:focus:[background-color:var(--shk-surface-100)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)]\"\n />\n </div>\n }\n @if (showClearButton() && (hasFilterableColumns() || showSearch())) {\n <shk-tooltip [text]=\"tr('table.clearFilters', 'Limpiar b\u00FAsqueda, filtros y orden')\">\n <button\n type=\"button\"\n (click)=\"clearAll()\"\n [disabled]=\"!hasActiveFilters()\"\n class=\"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border _shk-border _shk-text-surface-600 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed whitespace-nowrap\"\n >\n <svg [shkIcon]=\"icons.clear\" class=\"w-3.5 h-3.5\"></svg>\n {{ tr('table.clear', 'Limpiar') }}\n </button>\n </shk-tooltip>\n }\n @if (filters().length > 0) {\n <div\n class=\"flex _shk-bg-surface-100 p-0.5 rounded-md ml-auto\"\n role=\"group\"\n >\n @for (f of filters(); track f.value) {\n <button\n type=\"button\"\n (click)=\"onFilterClick(f.value)\"\n [attr.aria-pressed]=\"f.value === activeFilter()\"\n class=\"px-2.5 min-[1440px]:px-3 py-1 text-xs font-medium rounded _shk-text-surface-700 transition-all\"\n [class]=\"\n f.value === activeFilter()\n ? 'bg-white shadow-sm dark:[background-color:var(--shk-surface-700)]'\n : ''\n \"\n >\n {{ f.label }}\n </button>\n }\n </div>\n }\n </div>\n @if (selectable() && selection().length > 0 && bulkActions().length > 0) {\n <div\n class=\"flex items-center gap-1.5 shrink-0\"\n role=\"toolbar\"\n [attr.aria-label]=\"'table.selected' | transloco: { count: selection().length }\"\n >\n <span\n class=\"text-xs font-medium _shk-text-surface-600 whitespace-nowrap\"\n aria-live=\"polite\"\n >{{ 'table.selected' | transloco: { count: selection().length } }}</span\n >\n <button\n type=\"button\"\n (click)=\"clearSelection()\"\n [attr.aria-label]=\"'table.clearSelection' | transloco\"\n class=\"table-action-btn rounded-md _shk-text-surface-500 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n @for (action of visibleBulkActions(); track $index) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isBulkActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"runBulkAction(action)\"\n >\n @if (action.icon) {\n <svg [shkIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n </div>\n }\n @if (headerActions().length > 0) {\n <div class=\"flex items-center gap-1.5 shrink-0\">\n @for (action of headerActions(); track $index) {\n @if (isHeaderActionVisible(action)) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isHeaderActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"action.onClick()\"\n >\n @if (action.icon) {\n <svg [shkIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n }\n </div>\n }\n </div>\n }\n <div class=\"card p-0 overflow-hidden table-card\" [class.shadow-lg]=\"hasShadow()\">\n <div class=\"table-scroll-wrapper _shk-scrollbar\">\n <table\n class=\"shk-data-table\"\n [class.shk-gridlines]=\"showGridlines()\"\n [class.shk-row-hover]=\"rowHover()\"\n >\n <thead>\n <tr>\n @if (selectable()) {\n <th\n scope=\"col\"\n data-shk-select\n class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center _shk-bg-surface-50 border-b _shk-border\"\n >\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"allPageSelected()\"\n [indeterminate]=\"somePageSelected()\"\n [disabled]=\"loading() || selectablePageRows().length === 0\"\n (change)=\"toggleSelectAllPage()\"\n [attr.aria-label]=\"'table.selectAll' | transloco\"\n />\n </th>\n }\n @for (col of columnsWithActions(); track col.field) {\n <th\n scope=\"col\"\n (click)=\"onHeaderClick(col)\"\n (keydown)=\"onHeaderKeydown($event, col)\"\n [tabindex]=\"col.field !== 'actions' && col.sortable ? 0 : -1\"\n [attr.role]=\"col.field !== 'actions' && col.sortable ? 'button' : null\"\n [attr.aria-sort]=\"getAriaSort(col)\"\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [style.cursor]=\"col.field !== 'actions' && col.sortable ? 'pointer' : 'default'\"\n [style.width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : null)\"\n [style.min-width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : col.minWidth) || null\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n class=\"relative px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-left text-[10px] min-[1440px]:text-xs font-bold _shk-text-surface-500 uppercase tracking-wider _shk-bg-surface-50 border-b _shk-border focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n >\n @if (col.field !== 'actions') {\n <div class=\"flex items-center justify-between gap-2\">\n <span>{{ col.header }}</span>\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (col.sortable) {\n <shk-tooltip [text]=\"'table.tooltips.sort' | transloco\">\n @if (sortField() === col.field) {\n <svg\n [shkIcon]=\"getIcon(sortOrder() === 1 ? 'arrow-up' : 'arrow-down')\"\n class=\"w-3.5 h-3.5 _shk-text-primary\"\n ></svg>\n } @else {\n <svg\n [shkIcon]=\"getIcon('arrow-up-down')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400\"\n ></svg>\n }\n </shk-tooltip>\n }\n @if (col.filter) {\n <shk-tooltip [text]=\"'table.tooltips.filter' | transloco\">\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleFilter(col, $event)\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [attr.aria-expanded]=\"openFilterField() === col.field\"\n aria-haspopup=\"dialog\"\n class=\"_shk-text-surface-400 hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n >\n <svg\n [shkIcon]=\"getIcon('filter')\"\n class=\"w-3.5 h-3.5\"\n [class._shk-text-primary]=\"hasFilterValue(col.field) || openFilterField() === col.field\"\n ></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n </div>\n\n\n <!-- Column filter menu -->\n @if (col.filter && openFilterField() === col.field && filterDraft(); as draft) {\n <div\n shkPortal\n class=\"shk-filter-overlay fixed z-[9999] w-[240px] overflow-y-auto normal-case tracking-normal font-normal text-xs _shk-text-surface-700 bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border rounded-lg shadow-lg\"\n role=\"dialog\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [style.top.px]=\"filterPopupPosition().top\"\n [style.left.px]=\"filterPopupPosition().left\"\n [style.max-height.px]=\"filterPopupPosition().maxHeight\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"closeFilters()\"\n >\n @if (col.filterMenuTitle) {\n <div class=\"px-2 pt-2 font-semibold _shk-text-surface-800\">\n {{ col.filterMenuTitle }}\n </div>\n }\n @if (showOperatorFor(col)) {\n <div class=\"p-2 border-b _shk-border\">\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"filterLabel('matchAll') + ' / ' + filterLabel('matchAny')\"\n (change)=\"setDraftOperator($any($event.target).value)\"\n >\n <option value=\"and\" [selected]=\"draft.operator === 'and'\">\n {{ filterLabel('matchAll') }}\n </option>\n <option value=\"or\" [selected]=\"draft.operator === 'or'\">\n {{ filterLabel('matchAny') }}\n </option>\n </select>\n </div>\n }\n\n @switch (filterKind(col)) {\n @case ('select') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: false }\"\n ></ng-container>\n }\n @case ('multiselect') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: true }\"\n ></ng-container>\n }\n @case ('boolean') {\n @let boolValue = draft.rules[0].value;\n <div class=\"p-2\">\n <button\n type=\"button\"\n role=\"checkbox\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n class=\"inline-flex items-center gap-2 rounded-md focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n [attr.aria-checked]=\"\n boolValue === true ? 'true' : boolValue === false ? 'false' : 'mixed'\n \"\n (click)=\"cycleBoolean(col)\"\n >\n <span\n class=\"shk-checkbox-box\"\n [class.shk-checked]=\"boolValue === true || boolValue === false\"\n >\n @if (boolValue === true) {\n <svg [shkIcon]=\"getIcon('check')\"></svg>\n } @else if (boolValue === false) {\n <svg [shkIcon]=\"getIcon('x')\"></svg>\n }\n </span>\n <span>{{\n boolValue === true\n ? filterLabel('yes')\n : boolValue === false\n ? filterLabel('no')\n : filterLabel('any')\n }}</span>\n </button>\n </div>\n }\n @case ('range') {\n @let rv = rangeValue(col);\n @let bounds = rangeBounds(col);\n <div class=\"p-2\">\n <div class=\"shk-range\">\n <div class=\"shk-range-track\"></div>\n <div\n class=\"shk-range-fill\"\n [style.left.%]=\"rangePercent(col, rv[0])\"\n [style.width.%]=\"rangePercent(col, rv[1]) - rangePercent(col, rv[0])\"\n ></div>\n <input\n type=\"range\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[0]\"\n [style.z-index]=\"rv[0] >= bounds[1] ? 3 : null\"\n [attr.aria-label]=\"col.header + ' min'\"\n (input)=\"onRangeInput(col, 0, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 0, $any($event.target).value, true)\"\n />\n <input\n type=\"range\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[1]\"\n [attr.aria-label]=\"col.header + ' max'\"\n (input)=\"onRangeInput(col, 1, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 1, $any($event.target).value, true)\"\n />\n </div>\n <div class=\"flex items-center justify-between px-0.5 _shk-text-surface-500\">\n <span>{{ rv[0] }}</span>\n <span>{{ rv[1] }}</span>\n </div>\n </div>\n }\n @default {\n <!-- text / numeric / date: one block per rule -->\n @for (rule of draft.rules; track $index; let i = $index) {\n <div\n class=\"flex flex-col gap-1.5 p-2\"\n [class.border-b]=\"i < draft.rules.length - 1\"\n [class._shk-border]=\"i < draft.rules.length - 1\"\n >\n @if (showMatchModesFor(col)) {\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"col.header\"\n (change)=\"setDraftMatchMode(col, i, $any($event.target).value)\"\n >\n @for (mode of matchModesFor(col); track mode) {\n <option [value]=\"mode\" [selected]=\"mode === rule.matchMode\">\n {{ matchModeLabel(mode) }}\n </option>\n }\n </select>\n }\n <input\n [id]=\"uid + '-filter-' + safeId(col.field) + '-' + i\"\n [type]=\"filterKind(col) === 'numeric' ? 'number' : filterKind(col) === 'date' ? 'date' : 'text'\"\n [attr.step]=\"filterKind(col) === 'numeric' ? 'any' : null\"\n class=\"shk-filter-input\"\n [value]=\"rule.value ?? ''\"\n [placeholder]=\"col.filterPlaceholder || ('common.search_placeholder' | transloco)\"\n [attr.aria-label]=\"col.header\"\n (input)=\"onRuleInput(col, i, $any($event.target).value)\"\n (keydown.enter)=\"applyFilter(col)\"\n />\n @if (draft.rules.length > 1) {\n <button\n type=\"button\"\n class=\"inline-flex items-center justify-center gap-1 py-1 rounded-md [color:var(--shk-error-600)] hover:[background-color:var(--shk-error-50)] transition-colors\"\n (click)=\"removeRule(i)\"\n >\n <svg [shkIcon]=\"icons.trash\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('removeRule') }}\n </button>\n }\n </div>\n }\n @if (canAddRule(col)) {\n <div class=\"px-2 pb-1\">\n <button\n type=\"button\"\n class=\"w-full inline-flex items-center justify-center gap-1 py-1 rounded-md _shk-text-primary hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"addRule(col)\"\n >\n <svg [shkIcon]=\"getIcon('plus')\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('addRule') }}\n </button>\n </div>\n }\n }\n }\n\n <div class=\"flex items-center justify-between gap-2 p-2 border-t _shk-border\">\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md border _shk-border _shk-text-surface-600 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"clearFilter(col.field)\"\n >\n {{ filterLabel('clear') }}\n </button>\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors\"\n (click)=\"applyFilter(col)\"\n >\n {{ filterLabel('apply') }}\n </button>\n </div>\n </div>\n }\n } @else {\n <div class=\"flex items-center justify-center\">\n <span>{{ col.header }}</span>\n </div>\n }\n @if (isResizable()) {\n <span\n class=\"shk-col-resizer\"\n [class.shk-resizing]=\"resizingField() === col.field\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n [attr.aria-label]=\"tr('table.resizeColumn', 'Redimensionar columna') + ': ' + col.header\"\n [attr.aria-valuenow]=\"resizedWidthPx(col)\"\n (pointerdown)=\"startResize($event, col)\"\n (click)=\"$event.stopPropagation()\"\n (dblclick)=\"$event.stopPropagation(); resetColumnWidth(col)\"\n (keydown)=\"onResizerKeydown($event, col)\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n @if (loading()) {\n <tbody class=\"border-b _shk-border\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div\n class=\"flex items-center justify-center\"\n role=\"status\"\n [attr.aria-label]=\"'common.loading' | transloco\"\n >\n <svg\n [shkIcon]=\"getIcon('loader')\"\n class=\"w-6 h-6 animate-spin _shk-text-primary\"\n ></svg>\n </div>\n </td>\n </tr>\n </tbody>\n } @else if (effectiveDisplayedData().length === 0) {\n <tbody class=\"border-b _shk-border\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div class=\"flex flex-col items-center\">\n <div\n class=\"w-16 h-16 _shk-bg-surface-100 rounded-full flex items-center justify-center mb-4\"\n >\n <svg\n [shkIcon]=\"getIcon('inbox')\"\n class=\"w-8 h-8 _shk-text-surface-400\"\n ></svg>\n </div>\n <p\n class=\"text-lg font-semibold _shk-text-surface-600\"\n >\n {{ emptyMessage() || ('common.no_records' | transloco) }}\n </p>\n </div>\n </td>\n </tr>\n </tbody>\n } @else {\n <tbody>\n @for (rowData of effectiveDisplayedData(); track trackByRow(rowData, $index)) {\n @let rowSeverityValue = rowSeverity(rowData);\n <tr\n [attr.aria-selected]=\"selectable() ? isRowSelected(rowData) : null\"\n [class.shk-row-selected]=\"selectable() && isRowSelected(rowData)\"\n [class.shk-row-low]=\"rowSeverityValue === 'low'\"\n [class.shk-row-moderate]=\"rowSeverityValue === 'moderate'\"\n [class.shk-row-critical]=\"rowSeverityValue === 'critical'\"\n [class.cursor-pointer]=\"selectable() && selectOnRowClick() && canSelectRow(rowData)\"\n (click)=\"onRowClick($event, rowData)\"\n class=\"shk-data-row transition-colors duration-200 border-b _shk-border\"\n >\n @if (selectable()) {\n <td data-shk-select class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center\">\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"isRowSelected(rowData)\"\n [disabled]=\"!canSelectRow(rowData)\"\n (change)=\"toggleRowSelection(rowData)\"\n [attr.aria-label]=\"'table.selectRow' | transloco: { index: first() + $index + 1 }\"\n />\n </td>\n }\n @for (col of columnsWithActions(); track col.field) {\n <td\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [class]=\"\n 'px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)] ' +\n (col.field === 'actions' ? 'whitespace-nowrap' : 'whitespace-normal break-words')\n \"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n >\n @if (col.field !== 'actions') {\n @switch (col.template) {\n @case ('tag') {\n <shk-tag\n [value]=\"getTagValue(col, rowData)\"\n [severity]=\"getTagSeverity(col, rowData)\"\n [rounded]=\"getTagRounded(col, rowData)\"\n [icon]=\"getTagIcon(col, rowData)\"\n [style]=\"getTagStyle(col, rowData)\"\n />\n }\n @case ('progress') {\n <div\n class=\"shk-progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"getProgress(col, rowData)\"\n [attr.aria-label]=\"col.header\"\n >\n <div [style.width.%]=\"getProgress(col, rowData)\"></div>\n </div>\n }\n @case ('boolean') {\n @if (resolveField(rowData, col.field)) {\n <svg\n [shkIcon]=\"icons.yes\"\n class=\"w-4 h-4 [color:var(--shk-success-600)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('yes')\"\n ></svg>\n } @else {\n <svg\n [shkIcon]=\"icons.no\"\n class=\"w-4 h-4 [color:var(--shk-error-500)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('no')\"\n ></svg>\n }\n }\n @case ('date') {\n {{ formatDateCell(resolveField(rowData, col.field), col) }}\n }\n @case ('currency') {\n {{ formatCurrencyCell(resolveField(rowData, col.field), col) }}\n }\n @default {\n @if (col.image) {\n <div class=\"flex items-center gap-2\">\n @if (col.image(rowData); as src) {\n <img\n [src]=\"src\"\n alt=\"\"\n [width]=\"col.imageWidth || 24\"\n class=\"shrink-0 rounded-sm\"\n />\n }\n <span>\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n </span>\n </div>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n }\n }\n }\n } @else {\n <div class=\"flex items-center justify-start gap-px\">\n @for (action of getVisibleRowActions(rowData); track $index) {\n @if (isRowActionVisible(action, rowData)) {\n <div class=\"relative group\">\n <shk-tooltip\n [text]=\"getRowActionLabel(action, rowData)\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData)\"\n [class]=\"\n 'table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md ' +\n getRowActionClass(action, rowData)\n \"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [attr.aria-label]=\"getRowActionLabel(action, rowData)\"\n >\n <svg\n [shkIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n </div>\n }\n }\n @if (getHiddenRowActions(rowData).length > 0) {\n <div class=\"relative\">\n <shk-tooltip\n [text]=\"'common.more_options' | transloco\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleActionsDropdown(rowData, $event)\"\n class=\"table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md\"\n [attr.aria-label]=\"'common.more_options' | transloco\"\n [attr.aria-expanded]=\"isActionsDropdownOpen(rowData)\"\n >\n <svg\n [shkIcon]=\"getIcon('ellipsis-vertical')\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n @if (isActionsDropdownOpen(rowData)) {\n <div\n shkPortal\n class=\"fixed z-[9999] min-w-[160px] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border rounded-md shadow-lg py-1\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n >\n @for (action of getHiddenRowActions(rowData); track $index) {\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData); toggleActionsDropdown(rowData)\"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [class]=\"\n 'w-full flex items-center gap-2 px-3 py-2 text-xs text-left _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors ' +\n getRowActionClass(action, rowData)\n \"\n >\n <svg\n [shkIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-3.5 h-3.5 shrink-0\"\n ></svg>\n <span>{{ getRowActionLabel(action, rowData) }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n @if (rowSeverityValue) {\n <div class=\"relative group\">\n <shk-tooltip [text]=\"rowValidationTitle(rowData) || ''\" position=\"top\">\n <span\n class=\"shk-row-validation-btn\"\n [class.shk-sev-low]=\"rowSeverityValue === 'low'\"\n [class.shk-sev-moderate]=\"rowSeverityValue === 'moderate'\"\n [class.shk-sev-critical]=\"rowSeverityValue === 'critical'\"\n tabindex=\"0\"\n role=\"note\"\n [attr.aria-label]=\"rowValidationLabel(rowData)\"\n >\n <svg [shkIcon]=\"rowValidationIcon(rowData)\"></svg>\n </span>\n </shk-tooltip>\n </div>\n }\n </div>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n }\n </table>\n\n <!-- Text content of a cell: format() \u00B7 custom template \u00B7 raw value -->\n <ng-template #cellText let-rowData let-col=\"col\">\n @if (col.format) {\n <span>{{ col.format(rowData) }}</span>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplates()[col.field] || defaultTemplate;\n context: { $implicit: rowData, field: col.field }\n \"\n ></ng-container>\n }\n </ng-template>\n <ng-template #defaultTemplate let-rowData let-field=\"field\">\n {{ resolveField(rowData, field) }}\n </ng-template>\n\n <!-- Option list of the select / multiselect filters -->\n <ng-template #optionList let-col let-draft=\"draft\" let-multiple=\"multiple\">\n <div class=\"p-2 space-y-1.5\">\n @let selectedLabel = multiple ? selectedOptionsLabel(col) : selectedSingleLabel(col);\n <button\n type=\"button\"\n class=\"shk-filter-select flex items-center justify-between gap-2 text-left\"\n style=\"background-image: none\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [attr.aria-expanded]=\"multiselectOpen()\"\n (click)=\"multiselectOpen.set(!multiselectOpen())\"\n >\n <span class=\"truncate\" [class._shk-text-surface-400]=\"!selectedLabel\">\n {{ selectedLabel || tr('table.filterAll', 'Todos') }}\n </span>\n <svg\n [shkIcon]=\"getIcon('chevron-down')\"\n class=\"w-3.5 h-3.5 shrink-0 _shk-text-surface-400 transition-transform\"\n [class.rotate-180]=\"multiselectOpen()\"\n ></svg>\n </button>\n @if (multiselectOpen()) {\n <div\n class=\"max-h-52 overflow-y-auto p-0.5 border _shk-border rounded-md _shk-scrollbar\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple\"\n >\n @for (opt of col.filterOptions || []; track $index) {\n @let isSelected = multiple\n ? isOptionSelected(opt.value)\n : draft.rules[0].value != null && draft.rules[0].value == opt.value;\n <button\n type=\"button\"\n role=\"option\"\n class=\"w-full flex items-center gap-2 px-2 py-1.5 rounded text-left transition-colors hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [class._shk-bg-primary-soft]=\"isSelected\"\n [class._shk-text-primary-700]=\"isSelected\"\n [attr.aria-selected]=\"isSelected\"\n (click)=\"multiple ? toggleOption(col, opt.value) : selectOption(col, opt.value)\"\n >\n @if (multiple) {\n <span class=\"shk-checkbox-box\" [class.shk-checked]=\"isSelected\">\n @if (isSelected) {\n <svg [shkIcon]=\"getIcon('check')\"></svg>\n }\n </span>\n }\n @if (opt.image) {\n <img [src]=\"opt.image\" alt=\"\" width=\"22\" class=\"shrink-0 rounded-sm\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n </ng-template>\n </div>\n <div\n class=\"table-pagination flex items-center justify-between gap-4 px-2 min-[1440px]:px-3 py-2 border-t _shk-border\"\n >\n <div class=\"text-xs _shk-text-surface-600\">\n @if (showPageReport()) {\n {{ pageReport() }}\n }\n </div>\n <div\n class=\"flex items-center gap-0.5\"\n role=\"navigation\"\n >\n <button\n type=\"button\"\n (click)=\"goToFirst()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.firstPage', 'Primera p\u00E1gina')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevrons-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"prev()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.prevPage', 'P\u00E1gina anterior')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span\n class=\"px-2 text-xs font-medium _shk-text-surface-700\"\n >{{ currentPage() }} / {{ totalPages() }}</span\n >\n <button\n type=\"button\"\n (click)=\"next()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.nextPage', 'P\u00E1gina siguiente')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"goToLast()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.lastPage', '\u00DAltima p\u00E1gina')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevrons-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n <div\n class=\"flex items-center gap-1.5 text-xs _shk-text-surface-600\"\n >\n @if (showRowsPerPage()) {\n <label [for]=\"uid + '-rows-per-page'\">{{ 'table.rows' | transloco }}</label>\n <select\n [id]=\"uid + '-rows-per-page'\"\n (change)=\"onRowsPerPageChange($any($event.target).value)\"\n class=\"border _shk-border rounded px-2 py-1 text-xs bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 focus:outline-none focus:[border-color:var(--shk-primary-500)]\"\n >\n @for (opt of rowsPerPageOptions(); track opt) {\n <option [value]=\"opt\" [selected]=\"opt === rowsPerPageLocal()\">{{ opt }}</option>\n }\n </select>\n }\n </div>\n </div>\n </div>\n</div>\n", styles: ["input:focus{outline:none}input[type=text]{font-weight:400!important}table th{white-space:nowrap}table td{white-space:normal;overflow-wrap:break-word}.shk-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.375rem;transition:background-color .15s ease,color .15s ease}.shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.shk-page-btn:focus-visible{outline:none;box-shadow:0 0 0 2px color-mix(in srgb,var(--shk-primary-500) 45%,transparent)}td button svg{width:1.125rem!important;height:1.125rem!important}td button:disabled{opacity:.4;cursor:not-allowed}.table-action-btn svg{width:1rem!important;height:1rem!important;min-width:1rem!important;min-height:1rem!important}.table-action-btn{padding:.5rem!important;min-width:2rem!important;min-height:2rem!important;display:inline-flex!important;align-items:center!important;justify-content:center!important}.table-scroll-wrapper{width:100%;overflow-x:auto;overflow-y:hidden;border-radius:inherit;-webkit-overflow-scrolling:touch;container-type:inline-size}.table-card,.table-pagination{container-type:inline-size}@container (max-width: 640px){.table-pagination{flex-direction:column;align-items:center;gap:.5rem}.table-pagination>div{justify-content:center}}.table-scroll-wrapper table{table-layout:auto;width:100%}@container (max-width: 768px){.table-scroll-wrapper{scroll-snap-type:x mandatory}.table-scroll-wrapper table{table-layout:auto;width:100%}.table-scroll-wrapper th:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px)}.table-scroll-wrapper td:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px);max-width:var(--shk-col-width, 140px)}.table-scroll-wrapper th,.table-scroll-wrapper td{scroll-snap-align:start}}th[data-shk-select],td[data-shk-select]{width:2.5rem;min-width:2.5rem}.shk-table-checkbox{width:.875rem;height:.875rem;cursor:pointer;vertical-align:middle;accent-color:var(--shk-primary-500)}.shk-table-checkbox:disabled{opacity:.4;cursor:not-allowed}tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-50) 60%,transparent)}tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 90%,transparent)}:host-context(.dark) tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-900) 20%,transparent)}:host-context(.dark) tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 30%,transparent)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.shk-data-table tr.shk-row-low{background-color:color-mix(in srgb,var(--shk-info-600) 22%,transparent)}.shk-data-table tr.shk-row-moderate{background-color:color-mix(in srgb,var(--shk-warning-400) 32%,transparent)}.shk-data-table tr.shk-row-critical{background-color:color-mix(in srgb,var(--shk-error-500) 20%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-low{background-color:color-mix(in srgb,var(--shk-info-600) 26%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-moderate{background-color:color-mix(in srgb,var(--shk-warning-400) 34%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-critical{background-color:color-mix(in srgb,var(--shk-error-500) 24%,transparent)}.shk-row-validation-btn{display:inline-flex;align-items:center;justify-content:center;padding:.25rem;border-radius:.375rem;cursor:help;color:var(--shk-surface-500)}.shk-row-validation-btn svg{width:1rem!important;height:1rem!important}.shk-row-validation-btn.shk-sev-low{color:var(--shk-info-600)}.shk-row-validation-btn.shk-sev-moderate{color:var(--shk-warning-600)}:host-context(.dark) .shk-row-validation-btn.shk-sev-moderate{color:var(--shk-warning-400)}.shk-row-validation-btn.shk-sev-critical{color:var(--shk-error-500)}.shk-row-validation-btn:focus-visible{outline:2px solid currentColor;outline-offset:1px}table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 30%,transparent)}:host-context(.dark) table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 10%,transparent)}table.shk-gridlines th,table.shk-gridlines td{border-right:1px solid var(--shk-surface-200)}table.shk-gridlines th:last-child,table.shk-gridlines td:last-child{border-right:0}:host-context(.dark) table.shk-gridlines th,:host-context(.dark) table.shk-gridlines td{border-right-color:var(--shk-surface-200)}.shk-col-resizer{position:absolute;top:0;right:-4px;z-index:1;width:8px;height:100%;cursor:col-resize;touch-action:none}.shk-col-resizer:after{content:\"\";position:absolute;top:20%;bottom:20%;left:3px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.shk-col-resizer:hover:after,.shk-col-resizer:focus-visible:after,.shk-col-resizer.shk-resizing:after{background-color:var(--shk-primary-500)}.shk-col-resizer:focus-visible{outline:none}th:last-child .shk-col-resizer{right:0}.shk-filter-input,.shk-filter-select{width:100%;padding:.375rem .625rem;font-size:.75rem;line-height:1.25rem;border-radius:.375rem;border:1px solid var(--shk-surface-200);background-color:#fff;color:var(--shk-surface-700)}.dark .shk-filter-input,.dark .shk-filter-select{background-color:var(--shk-surface-100);border-color:var(--shk-surface-200);color-scheme:dark}.shk-filter-input::placeholder{color:var(--shk-surface-400)}select.shk-filter-select{appearance:none;padding-right:1.75rem;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .5rem center;cursor:pointer}button.shk-filter-select{cursor:pointer}.shk-filter-input:focus,.shk-filter-select:focus{outline:none;border-color:var(--shk-primary-500);box-shadow:0 0 0 1px var(--shk-primary-500)}.shk-checkbox-box{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:.875rem;height:.875rem;border-radius:.1875rem;border:1px solid var(--shk-surface-300);background-color:#fff;color:#fff}.dark .shk-checkbox-box{background-color:var(--shk-surface-100)}.shk-checkbox-box.shk-checked{background-color:var(--shk-primary-500);border-color:var(--shk-primary-500)}.shk-checkbox-box svg{width:.625rem;height:.625rem}.shk-range{position:relative;height:1rem;margin:.5rem .375rem .375rem}.shk-range-track,.shk-range-fill{position:absolute;top:50%;height:.1875rem;transform:translateY(-50%);border-radius:9999px}.shk-range-track{left:0;right:0;background-color:var(--shk-surface-200)}.shk-range-fill{background-color:var(--shk-primary-500)}.shk-range input[type=range]{position:absolute;inset:0;width:100%;margin:0;background:transparent;pointer-events:none;appearance:none;-webkit-appearance:none}.shk-range input[type=range]::-webkit-slider-thumb{pointer-events:auto;-webkit-appearance:none;width:.875rem;height:.875rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-range input[type=range]::-moz-range-thumb{pointer-events:auto;width:.625rem;height:.625rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-progress{height:.375rem;min-width:5rem;border-radius:9999px;background-color:var(--shk-surface-200);overflow:hidden}.shk-progress>div{height:100%;border-radius:inherit;background-color:var(--shk-primary-500)}\n"] }]
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
75
|
+
var TableComponent = class TableComponent {
|
|
76
|
+
getColumnWidth(col) {
|
|
77
|
+
return this.resizedWidth(col) || col.width || this.DEFAULT_COLUMN_WIDTH;
|
|
78
|
+
}
|
|
79
|
+
collectViolations(row, entries = Object.entries(this.rowValidations())) {
|
|
80
|
+
const violations = [];
|
|
81
|
+
for (const [field, rule] of entries) {
|
|
82
|
+
if (!rule || typeof rule.condition !== "function") continue;
|
|
83
|
+
const value = this.resolveField(row, field);
|
|
84
|
+
let failed = false;
|
|
85
|
+
try {
|
|
86
|
+
failed = !!rule.condition(value, row);
|
|
87
|
+
} catch {
|
|
88
|
+
failed = false;
|
|
89
|
+
}
|
|
90
|
+
if (!failed) continue;
|
|
91
|
+
violations.push({
|
|
92
|
+
field,
|
|
93
|
+
severity: rule.severity ?? "critical",
|
|
94
|
+
message: this.resolveViolationMessage(rule, value, row)
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return violations;
|
|
98
|
+
}
|
|
99
|
+
resolveViolationMessage(rule, value, row) {
|
|
100
|
+
if (!rule.message) return void 0;
|
|
101
|
+
return this.tr(rule.message, rule.message, rule.messageParams?.(value, row));
|
|
102
|
+
}
|
|
103
|
+
rowViolationsOf(row) {
|
|
104
|
+
return this.violationsByRow().get(row) ?? this.collectViolations(row);
|
|
105
|
+
}
|
|
106
|
+
rowSeverity(row) {
|
|
107
|
+
let severity = null;
|
|
108
|
+
for (const violation of this.rowViolationsOf(row)) if (!severity || this.severityRank[violation.severity] > this.severityRank[severity]) severity = violation.severity;
|
|
109
|
+
return severity;
|
|
110
|
+
}
|
|
111
|
+
validateRow(row) {
|
|
112
|
+
return this.collectViolations(row);
|
|
113
|
+
}
|
|
114
|
+
rowValidationTitle(row) {
|
|
115
|
+
const messages = this.rowViolationsOf(row).map((violation) => violation.message).filter((message) => !!message);
|
|
116
|
+
return messages.length ? messages.join("\n") : null;
|
|
117
|
+
}
|
|
118
|
+
rowValidationIcon(row) {
|
|
119
|
+
const severity = this.rowSeverity(row);
|
|
120
|
+
return severity ? this.icons[severity] : this.icons.low;
|
|
121
|
+
}
|
|
122
|
+
rowValidationLabel(row) {
|
|
123
|
+
const title = this.rowValidationTitle(row);
|
|
124
|
+
if (title) return title;
|
|
125
|
+
const severity = this.rowSeverity(row);
|
|
126
|
+
return severity ? this.tr(`table.severity.${severity}`, {
|
|
127
|
+
low: "Fila con observaciones",
|
|
128
|
+
moderate: "Fila con advertencias",
|
|
129
|
+
critical: "Fila con errores"
|
|
130
|
+
}[severity]) : "";
|
|
131
|
+
}
|
|
132
|
+
constructor() {
|
|
133
|
+
this.uid = `shk-table-${nextTableId++}`;
|
|
134
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
135
|
+
this.transloco = inject(TranslocoService);
|
|
136
|
+
this.config = inject(ShkConfigService);
|
|
137
|
+
this.destroyRef = inject(DestroyRef);
|
|
138
|
+
this.injector = inject(Injector);
|
|
139
|
+
this.getIcon = (name) => getIcon(name, LucidePlus);
|
|
140
|
+
this.icons = {
|
|
141
|
+
clear: LucideFunnelX,
|
|
142
|
+
yes: LucideCircleCheck,
|
|
143
|
+
no: LucideCircleX,
|
|
144
|
+
trash: LucideTrash2,
|
|
145
|
+
low: LucideInfo,
|
|
146
|
+
moderate: LucideTriangleAlert,
|
|
147
|
+
critical: LucideOctagonAlert
|
|
148
|
+
};
|
|
149
|
+
this.DEFAULT_COLUMN_WIDTH = "140px";
|
|
150
|
+
this.actionsHeaderLabel = toSignal(this.transloco.selectTranslate("common.actions"), { initialValue: "Acciones" });
|
|
151
|
+
this.currentLang = toSignal(this.transloco.langChanges$, { initialValue: this.transloco.getActiveLang() });
|
|
152
|
+
this.translations = toSignal(this.transloco.selectTranslation());
|
|
153
|
+
this.data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
154
|
+
this.columns = input([], ...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
|
|
155
|
+
this.rowsPerPage = input(10, ...ngDevMode ? [{ debugName: "rowsPerPage" }] : /* istanbul ignore next */ []);
|
|
156
|
+
this.rowsPerPageOptions = input([
|
|
157
|
+
10,
|
|
158
|
+
25,
|
|
159
|
+
50
|
|
160
|
+
], ...ngDevMode ? [{ debugName: "rowsPerPageOptions" }] : /* istanbul ignore next */ []);
|
|
161
|
+
this.loading = input(false, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
|
|
162
|
+
this.showActionRow = input(true, ...ngDevMode ? [{ debugName: "showActionRow" }] : /* istanbul ignore next */ []);
|
|
163
|
+
this.customTemplates = input({}, ...ngDevMode ? [{ debugName: "customTemplates" }] : /* istanbul ignore next */ []);
|
|
164
|
+
this.headerActions = input([], ...ngDevMode ? [{ debugName: "headerActions" }] : /* istanbul ignore next */ []);
|
|
165
|
+
this.rowActions = input([], ...ngDevMode ? [{ debugName: "rowActions" }] : /* istanbul ignore next */ []);
|
|
166
|
+
this.hasShadow = input(true, ...ngDevMode ? [{ debugName: "hasShadow" }] : /* istanbul ignore next */ []);
|
|
167
|
+
this.defaultSortField = input("", ...ngDevMode ? [{ debugName: "defaultSortField" }] : /* istanbul ignore next */ []);
|
|
168
|
+
this.defaultSortOrder = input(1, ...ngDevMode ? [{ debugName: "defaultSortOrder" }] : /* istanbul ignore next */ []);
|
|
169
|
+
this.showSearch = input(true, ...ngDevMode ? [{ debugName: "showSearch" }] : /* istanbul ignore next */ []);
|
|
170
|
+
this.searchPlaceholder = input("", ...ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []);
|
|
171
|
+
this.globalFilterFields = input([], ...ngDevMode ? [{ debugName: "globalFilterFields" }] : /* istanbul ignore next */ []);
|
|
172
|
+
this.emptyMessage = input("", ...ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []);
|
|
173
|
+
this.serverSide = input(false, ...ngDevMode ? [{ debugName: "serverSide" }] : /* istanbul ignore next */ []);
|
|
174
|
+
this.totalRecords = input(0, ...ngDevMode ? [{ debugName: "totalRecords" }] : /* istanbul ignore next */ []);
|
|
175
|
+
this.filters = input([], ...ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []);
|
|
176
|
+
this.activeFilter = input("", ...ngDevMode ? [{ debugName: "activeFilter" }] : /* istanbul ignore next */ []);
|
|
177
|
+
this.showGridlines = input(false, ...ngDevMode ? [{ debugName: "showGridlines" }] : /* istanbul ignore next */ []);
|
|
178
|
+
this.resizableColumns = input(true, ...ngDevMode ? [{ debugName: "resizableColumns" }] : /* istanbul ignore next */ []);
|
|
179
|
+
this.rowValidations = input({}, ...ngDevMode ? [{ debugName: "rowValidations" }] : /* istanbul ignore next */ []);
|
|
180
|
+
this.columnWidths = model({}, ...ngDevMode ? [{ debugName: "columnWidths" }] : /* istanbul ignore next */ []);
|
|
181
|
+
this.stateKey = input("", ...ngDevMode ? [{ debugName: "stateKey" }] : /* istanbul ignore next */ []);
|
|
182
|
+
this.stateStorage = input("local", ...ngDevMode ? [{ debugName: "stateStorage" }] : /* istanbul ignore next */ []);
|
|
183
|
+
this.rowHover = input(true, ...ngDevMode ? [{ debugName: "rowHover" }] : /* istanbul ignore next */ []);
|
|
184
|
+
this.showClearButton = input(false, ...ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []);
|
|
185
|
+
this.showPageReport = input(true, ...ngDevMode ? [{ debugName: "showPageReport" }] : /* istanbul ignore next */ []);
|
|
186
|
+
this.showRowsPerPage = input(true, ...ngDevMode ? [{ debugName: "showRowsPerPage" }] : /* istanbul ignore next */ []);
|
|
187
|
+
this.selectable = input(false, ...ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []);
|
|
188
|
+
this.dataKey = input("id", ...ngDevMode ? [{ debugName: "dataKey" }] : /* istanbul ignore next */ []);
|
|
189
|
+
this.isRowSelectable = input(void 0, ...ngDevMode ? [{ debugName: "isRowSelectable" }] : /* istanbul ignore next */ []);
|
|
190
|
+
this.selectOnRowClick = input(false, ...ngDevMode ? [{ debugName: "selectOnRowClick" }] : /* istanbul ignore next */ []);
|
|
191
|
+
this.bulkActions = input([], ...ngDevMode ? [{ debugName: "bulkActions" }] : /* istanbul ignore next */ []);
|
|
192
|
+
this.selection = model([], ...ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []);
|
|
193
|
+
this.refresh = output();
|
|
194
|
+
this.pageChange = output();
|
|
195
|
+
this.filterChange = output();
|
|
196
|
+
this.searchChange = output();
|
|
197
|
+
this.filterClick = output();
|
|
198
|
+
this.columnResize = output();
|
|
199
|
+
this.originalData = signal([], ...ngDevMode ? [{ debugName: "originalData" }] : /* istanbul ignore next */ []);
|
|
200
|
+
this.searchedData = signal([], ...ngDevMode ? [{ debugName: "searchedData" }] : /* istanbul ignore next */ []);
|
|
201
|
+
this.filteredData = signal([], ...ngDevMode ? [{ debugName: "filteredData" }] : /* istanbul ignore next */ []);
|
|
202
|
+
this.displayedData = signal([], ...ngDevMode ? [{ debugName: "displayedData" }] : /* istanbul ignore next */ []);
|
|
203
|
+
this.localTotalRecords = signal(0, ...ngDevMode ? [{ debugName: "localTotalRecords" }] : /* istanbul ignore next */ []);
|
|
204
|
+
this.first = signal(0, ...ngDevMode ? [{ debugName: "first" }] : /* istanbul ignore next */ []);
|
|
205
|
+
this.searchQuery = signal("", ...ngDevMode ? [{ debugName: "searchQuery" }] : /* istanbul ignore next */ []);
|
|
206
|
+
this.sortField = signal("", ...ngDevMode ? [{ debugName: "sortField" }] : /* istanbul ignore next */ []);
|
|
207
|
+
this.sortOrder = signal(1, ...ngDevMode ? [{ debugName: "sortOrder" }] : /* istanbul ignore next */ []);
|
|
208
|
+
this.rowsPerPageLocal = linkedSignal(() => this.rowsPerPage(), ...ngDevMode ? [{ debugName: "rowsPerPageLocal" }] : /* istanbul ignore next */ []);
|
|
209
|
+
this.filterState = signal({}, ...ngDevMode ? [{ debugName: "filterState" }] : /* istanbul ignore next */ []);
|
|
210
|
+
this.openFilterField = signal(null, ...ngDevMode ? [{ debugName: "openFilterField" }] : /* istanbul ignore next */ []);
|
|
211
|
+
this.filterDraft = signal(null, ...ngDevMode ? [{ debugName: "filterDraft" }] : /* istanbul ignore next */ []);
|
|
212
|
+
this.multiselectOpen = signal(false, ...ngDevMode ? [{ debugName: "multiselectOpen" }] : /* istanbul ignore next */ []);
|
|
213
|
+
this.totalPages = computed(() => Math.max(1, Math.ceil(this.effectiveTotalRecords() / this.rowsPerPageLocal())), ...ngDevMode ? [{ debugName: "totalPages" }] : /* istanbul ignore next */ []);
|
|
214
|
+
this.currentPage = computed(() => Math.floor(this.first() / this.rowsPerPageLocal()) + 1, ...ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []);
|
|
215
|
+
this.hasFilterableColumns = computed(() => this.columns().some((c) => c.filter), ...ngDevMode ? [{ debugName: "hasFilterableColumns" }] : /* istanbul ignore next */ []);
|
|
216
|
+
this.filterSubject = new Subject();
|
|
217
|
+
this.searchSubject = new Subject();
|
|
218
|
+
this.lastFilterFieldsSignature = "";
|
|
219
|
+
this.columnsWithActions = computed(() => {
|
|
220
|
+
const columnsArray = this.columns();
|
|
221
|
+
const showAction = this.showActionRow();
|
|
222
|
+
const rowActionsArray = this.rowActions();
|
|
223
|
+
const translatedHeader = this.actionsHeaderLabel();
|
|
224
|
+
const rows = this.effectiveDisplayedData();
|
|
225
|
+
const hasIndicator = rows.some((row) => this.rowViolationsOf(row).length > 0);
|
|
226
|
+
if (showAction && rowActionsArray.length > 0 || hasIndicator) {
|
|
227
|
+
let buttons = hasIndicator ? 1 : 0;
|
|
228
|
+
if (rows.length) for (const row of rows) {
|
|
229
|
+
const n = rowActionsArray.filter((a) => this.isRowActionVisible(a, row)).length;
|
|
230
|
+
const shown = n > this.MAX_VISIBLE_ACTIONS ? this.MAX_VISIBLE_ACTIONS + 1 : n;
|
|
231
|
+
if (shown + (hasIndicator ? 1 : 0) > buttons) buttons = shown + (hasIndicator ? 1 : 0);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
const n = rowActionsArray.length;
|
|
235
|
+
const shown = n > this.MAX_VISIBLE_ACTIONS ? this.MAX_VISIBLE_ACTIONS + 1 : n;
|
|
236
|
+
if (shown + (hasIndicator ? 1 : 0) > buttons) buttons = shown + (hasIndicator ? 1 : 0);
|
|
237
|
+
}
|
|
238
|
+
const actionsWidth = `${Math.max(this.MIN_ACTIONS_WIDTH, this.ACTIONS_CELL_PADDING + buttons * this.ACTION_BUTTON_WIDTH)}px`;
|
|
239
|
+
return [{
|
|
240
|
+
field: "actions",
|
|
241
|
+
header: translatedHeader || "Acciones",
|
|
242
|
+
width: actionsWidth,
|
|
243
|
+
defaultSort: true
|
|
244
|
+
}, ...columnsArray];
|
|
245
|
+
}
|
|
246
|
+
return [...columnsArray];
|
|
247
|
+
}, ...ngDevMode ? [{ debugName: "columnsWithActions" }] : /* istanbul ignore next */ []);
|
|
248
|
+
this.selectedKeys = computed(() => new Set(this.selection().map((row) => this.getSelectionKey(row))), ...ngDevMode ? [{ debugName: "selectedKeys" }] : /* istanbul ignore next */ []);
|
|
249
|
+
this.hasReceivedData = false;
|
|
250
|
+
this.selectablePageRows = computed(() => this.effectiveDisplayedData().filter((row) => this.canSelectRow(row)), ...ngDevMode ? [{ debugName: "selectablePageRows" }] : /* istanbul ignore next */ []);
|
|
251
|
+
this.allPageSelected = computed(() => {
|
|
252
|
+
const rows = this.selectablePageRows();
|
|
253
|
+
const keys = this.selectedKeys();
|
|
254
|
+
return rows.length > 0 && rows.every((row) => keys.has(this.getSelectionKey(row)));
|
|
255
|
+
}, ...ngDevMode ? [{ debugName: "allPageSelected" }] : /* istanbul ignore next */ []);
|
|
256
|
+
this.somePageSelected = computed(() => {
|
|
257
|
+
const keys = this.selectedKeys();
|
|
258
|
+
return !this.allPageSelected() && this.selectablePageRows().some((row) => keys.has(this.getSelectionKey(row)));
|
|
259
|
+
}, ...ngDevMode ? [{ debugName: "somePageSelected" }] : /* istanbul ignore next */ []);
|
|
260
|
+
this.visibleBulkActions = computed(() => {
|
|
261
|
+
const selected = this.selection();
|
|
262
|
+
return this.bulkActions().filter((a) => a.isVisible ? a.isVisible(selected) : true);
|
|
263
|
+
}, ...ngDevMode ? [{ debugName: "visibleBulkActions" }] : /* istanbul ignore next */ []);
|
|
264
|
+
this.totalColspan = computed(() => this.columnsWithActions().length + (this.selectable() ? 1 : 0), ...ngDevMode ? [{ debugName: "totalColspan" }] : /* istanbul ignore next */ []);
|
|
265
|
+
this.severityRank = {
|
|
266
|
+
low: 0,
|
|
267
|
+
moderate: 1,
|
|
268
|
+
critical: 2
|
|
269
|
+
};
|
|
270
|
+
this.violationsByRow = computed(() => {
|
|
271
|
+
const map = /* @__PURE__ */ new Map();
|
|
272
|
+
const entries = Object.entries(this.rowValidations());
|
|
273
|
+
if (!entries.length) return map;
|
|
274
|
+
for (const row of this.effectiveDisplayedData()) map.set(row, this.collectViolations(row, entries));
|
|
275
|
+
return map;
|
|
276
|
+
}, ...ngDevMode ? [{ debugName: "violationsByRow" }] : /* istanbul ignore next */ []);
|
|
277
|
+
this.effectiveTotalRecords = computed(() => {
|
|
278
|
+
return this.serverSide() ? this.totalRecords() : this.localTotalRecords();
|
|
279
|
+
}, ...ngDevMode ? [{ debugName: "effectiveTotalRecords" }] : /* istanbul ignore next */ []);
|
|
280
|
+
this.effectiveDisplayedData = computed(() => {
|
|
281
|
+
return this.serverSide() ? this.data() : this.displayedData();
|
|
282
|
+
}, ...ngDevMode ? [{ debugName: "effectiveDisplayedData" }] : /* istanbul ignore next */ []);
|
|
283
|
+
this.pageReport = computed(() => {
|
|
284
|
+
this.translations();
|
|
285
|
+
this.currentLang();
|
|
286
|
+
const total = this.effectiveTotalRecords();
|
|
287
|
+
if (total === 0) return this.transloco.translate("table.pageReport", {
|
|
288
|
+
from: 0,
|
|
289
|
+
to: 0,
|
|
290
|
+
total: 0
|
|
291
|
+
});
|
|
292
|
+
const from = this.first() + 1;
|
|
293
|
+
const to = Math.min(this.first() + this.rowsPerPageLocal(), total);
|
|
294
|
+
return this.transloco.translate("table.pageReport", {
|
|
295
|
+
from,
|
|
296
|
+
to,
|
|
297
|
+
total
|
|
298
|
+
});
|
|
299
|
+
}, ...ngDevMode ? [{ debugName: "pageReport" }] : /* istanbul ignore next */ []);
|
|
300
|
+
this.MIN_COLUMN_WIDTH = 60;
|
|
301
|
+
this.ACTION_BUTTON_WIDTH = 33;
|
|
302
|
+
this.ACTIONS_CELL_PADDING = 24;
|
|
303
|
+
this.MIN_ACTIONS_WIDTH = 84;
|
|
304
|
+
this.resizingField = signal(null, ...ngDevMode ? [{ debugName: "resizingField" }] : /* istanbul ignore next */ []);
|
|
305
|
+
this.suppressHeaderClick = false;
|
|
306
|
+
this.isResizable = computed(() => this.showGridlines() && this.resizableColumns(), ...ngDevMode ? [{ debugName: "isResizable" }] : /* istanbul ignore next */ []);
|
|
307
|
+
this.hasActiveFilters = computed(() => {
|
|
308
|
+
if (this.searchQuery()) return true;
|
|
309
|
+
const state = this.filterState();
|
|
310
|
+
return this.columns().some((c) => c.filter && this.activeRules(c, state[c.field]).length > 0);
|
|
311
|
+
}, ...ngDevMode ? [{ debugName: "hasActiveFilters" }] : /* istanbul ignore next */ []);
|
|
312
|
+
this.FILTER_POPUP_WIDTH = 240;
|
|
313
|
+
this.filterPopupPosition = signal({
|
|
314
|
+
top: 0,
|
|
315
|
+
left: 0,
|
|
316
|
+
maxHeight: 400
|
|
317
|
+
}, ...ngDevMode ? [{ debugName: "filterPopupPosition" }] : /* istanbul ignore next */ []);
|
|
318
|
+
this.filterAnchor = null;
|
|
319
|
+
this.filterListenersCleanup = null;
|
|
320
|
+
this.MAX_VISIBLE_ACTIONS = 4;
|
|
321
|
+
this.actionsDropdownOpen = signal({}, ...ngDevMode ? [{ debugName: "actionsDropdownOpen" }] : /* istanbul ignore next */ []);
|
|
322
|
+
this.dropdownPosition = signal({
|
|
323
|
+
top: 0,
|
|
324
|
+
left: 0
|
|
325
|
+
}, ...ngDevMode ? [{ debugName: "dropdownPosition" }] : /* istanbul ignore next */ []);
|
|
326
|
+
this.destroyRef.onDestroy(() => this.filterListenersCleanup?.());
|
|
327
|
+
afterEveryRender(() => {
|
|
328
|
+
if (this.filterAnchor && !this.filterAnchor.isConnected) this.closeFilters();
|
|
329
|
+
});
|
|
330
|
+
this.filterSubject.pipe(debounceTime(300), takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
331
|
+
if (this.serverSide()) this.emitFilterChange();
|
|
332
|
+
});
|
|
333
|
+
this.searchSubject.pipe(debounceTime(300), takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
334
|
+
this.searchChange.emit(value);
|
|
335
|
+
});
|
|
336
|
+
effect(() => {
|
|
337
|
+
const newData = this.data();
|
|
338
|
+
untracked(() => {
|
|
339
|
+
this.originalData.set([...newData]);
|
|
340
|
+
if (!this.serverSide()) this.applyFilters();
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
effect(() => {
|
|
344
|
+
const newData = this.data();
|
|
345
|
+
const loading = this.loading();
|
|
346
|
+
untracked(() => {
|
|
347
|
+
if (this.serverSide() || loading) return;
|
|
348
|
+
if (newData.length > 0) this.hasReceivedData = true;
|
|
349
|
+
if (this.hasReceivedData) this.pruneSelection(newData);
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
effect(() => {
|
|
353
|
+
const key = this.stateKey();
|
|
354
|
+
const storage = this.stateStorage();
|
|
355
|
+
untracked(() => {
|
|
356
|
+
if (!key) return;
|
|
357
|
+
const saved = this.readStoredWidths(key, storage);
|
|
358
|
+
if (saved) this.columnWidths.set(saved);
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
effect(() => {
|
|
362
|
+
const widths = this.columnWidths();
|
|
363
|
+
const resizing = this.resizingField();
|
|
364
|
+
const key = this.stateKey();
|
|
365
|
+
const storage = this.stateStorage();
|
|
366
|
+
if (!key || resizing) return;
|
|
367
|
+
untracked(() => this.writeStoredWidths(key, storage, widths));
|
|
368
|
+
});
|
|
369
|
+
effect(() => {
|
|
370
|
+
const cols = this.columns();
|
|
371
|
+
untracked(() => {
|
|
372
|
+
this.setupColumnFilters(cols);
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
effect(() => {
|
|
376
|
+
const field = this.defaultSortField();
|
|
377
|
+
const order = this.defaultSortOrder();
|
|
378
|
+
if (field) untracked(() => {
|
|
379
|
+
this.sortField.set(field);
|
|
380
|
+
this.sortOrder.set(order);
|
|
381
|
+
if (!this.serverSide()) {
|
|
382
|
+
this.applySort();
|
|
383
|
+
this.updateDisplayedData();
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
effect(() => {
|
|
388
|
+
this.searchQuery();
|
|
389
|
+
untracked(() => {
|
|
390
|
+
if (!this.serverSide()) this.applySearch();
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
tr(key, fallback, params) {
|
|
395
|
+
this.translations();
|
|
396
|
+
this.currentLang();
|
|
397
|
+
const value = this.transloco.translate(key, params);
|
|
398
|
+
if (value && value !== key) return value;
|
|
399
|
+
return fallback.replace(/\{\{\s*(\w+)\s*\}\}/g, (_, name) => String(params?.[name] ?? ""));
|
|
400
|
+
}
|
|
401
|
+
filterLabel(name, params) {
|
|
402
|
+
return this.tr(`table.filter.${name}`, FILTER_LABELS[name] ?? name, params);
|
|
403
|
+
}
|
|
404
|
+
matchModeLabel(mode) {
|
|
405
|
+
return this.tr(`table.filter.matchModes.${mode}`, FILTER_LABELS[mode] ?? mode);
|
|
406
|
+
}
|
|
407
|
+
resolveField(row, path) {
|
|
408
|
+
if (row == null || !path) return void 0;
|
|
409
|
+
if (typeof row === "object" && path in row) return row[path];
|
|
410
|
+
return path.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], row);
|
|
411
|
+
}
|
|
412
|
+
filterFieldOf(col) {
|
|
413
|
+
return col.filterField || col.field;
|
|
414
|
+
}
|
|
415
|
+
normalize(value) {
|
|
416
|
+
return String(value ?? "").normalize("NFD").replace(/[̀-ͯ]/g, "").toLocaleLowerCase();
|
|
417
|
+
}
|
|
418
|
+
filterKind(col) {
|
|
419
|
+
const type = col.filterType ?? "text";
|
|
420
|
+
return type === "exact" ? "text" : type;
|
|
421
|
+
}
|
|
422
|
+
matchModesFor(col) {
|
|
423
|
+
return MATCH_MODES[this.filterKind(col)] ?? [];
|
|
424
|
+
}
|
|
425
|
+
defaultMatchMode(col) {
|
|
426
|
+
if (col.filterMatchMode) return col.filterMatchMode;
|
|
427
|
+
switch (this.filterKind(col)) {
|
|
428
|
+
case "text": return col.filterType === "exact" ? "equals" : "contains";
|
|
429
|
+
case "numeric": return "equals";
|
|
430
|
+
case "date": return "dateIs";
|
|
431
|
+
case "multiselect": return "in";
|
|
432
|
+
case "range": return "between";
|
|
433
|
+
default: return "equals";
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
supportsRules(col) {
|
|
437
|
+
return !!MATCH_MODES[this.filterKind(col)];
|
|
438
|
+
}
|
|
439
|
+
showMatchModesFor(col) {
|
|
440
|
+
return this.supportsRules(col) && col.showMatchModes !== false;
|
|
441
|
+
}
|
|
442
|
+
showOperatorFor(col) {
|
|
443
|
+
return this.supportsRules(col) && col.showOperator !== false;
|
|
444
|
+
}
|
|
445
|
+
canAddRule(col) {
|
|
446
|
+
const draft = this.filterDraft();
|
|
447
|
+
return this.supportsRules(col) && col.showAddButton !== false && !!draft && draft.rules.length < (col.maxConstraints ?? 2);
|
|
448
|
+
}
|
|
449
|
+
appliesImmediately(col) {
|
|
450
|
+
return !this.supportsRules(col);
|
|
451
|
+
}
|
|
452
|
+
emptyFilterState(col) {
|
|
453
|
+
return {
|
|
454
|
+
operator: "and",
|
|
455
|
+
rules: [{
|
|
456
|
+
matchMode: this.defaultMatchMode(col),
|
|
457
|
+
value: null
|
|
458
|
+
}]
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
cloneState(state) {
|
|
462
|
+
return {
|
|
463
|
+
operator: state.operator,
|
|
464
|
+
rules: state.rules.map((r) => ({
|
|
465
|
+
matchMode: r.matchMode,
|
|
466
|
+
value: Array.isArray(r.value) ? [...r.value] : r.value
|
|
467
|
+
}))
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
rangeBounds(col) {
|
|
471
|
+
return [col.filterMin ?? 0, col.filterMax ?? 100];
|
|
472
|
+
}
|
|
473
|
+
isRuleActive(col, rule) {
|
|
474
|
+
const value = rule.value;
|
|
475
|
+
if (value === null || value === void 0 || value === "") return false;
|
|
476
|
+
if (this.filterKind(col) === "range") {
|
|
477
|
+
if (!Array.isArray(value) || value.length !== 2) return false;
|
|
478
|
+
const [min, max] = this.rangeBounds(col);
|
|
479
|
+
return value[0] > min || value[1] < max;
|
|
480
|
+
}
|
|
481
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
482
|
+
return true;
|
|
483
|
+
}
|
|
484
|
+
activeRules(col, state) {
|
|
485
|
+
return (state?.rules ?? []).filter((r) => this.isRuleActive(col, r));
|
|
486
|
+
}
|
|
487
|
+
toDay(value) {
|
|
488
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
489
|
+
let date;
|
|
490
|
+
if (value instanceof Date) date = value;
|
|
491
|
+
else if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
492
|
+
const [y, m, d] = value.split("-").map(Number);
|
|
493
|
+
date = new Date(y, m - 1, d);
|
|
494
|
+
} else date = new Date(value);
|
|
495
|
+
if (isNaN(date.getTime())) return null;
|
|
496
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
|
|
497
|
+
}
|
|
498
|
+
matchRule(col, cell, rule) {
|
|
499
|
+
const value = rule.value;
|
|
500
|
+
switch (rule.matchMode) {
|
|
501
|
+
case "startsWith": return this.normalize(cell).startsWith(this.normalize(value));
|
|
502
|
+
case "contains": return this.normalize(cell).includes(this.normalize(value));
|
|
503
|
+
case "notContains": return !this.normalize(cell).includes(this.normalize(value));
|
|
504
|
+
case "endsWith": return this.normalize(cell).endsWith(this.normalize(value));
|
|
505
|
+
case "equals":
|
|
506
|
+
case "notEquals": {
|
|
507
|
+
let equal;
|
|
508
|
+
const kind = this.filterKind(col);
|
|
509
|
+
if (kind === "numeric") equal = cell !== null && cell !== void 0 && cell !== "" && Number(cell) === Number(value);
|
|
510
|
+
else if (kind === "boolean") equal = Boolean(cell) === Boolean(value);
|
|
511
|
+
else if (kind === "select") equal = cell == value;
|
|
512
|
+
else equal = this.normalize(cell) === this.normalize(value);
|
|
513
|
+
return rule.matchMode === "equals" ? equal : !equal;
|
|
514
|
+
}
|
|
515
|
+
case "lt":
|
|
516
|
+
case "lte":
|
|
517
|
+
case "gt":
|
|
518
|
+
case "gte": {
|
|
519
|
+
if (cell === null || cell === void 0 || cell === "") return false;
|
|
520
|
+
const a = Number(cell);
|
|
521
|
+
const b = Number(value);
|
|
522
|
+
if (isNaN(a) || isNaN(b)) return false;
|
|
523
|
+
if (rule.matchMode === "lt") return a < b;
|
|
524
|
+
if (rule.matchMode === "lte") return a <= b;
|
|
525
|
+
if (rule.matchMode === "gt") return a > b;
|
|
526
|
+
return a >= b;
|
|
527
|
+
}
|
|
528
|
+
case "dateIs":
|
|
529
|
+
case "dateIsNot":
|
|
530
|
+
case "dateBefore":
|
|
531
|
+
case "dateAfter": {
|
|
532
|
+
const a = this.toDay(cell);
|
|
533
|
+
const b = this.toDay(value);
|
|
534
|
+
if (b === null) return true;
|
|
535
|
+
if (a === null) return rule.matchMode === "dateIsNot";
|
|
536
|
+
if (rule.matchMode === "dateIs") return a === b;
|
|
537
|
+
if (rule.matchMode === "dateIsNot") return a !== b;
|
|
538
|
+
if (rule.matchMode === "dateBefore") return a < b;
|
|
539
|
+
return a > b;
|
|
540
|
+
}
|
|
541
|
+
case "in": return value.some((v) => v == cell);
|
|
542
|
+
case "between": {
|
|
543
|
+
if (cell === null || cell === void 0 || cell === "") return false;
|
|
544
|
+
const n = Number(cell);
|
|
545
|
+
return n >= value[0] && n <= value[1];
|
|
546
|
+
}
|
|
547
|
+
default: return true;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
setupColumnFilters(cols) {
|
|
551
|
+
const filterableCols = cols.filter((c) => c.filter);
|
|
552
|
+
const signature = filterableCols.map((c) => `${c.field}:${c.filterType ?? "text"}`).join("|");
|
|
553
|
+
if (signature === this.lastFilterFieldsSignature) return;
|
|
554
|
+
this.lastFilterFieldsSignature = signature;
|
|
555
|
+
const previous = this.filterState();
|
|
556
|
+
const next = {};
|
|
557
|
+
filterableCols.forEach((col) => {
|
|
558
|
+
next[col.field] = previous[col.field] ?? this.emptyFilterState(col);
|
|
559
|
+
});
|
|
560
|
+
this.filterState.set(next);
|
|
561
|
+
}
|
|
562
|
+
emitFilterChange() {
|
|
563
|
+
const filters = {};
|
|
564
|
+
const filterMeta = {};
|
|
565
|
+
const state = this.filterState();
|
|
566
|
+
this.columns().forEach((col) => {
|
|
567
|
+
if (!col.filter) return;
|
|
568
|
+
const rules = this.activeRules(col, state[col.field]);
|
|
569
|
+
if (rules.length === 0) return;
|
|
570
|
+
const key = this.filterFieldOf(col);
|
|
571
|
+
filters[key] = rules[0].value;
|
|
572
|
+
filterMeta[key] = this.cloneState({
|
|
573
|
+
operator: state[col.field].operator,
|
|
574
|
+
rules
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
this.filterChange.emit({
|
|
578
|
+
filters,
|
|
579
|
+
filterMeta
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
applySearch() {
|
|
583
|
+
const original = this.originalData();
|
|
584
|
+
const query = this.normalize(this.searchQuery().trim());
|
|
585
|
+
if (!query) this.searchedData.set([...original]);
|
|
586
|
+
else {
|
|
587
|
+
const fields = this.globalFilterFields();
|
|
588
|
+
const filtered = original.filter((item) => {
|
|
589
|
+
return (fields.length ? fields.map((f) => this.resolveField(item, f)) : Object.values(item ?? {}).filter((v) => v === null || typeof v !== "object" || v instanceof Date)).some((val) => {
|
|
590
|
+
if (val === null || val === void 0) return false;
|
|
591
|
+
return this.normalize(val).includes(query);
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
this.searchedData.set(filtered);
|
|
595
|
+
}
|
|
596
|
+
this.applyColumnFilters();
|
|
597
|
+
}
|
|
598
|
+
applyFilters() {
|
|
599
|
+
this.applySearch();
|
|
600
|
+
}
|
|
601
|
+
applyColumnFilters() {
|
|
602
|
+
let filtered = [...this.searchedData()];
|
|
603
|
+
const state = this.filterState();
|
|
604
|
+
this.columns().forEach((col) => {
|
|
605
|
+
if (!col.filter) return;
|
|
606
|
+
const colState = state[col.field];
|
|
607
|
+
const rules = this.activeRules(col, colState);
|
|
608
|
+
if (rules.length === 0) return;
|
|
609
|
+
const field = this.filterFieldOf(col);
|
|
610
|
+
filtered = filtered.filter((item) => {
|
|
611
|
+
const cell = this.resolveField(item, field);
|
|
612
|
+
return colState.operator === "or" ? rules.some((r) => this.matchRule(col, cell, r)) : rules.every((r) => this.matchRule(col, cell, r));
|
|
613
|
+
});
|
|
614
|
+
});
|
|
615
|
+
this.filteredData.set(filtered);
|
|
616
|
+
this.localTotalRecords.set(filtered.length);
|
|
617
|
+
this.applySort();
|
|
618
|
+
this.updateDisplayedData();
|
|
619
|
+
}
|
|
620
|
+
onFiltersChanged() {
|
|
621
|
+
this.first.set(0);
|
|
622
|
+
if (this.serverSide()) this.filterSubject.next();
|
|
623
|
+
else this.applyFilters();
|
|
624
|
+
this.cdr.markForCheck();
|
|
625
|
+
}
|
|
626
|
+
updateDisplayedData() {
|
|
627
|
+
const filtered = this.filteredData();
|
|
628
|
+
const firstIndex = this.first();
|
|
629
|
+
const rows = this.rowsPerPageLocal();
|
|
630
|
+
this.displayedData.set(filtered.slice(firstIndex, firstIndex + rows));
|
|
631
|
+
}
|
|
632
|
+
getSelectionKey(row) {
|
|
633
|
+
const key = this.dataKey();
|
|
634
|
+
return key && row?.[key] !== void 0 ? row[key] : row;
|
|
635
|
+
}
|
|
636
|
+
canSelectRow(row) {
|
|
637
|
+
const predicate = this.isRowSelectable();
|
|
638
|
+
return predicate ? predicate(row) : true;
|
|
639
|
+
}
|
|
640
|
+
isRowSelected(row) {
|
|
641
|
+
return this.selectedKeys().has(this.getSelectionKey(row));
|
|
642
|
+
}
|
|
643
|
+
toggleRowSelection(row) {
|
|
644
|
+
if (!this.canSelectRow(row)) return;
|
|
645
|
+
const key = this.getSelectionKey(row);
|
|
646
|
+
if (this.isRowSelected(row)) this.selection.set(this.selection().filter((r) => this.getSelectionKey(r) !== key));
|
|
647
|
+
else this.selection.set([...this.selection(), row]);
|
|
648
|
+
}
|
|
649
|
+
onRowClick(event, row) {
|
|
650
|
+
if (!this.selectable() || !this.selectOnRowClick()) return;
|
|
651
|
+
if (event.target?.closest("button, a, input, select, textarea, label, [role=\"button\"], [data-shk-select]")) return;
|
|
652
|
+
this.toggleRowSelection(row);
|
|
653
|
+
}
|
|
654
|
+
toggleSelectAllPage() {
|
|
655
|
+
const pageRows = this.selectablePageRows();
|
|
656
|
+
const pageKeys = new Set(pageRows.map((row) => this.getSelectionKey(row)));
|
|
657
|
+
const rest = this.selection().filter((r) => !pageKeys.has(this.getSelectionKey(r)));
|
|
658
|
+
this.selection.set(this.allPageSelected() ? rest : [...rest, ...pageRows]);
|
|
659
|
+
}
|
|
660
|
+
clearSelection() {
|
|
661
|
+
this.selection.set([]);
|
|
662
|
+
}
|
|
663
|
+
runBulkAction(action) {
|
|
664
|
+
action.onClick([...this.selection()]);
|
|
665
|
+
}
|
|
666
|
+
isBulkActionDisabled(action) {
|
|
667
|
+
return action.isDisabled ? action.isDisabled(this.selection()) : false;
|
|
668
|
+
}
|
|
669
|
+
pruneSelection(data) {
|
|
670
|
+
const current = this.selection();
|
|
671
|
+
if (current.length === 0) return;
|
|
672
|
+
const byKey = new Map(data.map((row) => [this.getSelectionKey(row), row]));
|
|
673
|
+
const next = current.map((row) => byKey.get(this.getSelectionKey(row))).filter((row) => row !== void 0);
|
|
674
|
+
if (next.length !== current.length || next.some((row, i) => row !== current[i])) this.selection.set(next);
|
|
675
|
+
}
|
|
676
|
+
resizedWidth(col) {
|
|
677
|
+
const width = this.isResizable() ? this.columnWidths()[col.field] : void 0;
|
|
678
|
+
return width ? `${width}px` : null;
|
|
679
|
+
}
|
|
680
|
+
resizedWidthPx(col) {
|
|
681
|
+
return this.columnWidths()[col.field] ?? null;
|
|
682
|
+
}
|
|
683
|
+
onHeaderClick(col) {
|
|
684
|
+
if (this.suppressHeaderClick) return;
|
|
685
|
+
if (col.field !== "actions" && col.sortable) this.toggleSort(col.field);
|
|
686
|
+
}
|
|
687
|
+
startResize(event, col) {
|
|
688
|
+
if (event.button !== 0) return;
|
|
689
|
+
event.preventDefault();
|
|
690
|
+
event.stopPropagation();
|
|
691
|
+
const th = event.target.closest("th");
|
|
692
|
+
if (!th) return;
|
|
693
|
+
const startX = event.clientX;
|
|
694
|
+
const startWidth = th.getBoundingClientRect().width;
|
|
695
|
+
let moved = false;
|
|
696
|
+
this.resizingField.set(col.field);
|
|
697
|
+
const body = document.body;
|
|
698
|
+
const previousCursor = body.style.cursor;
|
|
699
|
+
const previousSelect = body.style.userSelect;
|
|
700
|
+
body.style.cursor = "col-resize";
|
|
701
|
+
body.style.userSelect = "none";
|
|
702
|
+
const onMove = (e) => {
|
|
703
|
+
const dx = e.clientX - startX;
|
|
704
|
+
if (Math.abs(dx) > 2) moved = true;
|
|
705
|
+
this.setColumnWidth(col, startWidth + dx, false);
|
|
706
|
+
};
|
|
707
|
+
const onUp = () => {
|
|
708
|
+
document.removeEventListener("pointermove", onMove);
|
|
709
|
+
document.removeEventListener("pointerup", onUp);
|
|
710
|
+
document.removeEventListener("pointercancel", onUp);
|
|
711
|
+
body.style.cursor = previousCursor;
|
|
712
|
+
body.style.userSelect = previousSelect;
|
|
713
|
+
this.resizingField.set(null);
|
|
714
|
+
if (moved) this.syncRenderedWidth(col, th);
|
|
715
|
+
if (moved) {
|
|
716
|
+
this.suppressHeaderClick = true;
|
|
717
|
+
setTimeout(() => this.suppressHeaderClick = false);
|
|
718
|
+
this.columnResize.emit({
|
|
719
|
+
field: col.field,
|
|
720
|
+
width: this.columnWidths()[col.field] ?? null
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
this.cdr.markForCheck();
|
|
724
|
+
};
|
|
725
|
+
document.addEventListener("pointermove", onMove);
|
|
726
|
+
document.addEventListener("pointerup", onUp);
|
|
727
|
+
document.addEventListener("pointercancel", onUp);
|
|
728
|
+
}
|
|
729
|
+
onResizerKeydown(event, col) {
|
|
730
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") {
|
|
731
|
+
if (event.key === "Enter" || event.key === " ") event.stopPropagation();
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
event.preventDefault();
|
|
735
|
+
event.stopPropagation();
|
|
736
|
+
const th = event.target.closest("th");
|
|
737
|
+
if (!th) return;
|
|
738
|
+
const step = event.shiftKey ? 50 : 10;
|
|
739
|
+
const base = this.columnWidths()[col.field] ?? th.getBoundingClientRect().width;
|
|
740
|
+
this.setColumnWidth(col, base + (event.key === "ArrowRight" ? step : -step), true);
|
|
741
|
+
this.syncRenderedWidth(col, th);
|
|
742
|
+
}
|
|
743
|
+
syncRenderedWidth(col, th) {
|
|
744
|
+
afterNextRender({ read: () => {
|
|
745
|
+
const rendered = Math.round(th.getBoundingClientRect().width);
|
|
746
|
+
if (rendered && this.columnWidths()[col.field] !== rendered) {
|
|
747
|
+
this.columnWidths.update((w) => ({
|
|
748
|
+
...w,
|
|
749
|
+
[col.field]: rendered
|
|
750
|
+
}));
|
|
751
|
+
this.cdr.markForCheck();
|
|
752
|
+
}
|
|
753
|
+
} }, { injector: this.injector });
|
|
754
|
+
}
|
|
755
|
+
resetColumnWidths() {
|
|
756
|
+
this.columnWidths.set({});
|
|
757
|
+
}
|
|
758
|
+
storageFor(type) {
|
|
759
|
+
try {
|
|
760
|
+
return type === "session" ? window.sessionStorage : window.localStorage;
|
|
761
|
+
} catch {
|
|
762
|
+
return null;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
readStoredWidths(key, type) {
|
|
766
|
+
try {
|
|
767
|
+
const raw = this.storageFor(type)?.getItem(`${key}:columnWidths`);
|
|
768
|
+
if (!raw) return null;
|
|
769
|
+
const parsed = JSON.parse(raw);
|
|
770
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
771
|
+
const widths = {};
|
|
772
|
+
Object.entries(parsed).forEach(([field, width]) => {
|
|
773
|
+
if (typeof width === "number" && isFinite(width) && width > 0) widths[field] = width;
|
|
774
|
+
});
|
|
775
|
+
return widths;
|
|
776
|
+
} catch {
|
|
777
|
+
return null;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
writeStoredWidths(key, type, widths) {
|
|
781
|
+
try {
|
|
782
|
+
const storage = this.storageFor(type);
|
|
783
|
+
if (!storage) return;
|
|
784
|
+
if (Object.keys(widths).length === 0) storage.removeItem(`${key}:columnWidths`);
|
|
785
|
+
else storage.setItem(`${key}:columnWidths`, JSON.stringify(widths));
|
|
786
|
+
} catch {}
|
|
787
|
+
}
|
|
788
|
+
resetColumnWidth(col) {
|
|
789
|
+
const { [col.field]: _removed, ...rest } = this.columnWidths();
|
|
790
|
+
this.columnWidths.set(rest);
|
|
791
|
+
this.columnResize.emit({
|
|
792
|
+
field: col.field,
|
|
793
|
+
width: null
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
setColumnWidth(col, width, emit) {
|
|
797
|
+
const next = Math.max(this.MIN_COLUMN_WIDTH, Math.round(width));
|
|
798
|
+
this.columnWidths.update((w) => ({
|
|
799
|
+
...w,
|
|
800
|
+
[col.field]: next
|
|
801
|
+
}));
|
|
802
|
+
if (emit) this.columnResize.emit({
|
|
803
|
+
field: col.field,
|
|
804
|
+
width: next
|
|
805
|
+
});
|
|
806
|
+
this.cdr.markForCheck();
|
|
807
|
+
}
|
|
808
|
+
onFilterClick(value) {
|
|
809
|
+
this.filterClick.emit(value);
|
|
810
|
+
}
|
|
811
|
+
toggleSort(field) {
|
|
812
|
+
if (this.sortField() === field) this.sortOrder.set(this.sortOrder() * -1);
|
|
813
|
+
else {
|
|
814
|
+
this.sortField.set(field);
|
|
815
|
+
this.sortOrder.set(1);
|
|
816
|
+
}
|
|
817
|
+
this.first.set(0);
|
|
818
|
+
if (!this.serverSide()) {
|
|
819
|
+
this.applySort();
|
|
820
|
+
this.updateDisplayedData();
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
applySort() {
|
|
824
|
+
const field = this.sortField();
|
|
825
|
+
const order = this.sortOrder();
|
|
826
|
+
if (!field) return;
|
|
827
|
+
const col = this.columns().find((c) => c.field === field);
|
|
828
|
+
const path = col ? this.filterFieldOf(col) : field;
|
|
829
|
+
const data = [...this.filteredData()];
|
|
830
|
+
data.sort((a, b) => {
|
|
831
|
+
const va = this.resolveField(a, path);
|
|
832
|
+
const vb = this.resolveField(b, path);
|
|
833
|
+
if (va == null && vb == null) return 0;
|
|
834
|
+
if (va == null) return 1;
|
|
835
|
+
if (vb == null) return -1;
|
|
836
|
+
if (typeof va === "string" && typeof vb === "string") return va.localeCompare(vb, void 0, {
|
|
837
|
+
numeric: true,
|
|
838
|
+
sensitivity: "base"
|
|
839
|
+
}) * order;
|
|
840
|
+
if (va < vb) return -1 * order;
|
|
841
|
+
if (va > vb) return 1 * order;
|
|
842
|
+
return 0;
|
|
843
|
+
});
|
|
844
|
+
this.filteredData.set(data);
|
|
845
|
+
}
|
|
846
|
+
onSearchInput(value) {
|
|
847
|
+
this.searchQuery.set(value);
|
|
848
|
+
this.first.set(0);
|
|
849
|
+
if (this.serverSide()) this.searchSubject.next(value);
|
|
850
|
+
}
|
|
851
|
+
hasFilterValue(field) {
|
|
852
|
+
const col = this.columns().find((c) => c.field === field);
|
|
853
|
+
if (!col) return false;
|
|
854
|
+
return this.activeRules(col, this.filterState()[field]).length > 0;
|
|
855
|
+
}
|
|
856
|
+
commitDraft(col) {
|
|
857
|
+
const draft = this.filterDraft();
|
|
858
|
+
if (!draft) return;
|
|
859
|
+
this.filterState.update((s) => ({
|
|
860
|
+
...s,
|
|
861
|
+
[col.field]: this.cloneState(draft)
|
|
862
|
+
}));
|
|
863
|
+
this.onFiltersChanged();
|
|
864
|
+
}
|
|
865
|
+
setDraftOperator(operator) {
|
|
866
|
+
this.filterDraft.update((d) => d ? {
|
|
867
|
+
...d,
|
|
868
|
+
operator
|
|
869
|
+
} : d);
|
|
870
|
+
}
|
|
871
|
+
setDraftMatchMode(col, index, matchMode) {
|
|
872
|
+
this.filterDraft.update((d) => d ? {
|
|
873
|
+
...d,
|
|
874
|
+
rules: d.rules.map((r, i) => i === index ? {
|
|
875
|
+
...r,
|
|
876
|
+
matchMode
|
|
877
|
+
} : r)
|
|
878
|
+
} : d);
|
|
879
|
+
}
|
|
880
|
+
setDraftValue(col, index, value) {
|
|
881
|
+
this.filterDraft.update((d) => d ? {
|
|
882
|
+
...d,
|
|
883
|
+
rules: d.rules.map((r, i) => i === index ? {
|
|
884
|
+
...r,
|
|
885
|
+
value
|
|
886
|
+
} : r)
|
|
887
|
+
} : d);
|
|
888
|
+
if (this.appliesImmediately(col)) this.commitDraft(col);
|
|
889
|
+
}
|
|
890
|
+
onRuleInput(col, index, raw) {
|
|
891
|
+
const kind = this.filterKind(col);
|
|
892
|
+
const value = kind === "numeric" ? this.numericValue(raw) : kind === "date" ? raw || null : raw;
|
|
893
|
+
this.setDraftValue(col, index, value);
|
|
894
|
+
}
|
|
895
|
+
numericValue(raw) {
|
|
896
|
+
return raw === "" || raw === null || isNaN(Number(raw)) ? null : Number(raw);
|
|
897
|
+
}
|
|
898
|
+
addRule(col) {
|
|
899
|
+
if (!this.canAddRule(col)) return;
|
|
900
|
+
this.filterDraft.update((d) => d ? {
|
|
901
|
+
...d,
|
|
902
|
+
rules: [...d.rules, {
|
|
903
|
+
matchMode: this.defaultMatchMode(col),
|
|
904
|
+
value: null
|
|
905
|
+
}]
|
|
906
|
+
} : d);
|
|
907
|
+
}
|
|
908
|
+
removeRule(index) {
|
|
909
|
+
this.filterDraft.update((d) => d && d.rules.length > 1 ? {
|
|
910
|
+
...d,
|
|
911
|
+
rules: d.rules.filter((_, i) => i !== index)
|
|
912
|
+
} : d);
|
|
913
|
+
}
|
|
914
|
+
applyFilter(col) {
|
|
915
|
+
this.commitDraft(col);
|
|
916
|
+
this.closeFilters();
|
|
917
|
+
}
|
|
918
|
+
clearFilter(field) {
|
|
919
|
+
const col = this.columns().find((c) => c.field === field);
|
|
920
|
+
if (!col) return;
|
|
921
|
+
this.filterState.update((s) => ({
|
|
922
|
+
...s,
|
|
923
|
+
[field]: this.emptyFilterState(col)
|
|
924
|
+
}));
|
|
925
|
+
this.onFiltersChanged();
|
|
926
|
+
this.closeFilters();
|
|
927
|
+
}
|
|
928
|
+
isOptionSelected(value) {
|
|
929
|
+
const current = this.filterDraft()?.rules[0]?.value;
|
|
930
|
+
return Array.isArray(current) && current.some((v) => v == value);
|
|
931
|
+
}
|
|
932
|
+
toggleOption(col, value) {
|
|
933
|
+
const current = this.filterDraft()?.rules[0]?.value ?? [];
|
|
934
|
+
const next = current.some((v) => v == value) ? current.filter((v) => v != value) : [...current, value];
|
|
935
|
+
this.setDraftValue(col, 0, next.length ? next : null);
|
|
936
|
+
}
|
|
937
|
+
selectedOptionsLabel(col) {
|
|
938
|
+
const current = this.filterDraft()?.rules[0]?.value ?? [];
|
|
939
|
+
if (!current.length) return "";
|
|
940
|
+
const labels = (col.filterOptions ?? []).filter((o) => current.some((v) => v == o.value)).map((o) => o.label);
|
|
941
|
+
return labels.length > 2 ? this.filterLabel("selectedCount", { count: labels.length }) : labels.join(", ");
|
|
942
|
+
}
|
|
943
|
+
selectOption(col, value) {
|
|
944
|
+
const current = this.filterDraft()?.rules[0]?.value;
|
|
945
|
+
this.setDraftValue(col, 0, current != null && current == value ? null : value);
|
|
946
|
+
this.multiselectOpen.set(false);
|
|
947
|
+
}
|
|
948
|
+
selectedSingleLabel(col) {
|
|
949
|
+
const current = this.filterDraft()?.rules[0]?.value;
|
|
950
|
+
if (current === null || current === void 0) return "";
|
|
951
|
+
return (col.filterOptions ?? []).find((o) => o.value == current)?.label ?? String(current);
|
|
952
|
+
}
|
|
953
|
+
cycleBoolean(col) {
|
|
954
|
+
const current = this.filterDraft()?.rules[0]?.value;
|
|
955
|
+
const next = current === null || current === void 0 ? true : current === true ? false : null;
|
|
956
|
+
this.setDraftValue(col, 0, next);
|
|
957
|
+
}
|
|
958
|
+
rangeValue(col) {
|
|
959
|
+
const value = this.filterDraft()?.rules[0]?.value;
|
|
960
|
+
return Array.isArray(value) ? [value[0], value[1]] : this.rangeBounds(col);
|
|
961
|
+
}
|
|
962
|
+
onRangeInput(col, thumb, raw, commit) {
|
|
963
|
+
const [low, high] = this.rangeValue(col);
|
|
964
|
+
const n = Number(raw);
|
|
965
|
+
const next = thumb === 0 ? [Math.min(n, high), high] : [low, Math.max(n, low)];
|
|
966
|
+
this.filterDraft.update((d) => d ? {
|
|
967
|
+
...d,
|
|
968
|
+
rules: d.rules.map((r, i) => i === 0 ? {
|
|
969
|
+
...r,
|
|
970
|
+
value: next
|
|
971
|
+
} : r)
|
|
972
|
+
} : d);
|
|
973
|
+
if (commit) this.commitDraft(col);
|
|
974
|
+
}
|
|
975
|
+
rangePercent(col, value) {
|
|
976
|
+
const [min, max] = this.rangeBounds(col);
|
|
977
|
+
return max === min ? 0 : (value - min) / (max - min) * 100;
|
|
978
|
+
}
|
|
979
|
+
clearAll() {
|
|
980
|
+
const state = {};
|
|
981
|
+
this.columns().filter((c) => c.filter).forEach((col) => state[col.field] = this.emptyFilterState(col));
|
|
982
|
+
this.filterState.set(state);
|
|
983
|
+
this.closeFilters();
|
|
984
|
+
const hadSearch = !!this.searchQuery();
|
|
985
|
+
this.searchQuery.set("");
|
|
986
|
+
this.sortField.set(this.defaultSortField());
|
|
987
|
+
this.sortOrder.set(this.defaultSortOrder());
|
|
988
|
+
this.first.set(0);
|
|
989
|
+
if (this.serverSide()) {
|
|
990
|
+
this.emitFilterChange();
|
|
991
|
+
if (hadSearch) this.searchChange.emit("");
|
|
992
|
+
} else this.applyFilters();
|
|
993
|
+
this.cdr.markForCheck();
|
|
994
|
+
}
|
|
995
|
+
toggleFilter(col, event) {
|
|
996
|
+
const wasOpen = this.openFilterField() === col.field;
|
|
997
|
+
this.closeFilters();
|
|
998
|
+
if (wasOpen) return;
|
|
999
|
+
this.filterAnchor = event?.currentTarget ?? null;
|
|
1000
|
+
this.updateFilterPopupPosition();
|
|
1001
|
+
const applied = this.filterState()[col.field] ?? this.emptyFilterState(col);
|
|
1002
|
+
this.filterDraft.set(this.cloneState(applied));
|
|
1003
|
+
this.multiselectOpen.set(false);
|
|
1004
|
+
this.openFilterField.set(col.field);
|
|
1005
|
+
const reposition = () => this.updateFilterPopupPosition();
|
|
1006
|
+
window.addEventListener("scroll", reposition, true);
|
|
1007
|
+
window.addEventListener("resize", reposition);
|
|
1008
|
+
this.filterListenersCleanup = () => {
|
|
1009
|
+
window.removeEventListener("scroll", reposition, true);
|
|
1010
|
+
window.removeEventListener("resize", reposition);
|
|
1011
|
+
};
|
|
1012
|
+
setTimeout(() => document.querySelector(`#${this.uid}-filter-${this.safeId(col.field)}-0`)?.focus());
|
|
1013
|
+
this.cdr.markForCheck();
|
|
1014
|
+
}
|
|
1015
|
+
safeId(field) {
|
|
1016
|
+
return field.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
1017
|
+
}
|
|
1018
|
+
closeFilters() {
|
|
1019
|
+
this.filterListenersCleanup?.();
|
|
1020
|
+
this.filterListenersCleanup = null;
|
|
1021
|
+
this.filterAnchor = null;
|
|
1022
|
+
if (this.openFilterField() !== null) {
|
|
1023
|
+
this.openFilterField.set(null);
|
|
1024
|
+
this.filterDraft.set(null);
|
|
1025
|
+
this.cdr.markForCheck();
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
updateFilterPopupPosition() {
|
|
1029
|
+
if (!this.filterAnchor) return;
|
|
1030
|
+
const rect = this.filterAnchor.getBoundingClientRect();
|
|
1031
|
+
const maxLeft = window.innerWidth - this.FILTER_POPUP_WIDTH - 8;
|
|
1032
|
+
const left = Math.max(8, Math.min(rect.left, maxLeft));
|
|
1033
|
+
const top = rect.bottom + 6;
|
|
1034
|
+
this.filterPopupPosition.set({
|
|
1035
|
+
top,
|
|
1036
|
+
left,
|
|
1037
|
+
maxHeight: Math.max(200, window.innerHeight - top - 12)
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
getPageReport() {
|
|
1041
|
+
return this.pageReport();
|
|
1042
|
+
}
|
|
1043
|
+
goToPage(page) {
|
|
1044
|
+
const rows = this.rowsPerPageLocal();
|
|
1045
|
+
const total = this.effectiveTotalRecords();
|
|
1046
|
+
const pageCount = Math.max(1, Math.ceil(total / rows));
|
|
1047
|
+
const target = Math.min(Math.max(0, page), pageCount - 1);
|
|
1048
|
+
const first = target * rows;
|
|
1049
|
+
this.first.set(first);
|
|
1050
|
+
if (this.serverSide()) this.pageChange.emit({
|
|
1051
|
+
first,
|
|
1052
|
+
rows,
|
|
1053
|
+
page: target,
|
|
1054
|
+
pageCount: Math.ceil(total / rows)
|
|
1055
|
+
});
|
|
1056
|
+
else this.updateDisplayedData();
|
|
1057
|
+
}
|
|
1058
|
+
goToFirst() {
|
|
1059
|
+
this.goToPage(0);
|
|
1060
|
+
}
|
|
1061
|
+
goToLast() {
|
|
1062
|
+
this.goToPage(this.totalPages() - 1);
|
|
1063
|
+
}
|
|
1064
|
+
onRowsPerPageChange(rows) {
|
|
1065
|
+
rows = Number(rows);
|
|
1066
|
+
this.rowsPerPageLocal.set(rows);
|
|
1067
|
+
this.goToPage(0);
|
|
1068
|
+
}
|
|
1069
|
+
refreshData() {
|
|
1070
|
+
this.refresh.emit();
|
|
1071
|
+
}
|
|
1072
|
+
isFirstPage() {
|
|
1073
|
+
return this.first() === 0;
|
|
1074
|
+
}
|
|
1075
|
+
isLastPage() {
|
|
1076
|
+
return this.first() + this.rowsPerPageLocal() >= this.effectiveTotalRecords();
|
|
1077
|
+
}
|
|
1078
|
+
next() {
|
|
1079
|
+
this.goToPage(this.currentPage());
|
|
1080
|
+
}
|
|
1081
|
+
prev() {
|
|
1082
|
+
this.goToPage(this.currentPage() - 2);
|
|
1083
|
+
}
|
|
1084
|
+
reset() {
|
|
1085
|
+
this.goToFirst();
|
|
1086
|
+
}
|
|
1087
|
+
formatDateCell(value, col) {
|
|
1088
|
+
const locale = this.config.get("dates.locale")();
|
|
1089
|
+
const named = col.dateFormat && NAMED_DATE_STYLES[col.dateFormat];
|
|
1090
|
+
if (named) return formatDateStyle(value, named[0], locale, named[1]);
|
|
1091
|
+
const pattern = resolveDateFormat(col.dateFormat || this.config.get("dates.format")(), locale);
|
|
1092
|
+
return formatDate(value, pattern, locale);
|
|
1093
|
+
}
|
|
1094
|
+
formatCurrencyCell(value, col) {
|
|
1095
|
+
return formatCurrency(value, col.currency || this.config.get("numbers.currency")(), this.config.get("numbers.locale")(), this.config.get("numbers.decimals")());
|
|
1096
|
+
}
|
|
1097
|
+
getRowActionLabel(action, rowData) {
|
|
1098
|
+
return typeof action.label === "function" ? action.label(rowData) : action.label;
|
|
1099
|
+
}
|
|
1100
|
+
getRowActionIconName(action, rowData) {
|
|
1101
|
+
const icon = action.icon;
|
|
1102
|
+
return isIconResolver(icon) ? icon(rowData) : icon;
|
|
1103
|
+
}
|
|
1104
|
+
getRowActionClass(action, rowData) {
|
|
1105
|
+
if (!action.class) return "";
|
|
1106
|
+
return typeof action.class === "function" ? action.class(rowData) : action.class;
|
|
1107
|
+
}
|
|
1108
|
+
isHeaderActionDisabled(action) {
|
|
1109
|
+
return action.isDisabled ? action.isDisabled() : false;
|
|
1110
|
+
}
|
|
1111
|
+
isHeaderActionVisible(action) {
|
|
1112
|
+
return action.isVisible ? action.isVisible() : true;
|
|
1113
|
+
}
|
|
1114
|
+
isRowActionDisabled(action, rowData) {
|
|
1115
|
+
return action.isDisabled ? action.isDisabled(rowData) : false;
|
|
1116
|
+
}
|
|
1117
|
+
isRowActionVisible(action, rowData) {
|
|
1118
|
+
return action.isVisible ? action.isVisible(rowData) : true;
|
|
1119
|
+
}
|
|
1120
|
+
truncate(value, limit = 30) {
|
|
1121
|
+
if (value === null || value === void 0) return "";
|
|
1122
|
+
const str = String(value);
|
|
1123
|
+
return str.length > limit ? str.slice(0, limit) + "…" : str;
|
|
1124
|
+
}
|
|
1125
|
+
getProgress(col, rowData) {
|
|
1126
|
+
const n = Number(this.resolveField(rowData, col.field));
|
|
1127
|
+
return isNaN(n) ? 0 : Math.max(0, Math.min(100, n));
|
|
1128
|
+
}
|
|
1129
|
+
getTagValue(col, rowData) {
|
|
1130
|
+
return col.tagValue ? col.tagValue(rowData) : String(this.resolveField(rowData, col.field) ?? "");
|
|
1131
|
+
}
|
|
1132
|
+
getTagSeverity(col, rowData) {
|
|
1133
|
+
const raw = col.tagSeverity ? col.tagSeverity(rowData) : "secondary";
|
|
1134
|
+
return [
|
|
1135
|
+
"secondary",
|
|
1136
|
+
"success",
|
|
1137
|
+
"info",
|
|
1138
|
+
"warning",
|
|
1139
|
+
"danger",
|
|
1140
|
+
"contrast"
|
|
1141
|
+
].includes(raw) ? raw : "secondary";
|
|
1142
|
+
}
|
|
1143
|
+
getTagRounded(col, rowData) {
|
|
1144
|
+
if (typeof col.tagRounded === "function") return col.tagRounded(rowData);
|
|
1145
|
+
return col.tagRounded ?? false;
|
|
1146
|
+
}
|
|
1147
|
+
getTagIcon(col, rowData) {
|
|
1148
|
+
if (typeof col.tagIcon === "function") return col.tagIcon(rowData);
|
|
1149
|
+
return col.tagIcon ?? "";
|
|
1150
|
+
}
|
|
1151
|
+
getTagStyle(col, rowData) {
|
|
1152
|
+
return col.tagStyle ? col.tagStyle(rowData) || {} : {};
|
|
1153
|
+
}
|
|
1154
|
+
trackByRow(row, index) {
|
|
1155
|
+
return row?.id ?? row?._id ?? index;
|
|
1156
|
+
}
|
|
1157
|
+
onHeaderKeydown(event, col) {
|
|
1158
|
+
if (col.field === "actions" || !col.sortable) return;
|
|
1159
|
+
if (event.target !== event.currentTarget) return;
|
|
1160
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1161
|
+
event.preventDefault();
|
|
1162
|
+
this.toggleSort(col.field);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
getAriaSort(col) {
|
|
1166
|
+
if (col.field === "actions" || !col.sortable) return "none";
|
|
1167
|
+
if (this.sortField() !== col.field) return "none";
|
|
1168
|
+
return this.sortOrder() === 1 ? "ascending" : "descending";
|
|
1169
|
+
}
|
|
1170
|
+
getVisibleRowActions(rowData) {
|
|
1171
|
+
return this.rowActions().filter((a) => this.isRowActionVisible(a, rowData)).slice(0, this.MAX_VISIBLE_ACTIONS);
|
|
1172
|
+
}
|
|
1173
|
+
getHiddenRowActions(rowData) {
|
|
1174
|
+
return this.rowActions().filter((a) => this.isRowActionVisible(a, rowData)).slice(this.MAX_VISIBLE_ACTIONS);
|
|
1175
|
+
}
|
|
1176
|
+
toggleActionsDropdown(rowData, event) {
|
|
1177
|
+
const key = this.getRowKey(rowData);
|
|
1178
|
+
const wasOpen = !!this.actionsDropdownOpen()[key];
|
|
1179
|
+
const next = {};
|
|
1180
|
+
if (!wasOpen) next[key] = true;
|
|
1181
|
+
this.actionsDropdownOpen.set(next);
|
|
1182
|
+
if (!wasOpen) this.computeDropdownPosition(event);
|
|
1183
|
+
}
|
|
1184
|
+
computeDropdownPosition(event) {
|
|
1185
|
+
if (!event) return;
|
|
1186
|
+
const rect = (event.currentTarget || event.target).getBoundingClientRect();
|
|
1187
|
+
const dropdownHeight = 180;
|
|
1188
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
1189
|
+
let top = rect.bottom + 4;
|
|
1190
|
+
let left = rect.right - 160;
|
|
1191
|
+
if (spaceBelow < dropdownHeight) top = rect.top - dropdownHeight - 4;
|
|
1192
|
+
if (left < 8) left = 8;
|
|
1193
|
+
this.dropdownPosition.set({
|
|
1194
|
+
top,
|
|
1195
|
+
left
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
isActionsDropdownOpen(rowData) {
|
|
1199
|
+
const key = this.getRowKey(rowData);
|
|
1200
|
+
return !!this.actionsDropdownOpen()[key];
|
|
1201
|
+
}
|
|
1202
|
+
getRowKey(rowData) {
|
|
1203
|
+
return String(rowData?.id ?? rowData?._id ?? JSON.stringify(rowData));
|
|
1204
|
+
}
|
|
1205
|
+
onDocumentClick() {
|
|
1206
|
+
const current = this.actionsDropdownOpen();
|
|
1207
|
+
if (Object.values(current).some((v) => v)) this.actionsDropdownOpen.set({});
|
|
1208
|
+
this.closeFilters();
|
|
1209
|
+
}
|
|
1210
|
+
onEscape() {
|
|
1211
|
+
this.closeFilters();
|
|
1212
|
+
}
|
|
1213
|
+
static {
|
|
1214
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1215
|
+
minVersion: "12.0.0",
|
|
1216
|
+
version: "22.3.2",
|
|
1217
|
+
ngImport: i0,
|
|
1218
|
+
type: TableComponent,
|
|
1219
|
+
deps: [],
|
|
1220
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
static {
|
|
1224
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1225
|
+
minVersion: "17.0.0",
|
|
1226
|
+
version: "22.3.2",
|
|
1227
|
+
type: TableComponent,
|
|
1228
|
+
isStandalone: true,
|
|
1229
|
+
selector: "shk-table",
|
|
1230
|
+
inputs: {
|
|
1231
|
+
data: {
|
|
1232
|
+
classPropertyName: "data",
|
|
1233
|
+
publicName: "data",
|
|
1234
|
+
isSignal: true,
|
|
1235
|
+
isRequired: false,
|
|
1236
|
+
transformFunction: null
|
|
1237
|
+
},
|
|
1238
|
+
columns: {
|
|
1239
|
+
classPropertyName: "columns",
|
|
1240
|
+
publicName: "columns",
|
|
1241
|
+
isSignal: true,
|
|
1242
|
+
isRequired: false,
|
|
1243
|
+
transformFunction: null
|
|
1244
|
+
},
|
|
1245
|
+
rowsPerPage: {
|
|
1246
|
+
classPropertyName: "rowsPerPage",
|
|
1247
|
+
publicName: "rowsPerPage",
|
|
1248
|
+
isSignal: true,
|
|
1249
|
+
isRequired: false,
|
|
1250
|
+
transformFunction: null
|
|
1251
|
+
},
|
|
1252
|
+
rowsPerPageOptions: {
|
|
1253
|
+
classPropertyName: "rowsPerPageOptions",
|
|
1254
|
+
publicName: "rowsPerPageOptions",
|
|
1255
|
+
isSignal: true,
|
|
1256
|
+
isRequired: false,
|
|
1257
|
+
transformFunction: null
|
|
1258
|
+
},
|
|
1259
|
+
loading: {
|
|
1260
|
+
classPropertyName: "loading",
|
|
1261
|
+
publicName: "loading",
|
|
1262
|
+
isSignal: true,
|
|
1263
|
+
isRequired: false,
|
|
1264
|
+
transformFunction: null
|
|
1265
|
+
},
|
|
1266
|
+
showActionRow: {
|
|
1267
|
+
classPropertyName: "showActionRow",
|
|
1268
|
+
publicName: "showActionRow",
|
|
1269
|
+
isSignal: true,
|
|
1270
|
+
isRequired: false,
|
|
1271
|
+
transformFunction: null
|
|
1272
|
+
},
|
|
1273
|
+
customTemplates: {
|
|
1274
|
+
classPropertyName: "customTemplates",
|
|
1275
|
+
publicName: "customTemplates",
|
|
1276
|
+
isSignal: true,
|
|
1277
|
+
isRequired: false,
|
|
1278
|
+
transformFunction: null
|
|
1279
|
+
},
|
|
1280
|
+
headerActions: {
|
|
1281
|
+
classPropertyName: "headerActions",
|
|
1282
|
+
publicName: "headerActions",
|
|
1283
|
+
isSignal: true,
|
|
1284
|
+
isRequired: false,
|
|
1285
|
+
transformFunction: null
|
|
1286
|
+
},
|
|
1287
|
+
rowActions: {
|
|
1288
|
+
classPropertyName: "rowActions",
|
|
1289
|
+
publicName: "rowActions",
|
|
1290
|
+
isSignal: true,
|
|
1291
|
+
isRequired: false,
|
|
1292
|
+
transformFunction: null
|
|
1293
|
+
},
|
|
1294
|
+
hasShadow: {
|
|
1295
|
+
classPropertyName: "hasShadow",
|
|
1296
|
+
publicName: "hasShadow",
|
|
1297
|
+
isSignal: true,
|
|
1298
|
+
isRequired: false,
|
|
1299
|
+
transformFunction: null
|
|
1300
|
+
},
|
|
1301
|
+
defaultSortField: {
|
|
1302
|
+
classPropertyName: "defaultSortField",
|
|
1303
|
+
publicName: "defaultSortField",
|
|
1304
|
+
isSignal: true,
|
|
1305
|
+
isRequired: false,
|
|
1306
|
+
transformFunction: null
|
|
1307
|
+
},
|
|
1308
|
+
defaultSortOrder: {
|
|
1309
|
+
classPropertyName: "defaultSortOrder",
|
|
1310
|
+
publicName: "defaultSortOrder",
|
|
1311
|
+
isSignal: true,
|
|
1312
|
+
isRequired: false,
|
|
1313
|
+
transformFunction: null
|
|
1314
|
+
},
|
|
1315
|
+
showSearch: {
|
|
1316
|
+
classPropertyName: "showSearch",
|
|
1317
|
+
publicName: "showSearch",
|
|
1318
|
+
isSignal: true,
|
|
1319
|
+
isRequired: false,
|
|
1320
|
+
transformFunction: null
|
|
1321
|
+
},
|
|
1322
|
+
searchPlaceholder: {
|
|
1323
|
+
classPropertyName: "searchPlaceholder",
|
|
1324
|
+
publicName: "searchPlaceholder",
|
|
1325
|
+
isSignal: true,
|
|
1326
|
+
isRequired: false,
|
|
1327
|
+
transformFunction: null
|
|
1328
|
+
},
|
|
1329
|
+
globalFilterFields: {
|
|
1330
|
+
classPropertyName: "globalFilterFields",
|
|
1331
|
+
publicName: "globalFilterFields",
|
|
1332
|
+
isSignal: true,
|
|
1333
|
+
isRequired: false,
|
|
1334
|
+
transformFunction: null
|
|
1335
|
+
},
|
|
1336
|
+
emptyMessage: {
|
|
1337
|
+
classPropertyName: "emptyMessage",
|
|
1338
|
+
publicName: "emptyMessage",
|
|
1339
|
+
isSignal: true,
|
|
1340
|
+
isRequired: false,
|
|
1341
|
+
transformFunction: null
|
|
1342
|
+
},
|
|
1343
|
+
serverSide: {
|
|
1344
|
+
classPropertyName: "serverSide",
|
|
1345
|
+
publicName: "serverSide",
|
|
1346
|
+
isSignal: true,
|
|
1347
|
+
isRequired: false,
|
|
1348
|
+
transformFunction: null
|
|
1349
|
+
},
|
|
1350
|
+
totalRecords: {
|
|
1351
|
+
classPropertyName: "totalRecords",
|
|
1352
|
+
publicName: "totalRecords",
|
|
1353
|
+
isSignal: true,
|
|
1354
|
+
isRequired: false,
|
|
1355
|
+
transformFunction: null
|
|
1356
|
+
},
|
|
1357
|
+
filters: {
|
|
1358
|
+
classPropertyName: "filters",
|
|
1359
|
+
publicName: "filters",
|
|
1360
|
+
isSignal: true,
|
|
1361
|
+
isRequired: false,
|
|
1362
|
+
transformFunction: null
|
|
1363
|
+
},
|
|
1364
|
+
activeFilter: {
|
|
1365
|
+
classPropertyName: "activeFilter",
|
|
1366
|
+
publicName: "activeFilter",
|
|
1367
|
+
isSignal: true,
|
|
1368
|
+
isRequired: false,
|
|
1369
|
+
transformFunction: null
|
|
1370
|
+
},
|
|
1371
|
+
showGridlines: {
|
|
1372
|
+
classPropertyName: "showGridlines",
|
|
1373
|
+
publicName: "showGridlines",
|
|
1374
|
+
isSignal: true,
|
|
1375
|
+
isRequired: false,
|
|
1376
|
+
transformFunction: null
|
|
1377
|
+
},
|
|
1378
|
+
resizableColumns: {
|
|
1379
|
+
classPropertyName: "resizableColumns",
|
|
1380
|
+
publicName: "resizableColumns",
|
|
1381
|
+
isSignal: true,
|
|
1382
|
+
isRequired: false,
|
|
1383
|
+
transformFunction: null
|
|
1384
|
+
},
|
|
1385
|
+
rowValidations: {
|
|
1386
|
+
classPropertyName: "rowValidations",
|
|
1387
|
+
publicName: "rowValidations",
|
|
1388
|
+
isSignal: true,
|
|
1389
|
+
isRequired: false,
|
|
1390
|
+
transformFunction: null
|
|
1391
|
+
},
|
|
1392
|
+
columnWidths: {
|
|
1393
|
+
classPropertyName: "columnWidths",
|
|
1394
|
+
publicName: "columnWidths",
|
|
1395
|
+
isSignal: true,
|
|
1396
|
+
isRequired: false,
|
|
1397
|
+
transformFunction: null
|
|
1398
|
+
},
|
|
1399
|
+
stateKey: {
|
|
1400
|
+
classPropertyName: "stateKey",
|
|
1401
|
+
publicName: "stateKey",
|
|
1402
|
+
isSignal: true,
|
|
1403
|
+
isRequired: false,
|
|
1404
|
+
transformFunction: null
|
|
1405
|
+
},
|
|
1406
|
+
stateStorage: {
|
|
1407
|
+
classPropertyName: "stateStorage",
|
|
1408
|
+
publicName: "stateStorage",
|
|
1409
|
+
isSignal: true,
|
|
1410
|
+
isRequired: false,
|
|
1411
|
+
transformFunction: null
|
|
1412
|
+
},
|
|
1413
|
+
rowHover: {
|
|
1414
|
+
classPropertyName: "rowHover",
|
|
1415
|
+
publicName: "rowHover",
|
|
1416
|
+
isSignal: true,
|
|
1417
|
+
isRequired: false,
|
|
1418
|
+
transformFunction: null
|
|
1419
|
+
},
|
|
1420
|
+
showClearButton: {
|
|
1421
|
+
classPropertyName: "showClearButton",
|
|
1422
|
+
publicName: "showClearButton",
|
|
1423
|
+
isSignal: true,
|
|
1424
|
+
isRequired: false,
|
|
1425
|
+
transformFunction: null
|
|
1426
|
+
},
|
|
1427
|
+
showPageReport: {
|
|
1428
|
+
classPropertyName: "showPageReport",
|
|
1429
|
+
publicName: "showPageReport",
|
|
1430
|
+
isSignal: true,
|
|
1431
|
+
isRequired: false,
|
|
1432
|
+
transformFunction: null
|
|
1433
|
+
},
|
|
1434
|
+
showRowsPerPage: {
|
|
1435
|
+
classPropertyName: "showRowsPerPage",
|
|
1436
|
+
publicName: "showRowsPerPage",
|
|
1437
|
+
isSignal: true,
|
|
1438
|
+
isRequired: false,
|
|
1439
|
+
transformFunction: null
|
|
1440
|
+
},
|
|
1441
|
+
selectable: {
|
|
1442
|
+
classPropertyName: "selectable",
|
|
1443
|
+
publicName: "selectable",
|
|
1444
|
+
isSignal: true,
|
|
1445
|
+
isRequired: false,
|
|
1446
|
+
transformFunction: null
|
|
1447
|
+
},
|
|
1448
|
+
dataKey: {
|
|
1449
|
+
classPropertyName: "dataKey",
|
|
1450
|
+
publicName: "dataKey",
|
|
1451
|
+
isSignal: true,
|
|
1452
|
+
isRequired: false,
|
|
1453
|
+
transformFunction: null
|
|
1454
|
+
},
|
|
1455
|
+
isRowSelectable: {
|
|
1456
|
+
classPropertyName: "isRowSelectable",
|
|
1457
|
+
publicName: "isRowSelectable",
|
|
1458
|
+
isSignal: true,
|
|
1459
|
+
isRequired: false,
|
|
1460
|
+
transformFunction: null
|
|
1461
|
+
},
|
|
1462
|
+
selectOnRowClick: {
|
|
1463
|
+
classPropertyName: "selectOnRowClick",
|
|
1464
|
+
publicName: "selectOnRowClick",
|
|
1465
|
+
isSignal: true,
|
|
1466
|
+
isRequired: false,
|
|
1467
|
+
transformFunction: null
|
|
1468
|
+
},
|
|
1469
|
+
bulkActions: {
|
|
1470
|
+
classPropertyName: "bulkActions",
|
|
1471
|
+
publicName: "bulkActions",
|
|
1472
|
+
isSignal: true,
|
|
1473
|
+
isRequired: false,
|
|
1474
|
+
transformFunction: null
|
|
1475
|
+
},
|
|
1476
|
+
selection: {
|
|
1477
|
+
classPropertyName: "selection",
|
|
1478
|
+
publicName: "selection",
|
|
1479
|
+
isSignal: true,
|
|
1480
|
+
isRequired: false,
|
|
1481
|
+
transformFunction: null
|
|
1482
|
+
}
|
|
1483
|
+
},
|
|
1484
|
+
outputs: {
|
|
1485
|
+
columnWidths: "columnWidthsChange",
|
|
1486
|
+
selection: "selectionChange",
|
|
1487
|
+
refresh: "refresh",
|
|
1488
|
+
pageChange: "pageChange",
|
|
1489
|
+
filterChange: "filterChange",
|
|
1490
|
+
searchChange: "searchChange",
|
|
1491
|
+
filterClick: "filterClick",
|
|
1492
|
+
columnResize: "columnResize"
|
|
1493
|
+
},
|
|
1494
|
+
host: { listeners: {
|
|
1495
|
+
"document:click": "onDocumentClick()",
|
|
1496
|
+
"document:keydown.escape": "onEscape()"
|
|
1497
|
+
} },
|
|
1498
|
+
ngImport: i0,
|
|
1499
|
+
template: "<div class=\"space-y-2 min-[1440px]:space-y-3 mt-2 min-[1440px]:mt-3 animate-fade-in pb-8\">\n @if (\n showSearch() ||\n (showClearButton() && hasFilterableColumns()) ||\n filters().length > 0 ||\n headerActions().length > 0 ||\n (selectable() && bulkActions().length > 0 && selection().length > 0)\n ) {\n <div class=\"card p-2 min-[1440px]:p-2.5 flex flex-row items-center justify-between gap-2\">\n <div class=\"flex items-center gap-2 min-[1440px]:gap-3 flex-1 min-w-0\">\n @if (showSearch()) {\n <div class=\"relative w-full md:w-52 min-[1440px]:w-56\">\n <label [for]=\"uid + '-search'\" class=\"sr-only\">{{\n searchPlaceholder() || ('common.search_placeholder' | transloco)\n }}</label>\n <div class=\"absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none\">\n <svg\n [shkIcon]=\"getIcon('search')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400\"\n ></svg>\n </div>\n <input\n [id]=\"uid + '-search'\"\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($any($event.target).value)\"\n [placeholder]=\"searchPlaceholder() || ('common.search_placeholder' | transloco)\"\n class=\"block w-full pl-8 pr-3 py-1.5 text-xs border _shk-border rounded-md leading-5 _shk-bg-surface-50 placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)] _shk-text-surface-700 focus:outline-none focus:bg-white dark:focus:[background-color:var(--shk-surface-100)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)]\"\n />\n </div>\n }\n @if (showClearButton() && (hasFilterableColumns() || showSearch())) {\n <shk-tooltip [text]=\"tr('table.clearFilters', 'Limpiar búsqueda, filtros y orden')\">\n <button\n type=\"button\"\n (click)=\"clearAll()\"\n [disabled]=\"!hasActiveFilters()\"\n class=\"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border _shk-border _shk-text-surface-600 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed whitespace-nowrap\"\n >\n <svg [shkIcon]=\"icons.clear\" class=\"w-3.5 h-3.5\"></svg>\n {{ tr('table.clear', 'Limpiar') }}\n </button>\n </shk-tooltip>\n }\n @if (filters().length > 0) {\n <div\n class=\"flex _shk-bg-surface-100 p-0.5 rounded-md ml-auto\"\n role=\"group\"\n >\n @for (f of filters(); track f.value) {\n <button\n type=\"button\"\n (click)=\"onFilterClick(f.value)\"\n [attr.aria-pressed]=\"f.value === activeFilter()\"\n class=\"px-2.5 min-[1440px]:px-3 py-1 text-xs font-medium rounded _shk-text-surface-700 transition-all\"\n [class]=\"\n f.value === activeFilter()\n ? 'bg-white shadow-sm dark:[background-color:var(--shk-surface-700)]'\n : ''\n \"\n >\n {{ f.label }}\n </button>\n }\n </div>\n }\n </div>\n @if (selectable() && selection().length > 0 && bulkActions().length > 0) {\n <div\n class=\"flex items-center gap-1.5 shrink-0\"\n role=\"toolbar\"\n [attr.aria-label]=\"'table.selected' | transloco: { count: selection().length }\"\n >\n <span\n class=\"text-xs font-medium _shk-text-surface-600 whitespace-nowrap\"\n aria-live=\"polite\"\n >{{ 'table.selected' | transloco: { count: selection().length } }}</span\n >\n <button\n type=\"button\"\n (click)=\"clearSelection()\"\n [attr.aria-label]=\"'table.clearSelection' | transloco\"\n class=\"table-action-btn rounded-md _shk-text-surface-500 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n @for (action of visibleBulkActions(); track $index) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isBulkActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"runBulkAction(action)\"\n >\n @if (action.icon) {\n <svg [shkIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n </div>\n }\n @if (headerActions().length > 0) {\n <div class=\"flex items-center gap-1.5 shrink-0\">\n @for (action of headerActions(); track $index) {\n @if (isHeaderActionVisible(action)) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isHeaderActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"action.onClick()\"\n >\n @if (action.icon) {\n <svg [shkIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n }\n </div>\n }\n </div>\n }\n <div class=\"card p-0 overflow-hidden table-card\" [class.shadow-lg]=\"hasShadow()\">\n <div class=\"table-scroll-wrapper _shk-scrollbar\">\n <table\n class=\"shk-data-table\"\n [class.shk-gridlines]=\"showGridlines()\"\n [class.shk-row-hover]=\"rowHover()\"\n >\n <thead>\n <tr>\n @if (selectable()) {\n <th\n scope=\"col\"\n data-shk-select\n class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center _shk-bg-surface-50 border-b _shk-border\"\n >\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"allPageSelected()\"\n [indeterminate]=\"somePageSelected()\"\n [disabled]=\"loading() || selectablePageRows().length === 0\"\n (change)=\"toggleSelectAllPage()\"\n [attr.aria-label]=\"'table.selectAll' | transloco\"\n />\n </th>\n }\n @for (col of columnsWithActions(); track col.field) {\n <th\n scope=\"col\"\n (click)=\"onHeaderClick(col)\"\n (keydown)=\"onHeaderKeydown($event, col)\"\n [tabindex]=\"col.field !== 'actions' && col.sortable ? 0 : -1\"\n [attr.role]=\"col.field !== 'actions' && col.sortable ? 'button' : null\"\n [attr.aria-sort]=\"getAriaSort(col)\"\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [style.cursor]=\"col.field !== 'actions' && col.sortable ? 'pointer' : 'default'\"\n [style.width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : null)\"\n [style.min-width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : col.minWidth) || null\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n class=\"relative px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-left text-[10px] min-[1440px]:text-xs font-bold _shk-text-surface-500 uppercase tracking-wider _shk-bg-surface-50 border-b _shk-border focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n >\n @if (col.field !== 'actions') {\n <div class=\"flex items-center justify-between gap-2\">\n <span>{{ col.header }}</span>\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (col.sortable) {\n <shk-tooltip [text]=\"'table.tooltips.sort' | transloco\">\n @if (sortField() === col.field) {\n <svg\n [shkIcon]=\"getIcon(sortOrder() === 1 ? 'arrow-up' : 'arrow-down')\"\n class=\"w-3.5 h-3.5 _shk-text-primary\"\n ></svg>\n } @else {\n <svg\n [shkIcon]=\"getIcon('arrow-up-down')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400\"\n ></svg>\n }\n </shk-tooltip>\n }\n @if (col.filter) {\n <shk-tooltip [text]=\"'table.tooltips.filter' | transloco\">\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleFilter(col, $event)\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [attr.aria-expanded]=\"openFilterField() === col.field\"\n aria-haspopup=\"dialog\"\n class=\"_shk-text-surface-400 hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n >\n <svg\n [shkIcon]=\"getIcon('filter')\"\n class=\"w-3.5 h-3.5\"\n [class._shk-text-primary]=\"hasFilterValue(col.field) || openFilterField() === col.field\"\n ></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n </div>\n\n\n <!-- Column filter menu -->\n @if (col.filter && openFilterField() === col.field && filterDraft(); as draft) {\n <div\n shkPortal\n class=\"shk-filter-overlay fixed z-[9999] w-[240px] overflow-y-auto normal-case tracking-normal font-normal text-xs _shk-text-surface-700 bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border rounded-lg shadow-lg\"\n role=\"dialog\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [style.top.px]=\"filterPopupPosition().top\"\n [style.left.px]=\"filterPopupPosition().left\"\n [style.max-height.px]=\"filterPopupPosition().maxHeight\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"closeFilters()\"\n >\n @if (col.filterMenuTitle) {\n <div class=\"px-2 pt-2 font-semibold _shk-text-surface-800\">\n {{ col.filterMenuTitle }}\n </div>\n }\n @if (showOperatorFor(col)) {\n <div class=\"p-2 border-b _shk-border\">\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"filterLabel('matchAll') + ' / ' + filterLabel('matchAny')\"\n (change)=\"setDraftOperator($any($event.target).value)\"\n >\n <option value=\"and\" [selected]=\"draft.operator === 'and'\">\n {{ filterLabel('matchAll') }}\n </option>\n <option value=\"or\" [selected]=\"draft.operator === 'or'\">\n {{ filterLabel('matchAny') }}\n </option>\n </select>\n </div>\n }\n\n @switch (filterKind(col)) {\n @case ('select') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: false }\"\n ></ng-container>\n }\n @case ('multiselect') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: true }\"\n ></ng-container>\n }\n @case ('boolean') {\n @let boolValue = draft.rules[0].value;\n <div class=\"p-2\">\n <button\n type=\"button\"\n role=\"checkbox\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n class=\"inline-flex items-center gap-2 rounded-md focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n [attr.aria-checked]=\"\n boolValue === true ? 'true' : boolValue === false ? 'false' : 'mixed'\n \"\n (click)=\"cycleBoolean(col)\"\n >\n <span\n class=\"shk-checkbox-box\"\n [class.shk-checked]=\"boolValue === true || boolValue === false\"\n >\n @if (boolValue === true) {\n <svg [shkIcon]=\"getIcon('check')\"></svg>\n } @else if (boolValue === false) {\n <svg [shkIcon]=\"getIcon('x')\"></svg>\n }\n </span>\n <span>{{\n boolValue === true\n ? filterLabel('yes')\n : boolValue === false\n ? filterLabel('no')\n : filterLabel('any')\n }}</span>\n </button>\n </div>\n }\n @case ('range') {\n @let rv = rangeValue(col);\n @let bounds = rangeBounds(col);\n <div class=\"p-2\">\n <div class=\"shk-range\">\n <div class=\"shk-range-track\"></div>\n <div\n class=\"shk-range-fill\"\n [style.left.%]=\"rangePercent(col, rv[0])\"\n [style.width.%]=\"rangePercent(col, rv[1]) - rangePercent(col, rv[0])\"\n ></div>\n <input\n type=\"range\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[0]\"\n [style.z-index]=\"rv[0] >= bounds[1] ? 3 : null\"\n [attr.aria-label]=\"col.header + ' min'\"\n (input)=\"onRangeInput(col, 0, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 0, $any($event.target).value, true)\"\n />\n <input\n type=\"range\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[1]\"\n [attr.aria-label]=\"col.header + ' max'\"\n (input)=\"onRangeInput(col, 1, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 1, $any($event.target).value, true)\"\n />\n </div>\n <div class=\"flex items-center justify-between px-0.5 _shk-text-surface-500\">\n <span>{{ rv[0] }}</span>\n <span>{{ rv[1] }}</span>\n </div>\n </div>\n }\n @default {\n <!-- text / numeric / date: one block per rule -->\n @for (rule of draft.rules; track $index; let i = $index) {\n <div\n class=\"flex flex-col gap-1.5 p-2\"\n [class.border-b]=\"i < draft.rules.length - 1\"\n [class._shk-border]=\"i < draft.rules.length - 1\"\n >\n @if (showMatchModesFor(col)) {\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"col.header\"\n (change)=\"setDraftMatchMode(col, i, $any($event.target).value)\"\n >\n @for (mode of matchModesFor(col); track mode) {\n <option [value]=\"mode\" [selected]=\"mode === rule.matchMode\">\n {{ matchModeLabel(mode) }}\n </option>\n }\n </select>\n }\n <input\n [id]=\"uid + '-filter-' + safeId(col.field) + '-' + i\"\n [type]=\"filterKind(col) === 'numeric' ? 'number' : filterKind(col) === 'date' ? 'date' : 'text'\"\n [attr.step]=\"filterKind(col) === 'numeric' ? 'any' : null\"\n class=\"shk-filter-input\"\n [value]=\"rule.value ?? ''\"\n [placeholder]=\"col.filterPlaceholder || ('common.search_placeholder' | transloco)\"\n [attr.aria-label]=\"col.header\"\n (input)=\"onRuleInput(col, i, $any($event.target).value)\"\n (keydown.enter)=\"applyFilter(col)\"\n />\n @if (draft.rules.length > 1) {\n <button\n type=\"button\"\n class=\"inline-flex items-center justify-center gap-1 py-1 rounded-md [color:var(--shk-error-600)] hover:[background-color:var(--shk-error-50)] transition-colors\"\n (click)=\"removeRule(i)\"\n >\n <svg [shkIcon]=\"icons.trash\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('removeRule') }}\n </button>\n }\n </div>\n }\n @if (canAddRule(col)) {\n <div class=\"px-2 pb-1\">\n <button\n type=\"button\"\n class=\"w-full inline-flex items-center justify-center gap-1 py-1 rounded-md _shk-text-primary hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"addRule(col)\"\n >\n <svg [shkIcon]=\"getIcon('plus')\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('addRule') }}\n </button>\n </div>\n }\n }\n }\n\n <div class=\"flex items-center justify-between gap-2 p-2 border-t _shk-border\">\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md border _shk-border _shk-text-surface-600 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"clearFilter(col.field)\"\n >\n {{ filterLabel('clear') }}\n </button>\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors\"\n (click)=\"applyFilter(col)\"\n >\n {{ filterLabel('apply') }}\n </button>\n </div>\n </div>\n }\n } @else {\n <div class=\"flex items-center justify-center\">\n <span>{{ col.header }}</span>\n </div>\n }\n @if (isResizable()) {\n <span\n class=\"shk-col-resizer\"\n [class.shk-resizing]=\"resizingField() === col.field\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n [attr.aria-label]=\"tr('table.resizeColumn', 'Redimensionar columna') + ': ' + col.header\"\n [attr.aria-valuenow]=\"resizedWidthPx(col)\"\n (pointerdown)=\"startResize($event, col)\"\n (click)=\"$event.stopPropagation()\"\n (dblclick)=\"$event.stopPropagation(); resetColumnWidth(col)\"\n (keydown)=\"onResizerKeydown($event, col)\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n @if (loading()) {\n <tbody class=\"border-b _shk-border\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div\n class=\"flex items-center justify-center\"\n role=\"status\"\n [attr.aria-label]=\"'common.loading' | transloco\"\n >\n <svg\n [shkIcon]=\"getIcon('loader')\"\n class=\"w-6 h-6 animate-spin _shk-text-primary\"\n ></svg>\n </div>\n </td>\n </tr>\n </tbody>\n } @else if (effectiveDisplayedData().length === 0) {\n <tbody class=\"border-b _shk-border\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div class=\"flex flex-col items-center\">\n <div\n class=\"w-16 h-16 _shk-bg-surface-100 rounded-full flex items-center justify-center mb-4\"\n >\n <svg\n [shkIcon]=\"getIcon('inbox')\"\n class=\"w-8 h-8 _shk-text-surface-400\"\n ></svg>\n </div>\n <p\n class=\"text-lg font-semibold _shk-text-surface-600\"\n >\n {{ emptyMessage() || ('common.no_records' | transloco) }}\n </p>\n </div>\n </td>\n </tr>\n </tbody>\n } @else {\n <tbody>\n @for (rowData of effectiveDisplayedData(); track trackByRow(rowData, $index)) {\n @let rowSeverityValue = rowSeverity(rowData);\n <tr\n [attr.aria-selected]=\"selectable() ? isRowSelected(rowData) : null\"\n [class.shk-row-selected]=\"selectable() && isRowSelected(rowData)\"\n [class.shk-row-low]=\"rowSeverityValue === 'low'\"\n [class.shk-row-moderate]=\"rowSeverityValue === 'moderate'\"\n [class.shk-row-critical]=\"rowSeverityValue === 'critical'\"\n [class.cursor-pointer]=\"selectable() && selectOnRowClick() && canSelectRow(rowData)\"\n (click)=\"onRowClick($event, rowData)\"\n class=\"shk-data-row transition-colors duration-200 border-b _shk-border\"\n >\n @if (selectable()) {\n <td data-shk-select class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center\">\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"isRowSelected(rowData)\"\n [disabled]=\"!canSelectRow(rowData)\"\n (change)=\"toggleRowSelection(rowData)\"\n [attr.aria-label]=\"'table.selectRow' | transloco: { index: first() + $index + 1 }\"\n />\n </td>\n }\n @for (col of columnsWithActions(); track col.field) {\n <td\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [class]=\"\n 'px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)] ' +\n (col.field === 'actions' ? 'whitespace-nowrap' : 'whitespace-normal break-words')\n \"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n >\n @if (col.field !== 'actions') {\n @switch (col.template) {\n @case ('tag') {\n <shk-tag\n [value]=\"getTagValue(col, rowData)\"\n [severity]=\"getTagSeverity(col, rowData)\"\n [rounded]=\"getTagRounded(col, rowData)\"\n [icon]=\"getTagIcon(col, rowData)\"\n [style]=\"getTagStyle(col, rowData)\"\n />\n }\n @case ('progress') {\n <div\n class=\"shk-progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"getProgress(col, rowData)\"\n [attr.aria-label]=\"col.header\"\n >\n <div [style.width.%]=\"getProgress(col, rowData)\"></div>\n </div>\n }\n @case ('boolean') {\n @if (resolveField(rowData, col.field)) {\n <svg\n [shkIcon]=\"icons.yes\"\n class=\"w-4 h-4 [color:var(--shk-success-600)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('yes')\"\n ></svg>\n } @else {\n <svg\n [shkIcon]=\"icons.no\"\n class=\"w-4 h-4 [color:var(--shk-error-500)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('no')\"\n ></svg>\n }\n }\n @case ('date') {\n {{ formatDateCell(resolveField(rowData, col.field), col) }}\n }\n @case ('currency') {\n {{ formatCurrencyCell(resolveField(rowData, col.field), col) }}\n }\n @default {\n @if (col.image) {\n <div class=\"flex items-center gap-2\">\n @if (col.image(rowData); as src) {\n <img\n [src]=\"src\"\n alt=\"\"\n [width]=\"col.imageWidth || 24\"\n class=\"shrink-0 rounded-sm\"\n />\n }\n <span>\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n </span>\n </div>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n }\n }\n }\n } @else {\n <div class=\"flex items-center justify-start gap-px\">\n @for (action of getVisibleRowActions(rowData); track $index) {\n @if (isRowActionVisible(action, rowData)) {\n <div class=\"relative group\">\n <shk-tooltip\n [text]=\"getRowActionLabel(action, rowData)\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData)\"\n [class]=\"\n 'table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md ' +\n getRowActionClass(action, rowData)\n \"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [attr.aria-label]=\"getRowActionLabel(action, rowData)\"\n >\n <svg\n [shkIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n </div>\n }\n }\n @if (getHiddenRowActions(rowData).length > 0) {\n <div class=\"relative\">\n <shk-tooltip\n [text]=\"'common.more_options' | transloco\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleActionsDropdown(rowData, $event)\"\n class=\"table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md\"\n [attr.aria-label]=\"'common.more_options' | transloco\"\n [attr.aria-expanded]=\"isActionsDropdownOpen(rowData)\"\n >\n <svg\n [shkIcon]=\"getIcon('ellipsis-vertical')\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n @if (isActionsDropdownOpen(rowData)) {\n <div\n shkPortal\n class=\"fixed z-[9999] min-w-[160px] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border rounded-md shadow-lg py-1\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n >\n @for (action of getHiddenRowActions(rowData); track $index) {\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData); toggleActionsDropdown(rowData)\"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [class]=\"\n 'w-full flex items-center gap-2 px-3 py-2 text-xs text-left _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors ' +\n getRowActionClass(action, rowData)\n \"\n >\n <svg\n [shkIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-3.5 h-3.5 shrink-0\"\n ></svg>\n <span>{{ getRowActionLabel(action, rowData) }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n @if (rowSeverityValue) {\n <div class=\"relative group\">\n <shk-tooltip [text]=\"rowValidationTitle(rowData) || ''\" position=\"top\">\n <span\n class=\"shk-row-validation-btn\"\n [class.shk-sev-low]=\"rowSeverityValue === 'low'\"\n [class.shk-sev-moderate]=\"rowSeverityValue === 'moderate'\"\n [class.shk-sev-critical]=\"rowSeverityValue === 'critical'\"\n tabindex=\"0\"\n role=\"note\"\n [attr.aria-label]=\"rowValidationLabel(rowData)\"\n >\n <svg [shkIcon]=\"rowValidationIcon(rowData)\"></svg>\n </span>\n </shk-tooltip>\n </div>\n }\n </div>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n }\n </table>\n\n <!-- Text content of a cell: format() · custom template · raw value -->\n <ng-template #cellText let-rowData let-col=\"col\">\n @if (col.format) {\n <span>{{ col.format(rowData) }}</span>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplates()[col.field] || defaultTemplate;\n context: { $implicit: rowData, field: col.field }\n \"\n ></ng-container>\n }\n </ng-template>\n <ng-template #defaultTemplate let-rowData let-field=\"field\">\n {{ resolveField(rowData, field) }}\n </ng-template>\n\n <!-- Option list of the select / multiselect filters -->\n <ng-template #optionList let-col let-draft=\"draft\" let-multiple=\"multiple\">\n <div class=\"p-2 space-y-1.5\">\n @let selectedLabel = multiple ? selectedOptionsLabel(col) : selectedSingleLabel(col);\n <button\n type=\"button\"\n class=\"shk-filter-select flex items-center justify-between gap-2 text-left\"\n style=\"background-image: none\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [attr.aria-expanded]=\"multiselectOpen()\"\n (click)=\"multiselectOpen.set(!multiselectOpen())\"\n >\n <span class=\"truncate\" [class._shk-text-surface-400]=\"!selectedLabel\">\n {{ selectedLabel || tr('table.filterAll', 'Todos') }}\n </span>\n <svg\n [shkIcon]=\"getIcon('chevron-down')\"\n class=\"w-3.5 h-3.5 shrink-0 _shk-text-surface-400 transition-transform\"\n [class.rotate-180]=\"multiselectOpen()\"\n ></svg>\n </button>\n @if (multiselectOpen()) {\n <div\n class=\"max-h-52 overflow-y-auto p-0.5 border _shk-border rounded-md _shk-scrollbar\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple\"\n >\n @for (opt of col.filterOptions || []; track $index) {\n @let isSelected = multiple\n ? isOptionSelected(opt.value)\n : draft.rules[0].value != null && draft.rules[0].value == opt.value;\n <button\n type=\"button\"\n role=\"option\"\n class=\"w-full flex items-center gap-2 px-2 py-1.5 rounded text-left transition-colors hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [class._shk-bg-primary-soft]=\"isSelected\"\n [class._shk-text-primary-700]=\"isSelected\"\n [attr.aria-selected]=\"isSelected\"\n (click)=\"multiple ? toggleOption(col, opt.value) : selectOption(col, opt.value)\"\n >\n @if (multiple) {\n <span class=\"shk-checkbox-box\" [class.shk-checked]=\"isSelected\">\n @if (isSelected) {\n <svg [shkIcon]=\"getIcon('check')\"></svg>\n }\n </span>\n }\n @if (opt.image) {\n <img [src]=\"opt.image\" alt=\"\" width=\"22\" class=\"shrink-0 rounded-sm\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n </ng-template>\n </div>\n <div\n class=\"table-pagination flex items-center justify-between gap-4 px-2 min-[1440px]:px-3 py-2 border-t _shk-border\"\n >\n <div class=\"text-xs _shk-text-surface-600\">\n @if (showPageReport()) {\n {{ pageReport() }}\n }\n </div>\n <div\n class=\"flex items-center gap-0.5\"\n role=\"navigation\"\n >\n <button\n type=\"button\"\n (click)=\"goToFirst()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.firstPage', 'Primera página')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevrons-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"prev()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.prevPage', 'Página anterior')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span\n class=\"px-2 text-xs font-medium _shk-text-surface-700\"\n >{{ currentPage() }} / {{ totalPages() }}</span\n >\n <button\n type=\"button\"\n (click)=\"next()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.nextPage', 'Página siguiente')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"goToLast()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.lastPage', 'Última página')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevrons-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n <div\n class=\"flex items-center gap-1.5 text-xs _shk-text-surface-600\"\n >\n @if (showRowsPerPage()) {\n <label [for]=\"uid + '-rows-per-page'\">{{ 'table.rows' | transloco }}</label>\n <select\n [id]=\"uid + '-rows-per-page'\"\n (change)=\"onRowsPerPageChange($any($event.target).value)\"\n class=\"border _shk-border rounded px-2 py-1 text-xs bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 focus:outline-none focus:[border-color:var(--shk-primary-500)]\"\n >\n @for (opt of rowsPerPageOptions(); track opt) {\n <option [value]=\"opt\" [selected]=\"opt === rowsPerPageLocal()\">{{ opt }}</option>\n }\n </select>\n }\n </div>\n </div>\n </div>\n</div>\n",
|
|
1500
|
+
styles: ["input:focus{outline:none}input[type=text]{font-weight:400!important}table th{white-space:nowrap}table td{white-space:normal;overflow-wrap:break-word}.shk-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.375rem;transition:background-color .15s ease,color .15s ease}.shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.shk-page-btn:focus-visible{outline:none;box-shadow:0 0 0 2px color-mix(in srgb,var(--shk-primary-500) 45%,transparent)}td button svg{width:1.125rem!important;height:1.125rem!important}td button:disabled{opacity:.4;cursor:not-allowed}.table-action-btn svg{width:1rem!important;height:1rem!important;min-width:1rem!important;min-height:1rem!important}.table-action-btn{padding:.5rem!important;min-width:2rem!important;min-height:2rem!important;display:inline-flex!important;align-items:center!important;justify-content:center!important}.table-scroll-wrapper{width:100%;overflow-x:auto;overflow-y:hidden;border-radius:inherit;-webkit-overflow-scrolling:touch;container-type:inline-size}.table-card,.table-pagination{container-type:inline-size}@container (max-width: 640px){.table-pagination{flex-direction:column;align-items:center;gap:.5rem}.table-pagination>div{justify-content:center}}.table-scroll-wrapper table{table-layout:auto;width:100%}@container (max-width: 768px){.table-scroll-wrapper{scroll-snap-type:x mandatory}.table-scroll-wrapper table{table-layout:auto;width:100%}.table-scroll-wrapper th:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px)}.table-scroll-wrapper td:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px);max-width:var(--shk-col-width, 140px)}.table-scroll-wrapper th,.table-scroll-wrapper td{scroll-snap-align:start}}th[data-shk-select],td[data-shk-select]{width:2.5rem;min-width:2.5rem}.shk-table-checkbox{width:.875rem;height:.875rem;cursor:pointer;vertical-align:middle;accent-color:var(--shk-primary-500)}.shk-table-checkbox:disabled{opacity:.4;cursor:not-allowed}tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-50) 60%,transparent)}tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 90%,transparent)}:host-context(.dark) tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-900) 20%,transparent)}:host-context(.dark) tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 30%,transparent)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.shk-data-table tr.shk-row-low{background-color:color-mix(in srgb,var(--shk-info-600) 22%,transparent)}.shk-data-table tr.shk-row-moderate{background-color:color-mix(in srgb,var(--shk-warning-400) 32%,transparent)}.shk-data-table tr.shk-row-critical{background-color:color-mix(in srgb,var(--shk-error-500) 20%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-low{background-color:color-mix(in srgb,var(--shk-info-600) 26%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-moderate{background-color:color-mix(in srgb,var(--shk-warning-400) 34%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-critical{background-color:color-mix(in srgb,var(--shk-error-500) 24%,transparent)}.shk-row-validation-btn{display:inline-flex;align-items:center;justify-content:center;padding:.25rem;border-radius:.375rem;cursor:help;color:var(--shk-surface-500)}.shk-row-validation-btn svg{width:1rem!important;height:1rem!important}.shk-row-validation-btn.shk-sev-low{color:var(--shk-info-600)}.shk-row-validation-btn.shk-sev-moderate{color:var(--shk-warning-600)}:host-context(.dark) .shk-row-validation-btn.shk-sev-moderate{color:var(--shk-warning-400)}.shk-row-validation-btn.shk-sev-critical{color:var(--shk-error-500)}.shk-row-validation-btn:focus-visible{outline:2px solid currentColor;outline-offset:1px}table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 30%,transparent)}:host-context(.dark) table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 10%,transparent)}table.shk-gridlines th,table.shk-gridlines td{border-right:1px solid var(--shk-surface-200)}table.shk-gridlines th:last-child,table.shk-gridlines td:last-child{border-right:0}:host-context(.dark) table.shk-gridlines th,:host-context(.dark) table.shk-gridlines td{border-right-color:var(--shk-surface-200)}.shk-col-resizer{position:absolute;top:0;right:-4px;z-index:1;width:8px;height:100%;cursor:col-resize;touch-action:none}.shk-col-resizer:after{content:\"\";position:absolute;top:20%;bottom:20%;left:3px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.shk-col-resizer:hover:after,.shk-col-resizer:focus-visible:after,.shk-col-resizer.shk-resizing:after{background-color:var(--shk-primary-500)}.shk-col-resizer:focus-visible{outline:none}th:last-child .shk-col-resizer{right:0}.shk-filter-input,.shk-filter-select{width:100%;padding:.375rem .625rem;font-size:.75rem;line-height:1.25rem;border-radius:.375rem;border:1px solid var(--shk-surface-200);background-color:#fff;color:var(--shk-surface-700)}.dark .shk-filter-input,.dark .shk-filter-select{background-color:var(--shk-surface-100);border-color:var(--shk-surface-200);color-scheme:dark}.shk-filter-input::placeholder{color:var(--shk-surface-400)}select.shk-filter-select{appearance:none;padding-right:1.75rem;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .5rem center;cursor:pointer}button.shk-filter-select{cursor:pointer}.shk-filter-input:focus,.shk-filter-select:focus{outline:none;border-color:var(--shk-primary-500);box-shadow:0 0 0 1px var(--shk-primary-500)}.shk-checkbox-box{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:.875rem;height:.875rem;border-radius:.1875rem;border:1px solid var(--shk-surface-300);background-color:#fff;color:#fff}.dark .shk-checkbox-box{background-color:var(--shk-surface-100)}.shk-checkbox-box.shk-checked{background-color:var(--shk-primary-500);border-color:var(--shk-primary-500)}.shk-checkbox-box svg{width:.625rem;height:.625rem}.shk-range{position:relative;height:1rem;margin:.5rem .375rem .375rem}.shk-range-track,.shk-range-fill{position:absolute;top:50%;height:.1875rem;transform:translateY(-50%);border-radius:9999px}.shk-range-track{left:0;right:0;background-color:var(--shk-surface-200)}.shk-range-fill{background-color:var(--shk-primary-500)}.shk-range input[type=range]{position:absolute;inset:0;width:100%;margin:0;background:transparent;pointer-events:none;appearance:none;-webkit-appearance:none}.shk-range input[type=range]::-webkit-slider-thumb{pointer-events:auto;-webkit-appearance:none;width:.875rem;height:.875rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-range input[type=range]::-moz-range-thumb{pointer-events:auto;width:.625rem;height:.625rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-progress{height:.375rem;min-width:5rem;border-radius:9999px;background-color:var(--shk-surface-200);overflow:hidden}.shk-progress>div{height:100%;border-radius:inherit;background-color:var(--shk-primary-500)}\n"],
|
|
1501
|
+
dependencies: [
|
|
1502
|
+
{
|
|
1503
|
+
kind: "directive",
|
|
1504
|
+
type: PortalDirective,
|
|
1505
|
+
selector: "[shkPortal]"
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
kind: "ngmodule",
|
|
1509
|
+
type: CommonModule
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
kind: "directive",
|
|
1513
|
+
type: i1.NgTemplateOutlet,
|
|
1514
|
+
selector: "[ngTemplateOutlet]",
|
|
1515
|
+
inputs: [
|
|
1516
|
+
"ngTemplateOutletContext",
|
|
1517
|
+
"ngTemplateOutlet",
|
|
1518
|
+
"ngTemplateOutletInjector"
|
|
1519
|
+
]
|
|
1520
|
+
},
|
|
1521
|
+
{
|
|
1522
|
+
kind: "ngmodule",
|
|
1523
|
+
type: TranslocoModule
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
kind: "directive",
|
|
1527
|
+
type: ShkIconDirective,
|
|
1528
|
+
selector: "svg[shkIcon]",
|
|
1529
|
+
inputs: [
|
|
1530
|
+
"shkIcon",
|
|
1531
|
+
"size",
|
|
1532
|
+
"strokeWidth",
|
|
1533
|
+
"color"
|
|
1534
|
+
]
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
kind: "component",
|
|
1538
|
+
type: TagComponent,
|
|
1539
|
+
selector: "shk-tag",
|
|
1540
|
+
inputs: [
|
|
1541
|
+
"value",
|
|
1542
|
+
"severity",
|
|
1543
|
+
"rounded",
|
|
1544
|
+
"icon",
|
|
1545
|
+
"style",
|
|
1546
|
+
"styleClass"
|
|
1547
|
+
]
|
|
1548
|
+
},
|
|
1549
|
+
{
|
|
1550
|
+
kind: "component",
|
|
1551
|
+
type: TooltipComponent,
|
|
1552
|
+
selector: "shk-tooltip",
|
|
1553
|
+
inputs: [
|
|
1554
|
+
"text",
|
|
1555
|
+
"position",
|
|
1556
|
+
"mode",
|
|
1557
|
+
"offset"
|
|
1558
|
+
]
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
kind: "pipe",
|
|
1562
|
+
type: i2.TranslocoPipe,
|
|
1563
|
+
name: "transloco"
|
|
1564
|
+
}
|
|
1565
|
+
],
|
|
1566
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
};
|
|
1570
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1571
|
+
minVersion: "12.0.0",
|
|
1572
|
+
version: "22.3.2",
|
|
1573
|
+
ngImport: i0,
|
|
1574
|
+
type: TableComponent,
|
|
1575
|
+
decorators: [{
|
|
1576
|
+
type: Component,
|
|
1577
|
+
args: [{
|
|
1578
|
+
selector: "shk-table",
|
|
1579
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1580
|
+
imports: [
|
|
1581
|
+
PortalDirective,
|
|
1582
|
+
CommonModule,
|
|
1583
|
+
TranslocoModule,
|
|
1584
|
+
ShkIconDirective,
|
|
1585
|
+
TagComponent,
|
|
1586
|
+
TooltipComponent
|
|
1587
|
+
],
|
|
1588
|
+
template: "<div class=\"space-y-2 min-[1440px]:space-y-3 mt-2 min-[1440px]:mt-3 animate-fade-in pb-8\">\n @if (\n showSearch() ||\n (showClearButton() && hasFilterableColumns()) ||\n filters().length > 0 ||\n headerActions().length > 0 ||\n (selectable() && bulkActions().length > 0 && selection().length > 0)\n ) {\n <div class=\"card p-2 min-[1440px]:p-2.5 flex flex-row items-center justify-between gap-2\">\n <div class=\"flex items-center gap-2 min-[1440px]:gap-3 flex-1 min-w-0\">\n @if (showSearch()) {\n <div class=\"relative w-full md:w-52 min-[1440px]:w-56\">\n <label [for]=\"uid + '-search'\" class=\"sr-only\">{{\n searchPlaceholder() || ('common.search_placeholder' | transloco)\n }}</label>\n <div class=\"absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none\">\n <svg\n [shkIcon]=\"getIcon('search')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400\"\n ></svg>\n </div>\n <input\n [id]=\"uid + '-search'\"\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($any($event.target).value)\"\n [placeholder]=\"searchPlaceholder() || ('common.search_placeholder' | transloco)\"\n class=\"block w-full pl-8 pr-3 py-1.5 text-xs border _shk-border rounded-md leading-5 _shk-bg-surface-50 placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-500)] _shk-text-surface-700 focus:outline-none focus:bg-white dark:focus:[background-color:var(--shk-surface-100)] focus:[border-color:var(--shk-primary-500)] focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)]\"\n />\n </div>\n }\n @if (showClearButton() && (hasFilterableColumns() || showSearch())) {\n <shk-tooltip [text]=\"tr('table.clearFilters', 'Limpiar búsqueda, filtros y orden')\">\n <button\n type=\"button\"\n (click)=\"clearAll()\"\n [disabled]=\"!hasActiveFilters()\"\n class=\"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border _shk-border _shk-text-surface-600 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed whitespace-nowrap\"\n >\n <svg [shkIcon]=\"icons.clear\" class=\"w-3.5 h-3.5\"></svg>\n {{ tr('table.clear', 'Limpiar') }}\n </button>\n </shk-tooltip>\n }\n @if (filters().length > 0) {\n <div\n class=\"flex _shk-bg-surface-100 p-0.5 rounded-md ml-auto\"\n role=\"group\"\n >\n @for (f of filters(); track f.value) {\n <button\n type=\"button\"\n (click)=\"onFilterClick(f.value)\"\n [attr.aria-pressed]=\"f.value === activeFilter()\"\n class=\"px-2.5 min-[1440px]:px-3 py-1 text-xs font-medium rounded _shk-text-surface-700 transition-all\"\n [class]=\"\n f.value === activeFilter()\n ? 'bg-white shadow-sm dark:[background-color:var(--shk-surface-700)]'\n : ''\n \"\n >\n {{ f.label }}\n </button>\n }\n </div>\n }\n </div>\n @if (selectable() && selection().length > 0 && bulkActions().length > 0) {\n <div\n class=\"flex items-center gap-1.5 shrink-0\"\n role=\"toolbar\"\n [attr.aria-label]=\"'table.selected' | transloco: { count: selection().length }\"\n >\n <span\n class=\"text-xs font-medium _shk-text-surface-600 whitespace-nowrap\"\n aria-live=\"polite\"\n >{{ 'table.selected' | transloco: { count: selection().length } }}</span\n >\n <button\n type=\"button\"\n (click)=\"clearSelection()\"\n [attr.aria-label]=\"'table.clearSelection' | transloco\"\n class=\"table-action-btn rounded-md _shk-text-surface-500 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-3.5 h-3.5\"></svg>\n </button>\n @for (action of visibleBulkActions(); track $index) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isBulkActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"runBulkAction(action)\"\n >\n @if (action.icon) {\n <svg [shkIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n </div>\n }\n @if (headerActions().length > 0) {\n <div class=\"flex items-center gap-1.5 shrink-0\">\n @for (action of headerActions(); track $index) {\n @if (isHeaderActionVisible(action)) {\n <button\n type=\"button\"\n [class]=\"\n 'inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed ' +\n (action.class || '')\n \"\n [disabled]=\"isHeaderActionDisabled(action)\"\n [attr.aria-label]=\"action.label\"\n (click)=\"action.onClick()\"\n >\n @if (action.icon) {\n <svg [shkIcon]=\"getIcon(action.icon)\" class=\"w-3.5 h-3.5\"></svg>\n }\n {{ action.label }}\n </button>\n }\n }\n </div>\n }\n </div>\n }\n <div class=\"card p-0 overflow-hidden table-card\" [class.shadow-lg]=\"hasShadow()\">\n <div class=\"table-scroll-wrapper _shk-scrollbar\">\n <table\n class=\"shk-data-table\"\n [class.shk-gridlines]=\"showGridlines()\"\n [class.shk-row-hover]=\"rowHover()\"\n >\n <thead>\n <tr>\n @if (selectable()) {\n <th\n scope=\"col\"\n data-shk-select\n class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center _shk-bg-surface-50 border-b _shk-border\"\n >\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"allPageSelected()\"\n [indeterminate]=\"somePageSelected()\"\n [disabled]=\"loading() || selectablePageRows().length === 0\"\n (change)=\"toggleSelectAllPage()\"\n [attr.aria-label]=\"'table.selectAll' | transloco\"\n />\n </th>\n }\n @for (col of columnsWithActions(); track col.field) {\n <th\n scope=\"col\"\n (click)=\"onHeaderClick(col)\"\n (keydown)=\"onHeaderKeydown($event, col)\"\n [tabindex]=\"col.field !== 'actions' && col.sortable ? 0 : -1\"\n [attr.role]=\"col.field !== 'actions' && col.sortable ? 'button' : null\"\n [attr.aria-sort]=\"getAriaSort(col)\"\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [style.cursor]=\"col.field !== 'actions' && col.sortable ? 'pointer' : 'default'\"\n [style.width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : null)\"\n [style.min-width]=\"resizedWidth(col) || (col.field === 'actions' ? col.width : col.minWidth) || null\"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n class=\"relative px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-left text-[10px] min-[1440px]:text-xs font-bold _shk-text-surface-500 uppercase tracking-wider _shk-bg-surface-50 border-b _shk-border focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n >\n @if (col.field !== 'actions') {\n <div class=\"flex items-center justify-between gap-2\">\n <span>{{ col.header }}</span>\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (col.sortable) {\n <shk-tooltip [text]=\"'table.tooltips.sort' | transloco\">\n @if (sortField() === col.field) {\n <svg\n [shkIcon]=\"getIcon(sortOrder() === 1 ? 'arrow-up' : 'arrow-down')\"\n class=\"w-3.5 h-3.5 _shk-text-primary\"\n ></svg>\n } @else {\n <svg\n [shkIcon]=\"getIcon('arrow-up-down')\"\n class=\"w-3.5 h-3.5 _shk-text-surface-400\"\n ></svg>\n }\n </shk-tooltip>\n }\n @if (col.filter) {\n <shk-tooltip [text]=\"'table.tooltips.filter' | transloco\">\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleFilter(col, $event)\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [attr.aria-expanded]=\"openFilterField() === col.field\"\n aria-haspopup=\"dialog\"\n class=\"_shk-text-surface-400 hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n >\n <svg\n [shkIcon]=\"getIcon('filter')\"\n class=\"w-3.5 h-3.5\"\n [class._shk-text-primary]=\"hasFilterValue(col.field) || openFilterField() === col.field\"\n ></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n </div>\n\n\n <!-- Column filter menu -->\n @if (col.filter && openFilterField() === col.field && filterDraft(); as draft) {\n <div\n shkPortal\n class=\"shk-filter-overlay fixed z-[9999] w-[240px] overflow-y-auto normal-case tracking-normal font-normal text-xs _shk-text-surface-700 bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border rounded-lg shadow-lg\"\n role=\"dialog\"\n [attr.aria-label]=\"('table.tooltips.filter' | transloco) + ': ' + col.header\"\n [style.top.px]=\"filterPopupPosition().top\"\n [style.left.px]=\"filterPopupPosition().left\"\n [style.max-height.px]=\"filterPopupPosition().maxHeight\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"closeFilters()\"\n >\n @if (col.filterMenuTitle) {\n <div class=\"px-2 pt-2 font-semibold _shk-text-surface-800\">\n {{ col.filterMenuTitle }}\n </div>\n }\n @if (showOperatorFor(col)) {\n <div class=\"p-2 border-b _shk-border\">\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"filterLabel('matchAll') + ' / ' + filterLabel('matchAny')\"\n (change)=\"setDraftOperator($any($event.target).value)\"\n >\n <option value=\"and\" [selected]=\"draft.operator === 'and'\">\n {{ filterLabel('matchAll') }}\n </option>\n <option value=\"or\" [selected]=\"draft.operator === 'or'\">\n {{ filterLabel('matchAny') }}\n </option>\n </select>\n </div>\n }\n\n @switch (filterKind(col)) {\n @case ('select') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: false }\"\n ></ng-container>\n }\n @case ('multiselect') {\n <ng-container\n *ngTemplateOutlet=\"optionList; context: { $implicit: col, draft: draft, multiple: true }\"\n ></ng-container>\n }\n @case ('boolean') {\n @let boolValue = draft.rules[0].value;\n <div class=\"p-2\">\n <button\n type=\"button\"\n role=\"checkbox\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n class=\"inline-flex items-center gap-2 rounded-md focus:outline-none focus-visible:ring-1 focus-visible:[--tw-ring-color:var(--shk-primary-500)]\"\n [attr.aria-checked]=\"\n boolValue === true ? 'true' : boolValue === false ? 'false' : 'mixed'\n \"\n (click)=\"cycleBoolean(col)\"\n >\n <span\n class=\"shk-checkbox-box\"\n [class.shk-checked]=\"boolValue === true || boolValue === false\"\n >\n @if (boolValue === true) {\n <svg [shkIcon]=\"getIcon('check')\"></svg>\n } @else if (boolValue === false) {\n <svg [shkIcon]=\"getIcon('x')\"></svg>\n }\n </span>\n <span>{{\n boolValue === true\n ? filterLabel('yes')\n : boolValue === false\n ? filterLabel('no')\n : filterLabel('any')\n }}</span>\n </button>\n </div>\n }\n @case ('range') {\n @let rv = rangeValue(col);\n @let bounds = rangeBounds(col);\n <div class=\"p-2\">\n <div class=\"shk-range\">\n <div class=\"shk-range-track\"></div>\n <div\n class=\"shk-range-fill\"\n [style.left.%]=\"rangePercent(col, rv[0])\"\n [style.width.%]=\"rangePercent(col, rv[1]) - rangePercent(col, rv[0])\"\n ></div>\n <input\n type=\"range\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[0]\"\n [style.z-index]=\"rv[0] >= bounds[1] ? 3 : null\"\n [attr.aria-label]=\"col.header + ' min'\"\n (input)=\"onRangeInput(col, 0, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 0, $any($event.target).value, true)\"\n />\n <input\n type=\"range\"\n [min]=\"bounds[0]\"\n [max]=\"bounds[1]\"\n [step]=\"col.filterStep || 1\"\n [value]=\"rv[1]\"\n [attr.aria-label]=\"col.header + ' max'\"\n (input)=\"onRangeInput(col, 1, $any($event.target).value, false)\"\n (change)=\"onRangeInput(col, 1, $any($event.target).value, true)\"\n />\n </div>\n <div class=\"flex items-center justify-between px-0.5 _shk-text-surface-500\">\n <span>{{ rv[0] }}</span>\n <span>{{ rv[1] }}</span>\n </div>\n </div>\n }\n @default {\n <!-- text / numeric / date: one block per rule -->\n @for (rule of draft.rules; track $index; let i = $index) {\n <div\n class=\"flex flex-col gap-1.5 p-2\"\n [class.border-b]=\"i < draft.rules.length - 1\"\n [class._shk-border]=\"i < draft.rules.length - 1\"\n >\n @if (showMatchModesFor(col)) {\n <select\n class=\"shk-filter-select\"\n [attr.aria-label]=\"col.header\"\n (change)=\"setDraftMatchMode(col, i, $any($event.target).value)\"\n >\n @for (mode of matchModesFor(col); track mode) {\n <option [value]=\"mode\" [selected]=\"mode === rule.matchMode\">\n {{ matchModeLabel(mode) }}\n </option>\n }\n </select>\n }\n <input\n [id]=\"uid + '-filter-' + safeId(col.field) + '-' + i\"\n [type]=\"filterKind(col) === 'numeric' ? 'number' : filterKind(col) === 'date' ? 'date' : 'text'\"\n [attr.step]=\"filterKind(col) === 'numeric' ? 'any' : null\"\n class=\"shk-filter-input\"\n [value]=\"rule.value ?? ''\"\n [placeholder]=\"col.filterPlaceholder || ('common.search_placeholder' | transloco)\"\n [attr.aria-label]=\"col.header\"\n (input)=\"onRuleInput(col, i, $any($event.target).value)\"\n (keydown.enter)=\"applyFilter(col)\"\n />\n @if (draft.rules.length > 1) {\n <button\n type=\"button\"\n class=\"inline-flex items-center justify-center gap-1 py-1 rounded-md [color:var(--shk-error-600)] hover:[background-color:var(--shk-error-50)] transition-colors\"\n (click)=\"removeRule(i)\"\n >\n <svg [shkIcon]=\"icons.trash\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('removeRule') }}\n </button>\n }\n </div>\n }\n @if (canAddRule(col)) {\n <div class=\"px-2 pb-1\">\n <button\n type=\"button\"\n class=\"w-full inline-flex items-center justify-center gap-1 py-1 rounded-md _shk-text-primary hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"addRule(col)\"\n >\n <svg [shkIcon]=\"getIcon('plus')\" class=\"w-3.5 h-3.5\"></svg>\n {{ filterLabel('addRule') }}\n </button>\n </div>\n }\n }\n }\n\n <div class=\"flex items-center justify-between gap-2 p-2 border-t _shk-border\">\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md border _shk-border _shk-text-surface-600 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] transition-colors\"\n (click)=\"clearFilter(col.field)\"\n >\n {{ filterLabel('clear') }}\n </button>\n <button\n type=\"button\"\n class=\"px-3 py-1.5 font-medium rounded-md _shk-bg-primary text-white hover:[background-color:var(--shk-primary-700)] transition-colors\"\n (click)=\"applyFilter(col)\"\n >\n {{ filterLabel('apply') }}\n </button>\n </div>\n </div>\n }\n } @else {\n <div class=\"flex items-center justify-center\">\n <span>{{ col.header }}</span>\n </div>\n }\n @if (isResizable()) {\n <span\n class=\"shk-col-resizer\"\n [class.shk-resizing]=\"resizingField() === col.field\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n [attr.aria-label]=\"tr('table.resizeColumn', 'Redimensionar columna') + ': ' + col.header\"\n [attr.aria-valuenow]=\"resizedWidthPx(col)\"\n (pointerdown)=\"startResize($event, col)\"\n (click)=\"$event.stopPropagation()\"\n (dblclick)=\"$event.stopPropagation(); resetColumnWidth(col)\"\n (keydown)=\"onResizerKeydown($event, col)\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n @if (loading()) {\n <tbody class=\"border-b _shk-border\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div\n class=\"flex items-center justify-center\"\n role=\"status\"\n [attr.aria-label]=\"'common.loading' | transloco\"\n >\n <svg\n [shkIcon]=\"getIcon('loader')\"\n class=\"w-6 h-6 animate-spin _shk-text-primary\"\n ></svg>\n </div>\n </td>\n </tr>\n </tbody>\n } @else if (effectiveDisplayedData().length === 0) {\n <tbody class=\"border-b _shk-border\">\n <tr>\n <td [attr.colspan]=\"totalColspan()\" class=\"text-center py-12\">\n <div class=\"flex flex-col items-center\">\n <div\n class=\"w-16 h-16 _shk-bg-surface-100 rounded-full flex items-center justify-center mb-4\"\n >\n <svg\n [shkIcon]=\"getIcon('inbox')\"\n class=\"w-8 h-8 _shk-text-surface-400\"\n ></svg>\n </div>\n <p\n class=\"text-lg font-semibold _shk-text-surface-600\"\n >\n {{ emptyMessage() || ('common.no_records' | transloco) }}\n </p>\n </div>\n </td>\n </tr>\n </tbody>\n } @else {\n <tbody>\n @for (rowData of effectiveDisplayedData(); track trackByRow(rowData, $index)) {\n @let rowSeverityValue = rowSeverity(rowData);\n <tr\n [attr.aria-selected]=\"selectable() ? isRowSelected(rowData) : null\"\n [class.shk-row-selected]=\"selectable() && isRowSelected(rowData)\"\n [class.shk-row-low]=\"rowSeverityValue === 'low'\"\n [class.shk-row-moderate]=\"rowSeverityValue === 'moderate'\"\n [class.shk-row-critical]=\"rowSeverityValue === 'critical'\"\n [class.cursor-pointer]=\"selectable() && selectOnRowClick() && canSelectRow(rowData)\"\n (click)=\"onRowClick($event, rowData)\"\n class=\"shk-data-row transition-colors duration-200 border-b _shk-border\"\n >\n @if (selectable()) {\n <td data-shk-select class=\"w-10 px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-center\">\n <input\n type=\"checkbox\"\n class=\"shk-table-checkbox\"\n [checked]=\"isRowSelected(rowData)\"\n [disabled]=\"!canSelectRow(rowData)\"\n (change)=\"toggleRowSelection(rowData)\"\n [attr.aria-label]=\"'table.selectRow' | transloco: { index: first() + $index + 1 }\"\n />\n </td>\n }\n @for (col of columnsWithActions(); track col.field) {\n <td\n [attr.data-shk-actions]=\"col.field === 'actions' ? '' : null\"\n [class]=\"\n 'px-2 min-[1440px]:px-3 py-2 min-[1440px]:py-2.5 text-xs font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-700)] ' +\n (col.field === 'actions' ? 'whitespace-nowrap' : 'whitespace-normal break-words')\n \"\n [style.--shk-col-width]=\"col.field !== 'actions' ? getColumnWidth(col) : null\"\n >\n @if (col.field !== 'actions') {\n @switch (col.template) {\n @case ('tag') {\n <shk-tag\n [value]=\"getTagValue(col, rowData)\"\n [severity]=\"getTagSeverity(col, rowData)\"\n [rounded]=\"getTagRounded(col, rowData)\"\n [icon]=\"getTagIcon(col, rowData)\"\n [style]=\"getTagStyle(col, rowData)\"\n />\n }\n @case ('progress') {\n <div\n class=\"shk-progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"getProgress(col, rowData)\"\n [attr.aria-label]=\"col.header\"\n >\n <div [style.width.%]=\"getProgress(col, rowData)\"></div>\n </div>\n }\n @case ('boolean') {\n @if (resolveField(rowData, col.field)) {\n <svg\n [shkIcon]=\"icons.yes\"\n class=\"w-4 h-4 [color:var(--shk-success-600)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('yes')\"\n ></svg>\n } @else {\n <svg\n [shkIcon]=\"icons.no\"\n class=\"w-4 h-4 [color:var(--shk-error-500)]\"\n role=\"img\"\n [attr.aria-label]=\"filterLabel('no')\"\n ></svg>\n }\n }\n @case ('date') {\n {{ formatDateCell(resolveField(rowData, col.field), col) }}\n }\n @case ('currency') {\n {{ formatCurrencyCell(resolveField(rowData, col.field), col) }}\n }\n @default {\n @if (col.image) {\n <div class=\"flex items-center gap-2\">\n @if (col.image(rowData); as src) {\n <img\n [src]=\"src\"\n alt=\"\"\n [width]=\"col.imageWidth || 24\"\n class=\"shrink-0 rounded-sm\"\n />\n }\n <span>\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n </span>\n </div>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"cellText; context: { $implicit: rowData, col: col }\"\n ></ng-container>\n }\n }\n }\n } @else {\n <div class=\"flex items-center justify-start gap-px\">\n @for (action of getVisibleRowActions(rowData); track $index) {\n @if (isRowActionVisible(action, rowData)) {\n <div class=\"relative group\">\n <shk-tooltip\n [text]=\"getRowActionLabel(action, rowData)\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData)\"\n [class]=\"\n 'table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md ' +\n getRowActionClass(action, rowData)\n \"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [attr.aria-label]=\"getRowActionLabel(action, rowData)\"\n >\n <svg\n [shkIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n </div>\n }\n }\n @if (getHiddenRowActions(rowData).length > 0) {\n <div class=\"relative\">\n <shk-tooltip\n [text]=\"'common.more_options' | transloco\"\n position=\"top\"\n >\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); toggleActionsDropdown(rowData, $event)\"\n class=\"table-action-btn hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] rounded-md\"\n [attr.aria-label]=\"'common.more_options' | transloco\"\n [attr.aria-expanded]=\"isActionsDropdownOpen(rowData)\"\n >\n <svg\n [shkIcon]=\"getIcon('ellipsis-vertical')\"\n class=\"w-4 h-4\"\n ></svg>\n </button>\n </shk-tooltip>\n @if (isActionsDropdownOpen(rowData)) {\n <div\n shkPortal\n class=\"fixed z-[9999] min-w-[160px] bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border rounded-md shadow-lg py-1\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n >\n @for (action of getHiddenRowActions(rowData); track $index) {\n <button\n type=\"button\"\n (click)=\"action.onClick(rowData); toggleActionsDropdown(rowData)\"\n [disabled]=\"isRowActionDisabled(action, rowData) || false\"\n [class]=\"\n 'w-full flex items-center gap-2 px-3 py-2 text-xs text-left _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors ' +\n getRowActionClass(action, rowData)\n \"\n >\n <svg\n [shkIcon]=\"getIcon(getRowActionIconName(action, rowData))\"\n class=\"w-3.5 h-3.5 shrink-0\"\n ></svg>\n <span>{{ getRowActionLabel(action, rowData) }}</span>\n </button>\n }\n </div>\n }\n </div>\n }\n @if (rowSeverityValue) {\n <div class=\"relative group\">\n <shk-tooltip [text]=\"rowValidationTitle(rowData) || ''\" position=\"top\">\n <span\n class=\"shk-row-validation-btn\"\n [class.shk-sev-low]=\"rowSeverityValue === 'low'\"\n [class.shk-sev-moderate]=\"rowSeverityValue === 'moderate'\"\n [class.shk-sev-critical]=\"rowSeverityValue === 'critical'\"\n tabindex=\"0\"\n role=\"note\"\n [attr.aria-label]=\"rowValidationLabel(rowData)\"\n >\n <svg [shkIcon]=\"rowValidationIcon(rowData)\"></svg>\n </span>\n </shk-tooltip>\n </div>\n }\n </div>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n }\n </table>\n\n <!-- Text content of a cell: format() · custom template · raw value -->\n <ng-template #cellText let-rowData let-col=\"col\">\n @if (col.format) {\n <span>{{ col.format(rowData) }}</span>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplates()[col.field] || defaultTemplate;\n context: { $implicit: rowData, field: col.field }\n \"\n ></ng-container>\n }\n </ng-template>\n <ng-template #defaultTemplate let-rowData let-field=\"field\">\n {{ resolveField(rowData, field) }}\n </ng-template>\n\n <!-- Option list of the select / multiselect filters -->\n <ng-template #optionList let-col let-draft=\"draft\" let-multiple=\"multiple\">\n <div class=\"p-2 space-y-1.5\">\n @let selectedLabel = multiple ? selectedOptionsLabel(col) : selectedSingleLabel(col);\n <button\n type=\"button\"\n class=\"shk-filter-select flex items-center justify-between gap-2 text-left\"\n style=\"background-image: none\"\n [id]=\"uid + '-filter-' + safeId(col.field) + '-0'\"\n [attr.aria-expanded]=\"multiselectOpen()\"\n (click)=\"multiselectOpen.set(!multiselectOpen())\"\n >\n <span class=\"truncate\" [class._shk-text-surface-400]=\"!selectedLabel\">\n {{ selectedLabel || tr('table.filterAll', 'Todos') }}\n </span>\n <svg\n [shkIcon]=\"getIcon('chevron-down')\"\n class=\"w-3.5 h-3.5 shrink-0 _shk-text-surface-400 transition-transform\"\n [class.rotate-180]=\"multiselectOpen()\"\n ></svg>\n </button>\n @if (multiselectOpen()) {\n <div\n class=\"max-h-52 overflow-y-auto p-0.5 border _shk-border rounded-md _shk-scrollbar\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple\"\n >\n @for (opt of col.filterOptions || []; track $index) {\n @let isSelected = multiple\n ? isOptionSelected(opt.value)\n : draft.rules[0].value != null && draft.rules[0].value == opt.value;\n <button\n type=\"button\"\n role=\"option\"\n class=\"w-full flex items-center gap-2 px-2 py-1.5 rounded text-left transition-colors hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [class._shk-bg-primary-soft]=\"isSelected\"\n [class._shk-text-primary-700]=\"isSelected\"\n [attr.aria-selected]=\"isSelected\"\n (click)=\"multiple ? toggleOption(col, opt.value) : selectOption(col, opt.value)\"\n >\n @if (multiple) {\n <span class=\"shk-checkbox-box\" [class.shk-checked]=\"isSelected\">\n @if (isSelected) {\n <svg [shkIcon]=\"getIcon('check')\"></svg>\n }\n </span>\n }\n @if (opt.image) {\n <img [src]=\"opt.image\" alt=\"\" width=\"22\" class=\"shrink-0 rounded-sm\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n </ng-template>\n </div>\n <div\n class=\"table-pagination flex items-center justify-between gap-4 px-2 min-[1440px]:px-3 py-2 border-t _shk-border\"\n >\n <div class=\"text-xs _shk-text-surface-600\">\n @if (showPageReport()) {\n {{ pageReport() }}\n }\n </div>\n <div\n class=\"flex items-center gap-0.5\"\n role=\"navigation\"\n >\n <button\n type=\"button\"\n (click)=\"goToFirst()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.firstPage', 'Primera página')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevrons-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"prev()\"\n [disabled]=\"isFirstPage()\"\n [attr.aria-label]=\"tr('table.prevPage', 'Página anterior')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span\n class=\"px-2 text-xs font-medium _shk-text-surface-700\"\n >{{ currentPage() }} / {{ totalPages() }}</span\n >\n <button\n type=\"button\"\n (click)=\"next()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.nextPage', 'Página siguiente')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n <button\n type=\"button\"\n (click)=\"goToLast()\"\n [disabled]=\"isLastPage()\"\n [attr.aria-label]=\"tr('table.lastPage', 'Última página')\"\n class=\"shk-page-btn p-1 _shk-text-surface-500 hover:[color:var(--shk-surface-700)] dark:hover:[color:var(--shk-surface-200)] disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('chevrons-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n <div\n class=\"flex items-center gap-1.5 text-xs _shk-text-surface-600\"\n >\n @if (showRowsPerPage()) {\n <label [for]=\"uid + '-rows-per-page'\">{{ 'table.rows' | transloco }}</label>\n <select\n [id]=\"uid + '-rows-per-page'\"\n (change)=\"onRowsPerPageChange($any($event.target).value)\"\n class=\"border _shk-border rounded px-2 py-1 text-xs bg-white dark:[background-color:var(--shk-surface-100)] _shk-text-surface-700 focus:outline-none focus:[border-color:var(--shk-primary-500)]\"\n >\n @for (opt of rowsPerPageOptions(); track opt) {\n <option [value]=\"opt\" [selected]=\"opt === rowsPerPageLocal()\">{{ opt }}</option>\n }\n </select>\n }\n </div>\n </div>\n </div>\n</div>\n",
|
|
1589
|
+
styles: ["input:focus{outline:none}input[type=text]{font-weight:400!important}table th{white-space:nowrap}table td{white-space:normal;overflow-wrap:break-word}.shk-page-btn{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.375rem;transition:background-color .15s ease,color .15s ease}.shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-page-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.shk-page-btn:focus-visible{outline:none;box-shadow:0 0 0 2px color-mix(in srgb,var(--shk-primary-500) 45%,transparent)}td button svg{width:1.125rem!important;height:1.125rem!important}td button:disabled{opacity:.4;cursor:not-allowed}.table-action-btn svg{width:1rem!important;height:1rem!important;min-width:1rem!important;min-height:1rem!important}.table-action-btn{padding:.5rem!important;min-width:2rem!important;min-height:2rem!important;display:inline-flex!important;align-items:center!important;justify-content:center!important}.table-scroll-wrapper{width:100%;overflow-x:auto;overflow-y:hidden;border-radius:inherit;-webkit-overflow-scrolling:touch;container-type:inline-size}.table-card,.table-pagination{container-type:inline-size}@container (max-width: 640px){.table-pagination{flex-direction:column;align-items:center;gap:.5rem}.table-pagination>div{justify-content:center}}.table-scroll-wrapper table{table-layout:auto;width:100%}@container (max-width: 768px){.table-scroll-wrapper{scroll-snap-type:x mandatory}.table-scroll-wrapper table{table-layout:auto;width:100%}.table-scroll-wrapper th:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px)}.table-scroll-wrapper td:not([data-shk-actions]):not([data-shk-select]){min-width:var(--shk-col-width, 140px);max-width:var(--shk-col-width, 140px)}.table-scroll-wrapper th,.table-scroll-wrapper td{scroll-snap-align:start}}th[data-shk-select],td[data-shk-select]{width:2.5rem;min-width:2.5rem}.shk-table-checkbox{width:.875rem;height:.875rem;cursor:pointer;vertical-align:middle;accent-color:var(--shk-primary-500)}.shk-table-checkbox:disabled{opacity:.4;cursor:not-allowed}tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-50) 60%,transparent)}tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 90%,transparent)}:host-context(.dark) tr.shk-row-selected{background-color:color-mix(in srgb,var(--shk-primary-900) 20%,transparent)}:host-context(.dark) tr.shk-row-selected:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 30%,transparent)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.shk-data-table tr.shk-row-low{background-color:color-mix(in srgb,var(--shk-info-600) 22%,transparent)}.shk-data-table tr.shk-row-moderate{background-color:color-mix(in srgb,var(--shk-warning-400) 32%,transparent)}.shk-data-table tr.shk-row-critical{background-color:color-mix(in srgb,var(--shk-error-500) 20%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-low{background-color:color-mix(in srgb,var(--shk-info-600) 26%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-moderate{background-color:color-mix(in srgb,var(--shk-warning-400) 34%,transparent)}:host-context(.dark) .shk-data-table tr.shk-row-critical{background-color:color-mix(in srgb,var(--shk-error-500) 24%,transparent)}.shk-row-validation-btn{display:inline-flex;align-items:center;justify-content:center;padding:.25rem;border-radius:.375rem;cursor:help;color:var(--shk-surface-500)}.shk-row-validation-btn svg{width:1rem!important;height:1rem!important}.shk-row-validation-btn.shk-sev-low{color:var(--shk-info-600)}.shk-row-validation-btn.shk-sev-moderate{color:var(--shk-warning-600)}:host-context(.dark) .shk-row-validation-btn.shk-sev-moderate{color:var(--shk-warning-400)}.shk-row-validation-btn.shk-sev-critical{color:var(--shk-error-500)}.shk-row-validation-btn:focus-visible{outline:2px solid currentColor;outline-offset:1px}table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-50) 30%,transparent)}:host-context(.dark) table.shk-row-hover tbody tr.shk-data-row:hover{background-color:color-mix(in srgb,var(--shk-primary-900) 10%,transparent)}table.shk-gridlines th,table.shk-gridlines td{border-right:1px solid var(--shk-surface-200)}table.shk-gridlines th:last-child,table.shk-gridlines td:last-child{border-right:0}:host-context(.dark) table.shk-gridlines th,:host-context(.dark) table.shk-gridlines td{border-right-color:var(--shk-surface-200)}.shk-col-resizer{position:absolute;top:0;right:-4px;z-index:1;width:8px;height:100%;cursor:col-resize;touch-action:none}.shk-col-resizer:after{content:\"\";position:absolute;top:20%;bottom:20%;left:3px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.shk-col-resizer:hover:after,.shk-col-resizer:focus-visible:after,.shk-col-resizer.shk-resizing:after{background-color:var(--shk-primary-500)}.shk-col-resizer:focus-visible{outline:none}th:last-child .shk-col-resizer{right:0}.shk-filter-input,.shk-filter-select{width:100%;padding:.375rem .625rem;font-size:.75rem;line-height:1.25rem;border-radius:.375rem;border:1px solid var(--shk-surface-200);background-color:#fff;color:var(--shk-surface-700)}.dark .shk-filter-input,.dark .shk-filter-select{background-color:var(--shk-surface-100);border-color:var(--shk-surface-200);color-scheme:dark}.shk-filter-input::placeholder{color:var(--shk-surface-400)}select.shk-filter-select{appearance:none;padding-right:1.75rem;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .5rem center;cursor:pointer}button.shk-filter-select{cursor:pointer}.shk-filter-input:focus,.shk-filter-select:focus{outline:none;border-color:var(--shk-primary-500);box-shadow:0 0 0 1px var(--shk-primary-500)}.shk-checkbox-box{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:.875rem;height:.875rem;border-radius:.1875rem;border:1px solid var(--shk-surface-300);background-color:#fff;color:#fff}.dark .shk-checkbox-box{background-color:var(--shk-surface-100)}.shk-checkbox-box.shk-checked{background-color:var(--shk-primary-500);border-color:var(--shk-primary-500)}.shk-checkbox-box svg{width:.625rem;height:.625rem}.shk-range{position:relative;height:1rem;margin:.5rem .375rem .375rem}.shk-range-track,.shk-range-fill{position:absolute;top:50%;height:.1875rem;transform:translateY(-50%);border-radius:9999px}.shk-range-track{left:0;right:0;background-color:var(--shk-surface-200)}.shk-range-fill{background-color:var(--shk-primary-500)}.shk-range input[type=range]{position:absolute;inset:0;width:100%;margin:0;background:transparent;pointer-events:none;appearance:none;-webkit-appearance:none}.shk-range input[type=range]::-webkit-slider-thumb{pointer-events:auto;-webkit-appearance:none;width:.875rem;height:.875rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-range input[type=range]::-moz-range-thumb{pointer-events:auto;width:.625rem;height:.625rem;border-radius:9999px;background:#fff;border:2px solid var(--shk-primary-500);cursor:grab}.shk-progress{height:.375rem;min-width:5rem;border-radius:9999px;background-color:var(--shk-surface-200);overflow:hidden}.shk-progress>div{height:100%;border-radius:inherit;background-color:var(--shk-primary-500)}\n"]
|
|
1590
|
+
}]
|
|
1591
|
+
}],
|
|
1592
|
+
ctorParameters: () => [],
|
|
1593
|
+
propDecorators: {
|
|
1594
|
+
data: [{
|
|
1595
|
+
type: i0.Input,
|
|
1596
|
+
args: [{
|
|
1597
|
+
isSignal: true,
|
|
1598
|
+
alias: "data",
|
|
1599
|
+
required: false
|
|
1600
|
+
}]
|
|
1601
|
+
}],
|
|
1602
|
+
columns: [{
|
|
1603
|
+
type: i0.Input,
|
|
1604
|
+
args: [{
|
|
1605
|
+
isSignal: true,
|
|
1606
|
+
alias: "columns",
|
|
1607
|
+
required: false
|
|
1608
|
+
}]
|
|
1609
|
+
}],
|
|
1610
|
+
rowsPerPage: [{
|
|
1611
|
+
type: i0.Input,
|
|
1612
|
+
args: [{
|
|
1613
|
+
isSignal: true,
|
|
1614
|
+
alias: "rowsPerPage",
|
|
1615
|
+
required: false
|
|
1616
|
+
}]
|
|
1617
|
+
}],
|
|
1618
|
+
rowsPerPageOptions: [{
|
|
1619
|
+
type: i0.Input,
|
|
1620
|
+
args: [{
|
|
1621
|
+
isSignal: true,
|
|
1622
|
+
alias: "rowsPerPageOptions",
|
|
1623
|
+
required: false
|
|
1624
|
+
}]
|
|
1625
|
+
}],
|
|
1626
|
+
loading: [{
|
|
1627
|
+
type: i0.Input,
|
|
1628
|
+
args: [{
|
|
1629
|
+
isSignal: true,
|
|
1630
|
+
alias: "loading",
|
|
1631
|
+
required: false
|
|
1632
|
+
}]
|
|
1633
|
+
}],
|
|
1634
|
+
showActionRow: [{
|
|
1635
|
+
type: i0.Input,
|
|
1636
|
+
args: [{
|
|
1637
|
+
isSignal: true,
|
|
1638
|
+
alias: "showActionRow",
|
|
1639
|
+
required: false
|
|
1640
|
+
}]
|
|
1641
|
+
}],
|
|
1642
|
+
customTemplates: [{
|
|
1643
|
+
type: i0.Input,
|
|
1644
|
+
args: [{
|
|
1645
|
+
isSignal: true,
|
|
1646
|
+
alias: "customTemplates",
|
|
1647
|
+
required: false
|
|
1648
|
+
}]
|
|
1649
|
+
}],
|
|
1650
|
+
headerActions: [{
|
|
1651
|
+
type: i0.Input,
|
|
1652
|
+
args: [{
|
|
1653
|
+
isSignal: true,
|
|
1654
|
+
alias: "headerActions",
|
|
1655
|
+
required: false
|
|
1656
|
+
}]
|
|
1657
|
+
}],
|
|
1658
|
+
rowActions: [{
|
|
1659
|
+
type: i0.Input,
|
|
1660
|
+
args: [{
|
|
1661
|
+
isSignal: true,
|
|
1662
|
+
alias: "rowActions",
|
|
1663
|
+
required: false
|
|
1664
|
+
}]
|
|
1665
|
+
}],
|
|
1666
|
+
hasShadow: [{
|
|
1667
|
+
type: i0.Input,
|
|
1668
|
+
args: [{
|
|
1669
|
+
isSignal: true,
|
|
1670
|
+
alias: "hasShadow",
|
|
1671
|
+
required: false
|
|
1672
|
+
}]
|
|
1673
|
+
}],
|
|
1674
|
+
defaultSortField: [{
|
|
1675
|
+
type: i0.Input,
|
|
1676
|
+
args: [{
|
|
1677
|
+
isSignal: true,
|
|
1678
|
+
alias: "defaultSortField",
|
|
1679
|
+
required: false
|
|
1680
|
+
}]
|
|
1681
|
+
}],
|
|
1682
|
+
defaultSortOrder: [{
|
|
1683
|
+
type: i0.Input,
|
|
1684
|
+
args: [{
|
|
1685
|
+
isSignal: true,
|
|
1686
|
+
alias: "defaultSortOrder",
|
|
1687
|
+
required: false
|
|
1688
|
+
}]
|
|
1689
|
+
}],
|
|
1690
|
+
showSearch: [{
|
|
1691
|
+
type: i0.Input,
|
|
1692
|
+
args: [{
|
|
1693
|
+
isSignal: true,
|
|
1694
|
+
alias: "showSearch",
|
|
1695
|
+
required: false
|
|
1696
|
+
}]
|
|
1697
|
+
}],
|
|
1698
|
+
searchPlaceholder: [{
|
|
1699
|
+
type: i0.Input,
|
|
1700
|
+
args: [{
|
|
1701
|
+
isSignal: true,
|
|
1702
|
+
alias: "searchPlaceholder",
|
|
1703
|
+
required: false
|
|
1704
|
+
}]
|
|
1705
|
+
}],
|
|
1706
|
+
globalFilterFields: [{
|
|
1707
|
+
type: i0.Input,
|
|
1708
|
+
args: [{
|
|
1709
|
+
isSignal: true,
|
|
1710
|
+
alias: "globalFilterFields",
|
|
1711
|
+
required: false
|
|
1712
|
+
}]
|
|
1713
|
+
}],
|
|
1714
|
+
emptyMessage: [{
|
|
1715
|
+
type: i0.Input,
|
|
1716
|
+
args: [{
|
|
1717
|
+
isSignal: true,
|
|
1718
|
+
alias: "emptyMessage",
|
|
1719
|
+
required: false
|
|
1720
|
+
}]
|
|
1721
|
+
}],
|
|
1722
|
+
serverSide: [{
|
|
1723
|
+
type: i0.Input,
|
|
1724
|
+
args: [{
|
|
1725
|
+
isSignal: true,
|
|
1726
|
+
alias: "serverSide",
|
|
1727
|
+
required: false
|
|
1728
|
+
}]
|
|
1729
|
+
}],
|
|
1730
|
+
totalRecords: [{
|
|
1731
|
+
type: i0.Input,
|
|
1732
|
+
args: [{
|
|
1733
|
+
isSignal: true,
|
|
1734
|
+
alias: "totalRecords",
|
|
1735
|
+
required: false
|
|
1736
|
+
}]
|
|
1737
|
+
}],
|
|
1738
|
+
filters: [{
|
|
1739
|
+
type: i0.Input,
|
|
1740
|
+
args: [{
|
|
1741
|
+
isSignal: true,
|
|
1742
|
+
alias: "filters",
|
|
1743
|
+
required: false
|
|
1744
|
+
}]
|
|
1745
|
+
}],
|
|
1746
|
+
activeFilter: [{
|
|
1747
|
+
type: i0.Input,
|
|
1748
|
+
args: [{
|
|
1749
|
+
isSignal: true,
|
|
1750
|
+
alias: "activeFilter",
|
|
1751
|
+
required: false
|
|
1752
|
+
}]
|
|
1753
|
+
}],
|
|
1754
|
+
showGridlines: [{
|
|
1755
|
+
type: i0.Input,
|
|
1756
|
+
args: [{
|
|
1757
|
+
isSignal: true,
|
|
1758
|
+
alias: "showGridlines",
|
|
1759
|
+
required: false
|
|
1760
|
+
}]
|
|
1761
|
+
}],
|
|
1762
|
+
resizableColumns: [{
|
|
1763
|
+
type: i0.Input,
|
|
1764
|
+
args: [{
|
|
1765
|
+
isSignal: true,
|
|
1766
|
+
alias: "resizableColumns",
|
|
1767
|
+
required: false
|
|
1768
|
+
}]
|
|
1769
|
+
}],
|
|
1770
|
+
rowValidations: [{
|
|
1771
|
+
type: i0.Input,
|
|
1772
|
+
args: [{
|
|
1773
|
+
isSignal: true,
|
|
1774
|
+
alias: "rowValidations",
|
|
1775
|
+
required: false
|
|
1776
|
+
}]
|
|
1777
|
+
}],
|
|
1778
|
+
columnWidths: [{
|
|
1779
|
+
type: i0.Input,
|
|
1780
|
+
args: [{
|
|
1781
|
+
isSignal: true,
|
|
1782
|
+
alias: "columnWidths",
|
|
1783
|
+
required: false
|
|
1784
|
+
}]
|
|
1785
|
+
}, {
|
|
1786
|
+
type: i0.Output,
|
|
1787
|
+
args: ["columnWidthsChange"]
|
|
1788
|
+
}],
|
|
1789
|
+
stateKey: [{
|
|
1790
|
+
type: i0.Input,
|
|
1791
|
+
args: [{
|
|
1792
|
+
isSignal: true,
|
|
1793
|
+
alias: "stateKey",
|
|
1794
|
+
required: false
|
|
1795
|
+
}]
|
|
1796
|
+
}],
|
|
1797
|
+
stateStorage: [{
|
|
1798
|
+
type: i0.Input,
|
|
1799
|
+
args: [{
|
|
1800
|
+
isSignal: true,
|
|
1801
|
+
alias: "stateStorage",
|
|
1802
|
+
required: false
|
|
1803
|
+
}]
|
|
1804
|
+
}],
|
|
1805
|
+
rowHover: [{
|
|
1806
|
+
type: i0.Input,
|
|
1807
|
+
args: [{
|
|
1808
|
+
isSignal: true,
|
|
1809
|
+
alias: "rowHover",
|
|
1810
|
+
required: false
|
|
1811
|
+
}]
|
|
1812
|
+
}],
|
|
1813
|
+
showClearButton: [{
|
|
1814
|
+
type: i0.Input,
|
|
1815
|
+
args: [{
|
|
1816
|
+
isSignal: true,
|
|
1817
|
+
alias: "showClearButton",
|
|
1818
|
+
required: false
|
|
1819
|
+
}]
|
|
1820
|
+
}],
|
|
1821
|
+
showPageReport: [{
|
|
1822
|
+
type: i0.Input,
|
|
1823
|
+
args: [{
|
|
1824
|
+
isSignal: true,
|
|
1825
|
+
alias: "showPageReport",
|
|
1826
|
+
required: false
|
|
1827
|
+
}]
|
|
1828
|
+
}],
|
|
1829
|
+
showRowsPerPage: [{
|
|
1830
|
+
type: i0.Input,
|
|
1831
|
+
args: [{
|
|
1832
|
+
isSignal: true,
|
|
1833
|
+
alias: "showRowsPerPage",
|
|
1834
|
+
required: false
|
|
1835
|
+
}]
|
|
1836
|
+
}],
|
|
1837
|
+
selectable: [{
|
|
1838
|
+
type: i0.Input,
|
|
1839
|
+
args: [{
|
|
1840
|
+
isSignal: true,
|
|
1841
|
+
alias: "selectable",
|
|
1842
|
+
required: false
|
|
1843
|
+
}]
|
|
1844
|
+
}],
|
|
1845
|
+
dataKey: [{
|
|
1846
|
+
type: i0.Input,
|
|
1847
|
+
args: [{
|
|
1848
|
+
isSignal: true,
|
|
1849
|
+
alias: "dataKey",
|
|
1850
|
+
required: false
|
|
1851
|
+
}]
|
|
1852
|
+
}],
|
|
1853
|
+
isRowSelectable: [{
|
|
1854
|
+
type: i0.Input,
|
|
1855
|
+
args: [{
|
|
1856
|
+
isSignal: true,
|
|
1857
|
+
alias: "isRowSelectable",
|
|
1858
|
+
required: false
|
|
1859
|
+
}]
|
|
1860
|
+
}],
|
|
1861
|
+
selectOnRowClick: [{
|
|
1862
|
+
type: i0.Input,
|
|
1863
|
+
args: [{
|
|
1864
|
+
isSignal: true,
|
|
1865
|
+
alias: "selectOnRowClick",
|
|
1866
|
+
required: false
|
|
1867
|
+
}]
|
|
1868
|
+
}],
|
|
1869
|
+
bulkActions: [{
|
|
1870
|
+
type: i0.Input,
|
|
1871
|
+
args: [{
|
|
1872
|
+
isSignal: true,
|
|
1873
|
+
alias: "bulkActions",
|
|
1874
|
+
required: false
|
|
1875
|
+
}]
|
|
1876
|
+
}],
|
|
1877
|
+
selection: [{
|
|
1878
|
+
type: i0.Input,
|
|
1879
|
+
args: [{
|
|
1880
|
+
isSignal: true,
|
|
1881
|
+
alias: "selection",
|
|
1882
|
+
required: false
|
|
1883
|
+
}]
|
|
1884
|
+
}, {
|
|
1885
|
+
type: i0.Output,
|
|
1886
|
+
args: ["selectionChange"]
|
|
1887
|
+
}],
|
|
1888
|
+
refresh: [{
|
|
1889
|
+
type: i0.Output,
|
|
1890
|
+
args: ["refresh"]
|
|
1891
|
+
}],
|
|
1892
|
+
pageChange: [{
|
|
1893
|
+
type: i0.Output,
|
|
1894
|
+
args: ["pageChange"]
|
|
1895
|
+
}],
|
|
1896
|
+
filterChange: [{
|
|
1897
|
+
type: i0.Output,
|
|
1898
|
+
args: ["filterChange"]
|
|
1899
|
+
}],
|
|
1900
|
+
searchChange: [{
|
|
1901
|
+
type: i0.Output,
|
|
1902
|
+
args: ["searchChange"]
|
|
1903
|
+
}],
|
|
1904
|
+
filterClick: [{
|
|
1905
|
+
type: i0.Output,
|
|
1906
|
+
args: ["filterClick"]
|
|
1907
|
+
}],
|
|
1908
|
+
columnResize: [{
|
|
1909
|
+
type: i0.Output,
|
|
1910
|
+
args: ["columnResize"]
|
|
1911
|
+
}],
|
|
1912
|
+
onDocumentClick: [{
|
|
1913
|
+
type: HostListener,
|
|
1914
|
+
args: ["document:click"]
|
|
1915
|
+
}],
|
|
1916
|
+
onEscape: [{
|
|
1917
|
+
type: HostListener,
|
|
1918
|
+
args: ["document:keydown.escape"]
|
|
1919
|
+
}]
|
|
1920
|
+
}
|
|
1921
|
+
});
|
|
1705
1922
|
export { TableComponent };
|
|
1706
|
-
|
|
1923
|
+
|
|
1924
|
+
//# sourceMappingURL=shirkasoft-ui-components-table.mjs.map
|