@timlassiter11/yatl 1.0.18 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -9,501 +9,6 @@ var __decorateClass = (decorators, target, key, kind) => {
9
9
  return result;
10
10
  };
11
11
 
12
- // src/yatl-button/yatl-button.ts
13
- import { html, LitElement } from "lit";
14
- import { customElement, property } from "lit/decorators.js";
15
-
16
- // src/theme.ts
17
- import { css } from "lit";
18
- var theme_default = css`
19
- /* Theme declarations */
20
- :host {
21
- /* Typography */
22
- --yatl-font-family: var(
23
- --yatl-table-font,
24
- -apple-system,
25
- BlinkMacSystemFont,
26
- 'Segoe UI',
27
- Roboto,
28
- Helvetica,
29
- Arial,
30
- sans-serif,
31
- 'Apple Color Emoji',
32
- 'Segoe UI Emoji'
33
- );
34
- --yatl-font-size: var(--yatl-table-font-size, 0.875rem);
35
- --yatl-line-height: var(--yatl-table-line-height, 1.25rem);
36
-
37
- /* Spacing */
38
- --yatl-spacing-xs: var(--yatl-table-spacing-xs, 4px);
39
- --yatl-spacing-s: var(--yatl-table-spacing-s, 8px);
40
- --yatl-spacing-m: var(--yatl-table-spacing-m, 12px);
41
- --yatl-spacing-l: var(--yatl-table-spacing-l, 16px);
42
-
43
- --yatl-cell-padding: var(
44
- --yatl-table-cell-padding,
45
- var(--yatl-spacing-m) var(--yatl-spacing-m)
46
- );
47
- --yatl-header-padding: var(
48
- --yatl-table-header-padding,
49
- var(--yatl-spacing-m) var(--yatl-spacing-l)
50
- );
51
-
52
- --yatl-brand-color: var(--yatl-table-brand-light, #7531ae);
53
-
54
- /* Light colors */
55
- --yatl-bg-light: var(--yatl-table-bg-light, #ffffff);
56
- --yatl-text-light: var(--yatl-table-text-light, #0f172a);
57
- --yatl-text-muted-light: var(--yatl-table-text-muted-light, #64748b);
58
- --yatl-border-color-light: var(--yatl-table-border-color-light, #e2e8f0);
59
- --yatl-header-bg-light: var(
60
- --yatl-table-header-bg-light,
61
- color-mix(in srgb, black 5%, var(--yatl-bg))
62
- );
63
- --yatl-header-text-light: var(--yatl-table-header-text-light, #475569);
64
- --yatl-header-drop-bg-light: var(
65
- --yatl-table-drop-bg-light,
66
- color-mix(in srgb, black 5%, transparent)
67
- );
68
- --yatl-row-hover-bg-light: var(
69
- --yatl-table-row-hover-bg-light,
70
- color-mix(in srgb, black 5%, transparent)
71
- );
72
- --yatl-row-selected-bg-light: var(
73
- --yatl-table-row-selected-bg-light,
74
- color-mix(in srgb, var(--yatl-brand-color) 20%, transparent)
75
- );
76
-
77
- /* Dark colors */
78
- --yatl-bg-dark: var(--yatl-table-bg-dark, #101219);
79
- --yatl-text-dark: var(--yatl-table-text-dark, #f1f5f9);
80
- --yatl-text-muted-dark: var(--yatl-table-text-muted-dark, #94a3b8);
81
- --yatl-border-color-dark: var(--yatl-table-border-color-dark, #1a1b1e);
82
- --yatl-header-bg-dark: var(
83
- --yatl-table-header-bg-dark,
84
- color-mix(in srgb, white 5%, var(--yatl-bg))
85
- );
86
- --yatl-header-text-dark: var(--yatl-table-header-text-dark, #cbd5e1);
87
- --yatl-header-drop-bg-dark: var(
88
- --yatl-table-drop-bg-dark,
89
- color-mix(in srgb, white 5%, transparent)
90
- );
91
- --yatl-row-hover-bg-dark: var(
92
- --yatl-table-row-hover-bg-dark,
93
- color-mix(in srgb, white 5%, transparent)
94
- );
95
- --yatl-row-selected-bg-dark: var(
96
- --yatl-table-row-selected-bg-dark,
97
- color-mix(in srgb, var(--yatl-brand-color) 20%, transparent)
98
- );
99
-
100
- /* Applied colors */
101
- --yatl-bg: var(
102
- --yatl-table-bg,
103
- light-dark(var(--yatl-bg-light), var(--yatl-bg-dark))
104
- );
105
- --yatl-text: var(
106
- --yatl-table-text,
107
- light-dark(var(--yatl-text-light), var(--yatl-text-dark))
108
- );
109
- --yatl-text-muted: var(
110
- --yatl-table-text-muted,
111
- light-dark(var(--yatl-text-muted-light), var(--yatl-text-muted-dark))
112
- );
113
- --yatl-border-color: var(
114
- --yatl-table-border-color,
115
- light-dark(var(--yatl-border-color-light), var(--yatl-border-color-dark))
116
- );
117
- --yatl-header-bg: var(
118
- --yatl-table-header-bg,
119
- light-dark(var(--yatl-header-bg-light), var(--yatl-header-bg-dark))
120
- );
121
- --yatl-header-text: var(
122
- --yatl-table-header-text,
123
- light-dark(var(--yatl-header-text-light), var(--yatl-header-text-dark))
124
- );
125
- --yatl-header-drop-bg: var(
126
- --yatl-table-header-drop-bg,
127
- light-dark(
128
- var(--yatl-header-drop-bg-light),
129
- var(--yatl-header-drop-bg-dark)
130
- )
131
- );
132
- --yatl-row-hover-bg: var(
133
- --yatl-table-row-hover-bg,
134
- light-dark(var(--yatl-row-hover-bg-light), var(--yatl-row-hover-bg-dark))
135
- );
136
- --yatl-row-selected-bg: var(
137
- --yatl-table-row-selected-bg,
138
- light-dark(
139
- var(--yatl-row-selected-bg-light),
140
- var(--yatl-row-selected-bg-dark)
141
- )
142
- );
143
-
144
- --yatl-row-number-column-width: var(
145
- --yatl-table-row-number-column-width,
146
- 48px
147
- );
148
- --yatl-row-selector-column-width: var(
149
- --yatl-table-row-selector-column-width,
150
- 48px
151
- );
152
- --yatl-column-visibility-transition: var(
153
- --yatl-table-column-visibility-transition,
154
- 100ms
155
- );
156
-
157
- --yatl-table-radius: var(--yatl-table-table-radius, 8px);
158
- --yatl-input-radius: var(--yatl-table-input-radius, 8px);
159
- --yatl-button-radius: var(--yatl-table-button-radius, 8px);
160
- --yatl-button-group-radius: var(--yatl-table-button-group-radius, 8px);
161
- --yatl-input-padding: var(
162
- --yatl-table-input-padding,
163
- var(--yatl-spacing-m)
164
- );
165
-
166
- font-family: var(--yatl-font-family);
167
- font-size: var(--yatl-font-size);
168
- color: var(--yatl-text);
169
- }
170
- `;
171
-
172
- // src/yatl-button/yatl-button.styles.ts
173
- import { css as css2 } from "lit";
174
- var yatl_button_styles_default = css2`
175
- :host {
176
- --yatl-button-radius: var(--yatl-table-button-radius, 4px);
177
-
178
- display: block;
179
- box-sizing: border-box;
180
- border-radius: var(--yatl-button-radius);
181
- overflow: hidden;
182
- padding: 0;
183
- border: 1px solid var(--yatl-border-color);
184
- background: var(--yatl-header-bg);
185
- font-size: large;
186
- font-weight: 500;
187
- color: var(--yatl-text);
188
- }
189
-
190
- .button {
191
- box-sizing: border-box;
192
- width: 100%;
193
- height: 100%;
194
- padding: 8px;
195
- border: none;
196
- cursor: pointer;
197
- background-color: transparent;
198
- /* Helps center the icons */
199
- display: flex;
200
- align-items: center;
201
- }
202
-
203
- .button:not([disabled]):hover {
204
- background: var(--yatl-brand-color);
205
- }
206
-
207
- .button:disabled,
208
- .button[disabled] {
209
- opacity: 0.5;
210
- cursor: not-allowed;
211
- filter: grayscale(100%);
212
- pointer-events: none;
213
- }
214
- `;
215
-
216
- // src/yatl-button/yatl-button.ts
217
- var YatlButton = class extends LitElement {
218
- constructor() {
219
- super(...arguments);
220
- this.disabled = false;
221
- this.type = "button";
222
- }
223
- render() {
224
- return html`
225
- <button
226
- class="button"
227
- type=${this.type}
228
- ?disabled=${this.disabled}
229
- part="button"
230
- >
231
- <slot></slot>
232
- </button>
233
- `;
234
- }
235
- };
236
- YatlButton.styles = [theme_default, yatl_button_styles_default];
237
- __decorateClass([
238
- property({ type: Boolean, reflect: true })
239
- ], YatlButton.prototype, "disabled", 2);
240
- __decorateClass([
241
- property({ type: String, reflect: true })
242
- ], YatlButton.prototype, "type", 2);
243
- YatlButton = __decorateClass([
244
- customElement("yatl-button")
245
- ], YatlButton);
246
-
247
- // src/yatl-button-group/yatl-button-group.ts
248
- import { LitElement as LitElement3, html as html3 } from "lit";
249
- import { customElement as customElement3 } from "lit/decorators.js";
250
-
251
- // src/yatl-dropdown/yatl-dropdown.ts
252
- import { html as html2, LitElement as LitElement2 } from "lit";
253
- import { customElement as customElement2, property as property2, query } from "lit/decorators.js";
254
-
255
- // src/yatl-dropdown/yatl-dropdown.styles.ts
256
- import { css as css3 } from "lit";
257
- var yatl_dropdown_styles_default = css3`
258
- :host {
259
- --yatl-dropdown-menu-bg: var(
260
- --yatl-table-dropdown-menu-bg,
261
- var(--yatl-header-bg)
262
- );
263
- --yatl-dropdown-menu-padding: var(
264
- --yatl-table-dropdown-menu-padding,
265
- 0.25em
266
- );
267
- --yatl-dropdown-menu-radius: var(--yatl-table-dropdown-menu-radius, 8px);
268
- --yatl-dropdown-menu-border: var(
269
- --yatl-table-dropdown-menu-border,
270
- var(--yatl-border-color)
271
- );
272
-
273
- overflow: visible !important;
274
- }
275
-
276
- .dropdown {
277
- position: relative;
278
- height: 100%;
279
- }
280
-
281
- .dropdown summary {
282
- box-sizing: border-box;
283
- /* Hides the dropdown arrow*/
284
- list-style: none;
285
- height: 100%;
286
- }
287
-
288
- :host([open]) ::slotted([slot='trigger']) {
289
- background-color: var(--yatl-brand-color);
290
- }
291
-
292
- .dropdown-menu {
293
- position: absolute;
294
- top: 100%;
295
- right: 0;
296
- margin-top: 4px;
297
- background: var(--yatl-dropdown-menu-bg);
298
- border: 1px solid var(--yatl-dropdown-menu-border);
299
- border-radius: var(--yatl-dropdown-menu-radius);
300
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
301
- padding: var(--yatl-dropdown-menu-padding);
302
- z-index: 50;
303
-
304
- display: flex;
305
- flex-direction: column;
306
- }
307
- `;
308
-
309
- // src/yatl-dropdown/yatl-dropdown.ts
310
- var YatlDropdown = class extends LitElement2 {
311
- constructor() {
312
- super(...arguments);
313
- this.open = false;
314
- this.handleDropdownTriggerClick = (event) => {
315
- event.preventDefault();
316
- event.stopPropagation();
317
- this.open = !this.open;
318
- if (this.open) {
319
- document.addEventListener("click", this.handleDocumentClick);
320
- } else {
321
- document.removeEventListener("click", this.handleDocumentClick);
322
- }
323
- };
324
- // Check if the click happened inside or outside
325
- this.handleDocumentClick = (event) => {
326
- if (this.detailsElement && !event.composedPath().includes(this.detailsElement)) {
327
- this.open = false;
328
- }
329
- };
330
- }
331
- render() {
332
- return html2`
333
- <details part="dropdown" class="dropdown" ?open=${this.open}>
334
- <summary @click=${this.handleDropdownTriggerClick}>
335
- <slot name="trigger"></slot>
336
- </summary>
337
- <div part="dropdown-menu" class="dropdown-menu">
338
- <slot></slot>
339
- </div>
340
- </details>
341
- `;
342
- }
343
- };
344
- YatlDropdown.styles = [yatl_dropdown_styles_default];
345
- __decorateClass([
346
- query("details")
347
- ], YatlDropdown.prototype, "detailsElement", 2);
348
- __decorateClass([
349
- property2({ type: Boolean, reflect: true })
350
- ], YatlDropdown.prototype, "open", 2);
351
- YatlDropdown = __decorateClass([
352
- customElement2("yatl-dropdown")
353
- ], YatlDropdown);
354
-
355
- // src/yatl-button-group/yatl-button-group.styles.ts
356
- import { css as css4 } from "lit";
357
- var yatl_button_group_styles_default = css4`
358
- :host {
359
- display: inline-flex;
360
- --yatl-button-group-radius: var(--yatl-table-button-group-radius, 8px);
361
- }
362
-
363
- .group-container {
364
- display: flex;
365
- flex-direction: row;
366
- align-items: stretch;
367
- }
368
-
369
- ::slotted(*:not(:first-child):not(:last-child)) {
370
- --yatl-table-button-radius: 0;
371
- }
372
-
373
- ::slotted(:first-child) {
374
- --yatl-table-button-radius: var(--yatl-button-group-radius) 0 0
375
- var(--yatl-button-group-radius);
376
- }
377
-
378
- ::slotted(:last-child) {
379
- --yatl-table-button-radius: 0 var(--yatl-button-group-radius)
380
- var(--yatl-button-group-radius) 0;
381
- margin-right: 0;
382
- }
383
-
384
- ::slotted(*) {
385
- margin-right: -1px;
386
- }
387
- `;
388
-
389
- // src/yatl-button-group/yatl-button-group.ts
390
- var YatlButtonGroup = class extends LitElement3 {
391
- render() {
392
- return html3`
393
- <div class="group-container">
394
- <slot @slotchange=${this.handleSlotChange}></slot>
395
- </div>
396
- `;
397
- }
398
- getFlattenedElements(slot) {
399
- const elements = slot.assignedNodes({ flatten: true }).filter((node) => node.nodeType === Node.ELEMENT_NODE);
400
- return elements.filter(
401
- (element) => getComputedStyle(element).display !== "none"
402
- );
403
- }
404
- handleSlotChange(event) {
405
- const slot = event.target;
406
- const elements = this.getFlattenedElements(slot);
407
- elements.forEach((element, index) => {
408
- if (element instanceof YatlDropdown) {
409
- element = element.querySelector('[slot="trigger"]') ?? element;
410
- }
411
- element.classList.toggle("is-first", index === 0);
412
- element.classList.toggle("is-last", index === elements.length - 1);
413
- });
414
- }
415
- };
416
- // FIXME: The column picker can't get the border radius
417
- YatlButtonGroup.styles = [yatl_button_group_styles_default];
418
- YatlButtonGroup = __decorateClass([
419
- customElement3("yatl-button-group")
420
- ], YatlButtonGroup);
421
-
422
- // src/yatl-dropdown-item/yatl-dropdown-item.ts
423
- import { html as html4, LitElement as LitElement4 } from "lit";
424
- import { customElement as customElement4, property as property3 } from "lit/decorators.js";
425
-
426
- // src/yatl-dropdown-item/yatl-dropdown-item.styles.ts
427
- import { css as css5 } from "lit";
428
- var yatl_dropdown_item_styles_default = css5`
429
- :host {
430
- --yatl-dropdown-item-padding: var(
431
- --yatl-table-dropdown-item-padding,
432
- 0.5em 1em
433
- );
434
- --yatl-dropdown-item-font-size: var(
435
- --yatl-table-dropdown-item-font-size,
436
- 16px
437
- );
438
- }
439
-
440
- .dropdown-item {
441
- display: flex;
442
- align-items: center;
443
- gap: var(--yatl-spacing-xs);
444
- color: var(--yatl-text);
445
- padding: var(--yatl-dropdown-item-padding);
446
- cursor: pointer;
447
- white-space: nowrap;
448
- font-size: var(--yatl-dropdown-item-font-size);
449
- user-select: none;
450
- transition: background 0.1s ease;
451
- }
452
-
453
- .dropdown-item:hover {
454
- background-color: var(--yatl-brand-color);
455
- border-radius: 4px;
456
- }
457
-
458
- .dropdown-item input {
459
- position: absolute;
460
- width: 1px;
461
- height: 1px;
462
- padding: 0;
463
- margin: -1px;
464
- overflow: hidden;
465
- clip: rect(0, 0, 0, 0);
466
- white-space: nowrap;
467
- border: 0;
468
- }
469
-
470
- .check-container {
471
- width: 18px;
472
- height: 18px;
473
- margin-right: 12px;
474
- display: flex;
475
- align-items: center;
476
- justify-content: center;
477
- border: 1px solid transparent;
478
- border-radius: 3px;
479
- transition: all 0.2s ease;
480
- }
481
-
482
- .check-icon {
483
- width: 14px;
484
- height: 14px;
485
- fill: var(--yatl-text);
486
- opacity: 0;
487
- transform: scale(0.5);
488
- transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46);
489
- }
490
-
491
- input:checked ~ .check-container .check-icon {
492
- opacity: 1;
493
- transform: scale(1);
494
- }
495
-
496
- input:focus-visible ~ .check-container {
497
- border-color: var(--yatl-brand-color);
498
- box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
499
- }
500
-
501
- .label-text {
502
- font-size: 14px;
503
- color: var(--yatl-text);
504
- }
505
- `;
506
-
507
12
  // src/events.ts
