@scalio-cloud/ui 0.110.0 → 0.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-kit/ScalioAppProviders.d.ts +20 -0
- package/dist/app-kit/ScalioAppProviders.d.ts.map +1 -0
- package/dist/app-kit/ScalioDrawer.d.ts +28 -0
- package/dist/app-kit/ScalioDrawer.d.ts.map +1 -0
- package/dist/app-kit/ScalioEmptyState.d.ts +14 -0
- package/dist/app-kit/ScalioEmptyState.d.ts.map +1 -0
- package/dist/app-kit/ScalioErrorBoundary.d.ts +27 -0
- package/dist/app-kit/ScalioErrorBoundary.d.ts.map +1 -0
- package/dist/app-kit/ScalioFormDialog.d.ts +33 -0
- package/dist/app-kit/ScalioFormDialog.d.ts.map +1 -0
- package/dist/app-kit/ScalioFormField.d.ts +36 -0
- package/dist/app-kit/ScalioFormField.d.ts.map +1 -0
- package/dist/app-kit/ScalioInputs.d.ts +80 -0
- package/dist/app-kit/ScalioInputs.d.ts.map +1 -0
- package/dist/app-kit/ScalioLayout.d.ts +27 -0
- package/dist/app-kit/ScalioLayout.d.ts.map +1 -0
- package/dist/app-kit/ScalioResultBadge.d.ts +19 -0
- package/dist/app-kit/ScalioResultBadge.d.ts.map +1 -0
- package/dist/app-kit/ScalioTenantSettings.d.ts +24 -0
- package/dist/app-kit/ScalioTenantSettings.d.ts.map +1 -0
- package/dist/app-kit/ScalioUtilities.d.ts +33 -0
- package/dist/app-kit/ScalioUtilities.d.ts.map +1 -0
- package/dist/app-kit/_uiReact.d.ts +64 -3
- package/dist/app-kit/_uiReact.d.ts.map +1 -1
- package/dist/app-kit/index.d.ts +11 -0
- package/dist/app-kit/index.d.ts.map +1 -1
- package/dist/app-kit/index.js +1164 -2
- package/dist/app-kit/index.js.map +1 -1
- package/dist/app-kit/index.mjs +1144 -2
- package/dist/app-kit/index.mjs.map +1 -1
- package/dist/{chunk-A7O3P4YV.mjs → chunk-WBI44QWN.mjs} +92 -1
- package/dist/chunk-WBI44QWN.mjs.map +1 -0
- package/dist/core/format.d.ts +36 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +97 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +13 -1
- package/dist/data-table/ScalioDataTable.d.ts +12 -0
- package/dist/data-table/ScalioDataTable.d.ts.map +1 -0
- package/dist/data-table/helpers.d.ts +40 -0
- package/dist/data-table/helpers.d.ts.map +1 -0
- package/dist/data-table/index.d.ts +8 -0
- package/dist/data-table/index.d.ts.map +1 -0
- package/dist/data-table/index.js +1040 -0
- package/dist/data-table/index.js.map +1 -0
- package/dist/data-table/index.mjs +1008 -0
- package/dist/data-table/index.mjs.map +1 -0
- package/dist/data-table/labels.d.ts +5 -0
- package/dist/data-table/labels.d.ts.map +1 -0
- package/dist/data-table/types.d.ts +178 -0
- package/dist/data-table/types.d.ts.map +1 -0
- package/package.json +7 -1
- package/dist/chunk-A7O3P4YV.mjs.map +0 -1
|
@@ -0,0 +1,1040 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/data-table/index.ts
|
|
31
|
+
var data_table_exports = {};
|
|
32
|
+
__export(data_table_exports, {
|
|
33
|
+
DEFAULT_DATA_TABLE_LABELS: () => DEFAULT_DATA_TABLE_LABELS,
|
|
34
|
+
ScalioDataTable: () => ScalioDataTable,
|
|
35
|
+
buildCsv: () => buildCsv,
|
|
36
|
+
escapeCsvCell: () => escapeCsvCell,
|
|
37
|
+
filterRows: () => filterRows,
|
|
38
|
+
interpolateLabel: () => interpolateLabel,
|
|
39
|
+
loadTablePrefs: () => loadTablePrefs,
|
|
40
|
+
paginateRows: () => paginateRows,
|
|
41
|
+
resolveCellValue: () => resolveCellValue,
|
|
42
|
+
resolveColumnLabel: () => resolveColumnLabel,
|
|
43
|
+
saveTablePrefs: () => saveTablePrefs,
|
|
44
|
+
sortRows: () => sortRows
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(data_table_exports);
|
|
47
|
+
|
|
48
|
+
// src/data-table/ScalioDataTable.tsx
|
|
49
|
+
var import_react = __toESM(require("react"));
|
|
50
|
+
var import_lucide_react = require("lucide-react");
|
|
51
|
+
|
|
52
|
+
// src/data-table/helpers.ts
|
|
53
|
+
function resolveCellValue(row, column) {
|
|
54
|
+
if (!column.accessor) return void 0;
|
|
55
|
+
if (typeof column.accessor === "function") return column.accessor(row);
|
|
56
|
+
return row[column.accessor];
|
|
57
|
+
}
|
|
58
|
+
function resolveColumnLabel(column) {
|
|
59
|
+
if (column.label) return column.label;
|
|
60
|
+
if (typeof column.header === "string") return column.header;
|
|
61
|
+
return column.id;
|
|
62
|
+
}
|
|
63
|
+
function filterRows(rows, columns, search, filterValues, filters = []) {
|
|
64
|
+
const needle = search.trim().toLowerCase();
|
|
65
|
+
const activeFacets = filters.filter((f) => {
|
|
66
|
+
const selected = filterValues[f.id];
|
|
67
|
+
return Array.isArray(selected) && selected.length > 0;
|
|
68
|
+
});
|
|
69
|
+
if (!needle && activeFacets.length === 0) return rows;
|
|
70
|
+
const searchableCols = columns.filter((col) => {
|
|
71
|
+
if (col.searchable === false) return false;
|
|
72
|
+
return Boolean(col.searchValue || col.accessor);
|
|
73
|
+
});
|
|
74
|
+
return rows.filter((row) => {
|
|
75
|
+
for (const facet of activeFacets) {
|
|
76
|
+
const selected = filterValues[facet.id] ?? [];
|
|
77
|
+
if (facet.match) {
|
|
78
|
+
if (!facet.match(row, selected)) return false;
|
|
79
|
+
} else {
|
|
80
|
+
const raw = row[facet.id];
|
|
81
|
+
if (!selected.includes(String(raw ?? ""))) return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (!needle) return true;
|
|
85
|
+
for (const col of searchableCols) {
|
|
86
|
+
const text = col.searchValue ? col.searchValue(row) : String(resolveCellValue(row, col) ?? "");
|
|
87
|
+
if (text.toLowerCase().includes(needle)) return true;
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function compareUnknown(a, b) {
|
|
93
|
+
const aEmpty = a === null || a === void 0 || a === "";
|
|
94
|
+
const bEmpty = b === null || b === void 0 || b === "";
|
|
95
|
+
if (aEmpty && bEmpty) return 0;
|
|
96
|
+
if (aEmpty) return 1;
|
|
97
|
+
if (bEmpty) return -1;
|
|
98
|
+
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
99
|
+
if (typeof a === "boolean" && typeof b === "boolean") return Number(a) - Number(b);
|
|
100
|
+
if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
|
|
101
|
+
return String(a).localeCompare(String(b), void 0, { numeric: true, sensitivity: "base" });
|
|
102
|
+
}
|
|
103
|
+
function sortRows(rows, columns, sort) {
|
|
104
|
+
if (!sort) return rows;
|
|
105
|
+
const col = columns.find((c) => c.id === sort.id);
|
|
106
|
+
if (!col) return rows;
|
|
107
|
+
const dir = sort.desc ? -1 : 1;
|
|
108
|
+
return [...rows].sort((a, b) => {
|
|
109
|
+
const cmp = col.sortFn ? col.sortFn(a, b) : compareUnknown(resolveCellValue(a, col), resolveCellValue(b, col));
|
|
110
|
+
return cmp * dir;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function paginateRows(rows, page, pageSize) {
|
|
114
|
+
const safeSize = Math.max(1, pageSize);
|
|
115
|
+
const safePage = Math.max(1, page);
|
|
116
|
+
const start = (safePage - 1) * safeSize;
|
|
117
|
+
return rows.slice(start, start + safeSize);
|
|
118
|
+
}
|
|
119
|
+
var FORMULA_PREFIX_RE = /^[=+\-@\t\r]/;
|
|
120
|
+
function escapeCsvCell(value) {
|
|
121
|
+
const raw = value === null || value === void 0 ? "" : String(value);
|
|
122
|
+
const safe = FORMULA_PREFIX_RE.test(raw) ? `'${raw}` : raw;
|
|
123
|
+
if (/[",\r\n]/.test(safe)) {
|
|
124
|
+
return `"${safe.replace(/"/g, '""')}"`;
|
|
125
|
+
}
|
|
126
|
+
return safe;
|
|
127
|
+
}
|
|
128
|
+
function buildCsv(rows, columns) {
|
|
129
|
+
const exportCols = columns.filter((c) => c.csvValue !== false);
|
|
130
|
+
const headerLine = exportCols.map((c) => escapeCsvCell(resolveColumnLabel(c))).join(",");
|
|
131
|
+
const bodyLines = rows.map(
|
|
132
|
+
(row) => exportCols.map((col) => {
|
|
133
|
+
const val = typeof col.csvValue === "function" ? col.csvValue(row) : resolveCellValue(row, col);
|
|
134
|
+
return escapeCsvCell(val);
|
|
135
|
+
}).join(",")
|
|
136
|
+
);
|
|
137
|
+
return `\uFEFF${[headerLine, ...bodyLines].join("\r\n")}`;
|
|
138
|
+
}
|
|
139
|
+
function loadTablePrefs(storageKey) {
|
|
140
|
+
if (!storageKey || typeof window === "undefined") return {};
|
|
141
|
+
try {
|
|
142
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
143
|
+
if (!raw) return {};
|
|
144
|
+
const parsed = JSON.parse(raw);
|
|
145
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
146
|
+
} catch {
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function saveTablePrefs(storageKey, prefs) {
|
|
151
|
+
if (!storageKey || typeof window === "undefined") return;
|
|
152
|
+
try {
|
|
153
|
+
window.localStorage.setItem(storageKey, JSON.stringify(prefs));
|
|
154
|
+
} catch {
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// src/data-table/labels.ts
|
|
159
|
+
var DEFAULT_DATA_TABLE_LABELS = {
|
|
160
|
+
en: {
|
|
161
|
+
searchPlaceholder: "Search...",
|
|
162
|
+
clearSearch: "Clear search",
|
|
163
|
+
columns: "Columns",
|
|
164
|
+
showAllColumns: "Show all",
|
|
165
|
+
density: "Density",
|
|
166
|
+
densityCompact: "Compact",
|
|
167
|
+
densityComfortable: "Comfortable",
|
|
168
|
+
densitySpacious: "Spacious",
|
|
169
|
+
exportCsv: "Export CSV",
|
|
170
|
+
refresh: "Refresh",
|
|
171
|
+
filtersReset: "Reset filters",
|
|
172
|
+
selectedCount: "{count} selected",
|
|
173
|
+
clearSelection: "Clear selection",
|
|
174
|
+
selectAllRows: "Select all rows on page",
|
|
175
|
+
selectRow: "Select row",
|
|
176
|
+
expandRow: "Expand row",
|
|
177
|
+
collapseRow: "Collapse row",
|
|
178
|
+
emptyTitle: "No entries yet",
|
|
179
|
+
emptyDescription: "There is nothing to display right now.",
|
|
180
|
+
noMatchesTitle: "No matching entries",
|
|
181
|
+
noMatchesDescription: "Adjust or reset your search and filters.",
|
|
182
|
+
errorTitle: "Could not load data",
|
|
183
|
+
retry: "Try again",
|
|
184
|
+
rowsPerPage: "Rows per page",
|
|
185
|
+
pageOf: "Page {page} of {pages}",
|
|
186
|
+
rangeOf: "{start}\u2013{end} of {total}",
|
|
187
|
+
previousPage: "Previous page",
|
|
188
|
+
nextPage: "Next page",
|
|
189
|
+
firstPage: "First page",
|
|
190
|
+
lastPage: "Last page"
|
|
191
|
+
},
|
|
192
|
+
de: {
|
|
193
|
+
searchPlaceholder: "Suchen...",
|
|
194
|
+
clearSearch: "Suche leeren",
|
|
195
|
+
columns: "Spalten",
|
|
196
|
+
showAllColumns: "Alle anzeigen",
|
|
197
|
+
density: "Dichte",
|
|
198
|
+
densityCompact: "Kompakt",
|
|
199
|
+
densityComfortable: "Standard",
|
|
200
|
+
densitySpacious: "Grossz\xFCgig",
|
|
201
|
+
exportCsv: "CSV exportieren",
|
|
202
|
+
refresh: "Aktualisieren",
|
|
203
|
+
filtersReset: "Filter zur\xFCcksetzen",
|
|
204
|
+
selectedCount: "{count} ausgew\xE4hlt",
|
|
205
|
+
clearSelection: "Auswahl aufheben",
|
|
206
|
+
selectAllRows: "Alle Zeilen auf dieser Seite ausw\xE4hlen",
|
|
207
|
+
selectRow: "Zeile ausw\xE4hlen",
|
|
208
|
+
expandRow: "Zeile aufklappen",
|
|
209
|
+
collapseRow: "Zeile zuklappen",
|
|
210
|
+
emptyTitle: "Noch keine Eintr\xE4ge",
|
|
211
|
+
emptyDescription: "Aktuell gibt es nichts anzuzeigen.",
|
|
212
|
+
noMatchesTitle: "Keine passenden Eintr\xE4ge",
|
|
213
|
+
noMatchesDescription: "Suche oder Filter anpassen oder zur\xFCcksetzen.",
|
|
214
|
+
errorTitle: "Daten konnten nicht geladen werden",
|
|
215
|
+
retry: "Erneut versuchen",
|
|
216
|
+
rowsPerPage: "Zeilen pro Seite",
|
|
217
|
+
pageOf: "Seite {page} von {pages}",
|
|
218
|
+
rangeOf: "{start}\u2013{end} von {total}",
|
|
219
|
+
previousPage: "Vorherige Seite",
|
|
220
|
+
nextPage: "N\xE4chste Seite",
|
|
221
|
+
firstPage: "Erste Seite",
|
|
222
|
+
lastPage: "Letzte Seite"
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
function interpolateLabel(template, vars) {
|
|
226
|
+
let out = template;
|
|
227
|
+
for (const [k, v] of Object.entries(vars)) {
|
|
228
|
+
out = out.split(`{${k}}`).join(String(v));
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// src/data-table/ScalioDataTable.tsx
|
|
234
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
235
|
+
var DENSITY_CELL_CLASS = {
|
|
236
|
+
compact: "px-2.5 py-1.5 text-xs",
|
|
237
|
+
comfortable: "px-3 py-2.5 text-sm",
|
|
238
|
+
spacious: "px-4 py-3.5 text-sm"
|
|
239
|
+
};
|
|
240
|
+
var ALIGN_CLASS = {
|
|
241
|
+
left: "text-left",
|
|
242
|
+
center: "text-center",
|
|
243
|
+
right: "text-right"
|
|
244
|
+
};
|
|
245
|
+
function triggerCsvDownload(csv, filename) {
|
|
246
|
+
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
247
|
+
const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
|
|
248
|
+
const url = URL.createObjectURL(blob);
|
|
249
|
+
const a = document.createElement("a");
|
|
250
|
+
a.href = url;
|
|
251
|
+
a.download = filename.endsWith(".csv") ? filename : `${filename}.csv`;
|
|
252
|
+
document.body.appendChild(a);
|
|
253
|
+
a.click();
|
|
254
|
+
document.body.removeChild(a);
|
|
255
|
+
URL.revokeObjectURL(url);
|
|
256
|
+
}
|
|
257
|
+
function ScalioDataTable({
|
|
258
|
+
data,
|
|
259
|
+
columns,
|
|
260
|
+
getRowId,
|
|
261
|
+
manual = false,
|
|
262
|
+
totalCount,
|
|
263
|
+
sort: controlledSort,
|
|
264
|
+
defaultSort = null,
|
|
265
|
+
onSortChange,
|
|
266
|
+
page: controlledPage,
|
|
267
|
+
defaultPage = 1,
|
|
268
|
+
onPageChange,
|
|
269
|
+
pageSize: controlledPageSize,
|
|
270
|
+
defaultPageSize = 25,
|
|
271
|
+
pageSizeOptions = [10, 25, 50, 100],
|
|
272
|
+
onPageSizeChange,
|
|
273
|
+
paginate = true,
|
|
274
|
+
searchable = true,
|
|
275
|
+
search: controlledSearch,
|
|
276
|
+
onSearchChange,
|
|
277
|
+
searchPlaceholder,
|
|
278
|
+
filters = [],
|
|
279
|
+
filterValues: controlledFilterValues,
|
|
280
|
+
onFilterChange,
|
|
281
|
+
selectable = false,
|
|
282
|
+
selectedIds: controlledSelectedIds,
|
|
283
|
+
onSelectionChange,
|
|
284
|
+
bulkActions = [],
|
|
285
|
+
renderExpandedRow,
|
|
286
|
+
onRowClick,
|
|
287
|
+
rowClassName,
|
|
288
|
+
exportCsv = false,
|
|
289
|
+
columnChooser = true,
|
|
290
|
+
densityToggle = true,
|
|
291
|
+
defaultDensity = "comfortable",
|
|
292
|
+
stickyHeader = true,
|
|
293
|
+
storageKey,
|
|
294
|
+
onRefresh,
|
|
295
|
+
refreshing = false,
|
|
296
|
+
toolbarActions,
|
|
297
|
+
loading = false,
|
|
298
|
+
loadingRows = 5,
|
|
299
|
+
error = null,
|
|
300
|
+
onRetry,
|
|
301
|
+
emptyTitle,
|
|
302
|
+
emptyDescription,
|
|
303
|
+
emptyAction,
|
|
304
|
+
lang = "en",
|
|
305
|
+
labels: labelOverrides,
|
|
306
|
+
testId = "scalio-data-table",
|
|
307
|
+
className = ""
|
|
308
|
+
}) {
|
|
309
|
+
const L = { ...DEFAULT_DATA_TABLE_LABELS[lang], ...labelOverrides };
|
|
310
|
+
const initialPrefs = (0, import_react.useMemo)(() => loadTablePrefs(storageKey), [storageKey]);
|
|
311
|
+
const [internalSort, setInternalSort] = (0, import_react.useState)(
|
|
312
|
+
initialPrefs.sort !== void 0 ? initialPrefs.sort : defaultSort
|
|
313
|
+
);
|
|
314
|
+
const [internalPage, setInternalPage] = (0, import_react.useState)(defaultPage);
|
|
315
|
+
const [internalPageSize, setInternalPageSize] = (0, import_react.useState)(
|
|
316
|
+
initialPrefs.pageSize ?? defaultPageSize
|
|
317
|
+
);
|
|
318
|
+
const [internalSearch, setInternalSearch] = (0, import_react.useState)("");
|
|
319
|
+
const [internalFilterValues, setInternalFilterValues] = (0, import_react.useState)({});
|
|
320
|
+
const [internalSelectedIds, setInternalSelectedIds] = (0, import_react.useState)([]);
|
|
321
|
+
const [expandedIds, setExpandedIds] = (0, import_react.useState)(/* @__PURE__ */ new Set());
|
|
322
|
+
const [density, setDensity] = (0, import_react.useState)(initialPrefs.density ?? defaultDensity);
|
|
323
|
+
const [hiddenCols, setHiddenCols] = (0, import_react.useState)(() => {
|
|
324
|
+
if (initialPrefs.hiddenColumns) return new Set(initialPrefs.hiddenColumns);
|
|
325
|
+
return new Set(columns.filter((c) => c.defaultHidden).map((c) => c.id));
|
|
326
|
+
});
|
|
327
|
+
const [openMenu, setOpenMenu] = (0, import_react.useState)(null);
|
|
328
|
+
const [bulkBusy, setBulkBusy] = (0, import_react.useState)(null);
|
|
329
|
+
const menuContainerRef = (0, import_react.useRef)(null);
|
|
330
|
+
(0, import_react.useEffect)(() => {
|
|
331
|
+
if (!openMenu) return;
|
|
332
|
+
const onDocClick = (e) => {
|
|
333
|
+
if (menuContainerRef.current && !menuContainerRef.current.contains(e.target)) {
|
|
334
|
+
setOpenMenu(null);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
const onKey = (e) => {
|
|
338
|
+
if (e.key === "Escape") setOpenMenu(null);
|
|
339
|
+
};
|
|
340
|
+
document.addEventListener("mousedown", onDocClick);
|
|
341
|
+
document.addEventListener("keydown", onKey);
|
|
342
|
+
return () => {
|
|
343
|
+
document.removeEventListener("mousedown", onDocClick);
|
|
344
|
+
document.removeEventListener("keydown", onKey);
|
|
345
|
+
};
|
|
346
|
+
}, [openMenu]);
|
|
347
|
+
const sort = controlledSort !== void 0 ? controlledSort : internalSort;
|
|
348
|
+
const page = controlledPage !== void 0 ? controlledPage : internalPage;
|
|
349
|
+
const pageSize = controlledPageSize !== void 0 ? controlledPageSize : internalPageSize;
|
|
350
|
+
const search = controlledSearch !== void 0 ? controlledSearch : internalSearch;
|
|
351
|
+
const filterValues = controlledFilterValues !== void 0 ? controlledFilterValues : internalFilterValues;
|
|
352
|
+
const selectedIds = controlledSelectedIds !== void 0 ? controlledSelectedIds : internalSelectedIds;
|
|
353
|
+
(0, import_react.useEffect)(() => {
|
|
354
|
+
if (!storageKey) return;
|
|
355
|
+
saveTablePrefs(storageKey, {
|
|
356
|
+
hiddenColumns: Array.from(hiddenCols),
|
|
357
|
+
density,
|
|
358
|
+
pageSize,
|
|
359
|
+
sort
|
|
360
|
+
});
|
|
361
|
+
}, [storageKey, hiddenCols, density, pageSize, sort]);
|
|
362
|
+
const visibleColumns = (0, import_react.useMemo)(
|
|
363
|
+
() => columns.filter((col) => !hiddenCols.has(col.id)),
|
|
364
|
+
[columns, hiddenCols]
|
|
365
|
+
);
|
|
366
|
+
const processedRows = (0, import_react.useMemo)(() => {
|
|
367
|
+
if (manual) return data;
|
|
368
|
+
const filtered = filterRows(data, columns, search, filterValues, filters);
|
|
369
|
+
return sortRows(filtered, columns, sort);
|
|
370
|
+
}, [manual, data, columns, search, filterValues, filters, sort]);
|
|
371
|
+
const effectiveTotal = manual ? totalCount ?? data.length : processedRows.length;
|
|
372
|
+
const totalPages = paginate ? Math.max(1, Math.ceil(effectiveTotal / Math.max(1, pageSize))) : 1;
|
|
373
|
+
const clampedPage = Math.min(Math.max(1, page), totalPages);
|
|
374
|
+
const pageRows = (0, import_react.useMemo)(() => {
|
|
375
|
+
if (!paginate || manual) return processedRows;
|
|
376
|
+
return paginateRows(processedRows, clampedPage, pageSize);
|
|
377
|
+
}, [paginate, manual, processedRows, clampedPage, pageSize]);
|
|
378
|
+
const selectedSet = (0, import_react.useMemo)(() => new Set(selectedIds), [selectedIds]);
|
|
379
|
+
const pageRowIds = (0, import_react.useMemo)(
|
|
380
|
+
() => pageRows.map((row, idx) => getRowId(row, idx)),
|
|
381
|
+
[pageRows, getRowId]
|
|
382
|
+
);
|
|
383
|
+
const allPageSelected = pageRowIds.length > 0 && pageRowIds.every((id) => selectedSet.has(id));
|
|
384
|
+
const somePageSelected = pageRowIds.some((id) => selectedSet.has(id)) && !allPageSelected;
|
|
385
|
+
const selectedRows = (0, import_react.useMemo)(() => {
|
|
386
|
+
const out = [];
|
|
387
|
+
for (let i = 0; i < data.length; i += 1) {
|
|
388
|
+
const row = data[i];
|
|
389
|
+
if (row !== void 0 && selectedSet.has(getRowId(row, i))) {
|
|
390
|
+
out.push(row);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return out;
|
|
394
|
+
}, [data, selectedSet, getRowId]);
|
|
395
|
+
const setSort = (next) => {
|
|
396
|
+
if (controlledSort === void 0) setInternalSort(next);
|
|
397
|
+
onSortChange?.(next);
|
|
398
|
+
};
|
|
399
|
+
const setPage = (next) => {
|
|
400
|
+
const safe = Math.min(Math.max(1, next), totalPages);
|
|
401
|
+
if (controlledPage === void 0) setInternalPage(safe);
|
|
402
|
+
onPageChange?.(safe);
|
|
403
|
+
};
|
|
404
|
+
const setPageSize = (next) => {
|
|
405
|
+
if (controlledPageSize === void 0) setInternalPageSize(next);
|
|
406
|
+
onPageSizeChange?.(next);
|
|
407
|
+
setPage(1);
|
|
408
|
+
};
|
|
409
|
+
const setSearch = (next) => {
|
|
410
|
+
if (controlledSearch === void 0) setInternalSearch(next);
|
|
411
|
+
onSearchChange?.(next);
|
|
412
|
+
if (clampedPage !== 1) setPage(1);
|
|
413
|
+
};
|
|
414
|
+
const updateFilters = (next) => {
|
|
415
|
+
if (controlledFilterValues === void 0) setInternalFilterValues(next);
|
|
416
|
+
onFilterChange?.(next);
|
|
417
|
+
if (clampedPage !== 1) setPage(1);
|
|
418
|
+
};
|
|
419
|
+
const updateSelection = (nextIds) => {
|
|
420
|
+
if (controlledSelectedIds === void 0) setInternalSelectedIds(nextIds);
|
|
421
|
+
if (onSelectionChange) {
|
|
422
|
+
const idSet = new Set(nextIds);
|
|
423
|
+
const rows = data.filter((r, i) => idSet.has(getRowId(r, i)));
|
|
424
|
+
onSelectionChange(nextIds, rows);
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
const toggleSort = (col) => {
|
|
428
|
+
if (!col.sortable) return;
|
|
429
|
+
if (!sort || sort.id !== col.id) {
|
|
430
|
+
setSort({ id: col.id, desc: false });
|
|
431
|
+
} else if (!sort.desc) {
|
|
432
|
+
setSort({ id: col.id, desc: true });
|
|
433
|
+
} else {
|
|
434
|
+
setSort(null);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const toggleSelectAllPage = () => {
|
|
438
|
+
if (allPageSelected) {
|
|
439
|
+
const pageSet = new Set(pageRowIds);
|
|
440
|
+
updateSelection(selectedIds.filter((id) => !pageSet.has(id)));
|
|
441
|
+
} else {
|
|
442
|
+
const merged = new Set(selectedIds);
|
|
443
|
+
for (const id of pageRowIds) merged.add(id);
|
|
444
|
+
updateSelection(Array.from(merged));
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
const toggleSelectRow = (id) => {
|
|
448
|
+
if (selectedSet.has(id)) {
|
|
449
|
+
updateSelection(selectedIds.filter((x) => x !== id));
|
|
450
|
+
} else {
|
|
451
|
+
updateSelection([...selectedIds, id]);
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
const toggleExpandRow = (id) => {
|
|
455
|
+
setExpandedIds((prev) => {
|
|
456
|
+
const next = new Set(prev);
|
|
457
|
+
if (next.has(id)) next.delete(id);
|
|
458
|
+
else next.add(id);
|
|
459
|
+
return next;
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
const toggleColumn = (id) => {
|
|
463
|
+
setHiddenCols((prev) => {
|
|
464
|
+
const next = new Set(prev);
|
|
465
|
+
if (next.has(id)) {
|
|
466
|
+
next.delete(id);
|
|
467
|
+
} else if (visibleColumns.length > 1) {
|
|
468
|
+
next.add(id);
|
|
469
|
+
}
|
|
470
|
+
return next;
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
const toggleFacetValue = (facetId, optionValue) => {
|
|
474
|
+
const current = filterValues[facetId] ?? [];
|
|
475
|
+
const exists = current.includes(optionValue);
|
|
476
|
+
const nextFacet = exists ? current.filter((v) => v !== optionValue) : [...current, optionValue];
|
|
477
|
+
updateFilters({ ...filterValues, [facetId]: nextFacet });
|
|
478
|
+
};
|
|
479
|
+
const hasActiveFilters = search.trim().length > 0 || Object.values(filterValues).some((vals) => Array.isArray(vals) && vals.length > 0);
|
|
480
|
+
const resetAllFilters = () => {
|
|
481
|
+
setSearch("");
|
|
482
|
+
updateFilters({});
|
|
483
|
+
};
|
|
484
|
+
const handleExportCsv = () => {
|
|
485
|
+
const csv = buildCsv(processedRows, visibleColumns);
|
|
486
|
+
const filename = typeof exportCsv === "string" ? exportCsv : "export.csv";
|
|
487
|
+
triggerCsvDownload(csv, filename);
|
|
488
|
+
};
|
|
489
|
+
const cellPadding = DENSITY_CELL_CLASS[density];
|
|
490
|
+
const extraColCount = (selectable ? 1 : 0) + (renderExpandedRow ? 1 : 0);
|
|
491
|
+
const totalColSpan = visibleColumns.length + extraColCount;
|
|
492
|
+
const rangeStart = effectiveTotal === 0 ? 0 : (clampedPage - 1) * pageSize + 1;
|
|
493
|
+
const rangeEnd = paginate ? Math.min(clampedPage * pageSize, effectiveTotal) : effectiveTotal;
|
|
494
|
+
const pinClass = (col, isHeader) => {
|
|
495
|
+
if (col.pinned === "left") {
|
|
496
|
+
return `sticky left-0 ${isHeader ? "z-20 bg-muted" : "z-10 bg-background"} shadow-[1px_0_0_0_hsl(var(--border))]`;
|
|
497
|
+
}
|
|
498
|
+
if (col.pinned === "right") {
|
|
499
|
+
return `sticky right-0 ${isHeader ? "z-20 bg-muted" : "z-10 bg-background"} shadow-[-1px_0_0_0_hsl(var(--border))]`;
|
|
500
|
+
}
|
|
501
|
+
return "";
|
|
502
|
+
};
|
|
503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `space-y-3 ${className}`.trim(), "data-testid": testId, ref: menuContainerRef, children: [
|
|
504
|
+
(searchable || filters.length > 0 || columnChooser || densityToggle || exportCsv || onRefresh || toolbarActions) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2", "data-testid": `${testId}-toolbar`, children: [
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-2 flex-1 min-w-[200px]", children: [
|
|
506
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative flex-1 max-w-xs min-w-[180px]", children: [
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Search, { className: "w-3.5 h-3.5 text-muted-foreground absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none" }),
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
509
|
+
"input",
|
|
510
|
+
{
|
|
511
|
+
type: "search",
|
|
512
|
+
value: search,
|
|
513
|
+
onChange: (e) => setSearch(e.target.value),
|
|
514
|
+
placeholder: searchPlaceholder ?? L.searchPlaceholder,
|
|
515
|
+
"aria-label": searchPlaceholder ?? L.searchPlaceholder,
|
|
516
|
+
"data-testid": `${testId}-search`,
|
|
517
|
+
className: "w-full h-9 pl-8 pr-7 text-sm bg-background text-foreground border border-input rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
521
|
+
"button",
|
|
522
|
+
{
|
|
523
|
+
type: "button",
|
|
524
|
+
onClick: () => setSearch(""),
|
|
525
|
+
"aria-label": L.clearSearch,
|
|
526
|
+
"data-testid": `${testId}-search-clear`,
|
|
527
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { className: "w-3.5 h-3.5" })
|
|
529
|
+
}
|
|
530
|
+
)
|
|
531
|
+
] }),
|
|
532
|
+
filters.map((facet) => {
|
|
533
|
+
const active = filterValues[facet.id] ?? [];
|
|
534
|
+
const isOpen = openMenu === `facet:${facet.id}`;
|
|
535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
537
|
+
"button",
|
|
538
|
+
{
|
|
539
|
+
type: "button",
|
|
540
|
+
onClick: () => setOpenMenu(isOpen ? null : `facet:${facet.id}`),
|
|
541
|
+
"aria-expanded": isOpen,
|
|
542
|
+
"data-testid": `${testId}-filter-${facet.id}`,
|
|
543
|
+
className: `h-9 px-3 text-xs font-medium rounded-sm border inline-flex items-center gap-1.5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${active.length > 0 ? "bg-primary/10 border-primary text-primary" : "bg-background border-input text-foreground hover:bg-muted"}`,
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: facet.label }),
|
|
546
|
+
active.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "px-1.5 py-0.5 text-[10px] font-bold rounded-full bg-primary text-primary-foreground", children: active.length }),
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { className: "w-3.5 h-3.5 opacity-60" })
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
),
|
|
551
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
552
|
+
"div",
|
|
553
|
+
{
|
|
554
|
+
className: "absolute left-0 mt-1 w-56 rounded-sm border border-border bg-popover text-popover-foreground shadow-md p-1.5 z-30 space-y-0.5",
|
|
555
|
+
"data-testid": `${testId}-filter-menu-${facet.id}`,
|
|
556
|
+
children: facet.options.map((opt) => {
|
|
557
|
+
const checked = active.includes(opt.value);
|
|
558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
559
|
+
"label",
|
|
560
|
+
{
|
|
561
|
+
className: "flex items-center justify-between gap-2 px-2 py-1.5 text-xs rounded-sm hover:bg-muted cursor-pointer",
|
|
562
|
+
children: [
|
|
563
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "inline-flex items-center gap-2", children: [
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
565
|
+
"input",
|
|
566
|
+
{
|
|
567
|
+
type: "checkbox",
|
|
568
|
+
checked,
|
|
569
|
+
onChange: () => toggleFacetValue(facet.id, opt.value),
|
|
570
|
+
className: "rounded border-input accent-primary"
|
|
571
|
+
}
|
|
572
|
+
),
|
|
573
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: opt.label })
|
|
574
|
+
] }),
|
|
575
|
+
opt.count !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground tabular-nums", children: opt.count })
|
|
576
|
+
]
|
|
577
|
+
},
|
|
578
|
+
opt.value
|
|
579
|
+
);
|
|
580
|
+
})
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
] }, facet.id);
|
|
584
|
+
}),
|
|
585
|
+
hasActiveFilters && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
586
|
+
"button",
|
|
587
|
+
{
|
|
588
|
+
type: "button",
|
|
589
|
+
onClick: resetAllFilters,
|
|
590
|
+
"data-testid": `${testId}-reset-filters`,
|
|
591
|
+
className: "h-9 px-2.5 text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1",
|
|
592
|
+
children: [
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { className: "w-3.5 h-3.5" }),
|
|
594
|
+
L.filtersReset
|
|
595
|
+
]
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
|
+
] }),
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
600
|
+
toolbarActions,
|
|
601
|
+
exportCsv && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
602
|
+
"button",
|
|
603
|
+
{
|
|
604
|
+
type: "button",
|
|
605
|
+
onClick: handleExportCsv,
|
|
606
|
+
disabled: processedRows.length === 0,
|
|
607
|
+
"data-testid": `${testId}-export-csv`,
|
|
608
|
+
className: "h-9 px-2.5 text-xs font-medium rounded-sm border border-input bg-background text-foreground hover:bg-muted inline-flex items-center gap-1.5 disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Download, { className: "w-3.5 h-3.5" }),
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "hidden sm:inline", children: L.exportCsv })
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
),
|
|
615
|
+
densityToggle && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
617
|
+
"button",
|
|
618
|
+
{
|
|
619
|
+
type: "button",
|
|
620
|
+
onClick: () => setOpenMenu(openMenu === "density" ? null : "density"),
|
|
621
|
+
"aria-label": L.density,
|
|
622
|
+
"aria-expanded": openMenu === "density",
|
|
623
|
+
"data-testid": `${testId}-density-btn`,
|
|
624
|
+
className: "h-9 px-2.5 text-xs font-medium rounded-sm border border-input bg-background text-foreground hover:bg-muted inline-flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
625
|
+
children: [
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Rows3, { className: "w-3.5 h-3.5" }),
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "hidden sm:inline", children: L.density })
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
),
|
|
631
|
+
openMenu === "density" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
632
|
+
"div",
|
|
633
|
+
{
|
|
634
|
+
className: "absolute right-0 mt-1 w-40 rounded-sm border border-border bg-popover text-popover-foreground shadow-md p-1 z-30",
|
|
635
|
+
"data-testid": `${testId}-density-menu`,
|
|
636
|
+
children: [
|
|
637
|
+
["compact", L.densityCompact],
|
|
638
|
+
["comfortable", L.densityComfortable],
|
|
639
|
+
["spacious", L.densitySpacious]
|
|
640
|
+
].map(([value, label]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
641
|
+
"button",
|
|
642
|
+
{
|
|
643
|
+
type: "button",
|
|
644
|
+
onClick: () => {
|
|
645
|
+
setDensity(value);
|
|
646
|
+
setOpenMenu(null);
|
|
647
|
+
},
|
|
648
|
+
"data-testid": `${testId}-density-${value}`,
|
|
649
|
+
className: `w-full text-left px-2.5 py-1.5 text-xs rounded-sm transition-colors ${density === value ? "bg-primary/10 text-primary font-semibold" : "hover:bg-muted"}`,
|
|
650
|
+
children: label
|
|
651
|
+
},
|
|
652
|
+
value
|
|
653
|
+
))
|
|
654
|
+
}
|
|
655
|
+
)
|
|
656
|
+
] }),
|
|
657
|
+
columnChooser && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
|
|
658
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
659
|
+
"button",
|
|
660
|
+
{
|
|
661
|
+
type: "button",
|
|
662
|
+
onClick: () => setOpenMenu(openMenu === "columns" ? null : "columns"),
|
|
663
|
+
"aria-label": L.columns,
|
|
664
|
+
"aria-expanded": openMenu === "columns",
|
|
665
|
+
"data-testid": `${testId}-columns-btn`,
|
|
666
|
+
className: "h-9 px-2.5 text-xs font-medium rounded-sm border border-input bg-background text-foreground hover:bg-muted inline-flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
667
|
+
children: [
|
|
668
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Columns3, { className: "w-3.5 h-3.5" }),
|
|
669
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "hidden sm:inline", children: L.columns })
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
openMenu === "columns" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
674
|
+
"div",
|
|
675
|
+
{
|
|
676
|
+
className: "absolute right-0 mt-1 w-56 rounded-sm border border-border bg-popover text-popover-foreground shadow-md p-1.5 z-30 space-y-0.5",
|
|
677
|
+
"data-testid": `${testId}-columns-menu`,
|
|
678
|
+
children: [
|
|
679
|
+
columns.filter((c) => c.hideable !== false).map((col) => {
|
|
680
|
+
const visible = !hiddenCols.has(col.id);
|
|
681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
682
|
+
"label",
|
|
683
|
+
{
|
|
684
|
+
className: "flex items-center gap-2 px-2 py-1.5 text-xs rounded-sm hover:bg-muted cursor-pointer",
|
|
685
|
+
children: [
|
|
686
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
687
|
+
"input",
|
|
688
|
+
{
|
|
689
|
+
type: "checkbox",
|
|
690
|
+
checked: visible,
|
|
691
|
+
disabled: visible && visibleColumns.length <= 1,
|
|
692
|
+
onChange: () => toggleColumn(col.id),
|
|
693
|
+
"data-testid": `${testId}-col-toggle-${col.id}`,
|
|
694
|
+
className: "rounded border-input accent-primary"
|
|
695
|
+
}
|
|
696
|
+
),
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: resolveColumnLabel(col) })
|
|
698
|
+
]
|
|
699
|
+
},
|
|
700
|
+
col.id
|
|
701
|
+
);
|
|
702
|
+
}),
|
|
703
|
+
hiddenCols.size > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
704
|
+
"button",
|
|
705
|
+
{
|
|
706
|
+
type: "button",
|
|
707
|
+
onClick: () => setHiddenCols(/* @__PURE__ */ new Set()),
|
|
708
|
+
className: "w-full mt-1 pt-1.5 border-t border-border text-left px-2 py-1 text-xs text-primary hover:underline",
|
|
709
|
+
children: L.showAllColumns
|
|
710
|
+
}
|
|
711
|
+
)
|
|
712
|
+
]
|
|
713
|
+
}
|
|
714
|
+
)
|
|
715
|
+
] }),
|
|
716
|
+
onRefresh && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
717
|
+
"button",
|
|
718
|
+
{
|
|
719
|
+
type: "button",
|
|
720
|
+
onClick: onRefresh,
|
|
721
|
+
disabled: refreshing,
|
|
722
|
+
"aria-label": L.refresh,
|
|
723
|
+
title: L.refresh,
|
|
724
|
+
"data-testid": `${testId}-refresh`,
|
|
725
|
+
className: "h-9 w-9 inline-flex items-center justify-center rounded-sm border border-input bg-background text-foreground hover:bg-muted disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
726
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.RefreshCw, { className: `w-3.5 h-3.5 ${refreshing ? "animate-spin" : ""}` })
|
|
727
|
+
}
|
|
728
|
+
)
|
|
729
|
+
] })
|
|
730
|
+
] }),
|
|
731
|
+
selectable && selectedIds.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
732
|
+
"div",
|
|
733
|
+
{
|
|
734
|
+
className: "flex flex-wrap items-center justify-between gap-2 px-3 py-2 rounded-sm border border-primary/40 bg-primary/5 text-sm",
|
|
735
|
+
"data-testid": `${testId}-bulk-bar`,
|
|
736
|
+
children: [
|
|
737
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs font-bold text-primary", children: interpolateLabel(L.selectedCount, { count: selectedIds.length }) }),
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
740
|
+
"button",
|
|
741
|
+
{
|
|
742
|
+
type: "button",
|
|
743
|
+
onClick: () => updateSelection([]),
|
|
744
|
+
"data-testid": `${testId}-clear-selection`,
|
|
745
|
+
className: "text-xs text-muted-foreground hover:text-foreground underline",
|
|
746
|
+
children: L.clearSelection
|
|
747
|
+
}
|
|
748
|
+
)
|
|
749
|
+
] }),
|
|
750
|
+
bulkActions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap items-center gap-1.5", children: bulkActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
751
|
+
"button",
|
|
752
|
+
{
|
|
753
|
+
type: "button",
|
|
754
|
+
disabled: action.disabled || bulkBusy !== null,
|
|
755
|
+
"data-testid": `${testId}-bulk-${action.id}`,
|
|
756
|
+
onClick: async () => {
|
|
757
|
+
setBulkBusy(action.id);
|
|
758
|
+
try {
|
|
759
|
+
await action.onAction(selectedRows);
|
|
760
|
+
} finally {
|
|
761
|
+
setBulkBusy(null);
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
className: `h-8 px-3 text-xs font-semibold rounded-sm inline-flex items-center gap-1.5 transition-colors disabled:opacity-40 ${action.tone === "danger" ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "bg-primary text-primary-foreground hover:bg-primary/90"}`,
|
|
765
|
+
children: [
|
|
766
|
+
action.icon,
|
|
767
|
+
action.label
|
|
768
|
+
]
|
|
769
|
+
},
|
|
770
|
+
action.id
|
|
771
|
+
)) })
|
|
772
|
+
]
|
|
773
|
+
}
|
|
774
|
+
),
|
|
775
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
776
|
+
"div",
|
|
777
|
+
{
|
|
778
|
+
role: "alert",
|
|
779
|
+
"data-testid": `${testId}-error`,
|
|
780
|
+
className: "flex items-center justify-between gap-3 px-4 py-3 rounded-sm border border-destructive/40 bg-destructive/10 text-destructive text-sm",
|
|
781
|
+
children: [
|
|
782
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
783
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.AlertCircle, { className: "w-4 h-4 shrink-0" }),
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold", children: L.errorTitle }),
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs opacity-90", children: error })
|
|
787
|
+
] })
|
|
788
|
+
] }),
|
|
789
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
790
|
+
"button",
|
|
791
|
+
{
|
|
792
|
+
type: "button",
|
|
793
|
+
onClick: onRetry,
|
|
794
|
+
"data-testid": `${testId}-retry`,
|
|
795
|
+
className: "h-8 px-3 text-xs font-semibold rounded-sm border border-destructive/40 hover:bg-destructive/10",
|
|
796
|
+
children: L.retry
|
|
797
|
+
}
|
|
798
|
+
)
|
|
799
|
+
]
|
|
800
|
+
}
|
|
801
|
+
),
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border border-border rounded-sm bg-card overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "w-full border-collapse", children: [
|
|
803
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
804
|
+
"thead",
|
|
805
|
+
{
|
|
806
|
+
className: `bg-muted/60 border-b border-border ${stickyHeader ? "sticky top-0 z-10" : ""}`,
|
|
807
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
808
|
+
renderExpandedRow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { className: "w-9 px-2 py-2", "aria-label": L.expandRow }),
|
|
809
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { className: "w-10 px-3 py-2 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
810
|
+
"input",
|
|
811
|
+
{
|
|
812
|
+
type: "checkbox",
|
|
813
|
+
checked: allPageSelected,
|
|
814
|
+
ref: (el) => {
|
|
815
|
+
if (el) el.indeterminate = somePageSelected;
|
|
816
|
+
},
|
|
817
|
+
onChange: toggleSelectAllPage,
|
|
818
|
+
"aria-label": L.selectAllRows,
|
|
819
|
+
"data-testid": `${testId}-select-all`,
|
|
820
|
+
className: "rounded border-input accent-primary"
|
|
821
|
+
}
|
|
822
|
+
) }),
|
|
823
|
+
visibleColumns.map((col) => {
|
|
824
|
+
const isSorted = sort?.id === col.id;
|
|
825
|
+
const ariaSort = !col.sortable ? void 0 : isSorted ? sort.desc ? "descending" : "ascending" : "none";
|
|
826
|
+
const align = ALIGN_CLASS[col.align ?? "left"];
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
828
|
+
"th",
|
|
829
|
+
{
|
|
830
|
+
scope: "col",
|
|
831
|
+
"aria-sort": ariaSort,
|
|
832
|
+
style: { width: col.width, minWidth: col.minWidth },
|
|
833
|
+
className: `px-3 py-2.5 text-[11px] font-bold uppercase tracking-wider text-muted-foreground select-none whitespace-nowrap ${align} ${pinClass(col, true)} ${col.headerClassName ?? ""}`,
|
|
834
|
+
children: col.sortable ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
835
|
+
"button",
|
|
836
|
+
{
|
|
837
|
+
type: "button",
|
|
838
|
+
onClick: () => toggleSort(col),
|
|
839
|
+
"data-testid": `${testId}-sort-${col.id}`,
|
|
840
|
+
className: "inline-flex items-center gap-1 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",
|
|
841
|
+
children: [
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: col.header }),
|
|
843
|
+
isSorted ? sort.desc ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArrowDown, { className: "w-3.5 h-3.5 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArrowUp, { className: "w-3.5 h-3.5 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArrowUpDown, { className: "w-3 h-3 opacity-40" })
|
|
844
|
+
]
|
|
845
|
+
}
|
|
846
|
+
) : col.header
|
|
847
|
+
},
|
|
848
|
+
col.id
|
|
849
|
+
);
|
|
850
|
+
})
|
|
851
|
+
] })
|
|
852
|
+
}
|
|
853
|
+
),
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { className: "divide-y divide-border", children: loading ? Array.from({ length: loadingRows }).map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { "data-testid": `${testId}-skeleton-row`, children: Array.from({ length: totalColSpan }).map((__, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: cellPadding, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 w-3/4 rounded bg-muted animate-pulse" }) }, colIdx)) }, `skeleton-${idx}`)) : pageRows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { colSpan: totalColSpan, className: "px-6 py-12 text-center", "data-testid": `${testId}-empty`, children: [
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-semibold text-foreground", children: hasActiveFilters ? L.noMatchesTitle : emptyTitle ?? L.emptyTitle }),
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: hasActiveFilters ? L.noMatchesDescription : emptyDescription ?? L.emptyDescription }),
|
|
857
|
+
hasActiveFilters ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
858
|
+
"button",
|
|
859
|
+
{
|
|
860
|
+
type: "button",
|
|
861
|
+
onClick: resetAllFilters,
|
|
862
|
+
className: "mt-3 h-8 px-3 text-xs font-medium rounded-sm border border-input bg-background hover:bg-muted",
|
|
863
|
+
children: L.filtersReset
|
|
864
|
+
}
|
|
865
|
+
) : emptyAction && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-3", children: emptyAction })
|
|
866
|
+
] }) }) : pageRows.map((row, rowIndex) => {
|
|
867
|
+
const rowId = getRowId(row, rowIndex);
|
|
868
|
+
const isSelected = selectedSet.has(rowId);
|
|
869
|
+
const isExpanded = expandedIds.has(rowId);
|
|
870
|
+
const extraClass = rowClassName ? rowClassName(row, rowIndex) : "";
|
|
871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, { children: [
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
873
|
+
"tr",
|
|
874
|
+
{
|
|
875
|
+
"data-testid": `${testId}-row-${rowId}`,
|
|
876
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
877
|
+
onClick: onRowClick ? () => onRowClick(row) : void 0,
|
|
878
|
+
onKeyDown: onRowClick ? (e) => {
|
|
879
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
880
|
+
e.preventDefault();
|
|
881
|
+
onRowClick(row);
|
|
882
|
+
}
|
|
883
|
+
} : void 0,
|
|
884
|
+
className: `transition-colors ${isSelected ? "bg-primary/5" : "hover:bg-muted/40"} ${onRowClick ? "cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring" : ""} ${extraClass}`,
|
|
885
|
+
children: [
|
|
886
|
+
renderExpandedRow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "w-9 px-2 py-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
887
|
+
"button",
|
|
888
|
+
{
|
|
889
|
+
type: "button",
|
|
890
|
+
onClick: (e) => {
|
|
891
|
+
e.stopPropagation();
|
|
892
|
+
toggleExpandRow(rowId);
|
|
893
|
+
},
|
|
894
|
+
"aria-expanded": isExpanded,
|
|
895
|
+
"aria-label": isExpanded ? L.collapseRow : L.expandRow,
|
|
896
|
+
"data-testid": `${testId}-expand-${rowId}`,
|
|
897
|
+
className: "h-7 w-7 inline-flex items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
899
|
+
import_lucide_react.ChevronRight,
|
|
900
|
+
{
|
|
901
|
+
className: `w-4 h-4 transition-transform ${isExpanded ? "rotate-90" : ""}`
|
|
902
|
+
}
|
|
903
|
+
)
|
|
904
|
+
}
|
|
905
|
+
) }),
|
|
906
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
907
|
+
"td",
|
|
908
|
+
{
|
|
909
|
+
className: "w-10 px-3 py-1.5",
|
|
910
|
+
onClick: (e) => e.stopPropagation(),
|
|
911
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
912
|
+
"input",
|
|
913
|
+
{
|
|
914
|
+
type: "checkbox",
|
|
915
|
+
checked: isSelected,
|
|
916
|
+
onChange: () => toggleSelectRow(rowId),
|
|
917
|
+
"aria-label": L.selectRow,
|
|
918
|
+
"data-testid": `${testId}-select-${rowId}`,
|
|
919
|
+
className: "rounded border-input accent-primary"
|
|
920
|
+
}
|
|
921
|
+
)
|
|
922
|
+
}
|
|
923
|
+
),
|
|
924
|
+
visibleColumns.map((col) => {
|
|
925
|
+
const align = ALIGN_CLASS[col.align ?? "left"];
|
|
926
|
+
const content = col.cell ? col.cell(row, rowIndex) : String(resolveCellValue(row, col) ?? "\u2013");
|
|
927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
928
|
+
"td",
|
|
929
|
+
{
|
|
930
|
+
className: `${cellPadding} text-foreground ${align} ${pinClass(col, false)} ${col.className ?? ""}`,
|
|
931
|
+
children: content
|
|
932
|
+
},
|
|
933
|
+
col.id
|
|
934
|
+
);
|
|
935
|
+
})
|
|
936
|
+
]
|
|
937
|
+
}
|
|
938
|
+
),
|
|
939
|
+
renderExpandedRow && isExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { "data-testid": `${testId}-expanded-${rowId}`, className: "bg-muted/20", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { colSpan: totalColSpan, className: "px-4 py-3", children: renderExpandedRow(row) }) })
|
|
940
|
+
] }, rowId);
|
|
941
|
+
}) })
|
|
942
|
+
] }) }),
|
|
943
|
+
paginate && effectiveTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
944
|
+
"div",
|
|
945
|
+
{
|
|
946
|
+
className: "flex flex-wrap items-center justify-between gap-3 text-xs text-muted-foreground",
|
|
947
|
+
"data-testid": `${testId}-pagination`,
|
|
948
|
+
children: [
|
|
949
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "tabular-nums", children: interpolateLabel(L.rangeOf, {
|
|
951
|
+
start: rangeStart,
|
|
952
|
+
end: rangeEnd,
|
|
953
|
+
total: effectiveTotal
|
|
954
|
+
}) }),
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "inline-flex items-center gap-1.5", children: [
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: L.rowsPerPage }),
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
958
|
+
"select",
|
|
959
|
+
{
|
|
960
|
+
value: pageSize,
|
|
961
|
+
onChange: (e) => setPageSize(Number(e.target.value)),
|
|
962
|
+
"data-testid": `${testId}-page-size`,
|
|
963
|
+
className: "h-8 px-2 rounded-sm border border-input bg-background text-foreground text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
964
|
+
children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: size, children: size }, size))
|
|
965
|
+
}
|
|
966
|
+
)
|
|
967
|
+
] })
|
|
968
|
+
] }),
|
|
969
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mr-2 tabular-nums", children: interpolateLabel(L.pageOf, { page: clampedPage, pages: totalPages }) }),
|
|
971
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
972
|
+
"button",
|
|
973
|
+
{
|
|
974
|
+
type: "button",
|
|
975
|
+
onClick: () => setPage(1),
|
|
976
|
+
disabled: clampedPage <= 1,
|
|
977
|
+
"aria-label": L.firstPage,
|
|
978
|
+
"data-testid": `${testId}-page-first`,
|
|
979
|
+
className: "h-8 w-8 inline-flex items-center justify-center rounded-sm border border-input bg-background text-foreground hover:bg-muted disabled:opacity-40",
|
|
980
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronsLeft, { className: "w-3.5 h-3.5" })
|
|
981
|
+
}
|
|
982
|
+
),
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
984
|
+
"button",
|
|
985
|
+
{
|
|
986
|
+
type: "button",
|
|
987
|
+
onClick: () => setPage(clampedPage - 1),
|
|
988
|
+
disabled: clampedPage <= 1,
|
|
989
|
+
"aria-label": L.previousPage,
|
|
990
|
+
"data-testid": `${testId}-page-prev`,
|
|
991
|
+
className: "h-8 w-8 inline-flex items-center justify-center rounded-sm border border-input bg-background text-foreground hover:bg-muted disabled:opacity-40",
|
|
992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronLeft, { className: "w-3.5 h-3.5" })
|
|
993
|
+
}
|
|
994
|
+
),
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
996
|
+
"button",
|
|
997
|
+
{
|
|
998
|
+
type: "button",
|
|
999
|
+
onClick: () => setPage(clampedPage + 1),
|
|
1000
|
+
disabled: clampedPage >= totalPages,
|
|
1001
|
+
"aria-label": L.nextPage,
|
|
1002
|
+
"data-testid": `${testId}-page-next`,
|
|
1003
|
+
className: "h-8 w-8 inline-flex items-center justify-center rounded-sm border border-input bg-background text-foreground hover:bg-muted disabled:opacity-40",
|
|
1004
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronRight, { className: "w-3.5 h-3.5" })
|
|
1005
|
+
}
|
|
1006
|
+
),
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1008
|
+
"button",
|
|
1009
|
+
{
|
|
1010
|
+
type: "button",
|
|
1011
|
+
onClick: () => setPage(totalPages),
|
|
1012
|
+
disabled: clampedPage >= totalPages,
|
|
1013
|
+
"aria-label": L.lastPage,
|
|
1014
|
+
"data-testid": `${testId}-page-last`,
|
|
1015
|
+
className: "h-8 w-8 inline-flex items-center justify-center rounded-sm border border-input bg-background text-foreground hover:bg-muted disabled:opacity-40",
|
|
1016
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronsRight, { className: "w-3.5 h-3.5" })
|
|
1017
|
+
}
|
|
1018
|
+
)
|
|
1019
|
+
] })
|
|
1020
|
+
]
|
|
1021
|
+
}
|
|
1022
|
+
)
|
|
1023
|
+
] });
|
|
1024
|
+
}
|
|
1025
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1026
|
+
0 && (module.exports = {
|
|
1027
|
+
DEFAULT_DATA_TABLE_LABELS,
|
|
1028
|
+
ScalioDataTable,
|
|
1029
|
+
buildCsv,
|
|
1030
|
+
escapeCsvCell,
|
|
1031
|
+
filterRows,
|
|
1032
|
+
interpolateLabel,
|
|
1033
|
+
loadTablePrefs,
|
|
1034
|
+
paginateRows,
|
|
1035
|
+
resolveCellValue,
|
|
1036
|
+
resolveColumnLabel,
|
|
1037
|
+
saveTablePrefs,
|
|
1038
|
+
sortRows
|
|
1039
|
+
});
|
|
1040
|
+
//# sourceMappingURL=index.js.map
|