kanto-ds 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/chunks/floating-B33g-M_1.js +63 -0
- package/dist/chunks/floating-B33g-M_1.js.map +1 -0
- package/dist/chunks/{index-STEEvEP7.js → index-TWJzttLX.js} +38 -15
- package/dist/chunks/index-TWJzttLX.js.map +1 -0
- package/dist/chunks/kt-calendar-CtwOby1R.js +780 -0
- package/dist/chunks/kt-calendar-CtwOby1R.js.map +1 -0
- package/dist/chunks/{kt-element-Djx2JcGl.js → kt-element-T0VbIBNp.js} +2 -2
- package/dist/chunks/{kt-element-Djx2JcGl.js.map → kt-element-T0VbIBNp.js.map} +1 -1
- package/dist/chunks/{listbox-llcUu_V-.js → listbox-LsUEyGhQ.js} +2 -2
- package/dist/chunks/{listbox-llcUu_V-.js.map → listbox-LsUEyGhQ.js.map} +1 -1
- package/dist/chunks/segmented-field-BBXR4XFL.js +384 -0
- package/dist/chunks/segmented-field-BBXR4XFL.js.map +1 -0
- package/dist/chunks/typed-date-CPAUNHzr.js +103 -0
- package/dist/chunks/typed-date-CPAUNHzr.js.map +1 -0
- package/dist/components/core/kt-avatar/kt-avatar.js +2 -2
- package/dist/components/core/kt-badge/kt-badge.js +2 -2
- package/dist/components/core/kt-button/kt-button.js +1 -1
- package/dist/components/core/kt-card/kt-card.js +1 -1
- package/dist/components/core/kt-code/kt-code.js +13 -13
- package/dist/components/core/kt-code/kt-code.js.map +1 -1
- package/dist/components/core/kt-icon/kt-icon.js +1 -1
- package/dist/components/core/kt-kbd/kt-kbd.js +5 -5
- package/dist/components/core/kt-kbd/kt-kbd.js.map +1 -1
- package/dist/components/core/kt-split-button/kt-split-button.js +3 -3
- package/dist/components/data/kt-chart/kt-chart.js +3 -3
- package/dist/components/data/kt-chart/kt-chart.js.map +1 -1
- package/dist/components/data/kt-meter/kt-meter.js +1 -1
- package/dist/components/data/kt-pagination/kt-pagination.js +2 -2
- package/dist/components/data/kt-stat/kt-stat.js +1 -1
- package/dist/components/data/kt-table/kt-table.js +85 -85
- package/dist/components/data/kt-table/kt-table.js.map +1 -1
- package/dist/components/data/kt-timeline/kt-timeline.js +1 -1
- package/dist/components/feedback/kt-alert/kt-alert.js +15 -15
- package/dist/components/feedback/kt-alert/kt-alert.js.map +1 -1
- package/dist/components/feedback/kt-empty-state/kt-empty-state.js +1 -1
- package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js +1 -1
- package/dist/components/feedback/kt-skeleton/kt-skeleton.js +13 -13
- package/dist/components/feedback/kt-skeleton/kt-skeleton.js.map +1 -1
- package/dist/components/feedback/kt-toast/kt-toast.js +3 -3
- package/dist/components/feedback/kt-toast/kt-toast.js.map +1 -1
- package/dist/components/feedback/kt-toast-container/kt-toast-container.js +1 -1
- package/dist/components/feedback/kt-tooltip/kt-tooltip.js +1 -1
- package/dist/components/forms/kt-calendar/kt-calendar.d.ts +35 -9
- package/dist/components/forms/kt-calendar/kt-calendar.js +3 -3
- package/dist/components/forms/kt-checkbox/kt-checkbox.js +2 -2
- package/dist/components/forms/kt-date-input/kt-date-input.d.ts +65 -0
- package/dist/components/forms/kt-date-input/kt-date-input.js +241 -0
- package/dist/components/forms/kt-date-input/kt-date-input.js.map +1 -0
- package/dist/components/forms/kt-date-picker/kt-date-picker.d.ts +47 -3
- package/dist/components/forms/kt-date-picker/kt-date-picker.js +430 -199
- package/dist/components/forms/kt-date-picker/kt-date-picker.js.map +1 -1
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js +3 -3
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js.map +1 -1
- package/dist/components/forms/kt-form/kt-form.js +2 -2
- package/dist/components/forms/kt-input/kt-input.js +10 -10
- package/dist/components/forms/kt-input/kt-input.js.map +1 -1
- package/dist/components/forms/kt-input-menu/kt-input-menu.js +4 -4
- package/dist/components/forms/kt-label-input/kt-label-input.js +1 -1
- package/dist/components/forms/kt-multi-select/kt-multi-select.d.ts +113 -0
- package/dist/components/forms/kt-multi-select/kt-multi-select.js +532 -0
- package/dist/components/forms/kt-multi-select/kt-multi-select.js.map +1 -0
- package/dist/components/forms/kt-radio-group/kt-radio-group.js +56 -51
- package/dist/components/forms/kt-radio-group/kt-radio-group.js.map +1 -1
- package/dist/components/forms/kt-select/kt-select.js +4 -4
- package/dist/components/forms/kt-textarea/kt-textarea.js +2 -2
- package/dist/components/forms/kt-time-input/kt-time-input.d.ts +48 -0
- package/dist/components/forms/kt-time-input/kt-time-input.js +114 -0
- package/dist/components/forms/kt-time-input/kt-time-input.js.map +1 -0
- package/dist/components/forms/kt-toggle/kt-toggle.js +1 -1
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +6 -6
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js.map +1 -1
- package/dist/components/navigation/kt-header/kt-header.js +2 -2
- package/dist/components/navigation/kt-page-header/kt-page-header.js +1 -1
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +2 -2
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js +2 -2
- package/dist/components/navigation/kt-tabs/kt-tabs.js +2 -2
- package/dist/components/navigation/kt-tabs/kt-tabs.js.map +1 -1
- package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js +1 -1
- package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js +2 -2
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js +3 -3
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js.map +1 -1
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js +2 -2
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js +24 -24
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js.map +1 -1
- package/dist/components/overlays/kt-modal/kt-modal.js +2 -2
- package/dist/components/overlays/kt-side-panel/kt-side-panel.js +2 -2
- package/dist/custom-elements.json +2230 -842
- package/dist/index.d.ts +9 -1
- package/dist/index.js +316 -109
- package/dist/index.js.map +1 -1
- package/dist/internal/floating.d.ts +3 -0
- package/dist/internal/segmented-field.d.ts +114 -0
- package/dist/internal/segments.d.ts +30 -0
- package/dist/internal/strings.d.ts +30 -0
- package/dist/internal/typed-date.d.ts +33 -0
- package/dist/react/index.d.ts +23 -0
- package/dist/react/index.js +193 -169
- package/dist/react/index.js.map +1 -1
- package/dist/react/jsx.d.ts +20 -1
- package/dist/strings/index.js +1 -1
- package/dist/theme/accent.d.ts +51 -0
- package/dist/theme/appearance.d.ts +37 -0
- package/dist/tokens/README.md +100 -1
- package/dist/tokens/accents.css +80 -0
- package/dist/tokens/appearance.css +65 -0
- package/dist/tokens/base.css +3 -0
- package/dist/tokens/colors.css +78 -25
- package/dist/tokens/index.css +2 -0
- package/dist/tokens/responsive.css +160 -75
- package/dist/tokens/spacing.css +47 -28
- package/dist/tokens/theme-light.css +124 -38
- package/dist/tokens/typography.css +20 -13
- package/dist/vscode.css-custom-data.json +36 -1
- package/dist/vscode.html-custom-data.json +67 -2
- package/dist/vue/index.d.ts +6 -0
- package/dist/vue/index.js +11 -8
- package/dist/vue/index.js.map +1 -1
- package/dist/web-types.json +190 -3
- package/package.json +13 -1
- package/dist/chunks/floating-B7_Dahpn.js +0 -54
- package/dist/chunks/floating-B7_Dahpn.js.map +0 -1
- package/dist/chunks/index-STEEvEP7.js.map +0 -1
- package/dist/chunks/kt-calendar-B_hFdD9V.js +0 -640
- package/dist/chunks/kt-calendar-B_hFdD9V.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as m, html as r, nothing as o } from "lit";
|
|
2
2
|
import { property as i } from "lit/decorators.js";
|
|
3
|
-
import { K as u, d as c } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as u, d as c } from "../../../chunks/kt-element-T0VbIBNp.js";
|
|
4
4
|
var g = Object.defineProperty, n = (d, t, e, s) => {
|
|
5
5
|
for (var a = void 0, p = d.length - 1, h; p >= 0; p--)
|
|
6
6
|
(h = d[p]) && (a = h(t, e, a) || a);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css as h, html as m } from "lit";
|
|
2
2
|
import { property as n } from "lit/decorators.js";
|
|
3
|
-
import { K as g, d as c } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as g, d as c } from "../../../chunks/kt-element-T0VbIBNp.js";
|
|
4
4
|
import { e as u } from "../../../chunks/events-r51msXNf.js";
|
|
5
|
-
import { s as i } from "../../../chunks/index-
|
|
5
|
+
import { s as i } from "../../../chunks/index-TWJzttLX.js";
|
|
6
6
|
import "../../core/kt-button/kt-button.js";
|
|
7
7
|
var d = Object.defineProperty, p = (r, a, t, f) => {
|
|
8
8
|
for (var e = void 0, o = r.length - 1, l; o >= 0; o--)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as h, nothing as l, html as r } from "lit";
|
|
2
2
|
import { property as e } from "lit/decorators.js";
|
|
3
|
-
import { K as c, d as f } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as c, d as f } from "../../../chunks/kt-element-T0VbIBNp.js";
|
|
4
4
|
import "../../core/kt-icon/kt-icon.js";
|
|
5
5
|
import "../../core/kt-badge/kt-badge.js";
|
|
6
6
|
import "../../feedback/kt-skeleton/kt-skeleton.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { css as k, nothing as d, html as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as k, nothing as d, html as h } from "lit";
|
|
2
|
+
import { property as n, state as f } from "lit/decorators.js";
|
|
3
3
|
import { classMap as S } from "lit/directives/class-map.js";
|
|
4
|
-
import { styleMap as
|
|
5
|
-
import { K as
|
|
4
|
+
import { styleMap as v } from "lit/directives/style-map.js";
|
|
5
|
+
import { K as w, d as R } from "../../../chunks/kt-element-T0VbIBNp.js";
|
|
6
6
|
import { e as g } from "../../../chunks/events-r51msXNf.js";
|
|
7
7
|
import { r as M } from "../../../chunks/locale-C5xLkGx5.js";
|
|
8
|
-
import { s as u } from "../../../chunks/index-
|
|
8
|
+
import { s as u } from "../../../chunks/index-TWJzttLX.js";
|
|
9
9
|
import "../../core/kt-icon/kt-icon.js";
|
|
10
10
|
import "../kt-pagination/kt-pagination.js";
|
|
11
11
|
const H = 50;
|
|
@@ -18,15 +18,15 @@ function z({
|
|
|
18
18
|
}) {
|
|
19
19
|
if (r === 0) return { start: 0, end: 0 };
|
|
20
20
|
if (t <= 0) return { start: 0, end: Math.min(r, H) };
|
|
21
|
-
const
|
|
21
|
+
const c = Math.ceil(e / t), a = Math.min(Math.floor(i / t), Math.max(0, r - c)), p = Math.ceil((i + e) / t);
|
|
22
22
|
return {
|
|
23
23
|
start: Math.max(0, a - s),
|
|
24
24
|
end: Math.min(r, p + s)
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
var D = Object.defineProperty,
|
|
28
|
-
for (var s = void 0,
|
|
29
|
-
(a = r[
|
|
27
|
+
var D = Object.defineProperty, l = (r, t, e, i) => {
|
|
28
|
+
for (var s = void 0, c = r.length - 1, a; c >= 0; c--)
|
|
29
|
+
(a = r[c]) && (s = a(t, e, s) || s);
|
|
30
30
|
return s && D(t, e, s), s;
|
|
31
31
|
};
|
|
32
32
|
const K = 8, x = /* @__PURE__ */ new Map();
|
|
@@ -47,7 +47,7 @@ function $(r) {
|
|
|
47
47
|
function y(r) {
|
|
48
48
|
return r.id ?? r.uid ?? r;
|
|
49
49
|
}
|
|
50
|
-
class o extends
|
|
50
|
+
class o extends w {
|
|
51
51
|
constructor() {
|
|
52
52
|
super(...arguments), this.page = 1, this.manual = !1, this.virtual = !1, this.scrollOffset = 0, this.viewportHeight = 0, this.headerHeight = 0, this.rowHeight = 0, this.totalRows = 0, this.columns = [], this.data = [], this.selectable = !1, this.selectionMode = "multiple", this.selected = [], this.pageSize = 0, this.loading = !1, this.compact = !1, this.sortKey = null, this.sortDirection = null, this.emptyText = void 0, this.loadingText = void 0, this.label = "", this.locale = "", this.onScroll = (t) => {
|
|
53
53
|
this.scrollOffset = t.currentTarget.scrollTop;
|
|
@@ -55,7 +55,7 @@ class o extends v {
|
|
|
55
55
|
}
|
|
56
56
|
static {
|
|
57
57
|
this.styles = [
|
|
58
|
-
|
|
58
|
+
w.styles,
|
|
59
59
|
k`
|
|
60
60
|
:host {
|
|
61
61
|
display: block;
|
|
@@ -82,8 +82,8 @@ class o extends v {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
th {
|
|
85
|
-
padding: 16px 18px;
|
|
86
|
-
font-size: 13px;
|
|
85
|
+
padding: calc(16px * var(--density-scale, 1)) calc(18px * var(--density-scale, 1));
|
|
86
|
+
font-size: calc(13px * var(--text-scale, 1));
|
|
87
87
|
font-weight: inherit;
|
|
88
88
|
text-align: left;
|
|
89
89
|
white-space: nowrap;
|
|
@@ -135,13 +135,13 @@ class o extends v {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
td {
|
|
138
|
-
padding: 14px 18px;
|
|
139
|
-
font-size: 14px;
|
|
138
|
+
padding: calc(14px * var(--density-scale, 1)) calc(18px * var(--density-scale, 1));
|
|
139
|
+
font-size: calc(14px * var(--text-scale, 1));
|
|
140
140
|
border-bottom: var(--border-width) solid var(--surface-hover);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
:host([compact]) td {
|
|
144
|
-
padding: 8px 12px;
|
|
144
|
+
padding: calc(8px * var(--density-scale, 1)) calc(12px * var(--density-scale, 1));
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/* === VIRTUAL ===
|
|
@@ -172,7 +172,7 @@ class o extends v {
|
|
|
172
172
|
border: none;
|
|
173
173
|
}
|
|
174
174
|
:host([compact]) th {
|
|
175
|
-
padding: 10px 12px;
|
|
175
|
+
padding: calc(10px * var(--density-scale, 1)) calc(12px * var(--density-scale, 1));
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
.select-cell {
|
|
@@ -181,7 +181,7 @@ class o extends v {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
.placeholder {
|
|
184
|
-
padding: 28px 0;
|
|
184
|
+
padding: calc(28px * var(--density-scale, 1)) 0;
|
|
185
185
|
color: var(--text-muted);
|
|
186
186
|
text-align: center;
|
|
187
187
|
}
|
|
@@ -200,7 +200,7 @@ class o extends v {
|
|
|
200
200
|
}
|
|
201
201
|
td,
|
|
202
202
|
th {
|
|
203
|
-
padding: 10px 12px;
|
|
203
|
+
padding: calc(10px * var(--density-scale, 1)) calc(12px * var(--density-scale, 1));
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
`
|
|
@@ -231,8 +231,8 @@ class o extends v {
|
|
|
231
231
|
sort(t) {
|
|
232
232
|
if (!this.sortKey || !this.sortDirection) return this.data;
|
|
233
233
|
const e = this.sortKey, i = this.sortDirection === "asc" ? 1 : -1;
|
|
234
|
-
return [...this.data].sort((s,
|
|
235
|
-
const a = s[e], p =
|
|
234
|
+
return [...this.data].sort((s, c) => {
|
|
235
|
+
const a = s[e], p = c[e], b = a == null, m = p == null;
|
|
236
236
|
return b && m ? 0 : b ? 1 : m ? -1 : typeof a == "number" && typeof p == "number" ? (a - p) * i : t.compare($(a), $(p)) * i;
|
|
237
237
|
});
|
|
238
238
|
}
|
|
@@ -311,55 +311,55 @@ class o extends v {
|
|
|
311
311
|
}
|
|
312
312
|
renderHeaderCell(t) {
|
|
313
313
|
const e = t.label ?? t.key, i = this.sortKey === t.key && this.sortDirection !== null;
|
|
314
|
-
return
|
|
314
|
+
return h`<th
|
|
315
315
|
part="header-cell"
|
|
316
316
|
scope="col"
|
|
317
|
-
style=${
|
|
317
|
+
style=${v(t.width ? { width: t.width } : {})}
|
|
318
318
|
aria-sort=${this.sortStateFor(t)}
|
|
319
319
|
>
|
|
320
|
-
${t.sortable ?
|
|
320
|
+
${t.sortable ? h`<button type="button" @click=${() => this.toggleSort(t)}>
|
|
321
321
|
<span>${e}</span>
|
|
322
322
|
<span class="indicator" aria-hidden="true">
|
|
323
|
-
${i ?
|
|
323
|
+
${i ? h`<kt-icon
|
|
324
324
|
name=${this.sortDirection === "asc" ? "arrow-up" : "arrow-down"}
|
|
325
325
|
size="14"
|
|
326
326
|
></kt-icon>` : d}
|
|
327
327
|
</span>
|
|
328
|
-
</button>` :
|
|
328
|
+
</button>` : h`<span>${e}</span>`}
|
|
329
329
|
</th>`;
|
|
330
330
|
}
|
|
331
331
|
renderBody() {
|
|
332
332
|
const t = this.visibleRows, e = this.columns.length + (this.selectable ? 1 : 0);
|
|
333
333
|
if (t.length === 0)
|
|
334
|
-
return
|
|
334
|
+
return h`<tr>
|
|
335
335
|
<td colspan=${e}>
|
|
336
336
|
<div class="placeholder">${this.emptyText ?? u().noData}</div>
|
|
337
337
|
</td>
|
|
338
338
|
</tr>`;
|
|
339
339
|
if (!this.isVirtual)
|
|
340
|
-
return
|
|
340
|
+
return h`${t.map((a, p) => this.renderRow(a, p))}`;
|
|
341
341
|
const { start: i, end: s } = z({
|
|
342
342
|
rowCount: t.length,
|
|
343
343
|
rowHeight: this.rowHeight,
|
|
344
344
|
viewportHeight: Math.max(0, this.viewportHeight - this.headerHeight),
|
|
345
345
|
scrollTop: Math.max(0, this.scrollOffset - this.headerHeight),
|
|
346
346
|
overscan: K
|
|
347
|
-
}),
|
|
347
|
+
}), c = (a) => a > 0 && this.rowHeight > 0 ? h`<tr class="spacer" aria-hidden="true">
|
|
348
348
|
<td colspan=${e} style=${`height: ${a * this.rowHeight}px`}></td>
|
|
349
349
|
</tr>` : d;
|
|
350
|
-
return
|
|
350
|
+
return h`${c(i)}${t.slice(i, s).map((a, p) => this.renderRow(a, i + p))}${c(t.length - s)}`;
|
|
351
351
|
}
|
|
352
352
|
/** `index` counts from the first row of the data, not of the rows rendered. */
|
|
353
353
|
renderRow(t, e) {
|
|
354
354
|
const i = this.isSelected(t);
|
|
355
|
-
return
|
|
355
|
+
return h`<tr
|
|
356
356
|
part="row"
|
|
357
357
|
class=${S({ selected: i })}
|
|
358
358
|
aria-selected=${this.selectable ? String(i) : d}
|
|
359
359
|
aria-rowindex=${this.isVirtual ? e + 2 : d}
|
|
360
360
|
@click=${() => g(this, "kt-row-click", { row: t, index: e })}
|
|
361
361
|
>
|
|
362
|
-
${this.selectable ?
|
|
362
|
+
${this.selectable ? h`<td class="select-cell">
|
|
363
363
|
<input
|
|
364
364
|
type=${this.selectionMode === "single" ? "radio" : "checkbox"}
|
|
365
365
|
name=${this.selectionMode === "single" ? "kt-table-selection" : d}
|
|
@@ -370,9 +370,9 @@ class o extends v {
|
|
|
370
370
|
/>
|
|
371
371
|
</td>` : d}
|
|
372
372
|
${this.columns.map((s) => {
|
|
373
|
-
const
|
|
374
|
-
return
|
|
375
|
-
${
|
|
373
|
+
const c = this.renderCell?.(t, s);
|
|
374
|
+
return h`<td part="cell" style=${v({ textAlign: s.align ?? "left" })}>
|
|
375
|
+
${c === void 0 ? t[s.key] : c}
|
|
376
376
|
</td>`;
|
|
377
377
|
})}
|
|
378
378
|
</tr>`;
|
|
@@ -380,21 +380,21 @@ class o extends v {
|
|
|
380
380
|
render() {
|
|
381
381
|
const t = this.loading && this.manual && this.data.length > 0;
|
|
382
382
|
if (this.loading && !t)
|
|
383
|
-
return
|
|
383
|
+
return h`<div class="placeholder" role="status" aria-live="polite">
|
|
384
384
|
${this.loadingText ?? u().loading}
|
|
385
385
|
</div>`;
|
|
386
|
-
const e = this.visibleRows, i = e.length > 0 && e.every((a) => this.isSelected(a)), s = e.some((a) => this.isSelected(a)),
|
|
387
|
-
return
|
|
386
|
+
const e = this.visibleRows, i = e.length > 0 && e.every((a) => this.isSelected(a)), s = e.some((a) => this.isSelected(a)), c = this.isVirtual;
|
|
387
|
+
return h`<div class="scroller" @scroll=${c ? this.onScroll : d}>
|
|
388
388
|
<table
|
|
389
389
|
part="table"
|
|
390
390
|
aria-label=${this.label || d}
|
|
391
391
|
aria-busy=${t ? "true" : d}
|
|
392
|
-
aria-rowcount=${
|
|
392
|
+
aria-rowcount=${c ? e.length + 1 : d}
|
|
393
393
|
>
|
|
394
394
|
<thead>
|
|
395
|
-
<tr aria-rowindex=${
|
|
396
|
-
${this.selectable ?
|
|
397
|
-
${this.selectionMode === "multiple" ?
|
|
395
|
+
<tr aria-rowindex=${c ? 1 : d}>
|
|
396
|
+
${this.selectable ? h`<th class="select-cell" scope="col">
|
|
397
|
+
${this.selectionMode === "multiple" ? h`<input
|
|
398
398
|
type="checkbox"
|
|
399
399
|
.checked=${i}
|
|
400
400
|
.indeterminate=${s && !i}
|
|
@@ -411,7 +411,7 @@ class o extends v {
|
|
|
411
411
|
</table>
|
|
412
412
|
</div>
|
|
413
413
|
|
|
414
|
-
${this.pageSize > 0 ?
|
|
414
|
+
${this.pageSize > 0 ? h`<footer>
|
|
415
415
|
<kt-pagination
|
|
416
416
|
.page=${Math.min(this.page, this.totalPages)}
|
|
417
417
|
.totalPages=${this.totalPages}
|
|
@@ -420,74 +420,74 @@ class o extends v {
|
|
|
420
420
|
</footer>` : d}`;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
|
|
424
|
-
|
|
423
|
+
l([
|
|
424
|
+
n({ type: Number })
|
|
425
425
|
], o.prototype, "page");
|
|
426
|
-
|
|
427
|
-
|
|
426
|
+
l([
|
|
427
|
+
n({ type: Boolean, reflect: !0 })
|
|
428
428
|
], o.prototype, "manual");
|
|
429
|
-
|
|
430
|
-
|
|
429
|
+
l([
|
|
430
|
+
n({ type: Boolean, reflect: !0 })
|
|
431
431
|
], o.prototype, "virtual");
|
|
432
|
-
|
|
432
|
+
l([
|
|
433
433
|
f()
|
|
434
434
|
], o.prototype, "scrollOffset");
|
|
435
|
-
|
|
435
|
+
l([
|
|
436
436
|
f()
|
|
437
437
|
], o.prototype, "viewportHeight");
|
|
438
|
-
|
|
438
|
+
l([
|
|
439
439
|
f()
|
|
440
440
|
], o.prototype, "headerHeight");
|
|
441
|
-
|
|
441
|
+
l([
|
|
442
442
|
f()
|
|
443
443
|
], o.prototype, "rowHeight");
|
|
444
|
-
|
|
445
|
-
|
|
444
|
+
l([
|
|
445
|
+
n({ type: Number, attribute: "total-rows" })
|
|
446
446
|
], o.prototype, "totalRows");
|
|
447
|
-
|
|
448
|
-
|
|
447
|
+
l([
|
|
448
|
+
n({ attribute: !1 })
|
|
449
449
|
], o.prototype, "columns");
|
|
450
|
-
|
|
451
|
-
|
|
450
|
+
l([
|
|
451
|
+
n({ attribute: !1 })
|
|
452
452
|
], o.prototype, "data");
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
l([
|
|
454
|
+
n({ type: Boolean, reflect: !0 })
|
|
455
455
|
], o.prototype, "selectable");
|
|
456
|
-
|
|
457
|
-
|
|
456
|
+
l([
|
|
457
|
+
n({ type: String, attribute: "selection-mode" })
|
|
458
458
|
], o.prototype, "selectionMode");
|
|
459
|
-
|
|
460
|
-
|
|
459
|
+
l([
|
|
460
|
+
n({ attribute: !1 })
|
|
461
461
|
], o.prototype, "selected");
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
l([
|
|
463
|
+
n({ type: Number, attribute: "page-size" })
|
|
464
464
|
], o.prototype, "pageSize");
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
l([
|
|
466
|
+
n({ type: Boolean, reflect: !0 })
|
|
467
467
|
], o.prototype, "loading");
|
|
468
|
-
|
|
469
|
-
|
|
468
|
+
l([
|
|
469
|
+
n({ type: Boolean, reflect: !0 })
|
|
470
470
|
], o.prototype, "compact");
|
|
471
|
-
|
|
472
|
-
|
|
471
|
+
l([
|
|
472
|
+
n({ type: String, attribute: "sort-key" })
|
|
473
473
|
], o.prototype, "sortKey");
|
|
474
|
-
|
|
475
|
-
|
|
474
|
+
l([
|
|
475
|
+
n({ type: String, attribute: "sort-direction" })
|
|
476
476
|
], o.prototype, "sortDirection");
|
|
477
|
-
|
|
478
|
-
|
|
477
|
+
l([
|
|
478
|
+
n({ attribute: !1 })
|
|
479
479
|
], o.prototype, "renderCell");
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
l([
|
|
481
|
+
n({ type: String, attribute: "empty-text" })
|
|
482
482
|
], o.prototype, "emptyText");
|
|
483
|
-
|
|
484
|
-
|
|
483
|
+
l([
|
|
484
|
+
n({ type: String, attribute: "loading-text" })
|
|
485
485
|
], o.prototype, "loadingText");
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
l([
|
|
487
|
+
n({ type: String })
|
|
488
488
|
], o.prototype, "label");
|
|
489
|
-
|
|
490
|
-
|
|
489
|
+
l([
|
|
490
|
+
n({ type: String })
|
|
491
491
|
], o.prototype, "locale");
|
|
492
492
|
R("kt-table", o);
|
|
493
493
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kt-table.js","sources":["../../../../src/components/data/kt-table/window.ts","../../../../src/components/data/kt-table/kt-table.ts"],"sourcesContent":["/**\n * Which rows a virtual table renders: those under the viewport, and a few\n * either side so a fast scroll does not show blank space before the next\n * render lands.\n */\n\n/** Rendered before the first row has been measured, to measure it. */\nconst FIRST_BATCH = 50;\n\nexport interface RowWindowInput {\n readonly rowCount: number;\n /** Every row's height, in px; 0 until one has been measured. */\n readonly rowHeight: number;\n readonly viewportHeight: number;\n readonly scrollTop: number;\n /** Extra rows rendered above and below the viewport. */\n readonly overscan: number;\n}\n\n/** Rows `start` (inclusive) to `end` (exclusive). */\nexport function rowWindow({\n rowCount,\n rowHeight,\n viewportHeight,\n scrollTop,\n overscan,\n}: RowWindowInput): { start: number; end: number } {\n if (rowCount === 0) return { start: 0, end: 0 };\n if (rowHeight <= 0) return { start: 0, end: Math.min(rowCount, FIRST_BATCH) };\n\n // Past the end — a scroll position left over from longer data — the window\n // settles on the last screenful rather than on nothing.\n const fits = Math.ceil(viewportHeight / rowHeight);\n const first = Math.min(Math.floor(scrollTop / rowHeight), Math.max(0, rowCount - fits));\n const last = Math.ceil((scrollTop + viewportHeight) / rowHeight);\n\n return {\n start: Math.max(0, first - overscan),\n end: Math.min(rowCount, last + overscan),\n };\n}\n","import { css, html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { KtElement, defineElement } from '#internal/kt-element';\nimport { emit } from '#internal/events';\nimport { resolveLocale } from '#internal/locale';\nimport { strings } from '#internal/strings';\nimport '../../core/kt-icon/kt-icon.js';\nimport '../kt-pagination/kt-pagination.js';\nimport { rowWindow } from './window.js';\n\nexport type KtSortDirection = 'asc' | 'desc' | null;\nexport type KtTableRow = Record<string, unknown>;\n\nexport interface KtTableColumn {\n /** Key into the row object. */\n readonly key: string;\n /** Header text. Falls back to `key`. */\n readonly label?: string;\n readonly sortable?: boolean;\n readonly align?: 'left' | 'center' | 'right';\n /** Any CSS width. */\n readonly width?: string;\n}\n\nexport interface KtSortState {\n readonly key: string | null;\n readonly direction: KtSortDirection;\n}\n\n/** Renders a cell. Return `undefined` to fall back to the raw value. */\nexport type KtCellRenderer = (row: KtTableRow, column: KtTableColumn) => unknown;\n\n/** Rows rendered above and below the viewport of a virtual table. */\nconst OVERSCAN = 8;\n\nconst collators = new Map<string, Intl.Collator>();\n\n/**\n * A collator for `locale`, made once. Locale-aware, so each language files\n * accented letters its own way — \"Ångström\" next to \"Angstrom\" in English,\n * after \"Zeta\" in Swedish. `numeric` also makes \"Entity 2\" precede\n * \"Entity 10\".\n */\nfunction collatorFor(locale: string): Intl.Collator {\n let collator = collators.get(locale);\n if (!collator) {\n collator = new Intl.Collator(locale, { numeric: true, sensitivity: 'base' });\n collators.set(locale, collator);\n }\n return collator;\n}\n\n/**\n * A sortable string for any cell value.\n *\n * Objects get their JSON rather than \"[object Object]\", which at least sorts\n * consistently instead of collapsing every object in the column to one key.\n */\nfunction sortableText(value: unknown): string {\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {\n return String(value);\n }\n try {\n return JSON.stringify(value) ?? '';\n } catch {\n return '';\n }\n}\n\n/** A row's identity: `id`, else `uid`, else the row itself. */\nfunction rowKey(row: KtTableRow): unknown {\n return row['id'] ?? row['uid'] ?? row;\n}\n\n/**\n * A data table: tri-state sorting, single or multiple selection, paging.\n *\n * @element kt-table\n *\n * @csspart table - The `<table>`.\n * @csspart header-cell - A `<th>`.\n * @csspart row - A `<tr>`.\n * @csspart cell - A `<td>`.\n *\n * @fires kt-sort-change - Sorting changed. `detail: { key, direction }`.\n * @fires kt-selection-change - Selection changed. `detail: { selected, rows }`.\n * @fires kt-row-click - A row was clicked. `detail: { row, index }`.\n * @fires kt-page-change - The page changed. `detail: { page }`.\n *\n * @example\n * ```js\n * table.columns = [\n * { key: 'name', label: 'Name', sortable: true },\n * { key: 'amount', label: 'Amount', sortable: true, align: 'right' },\n * ];\n * table.data = rows;\n * ```\n */\nexport class KtTable extends KtElement {\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: block;\n width: 100%;\n color: var(--text-body);\n font: var(--font-normal-regular);\n }\n\n .scroller {\n overflow: auto;\n border-radius: var(--border-radius);\n }\n\n table {\n width: 100%;\n min-width: 600px;\n border-spacing: 0;\n border-collapse: separate;\n }\n\n thead {\n background: var(--surface-card);\n color: var(--text-muted);\n }\n\n th {\n padding: 16px 18px;\n font-size: 13px;\n font-weight: inherit;\n text-align: left;\n white-space: nowrap;\n vertical-align: middle;\n user-select: none;\n }\n\n /* Sortable headers are buttons, not clickable <th>s: a header you can\n only sort with a mouse is a table half the users cannot sort. */\n th button {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 0;\n color: inherit;\n font: inherit;\n text-align: inherit;\n background: none;\n border: none;\n cursor: pointer;\n }\n\n th button:focus-visible {\n outline: var(--outline-width) solid var(--color-primary-base);\n outline-offset: 2px;\n }\n\n .indicator {\n display: inline-flex;\n color: var(--color-primary-text);\n }\n\n tbody tr {\n transition: background-color var(--duration-instant) linear;\n }\n\n table[aria-busy='true'] tbody {\n opacity: 0.5;\n transition: opacity var(--duration-fast) var(--easing-standard);\n }\n\n tbody tr:hover {\n background: var(--color-dark-14);\n }\n\n tbody tr.selected {\n background: var(--color-primary-soft);\n }\n\n td {\n padding: 14px 18px;\n font-size: 14px;\n border-bottom: var(--border-width) solid var(--surface-hover);\n }\n\n :host([compact]) td {\n padding: 8px 12px;\n }\n\n /* === VIRTUAL ===\n The table scrolls inside its own box, whose height the page sets,\n and the header stays on top of the rows passing under it. */\n :host([virtual]) {\n display: flex;\n flex-direction: column;\n }\n :host([virtual]) .scroller {\n flex: 1;\n min-height: 0;\n }\n :host([virtual]) thead th {\n position: sticky;\n top: 0;\n z-index: 1;\n background: var(--surface-card);\n }\n\n /* Stand-ins for the rows above and below the window: height only. */\n tbody tr.spacer,\n tbody tr.spacer:hover {\n background: none;\n }\n tr.spacer td {\n padding: 0;\n border: none;\n }\n :host([compact]) th {\n padding: 10px 12px;\n }\n\n .select-cell {\n width: 56px;\n text-align: center;\n }\n\n .placeholder {\n padding: 28px 0;\n color: var(--text-muted);\n text-align: center;\n }\n\n footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 12px;\n padding-top: 12px;\n }\n\n @media (max-width: 680px) {\n table {\n min-width: 100%;\n }\n td,\n th {\n padding: 10px 12px;\n }\n }\n `,\n ];\n\n /** The page on screen, from 1. Set it to open on another page. */\n @property({ type: Number })\n page = 1;\n\n /**\n * For data sorted and paged on a server: `data` is the current page, shown\n * as given. Headers and the pager still update the state and fire their\n * events, and the application loads what they ask for.\n */\n @property({ type: Boolean, reflect: true })\n manual = false;\n\n /**\n * Renders only the rows in view, for thousands of rows without paging. The\n * table scrolls inside its own box: give it a height (`kt-table { height:\n * 480px }`). Every row must be the same height — the first one rendered is\n * measured. A page size takes precedence.\n */\n @property({ type: Boolean, reflect: true })\n virtual = false;\n\n /** How far the scroller is scrolled. Not `scrollTop`, which the host already has. */\n @state()\n private scrollOffset = 0;\n\n /** The scroller's height, and the header's inside it, in px. */\n @state()\n private viewportHeight = 0;\n\n @state()\n private headerHeight = 0;\n\n /** A body row's height, in px; 0 until one has been measured. */\n @state()\n private rowHeight = 0;\n\n private resizeObserver: ResizeObserver | undefined;\n private observed: Element | undefined;\n\n /** In manual mode, how many rows the server holds — what the pager counts. */\n @property({ type: Number, attribute: 'total-rows' })\n totalRows = 0;\n\n @property({ attribute: false })\n columns: readonly KtTableColumn[] = [];\n\n @property({ attribute: false })\n data: readonly KtTableRow[] = [];\n\n @property({ type: Boolean, reflect: true })\n selectable = false;\n\n @property({ type: String, attribute: 'selection-mode' })\n selectionMode: 'single' | 'multiple' = 'multiple';\n\n /** The identities of the selected rows. */\n @property({ attribute: false })\n selected: readonly unknown[] = [];\n\n /** Rows per page. Zero shows everything and hides the footer. */\n @property({ type: Number, attribute: 'page-size' })\n pageSize = 0;\n\n @property({ type: Boolean, reflect: true })\n loading = false;\n\n @property({ type: Boolean, reflect: true })\n compact = false;\n\n @property({ type: String, attribute: 'sort-key' })\n sortKey: string | null = null;\n\n @property({ type: String, attribute: 'sort-direction' })\n sortDirection: KtSortDirection = null;\n\n /** Renders a cell. Return `undefined` to fall back to the raw value. */\n @property({ attribute: false })\n renderCell: KtCellRenderer | undefined;\n\n @property({ type: String, attribute: 'empty-text' })\n emptyText: string | undefined = undefined;\n\n @property({ type: String, attribute: 'loading-text' })\n loadingText: string | undefined = undefined;\n\n /** Accessible name for the table. */\n @property({ type: String })\n label = '';\n\n /**\n * BCP 47 locale text is sorted in. Empty means the page's `<html lang>`,\n * then the browser's language.\n */\n @property({ type: String })\n locale = '';\n\n /** The last sort, and what it was computed from. */\n private sortCache:\n | {\n data: readonly KtTableRow[];\n key: string | null;\n direction: KtSortDirection;\n locale: string;\n rows: readonly KtTableRow[];\n }\n | undefined;\n\n /**\n * The rows after sorting, before paging.\n *\n * Sorted once per change of `data`, `sortKey`, `sortDirection` or locale, not on\n * every render: hovering a row or ticking a box re-renders the table, and\n * re-sorting a few thousand rows each time is what made that lag. Assign a\n * new array to `data` rather than changing it in place.\n */\n get sortedRows(): readonly KtTableRow[] {\n if (this.manual) return this.data;\n\n const cache = this.sortCache;\n const locale = resolveLocale(this.locale);\n if (\n cache?.data === this.data &&\n cache.key === this.sortKey &&\n cache.direction === this.sortDirection &&\n cache.locale === locale\n ) {\n return cache.rows;\n }\n\n const rows = this.sort(collatorFor(locale));\n this.sortCache = {\n data: this.data,\n key: this.sortKey,\n direction: this.sortDirection,\n locale,\n rows,\n };\n return rows;\n }\n\n private sort(collator: Intl.Collator): readonly KtTableRow[] {\n if (!this.sortKey || !this.sortDirection) return this.data;\n\n const key = this.sortKey;\n const sign = this.sortDirection === 'asc' ? 1 : -1;\n\n return [...this.data].sort((a, b) => {\n const left = a[key];\n const right = b[key];\n\n // Empty values sort to the end whichever way the column points, so a\n // descending sort does not open with a screen of blanks.\n const leftEmpty = left === null || left === undefined;\n const rightEmpty = right === null || right === undefined;\n if (leftEmpty && rightEmpty) return 0;\n if (leftEmpty) return 1;\n if (rightEmpty) return -1;\n\n if (typeof left === 'number' && typeof right === 'number') return (left - right) * sign;\n return collator.compare(sortableText(left), sortableText(right)) * sign;\n });\n }\n\n get totalPages(): number {\n if (this.pageSize <= 0) return 1;\n const rows = this.manual ? this.totalRows || this.data.length : this.data.length;\n return Math.max(1, Math.ceil(rows / this.pageSize));\n }\n\n /** The rows actually on screen. */\n get visibleRows(): readonly KtTableRow[] {\n const rows = this.sortedRows;\n if (this.pageSize <= 0 || this.manual) return rows;\n\n const page = Math.min(this.page, this.totalPages);\n return rows.slice((page - 1) * this.pageSize, page * this.pageSize);\n }\n\n /**\n * Cycles a column: unsorted → ascending → descending → unsorted. The third\n * press restoring the original order is what makes sorting undoable.\n */\n private toggleSort(column: KtTableColumn): void {\n if (!column.sortable) return;\n\n if (this.sortKey !== column.key) {\n this.sortKey = column.key;\n this.sortDirection = 'asc';\n } else if (this.sortDirection === 'asc') {\n this.sortDirection = 'desc';\n } else {\n this.sortKey = null;\n this.sortDirection = null;\n }\n // A new order starts from its first page. No kt-page-change: the sort\n // event is the one reload the application needs.\n if (this.manual) this.page = 1;\n\n emit(this, 'kt-sort-change', { key: this.sortKey, direction: this.sortDirection });\n }\n\n private isSelected(row: KtTableRow): boolean {\n return this.selected.includes(rowKey(row));\n }\n\n private toggleSelection(row: KtTableRow): void {\n const key = rowKey(row);\n\n if (this.selectionMode === 'single') {\n this.selected = this.isSelected(row) ? [] : [key];\n } else {\n this.selected = this.isSelected(row)\n ? this.selected.filter((candidate) => candidate !== key)\n : [...this.selected, key];\n }\n\n emit(this, 'kt-selection-change', { selected: this.selected, rows: this.selectedRows });\n }\n\n /** Selects or clears every row on the current page. */\n private toggleAll(): void {\n const rows = this.visibleRows;\n const keys = rows.map(rowKey);\n const allSelected = keys.every((key) => this.selected.includes(key));\n\n this.selected = allSelected\n ? this.selected.filter((key) => !keys.includes(key))\n : [...new Set([...this.selected, ...keys])];\n\n emit(this, 'kt-selection-change', { selected: this.selected, rows: this.selectedRows });\n }\n\n /** The selected rows themselves, not just their identities. */\n get selectedRows(): readonly KtTableRow[] {\n return this.data.filter((row) => this.selected.includes(rowKey(row)));\n }\n\n /** Virtual rendering, unless a page size pages the rows instead. */\n private get isVirtual(): boolean {\n return this.virtual && this.pageSize <= 0;\n }\n\n private onScroll = (event: Event): void => {\n this.scrollOffset = (event.currentTarget as HTMLElement).scrollTop;\n };\n\n // Untyped: the measurements are private, so not among PropertyValues<this>.\n override updated(changed: PropertyValues): void {\n if (changed.has('compact')) this.rowHeight = 0;\n if (!this.isVirtual) {\n this.observe(undefined);\n return;\n }\n\n const scroller = this.shadowRoot?.querySelector<HTMLElement>('.scroller') ?? undefined;\n this.observe(scroller);\n\n // Measured from what was just rendered; each assignment is a no-op once\n // the numbers settle, so this converges in one extra render.\n const row = this.shadowRoot?.querySelector<HTMLElement>('tbody tr[part=\"row\"]');\n if (row && this.rowHeight === 0) this.rowHeight = row.getBoundingClientRect().height;\n const header = this.shadowRoot?.querySelector('thead');\n if (header) this.headerHeight = header.getBoundingClientRect().height;\n if (scroller) this.viewportHeight = scroller.clientHeight;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observe(undefined);\n }\n\n /** Follows the scroller's height, which the page can change at any time. */\n private observe(scroller: HTMLElement | undefined): void {\n if (scroller === this.observed) return;\n this.resizeObserver?.disconnect();\n this.observed = scroller;\n if (!scroller || typeof ResizeObserver === 'undefined') return;\n\n this.resizeObserver ??= new ResizeObserver(([entry]) => {\n if (entry) this.viewportHeight = (entry.target as HTMLElement).clientHeight;\n });\n this.resizeObserver.observe(scroller);\n }\n\n private onPageChange(event: Event): void {\n event.stopPropagation();\n this.page = (event as CustomEvent<{ page: number }>).detail.page;\n emit(this, 'kt-page-change', { page: this.page });\n }\n\n /**\n * The aria-sort value for a column.\n *\n * Not named ariaSort: HTMLElement reflects that ARIA attribute as a string\n * property, and shadowing it with a method breaks the element's own typing.\n */\n private sortStateFor(column: KtTableColumn): 'ascending' | 'descending' | 'none' {\n if (this.sortKey !== column.key || !this.sortDirection) return 'none';\n return this.sortDirection === 'asc' ? 'ascending' : 'descending';\n }\n\n private renderHeaderCell(column: KtTableColumn): TemplateResult {\n const title = column.label ?? column.key;\n const active = this.sortKey === column.key && this.sortDirection !== null;\n\n return html`<th\n part=\"header-cell\"\n scope=\"col\"\n style=${styleMap(column.width ? { width: column.width } : {})}\n aria-sort=${this.sortStateFor(column)}\n >\n ${\n column.sortable\n ? html`<button type=\"button\" @click=${() => this.toggleSort(column)}>\n <span>${title}</span>\n <span class=\"indicator\" aria-hidden=\"true\">\n ${\n active\n ? html`<kt-icon\n name=${this.sortDirection === 'asc' ? 'arrow-up' : 'arrow-down'}\n size=\"14\"\n ></kt-icon>`\n : nothing\n }\n </span>\n </button>`\n : html`<span>${title}</span>`\n }\n </th>`;\n }\n\n private renderBody(): TemplateResult {\n const rows = this.visibleRows;\n const columnCount = this.columns.length + (this.selectable ? 1 : 0);\n\n if (rows.length === 0) {\n return html`<tr>\n <td colspan=${columnCount}>\n <div class=\"placeholder\">${this.emptyText ?? strings().noData}</div>\n </td>\n </tr>`;\n }\n\n if (!this.isVirtual) {\n return html`${rows.map((row, index) => this.renderRow(row, index))}`;\n }\n\n const { start, end } = rowWindow({\n rowCount: rows.length,\n rowHeight: this.rowHeight,\n viewportHeight: Math.max(0, this.viewportHeight - this.headerHeight),\n scrollTop: Math.max(0, this.scrollOffset - this.headerHeight),\n overscan: OVERSCAN,\n });\n const spacer = (count: number) =>\n count > 0 && this.rowHeight > 0\n ? html`<tr class=\"spacer\" aria-hidden=\"true\">\n <td colspan=${columnCount} style=${`height: ${count * this.rowHeight}px`}></td>\n </tr>`\n : nothing;\n\n return html`${spacer(start)}${rows\n .slice(start, end)\n .map((row, offset) => this.renderRow(row, start + offset))}${spacer(rows.length - end)}`;\n }\n\n /** `index` counts from the first row of the data, not of the rows rendered. */\n private renderRow(row: KtTableRow, index: number): TemplateResult {\n const selected = this.isSelected(row);\n\n return html`<tr\n part=\"row\"\n class=${classMap({ selected })}\n aria-selected=${this.selectable ? String(selected) : nothing}\n aria-rowindex=${this.isVirtual ? index + 2 : nothing}\n @click=${() => emit(this, 'kt-row-click', { row, index })}\n >\n ${\n this.selectable\n ? html`<td class=\"select-cell\">\n <input\n type=${this.selectionMode === 'single' ? 'radio' : 'checkbox'}\n name=${this.selectionMode === 'single' ? 'kt-table-selection' : nothing}\n .checked=${selected}\n aria-label=${strings().selectRow}\n @click=${(event: Event) => event.stopPropagation()}\n @change=${() => this.toggleSelection(row)}\n />\n </td>`\n : nothing\n }\n ${this.columns.map((column) => {\n const rendered = this.renderCell?.(row, column);\n return html`<td part=\"cell\" style=${styleMap({ textAlign: column.align ?? 'left' })}>\n ${rendered === undefined ? row[column.key] : rendered}\n </td>`;\n })}\n </tr>`;\n }\n\n override render(): TemplateResult {\n // A manual table reloading a page keeps the one on screen, dimmed, so the\n // pager that asked for it — and the focus on it — stay where they are.\n const reloading = this.loading && this.manual && this.data.length > 0;\n if (this.loading && !reloading) {\n return html`<div class=\"placeholder\" role=\"status\" aria-live=\"polite\">\n ${this.loadingText ?? strings().loading}\n </div>`;\n }\n\n const rows = this.visibleRows;\n const allSelected = rows.length > 0 && rows.every((row) => this.isSelected(row));\n const someSelected = rows.some((row) => this.isSelected(row));\n\n const virtual = this.isVirtual;\n\n return html`<div class=\"scroller\" @scroll=${virtual ? this.onScroll : nothing}>\n <table\n part=\"table\"\n aria-label=${this.label || nothing}\n aria-busy=${reloading ? 'true' : nothing}\n aria-rowcount=${virtual ? rows.length + 1 : nothing}\n >\n <thead>\n <tr aria-rowindex=${virtual ? 1 : nothing}>\n ${\n this.selectable\n ? html`<th class=\"select-cell\" scope=\"col\">\n ${\n this.selectionMode === 'multiple'\n ? html`<input\n type=\"checkbox\"\n .checked=${allSelected}\n .indeterminate=${someSelected && !allSelected}\n aria-label=${strings().selectAll}\n @change=${this.toggleAll}\n />`\n : nothing\n }\n </th>`\n : nothing\n }\n ${this.columns.map((column) => this.renderHeaderCell(column))}\n </tr>\n </thead>\n <tbody>\n ${this.renderBody()}\n </tbody>\n </table>\n </div>\n\n ${\n this.pageSize > 0\n ? html`<footer>\n <kt-pagination\n .page=${Math.min(this.page, this.totalPages)}\n .totalPages=${this.totalPages}\n @kt-page-change=${this.onPageChange}\n ></kt-pagination>\n </footer>`\n : nothing\n }`;\n }\n}\n\ndefineElement('kt-table', KtTable);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kt-table': KtTable;\n }\n}\n"],"names":["FIRST_BATCH","rowWindow","rowCount","rowHeight","viewportHeight","scrollTop","overscan","fits","first","last","OVERSCAN","collators","collatorFor","locale","collator","sortableText","value","rowKey","row","KtTable","KtElement","event","css","cache","resolveLocale","rows","key","sign","a","b","left","right","leftEmpty","rightEmpty","page","column","emit","candidate","keys","allSelected","changed","scroller","header","entry","title","active","html","styleMap","nothing","columnCount","strings","index","start","end","spacer","count","offset","selected","classMap","rendered","reloading","someSelected","virtual","__decorateClass","property","state","defineElement"],"mappings":";;;;;;;;;;AAOA,MAAMA,IAAc;AAab,SAASC,EAAU;AAAA,EACxB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAA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AA,GA/Of7C,EAgPX,WAAA,OAAA;AAOA4C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAtPf7C,EAuPX,WAAA,QAAA;AAmXF+C,EAAc,YAAY/C,CAAO;"}
|
|
1
|
+
{"version":3,"file":"kt-table.js","sources":["../../../../src/components/data/kt-table/window.ts","../../../../src/components/data/kt-table/kt-table.ts"],"sourcesContent":["/**\n * Which rows a virtual table renders: those under the viewport, and a few\n * either side so a fast scroll does not show blank space before the next\n * render lands.\n */\n\n/** Rendered before the first row has been measured, to measure it. */\nconst FIRST_BATCH = 50;\n\nexport interface RowWindowInput {\n readonly rowCount: number;\n /** Every row's height, in px; 0 until one has been measured. */\n readonly rowHeight: number;\n readonly viewportHeight: number;\n readonly scrollTop: number;\n /** Extra rows rendered above and below the viewport. */\n readonly overscan: number;\n}\n\n/** Rows `start` (inclusive) to `end` (exclusive). */\nexport function rowWindow({\n rowCount,\n rowHeight,\n viewportHeight,\n scrollTop,\n overscan,\n}: RowWindowInput): { start: number; end: number } {\n if (rowCount === 0) return { start: 0, end: 0 };\n if (rowHeight <= 0) return { start: 0, end: Math.min(rowCount, FIRST_BATCH) };\n\n // Past the end — a scroll position left over from longer data — the window\n // settles on the last screenful rather than on nothing.\n const fits = Math.ceil(viewportHeight / rowHeight);\n const first = Math.min(Math.floor(scrollTop / rowHeight), Math.max(0, rowCount - fits));\n const last = Math.ceil((scrollTop + viewportHeight) / rowHeight);\n\n return {\n start: Math.max(0, first - overscan),\n end: Math.min(rowCount, last + overscan),\n };\n}\n","import { css, html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { KtElement, defineElement } from '#internal/kt-element';\nimport { emit } from '#internal/events';\nimport { resolveLocale } from '#internal/locale';\nimport { strings } from '#internal/strings';\nimport '../../core/kt-icon/kt-icon.js';\nimport '../kt-pagination/kt-pagination.js';\nimport { rowWindow } from './window.js';\n\nexport type KtSortDirection = 'asc' | 'desc' | null;\nexport type KtTableRow = Record<string, unknown>;\n\nexport interface KtTableColumn {\n /** Key into the row object. */\n readonly key: string;\n /** Header text. Falls back to `key`. */\n readonly label?: string;\n readonly sortable?: boolean;\n readonly align?: 'left' | 'center' | 'right';\n /** Any CSS width. */\n readonly width?: string;\n}\n\nexport interface KtSortState {\n readonly key: string | null;\n readonly direction: KtSortDirection;\n}\n\n/** Renders a cell. Return `undefined` to fall back to the raw value. */\nexport type KtCellRenderer = (row: KtTableRow, column: KtTableColumn) => unknown;\n\n/** Rows rendered above and below the viewport of a virtual table. */\nconst OVERSCAN = 8;\n\nconst collators = new Map<string, Intl.Collator>();\n\n/**\n * A collator for `locale`, made once. Locale-aware, so each language files\n * accented letters its own way — \"Ångström\" next to \"Angstrom\" in English,\n * after \"Zeta\" in Swedish. `numeric` also makes \"Entity 2\" precede\n * \"Entity 10\".\n */\nfunction collatorFor(locale: string): Intl.Collator {\n let collator = collators.get(locale);\n if (!collator) {\n collator = new Intl.Collator(locale, { numeric: true, sensitivity: 'base' });\n collators.set(locale, collator);\n }\n return collator;\n}\n\n/**\n * A sortable string for any cell value.\n *\n * Objects get their JSON rather than \"[object Object]\", which at least sorts\n * consistently instead of collapsing every object in the column to one key.\n */\nfunction sortableText(value: unknown): string {\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {\n return String(value);\n }\n try {\n return JSON.stringify(value) ?? '';\n } catch {\n return '';\n }\n}\n\n/** A row's identity: `id`, else `uid`, else the row itself. */\nfunction rowKey(row: KtTableRow): unknown {\n return row['id'] ?? row['uid'] ?? row;\n}\n\n/**\n * A data table: tri-state sorting, single or multiple selection, paging.\n *\n * @element kt-table\n *\n * @csspart table - The `<table>`.\n * @csspart header-cell - A `<th>`.\n * @csspart row - A `<tr>`.\n * @csspart cell - A `<td>`.\n *\n * @fires kt-sort-change - Sorting changed. `detail: { key, direction }`.\n * @fires kt-selection-change - Selection changed. `detail: { selected, rows }`.\n * @fires kt-row-click - A row was clicked. `detail: { row, index }`.\n * @fires kt-page-change - The page changed. `detail: { page }`.\n *\n * @example\n * ```js\n * table.columns = [\n * { key: 'name', label: 'Name', sortable: true },\n * { key: 'amount', label: 'Amount', sortable: true, align: 'right' },\n * ];\n * table.data = rows;\n * ```\n */\nexport class KtTable extends KtElement {\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: block;\n width: 100%;\n color: var(--text-body);\n font: var(--font-normal-regular);\n }\n\n .scroller {\n overflow: auto;\n border-radius: var(--border-radius);\n }\n\n table {\n width: 100%;\n min-width: 600px;\n border-spacing: 0;\n border-collapse: separate;\n }\n\n thead {\n background: var(--surface-card);\n color: var(--text-muted);\n }\n\n th {\n padding: calc(16px * var(--density-scale, 1)) calc(18px * var(--density-scale, 1));\n font-size: calc(13px * var(--text-scale, 1));\n font-weight: inherit;\n text-align: left;\n white-space: nowrap;\n vertical-align: middle;\n user-select: none;\n }\n\n /* Sortable headers are buttons, not clickable <th>s: a header you can\n only sort with a mouse is a table half the users cannot sort. */\n th button {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 0;\n color: inherit;\n font: inherit;\n text-align: inherit;\n background: none;\n border: none;\n cursor: pointer;\n }\n\n th button:focus-visible {\n outline: var(--outline-width) solid var(--color-primary-base);\n outline-offset: 2px;\n }\n\n .indicator {\n display: inline-flex;\n color: var(--color-primary-text);\n }\n\n tbody tr {\n transition: background-color var(--duration-instant) linear;\n }\n\n table[aria-busy='true'] tbody {\n opacity: 0.5;\n transition: opacity var(--duration-fast) var(--easing-standard);\n }\n\n tbody tr:hover {\n background: var(--color-dark-14);\n }\n\n tbody tr.selected {\n background: var(--color-primary-soft);\n }\n\n td {\n padding: calc(14px * var(--density-scale, 1)) calc(18px * var(--density-scale, 1));\n font-size: calc(14px * var(--text-scale, 1));\n border-bottom: var(--border-width) solid var(--surface-hover);\n }\n\n :host([compact]) td {\n padding: calc(8px * var(--density-scale, 1)) calc(12px * var(--density-scale, 1));\n }\n\n /* === VIRTUAL ===\n The table scrolls inside its own box, whose height the page sets,\n and the header stays on top of the rows passing under it. */\n :host([virtual]) {\n display: flex;\n flex-direction: column;\n }\n :host([virtual]) .scroller {\n flex: 1;\n min-height: 0;\n }\n :host([virtual]) thead th {\n position: sticky;\n top: 0;\n z-index: 1;\n background: var(--surface-card);\n }\n\n /* Stand-ins for the rows above and below the window: height only. */\n tbody tr.spacer,\n tbody tr.spacer:hover {\n background: none;\n }\n tr.spacer td {\n padding: 0;\n border: none;\n }\n :host([compact]) th {\n padding: calc(10px * var(--density-scale, 1)) calc(12px * var(--density-scale, 1));\n }\n\n .select-cell {\n width: 56px;\n text-align: center;\n }\n\n .placeholder {\n padding: calc(28px * var(--density-scale, 1)) 0;\n color: var(--text-muted);\n text-align: center;\n }\n\n footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 12px;\n padding-top: 12px;\n }\n\n @media (max-width: 680px) {\n table {\n min-width: 100%;\n }\n td,\n th {\n padding: calc(10px * var(--density-scale, 1)) calc(12px * var(--density-scale, 1));\n }\n }\n `,\n ];\n\n /** The page on screen, from 1. Set it to open on another page. */\n @property({ type: Number })\n page = 1;\n\n /**\n * For data sorted and paged on a server: `data` is the current page, shown\n * as given. Headers and the pager still update the state and fire their\n * events, and the application loads what they ask for.\n */\n @property({ type: Boolean, reflect: true })\n manual = false;\n\n /**\n * Renders only the rows in view, for thousands of rows without paging. The\n * table scrolls inside its own box: give it a height (`kt-table { height:\n * 480px }`). Every row must be the same height — the first one rendered is\n * measured. A page size takes precedence.\n */\n @property({ type: Boolean, reflect: true })\n virtual = false;\n\n /** How far the scroller is scrolled. Not `scrollTop`, which the host already has. */\n @state()\n private scrollOffset = 0;\n\n /** The scroller's height, and the header's inside it, in px. */\n @state()\n private viewportHeight = 0;\n\n @state()\n private headerHeight = 0;\n\n /** A body row's height, in px; 0 until one has been measured. */\n @state()\n private rowHeight = 0;\n\n private resizeObserver: ResizeObserver | undefined;\n private observed: Element | undefined;\n\n /** In manual mode, how many rows the server holds — what the pager counts. */\n @property({ type: Number, attribute: 'total-rows' })\n totalRows = 0;\n\n @property({ attribute: false })\n columns: readonly KtTableColumn[] = [];\n\n @property({ attribute: false })\n data: readonly KtTableRow[] = [];\n\n @property({ type: Boolean, reflect: true })\n selectable = false;\n\n @property({ type: String, attribute: 'selection-mode' })\n selectionMode: 'single' | 'multiple' = 'multiple';\n\n /** The identities of the selected rows. */\n @property({ attribute: false })\n selected: readonly unknown[] = [];\n\n /** Rows per page. Zero shows everything and hides the footer. */\n @property({ type: Number, attribute: 'page-size' })\n pageSize = 0;\n\n @property({ type: Boolean, reflect: true })\n loading = false;\n\n @property({ type: Boolean, reflect: true })\n compact = false;\n\n @property({ type: String, attribute: 'sort-key' })\n sortKey: string | null = null;\n\n @property({ type: String, attribute: 'sort-direction' })\n sortDirection: KtSortDirection = null;\n\n /** Renders a cell. Return `undefined` to fall back to the raw value. */\n @property({ attribute: false })\n renderCell: KtCellRenderer | undefined;\n\n @property({ type: String, attribute: 'empty-text' })\n emptyText: string | undefined = undefined;\n\n @property({ type: String, attribute: 'loading-text' })\n loadingText: string | undefined = undefined;\n\n /** Accessible name for the table. */\n @property({ type: String })\n label = '';\n\n /**\n * BCP 47 locale text is sorted in. Empty means the page's `<html lang>`,\n * then the browser's language.\n */\n @property({ type: String })\n locale = '';\n\n /** The last sort, and what it was computed from. */\n private sortCache:\n | {\n data: readonly KtTableRow[];\n key: string | null;\n direction: KtSortDirection;\n locale: string;\n rows: readonly KtTableRow[];\n }\n | undefined;\n\n /**\n * The rows after sorting, before paging.\n *\n * Sorted once per change of `data`, `sortKey`, `sortDirection` or locale, not on\n * every render: hovering a row or ticking a box re-renders the table, and\n * re-sorting a few thousand rows each time is what made that lag. Assign a\n * new array to `data` rather than changing it in place.\n */\n get sortedRows(): readonly KtTableRow[] {\n if (this.manual) return this.data;\n\n const cache = this.sortCache;\n const locale = resolveLocale(this.locale);\n if (\n cache?.data === this.data &&\n cache.key === this.sortKey &&\n cache.direction === this.sortDirection &&\n cache.locale === locale\n ) {\n return cache.rows;\n }\n\n const rows = this.sort(collatorFor(locale));\n this.sortCache = {\n data: this.data,\n key: this.sortKey,\n direction: this.sortDirection,\n locale,\n rows,\n };\n return rows;\n }\n\n private sort(collator: Intl.Collator): readonly KtTableRow[] {\n if (!this.sortKey || !this.sortDirection) return this.data;\n\n const key = this.sortKey;\n const sign = this.sortDirection === 'asc' ? 1 : -1;\n\n return [...this.data].sort((a, b) => {\n const left = a[key];\n const right = b[key];\n\n // Empty values sort to the end whichever way the column points, so a\n // descending sort does not open with a screen of blanks.\n const leftEmpty = left === null || left === undefined;\n const rightEmpty = right === null || right === undefined;\n if (leftEmpty && rightEmpty) return 0;\n if (leftEmpty) return 1;\n if (rightEmpty) return -1;\n\n if (typeof left === 'number' && typeof right === 'number') return (left - right) * sign;\n return collator.compare(sortableText(left), sortableText(right)) * sign;\n });\n }\n\n get totalPages(): number {\n if (this.pageSize <= 0) return 1;\n const rows = this.manual ? this.totalRows || this.data.length : this.data.length;\n return Math.max(1, Math.ceil(rows / this.pageSize));\n }\n\n /** The rows actually on screen. */\n get visibleRows(): readonly KtTableRow[] {\n const rows = this.sortedRows;\n if (this.pageSize <= 0 || this.manual) return rows;\n\n const page = Math.min(this.page, this.totalPages);\n return rows.slice((page - 1) * this.pageSize, page * this.pageSize);\n }\n\n /**\n * Cycles a column: unsorted → ascending → descending → unsorted. The third\n * press restoring the original order is what makes sorting undoable.\n */\n private toggleSort(column: KtTableColumn): void {\n if (!column.sortable) return;\n\n if (this.sortKey !== column.key) {\n this.sortKey = column.key;\n this.sortDirection = 'asc';\n } else if (this.sortDirection === 'asc') {\n this.sortDirection = 'desc';\n } else {\n this.sortKey = null;\n this.sortDirection = null;\n }\n // A new order starts from its first page. No kt-page-change: the sort\n // event is the one reload the application needs.\n if (this.manual) this.page = 1;\n\n emit(this, 'kt-sort-change', { key: this.sortKey, direction: this.sortDirection });\n }\n\n private isSelected(row: KtTableRow): boolean {\n return this.selected.includes(rowKey(row));\n }\n\n private toggleSelection(row: KtTableRow): void {\n const key = rowKey(row);\n\n if (this.selectionMode === 'single') {\n this.selected = this.isSelected(row) ? [] : [key];\n } else {\n this.selected = this.isSelected(row)\n ? this.selected.filter((candidate) => candidate !== key)\n : [...this.selected, key];\n }\n\n emit(this, 'kt-selection-change', { selected: this.selected, rows: this.selectedRows });\n }\n\n /** Selects or clears every row on the current page. */\n private toggleAll(): void {\n const rows = this.visibleRows;\n const keys = rows.map(rowKey);\n const allSelected = keys.every((key) => this.selected.includes(key));\n\n this.selected = allSelected\n ? this.selected.filter((key) => !keys.includes(key))\n : [...new Set([...this.selected, ...keys])];\n\n emit(this, 'kt-selection-change', { selected: this.selected, rows: this.selectedRows });\n }\n\n /** The selected rows themselves, not just their identities. */\n get selectedRows(): readonly KtTableRow[] {\n return this.data.filter((row) => this.selected.includes(rowKey(row)));\n }\n\n /** Virtual rendering, unless a page size pages the rows instead. */\n private get isVirtual(): boolean {\n return this.virtual && this.pageSize <= 0;\n }\n\n private onScroll = (event: Event): void => {\n this.scrollOffset = (event.currentTarget as HTMLElement).scrollTop;\n };\n\n // Untyped: the measurements are private, so not among PropertyValues<this>.\n override updated(changed: PropertyValues): void {\n if (changed.has('compact')) this.rowHeight = 0;\n if (!this.isVirtual) {\n this.observe(undefined);\n return;\n }\n\n const scroller = this.shadowRoot?.querySelector<HTMLElement>('.scroller') ?? undefined;\n this.observe(scroller);\n\n // Measured from what was just rendered; each assignment is a no-op once\n // the numbers settle, so this converges in one extra render.\n const row = this.shadowRoot?.querySelector<HTMLElement>('tbody tr[part=\"row\"]');\n if (row && this.rowHeight === 0) this.rowHeight = row.getBoundingClientRect().height;\n const header = this.shadowRoot?.querySelector('thead');\n if (header) this.headerHeight = header.getBoundingClientRect().height;\n if (scroller) this.viewportHeight = scroller.clientHeight;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observe(undefined);\n }\n\n /** Follows the scroller's height, which the page can change at any time. */\n private observe(scroller: HTMLElement | undefined): void {\n if (scroller === this.observed) return;\n this.resizeObserver?.disconnect();\n this.observed = scroller;\n if (!scroller || typeof ResizeObserver === 'undefined') return;\n\n this.resizeObserver ??= new ResizeObserver(([entry]) => {\n if (entry) this.viewportHeight = (entry.target as HTMLElement).clientHeight;\n });\n this.resizeObserver.observe(scroller);\n }\n\n private onPageChange(event: Event): void {\n event.stopPropagation();\n this.page = (event as CustomEvent<{ page: number }>).detail.page;\n emit(this, 'kt-page-change', { page: this.page });\n }\n\n /**\n * The aria-sort value for a column.\n *\n * Not named ariaSort: HTMLElement reflects that ARIA attribute as a string\n * property, and shadowing it with a method breaks the element's own typing.\n */\n private sortStateFor(column: KtTableColumn): 'ascending' | 'descending' | 'none' {\n if (this.sortKey !== column.key || !this.sortDirection) return 'none';\n return this.sortDirection === 'asc' ? 'ascending' : 'descending';\n }\n\n private renderHeaderCell(column: KtTableColumn): TemplateResult {\n const title = column.label ?? column.key;\n const active = this.sortKey === column.key && this.sortDirection !== null;\n\n return html`<th\n part=\"header-cell\"\n scope=\"col\"\n style=${styleMap(column.width ? { width: column.width } : {})}\n aria-sort=${this.sortStateFor(column)}\n >\n ${\n column.sortable\n ? html`<button type=\"button\" @click=${() => this.toggleSort(column)}>\n <span>${title}</span>\n <span class=\"indicator\" aria-hidden=\"true\">\n ${\n active\n ? html`<kt-icon\n name=${this.sortDirection === 'asc' ? 'arrow-up' : 'arrow-down'}\n size=\"14\"\n ></kt-icon>`\n : nothing\n }\n </span>\n </button>`\n : html`<span>${title}</span>`\n }\n </th>`;\n }\n\n private renderBody(): TemplateResult {\n const rows = this.visibleRows;\n const columnCount = this.columns.length + (this.selectable ? 1 : 0);\n\n if (rows.length === 0) {\n return html`<tr>\n <td colspan=${columnCount}>\n <div class=\"placeholder\">${this.emptyText ?? strings().noData}</div>\n </td>\n </tr>`;\n }\n\n if (!this.isVirtual) {\n return html`${rows.map((row, index) => this.renderRow(row, index))}`;\n }\n\n const { start, end } = rowWindow({\n rowCount: rows.length,\n rowHeight: this.rowHeight,\n viewportHeight: Math.max(0, this.viewportHeight - this.headerHeight),\n scrollTop: Math.max(0, this.scrollOffset - this.headerHeight),\n overscan: OVERSCAN,\n });\n const spacer = (count: number) =>\n count > 0 && this.rowHeight > 0\n ? html`<tr class=\"spacer\" aria-hidden=\"true\">\n <td colspan=${columnCount} style=${`height: ${count * this.rowHeight}px`}></td>\n </tr>`\n : nothing;\n\n return html`${spacer(start)}${rows\n .slice(start, end)\n .map((row, offset) => this.renderRow(row, start + offset))}${spacer(rows.length - end)}`;\n }\n\n /** `index` counts from the first row of the data, not of the rows rendered. */\n private renderRow(row: KtTableRow, index: number): TemplateResult {\n const selected = this.isSelected(row);\n\n return html`<tr\n part=\"row\"\n class=${classMap({ selected })}\n aria-selected=${this.selectable ? String(selected) : nothing}\n aria-rowindex=${this.isVirtual ? index + 2 : nothing}\n @click=${() => emit(this, 'kt-row-click', { row, index })}\n >\n ${\n this.selectable\n ? html`<td class=\"select-cell\">\n <input\n type=${this.selectionMode === 'single' ? 'radio' : 'checkbox'}\n name=${this.selectionMode === 'single' ? 'kt-table-selection' : nothing}\n .checked=${selected}\n aria-label=${strings().selectRow}\n @click=${(event: Event) => event.stopPropagation()}\n @change=${() => this.toggleSelection(row)}\n />\n </td>`\n : nothing\n }\n ${this.columns.map((column) => {\n const rendered = this.renderCell?.(row, column);\n return html`<td part=\"cell\" style=${styleMap({ textAlign: column.align ?? 'left' })}>\n ${rendered === undefined ? row[column.key] : rendered}\n </td>`;\n })}\n </tr>`;\n }\n\n override render(): TemplateResult {\n // A manual table reloading a page keeps the one on screen, dimmed, so the\n // pager that asked for it — and the focus on it — stay where they are.\n const reloading = this.loading && this.manual && this.data.length > 0;\n if (this.loading && !reloading) {\n return html`<div class=\"placeholder\" role=\"status\" aria-live=\"polite\">\n ${this.loadingText ?? strings().loading}\n </div>`;\n }\n\n const rows = this.visibleRows;\n const allSelected = rows.length > 0 && rows.every((row) => this.isSelected(row));\n const someSelected = rows.some((row) => this.isSelected(row));\n\n const virtual = this.isVirtual;\n\n return html`<div class=\"scroller\" @scroll=${virtual ? this.onScroll : nothing}>\n <table\n part=\"table\"\n aria-label=${this.label || nothing}\n aria-busy=${reloading ? 'true' : nothing}\n aria-rowcount=${virtual ? rows.length + 1 : nothing}\n >\n <thead>\n <tr aria-rowindex=${virtual ? 1 : nothing}>\n ${\n this.selectable\n ? html`<th class=\"select-cell\" scope=\"col\">\n ${\n this.selectionMode === 'multiple'\n ? html`<input\n type=\"checkbox\"\n .checked=${allSelected}\n .indeterminate=${someSelected && !allSelected}\n aria-label=${strings().selectAll}\n @change=${this.toggleAll}\n />`\n : nothing\n }\n </th>`\n : nothing\n }\n ${this.columns.map((column) => this.renderHeaderCell(column))}\n </tr>\n </thead>\n <tbody>\n ${this.renderBody()}\n </tbody>\n </table>\n </div>\n\n ${\n this.pageSize > 0\n ? html`<footer>\n <kt-pagination\n .page=${Math.min(this.page, this.totalPages)}\n .totalPages=${this.totalPages}\n @kt-page-change=${this.onPageChange}\n ></kt-pagination>\n </footer>`\n : nothing\n }`;\n }\n}\n\ndefineElement('kt-table', KtTable);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kt-table': KtTable;\n }\n}\n"],"names":["FIRST_BATCH","rowWindow","rowCount","rowHeight","viewportHeight","scrollTop","overscan","fits","first","last","OVERSCAN","collators","collatorFor","locale","collator","sortableText","value","rowKey","row","KtTable","KtElement","event","css","cache","resolveLocale","rows","key","sign","a","b","left","right","leftEmpty","rightEmpty","page","column","emit","candidate","keys","allSelected","changed","scroller","header","entry","title","active","html","styleMap","nothing","columnCount","strings","index","start","end","spacer","count","offset","selected","classMap","rendered","reloading","someSelected","virtual","__decorateClass","property","state","defineElement"],"mappings":";;;;;;;;;;AAOA,MAAMA,IAAc;AAab,SAASC,EAAU;AAAA,EACxB,UAAAC;AAAA,EACA,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,MAAM,OAAA,CAAQ;AAAA,GA/Of7C,EAgPX,WAAA,OAAA;AAOA4C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAtPf7C,EAuPX,WAAA,QAAA;AAmXF+C,EAAc,YAAY/C,CAAO;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css as h, html as s, nothing as m } from "lit";
|
|
2
2
|
import { property as a } from "lit/decorators.js";
|
|
3
3
|
import { classMap as k } from "lit/directives/class-map.js";
|
|
4
|
-
import { K as c, d as f } from "../../../chunks/kt-element-
|
|
4
|
+
import { K as c, d as f } from "../../../chunks/kt-element-T0VbIBNp.js";
|
|
5
5
|
import "../../core/kt-icon/kt-icon.js";
|
|
6
6
|
var v = Object.defineProperty, i = (l, r, o, n) => {
|
|
7
7
|
for (var e = void 0, p = l.length - 1, d; p >= 0; p--)
|