508
13
  var YatlEvent = class extends Event {
509
14
  constructor(name, options = {}) {
@@ -515,7 +20,7 @@ var YatlEvent = class extends Event {
515
20
  });
516
21
  }
517
22
  };
518
- var _YatlRowClickEvent = class _YatlRowClickEvent extends YatlEvent {
23
+ var YatlRowClickEvent = class _YatlRowClickEvent extends YatlEvent {
519
24
  constructor(row, rowId, index, field, originalEvent) {
520
25
  super(_YatlRowClickEvent.EVENT_NAME);
521
26
  this.row = row;
@@ -524,196 +29,195 @@ var _YatlRowClickEvent = class _YatlRowClickEvent extends YatlEvent {
524
29
  this.field = field;
525
30
  this.originalEvent = originalEvent;
526
31
  }
32
+ static {
33
+ this.EVENT_NAME = "yatl-row-click";
34
+ }
35
+ clone() {
36
+ return new _YatlRowClickEvent(
37
+ this.row,
38
+ this.rowId,
39
+ this.index,
40
+ this.field,
41
+ this.originalEvent
42
+ );
43
+ }
527
44
  };
528
- _YatlRowClickEvent.EVENT_NAME = "yatl-row-click";
529
- var YatlRowClickEvent = _YatlRowClickEvent;
530
- var _YatlRowSelectRequestEvent = class _YatlRowSelectRequestEvent extends YatlEvent {
45
+ var YatlRowSelectRequest = class _YatlRowSelectRequest extends YatlEvent {
531
46
  constructor(rowId, selected, currentlySelectedRows) {
532
- super(_YatlRowSelectRequestEvent.EVENT_NAME, { cancelable: true });
47
+ super(_YatlRowSelectRequest.EVENT_NAME, { cancelable: true });
533
48
  this.rowId = rowId;
534
49
  this.selected = selected;
535
50
  this.currentlySelectedRows = currentlySelectedRows;
536
51
  }
52
+ static {
53
+ this.EVENT_NAME = "yatl-row-select-request";
54
+ }
55
+ clone() {
56
+ return new _YatlRowSelectRequest(
57
+ this.rowId,
58
+ this.selected,
59
+ this.currentlySelectedRows
60
+ );
61
+ }
537
62
  };
538
- _YatlRowSelectRequestEvent.EVENT_NAME = "yatl-row-select-request";
539
- var YatlRowSelectRequestEvent = _YatlRowSelectRequestEvent;
540
- var _YatlRowSelectEvent = class _YatlRowSelectEvent extends YatlEvent {
63
+ var YatlRowSelectEvent = class _YatlRowSelectEvent extends YatlEvent {
541
64
  constructor(selectedIds, previouslySelectedRows) {
542
65
  super(_YatlRowSelectEvent.EVENT_NAME);
543
66
  this.selectedIds = selectedIds;
544
67
  this.previouslySelectedRows = previouslySelectedRows;
545
68
  }
69
+ static {
70
+ this.EVENT_NAME = "yatl-row-select";
71
+ }
72
+ clone() {
73
+ return new _YatlRowSelectEvent(
74
+ this.selectedIds,
75
+ this.previouslySelectedRows
76
+ );
77
+ }
546
78
  };
547
- _YatlRowSelectEvent.EVENT_NAME = "yatl-row-select";
548
- var YatlRowSelectEvent = _YatlRowSelectEvent;
549
- var _YatlColumnSortRequestEvent = class _YatlColumnSortRequestEvent extends YatlEvent {
79
+ var YatlColumnSortRequest = class _YatlColumnSortRequest extends YatlEvent {
550
80
  constructor(field, order, multisort) {
551
- super(_YatlColumnSortRequestEvent.EVENT_NAME, { cancelable: true });
81
+ super(_YatlColumnSortRequest.EVENT_NAME, { cancelable: true });
552
82
  this.field = field;
553
83
  this.order = order;
554
84
  this.multisort = multisort;
555
85
  }
86
+ static {
87
+ this.EVENT_NAME = "yatl-column-sort-request";
88
+ }
89
+ clone() {
90
+ return new _YatlColumnSortRequest(this.field, this.order, this.multisort);
91
+ }
556
92
  };
557
- _YatlColumnSortRequestEvent.EVENT_NAME = "yatl-column-sort-request";
558
- var YatlColumnSortRequestEvent = _YatlColumnSortRequestEvent;
559
- var _YatlColumnSortEvent = class _YatlColumnSortEvent extends YatlEvent {
93
+ var YatlColumnSortEvent = class _YatlColumnSortEvent extends YatlEvent {
560
94
  constructor(field, order, multisort) {
561
95
  super(_YatlColumnSortEvent.EVENT_NAME);
562
96
  this.field = field;
563
97
  this.order = order;
564
98
  this.multisort = multisort;
565
99
  }
100
+ static {
101
+ this.EVENT_NAME = "yatl-column-sort";
102
+ }
103
+ clone() {
104
+ return new _YatlColumnSortEvent(this.field, this.order, this.multisort);
105
+ }
566
106
  };
567
- _YatlColumnSortEvent.EVENT_NAME = "yatl-column-sort";
568
- var YatlColumnSortEvent = _YatlColumnSortEvent;
569
- var _YatlColumnToggleRequestEvent = class _YatlColumnToggleRequestEvent extends YatlEvent {
107
+ var YatlColumnToggleRequest = class _YatlColumnToggleRequest extends YatlEvent {
570
108
  constructor(field, visibility) {
571
- super(_YatlColumnToggleRequestEvent.EVENT_NAME, { cancelable: true });
109
+ super(_YatlColumnToggleRequest.EVENT_NAME, { cancelable: true });
572
110
  this.field = field;
573
111
  this.visibility = visibility;
574
112
  }
113
+ static {
114
+ this.EVENT_NAME = "yatl-column-toggle-request";
115
+ }
116
+ clone() {
117
+ return new _YatlColumnToggleRequest(this.field, this.visibility);
118
+ }
575
119
  };
576
- _YatlColumnToggleRequestEvent.EVENT_NAME = "yatl-column-toggle-request";
577
- var YatlColumnToggleRequestEvent = _YatlColumnToggleRequestEvent;
578
- var _YatlColumnToggleEvent = class _YatlColumnToggleEvent extends YatlEvent {
120
+ var YatlColumnToggleEvent = class _YatlColumnToggleEvent extends YatlEvent {
579
121
  constructor(field, visible) {
580
122
  super(_YatlColumnToggleEvent.EVENT_NAME);
581
123
  this.field = field;
582
124
  this.visible = visible;
583
125
  }
126
+ static {
127
+ this.EVENT_NAME = "yatl-column-toggle";
128
+ }
129
+ clone() {
130
+ return new _YatlColumnToggleEvent(this.field, this.visible);
131
+ }
584
132
  };
585
- _YatlColumnToggleEvent.EVENT_NAME = "yatl-column-toggle";
586
- var YatlColumnToggleEvent = _YatlColumnToggleEvent;
587
- var _YatlColumnResizeEvent = class _YatlColumnResizeEvent extends YatlEvent {
133
+ var YatlColumnResizeEvent = class _YatlColumnResizeEvent extends YatlEvent {
588
134
  constructor(field, width) {
589
135
  super(_YatlColumnResizeEvent.EVENT_NAME);
590
136
  this.field = field;
591
137
  this.width = width;
592
138
  }
139
+ static {
140
+ this.EVENT_NAME = "yatl-column-resize";
141
+ }
142
+ clone() {
143
+ return new _YatlColumnResizeEvent(this.field, this.width);
144
+ }
593
145
  };
594
- _YatlColumnResizeEvent.EVENT_NAME = "yatl-column-resize";
595
- var YatlColumnResizeEvent = _YatlColumnResizeEvent;
596
- var _YatlColumnReorderRequestEvent = class _YatlColumnReorderRequestEvent extends YatlEvent {
146
+ var YatlColumnReorderRequest = class _YatlColumnReorderRequest extends YatlEvent {
597
147
  constructor(movedColumn, originalIndex, newIndex) {
598
- super(_YatlColumnReorderRequestEvent.EVENT_NAME, { cancelable: true });
148
+ super(_YatlColumnReorderRequest.EVENT_NAME, { cancelable: true });
599
149
  this.movedColumn = movedColumn;
600
150
  this.originalIndex = originalIndex;
601
151
  this.newIndex = newIndex;
602
152
  }
153
+ static {
154
+ this.EVENT_NAME = "yatl-column-reorder-request";
155
+ }
156
+ clone() {
157
+ return new _YatlColumnReorderRequest(
158
+ this.movedColumn,
159
+ this.originalIndex,
160
+ this.newIndex
161
+ );
162
+ }
603
163
  };
604
- _YatlColumnReorderRequestEvent.EVENT_NAME = "yatl-column-reorder-request";
605
- var YatlColumnReorderRequestEvent = _YatlColumnReorderRequestEvent;
606
- var _YatlColumnReorderEvent = class _YatlColumnReorderEvent extends YatlEvent {
164
+ var YatlColumnReorderEvent = class _YatlColumnReorderEvent extends YatlEvent {
607
165
  constructor(order) {
608
166
  super(_YatlColumnReorderEvent.EVENT_NAME);
609
167
  this.order = order;
610
168
  }
169
+ static {
170
+ this.EVENT_NAME = "yatl-column-reorder";
171
+ }
172
+ clone() {
173
+ return new _YatlColumnReorderEvent(this.order);
174
+ }
611
175
  };
612
- _YatlColumnReorderEvent.EVENT_NAME = "yatl-column-reorder";
613
- var YatlColumnReorderEvent = _YatlColumnReorderEvent;
614
- var _YatlTableSearchEvent = class _YatlTableSearchEvent extends YatlEvent {
615
- constructor(query3) {
176
+ var YatlTableSearchEvent = class _YatlTableSearchEvent extends YatlEvent {
177
+ constructor(query2) {
616
178
  super(_YatlTableSearchEvent.EVENT_NAME);
617
- this.query = query3;
179
+ this.query = query2;
180
+ }
181
+ static {
182
+ this.EVENT_NAME = "yatl-table-search";
183
+ }
184
+ clone() {
185
+ return new _YatlTableSearchEvent(this.query);
618
186
  }
619
187
  };
620
- _YatlTableSearchEvent.EVENT_NAME = "yatl-table-search";
621
- var YatlTableSearchEvent = _YatlTableSearchEvent;
622
- var _YatlTableViewChangeEvent = class _YatlTableViewChangeEvent extends YatlEvent {
188
+ var YatlTableViewChangeEvent = class _YatlTableViewChangeEvent extends YatlEvent {
623
189
  constructor(data) {
624
190
  super(_YatlTableViewChangeEvent.EVENT_NAME);
625
191
  this.data = data;
626
192
  }
627
- };
628
- _YatlTableViewChangeEvent.EVENT_NAME = "yatl-table-view-change";
629
- var YatlTableViewChangeEvent = _YatlTableViewChangeEvent;
630
- var _YatlTableStateChangeEvent = class _YatlTableStateChangeEvent extends YatlEvent {
631
- constructor(state, triggers) {
632
- super(_YatlTableStateChangeEvent.EVENT_NAME);
633
- this.state = state;
634
- this.triggers = triggers;
193
+ static {
194
+ this.EVENT_NAME = "yatl-table-view-change";
635
195
  }
636
- };
637
- _YatlTableStateChangeEvent.EVENT_NAME = "yatl-table-state-change";
638
- var YatlTableStateChangeEvent = _YatlTableStateChangeEvent;
639
- var _YatlDropdownToggleEvent = class _YatlDropdownToggleEvent extends YatlEvent {
640
- constructor(value, checked) {
641
- super(_YatlDropdownToggleEvent.EVENT_NAME);
642
- this.value = value;
643
- this.checked = checked;
196
+ clone() {
197
+ return new _YatlTableViewChangeEvent(this.data);
644
198
  }
645
199
  };
646
- _YatlDropdownToggleEvent.EVENT_NAME = "yatl-dropdown-toggle";
647
- var YatlDropdownToggleEvent = _YatlDropdownToggleEvent;
648
- var _YatlToolbarSearchInput = class _YatlToolbarSearchInput extends YatlEvent {
649
- constructor(value) {
650
- super(_YatlToolbarSearchInput.EVENT_NAME);
651
- this.value = value;
200
+ var YatlTableStateChangeEvent = class _YatlTableStateChangeEvent extends YatlEvent {
201
+ constructor(state2, triggers) {
202
+ super(_YatlTableStateChangeEvent.EVENT_NAME);
203
+ this.state = state2;
204
+ this.triggers = triggers;
652
205
  }
653
- };
654
- _YatlToolbarSearchInput.EVENT_NAME = "yatl-toolbar-search-input";
655
- var YatlToolbarSearchInput = _YatlToolbarSearchInput;
656
- var _YatlToolbarSearchChange = class _YatlToolbarSearchChange extends YatlEvent {
657
- constructor(value) {
658
- super(_YatlToolbarSearchChange.EVENT_NAME);
659
- this.value = value;
206
+ static {
207
+ this.EVENT_NAME = "yatl-table-state-change";
660
208
  }
661
- };
662
- _YatlToolbarSearchChange.EVENT_NAME = "yatl-toolbar-search-change";
663
- var YatlToolbarSearchChange = _YatlToolbarSearchChange;
664
- var _YatlToolbarExportClick = class _YatlToolbarExportClick extends YatlEvent {
665
- constructor() {
666
- super(_YatlToolbarExportClick.EVENT_NAME);
209
+ clone() {
210
+ return new _YatlTableStateChangeEvent(this.state, this.triggers);
667
211
  }
668
212
  };
669
- _YatlToolbarExportClick.EVENT_NAME = "yatl-toolbar-export-click";
670
- var YatlToolbarExportClick = _YatlToolbarExportClick;
671
-
672
- // src/yatl-dropdown-item/yatl-dropdown-item.ts
673
- var YatlDropdownItem = class extends LitElement4 {
674
- constructor() {
675
- super(...arguments);
676
- this.value = "on";
677
- this.checked = false;
678
- this.handleCheckboxChanged = (event) => {
679
- const input = event.target;
680
- this.checked = input.checked;
681
- this.dispatchEvent(new YatlDropdownToggleEvent(input.value, input.checked));
682
- };
683
- }
684
- render() {
685
- return html4`
686
- <label part="dropdown-item" class="dropdown-item">
687
- <input
688
- type="checkbox"
689
- value=${this.value}
690
- .checked=${this.checked}
691
- @change=${this.handleCheckboxChanged}
692
- />
693
- <div class="check-container">
694
- <svg class="check-icon" viewBox="0 0 16 16">
695
- <path
696
- d="M13.485 1.929l-8.485 8.485-3.536-3.536-1.414 1.414 4.95 4.95 9.9-9.9z"
697
- />
698
- </svg>
699
- </div>
700
- <span part="label-text" class="label-text"><slot></slot></span>
701
- </label>
702
- `;
703
- }
704
- };
705
- YatlDropdownItem.styles = [yatl_dropdown_item_styles_default];
706
- __decorateClass([
707
- property3({ type: String, reflect: true })
708
- ], YatlDropdownItem.prototype, "value", 2);
709
- __decorateClass([
710
- property3({ type: Boolean, reflect: true })
711
- ], YatlDropdownItem.prototype, "checked", 2);
712
- YatlDropdownItem = __decorateClass([
713
- customElement4("yatl-dropdown-item")
714
- ], YatlDropdownItem);
715
213
 
716
214
  // src/utils/columns.ts
215
+ function findColumn(columns, field) {
216
+ return columns.find((c) => c.field === field);
217
+ }
218
+ function isInternalColumn(col) {
219
+ return col?.role === "internal";
220
+ }
717
221
  function isDisplayColumn(col) {
718
222
  return col?.role !== "internal";
719
223
  }
@@ -766,6 +270,24 @@ function getNestedValue(obj, path) {
766
270
  }
767
271
  return current;
768
272
  }
273
+ function setNestedValue(obj, path, value) {
274
+ const keys = path.split(".");
275
+ const finalProp = keys.at(-1);
276
+ if (!finalProp) {
277
+ throw new Error("Cannot set nested value with empty path");
278
+ }
279
+ let current = obj;
280
+ for (const key of keys.slice(0, -1)) {
281
+ if (!isValidKey(key, current)) {
282
+ const newObj = {};
283
+ Object.assign(current, { [key]: newObj });
284
+ current = newObj;
285
+ } else {
286
+ current = current[key];
287
+ }
288
+ }
289
+ Object.assign(current, { [finalProp]: value });
290
+ }
769
291
 
770
292
  // src/utils/tokenizer.ts
771
293
  var createRegexTokenizer = (exp = "\\S+") => {
@@ -783,8 +305,25 @@ var createRegexTokenizer = (exp = "\\S+") => {
783
305
  };
784
306
  var whitespaceTokenizer = createRegexTokenizer();
785
307
 
786
- // src/yatl-table/utils.ts
787
- import { html as html5 } from "lit";
308
+ // src/utils/typed-event-target.ts
309
+ var TypedEventTarget = class extends EventTarget {
310
+ addEventListener(type, listener, options) {
311
+ super.addEventListener(
312
+ type,
313
+ listener,
314
+ options
315
+ );
316
+ }
317
+ removeEventListener(type, listener, options) {
318
+ super.removeEventListener(type, listener, options);
319
+ }
320
+ dispatchEvent(event) {
321
+ return super.dispatchEvent(event);
322
+ }
323
+ };
324
+
325
+ // src/table/utils.ts
326
+ import { html } from "lit";
788
327
  function highlightText(text, ranges) {
789
328
  if (!text || !ranges || ranges.length === 0) {
790
329
  return text;
@@ -811,47 +350,29 @@ function highlightText(text, ranges) {
811
350
  result.push(text.slice(lastIndex, safeStart));
812
351
  }
813
352
  result.push(
814
- html5`<mark class="highlight">${text.slice(safeStart, safeEnd)}</mark>`
353
+ html`<mark class="highlight">${text.slice(safeStart, safeEnd)}</mark>`
815
354
  );
816
355
  lastIndex = safeEnd;
817
356
  }
818
357
  if (lastIndex < text.length) {
819
358
  result.push(text.slice(lastIndex));
820
359
  }
821
- return html5`${result}`;
360
+ return html`${result}`;
822
361
  }
823
362
  var toHumanReadable = (str) => {
824
363
  return str.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (char) => char.toUpperCase());
825
364
  };
826
365
 
827
- // src/yatl-table/yatl-table.ts
828
- import { html as html6, LitElement as LitElement5, nothing } from "lit";
829
- import { customElement as customElement5, property as property4, query as query2 } from "lit/decorators.js";
366
+ // src/table/table.ts
367
+ import { html as html2, LitElement, nothing } from "lit";
368
+ import { customElement, property, query, state } from "lit/decorators.js";
830
369
  import { classMap } from "lit/directives/class-map.js";
831
370
  import { ifDefined } from "lit/directives/if-defined.js";
832
371
  import { repeat } from "lit/directives/repeat.js";
833
372
  import { styleMap } from "lit/directives/style-map.js";
834
373
  import "@lit-labs/virtualizer";
835
374
 
836
- // src/yatl-table-controller/utils.ts
837
- function getColumnStateChanges2(oldState, newState) {
838
- if (oldState && oldState.field !== newState.field) {
839
- throw Error(
840
- `attempting to compare states for different fields: ${oldState.field}, ${newState.field}`
841
- );
842
- }
843
- const changes = [];
844
- if (oldState?.visible !== newState.visible) {
845
- changes.push("visible");
846
- }
847
- if (oldState?.width !== newState.width) {
848
- changes.push("width");
849
- }
850
- if (oldState?.sort !== newState.sort || oldState.sort?.order !== newState.sort?.order || oldState.sort?.priority !== newState.sort?.priority) {
851
- changes.push("sort");
852
- }
853
- return changes;
854
- }
375
+ // src/table-controller/utils.ts
855
376
  function getCompareableValue(value) {
856
377
  if (typeof value === "string" || typeof value === "number" || typeof value === "bigint") {
857
378
  return value;
@@ -887,7 +408,7 @@ function createRankMap(values, locale) {
887
408
  return rankMap;
888
409
  }
889
410
 
890
- // src/yatl-table-controller/yatl-table-controller.ts
411
+ // src/table-controller/table-controller.ts
891
412
  var STATE_SAVE_DEBOUNCE = 1e3;
892
413
  var DEFAULT_STORAGE_OPTIONS = {
893
414
  storage: "local",
@@ -902,10 +423,11 @@ var MATCH_WEIGHTS = {
902
423
  PREFIX: 50,
903
424
  SUBSTRING: 10
904
425
  };
905
- var YatlTableController = class {
426
+ var YatlTableController = class extends TypedEventTarget {
906
427
  // #endregion
907
428
  // #region Public Methods
908
429
  constructor(host, options) {
430
+ super();
909
431
  // #region State Data
910
432
  // Property data
911
433
  this.hosts = /* @__PURE__ */ new Set();
@@ -928,6 +450,11 @@ var YatlTableController = class {
928
450
  };
929
451
  this._data = [];
930
452
  this._filteredData = [];
453
+ // The last time the data was updated.
454
+ // This is just provided as a convience so the
455
+ // table element can display it in the footer.
456
+ // The controller needs to own it so it is always accurate.
457
+ this._dataUpdateTimestamp = null;
931
458
  this._searchQuery = "";
932
459
  this._searchTokenizer = whitespaceTokenizer;
933
460
  this._filters = null;
@@ -1024,22 +551,22 @@ var YatlTableController = class {
1024
551
  }
1025
552
  get columnStates() {
1026
553
  return this.columns.map((column) => {
1027
- const state = this.getColumnState(column.field);
1028
- return createState(column.field, state);
554
+ const state2 = this.getColumnState(column.field);
555
+ return createState(column.field, state2);
1029
556
  });
1030
557
  }
1031
558
  set columnStates(states) {
1032
559
  let changed = false;
1033
- for (const state of states) {
1034
- const oldState = this.getColumnState(state.field);
1035
- const stateChanges = getColumnStateChanges2(oldState, state);
560
+ for (const state2 of states) {
561
+ const oldState = this.getColumnState(state2.field);
562
+ const stateChanges = getColumnStateChanges(oldState, state2);
1036
563
  if (stateChanges.length) {
1037
564
  changed = true;
1038
565
  if (stateChanges.includes("sort")) {
1039
566
  this.sortDirty = true;
1040
567
  }
1041
- const newState = createState(state.field, state);
1042
- this._columnStateMap.set(state.field, newState);
568
+ const newState = createState(state2.field, state2);
569
+ this._columnStateMap.set(state2.field, newState);
1043
570
  }
1044
571
  }
1045
572
  if (!changed) {
@@ -1054,11 +581,11 @@ var YatlTableController = class {
1054
581
  get searchQuery() {
1055
582
  return this._searchQuery;
1056
583
  }
1057
- set searchQuery(query3) {
1058
- if (this._searchQuery === query3) {
584
+ set searchQuery(query2) {
585
+ if (this._searchQuery === query2) {
1059
586
  return;
1060
587
  }
1061
- this._searchQuery = query3;
588
+ this._searchQuery = query2;
1062
589
  this.updateInternalQuery();
1063
590
  this.filterDirty = true;
1064
591
  this.requestUpdate("searchQuery");
@@ -1183,6 +710,7 @@ var YatlTableController = class {
1183
710
  set data(data) {
1184
711
  this._data = [...data];
1185
712
  this.createMetadata();
713
+ this._dataUpdateTimestamp = /* @__PURE__ */ new Date();
1186
714
  this.filterDirty = true;
1187
715
  this.requestUpdate("data");
1188
716
  }
@@ -1196,6 +724,9 @@ var YatlTableController = class {
1196
724
  this.sortDirty = false;
1197
725
  return [...this._filteredData];
1198
726
  }
727
+ get dataUpdateTimestamp() {
728
+ return this._dataUpdateTimestamp;
729
+ }
1199
730
  attach(host) {
1200
731
  this.hosts.add(host);
1201
732
  host.addController(this);
@@ -1222,8 +753,8 @@ var YatlTableController = class {
1222
753
  searchQuery: this.searchQuery,
1223
754
  selectedRows: this.selectedRowIds,
1224
755
  columns: this.columnStates.map((column) => {
1225
- const state = this.getColumnState(column.field);
1226
- return createState(column.field, state);
756
+ const state2 = this.getColumnState(column.field);
757
+ return createState(column.field, state2);
1227
758
  })
1228
759
  };
1229
760
  }
@@ -1231,15 +762,15 @@ var YatlTableController = class {
1231
762
  * Restores the table to the provided state.
1232
763
  * @param state - The state to restore the table to.
1233
764
  */
1234
- updateTableState(state) {
1235
- if ("searchQuery" in state && state.searchQuery !== void 0) {
1236
- this.searchQuery = state.searchQuery;
765
+ updateTableState(state2) {
766
+ if ("searchQuery" in state2 && state2.searchQuery !== void 0) {
767
+ this.searchQuery = state2.searchQuery;
1237
768
  }
1238
- if ("selectedRows" in state && state.selectedRows) {
1239
- this.selectedRowIds = state.selectedRows;
769
+ if ("selectedRows" in state2 && state2.selectedRows) {
770
+ this.selectedRowIds = state2.selectedRows;
1240
771
  }
1241
- if ("columns" in state && state.columns !== void 0) {
1242
- for (const newState of state.columns) {
772
+ if ("columns" in state2 && state2.columns !== void 0) {
773
+ for (const newState of state2.columns) {
1243
774
  this.updateColumnState(newState.field, newState);
1244
775
  }
1245
776
  }
@@ -1254,14 +785,29 @@ var YatlTableController = class {
1254
785
  }
1255
786
  return createState(field, currentState);
1256
787
  }
1257
- updateColumnState(field, state) {
788
+ updateColumnState(field, state2) {
1258
789
  const currentState = this._columnStateMap.get(field);
1259
- const newState = createState(field, { ...currentState, ...state });
790
+ const newState = createState(field, { ...currentState, ...state2 });
1260
791
  this.columnStates = [newState];
1261
792
  }
1262
- search(query3) {
1263
- this.searchQuery = query3;
1264
- this.dispatchEvent(new YatlTableSearchEvent(query3));
793
+ search(query2) {
794
+ this.searchQuery = query2;
795
+ this.dispatchEvent(new YatlTableSearchEvent(query2));
796
+ }
797
+ getColumnFilterValues(field, includeNull = false) {
798
+ const column = this.getDisplayColumn(field);
799
+ const values = /* @__PURE__ */ new Map();
800
+ for (const row of this.filteredData) {
801
+ let value = getNestedValue(row, field);
802
+ if (column?.valueFormatter) {
803
+ value = column.valueFormatter(value, row);
804
+ }
805
+ if (value != null || includeNull) {
806
+ const valueCount = values.get(value) ?? 0;
807
+ values.set(value, valueCount + 1);
808
+ }
809
+ }
810
+ return values;
1265
811
  }
1266
812
  /**
1267
813
  * Sorts the table by a specified column and order.
@@ -1271,24 +817,24 @@ var YatlTableController = class {
1271
817
  * @param clear - Clear all other sorting
1272
818
  */
1273
819
  sort(field, order, clear = true) {
1274
- const state = this.getColumnState(field);
1275
- if (state === void 0) {
820
+ const state2 = this.getColumnState(field);
821
+ if (state2 === void 0) {
1276
822
  throw new Error(`Cannot get options for non-existent column "${field}"`);
1277
823
  }
1278
- if (order === state?.sort?.order) {
824
+ if (order === state2?.sort?.order) {
1279
825
  return;
1280
826
  }
1281
- if (order && !state.sort) {
1282
- const priorities = [...this._columnStateMap.values()].map((state2) => state2.sort?.priority).filter((priority2) => priority2 !== void 0);
827
+ if (order && !state2.sort) {
828
+ const priorities = [...this._columnStateMap.values()].map((state3) => state3.sort?.priority).filter((priority2) => priority2 !== void 0);
1283
829
  const maxPriority = this.columns.length + 1;
1284
830
  const priority = Math.min(maxPriority, ...priorities) - 1;
1285
- state.sort = { order, priority };
1286
- } else if (order && state.sort) {
1287
- state.sort.order = order;
831
+ state2.sort = { order, priority };
832
+ } else if (order && state2.sort) {
833
+ state2.sort.order = order;
1288
834
  } else {
1289
- state.sort = null;
835
+ state2.sort = null;
1290
836
  }
1291
- const newStates = [state];
837
+ const newStates = [state2];
1292
838
  if (clear) {
1293
839
  for (const otherColumn of this.columns) {
1294
840
  if (otherColumn.field !== field) {
@@ -1308,13 +854,13 @@ var YatlTableController = class {
1308
854
  * @param visible - Optionally force the visibility state.
1309
855
  */
1310
856
  toggleColumnVisibility(field, visible) {
1311
- const state = this.getColumnState(field);
1312
- const newVisibility = visible !== void 0 ? visible : !state.visible;
1313
- if (newVisibility === state.visible) {
857
+ const state2 = this.getColumnState(field);
858
+ const newVisibility = visible !== void 0 ? visible : !state2.visible;
859
+ if (newVisibility === state2.visible) {
1314
860
  return;
1315
861
  }
1316
- state.visible = newVisibility;
1317
- this.columnStates = [state];
862
+ state2.visible = newVisibility;
863
+ this.columnStates = [state2];
1318
864
  const event = new YatlColumnToggleEvent(field, newVisibility);
1319
865
  this.dispatchEvent(event);
1320
866
  }
@@ -1351,9 +897,9 @@ var YatlTableController = class {
1351
897
  }
1352
898
  }
1353
899
  resizeColumn(field, width) {
1354
- const state = this.getColumnState(field);
1355
- state.width = width;
1356
- this.updateColumnState(field, state);
900
+ const state2 = this.getColumnState(field);
901
+ state2.width = width;
902
+ this.updateColumnState(field, state2);
1357
903
  this.dispatchEvent(new YatlColumnResizeEvent(field, width));
1358
904
  }
1359
905
  isRowSelected(row) {
@@ -1363,10 +909,10 @@ var YatlTableController = class {
1363
909
  /**
1364
910
  * Toggles the selection state of a specific row.
1365
911
  */
1366
- toggleRowSelection(row, state) {
912
+ toggleRowSelection(row, state2) {
1367
913
  const rowId = this.getRowId(row);
1368
914
  const isSelected = this.isRowSelected(row);
1369
- const newSelectionState = state !== void 0 ? state : isSelected;
915
+ const newSelectionState = state2 !== void 0 ? state2 : isSelected;
1370
916
  if (newSelectionState === isSelected) {
1371
917
  return;
1372
918
  }
@@ -1411,8 +957,7 @@ var YatlTableController = class {
1411
957
  }
1412
958
  /**
1413
959
  * Export the current visible table data to a CSV file.
1414
- * @param filename - The name of the file to save.
1415
- * @param all - If `true`, exports all original data (ignoring filters). If `false` (default), exports only the currently visible (filtered and sorted) rows.
960
+ * @param options - Options for configuring what should be exported.
1416
961
  */
1417
962
  export(options = {
1418
963
  includeAllRows: false,
@@ -1435,9 +980,9 @@ var YatlTableController = class {
1435
980
  const csvRows = data.map((row) => {
1436
981
  const list = [];
1437
982
  for (const column of columnData) {
1438
- const state = this.getColumnState(column.field);
983
+ const state2 = this.getColumnState(column.field);
1439
984
  let value = getNestedValue(row, column.field);
1440
- if (options.includeHiddenColumns || state.visible) {
985
+ if (options.includeHiddenColumns || state2.visible) {
1441
986
  if (isDisplayColumn(column) && typeof column.valueFormatter === "function") {
1442
987
  value = column.valueFormatter(value, row);
1443
988
  }
@@ -1520,7 +1065,7 @@ var YatlTableController = class {
1520
1065
  }
1521
1066
  /**
1522
1067
  * Deletes the row with the matching ID.
1523
- * @param id - The ID of the row to delete
1068
+ * @param rowIds - The IDs rows to delete
1524
1069
  */
1525
1070
  deleteRow(...rowIds) {
1526
1071
  for (const rowId of rowIds) {
@@ -1533,7 +1078,7 @@ var YatlTableController = class {
1533
1078
  }
1534
1079
  /**
1535
1080
  * Deletes a row at a specific original index from the table.
1536
- * @param index - The original index of the row to delete.
1081
+ * @param indexes - The original indexes of rows to delete.
1537
1082
  */
1538
1083
  deleteRowAtIndex(...indexes) {
1539
1084
  const newSelectedRows = new Set(this.selectedRowIds);
@@ -1571,13 +1116,6 @@ var YatlTableController = class {
1571
1116
  return metadata.highlightIndices;
1572
1117
  }
1573
1118
  // #endregion
1574
- dispatchEvent(event) {
1575
- for (const host of this.hosts) {
1576
- if (host instanceof YatlTable) {
1577
- host.dispatchEvent(event);
1578
- }
1579
- }
1580
- }
1581
1119
  // #region Lifecycle Methods
1582
1120
  hostConnected() {
1583
1121
  }
@@ -1622,41 +1160,41 @@ var YatlTableController = class {
1622
1160
  * @param target The string to be searched (e.g., "Apple" or "Application").
1623
1161
  * @returns A numerical score representing the relevance of the match. Higher is better. Returns 0 if no match is found.
1624
1162
  */
1625
- calculateSearchScore(query3, target) {
1163
+ calculateSearchScore(query2, target) {
1626
1164
  const results = { score: 0, ranges: [] };
1627
- if (!query3 || !target) {
1165
+ if (!query2 || !target) {
1628
1166
  return results;
1629
1167
  }
1630
1168
  let baseScore = 0;
1631
1169
  let matchTypeWeight = 0;
1632
- if (target === query3) {
1170
+ if (target === query2) {
1633
1171
  matchTypeWeight = MATCH_WEIGHTS.EXACT;
1634
- baseScore = query3.length;
1172
+ baseScore = query2.length;
1635
1173
  results.ranges.push([0, target.length]);
1636
- } else if (target.startsWith(query3)) {
1174
+ } else if (target.startsWith(query2)) {
1637
1175
  matchTypeWeight = MATCH_WEIGHTS.PREFIX;
1638
- baseScore = query3.length;
1639
- results.ranges.push([0, query3.length]);
1176
+ baseScore = query2.length;
1177
+ results.ranges.push([0, query2.length]);
1640
1178
  } else {
1641
- const index = target.indexOf(query3);
1179
+ const index = target.indexOf(query2);
1642
1180
  if (index !== -1) {
1643
1181
  matchTypeWeight = MATCH_WEIGHTS.SUBSTRING;
1644
- baseScore = query3.length;
1182
+ baseScore = query2.length;
1645
1183
  let cursor = index;
1646
1184
  while (cursor !== -1) {
1647
- results.ranges.push([cursor, cursor + query3.length]);
1648
- cursor = target.indexOf(query3, cursor + 1);
1185
+ results.ranges.push([cursor, cursor + query2.length]);
1186
+ cursor = target.indexOf(query2, cursor + 1);
1649
1187
  }
1650
1188
  } else {
1651
1189
  return results;
1652
1190
  }
1653
1191
  }
1654
- const lengthDifference = target.length - query3.length;
1192
+ const lengthDifference = target.length - query2.length;
1655
1193
  const specificityBonus = 1 / (1 + lengthDifference);
1656
1194
  results.score = baseScore * matchTypeWeight * specificityBonus;
1657
1195
  return results;
1658
1196
  }
1659
- searchField(query3, value, tokens) {
1197
+ searchField(query2, value, tokens) {
1660
1198
  const result = { score: 0, ranges: [] };
1661
1199
  const addRangesFromValue = (searchTerm) => {
1662
1200
  let idx = value.indexOf(searchTerm);
@@ -1665,32 +1203,32 @@ var YatlTableController = class {
1665
1203
  idx = value.indexOf(searchTerm, idx + 1);
1666
1204
  }
1667
1205
  };
1668
- if (query3.quoted || !tokens) {
1206
+ if (query2.quoted || !tokens) {
1669
1207
  if (!this.enableSearchScoring) {
1670
- if (value.includes(query3.value)) {
1208
+ if (value.includes(query2.value)) {
1671
1209
  result.score = 1;
1672
- addRangesFromValue(query3.value);
1210
+ addRangesFromValue(query2.value);
1673
1211
  }
1674
1212
  } else {
1675
- const calculation = this.calculateSearchScore(query3.value, value);
1213
+ const calculation = this.calculateSearchScore(query2.value, value);
1676
1214
  result.score = calculation.score;
1677
1215
  result.ranges = calculation.ranges;
1678
1216
  }
1679
1217
  return result;
1680
1218
  }
1681
1219
  if (!this.enableSearchScoring) {
1682
- const isMatch = tokens.some((token) => token.includes(query3.value));
1220
+ const isMatch = tokens.some((token) => token.includes(query2.value));
1683
1221
  if (isMatch) {
1684
1222
  result.score = 1;
1685
- addRangesFromValue(query3.value);
1223
+ addRangesFromValue(query2.value);
1686
1224
  }
1687
1225
  return result;
1688
1226
  }
1689
1227
  for (const token of tokens) {
1690
- const calculation = this.calculateSearchScore(query3.value, token);
1228
+ const calculation = this.calculateSearchScore(query2.value, token);
1691
1229
  if (calculation.score > 0) {
1692
1230
  result.score += calculation.score;
1693
- addRangesFromValue(query3.value);
1231
+ addRangesFromValue(query2.value);
1694
1232
  }
1695
1233
  }
1696
1234
  return result;
@@ -1734,7 +1272,7 @@ var YatlTableController = class {
1734
1272
  if (!filter(value)) {
1735
1273
  return false;
1736
1274
  }
1737
- } else {
1275
+ } else if (filter !== void 0) {
1738
1276
  const column = this.getColumn(field);
1739
1277
  const filterCallback = column ? column.filter : void 0;
1740
1278
  if (!this.filterField(value, filter, filterCallback)) {
@@ -1785,21 +1323,21 @@ var YatlTableController = class {
1785
1323
  // #region Sort Methods
1786
1324
  compareRows(a, b, field) {
1787
1325
  let aValue, bValue;
1788
- const state = this.getColumnState(field);
1789
- if (!state.sort) {
1326
+ const state2 = this.getColumnState(field);
1327
+ if (!state2.sort) {
1790
1328
  return 0;
1791
1329
  }
1792
1330
  const aMetadata = this.rowMetadata.get(a);
1793
1331
  const bMetadata = this.rowMetadata.get(b);
1794
- if (state.sort?.order === "asc") {
1332
+ if (state2.sort?.order === "asc") {
1795
1333
  aValue = aMetadata.sortValues[field];
1796
1334
  bValue = bMetadata.sortValues[field];
1797
1335
  } else {
1798
1336
  aValue = bMetadata.sortValues[field];
1799
1337
  bValue = aMetadata.sortValues[field];
1800
1338
  }
1801
- aValue ?? (aValue = Number.MIN_SAFE_INTEGER);
1802
- bValue ?? (bValue = Number.MIN_SAFE_INTEGER);
1339
+ aValue ??= Number.MIN_SAFE_INTEGER;
1340
+ bValue ??= Number.MIN_SAFE_INTEGER;
1803
1341
  if (aValue < bValue) return -1;
1804
1342
  if (aValue > bValue) return 1;
1805
1343
  return 0;
@@ -1809,7 +1347,7 @@ var YatlTableController = class {
1809
1347
  this.filterRows();
1810
1348
  return;
1811
1349
  }
1812
- const sortedStates = [...this._columnStateMap.values()].filter((state) => state.visible && state.sort).sort((a, b) => b.sort.priority - a.sort.priority);
1350
+ const sortedStates = [...this._columnStateMap.values()].filter((state2) => state2.visible && state2.sort).sort((a, b) => b.sort.priority - a.sort.priority);
1813
1351
  this._filteredData = this._filteredData.toSorted((a, b) => {
1814
1352
  const aMetadata = this.rowMetadata.get(a);
1815
1353
  const bMetadata = this.rowMetadata.get(b);
@@ -1819,8 +1357,8 @@ var YatlTableController = class {
1819
1357
  if (aValue > bValue) return -1;
1820
1358
  if (aValue < bValue) return 1;
1821
1359
  }
1822
- for (const state of sortedStates) {
1823
- const comp = this.compareRows(a, b, state.field);
1360
+ for (const state2 of sortedStates) {
1361
+ const comp = this.compareRows(a, b, state2.field);
1824
1362
  if (comp !== 0) {
1825
1363
  return comp;
1826
1364
  }
@@ -2002,127 +1540,195 @@ function warnInvalidIdFunction(index, rowId, row) {
2002
1540
  console.debug(row);
2003
1541
  }
2004
1542
 
2005
- // src/yatl-table/yatl-table.styles.ts
2006
- import { css as css6 } from "lit";
2007
- var yatl_table_styles_default = css6`
2008
- :host {
2009
- /* Resize grab handle width */
2010
- --yatl-resizer-width: var(--yatl-table-resizer-width, 10px);
2011
- /* z-index for the header */
2012
- --header-z-index: 2;
1543
+ // src/table/table.styles.ts
1544
+ import { css } from "lit";
1545
+ var table_styles_default = css`
1546
+ @layer base, striped, hover, selected;
2013
1547
 
2014
- overflow: hidden;
2015
- border-radius: 6px;
2016
- }
1548
+ :host {
1549
+ --table-cell-padding: var(
1550
+ --yatl-table-cell-padding,
1551
+ var(--yatl-spacing-m) var(--yatl-spacing-m)
1552
+ );
1553
+ --table-header-padding: var(
1554
+ --yatl-table-header-padding,
1555
+ var(--yatl-spacing-m) var(--yatl-spacing-l)
1556
+ );
2017
1557
 
2018
- .scroller {
2019
- border: 1px solid var(--yatl-border-color);
2020
- background-color: var(--yatl-header-bg);
2021
- }
1558
+ --table-text: var(--yatl-table-text, var(--yatl-text-1));
1559
+ --table-bg: var(--yatl-table-bg, var(--yatl-surface-1));
1560
+ --table-radius: var(--yatl-table-radius, var(--yatl-radius-m));
1561
+ --table-border-width: var(--yatl-table-border-width, 1px);
1562
+ --table-border-color: var(
1563
+ --yatl-table-border-color,
1564
+ var(--yatl-border-color)
1565
+ );
2022
1566
 
2023
- .row {
2024
- background-color: var(--yatl-bg);
2025
- border-bottom: 1px solid var(--yatl-border-color);
2026
- transition: background-color 50ms;
2027
- position: relative;
2028
- }
1567
+ --table-header-text: var(--yatl-table-header-text, var(--yatl-text-1));
1568
+ --table-header-bg: var(
1569
+ --yatl-table-header-bg,
1570
+ color-mix(in srgb, var(--yatl-color-mix) 4%, var(--table-bg))
1571
+ );
1572
+ --table-header-hover-bg: var(
1573
+ --yatl-table-header-hover-bg,
1574
+ color-mix(in srgb, var(--yatl-color-mix) 4%, var(--table-header-bg))
1575
+ );
1576
+ --table-header-drop-bg: var(
1577
+ --yatl-table-header-drop-bg,
1578
+ color-mix(in srgb, var(--yatl-color-mix) 4%, var(--table-header-bg))
1579
+ );
2029
1580
 
2030
- .row.header-row {
2031
- background-color: var(--yatl-header-bg);
2032
- border-bottom: 1px solid var(--yatl-border-color);
2033
- font-weight: 600;
2034
- color: var(--yatl-header-text);
2035
- }
1581
+ --table-row-text: var(--yatl-table-row-text, var(--yatl-text-1));
1582
+ --table-row-bg: var(
1583
+ --yatl-table-row-bg,
1584
+ color-mix(in srgb, var(--yatl-color-mix) 2%, var(--table-bg))
1585
+ );
1586
+ --table-row-hover-bg: var(
1587
+ --yatl-table-row-hover-bg,
1588
+ var(--table-header-bg)
1589
+ );
1590
+ --table-row-stripe-bg: var(
1591
+ --yatl-table-row-stripe-bg,
1592
+ color-mix(in srbg, var(--yatl-color-mix) 3%, var(--table-bg))
1593
+ var(--table-header-bg)
1594
+ );
1595
+ --table-row-selected-bg: var(
1596
+ --yatl-table-row-selected-bg,
1597
+ color-mix(in srgb, var(--yatl-color-brand) 20%, transparent)
1598
+ );
1599
+ --table-footer-text: var(--yatl-table-footer-text, var(--yatl-text-3));
1600
+ --table-selector-color: var(
1601
+ --yatl-table-selector-color,
1602
+ color-mix(in srgb, var(--table-row-bg), var(--yatl-color-brand, black) 5%)
1603
+ );
2036
1604
 
2037
- .table:not(.resizing) .row {
2038
- transition: grid-template-columns var(--yatl-column-visibility-transition);
2039
- }
1605
+ --table-row-number-column-width: var(
1606
+ --yatl-table-row-number-column-width,
1607
+ 48px
1608
+ );
1609
+ --table-row-selector-column-width: var(
1610
+ --yatl-table-row-selector-column-width,
1611
+ 48px
1612
+ );
1613
+ --table-column-visibility-transition: var(
1614
+ --yatl-table-column-visibility-transition,
1615
+ 100ms
1616
+ );
2040
1617
 
2041
- .row:last-child {
2042
- border-bottom: none;
2043
- }
1618
+ /* Resize grab handle width */
1619
+ --resizer-width: var(--yatl-table-column-resizer-width, 10px);
2044
1620
 
2045
- /* Use after element for row and header hover */
2046
- .header.reorderable .cell::after,
2047
- .header .cell.sortable::after,
2048
- .row:not(.header)::after {
2049
- content: '';
2050
- position: absolute;
2051
- inset: 0;
2052
- pointer-events: none;
2053
- background-color: transparent;
2054
- transition: background-color 50ms;
2055
- z-index: 1;
1621
+ /* z-index for the header */
1622
+ --header-z-index: 2;
2056
1623
  }
2057
1624
 
2058
- .table:not(.resizing) .header .cell:hover::after,
2059
- .row:not(.header):hover::after {
2060
- background-color: var(--yatl-row-hover-bg);
2061
- }
1625
+ @layer base {
1626
+ .table {
1627
+ border-radius: var(--table-radius);
1628
+ background-color: var(--table-bg);
1629
+ border: var(--table-border-width) solid var(--table-border-color);
1630
+ }
2062
1631
 
2063
- .row:not(.header).selected::after {
2064
- background-color: var(--yatl-row-selected-bg);
2065
- }
1632
+ .row {
1633
+ position: relative;
1634
+ background-color: var(--table-row-bg);
1635
+ border-bottom: 1px solid var(--table-border-color);
1636
+ transition: background-color 50ms;
1637
+ }
2066
1638
 
2067
- .cell {
2068
- align-items: center;
2069
- padding: var(--yatl-cell-padding);
2070
- }
1639
+ .row.header-row {
1640
+ background-color: var(--table-header-bg);
1641
+ border-bottom: 1px solid var(--table-border-color);
1642
+ font-weight: 600;
1643
+ color: var(--table-header-text);
1644
+ }
2071
1645
 
2072
- .table.resizing * {
2073
- cursor: col-resize !important;
2074
- }
1646
+ .body .row {
1647
+ background-color: var(--table-row-bg);
1648
+ }
2075
1649
 
2076
- .header .cell {
2077
- padding: var(--yatl-header-padding);
2078
- }
1650
+ .row:last-child {
1651
+ border-bottom: none;
1652
+ }
2079
1653
 
2080
- .footer {
2081
- padding: 8px 12px;
2082
- background-color: var(--yatl-header-bg);
2083
- border-top: 1px solid var(--yatl-border-color);
2084
- color: var(--yatl-text-muted);
2085
- font-size: 0.8em;
2086
- }
1654
+ .table:not(.resizing) .row {
1655
+ transition: grid-template-columns
1656
+ var(--table-column-visibility-transition);
1657
+ }
2087
1658
 
2088
- .resizer::after {
2089
- height: 60%;
2090
- width: 1px;
2091
- background-color: color-mix(in srgb, currentColor 30%, transparent);
2092
- transition: background-color 0.2s;
2093
- }
1659
+ .cell {
1660
+ align-items: center;
1661
+ padding: var(--table-cell-padding);
1662
+ }
2094
1663
 
2095
- .resizer:hover::after {
2096
- background-color: currentColor;
2097
- width: 2px;
2098
- }
1664
+ .table.resizing * {
1665
+ cursor: col-resize !important;
1666
+ }
2099
1667
 
2100
- .row-number-cell {
2101
- background-color: var(--yatl-header-bg);
2102
- }
1668
+ .header .cell {
1669
+ padding: var(--table-header-padding);
1670
+ }
2103
1671
 
2104
- .row-checkbox {
2105
- width: 1.125rem;
2106
- height: 1.125rem;
1672
+ .footer {
1673
+ padding: 8px 12px;
1674
+ background-color: var(--table-header-bg);
1675
+ border-top: 1px solid var(--table-border-color);
1676
+ color: var(--table-footer-text);
1677
+ font-size: 0.8em;
1678
+ }
2107
1679
 
2108
- cursor: pointer;
2109
- margin: 0;
1680
+ .resizer::after {
1681
+ height: 60%;
1682
+ width: 1px;
1683
+ background-color: color-mix(in srgb, currentcolor 30%, transparent);
1684
+ transition: background-color 0.2s;
1685
+ }
2110
1686
 
2111
- accent-color: var(--yatl-brand-color, var(--yatl-text));
1687
+ .row-number-cell {
1688
+ background-color: var(--table-header-bg);
1689
+ }
2112
1690
 
2113
- transition: transform 0.1s ease-in-out;
1691
+ .message {
1692
+ font-size: large;
1693
+ }
2114
1694
  }
2115
1695
 
2116
- .row-checkbox:active {
2117
- transform: scale(0.9);
1696
+ @layer striped {
1697
+ :host([striped]) .body .row:nth-child(even) {
1698
+ background-color: var(--table-row-stripe-bg);
1699
+ }
2118
1700
  }
2119
1701
 
2120
- .drop-indicator {
2121
- background: var(--yatl-header-drop-bg);
1702
+ @layer hover {
1703
+ .table:not(.resizing) .header .cell:hover {
1704
+ background-color: var(--table-header-hover-bg);
1705
+ }
1706
+
1707
+ .body .row:hover {
1708
+ background-color: var(--table-row-hover-bg);
1709
+ }
1710
+
1711
+ .resizer:hover::after {
1712
+ background-color: currentcolor;
1713
+ width: 2px;
1714
+ }
1715
+
1716
+ .drop-indicator {
1717
+ background: var(--table-header-drop-bg);
1718
+ }
2122
1719
  }
2123
1720
 
2124
- .message {
2125
- font-size: large;
1721
+ @layer selected {
1722
+ /* Use after element to blend selection color */
1723
+ .body .row.selected::after {
1724
+ content: '';
1725
+ position: absolute;
1726
+ inset: 0;
1727
+ pointer-events: none;
1728
+ transition: background-color 50ms;
1729
+ z-index: 1;
1730
+ background-color: var(--table-row-selected-bg);
1731
+ }
2126
1732
  }
2127
1733
 
2128
1734
  /* Layout stuff
@@ -2130,19 +1736,21 @@ var yatl_table_styles_default = css6`
2130
1736
  * for the table to work properly.
2131
1737
  * Modify with caution!
2132
1738
  */
1739
+ /* stylelint-disable-next-line no-duplicate-selectors */
2133
1740
  :host {
2134
1741
  display: block;
2135
1742
  width: 100%;
2136
1743
  height: 100%;
2137
1744
  }
2138
1745
 
2139
- .wrapper {
1746
+ .table {
2140
1747
  display: flex;
2141
1748
  flex-direction: column;
2142
1749
  width: 100%;
2143
1750
  height: 100%;
2144
1751
  position: relative;
2145
1752
  overflow: hidden;
1753
+ box-sizing: border-box;
2146
1754
  }
2147
1755
 
2148
1756
  .scroller {
@@ -2152,14 +1760,9 @@ var yatl_table_styles_default = css6`
2152
1760
  height: 100%;
2153
1761
  }
2154
1762
 
2155
- .table {
2156
- box-sizing: border-box;
2157
- }
2158
-
2159
1763
  .body {
2160
1764
  min-width: 100%;
2161
1765
  width: fit-content;
2162
- min-height: 100%;
2163
1766
  height: fit-content;
2164
1767
  }
2165
1768
 
@@ -2212,7 +1815,7 @@ var yatl_table_styles_default = css6`
2212
1815
  top: 0;
2213
1816
  bottom: 0;
2214
1817
  right: 0;
2215
- width: var(--yatl-resizer-width);
1818
+ width: var(--resizer-width);
2216
1819
  cursor: col-resize;
2217
1820
  display: flex;
2218
1821
  justify-content: center;
@@ -2227,10 +1830,7 @@ var yatl_table_styles_default = css6`
2227
1830
  .drop-indicator {
2228
1831
  display: none;
2229
1832
  position: absolute;
2230
- top: 0;
2231
- left: 0;
2232
- right: 0;
2233
- bottom: 0;
1833
+ inset: 0;
2234
1834
  pointer-events: none;
2235
1835
  z-index: calc(var(--header-z-index) + 1);
2236
1836
  }
@@ -2249,7 +1849,6 @@ var yatl_table_styles_default = css6`
2249
1849
  align-items: center;
2250
1850
  justify-content: space-between;
2251
1851
  flex-shrink: 0;
2252
-
2253
1852
  position: sticky;
2254
1853
  bottom: 0;
2255
1854
  left: 0;
@@ -2261,6 +1860,7 @@ var yatl_table_styles_default = css6`
2261
1860
  .row {
2262
1861
  display: grid;
2263
1862
  grid-template-columns: var(--grid-template);
1863
+
2264
1864
  /* This is required! Don't remove it. */
2265
1865
  min-width: 100%;
2266
1866
  width: fit-content;
@@ -2296,7 +1896,7 @@ var yatl_table_styles_default = css6`
2296
1896
  flex-direction: row;
2297
1897
  align-items: center;
2298
1898
  justify-content: center;
2299
- padding: var(--yatl-cell-padding);
1899
+ padding: var(--table-cell-padding);
2300
1900
  height: 100%;
2301
1901
  width: 100%;
2302
1902
  box-sizing: border-box;
@@ -2319,33 +1919,49 @@ var yatl_table_styles_default = css6`
2319
1919
  }
2320
1920
  `;
2321
1921
 
2322
- // src/yatl-table/yatl-table.ts
2323
- var YatlTable = class extends LitElement5 {
1922
+ // src/table/table.ts
1923
+ var YatlTable = class extends LitElement {
2324
1924
  constructor() {
2325
1925
  super(...arguments);
2326
1926
  // #region --- State Data ---
2327
1927
  // Property data
2328
- // The last time the data was updated.
2329
- // For displaying in the footer only.
2330
- this.dataLastUpdate = null;
2331
1928
  this.resizeState = null;
2332
1929
  // Column drag & drop state
2333
1930
  this.dragColumn = null;
1931
+ this.useYatlUi = false;
2334
1932
  // #endregion
2335
1933
  // #region --- Properties ---
2336
1934
  this._controller = new YatlTableController(this);
2337
- this.sortable = false;
2338
- this.resizable = false;
1935
+ this.striped = true;
1936
+ this.sortable = true;
1937
+ this.resizable = true;
2339
1938
  this.enableVirtualScroll = false;
2340
1939
  this.enableSearchHighlight = true;
2341
1940
  this.enableColumnReorder = true;
2342
- this.enableRowNumberColumn = false;
2343
- this.enableFooter = false;
1941
+ this.enableRowNumberColumn = true;
1942
+ this.enableFooter = true;
2344
1943
  this.nullValuePlaceholder = "-";
2345
1944
  this.emptyMessage = "No records to display";
2346
1945
  this.noResultsMessage = "No matching records found";
2347
1946
  this.rowParts = null;
2348
1947
  // #endregion
1948
+ // #region Utilities
1949
+ this.eventNames = [
1950
+ "yatl-column-reorder",
1951
+ "yatl-column-resize",
1952
+ "yatl-column-sort",
1953
+ "yatl-column-toggle",
1954
+ "yatl-row-select",
1955
+ "yatl-table-search",
1956
+ "yatl-table-state-change",
1957
+ "yatl-table-view-change"
1958
+ ];
1959
+ this.redispatchControllerEvent = (event) => {
1960
+ if (event instanceof YatlEvent) {
1961
+ this.dispatchEvent(event.clone());
1962
+ }
1963
+ };
1964
+ // #endregion
2349
1965
  // #region --- Event Handlers ---
2350
1966
  this.handleHeaderClicked = (event, column) => {
2351
1967
  const cell = event.currentTarget;
@@ -2353,14 +1969,14 @@ var YatlTable = class extends LitElement5 {
2353
1969
  return;
2354
1970
  }
2355
1971
  const multiSort = event.shiftKey;
2356
- const state = this.getColumnState(column.field);
1972
+ const state2 = this.getColumnState(column.field);
2357
1973
  let sortOrder = null;
2358
- if (!state?.sort) {
1974
+ if (!state2?.sort) {
2359
1975
  sortOrder = "asc";
2360
- } else if (state.sort.order === "asc") {
1976
+ } else if (state2.sort.order === "asc") {
2361
1977
  sortOrder = "desc";
2362
1978
  }
2363
- const requestEvent = new YatlColumnSortRequestEvent(
1979
+ const requestEvent = new YatlColumnSortRequest(
2364
1980
  column.field,
2365
1981
  sortOrder,
2366
1982
  multiSort
@@ -2450,7 +2066,7 @@ var YatlTable = class extends LitElement5 {
2450
2066
  (col) => col.field === this.dragColumn
2451
2067
  );
2452
2068
  const newIndex = newColumns.findIndex((col) => col.field === field);
2453
- const requestEvent = new YatlColumnReorderRequestEvent(
2069
+ const requestEvent = new YatlColumnReorderRequest(
2454
2070
  this.dragColumn,
2455
2071
  originalIndex,
2456
2072
  newIndex
@@ -2470,7 +2086,7 @@ var YatlTable = class extends LitElement5 {
2470
2086
  const selected = inputElement.checked;
2471
2087
  const rowId = this.controller.getRowId(row);
2472
2088
  const selectedRows = this.selectedRowIds;
2473
- const requestEvent = new YatlRowSelectRequestEvent(
2089
+ const requestEvent = new YatlRowSelectRequest(
2474
2090
  rowId,
2475
2091
  selected,
2476
2092
  selectedRows
@@ -2488,11 +2104,15 @@ var YatlTable = class extends LitElement5 {
2488
2104
  if (this._controller === controller) {
2489
2105
  return;
2490
2106
  }
2491
- if (this._controller) {
2492
- this._controller.detach(this);
2107
+ const oldController = this._controller;
2108
+ if (this.isConnected) {
2109
+ this.removeControllerListeners(oldController);
2110
+ this.addControllerListeners(controller);
2493
2111
  }
2494
- this._controller = controller;
2112
+ oldController.detach(this);
2495
2113
  controller.attach(this);
2114
+ this._controller = controller;
2115
+ this.requestUpdate("controller", oldController);
2496
2116
  }
2497
2117
  get enableSearchTokenization() {
2498
2118
  return this.controller.enableSearchTokenization;
@@ -2545,9 +2165,9 @@ var YatlTable = class extends LitElement5 {
2545
2165
  set columnStates(states) {
2546
2166
  const oldValue = this.columnStates;
2547
2167
  let changed = false;
2548
- for (const state of states) {
2549
- const oldState = this.getColumnState(state.field);
2550
- const stateChanges = getColumnStateChanges(oldState, state);
2168
+ for (const state2 of states) {
2169
+ const oldState = this.getColumnState(state2.field);
2170
+ const stateChanges = getColumnStateChanges(oldState, state2);
2551
2171
  if (stateChanges.length) {
2552
2172
  changed = true;
2553
2173
  break;
@@ -2562,12 +2182,12 @@ var YatlTable = class extends LitElement5 {
2562
2182
  get searchQuery() {
2563
2183
  return this.controller.searchQuery;
2564
2184
  }
2565
- set searchQuery(query3) {
2185
+ set searchQuery(query2) {
2566
2186
  const oldValue = this.searchQuery;
2567
- if (oldValue === query3) {
2187
+ if (oldValue === query2) {
2568
2188
  return;
2569
2189
  }
2570
- this.controller.searchQuery = query3;
2190
+ this.controller.searchQuery = query2;
2571
2191
  this.requestUpdate("searchQuery", oldValue);
2572
2192
  }
2573
2193
  get searchTokenizer() {
@@ -2639,12 +2259,14 @@ var YatlTable = class extends LitElement5 {
2639
2259
  set data(value) {
2640
2260
  const oldValue = this.data;
2641
2261
  this.controller.data = value;
2642
- this.dataLastUpdate = /* @__PURE__ */ new Date();
2643
2262
  this.requestUpdate("data", oldValue);
2644
2263
  }
2645
2264
  get filteredData() {
2646
2265
  return this.controller.filteredData;
2647
2266
  }
2267
+ get dataUpdateTimestamp() {
2268
+ return this.controller.dataUpdateTimestamp;
2269
+ }
2648
2270
  // #endregion
2649
2271
  // #region --- Public Methods ---
2650
2272
  getColumn(field) {
@@ -2666,14 +2288,14 @@ var YatlTable = class extends LitElement5 {
2666
2288
  * Restores the table to the provided state.
2667
2289
  * @param state - The state to restore the table to.
2668
2290
  */
2669
- updateTableState(state) {
2670
- return this.controller.updateTableState(state);
2291
+ updateTableState(state2) {
2292
+ return this.controller.updateTableState(state2);
2671
2293
  }
2672
2294
  getColumnState(field) {
2673
2295
  return this.controller.getColumnState(field);
2674
2296
  }
2675
- updateColumnState(field, state) {
2676
- return this.controller.updateColumnState(field, state);
2297
+ updateColumnState(field, state2) {
2298
+ return this.controller.updateColumnState(field, state2);
2677
2299
  }
2678
2300
  /**
2679
2301
  * Sorts the table by a specified column and order.
@@ -2722,8 +2344,8 @@ var YatlTable = class extends LitElement5 {
2722
2344
  /**
2723
2345
  * Toggles the selection state of a specific row.
2724
2346
  */
2725
- toggleRowSelection(row, state) {
2726
- return this.controller.toggleRowSelection(row, state);
2347
+ toggleRowSelection(row, state2) {
2348
+ return this.controller.toggleRowSelection(row, state2);
2727
2349
  }
2728
2350
  /**
2729
2351
  * Selects a specific row.
@@ -2752,7 +2374,7 @@ var YatlTable = class extends LitElement5 {
2752
2374
  /**
2753
2375
  * Export the current visible table data to a CSV file.
2754
2376
  * @param filename - The name of the file to save.
2755
- * @param all - If `true`, exports all original data (ignoring filters). If `false` (default), exports only the currently visible (filtered and sorted) rows.
2377
+ * @param options - Options for configuring what should be exported.
2756
2378
  */
2757
2379
  export(filename, options = {
2758
2380
  includeAllRows: false,
@@ -2877,7 +2499,7 @@ var YatlTable = class extends LitElement5 {
2877
2499
  }
2878
2500
  /**
2879
2501
  * Deletes the row with the matching ID.
2880
- * @param id - The ID of the row to delete
2502
+ * @param rowIds - The IDs rows to delete
2881
2503
  */
2882
2504
  deleteRow(...rowIds) {
2883
2505
  return this.controller.deleteRow(...rowIds);
@@ -2891,18 +2513,18 @@ var YatlTable = class extends LitElement5 {
2891
2513
  }
2892
2514
  // #endregion
2893
2515
  // #region Render Methods
2894
- renderColumnSortIcon(column, state) {
2895
- return column.sortable ?? this.sortable ? html6`<div
2516
+ renderColumnSortIcon(column, state2) {
2517
+ return column.sortable ?? this.sortable ? html2`<div
2896
2518
  part="header-sort-icon"
2897
2519
  class=${classMap({
2898
2520
  "sort-icon": true,
2899
- ascending: state.sort?.order === "asc",
2900
- descending: state.sort?.order === "desc"
2521
+ ascending: state2.sort?.order === "asc",
2522
+ descending: state2.sort?.order === "desc"
2901
2523
  })}
2902
2524
  ></div>` : nothing;
2903
2525
  }
2904
2526
  renderColumnResizer(column, _state) {
2905
- return column.resizable ?? this.resizable ? html6`
2527
+ return column.resizable ?? this.resizable ? html2`
2906
2528
  <div
2907
2529
  part="header-resizer"
2908
2530
  class="resizer"
@@ -2915,18 +2537,18 @@ var YatlTable = class extends LitElement5 {
2915
2537
  if (!column) {
2916
2538
  return nothing;
2917
2539
  }
2918
- const state = this.getColumnState(column.field);
2540
+ const state2 = this.getColumnState(column.field);
2919
2541
  const title = column.title ?? column.field;
2920
2542
  let ariaSort = "none";
2921
- if (state.sort?.order === "asc") ariaSort = "ascending";
2922
- if (state.sort?.order === "desc") ariaSort = "descending";
2923
- const role = state.visible ? "columnheader" : void 0;
2924
- const hidden = state.visible ? false : void 0;
2543
+ if (state2.sort?.order === "asc") ariaSort = "ascending";
2544
+ if (state2.sort?.order === "desc") ariaSort = "descending";
2545
+ const role = state2.visible ? "columnheader" : void 0;
2546
+ const hidden = state2.visible ? false : void 0;
2925
2547
  const classes = {
2926
2548
  cell: true,
2927
2549
  sortable: column.sortable ?? this.sortable
2928
2550
  };
2929
- return this.renderCellWrapper(html6`
2551
+ return this.renderCellWrapper(html2`
2930
2552
  <div
2931
2553
  role=${ifDefined(role)}
2932
2554
  aria-hidden=${ifDefined(hidden)}
@@ -2948,21 +2570,21 @@ var YatlTable = class extends LitElement5 {
2948
2570
  <span class="header-title truncate" part="header-title">
2949
2571
  ${title}
2950
2572
  </span>
2951
- ${this.renderColumnSortIcon(column, state)}
2573
+ ${this.renderColumnSortIcon(column, state2)}
2952
2574
  </div>
2953
- ${this.renderColumnResizer(column, state)}
2575
+ ${this.renderColumnResizer(column, state2)}
2954
2576
  <div part="drop-indicator" class="drop-indicator"></div>
2955
2577
  </div>
2956
2578
  `);
2957
2579
  }
2958
2580
  renderRowNumberHeader() {
2959
2581
  return this.renderCellWrapper(
2960
- html6`<div part="cell-index" class="cell-index"></div>`
2582
+ html2`<div part="cell-index" class="cell-index"></div>`
2961
2583
  );
2962
2584
  }
2963
2585
  renderSelectionHeader() {
2964
2586
  return this.renderCellWrapper(
2965
- html6`<div part="cell-selector" class="cell-selector"></div>`
2587
+ html2`<div part="cell-selector" class="cell-selector"></div>`
2966
2588
  );
2967
2589
  }
2968
2590
  renderHeader() {
@@ -2970,7 +2592,7 @@ var YatlTable = class extends LitElement5 {
2970
2592
  header: true,
2971
2593
  reorderable: this.enableColumnReorder
2972
2594
  };
2973
- return html6`
2595
+ return html2`
2974
2596
  <div role="rowgroup" part="header" class=${classMap(classes)}>
2975
2597
  <div role="row" class="row header-row" part="row header-row">
2976
2598
  ${this.renderRowNumberHeader()} ${this.renderSelectionHeader()}
@@ -2998,7 +2620,7 @@ var YatlTable = class extends LitElement5 {
2998
2620
  if (typeof column.valueFormatter === "function") {
2999
2621
  value = column.valueFormatter(value, row);
3000
2622
  }
3001
- return this.renderCellWrapper(html6`
2623
+ return this.renderCellWrapper(html2`
3002
2624
  <div
3003
2625
  role="cell"
3004
2626
  part="cell body-cell cell-${column.field} ${userParts}"
@@ -3013,25 +2635,31 @@ var YatlTable = class extends LitElement5 {
3013
2635
  </div>
3014
2636
  `);
3015
2637
  }
2638
+ renderCheckbox(row, selected) {
2639
+ return this.useYatlUi ? html2`<yatl-checkbox
2640
+ part="row-checkbox"
2641
+ class="row-checkbox"
2642
+ .checked=${selected}
2643
+ @change=${(event) => this.handleRowSelectionClicked(event, row)}
2644
+ ></yatl-checkbox>` : html2`<input
2645
+ part="row-checkbox"
2646
+ class="row-checkbox"
2647
+ type="checkbox"
2648
+ .checked=${selected}
2649
+ @change=${(event) => this.handleRowSelectionClicked(event, row)}
2650
+ />`;
2651
+ }
3016
2652
  renderRowSelectorCell(row, selected) {
3017
- return this.renderCellWrapper(html6`
2653
+ return this.renderCellWrapper(html2`
3018
2654
  <div part="cell body-cell" class="cell body-cell">
3019
2655
  <div part="row-selector-cell" class="row-selector-cell">
3020
- <label>
3021
- <input
3022
- part="row-checkbox"
3023
- class="row-checkbox"
3024
- type="checkbox"
3025
- .checked=${selected}
3026
- @change=${(event) => this.handleRowSelectionClicked(event, row)}
3027
- />
3028
- </label>
2656
+ <label> ${this.renderCheckbox(row, selected)} </label>
3029
2657
  </div>
3030
2658
  </div>
3031
2659
  `);
3032
2660
  }
3033
2661
  renderRowNumberCell(rowNumber) {
3034
- return this.renderCellWrapper(html6`
2662
+ return this.renderCellWrapper(html2`
3035
2663
  <div part="cell body-cell" class="cell body-cell">
3036
2664
  <div part="row-number-cell" class="row-number-cell">${rowNumber}</div>
3037
2665
  </div>
@@ -3045,7 +2673,7 @@ var YatlTable = class extends LitElement5 {
3045
2673
  }
3046
2674
  const classes = { row: true, selected };
3047
2675
  const rowIndex = renderIndex + 1;
3048
- return html6`
2676
+ return html2`
3049
2677
  <div
3050
2678
  role="row"
3051
2679
  aria-rowindex=${rowIndex}
@@ -3061,22 +2689,22 @@ var YatlTable = class extends LitElement5 {
3061
2689
  }
3062
2690
  renderBodyContents() {
3063
2691
  if (!this.hasVisibleColumn()) {
3064
- return html6`
2692
+ return html2`
3065
2693
  <div part="message" class="message">No visible columns.</div>
3066
2694
  `;
3067
2695
  }
3068
2696
  if (this.data.length === 0) {
3069
- return html6`
2697
+ return html2`
3070
2698
  <div part="message" class="message">${this.emptyMessage}</div>
3071
2699
  `;
3072
2700
  }
3073
2701
  if (this.filteredData.length === 0) {
3074
- return html6`
2702
+ return html2`
3075
2703
  <div part="message" class="message">${this.noResultsMessage}</div>
3076
2704
  `;
3077
2705
  }
3078
2706
  if (this.enableVirtualScroll) {
3079
- return html6`
2707
+ return html2`
3080
2708
  <lit-virtualizer
3081
2709
  .items=${this.filteredData}
3082
2710
  .renderItem=${(item, index) => this.renderRow(item, index)}
@@ -3084,7 +2712,7 @@ var YatlTable = class extends LitElement5 {
3084
2712
  </lit-virtualizer>
3085
2713
  `;
3086
2714
  }
3087
- return html6`
2715
+ return html2`
3088
2716
  ${repeat(
3089
2717
  this.filteredData,
3090
2718
  (item) => this.controller.getRowId(item),
@@ -3106,8 +2734,8 @@ var YatlTable = class extends LitElement5 {
3106
2734
  dateStyle: "short",
3107
2735
  timeStyle: "short"
3108
2736
  });
3109
- const lastUpdateText = this.dataLastUpdate ? formatter.format(this.dataLastUpdate) : "Never";
3110
- return html6`
2737
+ const lastUpdateText = this.dataUpdateTimestamp ? formatter.format(this.dataUpdateTimestamp) : "Never";
2738
+ return html2`
3111
2739
  <div part="footer" class="footer">
3112
2740
  <slot name="footer">
3113
2741
  <span part="row-count">${rowCountText}</span>
@@ -3121,21 +2749,19 @@ var YatlTable = class extends LitElement5 {
3121
2749
  const style = {
3122
2750
  "--grid-template": gridTemplate
3123
2751
  };
3124
- return html6`
3125
- <div class="wrapper">
2752
+ return html2`
2753
+ <div
2754
+ role="table"
2755
+ aria-label="Data Table"
2756
+ aria-rowcount=${this.filteredData.length}
2757
+ part="table"
2758
+ class="table"
2759
+ style=${styleMap(style)}
2760
+ >
3126
2761
  <div class="scroller">
3127
- <div
3128
- role="table"
3129
- aria-label="Data Table"
3130
- aria-rowcount=${this.filteredData.length}
3131
- part="table"
3132
- class="table"
3133
- style=${styleMap(style)}
3134
- >
3135
- ${this.renderHeader()}
3136
- <div class="body" role="rowgroup">
3137
- <slot name="body">${this.renderBodyContents()}</slot>
3138
- </div>
2762
+ ${this.renderHeader()}
2763
+ <div class="body" role="rowgroup">
2764
+ <slot name="body">${this.renderBodyContents()}</slot>
3139
2765
  </div>
3140
2766
  </div>
3141
2767
  ${this.renderFooter()}
@@ -3143,19 +2769,37 @@ var YatlTable = class extends LitElement5 {
3143
2769
  `;
3144
2770
  }
3145
2771
  renderCellWrapper(content) {
3146
- return html6` <div class="cell-wrapper">${content}</div> `;
2772
+ return html2` <div class="cell-wrapper">${content}</div> `;
3147
2773
  }
3148
2774
  // #endregion
3149
2775
  // #region --- Lifecycle Methods ---
2776
+ connectedCallback() {
2777
+ super.connectedCallback();
2778
+ this.addControllerListeners(this.controller);
2779
+ if (!this.useYatlUi) {
2780
+ customElements.whenDefined("yatl-checkbox").then(() => {
2781
+ this.useYatlUi = true;
2782
+ });
2783
+ }
2784
+ }
3150
2785
  disconnectedCallback() {
3151
2786
  super.disconnectedCallback();
2787
+ this.removeControllerListeners(this.controller);
3152
2788
  window.addEventListener("mousemove", this.handleResizeMouseMove);
3153
2789
  window.addEventListener("mouseup", this.handleResizeMouseUp);
3154
2790
  }
3155
- // #endregion
3156
- // #region Utilities
2791
+ addControllerListeners(controller) {
2792
+ for (const name of this.eventNames) {
2793
+ controller.addEventListener(name, this.redispatchControllerEvent);
2794
+ }
2795
+ }
2796
+ removeControllerListeners(controller) {
2797
+ for (const name of this.eventNames) {
2798
+ controller.removeEventListener(name, this.redispatchControllerEvent);
2799
+ }
2800
+ }
3157
2801
  hasVisibleColumn() {
3158
- return this.displayColumns.map((column) => this.getColumnState(column.field)).filter((state) => state.visible).length > 0;
2802
+ return this.displayColumns.map((column) => this.getColumnState(column.field)).filter((state2) => state2.visible).length > 0;
3159
2803
  }
3160
2804
  /**
3161
2805
  * Gets the width of each column in the
@@ -3174,11 +2818,11 @@ var YatlTable = class extends LitElement5 {
3174
2818
  widths.push("0");
3175
2819
  }
3176
2820
  for (const column of this.displayColumns) {
3177
- const state = this.getColumnState(column.field);
3178
- const hasPixelWidth = state.width != null;
3179
- if (state.visible) {
2821
+ const state2 = this.getColumnState(column.field);
2822
+ const hasPixelWidth = state2.width != null;
2823
+ if (state2.visible) {
3180
2824
  if (hasPixelWidth) {
3181
- widths.push(`${state.width}px`);
2825
+ widths.push(`${state2.width}px`);
3182
2826
  } else {
3183
2827
  widths.push("minmax(0, 1fr)");
3184
2828
  }
@@ -3200,25 +2844,19 @@ var YatlTable = class extends LitElement5 {
3200
2844
  if (!header) {
3201
2845
  return;
3202
2846
  }
3203
- let columnIndex = this.displayColumns.findIndex(
2847
+ const columnIndex = this.displayColumns.findIndex(
3204
2848
  (column) => column.field === field
3205
2849
  );
3206
2850
  if (columnIndex < 0) {
3207
2851
  return;
3208
2852
  }
3209
- if (this.enableRowNumberColumn) {
3210
- columnIndex++;
3211
- }
3212
- if (this.rowSelectionMethod) {
3213
- columnIndex++;
3214
- }
3215
2853
  this.tableElement.classList.add("resizing");
3216
2854
  this.tableElement.querySelectorAll(".header .cell").forEach((element) => {
3217
2855
  const field2 = element.dataset.field;
3218
2856
  if (field2) {
3219
- const state = this.getColumnState(field2);
3220
- state.width = element.getBoundingClientRect().width;
3221
- this.updateColumnState(field2, state);
2857
+ const state2 = this.getColumnState(field2);
2858
+ state2.width = element.getBoundingClientRect().width;
2859
+ this.updateColumnState(field2, state2);
3222
2860
  }
3223
2861
  });
3224
2862
  const gridWidths = this.getGridWidths();
@@ -3226,7 +2864,8 @@ var YatlTable = class extends LitElement5 {
3226
2864
  active: true,
3227
2865
  startX: event.pageX,
3228
2866
  startWidth: header.getBoundingClientRect().width,
3229
- columnIndex,
2867
+ columnIndex: columnIndex + 2,
2868
+ // row number column + selector column
3230
2869
  columnField: field,
3231
2870
  currentWidths: gridWidths
3232
2871
  };
@@ -3239,359 +2878,122 @@ var YatlTable = class extends LitElement5 {
3239
2878
  }
3240
2879
  // #endregion
3241
2880
  };
3242
- YatlTable.styles = [theme_default, yatl_table_styles_default];
2881
+ YatlTable.styles = [table_styles_default];
3243
2882
  __decorateClass([
3244
- query2(".table")
2883
+ query(".table")
3245
2884
  ], YatlTable.prototype, "tableElement", 2);
3246
2885
  __decorateClass([
3247
- query2("lit-virtualizer")
2886
+ query("lit-virtualizer")
3248
2887
  ], YatlTable.prototype, "virtualizer", 2);
3249
2888
  __decorateClass([
3250
- property4({ attribute: false })
2889
+ state()
2890
+ ], YatlTable.prototype, "useYatlUi", 2);
2891
+ __decorateClass([
2892
+ property({ attribute: false })
3251
2893
  ], YatlTable.prototype, "controller", 1);
3252
2894
  __decorateClass([
3253
- property4({ type: Boolean, attribute: "sortable" })
2895
+ property({ type: Boolean, reflect: true })
2896
+ ], YatlTable.prototype, "striped", 2);
2897
+ __decorateClass([
2898
+ property({ type: Boolean, attribute: "sortable" })
3254
2899
  ], YatlTable.prototype, "sortable", 2);
3255
2900
  __decorateClass([
3256
- property4({ type: Boolean, attribute: "resizable" })
2901
+ property({ type: Boolean, attribute: "resizable" })
3257
2902
  ], YatlTable.prototype, "resizable", 2);
3258
2903
  __decorateClass([
3259
- property4({ type: Boolean, attribute: "enable-virtual-scroll" })
2904
+ property({ type: Boolean, attribute: "enable-virtual-scroll" })
3260
2905
  ], YatlTable.prototype, "enableVirtualScroll", 2);
3261
2906
  __decorateClass([
3262
- property4({ type: Boolean, attribute: "enable-search-highlight" })
2907
+ property({ type: Boolean, attribute: "enable-search-highlight" })
3263
2908
  ], YatlTable.prototype, "enableSearchHighlight", 2);
3264
2909
  __decorateClass([
3265
- property4({ type: Boolean, attribute: "enable-search-tokenization" })
2910
+ property({ type: Boolean, attribute: "enable-search-tokenization" })
3266
2911
  ], YatlTable.prototype, "enableSearchTokenization", 1);
3267
2912
  __decorateClass([
3268
- property4({ type: Boolean, attribute: "enable-search-scoring" })
2913
+ property({ type: Boolean, attribute: "enable-search-scoring" })
3269
2914
  ], YatlTable.prototype, "enableSearchScoring", 1);
3270
2915
  __decorateClass([
3271
- property4({ type: Boolean, attribute: "enable-column-reorder" })
2916
+ property({ type: Boolean, attribute: "enable-column-reorder" })
3272
2917
  ], YatlTable.prototype, "enableColumnReorder", 2);
3273
2918
  __decorateClass([
3274
- property4({ type: Boolean })
2919
+ property({ type: Boolean })
3275
2920
  ], YatlTable.prototype, "enableRowNumberColumn", 2);
3276
2921
  __decorateClass([
3277
- property4({ type: Boolean, attribute: "enable-footer" })
2922
+ property({ type: Boolean, attribute: "enable-footer" })
3278
2923
  ], YatlTable.prototype, "enableFooter", 2);
3279
2924
  __decorateClass([
3280
- property4({ type: String, attribute: "null-value-placeholder" })
2925
+ property({ type: String, attribute: "null-value-placeholder" })
3281
2926
  ], YatlTable.prototype, "nullValuePlaceholder", 2);
3282
2927
  __decorateClass([
3283
- property4({ type: String, attribute: "empty-message" })
2928
+ property({ type: String, attribute: "empty-message" })
3284
2929
  ], YatlTable.prototype, "emptyMessage", 2);
3285
2930
  __decorateClass([
3286
- property4({ type: String, attribute: "no-results-message" })
2931
+ property({ type: String, attribute: "no-results-message" })
3287
2932
  ], YatlTable.prototype, "noResultsMessage", 2);
3288
2933
  __decorateClass([
3289
- property4({ attribute: false })
2934
+ property({ attribute: false })
3290
2935
  ], YatlTable.prototype, "columns", 1);
3291
2936
  __decorateClass([
3292
- property4({ attribute: false })
2937
+ property({ attribute: false })
3293
2938
  ], YatlTable.prototype, "columnStates", 1);
3294
2939
  __decorateClass([
3295
- property4({ type: String, attribute: "search-query" })
2940
+ property({ type: String, attribute: "search-query" })
3296
2941
  ], YatlTable.prototype, "searchQuery", 1);
3297
2942
  __decorateClass([
3298
- property4({ attribute: false })
2943
+ property({ attribute: false })
3299
2944
  ], YatlTable.prototype, "searchTokenizer", 1);
3300
2945
  __decorateClass([
3301
- property4({ attribute: false })
2946
+ property({ attribute: false })
3302
2947
  ], YatlTable.prototype, "filters", 1);
3303
2948
  __decorateClass([
3304
- property4({ attribute: false })
2949
+ property({ attribute: false })
3305
2950
  ], YatlTable.prototype, "rowParts", 2);
3306
2951
  __decorateClass([
3307
- property4({ type: String })
2952
+ property({ type: String })
3308
2953
  ], YatlTable.prototype, "rowSelectionMethod", 1);
3309
2954
  __decorateClass([
3310
- property4({ attribute: false })
2955
+ property({ attribute: false })
3311
2956
  ], YatlTable.prototype, "selectedRowIds", 1);
3312
2957
  __decorateClass([
3313
- property4({ type: Object, attribute: "storage-options" })
2958
+ property({ type: Object, attribute: "storage-options" })
3314
2959
  ], YatlTable.prototype, "storageOptions", 1);
3315
2960
  __decorateClass([
3316
- property4({ attribute: false })
2961
+ property({ attribute: false })
3317
2962
  ], YatlTable.prototype, "rowIdCallback", 1);
3318
2963
  __decorateClass([
3319
- property4({ attribute: false })
2964
+ property({ attribute: false })
3320
2965
  ], YatlTable.prototype, "data", 1);
3321
2966
  YatlTable = __decorateClass([
3322
- customElement5("yatl-table")
2967
+ customElement("yatl-table")
3323
2968
  ], YatlTable);
3324
-
3325
- // src/yatl-table-ui/yatl-table-ui.ts
3326
- import { html as html7 } from "lit";
3327
- import { customElement as customElement6, property as property5 } from "lit/decorators.js";
3328
-
3329
- // src/yatl-table-ui/yatl-table-ui.styles.ts
3330
- import { css as css7 } from "lit";
3331
- var yatl_table_ui_styles_default = css7`
3332
- :host {
3333
- border-radius: 0;
3334
- }
3335
-
3336
- .ui-wrapper {
3337
- display: flex;
3338
- flex-direction: column;
3339
- gap: var(--yatl-spacing-m);
3340
- height: 100%;
3341
- width: 100%;
3342
- }
3343
-
3344
- .wrapper {
3345
- border-radius: var(--yatl-table-radius);
3346
- }
3347
- `;
3348
-
3349
- // src/yatl-table-ui/yatl-table-ui.ts
3350
- var YatlTableUi = class extends YatlTable {
3351
- constructor() {
3352
- super(...arguments);
3353
- this.showColumnPicker = true;
3354
- this.showExportButton = true;
3355
- this.handleTableExportClicked = () => {
3356
- this.export(document.title);
3357
- };
3358
- }
3359
- render() {
3360
- return html7`
3361
- <div class="ui-wrapper">
3362
- <yatl-toolbar
3363
- ?showColumnPicker=${this.showColumnPicker}
3364
- ?showExportButton=${this.showExportButton}
3365
- .controller=${this.controller}
3366
- @yatl-toolbar-export-click=${this.handleTableExportClicked}
3367
- ><slot name="toolbar-button-group" slot="button-group"></slot
3368
- ><slot name="toolbar"></slot
3369
- ></yatl-toolbar>
3370
- ${super.render()}
3371
- </div>
3372
- `;
3373
- }
3374
- };
3375
- YatlTableUi.styles = [...YatlTable.styles, yatl_table_ui_styles_default];
3376
- __decorateClass([
3377
- property5({ type: Boolean })
3378
- ], YatlTableUi.prototype, "showColumnPicker", 2);
3379
- __decorateClass([
3380
- property5({ type: Boolean })
3381
- ], YatlTableUi.prototype, "showExportButton", 2);
3382
- YatlTableUi = __decorateClass([
3383
- customElement6("yatl-table-ui")
3384
- ], YatlTableUi);
3385
-
3386
- // src/yatl-toolbar/yatl-toolbar.ts
3387
- import { html as html8, LitElement as LitElement6, nothing as nothing2 } from "lit";
3388
- import { customElement as customElement7, property as property6 } from "lit/decorators.js";
3389
- import { repeat as repeat2 } from "lit/directives/repeat.js";
3390
-
3391
- // src/yatl-toolbar/yatl-toolbar.styles.ts
3392
- import { css as css8 } from "lit";
3393
- var yatl_toolbar_styles_default = css8`
3394
- :host {
3395
- box-sizing: border-box;
3396
- }
3397
-
3398
- .toolbar {
3399
- display: flex;
3400
- flex-direction: row;
3401
- gap: 10px;
3402
- }
3403
-
3404
- .search {
3405
- flex-grow: 1;
3406
- border-radius: var(--yatl-input-radius);
3407
- background-color: var(--bg-subtle);
3408
- line-height: 1;
3409
- border: none;
3410
- font-size: large;
3411
- padding: var(--yatl-input-padding);
3412
- }
3413
-
3414
- .search:focus,
3415
- .search:focus-visible {
3416
- outline: 3px solid var(--yatl-brand-color);
3417
- outline-offset: -3px;
3418
- }
3419
-
3420
- yatl-button-group yatl-button {
3421
- height: 100%;
3422
- }
3423
- `;
3424
-
3425
- // src/yatl-toolbar/yatl-toolbar.ts
3426
- import { ifDefined as ifDefined2 } from "lit/directives/if-defined.js";
3427
- var YatlToolbar = class extends LitElement6 {
3428
- constructor() {
3429
- super(...arguments);
3430
- this.showColumnPicker = true;
3431
- this.showExportButton = true;
3432
- this.handleDropdownToggle = (event) => {
3433
- this.controller?.toggleColumnVisibility(
3434
- event.value,
3435
- event.checked
3436
- );
3437
- };
3438
- this.onSearchInput = (event) => {
3439
- const input = event.currentTarget;
3440
- this.controller?.search(input.value);
3441
- this.dispatchEvent(new YatlToolbarSearchInput(input.value));
3442
- };
3443
- this.onSearchChange = (event) => {
3444
- const input = event.currentTarget;
3445
- this.dispatchEvent(new YatlToolbarSearchChange(input.value));
3446
- };
3447
- this.onExportClick = (_event) => {
3448
- this.dispatchEvent(new YatlToolbarExportClick());
3449
- };
3450
- }
3451
- get controller() {
3452
- return this._controller;
3453
- }
3454
- set controller(controller) {
3455
- if (this._controller === controller) {
3456
- return;
3457
- }
3458
- this._controller = controller;
3459
- controller?.attach(this);
3460
- }
3461
- render() {
3462
- return html8`
3463
- <div class="toolbar">
3464
- <input
3465
- part="search"
3466
- class="search"
3467
- type="search"
3468
- placeholder="Search"
3469
- value=${ifDefined2(this.controller?.searchQuery)}
3470
- @input=${this.onSearchInput}
3471
- @change=${this.onSearchChange}
3472
- />
3473
- <yatl-button-group>
3474
- ${this.showColumnPicker ? this.renderColumnPicker() : nothing2}
3475
- ${this.showExportButton ? this.renderExportButton() : nothing2}
3476
- <slot name="button-group"></slot>
3477
- </yatl-button-group>
3478
- <slot></slot>
3479
- </div>
3480
- `;
3481
- }
3482
- renderColumnPicker() {
3483
- return html8`
3484
- <yatl-dropdown
3485
- part="column-picker"
3486
- @yatl-dropdown-toggle=${this.handleDropdownToggle}
3487
- >
3488
- <yatl-button
3489
- part="column-picker-trigger"
3490
- slot="trigger"
3491
- title="Show/hide columns"
3492
- >
3493
- <svg
3494
- width="20"
3495
- height="20"
3496
- viewBox="0 0 24 24"
3497
- fill="none"
3498
- stroke="currentColor"
3499
- stroke-width="2"
3500
- >
3501
- <path
3502
- d="M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18"
3503
- />
3504
- </svg>
3505
- </yatl-button>
3506
- ${repeat2(
3507
- this.controller?.displayColumns ?? [],
3508
- (s) => s.field,
3509
- (s) => this.renderColumnVisibilityToggle(s)
3510
- )}
3511
- </yatl-dropdown>
3512
- `;
3513
- }
3514
- renderColumnVisibilityToggle(column) {
3515
- const state = this.controller.getColumnState(column.field);
3516
- return html8`
3517
- <yatl-dropdown-item
3518
- part="column-picker-item"
3519
- .checked=${state.visible}
3520
- .value=${state.field}
3521
- >${column.title}</yatl-dropdown-item
3522
- >
3523
- `;
3524
- }
3525
- renderExportButton() {
3526
- return html8`
3527
- <yatl-button type="button" @click=${this.onExportClick}>
3528
- <svg
3529
- xmlns="http://www.w3.org/2000/svg"
3530
- width="20"
3531
- height="20"
3532
- viewBox="0 0 24 24"
3533
- fill="none"
3534
- stroke="currentColor"
3535
- stroke-width="2"
3536
- stroke-linecap="round"
3537
- stroke-linejoin="round"
3538
- >
3539
- <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
3540
- <polyline points="7 10 12 15 17 10"></polyline>
3541
- <line x1="12" y1="15" x2="12" y2="3"></line>
3542
- </svg>
3543
- </yatl-button>
3544
- `;
3545
- }
3546
- };
3547
- YatlToolbar.styles = [theme_default, yatl_toolbar_styles_default];
3548
- __decorateClass([
3549
- property6({ attribute: false })
3550
- ], YatlToolbar.prototype, "controller", 1);
3551
- __decorateClass([
3552
- property6({ type: Boolean })
3553
- ], YatlToolbar.prototype, "showColumnPicker", 2);
3554
- __decorateClass([
3555
- property6({ type: Boolean })
3556
- ], YatlToolbar.prototype, "showExportButton", 2);
3557
- YatlToolbar = __decorateClass([
3558
- customElement7("yatl-toolbar")
3559
- ], YatlToolbar);
3560
-
3561
- // src/index.ts
3562
- import { html as html9, svg, nothing as nothing3, noChange } from "lit";
3563
- import { unsafeHTML } from "lit/directives/unsafe-html.js";
3564
2969
  export {
3565
- YatlButton,
3566
- YatlButtonGroup,
2970
+ TypedEventTarget,
3567
2971
  YatlColumnReorderEvent,
3568
- YatlColumnReorderRequestEvent,
2972
+ YatlColumnReorderRequest,
3569
2973
  YatlColumnResizeEvent,
3570
2974
  YatlColumnSortEvent,
3571
- YatlColumnSortRequestEvent,
2975
+ YatlColumnSortRequest,
3572
2976
  YatlColumnToggleEvent,
3573
- YatlColumnToggleRequestEvent,
3574
- YatlDropdown,
3575
- YatlDropdownItem,
3576
- YatlDropdownToggleEvent,
2977
+ YatlColumnToggleRequest,
3577
2978
  YatlEvent,
3578
2979
  YatlRowClickEvent,
3579
2980
  YatlRowSelectEvent,
3580
- YatlRowSelectRequestEvent,
2981
+ YatlRowSelectRequest,
3581
2982
  YatlTable,
3582
2983
  YatlTableController,
3583
2984
  YatlTableSearchEvent,
3584
2985
  YatlTableStateChangeEvent,
3585
- YatlTableUi,
3586
2986
  YatlTableViewChangeEvent,
3587
- YatlToolbar,
3588
- YatlToolbarExportClick,
3589
- YatlToolbarSearchChange,
3590
- YatlToolbarSearchInput,
3591
- html9 as html,
3592
- noChange,
3593
- nothing3 as nothing,
3594
- svg,
3595
- unsafeHTML
2987
+ createRegexTokenizer,
2988
+ createState,
2989
+ findColumn,
2990
+ getColumnStateChanges,
2991
+ getNestedValue,
2992
+ isDisplayColumn,
2993
+ isInternalColumn,
2994
+ isRowIdType,
2995
+ isRowSelectionMethod,
2996
+ setNestedValue,
2997
+ whitespaceTokenizer
3596
2998
  };
3597
2999
  //# sourceMappingURL=index.mjs.map