@ship-ui/core 0.22.11 → 0.22.14

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.
@@ -1,7 +1,10 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
1
2
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Renderer2, input, HostListener, Directive, computed, output, model, viewChild, signal, DestroyRef, effect, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
3
- import { ShipProgressBar } from '@ship-ui/core/ship-progress-bar';
3
+ import { inject, ElementRef, Renderer2, input, signal, HostListener, Directive, computed, output, model, contentChild, viewChild, DestroyRef, effect, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
4
4
  import { shipComponentClasses, observeChildren } from '@ship-ui/core';
5
+ import { ShipChip } from '@ship-ui/core/ship-chip';
6
+ import { ShipIcon } from '@ship-ui/core/ship-icon';
7
+ import { ShipProgressBar } from '@ship-ui/core/ship-progress-bar';
5
8
 
6
9
  class ShipResize {
7
10
  constructor() {
@@ -14,6 +17,8 @@ class ShipResize {
14
17
  ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
15
18
  this.maxWidth = input(null, /* @ts-ignore */
16
19
  ...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
20
+ this.resizingClass = signal(false, /* @ts-ignore */
21
+ ...(ngDevMode ? [{ debugName: "resizingClass" }] : /* istanbul ignore next */ []));
17
22
  this.#resizing = false;
18
23
  this.#animationFrameRequest = null; // Store request ID
19
24
  }
@@ -44,11 +49,15 @@ class ShipResize {
44
49
  onMouseUp(event) {
45
50
  if (this.#resizing) {
46
51
  this.#resizing = false;
47
- this.#table.resizing.set(false);
52
+ this.resizingClass.set(false);
48
53
  if (this.#animationFrameRequest !== null) {
49
54
  cancelAnimationFrame(this.#animationFrameRequest);
50
55
  this.#animationFrameRequest = null;
51
56
  }
57
+ // Delay resetting the table's resizing state to block sorting clicks immediately after resizing
58
+ setTimeout(() => {
59
+ this.#table.resizing.set(false);
60
+ }, 50);
52
61
  }
53
62
  }
54
63
  onClick(event) {
@@ -62,6 +71,7 @@ class ShipResize {
62
71
  return;
63
72
  this.#table.resizing.set(true);
64
73
  this.#resizing = true;
74
+ this.resizingClass.set(true);
65
75
  this.#startX = event.pageX;
66
76
  this.#startWidth = this.#el.nativeElement.offsetWidth;
67
77
  }
@@ -86,13 +96,16 @@ class ShipResize {
86
96
  }
87
97
  }
88
98
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipResize, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
89
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.0", type: ShipResize, isStandalone: true, selector: "[shResize]", inputs: { resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:mousemove": "onMouseMove($event)", "document:mouseup": "onMouseUp($event)", "document:click": "onClick($event)" } }, ngImport: i0 }); }
99
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.0", type: ShipResize, isStandalone: true, selector: "[shResize]", inputs: { resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:mousemove": "onMouseMove($event)", "document:mouseup": "onMouseUp($event)", "document:click": "onClick($event)" }, properties: { "class.resizing": "resizingClass()" } }, ngImport: i0 }); }
90
100
  }
91
101
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipResize, decorators: [{
92
102
  type: Directive,
93
103
  args: [{
94
104
  selector: '[shResize]',
95
105
  standalone: true,
106
+ host: {
107
+ '[class.resizing]': 'resizingClass()',
108
+ },
96
109
  }]
97
110
  }], propDecorators: { resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], onMouseMove: [{
98
111
  type: HostListener,
@@ -125,16 +138,30 @@ class ShipSort {
125
138
  return currentSort === `-${thisColumn}`;
126
139
  }, /* @ts-ignore */
127
140
  ...(ngDevMode ? [{ debugName: "sortDesc" }] : /* istanbul ignore next */ []));
141
+ this.ariaSort = computed(() => {
142
+ if (this.sortAsc())
143
+ return 'ascending';
144
+ if (this.sortDesc())
145
+ return 'descending';
146
+ return 'none';
147
+ }, /* @ts-ignore */
148
+ ...(ngDevMode ? [{ debugName: "ariaSort" }] : /* istanbul ignore next */ []));
128
149
  }
129
150
  #table;
130
- toggleSort() {
151
+ toggleSort(event) {
152
+ if (event) {
153
+ event.preventDefault();
154
+ }
155
+ if (this.#table.resizing()) {
156
+ return;
157
+ }
131
158
  const sortCol = this.shSort();
132
159
  if (!sortCol)
133
160
  return;
134
161
  this.#table.toggleSort(sortCol);
135
162
  }
136
163
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipSort, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
137
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.0", type: ShipSort, isStandalone: true, selector: "[shSort]", inputs: { shSort: { classPropertyName: "shSort", publicName: "shSort", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mousedown": "toggleSort()" }, properties: { "class.sort-asc": "sortAsc()", "class.sort-desc": "sortDesc()" }, classAttribute: "sortable" }, ngImport: i0 }); }
164
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.0", type: ShipSort, isStandalone: true, selector: "[shSort]", inputs: { shSort: { classPropertyName: "shSort", publicName: "shSort", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "columnheader" }, listeners: { "click": "shSort() ? toggleSort() : null", "keydown.enter": "shSort() ? toggleSort() : null", "keydown.space": "shSort() ? toggleSort($event) : null" }, properties: { "class.sortable": "!!shSort()", "attr.tabindex": "shSort() ? \"0\" : null", "attr.aria-sort": "shSort() ? ariaSort() : null", "class.sort-asc": "sortAsc()", "class.sort-desc": "sortDesc()" } }, ngImport: i0 }); }
138
165
  }
139
166
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipSort, decorators: [{
140
167
  type: Directive,
@@ -142,8 +169,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
142
169
  selector: '[shSort]',
143
170
  standalone: true,
144
171
  host: {
145
- class: 'sortable',
146
- '(mousedown)': 'toggleSort()',
172
+ role: 'columnheader',
173
+ '[class.sortable]': '!!shSort()',
174
+ '[attr.tabindex]': 'shSort() ? "0" : null',
175
+ '(click)': 'shSort() ? toggleSort() : null',
176
+ '(keydown.enter)': 'shSort() ? toggleSort() : null',
177
+ '(keydown.space)': 'shSort() ? toggleSort($event) : null',
178
+ '[attr.aria-sort]': 'shSort() ? ariaSort() : null',
147
179
  '[class.sort-asc]': 'sortAsc()',
148
180
  '[class.sort-desc]': 'sortDesc()',
149
181
  },
@@ -198,13 +230,21 @@ class ShipTable {
198
230
  ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
199
231
  this.variant = input(null, /* @ts-ignore */
200
232
  ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
233
+ this.ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
234
+ this.ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
201
235
  this.hostClasses = shipComponentClasses('table', {
202
236
  color: this.color,
203
237
  variant: this.variant,
204
238
  });
205
- this.thead = viewChild('thead', /* @ts-ignore */
239
+ this.content = contentChild(ShipTableContent, /* @ts-ignore */
240
+ ...(ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []));
241
+ this.theadLocal = viewChild('theadLocal', /* @ts-ignore */
242
+ ...(ngDevMode ? [{ debugName: "theadLocal" }] : /* istanbul ignore next */ []));
243
+ this.tbodyLocal = viewChild('tbodyLocal', /* @ts-ignore */
244
+ ...(ngDevMode ? [{ debugName: "tbodyLocal" }] : /* istanbul ignore next */ []));
245
+ this.thead = computed(() => this.content()?.thead() || this.theadLocal(), /* @ts-ignore */
206
246
  ...(ngDevMode ? [{ debugName: "thead" }] : /* istanbul ignore next */ []));
207
- this.tbody = viewChild('tbody', /* @ts-ignore */
247
+ this.tbody = computed(() => this.content()?.tbody() || this.tbodyLocal(), /* @ts-ignore */
208
248
  ...(ngDevMode ? [{ debugName: "tbody" }] : /* istanbul ignore next */ []));
209
249
  this.columns = observeChildren(this.thead, ['tr:first-child th']);
210
250
  this.stickyHeaderHeight = signal(0, /* @ts-ignore */
@@ -294,17 +334,46 @@ class ShipTable {
294
334
  const column = sortByColumn.startsWith('-') ? sortByColumn.slice(1) : sortByColumn;
295
335
  const isDescending = sortByColumn.startsWith('-');
296
336
  const sortedData = this.data().sort((a, b) => {
337
+ const colConfig = this.content()
338
+ ?.columns()
339
+ ?.find((c) => c.id === column);
340
+ if (colConfig?.sortPredicate) {
341
+ const predicateResult = colConfig.sortPredicate(a, b);
342
+ return isDescending ? -predicateResult : predicateResult;
343
+ }
297
344
  const valueA = a[column];
298
345
  const valueB = b[column];
299
346
  let comparison = 0;
300
- if (typeof valueA === 'number' && typeof valueB === 'number') {
301
- comparison = valueA - valueB;
347
+ if (colConfig?.type === 'date') {
348
+ const dateA = valueA ? new Date(valueA).getTime() : 0;
349
+ const dateB = valueB ? new Date(valueB).getTime() : 0;
350
+ comparison = dateA - dateB;
351
+ }
352
+ else if (colConfig?.type === 'number') {
353
+ const numA = Number(valueA) || 0;
354
+ const numB = Number(valueB) || 0;
355
+ comparison = numA - numB;
302
356
  }
303
- if (valueA instanceof Date && valueB instanceof Date) {
304
- comparison = valueA.getTime() - valueB.getTime();
357
+ else if (colConfig?.type === 'boolean') {
358
+ const boolA = valueA ? 1 : 0;
359
+ const boolB = valueB ? 1 : 0;
360
+ comparison = boolA - boolB;
305
361
  }
306
- if (typeof valueA === 'string' && typeof valueB === 'string') {
307
- comparison = valueA.localeCompare(valueB, undefined, { sensitivity: 'base' });
362
+ else if (colConfig?.type === 'string' || colConfig?.type === 'badge') {
363
+ const strA = (valueA ?? '').toString();
364
+ const strB = (valueB ?? '').toString();
365
+ comparison = strA.localeCompare(strB, undefined, { sensitivity: 'base' });
366
+ }
367
+ else {
368
+ if (typeof valueA === 'number' && typeof valueB === 'number') {
369
+ comparison = valueA - valueB;
370
+ }
371
+ else if (valueA instanceof Date && valueB instanceof Date) {
372
+ comparison = valueA.getTime() - valueB.getTime();
373
+ }
374
+ else if (typeof valueA === 'string' && typeof valueB === 'string') {
375
+ comparison = valueA.localeCompare(valueB, undefined, { sensitivity: 'base' });
376
+ }
308
377
  }
309
378
  return isDescending ? -comparison : comparison;
310
379
  });
@@ -367,7 +436,7 @@ class ShipTable {
367
436
  this.canScrollY.set(canScrollY);
368
437
  }
369
438
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipTable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
370
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: ShipTable, isStandalone: true, selector: "sh-table", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, sortByColumn: { classPropertyName: "sortByColumn", publicName: "sortByColumn", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dataChange: "dataChange", sortByColumn: "sortByColumnChange" }, host: { listeners: { "scroll": "onScroll()", "window:resize": "onResize($event)" }, properties: { "class": "hostClasses()", "style.grid-template-columns": "columnSizes()", "class.resizing": "resizing()", "class.can-scroll-x": "canScrollX()", "class.can-scroll-y": "canScrollY()", "class.scrolled-x": "scrollXState() >= 0", "class.scrolled-x-end": "scrollXState() === 1", "class.scrolled-y": "scrollYState() >= 0", "class.scrolled-y-end": "scrollYState() === 1" } }, viewQueries: [{ propertyName: "thead", first: true, predicate: ["thead"], descendants: true, isSignal: true }, { propertyName: "tbody", first: true, predicate: ["tbody"], descendants: true, isSignal: true }], ngImport: i0, template: `
439
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: ShipTable, isStandalone: true, selector: "sh-table", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, sortByColumn: { classPropertyName: "sortByColumn", publicName: "sortByColumn", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dataChange: "dataChange", sortByColumn: "sortByColumnChange" }, host: { attributes: { "role": "table" }, listeners: { "scroll": "onScroll()", "window:resize": "onResize($event)" }, properties: { "attr.aria-busy": "loading()", "attr.aria-label": "ariaLabel()", "attr.aria-labelledby": "ariaLabelledby()", "class": "hostClasses()", "style.grid-template-columns": "columnSizes()", "class.resizing": "resizing()", "class.can-scroll-x": "canScrollX()", "class.can-scroll-y": "canScrollY()", "class.scrolled-x": "scrollXState() >= 0", "class.scrolled-x-end": "scrollXState() === 1", "class.scrolled-y": "scrollYState() >= 0", "class.scrolled-y-end": "scrollYState() === 1" } }, queries: [{ propertyName: "content", first: true, predicate: ShipTableContent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "theadLocal", first: true, predicate: ["theadLocal"], descendants: true, isSignal: true }, { propertyName: "tbodyLocal", first: true, predicate: ["tbodyLocal"], descendants: true, isSignal: true }], ngImport: i0, template: `
371
440
  <div class="actionbar">
372
441
  <ng-content select="[actionbar]:not([align-right])" />
373
442
  <div class="actionbar-right">
@@ -379,21 +448,25 @@ class ShipTable {
379
448
  <sh-progress-bar class="indeterminate primary" />
380
449
  }
381
450
 
382
- <thead #thead>
383
- <ng-content select="th" />
384
- <ng-content select="[thead]" />
385
- </thead>
451
+ <ng-content select="sh-table-content" />
386
452
 
387
- <tbody #tbody>
388
- <ng-content />
389
- </tbody>
453
+ @if (!content()) {
454
+ <thead #theadLocal role="rowgroup">
455
+ <ng-content select="th" />
456
+ <ng-content select="[thead]" />
457
+ </thead>
458
+
459
+ <tbody #tbodyLocal role="rowgroup">
460
+ <ng-content />
461
+ </tbody>
462
+ }
390
463
 
391
464
  @if (!loading()) {
392
465
  <div class="no-rows">
393
466
  <ng-content select="[table-no-rows]" />
394
467
  </div>
395
468
  }
396
- `, isInline: true, styles: ["sh-table{--table-bc: var(--base-4);--table-th-bg: var(--base-2);--table-tr-bg: var(--base-1);--table-td-bg: var(--base-1);--table-th-c: var(--base-8);--table-th-f: var(--paragraph-30);--table-td-c: var(--base-8);--table-td-f: var(--paragraph-30);--table-th-p: 0 1.25rem;--table-td-p: 0 1.25rem;--table-th-mh: 3rem;--table-td-mh: 4.875rem;--table-th-g: .25rem;--table-td-g: .5rem;--table-ws: nowrap;--table-th-bw: 0;--table-td-bw: .0625rem 0 0;--table-columns: 1fr 1fr 1fr max-content;--table-sticky-bw: .0625rem}sh-table.type-a tbody>th,sh-table.type-a tbody>td,sh-table.type-a thead>th,sh-table.type-a thead>td{padding-right:0}sh-table.type-a tbody>th:first-child,sh-table.type-a tbody>td:first-child,sh-table.type-a thead>th:first-child,sh-table.type-a thead>td:first-child{padding:0}sh-table.type-b{--table-th-p: 0 .75rem;--table-td-p: 0 .75rem;--table-th-mh: 2.25rem;--table-td-mh: 3.5rem;--table-th-bw: .0625rem 0 .0625rem .0625rem;--table-td-bw: 0 0 .0625rem .0625rem;--table-sticky-bw: .0625rem}sh-table.type-b th:first-child{border-left-width:0;padding:var(--table-th-p)}sh-table.type-b td:first-child{border-left-width:0;padding:var(--table-td-p)}sh-table.type-b td.sticky,sh-table.type-b th.sticky{border-left-width:0;border-right:var(--table-sticky-bw) solid var(--table-bc)}sh-table.type-b [shStickyColumns] th,sh-table.type-b [shStickyColumns] td{border-right:var(--table-sticky-bw) solid var(--table-bc)}sh-table.type-b th.sticky-end,sh-table.type-b td.sticky-end,sh-table.type-b [shStickyColumns=end] th,sh-table.type-b [shStickyColumns=end] td{border-left:var(--table-sticky-bw) solid var(--table-bc);border-right:0}sh-table.type-b .sticky+th,sh-table.type-b .sticky+td,sh-table.type-b [shStickyColumns]+th,sh-table.type-b [shStickyColumns]+td{border-left-width:0}sh-table.type-b tr:hover td{background-color:var(--base-2)}sh-table.type-b div[table-header] tr:first-child th{border-bottom:0}sh-table.type-b tbody tr:last-child td{border-bottom-width:0}sh-table.type-b .actionbar{background-color:var(--base-2);border-width:.0625rem 0 0}sh-table{width:100%;display:grid;overflow:auto;overscroll-behavior-x:none;grid-template-columns:var(--table-columns);position:relative;container-type:inline-size}sh-table.resizing{-webkit-user-select:none;user-select:none}sh-table:has([shTableResize]) td{overflow:auto}sh-table.no-resize .sh-resizer{display:none}sh-table.no-resize td{overflow:initial}sh-table .actionbar{display:flex;align-items:center;gap:.5rem;grid-column:1/-1;position:sticky;left:0;z-index:10;background-color:var(--base-1);width:100cqw;box-sizing:border-box;padding:.5rem;border:var(--border-10);border-width:.0625rem 0;opacity:1;transition:padding .3s ease-out,border-width .3s ease-out,opacity .3s ease-out;overflow:hidden}sh-table .actionbar:empty,sh-table .actionbar:not(:has(>:not(.actionbar-right))):has(>.actionbar-right:empty){display:none}sh-table .actionbar>*{min-height:0}sh-table .actionbar .actionbar-right{display:flex;align-items:center;gap:.5rem;margin-left:auto;flex-shrink:0}sh-table .actionbar .actionbar-right:empty{display:none}sh-table tbody{position:relative}sh-table tbody:has(tr.sticky){position:sticky;top:0;z-index:1}sh-table thead{position:relative}sh-table thead:has(tr.sticky){position:sticky;top:0;z-index:2}sh-table sh-progress-bar{grid-column:1/-1;position:absolute;top:100%;transform:translateY(-50%);z-index:200}sh-table tbody,sh-table thead,sh-table tr{display:grid;grid-column:1/-1;grid-template-columns:subgrid}sh-table tr{background:var(--table-tr-bg);position:relative;z-index:0}sh-table tr.sticky{position:sticky;top:0;z-index:1}sh-table tr.sticky-end{position:sticky;bottom:0;z-index:3}sh-table tr:has(th.sticky-end) th:nth-last-child(2){padding:var(--table-th-p)}sh-table tr:has(td.sticky-end) td:nth-last-child(2){padding:var(--table-td-p)}sh-table th{display:flex;align-items:center;padding:var(--table-th-p);min-height:var(--table-th-mh);font:var(--table-th-f);line-height:1em;white-space:var(--table-ws);color:var(--table-th-c);border:0;border-color:var(--table-bc);border-style:solid;border-width:var(--table-th-bw);background:var(--table-th-bg);gap:var(--table-th-g);z-index:100}sh-table th:has(.sh-resizer){position:relative}sh-table th.sortable{--caret-color: var(--base-10);--caret-size: .375rem;cursor:pointer;-webkit-user-select:none;user-select:none}sh-table th.sortable sh-icon{opacity:.35;transition:opacity 125ms ease-in-out}sh-table th.sortable:hover sh-icon{opacity:.7}sh-table th.sortable.sort-asc sh-icon,sh-table th.sortable.sort-desc sh-icon{opacity:1}sh-table th.sortable:not(:has(sh-icon)):after{content:\"\";border:var(--caret-size) solid transparent;width:0;height:0;opacity:0;transition:opacity 125ms ease-in-out}sh-table th.sortable:not(:has(sh-icon)).sort-desc:after{opacity:1;transform:translateY(-4px);border-bottom-color:var(--caret-color)}sh-table th.sortable:not(:has(sh-icon)).sort-asc:after{opacity:1;transform:translateY(4px);border-top-color:var(--caret-color)}sh-table th .sh-resizer{width:10px;height:100%;position:absolute;top:0;right:0;cursor:col-resize}sh-table th .sh-resizer:before,sh-table th .sh-resizer:after{content:\"\";position:absolute;top:50%;transform:translateY(-50%);height:.75rem;right:.1875rem;width:.0625rem;background-color:var(--base-4)}sh-table th .sh-resizer:hover:before,sh-table th .sh-resizer:hover:after{background-color:var(--primary-8)}sh-table th .sh-resizer:before{left:.1875rem}sh-table td{display:flex;align-items:center;padding:var(--table-td-p);min-height:var(--table-td-mh);gap:var(--table-td-g);color:var(--table-td-c);font:var(--table-td-f);white-space:var(--table-ws);border-color:var(--table-bc);border-style:solid;border-width:var(--table-td-bw);background:var(--table-td-bg)}sh-table td+td.sticky-end:last-child{padding:var(--table-td-p)}sh-table th.sticky,sh-table th.sticky-end,sh-table td.sticky,sh-table td.sticky-end{position:sticky;overflow:hidden;right:auto;left:0;z-index:1;padding:var(--table-td-p)}sh-table th.sticky:first-child,sh-table th.sticky-end:first-child,sh-table td.sticky:first-child,sh-table td.sticky-end:first-child{padding:var(--table-th-p)}sh-table th.sticky-end,sh-table td.sticky-end{right:0;left:auto}sh-table th.sticky,sh-table th.sticky-end{background:var(--base-1);padding:var(--table-th-p);z-index:101}sh-table th.sticky:first-child,sh-table th.sticky-end:first-child{padding:var(--table-th-p)}sh-table [shStickyColumns]{display:grid;grid-template-columns:subgrid;position:sticky;left:0;z-index:1000;border:0;border-color:var(--table-bc);border-style:solid}sh-table [shStickyColumns] th{background-color:var(--base-1)}sh-table [shStickyColumns=end]{left:auto;right:0}sh-table .span-all{grid-column:1/-1;white-space:initial;align-items:flex-start;padding:0;border-left-width:0;position:sticky;left:0;width:100cqw;box-sizing:border-box}sh-table .no-rows{display:none;grid-column:1/-1}sh-table tbody:empty+.no-rows{display:block}\n"], dependencies: [{ kind: "component", type: ShipProgressBar, selector: "sh-progress-bar", inputs: ["value", "color", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
469
+ `, isInline: true, styles: ["sh-table{--table-bc: var(--base-4);--table-th-bg: var(--base-2);--table-tr-bg: var(--base-1);--table-td-bg: var(--base-1);--table-th-c: var(--base-8);--table-th-f: var(--paragraph-30);--table-td-c: var(--base-8);--table-td-f: var(--paragraph-30);--table-th-p: 0 1.25rem;--table-td-p: 0 1.25rem;--table-th-mh: 3rem;--table-td-mh: 4.875rem;--table-th-g: .25rem;--table-td-g: .5rem;--table-ws: nowrap;--table-th-bw: 0;--table-td-bw: .0625rem 0 0;--table-columns: 1fr 1fr 1fr max-content;--table-sticky-bw: .0625rem}sh-table.type-a tbody>th,sh-table.type-a tbody>td,sh-table.type-a thead>th,sh-table.type-a thead>td{padding-right:0}sh-table.type-a tbody>th:first-child,sh-table.type-a tbody>td:first-child,sh-table.type-a thead>th:first-child,sh-table.type-a thead>td:first-child{padding:0}sh-table.type-b{--table-th-p: 0 .75rem;--table-td-p: 0 .75rem;--table-th-mh: 2.25rem;--table-td-mh: 3.5rem;--table-th-bw: .0625rem 0 .0625rem .0625rem;--table-td-bw: 0 0 .0625rem .0625rem;--table-sticky-bw: .0625rem}sh-table.type-b th:first-child{border-left-width:0;padding:var(--table-th-p)}sh-table.type-b td:first-child{border-left-width:0;padding:var(--table-td-p)}sh-table.type-b td.sticky,sh-table.type-b th.sticky{border-left-width:0;border-right:var(--table-sticky-bw) solid var(--table-bc)}sh-table.type-b [shStickyColumns] th,sh-table.type-b [shStickyColumns] td{border-right:var(--table-sticky-bw) solid var(--table-bc)}sh-table.type-b th.sticky-end,sh-table.type-b td.sticky-end,sh-table.type-b [shStickyColumns=end] th,sh-table.type-b [shStickyColumns=end] td{border-left:var(--table-sticky-bw) solid var(--table-bc);border-right:0}sh-table.type-b .sticky+th,sh-table.type-b .sticky+td,sh-table.type-b [shStickyColumns]+th,sh-table.type-b [shStickyColumns]+td{border-left-width:0}sh-table.type-b tr:hover td{background-color:var(--base-2)}sh-table.type-b div[table-header] tr:first-child th{border-bottom:0}sh-table.type-b tbody tr:last-child td{border-bottom-width:0}sh-table.type-b .actionbar{background-color:var(--base-2);border-width:.0625rem 0 0}sh-table{width:100%;display:grid;overflow:auto;overscroll-behavior-x:none;grid-template-columns:var(--table-columns);position:relative;container-type:inline-size}sh-table.resizing{-webkit-user-select:none;user-select:none}sh-table:has([shTableResize]) td{overflow:auto}sh-table.no-resize .sh-resizer{display:none}sh-table.no-resize td{overflow:initial}sh-table .actionbar{display:flex;align-items:center;gap:.5rem;grid-column:1/-1;position:sticky;left:0;z-index:10;background-color:var(--base-1);width:100cqw;box-sizing:border-box;padding:.5rem;border:var(--border-10);border-width:.0625rem 0;opacity:1;transition:padding .3s ease-out,border-width .3s ease-out,opacity .3s ease-out;overflow:hidden}sh-table .actionbar:empty,sh-table .actionbar:not(:has(>:not(.actionbar-right))):has(>.actionbar-right:empty){display:none}sh-table .actionbar>*{min-height:0}sh-table .actionbar .actionbar-right{display:flex;align-items:center;gap:.5rem;margin-left:auto;flex-shrink:0}sh-table .actionbar .actionbar-right:empty{display:none}sh-table tbody{position:relative}sh-table tbody:has(tr.sticky){position:sticky;top:0;z-index:1}sh-table thead{position:relative}sh-table thead:has(tr.sticky){position:sticky;top:0;z-index:2}sh-table sh-progress-bar{grid-column:1/-1;position:absolute;top:100%;transform:translateY(-50%);z-index:200}sh-table tbody,sh-table thead,sh-table tr{display:grid;grid-column:1/-1;grid-template-columns:subgrid}sh-table tr{background:var(--table-tr-bg);position:relative;z-index:0}sh-table tr.sticky{position:sticky;top:0;z-index:1}sh-table tr.sticky-end{position:sticky;bottom:0;z-index:3}sh-table tr:has(th.sticky-end) th:nth-last-child(2){padding:var(--table-th-p)}sh-table tr:has(td.sticky-end) td:nth-last-child(2){padding:var(--table-td-p)}sh-table th{display:flex;align-items:center;padding:var(--table-th-p);min-height:var(--table-th-mh);font:var(--table-th-f);line-height:1em;white-space:var(--table-ws);color:var(--table-th-c);border:0;border-color:var(--table-bc);border-style:solid;border-width:var(--table-th-bw);background:var(--table-th-bg);gap:var(--table-th-g);z-index:auto}sh-table th:hover,sh-table th.resizing{z-index:120}sh-table th:has(.sh-resizer){position:relative}sh-table th.sortable{--caret-color: var(--base-10);--caret-size: .375rem;cursor:pointer;-webkit-user-select:none;user-select:none}sh-table th.sortable sh-icon{opacity:.35;transition:opacity 125ms ease-in-out}sh-table th.sortable:hover sh-icon{opacity:.7}sh-table th.sortable.sort-asc sh-icon,sh-table th.sortable.sort-desc sh-icon{opacity:1}sh-table th.sortable:not(:has(sh-icon)):after{content:\"\";border:var(--caret-size) solid transparent;width:0;height:0;opacity:0;transition:opacity 125ms ease-in-out}sh-table th.sortable:not(:has(sh-icon)).sort-desc:after{opacity:1;transform:translateY(-4px);border-bottom-color:var(--caret-color)}sh-table th.sortable:not(:has(sh-icon)).sort-asc:after{opacity:1;transform:translateY(4px);border-top-color:var(--caret-color)}sh-table th .sh-resizer{width:.75rem;height:100%;position:absolute;top:0;right:-.375rem;cursor:col-resize;z-index:110}sh-table th .sh-resizer:after{content:\"\";position:absolute;top:.3125rem;bottom:.3125rem;border-radius:.125rem;right:.3125rem;width:.1875rem;background-color:var(--base-4);transition:width .15s ease,background-color .15s ease,right .15s ease}sh-table th .sh-resizer:hover:after{width:.3125rem;right:.1875rem;background-color:var(--primary-8)}sh-table th.resizing .sh-resizer:after{width:.3125rem;right:.1875rem;background-color:var(--primary-8)}sh-table td{display:flex;align-items:center;padding:var(--table-td-p);min-height:var(--table-td-mh);gap:var(--table-td-g);color:var(--table-td-c);font:var(--table-td-f);white-space:var(--table-ws);border-color:var(--table-bc);border-style:solid;border-width:var(--table-td-bw);background:var(--table-td-bg)}sh-table td+td.sticky-end:last-child{padding:var(--table-td-p)}sh-table th.sticky,sh-table th.sticky-end,sh-table td.sticky,sh-table td.sticky-end{position:sticky;overflow:hidden;right:auto;left:0;z-index:1;padding:var(--table-td-p)}sh-table th.sticky:first-child,sh-table th.sticky-end:first-child,sh-table td.sticky:first-child,sh-table td.sticky-end:first-child{padding:var(--table-th-p)}sh-table th.sticky-end,sh-table td.sticky-end{right:0;left:auto}sh-table th.sticky,sh-table th.sticky-end{background:var(--base-1);padding:var(--table-th-p);z-index:101}sh-table th.sticky:first-child,sh-table th.sticky-end:first-child{padding:var(--table-th-p)}sh-table [shStickyColumns]{display:grid;grid-template-columns:subgrid;position:sticky;left:0;z-index:1000;border:0;border-color:var(--table-bc);border-style:solid}sh-table [shStickyColumns] th{background-color:var(--base-1)}sh-table [shStickyColumns=end]{left:auto;right:0}sh-table .span-all{grid-column:1/-1;white-space:initial;align-items:flex-start;padding:0;border-left-width:0;position:sticky;left:0;width:100cqw;box-sizing:border-box}sh-table .no-rows{display:none;grid-column:1/-1}sh-table tbody:empty+.no-rows{display:block}\n"], dependencies: [{ kind: "component", type: ShipProgressBar, selector: "sh-progress-bar", inputs: ["value", "color", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
397
470
  }
398
471
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipTable, decorators: [{
399
472
  type: Component,
@@ -409,14 +482,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
409
482
  <sh-progress-bar class="indeterminate primary" />
410
483
  }
411
484
 
412
- <thead #thead>
413
- <ng-content select="th" />
414
- <ng-content select="[thead]" />
415
- </thead>
485
+ <ng-content select="sh-table-content" />
416
486
 
417
- <tbody #tbody>
418
- <ng-content />
419
- </tbody>
487
+ @if (!content()) {
488
+ <thead #theadLocal role="rowgroup">
489
+ <ng-content select="th" />
490
+ <ng-content select="[thead]" />
491
+ </thead>
492
+
493
+ <tbody #tbodyLocal role="rowgroup">
494
+ <ng-content />
495
+ </tbody>
496
+ }
420
497
 
421
498
  @if (!loading()) {
422
499
  <div class="no-rows">
@@ -424,6 +501,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
424
501
  </div>
425
502
  }
426
503
  `, changeDetection: ChangeDetectionStrategy.OnPush, host: {
504
+ role: 'table',
505
+ '[attr.aria-busy]': 'loading()',
506
+ '[attr.aria-label]': 'ariaLabel()',
507
+ '[attr.aria-labelledby]': 'ariaLabelledby()',
427
508
  '[class]': 'hostClasses()',
428
509
  '[style.grid-template-columns]': 'columnSizes()',
429
510
  '[class.resizing]': 'resizing()',
@@ -434,15 +515,250 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
434
515
  '[class.scrolled-x-end]': 'scrollXState() === 1',
435
516
  '[class.scrolled-y]': 'scrollYState() >= 0',
436
517
  '[class.scrolled-y-end]': 'scrollYState() === 1',
437
- }, styles: ["sh-table{--table-bc: var(--base-4);--table-th-bg: var(--base-2);--table-tr-bg: var(--base-1);--table-td-bg: var(--base-1);--table-th-c: var(--base-8);--table-th-f: var(--paragraph-30);--table-td-c: var(--base-8);--table-td-f: var(--paragraph-30);--table-th-p: 0 1.25rem;--table-td-p: 0 1.25rem;--table-th-mh: 3rem;--table-td-mh: 4.875rem;--table-th-g: .25rem;--table-td-g: .5rem;--table-ws: nowrap;--table-th-bw: 0;--table-td-bw: .0625rem 0 0;--table-columns: 1fr 1fr 1fr max-content;--table-sticky-bw: .0625rem}sh-table.type-a tbody>th,sh-table.type-a tbody>td,sh-table.type-a thead>th,sh-table.type-a thead>td{padding-right:0}sh-table.type-a tbody>th:first-child,sh-table.type-a tbody>td:first-child,sh-table.type-a thead>th:first-child,sh-table.type-a thead>td:first-child{padding:0}sh-table.type-b{--table-th-p: 0 .75rem;--table-td-p: 0 .75rem;--table-th-mh: 2.25rem;--table-td-mh: 3.5rem;--table-th-bw: .0625rem 0 .0625rem .0625rem;--table-td-bw: 0 0 .0625rem .0625rem;--table-sticky-bw: .0625rem}sh-table.type-b th:first-child{border-left-width:0;padding:var(--table-th-p)}sh-table.type-b td:first-child{border-left-width:0;padding:var(--table-td-p)}sh-table.type-b td.sticky,sh-table.type-b th.sticky{border-left-width:0;border-right:var(--table-sticky-bw) solid var(--table-bc)}sh-table.type-b [shStickyColumns] th,sh-table.type-b [shStickyColumns] td{border-right:var(--table-sticky-bw) solid var(--table-bc)}sh-table.type-b th.sticky-end,sh-table.type-b td.sticky-end,sh-table.type-b [shStickyColumns=end] th,sh-table.type-b [shStickyColumns=end] td{border-left:var(--table-sticky-bw) solid var(--table-bc);border-right:0}sh-table.type-b .sticky+th,sh-table.type-b .sticky+td,sh-table.type-b [shStickyColumns]+th,sh-table.type-b [shStickyColumns]+td{border-left-width:0}sh-table.type-b tr:hover td{background-color:var(--base-2)}sh-table.type-b div[table-header] tr:first-child th{border-bottom:0}sh-table.type-b tbody tr:last-child td{border-bottom-width:0}sh-table.type-b .actionbar{background-color:var(--base-2);border-width:.0625rem 0 0}sh-table{width:100%;display:grid;overflow:auto;overscroll-behavior-x:none;grid-template-columns:var(--table-columns);position:relative;container-type:inline-size}sh-table.resizing{-webkit-user-select:none;user-select:none}sh-table:has([shTableResize]) td{overflow:auto}sh-table.no-resize .sh-resizer{display:none}sh-table.no-resize td{overflow:initial}sh-table .actionbar{display:flex;align-items:center;gap:.5rem;grid-column:1/-1;position:sticky;left:0;z-index:10;background-color:var(--base-1);width:100cqw;box-sizing:border-box;padding:.5rem;border:var(--border-10);border-width:.0625rem 0;opacity:1;transition:padding .3s ease-out,border-width .3s ease-out,opacity .3s ease-out;overflow:hidden}sh-table .actionbar:empty,sh-table .actionbar:not(:has(>:not(.actionbar-right))):has(>.actionbar-right:empty){display:none}sh-table .actionbar>*{min-height:0}sh-table .actionbar .actionbar-right{display:flex;align-items:center;gap:.5rem;margin-left:auto;flex-shrink:0}sh-table .actionbar .actionbar-right:empty{display:none}sh-table tbody{position:relative}sh-table tbody:has(tr.sticky){position:sticky;top:0;z-index:1}sh-table thead{position:relative}sh-table thead:has(tr.sticky){position:sticky;top:0;z-index:2}sh-table sh-progress-bar{grid-column:1/-1;position:absolute;top:100%;transform:translateY(-50%);z-index:200}sh-table tbody,sh-table thead,sh-table tr{display:grid;grid-column:1/-1;grid-template-columns:subgrid}sh-table tr{background:var(--table-tr-bg);position:relative;z-index:0}sh-table tr.sticky{position:sticky;top:0;z-index:1}sh-table tr.sticky-end{position:sticky;bottom:0;z-index:3}sh-table tr:has(th.sticky-end) th:nth-last-child(2){padding:var(--table-th-p)}sh-table tr:has(td.sticky-end) td:nth-last-child(2){padding:var(--table-td-p)}sh-table th{display:flex;align-items:center;padding:var(--table-th-p);min-height:var(--table-th-mh);font:var(--table-th-f);line-height:1em;white-space:var(--table-ws);color:var(--table-th-c);border:0;border-color:var(--table-bc);border-style:solid;border-width:var(--table-th-bw);background:var(--table-th-bg);gap:var(--table-th-g);z-index:100}sh-table th:has(.sh-resizer){position:relative}sh-table th.sortable{--caret-color: var(--base-10);--caret-size: .375rem;cursor:pointer;-webkit-user-select:none;user-select:none}sh-table th.sortable sh-icon{opacity:.35;transition:opacity 125ms ease-in-out}sh-table th.sortable:hover sh-icon{opacity:.7}sh-table th.sortable.sort-asc sh-icon,sh-table th.sortable.sort-desc sh-icon{opacity:1}sh-table th.sortable:not(:has(sh-icon)):after{content:\"\";border:var(--caret-size) solid transparent;width:0;height:0;opacity:0;transition:opacity 125ms ease-in-out}sh-table th.sortable:not(:has(sh-icon)).sort-desc:after{opacity:1;transform:translateY(-4px);border-bottom-color:var(--caret-color)}sh-table th.sortable:not(:has(sh-icon)).sort-asc:after{opacity:1;transform:translateY(4px);border-top-color:var(--caret-color)}sh-table th .sh-resizer{width:10px;height:100%;position:absolute;top:0;right:0;cursor:col-resize}sh-table th .sh-resizer:before,sh-table th .sh-resizer:after{content:\"\";position:absolute;top:50%;transform:translateY(-50%);height:.75rem;right:.1875rem;width:.0625rem;background-color:var(--base-4)}sh-table th .sh-resizer:hover:before,sh-table th .sh-resizer:hover:after{background-color:var(--primary-8)}sh-table th .sh-resizer:before{left:.1875rem}sh-table td{display:flex;align-items:center;padding:var(--table-td-p);min-height:var(--table-td-mh);gap:var(--table-td-g);color:var(--table-td-c);font:var(--table-td-f);white-space:var(--table-ws);border-color:var(--table-bc);border-style:solid;border-width:var(--table-td-bw);background:var(--table-td-bg)}sh-table td+td.sticky-end:last-child{padding:var(--table-td-p)}sh-table th.sticky,sh-table th.sticky-end,sh-table td.sticky,sh-table td.sticky-end{position:sticky;overflow:hidden;right:auto;left:0;z-index:1;padding:var(--table-td-p)}sh-table th.sticky:first-child,sh-table th.sticky-end:first-child,sh-table td.sticky:first-child,sh-table td.sticky-end:first-child{padding:var(--table-th-p)}sh-table th.sticky-end,sh-table td.sticky-end{right:0;left:auto}sh-table th.sticky,sh-table th.sticky-end{background:var(--base-1);padding:var(--table-th-p);z-index:101}sh-table th.sticky:first-child,sh-table th.sticky-end:first-child{padding:var(--table-th-p)}sh-table [shStickyColumns]{display:grid;grid-template-columns:subgrid;position:sticky;left:0;z-index:1000;border:0;border-color:var(--table-bc);border-style:solid}sh-table [shStickyColumns] th{background-color:var(--base-1)}sh-table [shStickyColumns=end]{left:auto;right:0}sh-table .span-all{grid-column:1/-1;white-space:initial;align-items:flex-start;padding:0;border-left-width:0;position:sticky;left:0;width:100cqw;box-sizing:border-box}sh-table .no-rows{display:none;grid-column:1/-1}sh-table tbody:empty+.no-rows{display:block}\n"] }]
438
- }], propDecorators: { loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], dataChange: [{ type: i0.Output, args: ["dataChange"] }], sortByColumn: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortByColumn", required: false }] }, { type: i0.Output, args: ["sortByColumnChange"] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], thead: [{ type: i0.ViewChild, args: ['thead', { isSignal: true }] }], tbody: [{ type: i0.ViewChild, args: ['tbody', { isSignal: true }] }], onResize: [{
518
+ }, styles: ["sh-table{--table-bc: var(--base-4);--table-th-bg: var(--base-2);--table-tr-bg: var(--base-1);--table-td-bg: var(--base-1);--table-th-c: var(--base-8);--table-th-f: var(--paragraph-30);--table-td-c: var(--base-8);--table-td-f: var(--paragraph-30);--table-th-p: 0 1.25rem;--table-td-p: 0 1.25rem;--table-th-mh: 3rem;--table-td-mh: 4.875rem;--table-th-g: .25rem;--table-td-g: .5rem;--table-ws: nowrap;--table-th-bw: 0;--table-td-bw: .0625rem 0 0;--table-columns: 1fr 1fr 1fr max-content;--table-sticky-bw: .0625rem}sh-table.type-a tbody>th,sh-table.type-a tbody>td,sh-table.type-a thead>th,sh-table.type-a thead>td{padding-right:0}sh-table.type-a tbody>th:first-child,sh-table.type-a tbody>td:first-child,sh-table.type-a thead>th:first-child,sh-table.type-a thead>td:first-child{padding:0}sh-table.type-b{--table-th-p: 0 .75rem;--table-td-p: 0 .75rem;--table-th-mh: 2.25rem;--table-td-mh: 3.5rem;--table-th-bw: .0625rem 0 .0625rem .0625rem;--table-td-bw: 0 0 .0625rem .0625rem;--table-sticky-bw: .0625rem}sh-table.type-b th:first-child{border-left-width:0;padding:var(--table-th-p)}sh-table.type-b td:first-child{border-left-width:0;padding:var(--table-td-p)}sh-table.type-b td.sticky,sh-table.type-b th.sticky{border-left-width:0;border-right:var(--table-sticky-bw) solid var(--table-bc)}sh-table.type-b [shStickyColumns] th,sh-table.type-b [shStickyColumns] td{border-right:var(--table-sticky-bw) solid var(--table-bc)}sh-table.type-b th.sticky-end,sh-table.type-b td.sticky-end,sh-table.type-b [shStickyColumns=end] th,sh-table.type-b [shStickyColumns=end] td{border-left:var(--table-sticky-bw) solid var(--table-bc);border-right:0}sh-table.type-b .sticky+th,sh-table.type-b .sticky+td,sh-table.type-b [shStickyColumns]+th,sh-table.type-b [shStickyColumns]+td{border-left-width:0}sh-table.type-b tr:hover td{background-color:var(--base-2)}sh-table.type-b div[table-header] tr:first-child th{border-bottom:0}sh-table.type-b tbody tr:last-child td{border-bottom-width:0}sh-table.type-b .actionbar{background-color:var(--base-2);border-width:.0625rem 0 0}sh-table{width:100%;display:grid;overflow:auto;overscroll-behavior-x:none;grid-template-columns:var(--table-columns);position:relative;container-type:inline-size}sh-table.resizing{-webkit-user-select:none;user-select:none}sh-table:has([shTableResize]) td{overflow:auto}sh-table.no-resize .sh-resizer{display:none}sh-table.no-resize td{overflow:initial}sh-table .actionbar{display:flex;align-items:center;gap:.5rem;grid-column:1/-1;position:sticky;left:0;z-index:10;background-color:var(--base-1);width:100cqw;box-sizing:border-box;padding:.5rem;border:var(--border-10);border-width:.0625rem 0;opacity:1;transition:padding .3s ease-out,border-width .3s ease-out,opacity .3s ease-out;overflow:hidden}sh-table .actionbar:empty,sh-table .actionbar:not(:has(>:not(.actionbar-right))):has(>.actionbar-right:empty){display:none}sh-table .actionbar>*{min-height:0}sh-table .actionbar .actionbar-right{display:flex;align-items:center;gap:.5rem;margin-left:auto;flex-shrink:0}sh-table .actionbar .actionbar-right:empty{display:none}sh-table tbody{position:relative}sh-table tbody:has(tr.sticky){position:sticky;top:0;z-index:1}sh-table thead{position:relative}sh-table thead:has(tr.sticky){position:sticky;top:0;z-index:2}sh-table sh-progress-bar{grid-column:1/-1;position:absolute;top:100%;transform:translateY(-50%);z-index:200}sh-table tbody,sh-table thead,sh-table tr{display:grid;grid-column:1/-1;grid-template-columns:subgrid}sh-table tr{background:var(--table-tr-bg);position:relative;z-index:0}sh-table tr.sticky{position:sticky;top:0;z-index:1}sh-table tr.sticky-end{position:sticky;bottom:0;z-index:3}sh-table tr:has(th.sticky-end) th:nth-last-child(2){padding:var(--table-th-p)}sh-table tr:has(td.sticky-end) td:nth-last-child(2){padding:var(--table-td-p)}sh-table th{display:flex;align-items:center;padding:var(--table-th-p);min-height:var(--table-th-mh);font:var(--table-th-f);line-height:1em;white-space:var(--table-ws);color:var(--table-th-c);border:0;border-color:var(--table-bc);border-style:solid;border-width:var(--table-th-bw);background:var(--table-th-bg);gap:var(--table-th-g);z-index:auto}sh-table th:hover,sh-table th.resizing{z-index:120}sh-table th:has(.sh-resizer){position:relative}sh-table th.sortable{--caret-color: var(--base-10);--caret-size: .375rem;cursor:pointer;-webkit-user-select:none;user-select:none}sh-table th.sortable sh-icon{opacity:.35;transition:opacity 125ms ease-in-out}sh-table th.sortable:hover sh-icon{opacity:.7}sh-table th.sortable.sort-asc sh-icon,sh-table th.sortable.sort-desc sh-icon{opacity:1}sh-table th.sortable:not(:has(sh-icon)):after{content:\"\";border:var(--caret-size) solid transparent;width:0;height:0;opacity:0;transition:opacity 125ms ease-in-out}sh-table th.sortable:not(:has(sh-icon)).sort-desc:after{opacity:1;transform:translateY(-4px);border-bottom-color:var(--caret-color)}sh-table th.sortable:not(:has(sh-icon)).sort-asc:after{opacity:1;transform:translateY(4px);border-top-color:var(--caret-color)}sh-table th .sh-resizer{width:.75rem;height:100%;position:absolute;top:0;right:-.375rem;cursor:col-resize;z-index:110}sh-table th .sh-resizer:after{content:\"\";position:absolute;top:.3125rem;bottom:.3125rem;border-radius:.125rem;right:.3125rem;width:.1875rem;background-color:var(--base-4);transition:width .15s ease,background-color .15s ease,right .15s ease}sh-table th .sh-resizer:hover:after{width:.3125rem;right:.1875rem;background-color:var(--primary-8)}sh-table th.resizing .sh-resizer:after{width:.3125rem;right:.1875rem;background-color:var(--primary-8)}sh-table td{display:flex;align-items:center;padding:var(--table-td-p);min-height:var(--table-td-mh);gap:var(--table-td-g);color:var(--table-td-c);font:var(--table-td-f);white-space:var(--table-ws);border-color:var(--table-bc);border-style:solid;border-width:var(--table-td-bw);background:var(--table-td-bg)}sh-table td+td.sticky-end:last-child{padding:var(--table-td-p)}sh-table th.sticky,sh-table th.sticky-end,sh-table td.sticky,sh-table td.sticky-end{position:sticky;overflow:hidden;right:auto;left:0;z-index:1;padding:var(--table-td-p)}sh-table th.sticky:first-child,sh-table th.sticky-end:first-child,sh-table td.sticky:first-child,sh-table td.sticky-end:first-child{padding:var(--table-th-p)}sh-table th.sticky-end,sh-table td.sticky-end{right:0;left:auto}sh-table th.sticky,sh-table th.sticky-end{background:var(--base-1);padding:var(--table-th-p);z-index:101}sh-table th.sticky:first-child,sh-table th.sticky-end:first-child{padding:var(--table-th-p)}sh-table [shStickyColumns]{display:grid;grid-template-columns:subgrid;position:sticky;left:0;z-index:1000;border:0;border-color:var(--table-bc);border-style:solid}sh-table [shStickyColumns] th{background-color:var(--base-1)}sh-table [shStickyColumns=end]{left:auto;right:0}sh-table .span-all{grid-column:1/-1;white-space:initial;align-items:flex-start;padding:0;border-left-width:0;position:sticky;left:0;width:100cqw;box-sizing:border-box}sh-table .no-rows{display:none;grid-column:1/-1}sh-table tbody:empty+.no-rows{display:block}\n"] }]
519
+ }], propDecorators: { loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], dataChange: [{ type: i0.Output, args: ["dataChange"] }], sortByColumn: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortByColumn", required: false }] }, { type: i0.Output, args: ["sortByColumnChange"] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], content: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ShipTableContent), { isSignal: true }] }], theadLocal: [{ type: i0.ViewChild, args: ['theadLocal', { isSignal: true }] }], tbodyLocal: [{ type: i0.ViewChild, args: ['tbodyLocal', { isSignal: true }] }], onResize: [{
439
520
  type: HostListener,
440
521
  args: ['window:resize', ['$event']]
441
522
  }] } });
523
+ class ShipTableContent {
524
+ constructor() {
525
+ this.#table = inject(ShipTable);
526
+ this.columns = input([], /* @ts-ignore */
527
+ ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
528
+ this.data = input([], /* @ts-ignore */
529
+ ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
530
+ this.sortByColumn = this.#table.sortByColumn;
531
+ this.thead = viewChild('thead', /* @ts-ignore */
532
+ ...(ngDevMode ? [{ debugName: "thead" }] : /* istanbul ignore next */ []));
533
+ this.tbody = viewChild('tbody', /* @ts-ignore */
534
+ ...(ngDevMode ? [{ debugName: "tbody" }] : /* istanbul ignore next */ []));
535
+ }
536
+ #table;
537
+ getValue(row, col) {
538
+ if (!row)
539
+ return '';
540
+ const key = col.accessorKey || col.id;
541
+ return row[key];
542
+ }
543
+ formatDate(value) {
544
+ if (!value)
545
+ return '';
546
+ const date = new Date(value);
547
+ if (isNaN(date.getTime()))
548
+ return String(value);
549
+ return date.toLocaleDateString();
550
+ }
551
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipTableContent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
552
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: ShipTableContent, isStandalone: true, selector: "sh-table-content", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, host: { styleAttribute: "display: contents" }, viewQueries: [{ propertyName: "thead", first: true, predicate: ["thead"], descendants: true, isSignal: true }, { propertyName: "tbody", first: true, predicate: ["tbody"], descendants: true, isSignal: true }], ngImport: i0, template: `
553
+ <thead #thead role="rowgroup">
554
+ <tr role="row">
555
+ @for (col of columns(); track col.id) {
556
+ @if (col.resizable) {
557
+ <th
558
+ role="columnheader"
559
+ [id]="col.id"
560
+ [attr.aria-label]="col.header"
561
+ [shSort]="col.sortable ? col.id : undefined"
562
+ shResize
563
+ [minWidth]="col.minWidth ?? 50"
564
+ [maxWidth]="col.maxWidth ?? null"
565
+ [attr.size]="col.size || null"
566
+ [class.sticky]="col.sticky === 'start'"
567
+ [class.sticky-end]="col.sticky === 'end'">
568
+ {{ col.header }}
569
+ @if (col.sortable) {
570
+ @if (sortByColumn() === col.id) {
571
+ <sh-icon>caret-up</sh-icon>
572
+ } @else if (sortByColumn() === '-' + col.id) {
573
+ <sh-icon>caret-down</sh-icon>
574
+ } @else {
575
+ <sh-icon>arrows-down-up</sh-icon>
576
+ }
577
+ }
578
+ </th>
579
+ } @else {
580
+ <th
581
+ role="columnheader"
582
+ [id]="col.id"
583
+ [attr.aria-label]="col.header"
584
+ [shSort]="col.sortable ? col.id : undefined"
585
+ [attr.size]="col.size || null"
586
+ [class.sticky]="col.sticky === 'start'"
587
+ [class.sticky-end]="col.sticky === 'end'">
588
+ {{ col.header }}
589
+ @if (col.sortable) {
590
+ @if (sortByColumn() === col.id) {
591
+ <sh-icon>caret-up</sh-icon>
592
+ } @else if (sortByColumn() === '-' + col.id) {
593
+ <sh-icon>caret-down</sh-icon>
594
+ } @else {
595
+ <sh-icon>arrows-down-up</sh-icon>
596
+ }
597
+ }
598
+ </th>
599
+ }
600
+ }
601
+ </tr>
602
+ </thead>
603
+
604
+ <tbody #tbody role="rowgroup">
605
+ @for (row of data(); track $index) {
606
+ @let rowIndex = $index;
607
+ <tr role="row">
608
+ @for (col of columns(); track col.id) {
609
+ <td
610
+ [class.sticky]="col.sticky === 'start'"
611
+ [class.sticky-end]="col.sticky === 'end'"
612
+ [id]="col.id + '-' + rowIndex"
613
+ [attr.aria-labelledby]="col.id + ' ' + col.id + '-' + rowIndex"
614
+ [attr.role]="col.rowHeader ? 'rowheader' : 'cell'">
615
+ @if (col.cellTemplate) {
616
+ <ng-container
617
+ [ngTemplateOutlet]="col.cellTemplate"
618
+ [ngTemplateOutletContext]="{ $implicit: row, column: col }" />
619
+ } @else if (col.cell) {
620
+ {{ col.cell(row) }}
621
+ } @else if (col.format) {
622
+ {{ col.format(getValue(row, col), row) }}
623
+ } @else {
624
+ @switch (col.type) {
625
+ @case ('date') {
626
+ {{ formatDate(getValue(row, col)) }}
627
+ }
628
+ @case ('boolean') {
629
+ @if (getValue(row, col)) {
630
+ <sh-icon class="text-success">check</sh-icon>
631
+ } @else {
632
+ <sh-icon class="text-muted">x</sh-icon>
633
+ }
634
+ }
635
+ @case ('badge') {
636
+ <sh-chip>{{ getValue(row, col) }}</sh-chip>
637
+ }
638
+ @default {
639
+ {{ getValue(row, col) }}
640
+ }
641
+ }
642
+ }
643
+ </td>
644
+ }
645
+ </tr>
646
+ }
647
+ </tbody>
648
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ShipSort, selector: "[shSort]", inputs: ["shSort"] }, { kind: "directive", type: ShipResize, selector: "[shResize]", inputs: ["resizable", "minWidth", "maxWidth"] }, { kind: "component", type: ShipIcon, selector: "sh-icon", inputs: ["color", "size"] }, { kind: "component", type: ShipChip, selector: "sh-chip", inputs: ["color", "variant", "size", "sharp", "dynamic", "readonly", "noBg"] }] }); }
649
+ }
650
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipTableContent, decorators: [{
651
+ type: Component,
652
+ args: [{
653
+ selector: 'sh-table-content',
654
+ standalone: true,
655
+ imports: [NgTemplateOutlet, ShipSort, ShipResize, ShipIcon, ShipChip],
656
+ host: {
657
+ style: 'display: contents',
658
+ },
659
+ template: `
660
+ <thead #thead role="rowgroup">
661
+ <tr role="row">
662
+ @for (col of columns(); track col.id) {
663
+ @if (col.resizable) {
664
+ <th
665
+ role="columnheader"
666
+ [id]="col.id"
667
+ [attr.aria-label]="col.header"
668
+ [shSort]="col.sortable ? col.id : undefined"
669
+ shResize
670
+ [minWidth]="col.minWidth ?? 50"
671
+ [maxWidth]="col.maxWidth ?? null"
672
+ [attr.size]="col.size || null"
673
+ [class.sticky]="col.sticky === 'start'"
674
+ [class.sticky-end]="col.sticky === 'end'">
675
+ {{ col.header }}
676
+ @if (col.sortable) {
677
+ @if (sortByColumn() === col.id) {
678
+ <sh-icon>caret-up</sh-icon>
679
+ } @else if (sortByColumn() === '-' + col.id) {
680
+ <sh-icon>caret-down</sh-icon>
681
+ } @else {
682
+ <sh-icon>arrows-down-up</sh-icon>
683
+ }
684
+ }
685
+ </th>
686
+ } @else {
687
+ <th
688
+ role="columnheader"
689
+ [id]="col.id"
690
+ [attr.aria-label]="col.header"
691
+ [shSort]="col.sortable ? col.id : undefined"
692
+ [attr.size]="col.size || null"
693
+ [class.sticky]="col.sticky === 'start'"
694
+ [class.sticky-end]="col.sticky === 'end'">
695
+ {{ col.header }}
696
+ @if (col.sortable) {
697
+ @if (sortByColumn() === col.id) {
698
+ <sh-icon>caret-up</sh-icon>
699
+ } @else if (sortByColumn() === '-' + col.id) {
700
+ <sh-icon>caret-down</sh-icon>
701
+ } @else {
702
+ <sh-icon>arrows-down-up</sh-icon>
703
+ }
704
+ }
705
+ </th>
706
+ }
707
+ }
708
+ </tr>
709
+ </thead>
710
+
711
+ <tbody #tbody role="rowgroup">
712
+ @for (row of data(); track $index) {
713
+ @let rowIndex = $index;
714
+ <tr role="row">
715
+ @for (col of columns(); track col.id) {
716
+ <td
717
+ [class.sticky]="col.sticky === 'start'"
718
+ [class.sticky-end]="col.sticky === 'end'"
719
+ [id]="col.id + '-' + rowIndex"
720
+ [attr.aria-labelledby]="col.id + ' ' + col.id + '-' + rowIndex"
721
+ [attr.role]="col.rowHeader ? 'rowheader' : 'cell'">
722
+ @if (col.cellTemplate) {
723
+ <ng-container
724
+ [ngTemplateOutlet]="col.cellTemplate"
725
+ [ngTemplateOutletContext]="{ $implicit: row, column: col }" />
726
+ } @else if (col.cell) {
727
+ {{ col.cell(row) }}
728
+ } @else if (col.format) {
729
+ {{ col.format(getValue(row, col), row) }}
730
+ } @else {
731
+ @switch (col.type) {
732
+ @case ('date') {
733
+ {{ formatDate(getValue(row, col)) }}
734
+ }
735
+ @case ('boolean') {
736
+ @if (getValue(row, col)) {
737
+ <sh-icon class="text-success">check</sh-icon>
738
+ } @else {
739
+ <sh-icon class="text-muted">x</sh-icon>
740
+ }
741
+ }
742
+ @case ('badge') {
743
+ <sh-chip>{{ getValue(row, col) }}</sh-chip>
744
+ }
745
+ @default {
746
+ {{ getValue(row, col) }}
747
+ }
748
+ }
749
+ }
750
+ </td>
751
+ }
752
+ </tr>
753
+ }
754
+ </tbody>
755
+ `,
756
+ }]
757
+ }], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], thead: [{ type: i0.ViewChild, args: ['thead', { isSignal: true }] }], tbody: [{ type: i0.ViewChild, args: ['tbody', { isSignal: true }] }] } });
442
758
 
443
759
  /**
444
760
  * Generated bundle index. Do not edit.
445
761
  */
446
762
 
447
- export { ShipResize, ShipSort, ShipStickyColumns, ShipTable };
763
+ export { ShipResize, ShipSort, ShipStickyColumns, ShipTable, ShipTableContent };
448
764
  //# sourceMappingURL=ship-ui-core-ship-table.mjs.map