@gemologic/sheen-table 0.1.0-rc.2 → 0.1.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/DataTable.js CHANGED
@@ -506,8 +506,8 @@ function Kt(t) {
506
506
  }
507
507
  function yr(e, t, n) {
508
508
  let r = gr.get(e.id);
509
- if (r) return r.position = t + 1, r.setSize = n, r;
510
- let i = {
509
+ if (r && r.row === e && r.position === t + 1 && r.setSize === n) return r;
510
+ let i = Object.freeze({
511
511
  kind: "data",
512
512
  key: `row:${e.id}`,
513
513
  row: e,
@@ -520,7 +520,7 @@ function Kt(t) {
520
520
  unloaded: !1,
521
521
  pending: !1,
522
522
  error: null
523
- };
523
+ });
524
524
  return gr.set(e.id, i), i;
525
525
  }
526
526
  let br = j(() => new Intl.NumberFormat(Zt()));
@@ -1138,94 +1138,98 @@ function Kt(t) {
1138
1138
  });
1139
1139
  let Qi = t.rowHeight ?? "var(--sheen-table-row-h)";
1140
1140
  if (typeof Qi != "string" || Qi.trim() === "") throw Error("rowHeight must be a nonempty CSS length");
1141
- let $i = () => ue() ?? Xt.state().density, ea = () => t.estimatedRowHeight ?? ($i() === "compact" ? 28 : $i() === "spacious" ? 42 : 34);
1142
- if (!Number.isFinite(ea()) || ea() <= 0) throw Error("estimatedRowHeight must be a positive finite number");
1143
- let ta = t.initialViewportHeight ?? 400;
1144
- if (!Number.isFinite(ta) || ta <= 0) throw Error("initialViewportHeight must be a positive finite number");
1145
- let na = we({
1141
+ let $i = () => ue() ?? Xt.state().density, ea = () => t.estimatedRowHeight ?? ($i() === "compact" ? 28 : $i() === "spacious" ? 42 : 34), ta = $i(), na = ea();
1142
+ if (!Number.isFinite(na) || na <= 0) throw Error("estimatedRowHeight must be a positive finite number");
1143
+ let ra = t.initialViewportHeight ?? 400;
1144
+ if (!Number.isFinite(ra) || ra <= 0) throw Error("initialViewportHeight must be a positive finite number");
1145
+ let ia = we({
1146
1146
  get count() {
1147
1147
  return Or();
1148
1148
  },
1149
1149
  getScrollElement: () => B ?? null,
1150
- estimateSize: ea,
1150
+ estimateSize: () => na,
1151
1151
  getItemKey: (e) => t.variableRowHeight ? kr(e)?.key ?? e : e,
1152
1152
  initialRect: {
1153
1153
  width: 1024,
1154
- height: ta
1154
+ height: ra
1155
1155
  },
1156
1156
  overscan: 8,
1157
1157
  useAnimationFrameWithResizeObserver: !0
1158
- }), ra = !1;
1159
- function ia(e, n) {
1160
- e.setAttribute("data-index", String(n)), ra && t.variableRowHeight && na.measureElement(e);
1158
+ }), aa = !1;
1159
+ function oa(e, n) {
1160
+ e.setAttribute("data-index", String(n)), aa && t.variableRowHeight && ia.measureElement(e);
1161
1161
  }
1162
1162
  ke(() => {
1163
- if (ra = !0, t.variableRowHeight) for (let e of B?.querySelectorAll("tbody tr[data-row-key]") ?? []) na.measureElement(e);
1164
- });
1165
- let aa = $i();
1166
- A(() => {
1167
- let e = $i();
1168
- ra && e !== aa && na.measure(), aa = e;
1163
+ if (aa = !0, t.variableRowHeight) for (let e of B?.querySelectorAll("tbody tr[data-row-key]") ?? []) ia.measureElement(e);
1164
+ }), A(() => {
1165
+ let e = $i(), t = ea();
1166
+ if (!Number.isFinite(t) || t <= 0) throw Error("estimatedRowHeight must be a positive finite number");
1167
+ let n = t !== na || e !== ta;
1168
+ na = t, ta = e, aa && n && ia.measure();
1169
1169
  });
1170
- let oa = /* @__PURE__ */ new Map(), sa = j(() => {
1171
- let e = /* @__PURE__ */ new Set(), t = na.getVirtualItems().flatMap((t) => {
1172
- let n = kr(t.index);
1173
- if (!n) return [];
1174
- e.add(n.key);
1175
- let r = oa.get(n.key);
1176
- if (r) return r.updateRow(n), r.updateItem(t), [r];
1177
- let [i, a] = M(n, { equals: !1 }), [o, s] = M(t, { equals: !1 }), c = Object.freeze({
1178
- key: n.key,
1179
- row: i,
1170
+ let sa = /* @__PURE__ */ new Map(), ca = j(() => {
1171
+ let e = /* @__PURE__ */ new Set(), t = [];
1172
+ for (let n of ia.getVirtualItems()) {
1173
+ let r = kr(n.index);
1174
+ if (!r) continue;
1175
+ e.add(r.key);
1176
+ let i = sa.get(r.key);
1177
+ if (i) {
1178
+ i.updateRow(r), i.updateItem(n), t.push(i);
1179
+ continue;
1180
+ }
1181
+ let [a, o] = M(r), [s, c] = M(n), l = Object.freeze({
1182
+ key: r.key,
1183
+ row: a,
1180
1184
  updateRow: (e) => {
1181
- a(e);
1185
+ o(e);
1182
1186
  },
1183
- item: o,
1187
+ item: s,
1184
1188
  updateItem: (e) => {
1185
- s(e);
1189
+ c(e);
1186
1190
  }
1187
1191
  });
1188
- return oa.set(n.key, c), [c];
1189
- });
1190
- for (let t of oa.keys()) e.has(t) || oa.delete(t);
1192
+ sa.set(r.key, l), t.push(l);
1193
+ }
1194
+ for (let t of sa.keys()) e.has(t) || sa.delete(t);
1191
1195
  return t;
1192
- }), [ca, la] = M(null), ua = j(() => {
1196
+ }), [la, ua] = M(null), da = j(() => {
1193
1197
  if (!t.onRowActivate && !L && !z && !t.grouping && E().length === 0) return null;
1194
- let e = ca();
1198
+ let e = la();
1195
1199
  return e && Ar(e) >= 0 ? e : kr(0)?.key ?? null;
1196
- }), da;
1197
- function fa(e) {
1200
+ }), fa;
1201
+ function pa(e) {
1198
1202
  let t = kr(e);
1199
1203
  if (!t || !B) return;
1200
- la(t.key), na.scrollToIndex(e, { align: "auto" });
1204
+ ua(t.key), ia.scrollToIndex(e, { align: "auto" });
1201
1205
  let n = 10, r = () => {
1202
- da = void 0;
1206
+ fa = void 0;
1203
1207
  let e = [...B?.querySelectorAll("tbody tr[data-row-key]") ?? []].find((e) => e.dataset.rowKey === t.key);
1204
1208
  if (e) {
1205
1209
  e.focus({ preventScroll: !0 });
1206
1210
  return;
1207
1211
  }
1208
- n--, n > 0 && (da = requestAnimationFrame(r));
1212
+ n--, n > 0 && (fa = requestAnimationFrame(r));
1209
1213
  };
1210
- da !== void 0 && cancelAnimationFrame(da), da = requestAnimationFrame(r);
1214
+ fa !== void 0 && cancelAnimationFrame(fa), fa = requestAnimationFrame(r);
1211
1215
  }
1212
- function pa(e, t) {
1216
+ function ma(e, t) {
1213
1217
  if (!z || q()) return;
1214
1218
  let n = z.setExpanded(e.row.id, t);
1215
1219
  fn((e) => e + 1), n.finally(() => fn((e) => e + 1));
1216
1220
  }
1217
- function ma(e) {
1221
+ function ha(e) {
1218
1222
  if (!z || q()) return;
1219
1223
  let t = z.retry(e.row.id);
1220
1224
  fn((e) => e + 1), t.finally(() => fn((e) => e + 1));
1221
1225
  }
1222
- let [ha, ga] = M(!1);
1226
+ let [ga, _a] = M(!1);
1223
1227
  ke(() => {
1224
- ga(!0);
1228
+ _a(!0);
1225
1229
  }), A(() => {
1226
- if (z && ha()) for (let e of wr()) e.kind === "data" && e.expanded && e.unloaded && !e.pending && e.error === null && pa(e, !0);
1230
+ if (z && ga()) for (let e of wr()) e.kind === "data" && e.expanded && e.unloaded && !e.pending && e.error === null && ma(e, !0);
1227
1231
  });
1228
- function _a(e, n) {
1232
+ function va(e, n) {
1229
1233
  if (e.target !== e.currentTarget || e.altKey) return;
1230
1234
  if (L && !q() && n.kind === "data" && (e.ctrlKey || e.metaKey) && !e.shiftKey && e.key.toLowerCase() === "a") {
1231
1235
  e.preventDefault(), Pr(!0);
@@ -1240,18 +1244,18 @@ function Kt(t) {
1240
1244
  return;
1241
1245
  }
1242
1246
  if (z && n.kind === "data" && n.canExpand && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.key === "ArrowRight") {
1243
- if (e.preventDefault(), !n.expanded) pa(n, !0);
1247
+ if (e.preventDefault(), !n.expanded) ma(n, !0);
1244
1248
  else {
1245
1249
  let e = Ar(n.key), t = kr(e + 1);
1246
- t?.kind === "data" && t.parentId === n.row.id && fa(e + 1);
1250
+ t?.kind === "data" && t.parentId === n.row.id && pa(e + 1);
1247
1251
  }
1248
1252
  return;
1249
1253
  }
1250
1254
  if (z && n.kind === "data" && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.key === "ArrowLeft") {
1251
- if (e.preventDefault(), n.expanded) pa(n, !1);
1255
+ if (e.preventDefault(), n.expanded) ma(n, !1);
1252
1256
  else if (n.parentId) {
1253
1257
  let e = wr().findIndex((e) => e.kind === "data" && e.row.id === n.parentId);
1254
- e >= 0 && fa(e);
1258
+ e >= 0 && pa(e);
1255
1259
  }
1256
1260
  return;
1257
1261
  }
@@ -1270,67 +1274,67 @@ function Kt(t) {
1270
1274
  if (o === null) return;
1271
1275
  e.preventDefault();
1272
1276
  let s = kr(o);
1273
- L && n.kind === "data" && e.shiftKey && s?.kind === "data" && ((!R || !J().rows.some((e) => e.id === R)) && (R = n.row.id), L.selectRange(R, s.row.id, !0), Mr()), fa(o);
1277
+ L && n.kind === "data" && e.shiftKey && s?.kind === "data" && ((!R || !J().rows.some((e) => e.id === R)) && (R = n.row.id), L.selectRange(R, s.row.id, !0), Mr()), pa(o);
1274
1278
  }
1275
- function va(e, t) {
1279
+ function ya(e, t) {
1276
1280
  L && !q() && t.kind === "data" && e.target instanceof Element && !e.target.closest("button, input, select, textarea, a, [data-sheen-selection-control]") && (e.shiftKey ? Nr(t.row.id, !0, !0) : e.ctrlKey || e.metaKey ? Nr(t.row.id, !Y(t.row.id), !1) : (L.clear(), L.setSelected(t.row.id, !0), R = t.row.id, Mr()), e.currentTarget instanceof HTMLElement && e.currentTarget.focus({ preventScroll: !0 }));
1277
1281
  }
1278
1282
  Oe(() => {
1279
- da !== void 0 && cancelAnimationFrame(da);
1283
+ fa !== void 0 && cancelAnimationFrame(fa);
1280
1284
  });
1281
- let ya, ba;
1282
- function xa() {
1285
+ let ba, xa;
1286
+ function Sa() {
1283
1287
  if (!B) return;
1284
1288
  let e = B.getBoundingClientRect(), t = B.querySelector("thead")?.getBoundingClientRect().bottom ?? e.top, n = [...B.querySelectorAll("tbody tr[data-row-key]")].find((e) => e.getBoundingClientRect().bottom > t);
1285
1289
  if (!n?.dataset.rowKey) return;
1286
- let r = Number(n.dataset.index), i = na.getVirtualItems().find((e) => e.index === r);
1287
- i && (ya = {
1290
+ let r = Number(n.dataset.index), i = ia.getVirtualItems().find((e) => e.index === r);
1291
+ i && (ba = {
1288
1292
  id: n.dataset.rowKey,
1289
1293
  offset: B.scrollTop - i.start
1290
1294
  });
1291
1295
  }
1292
- function Sa() {
1293
- ba !== void 0 && cancelAnimationFrame(ba), ba = requestAnimationFrame(() => {
1294
- ba = void 0, xa();
1296
+ function Ca() {
1297
+ xa !== void 0 && cancelAnimationFrame(xa), xa = requestAnimationFrame(() => {
1298
+ xa = void 0, Sa();
1295
1299
  });
1296
1300
  }
1297
1301
  Oe(() => {
1298
- ba !== void 0 && cancelAnimationFrame(ba);
1302
+ xa !== void 0 && cancelAnimationFrame(xa);
1299
1303
  });
1300
- let Ca = () => z || t.grouping ? wr() : Tr(), wa = Ca(), Ta = l(G(), N);
1304
+ let wa = () => z || t.grouping ? wr() : Tr(), Ta = wa(), Ea = l(G(), N);
1301
1305
  A(() => {
1302
- let e = Ca(), t = l(G(), N), n = ya;
1303
- if (B && n && e !== wa && t === Ta) {
1304
- let e = Ar(n.id), t = e < 0 ? void 0 : na.getOffsetForIndex(e, "start")?.[0];
1306
+ let e = wa(), t = l(G(), N), n = ba;
1307
+ if (B && n && e !== Ta && t === Ea) {
1308
+ let e = Ar(n.id), t = e < 0 ? void 0 : ia.getOffsetForIndex(e, "start")?.[0];
1305
1309
  t !== void 0 && (B.scrollTop = Math.max(0, t + n.offset));
1306
1310
  }
1307
- wa = e, Ta = t;
1311
+ Ta = e, Ea = t;
1308
1312
  });
1309
- let Ea = j(() => {
1313
+ let Da = j(() => {
1310
1314
  let t = G().pagination;
1311
1315
  return t === !1 ? void 0 : e(t, K().total);
1312
- }), Da = j(() => {
1316
+ }), Oa = j(() => {
1313
1317
  if (I && G().pagination === !1) return e({
1314
1318
  pageIndex: Ln(),
1315
1319
  pageSize: I.pageSize
1316
1320
  }, Or());
1317
1321
  });
1318
1322
  A(() => {
1319
- let e = Da();
1323
+ let e = Oa();
1320
1324
  e && e.pageIndex !== Ln() && Rn(e.pageIndex);
1321
1325
  });
1322
- let Oa = j(() => {
1326
+ let ka = j(() => {
1323
1327
  if (!I) return Object.freeze([]);
1324
- let e = Da(), t = e?.start ?? 0, n = e?.end ?? Or(), r = [];
1328
+ let e = Oa(), t = e?.start ?? 0, n = e?.end ?? Or(), r = [];
1325
1329
  for (let e = t; e < n; e++) {
1326
1330
  let t = kr(e);
1327
1331
  t && r.push(t);
1328
1332
  }
1329
1333
  return Object.freeze(r);
1330
- }), ka = j(() => {
1334
+ }), Aa = j(() => {
1331
1335
  let e = Z();
1332
1336
  return e.find((e) => e.definition.id === I?.titleColumn) ?? e[0];
1333
- }), Aa = j(() => Oa().flatMap((e) => e.kind === "data" ? [e.row] : [])), ja = j(() => Aa().filter((e) => Y(e.id)).length), Ma = j(() => Z().flatMap((e) => {
1337
+ }), ja = j(() => ka().flatMap((e) => e.kind === "data" ? [e.row] : [])), Ma = j(() => ja().filter((e) => Y(e.id)).length), Na = j(() => Z().flatMap((e) => {
1334
1338
  if (!e.definition.sort) return [];
1335
1339
  let t = G().sorting.find((t) => t.column === e.definition.id)?.direction, n = t === "asc" ? P().sortedAscending : t === "desc" ? P().sortedDescending : P().notSorted;
1336
1340
  return [{
@@ -1340,35 +1344,35 @@ function Kt(t) {
1340
1344
  disabled: q(),
1341
1345
  onSelect: () => ur(e.definition.id, !1)
1342
1346
  }];
1343
- })), Na = j(() => {
1344
- let e = ca();
1345
- return e && Oa().some((t) => t.key === e) ? e : Oa()[0]?.key ?? null;
1346
- }), Pa = j(() => G().search.length > 0 || Lt(G().filter)), Fa = () => G().search.length > 0 ? P().clearSearchAndFilters : P().clearFilters, Q = j(() => Kn() ? Pa() ? "no-results" : "empty" : Yn() ? "error" : "cold"), Ia = j(() => t.mode === "server" ? K().rows : Gn()?.view ?? []), La = j(() => Z().some((e) => e.definition.footer !== null)), Ra = () => Math.max(1, Z().length + +!!L), za = () => Qt.length + +!!L, Ba = Object.freeze([
1347
+ })), Pa = j(() => {
1348
+ let e = la();
1349
+ return e && ka().some((t) => t.key === e) ? e : ka()[0]?.key ?? null;
1350
+ }), Fa = j(() => G().search.length > 0 || Lt(G().filter)), Ia = () => G().search.length > 0 ? P().clearSearchAndFilters : P().clearFilters, Q = j(() => Kn() ? Fa() ? "no-results" : "empty" : Yn() ? "error" : "cold"), La = j(() => t.mode === "server" ? K().rows : Gn()?.view ?? []), Ra = j(() => Z().some((e) => e.definition.footer !== null)), za = () => Math.max(1, Z().length + +!!L), Ba = () => Qt.length + +!!L, Va = Object.freeze([
1347
1351
  0,
1348
1352
  1,
1349
1353
  2,
1350
1354
  3,
1351
1355
  4,
1352
1356
  5
1353
- ]), Va = () => `sheen-data-table${t.class ? ` ${t.class}` : ""}`;
1354
- function Ha(e) {
1355
- let t = Da();
1357
+ ]), Ha = () => `sheen-data-table${t.class ? ` ${t.class}` : ""}`;
1358
+ function Ua(e) {
1359
+ let t = Oa();
1356
1360
  !t || q() || e < 0 || e >= t.pageCount || e === t.pageIndex || (Rn(e), Bn?.scrollIntoView({ block: "nearest" }));
1357
1361
  }
1358
- function Ua(e) {
1362
+ function Wa(e) {
1359
1363
  if (L && !q()) {
1360
- for (let t of Aa()) L.setSelected(t.id, e);
1364
+ for (let t of ja()) L.setSelected(t.id, e);
1361
1365
  Mr();
1362
1366
  }
1363
1367
  }
1364
- function Wa(e) {
1365
- let t = Oa()[e];
1366
- t && Bn && (la(t.key), [...Bn.querySelectorAll("[data-mobile-row-key]")].find((e) => e.dataset.mobileRowKey === t.key)?.focus({ preventScroll: !0 }));
1368
+ function Ga(e) {
1369
+ let t = ka()[e];
1370
+ t && Bn && (ua(t.key), [...Bn.querySelectorAll("[data-mobile-row-key]")].find((e) => e.dataset.mobileRowKey === t.key)?.focus({ preventScroll: !0 }));
1367
1371
  }
1368
- function Ga(e, n) {
1372
+ function Ka(e, n) {
1369
1373
  if (e.target !== e.currentTarget || e.altKey) return;
1370
1374
  if (L && !q() && n.kind === "data" && (e.ctrlKey || e.metaKey) && !e.shiftKey && e.key.toLowerCase() === "a") {
1371
- e.preventDefault(), Ua(!0);
1375
+ e.preventDefault(), Wa(!0);
1372
1376
  return;
1373
1377
  }
1374
1378
  if (n.kind === "group" && !e.ctrlKey && !e.metaKey && !e.shiftKey && (e.key === " " || e.key === "Enter" || e.key === "ArrowRight" || e.key === "ArrowLeft")) {
@@ -1376,7 +1380,7 @@ function Kt(t) {
1376
1380
  return;
1377
1381
  }
1378
1382
  if (z && n.kind === "data" && n.canExpand && !e.ctrlKey && !e.metaKey && !e.shiftKey && (e.key === "ArrowRight" || e.key === "ArrowLeft")) {
1379
- e.preventDefault(), pa(n, e.key === "ArrowRight");
1383
+ e.preventDefault(), ma(n, e.key === "ArrowRight");
1380
1384
  return;
1381
1385
  }
1382
1386
  if (L && !q() && n.kind === "data" && !e.ctrlKey && !e.metaKey && e.key === " ") {
@@ -1388,10 +1392,10 @@ function Kt(t) {
1388
1392
  return;
1389
1393
  }
1390
1394
  if (e.ctrlKey || e.metaKey || e.shiftKey) return;
1391
- let r = Oa().findIndex((e) => e.key === n.key), i = Math.max(0, Oa().length - 1), a = e.key === "ArrowDown" ? Math.min(i, r + 1) : e.key === "ArrowUp" ? Math.max(0, r - 1) : e.key === "Home" ? 0 : e.key === "End" ? i : null;
1392
- a === null || r < 0 || (e.preventDefault(), Wa(a));
1395
+ let r = ka().findIndex((e) => e.key === n.key), i = Math.max(0, ka().length - 1), a = e.key === "ArrowDown" ? Math.min(i, r + 1) : e.key === "ArrowUp" ? Math.max(0, r - 1) : e.key === "Home" ? 0 : e.key === "End" ? i : null;
1396
+ a === null || r < 0 || (e.preventDefault(), Ga(a));
1393
1397
  }
1394
- function Ka(e) {
1398
+ function qa(e) {
1395
1399
  let t = !1;
1396
1400
  return (() => {
1397
1401
  var n = Ae();
@@ -1420,20 +1424,20 @@ function Kt(t) {
1420
1424
  })();
1421
1425
  }
1422
1426
  let $ = !!(z || t.grouping);
1423
- function qa(e) {
1427
+ function Ja(e) {
1424
1428
  let t = ei().findIndex((t) => t.id === e);
1425
1429
  if (t < 0) throw Error(`Missing accepted state for table column: ${e}`);
1426
1430
  return t + 1 + +!!L;
1427
1431
  }
1428
- function Ja(t) {
1432
+ function Ya(t) {
1429
1433
  let n = G().pagination;
1430
1434
  return $ || n === !1 ? t + 2 : e(n, K().total).start + t + 2;
1431
1435
  }
1432
- let Ya = () => Or() === 0 ? void 0 : $ ? -1 : K().total + 1 + +!!La(), Xa = () => $ ? Or() + 2 : K().total + 2;
1433
- function Za(e) {
1436
+ let Xa = () => Or() === 0 ? void 0 : $ ? -1 : K().total + 1 + +!!Ra(), Za = () => $ ? Or() + 2 : K().total + 2;
1437
+ function Qa(e) {
1434
1438
  return `${e.expanded ? P().collapse : P().expand} ${e.row.id}`;
1435
1439
  }
1436
- function Qa(e) {
1440
+ function $a(e) {
1437
1441
  let t = e.column.definition.editor, n = e.column.definition.accessor;
1438
1442
  if (!t || !n) throw Error(`Editable cell ${e.row.row.id}/${e.column.definition.id} is missing its editor`);
1439
1443
  let r = t, i = Ee(), a, o, s = !1, c = n(e.row.row.value()), l = () => (e.record.revision(), e.record.controller.getSnapshot()), u = () => l().draft?.value ?? l().committed, d = () => P().editCell.replaceAll("{column}", e.column.definition.header).replaceAll("{id}", e.row.row.id), f = () => {
@@ -1598,8 +1602,8 @@ function Kt(t) {
1598
1602
  }), null), e;
1599
1603
  })();
1600
1604
  }
1601
- function $a(e) {
1602
- let t = () => e.column.definition.accessor?.(e.row.row.value()) ?? null, n = () => e.edit ? b(Qa, {
1605
+ function eo(e) {
1606
+ let t = () => e.column.definition.accessor?.(e.row.row.value()) ?? null, n = () => e.edit ? b($a, {
1603
1607
  get row() {
1604
1608
  return e.row;
1605
1609
  },
@@ -1621,8 +1625,8 @@ function Kt(t) {
1621
1625
  },
1622
1626
  get children() {
1623
1627
  var t = Be();
1624
- return t.$$click = () => pa(e.row, !e.row.expanded), S(t, () => e.row.expanded ? "▾" : "▸"), x((n) => {
1625
- var r = Za(e.row), i = e.row.expanded, a = q();
1628
+ return t.$$click = () => ma(e.row, !e.row.expanded), S(t, () => e.row.expanded ? "▾" : "▸"), x((n) => {
1629
+ var r = Qa(e.row), i = e.row.expanded, a = q();
1626
1630
  return r !== n.e && w(t, "aria-label", n.e = r), i !== n.t && w(t, "aria-expanded", n.t = i), a !== n.a && (t.disabled = n.a = a), n;
1627
1631
  }, {
1628
1632
  e: void 0,
@@ -1644,12 +1648,12 @@ function Kt(t) {
1644
1648
  },
1645
1649
  get children() {
1646
1650
  var t = He(), n = t.firstChild, r = n.nextSibling;
1647
- return S(t, () => P().serverError, n), r.$$click = () => ma(e.row), S(r, () => P().retry), t;
1651
+ return S(t, () => P().serverError, n), r.$$click = () => ha(e.row), S(r, () => P().retry), t;
1648
1652
  }
1649
1653
  }), null), x((n) => T(t, "--sheen-table-depth", Math.max(0, e.row.depth - 1))), t;
1650
1654
  })();
1651
1655
  }
1652
- function eo(e) {
1656
+ function to(e) {
1653
1657
  return e.labelColumn ? (() => {
1654
1658
  var n = Ge(), r = n.firstChild, i = r.firstChild, a = i.nextSibling, o = a.firstChild.nextSibling;
1655
1659
  return o.nextSibling, S(n, b(k, {
@@ -1673,7 +1677,7 @@ function Kt(t) {
1673
1677
  }), r), S(r, () => e.row.label, i), S(a, () => br().format(e.row.group.count), o), n;
1674
1678
  })() : jt(e.row.group.aggregates.find((t) => t.column === e.column.definition.id)?.value ?? null);
1675
1679
  }
1676
- function to(e) {
1680
+ function no(e) {
1677
1681
  let t = !1;
1678
1682
  return b(me, {
1679
1683
  "data-sheen-selection-control": "",
@@ -1698,7 +1702,7 @@ function Kt(t) {
1698
1702
  }
1699
1703
  });
1700
1704
  }
1701
- function no(e) {
1705
+ function ro(e) {
1702
1706
  let t = () => Dt(e.row), n = j(() => {
1703
1707
  let n = t();
1704
1708
  return n ? ai(n.row, e.column) : void 0;
@@ -1717,7 +1721,7 @@ function Kt(t) {
1717
1721
  },
1718
1722
  children: (t) => (() => {
1719
1723
  var n = Ke();
1720
- return S(n, b(eo, {
1724
+ return S(n, b(to, {
1721
1725
  get row() {
1722
1726
  return t();
1723
1727
  },
@@ -1740,7 +1744,7 @@ function Kt(t) {
1740
1744
  },
1741
1745
  children: (t) => (() => {
1742
1746
  var a = Ke();
1743
- return S(a, b($a, {
1747
+ return S(a, b(eo, {
1744
1748
  get row() {
1745
1749
  return t();
1746
1750
  },
@@ -1769,8 +1773,8 @@ function Kt(t) {
1769
1773
  })()
1770
1774
  });
1771
1775
  }
1772
- function ro(e) {
1773
- let t = () => Dt(e.row), n = ka, r = () => Z().filter((e) => e !== n());
1776
+ function io(e) {
1777
+ let t = () => Dt(e.row), n = Aa, r = () => Z().filter((e) => e !== n());
1774
1778
  return [(() => {
1775
1779
  var r = qe(), i = r.firstChild;
1776
1780
  return S(r, b(k, {
@@ -1780,7 +1784,7 @@ function Kt(t) {
1780
1784
  children: (e) => b(k, {
1781
1785
  when: L,
1782
1786
  get children() {
1783
- return b(to, { get row() {
1787
+ return b(no, { get row() {
1784
1788
  return e().row;
1785
1789
  } });
1786
1790
  }
@@ -1792,7 +1796,7 @@ function Kt(t) {
1792
1796
  get fallback() {
1793
1797
  return t()?.row.id ?? Ot(e.row)?.label ?? "";
1794
1798
  },
1795
- children: (t) => b(no, {
1799
+ children: (t) => b(ro, {
1796
1800
  get row() {
1797
1801
  return e.row;
1798
1802
  },
@@ -1836,7 +1840,7 @@ function Kt(t) {
1836
1840
  },
1837
1841
  children: (t) => (() => {
1838
1842
  var n = Ye(), r = n.firstChild, i = r.nextSibling;
1839
- return S(r, () => t.definition.header), S(i, b(no, {
1843
+ return S(r, () => t.definition.header), S(i, b(ro, {
1840
1844
  get row() {
1841
1845
  return e.row;
1842
1846
  },
@@ -1850,7 +1854,7 @@ function Kt(t) {
1850
1854
  }
1851
1855
  return (() => {
1852
1856
  var e = st(), n = e.firstChild, r = n.firstChild, i = r.firstChild, a = i.firstChild, o = a.nextSibling.firstChild, s = zn;
1853
- typeof s == "function" ? D(s, e) : zn = e, w(e, "data-mobile-layout", I ? "" : void 0), w(e, "data-selection", L ? "multiple" : void 0), T(e, "--sheen-data-table-initial-viewport-height", `${ta}px`), S(e, b(k, {
1857
+ typeof s == "function" ? D(s, e) : zn = e, w(e, "data-mobile-layout", I ? "" : void 0), w(e, "data-selection", L ? "multiple" : void 0), T(e, "--sheen-data-table-initial-viewport-height", `${ra}px`), S(e, b(k, {
1854
1858
  get when() {
1855
1859
  return C(() => !!Kn())() ? Yn() : null;
1856
1860
  },
@@ -1990,7 +1994,7 @@ function Kt(t) {
1990
1994
  var e = Ze(), t = e.firstChild;
1991
1995
  return S(t, () => P().refreshing), e;
1992
1996
  }
1993
- }), r), r.addEventListener("scroll", Sa), D((e) => {
1997
+ }), r), r.addEventListener("scroll", Ca), D((e) => {
1994
1998
  B = e;
1995
1999
  }, r);
1996
2000
  var c = V;
@@ -2073,7 +2077,7 @@ function Kt(t) {
2073
2077
  }), l.addEventListener("pointercancel", Ki), l.$$pointerup = Yi, l.$$pointermove = Ji, l.$$pointerdown = (t) => qi(t, e), l.$$keydown = (t) => Xi(t, e), u.$$dblclick = () => ki(e), u.$$keydown = (t) => Wi(t, e), u.addEventListener("lostpointercapture", () => {
2074
2078
  Ri?.column === e && Bi();
2075
2079
  }), u.addEventListener("pointercancel", Bi), u.$$pointerup = Ui, u.$$pointermove = Hi, u.$$pointerdown = (t) => Vi(t, e), w(u, "aria-controls", Yt), x((r) => {
2076
- var c = qa(e.definition.id), d = e.definition.id, f = e.state().pin || void 0, p = Li(e), m = t()?.direction, h = t() ? n() : void 0, g = Ii(e), _ = n() === 1 ? t()?.direction === "asc" ? "ascending" : t()?.direction === "desc" ? "descending" : void 0 : void 0, ee = a(), te = i(), v = e.definition.minWidth ?? 80, y = e.definition.maxWidth ?? 4096, ne = o(), re = P().columnWidthPixels.replace("{width}", String(o()));
2080
+ var c = Ja(e.definition.id), d = e.definition.id, f = e.state().pin || void 0, p = Li(e), m = t()?.direction, h = t() ? n() : void 0, g = Ii(e), _ = n() === 1 ? t()?.direction === "asc" ? "ascending" : t()?.direction === "desc" ? "descending" : void 0 : void 0, ee = a(), te = i(), v = e.definition.minWidth ?? 80, y = e.definition.maxWidth ?? 4096, ne = o(), re = P().columnWidthPixels.replace("{width}", String(o()));
2077
2081
  return c !== r.e && w(s, "aria-colindex", r.e = c), d !== r.t && w(s, "data-column", r.t = d), f !== r.a && w(s, "data-pin", r.a = f), p !== r.o && w(s, "data-pin-edge", r.o = p), m !== r.i && w(s, "data-sort-direction", r.i = m), h !== r.n && w(s, "data-sort-priority", r.n = h), r.s = fe(s, g, r.s), _ !== r.h && w(s, "aria-sort", r.h = _), ee !== r.r && w(l, "aria-label", r.r = ee), te !== r.d && w(u, "aria-label", r.d = te), v !== r.l && w(u, "aria-valuemin", r.l = v), y !== r.u && w(u, "aria-valuemax", r.u = y), ne !== r.c && w(u, "aria-valuenow", r.c = ne), re !== r.w && w(u, "aria-valuetext", r.w = re), r;
2078
2082
  }, {
2079
2083
  e: void 0,
@@ -2107,12 +2111,12 @@ function Kt(t) {
2107
2111
  get children() {
2108
2112
  var e = _t(), t = e.firstChild;
2109
2113
  return S(t, () => P().loading), S(e, b(O, {
2110
- each: Ba,
2114
+ each: Va,
2111
2115
  children: () => (() => {
2112
2116
  var e = bt();
2113
2117
  return S(e, b(O, {
2114
2118
  get each() {
2115
- return Array.from({ length: Ra() });
2119
+ return Array.from({ length: za() });
2116
2120
  },
2117
2121
  children: () => b(be, {})
2118
2122
  })), x((t) => T(e, "grid-template-columns", Ci())), e;
@@ -2149,7 +2153,7 @@ function Kt(t) {
2149
2153
  return b(pe, {
2150
2154
  onClick: fr,
2151
2155
  get children() {
2152
- return Fa();
2156
+ return Ia();
2153
2157
  }
2154
2158
  });
2155
2159
  }
@@ -2163,7 +2167,7 @@ function Kt(t) {
2163
2167
  return b(_e, { kind: "empty" });
2164
2168
  }
2165
2169
  }), null), x((r) => {
2166
- var i = Q(), a = Ci(), o = Ra(), s = za();
2170
+ var i = Q(), a = Ci(), o = za(), s = Ba();
2167
2171
  return i !== r.e && w(e, "data-state", r.e = i), a !== r.t && T(t, "grid-template-columns", r.t = a), o !== r.a && w(n, "colspan", r.a = o), s !== r.o && w(n, "aria-colspan", r.o = s), r;
2168
2172
  }, {
2169
2173
  e: void 0,
@@ -2177,10 +2181,10 @@ function Kt(t) {
2177
2181
  var e = $e();
2178
2182
  return S(e, b(O, {
2179
2183
  get each() {
2180
- return sa();
2184
+ return ca();
2181
2185
  },
2182
2186
  children: (e) => {
2183
- let n = () => e.row(), r = () => Dt(n()), i = () => Ot(n()), a = () => {
2187
+ let n = () => e.row(), r = $ ? () => Dt(n()) : j(() => Dt(n()), void 0, { equals: (e, t) => e?.row === t?.row }), i = () => Ot(n()), a = () => {
2184
2188
  let e = Z();
2185
2189
  return e.some((e) => e.definition.id === t.grouping?.by) ? t.grouping?.by : e[0]?.definition.id;
2186
2190
  };
@@ -2198,7 +2202,7 @@ function Kt(t) {
2198
2202
  return w(e, "role", $ ? "gridcell" : void 0), e;
2199
2203
  })();
2200
2204
  },
2201
- children: (e) => b(Ka, { get row() {
2205
+ children: (e) => b(qa, { get row() {
2202
2206
  return e().row;
2203
2207
  } })
2204
2208
  });
@@ -2208,10 +2212,10 @@ function Kt(t) {
2208
2212
  return Z();
2209
2213
  },
2210
2214
  children: (e) => {
2211
- let t = j(() => {
2215
+ let t = e.definition.editor ? j(() => {
2212
2216
  let t = r();
2213
2217
  return t ? ai(t.row, e) : void 0;
2214
- }), n = () => oi(t()), o = () => {
2218
+ }) : () => void 0, n = () => oi(t()), o = () => {
2215
2219
  let e = n();
2216
2220
  return !(!e || e.invalid === null && e.error === null);
2217
2221
  };
@@ -2226,7 +2230,7 @@ function Kt(t) {
2226
2230
  get when() {
2227
2231
  return i();
2228
2232
  },
2229
- children: (t) => b(eo, {
2233
+ children: (t) => b(to, {
2230
2234
  get row() {
2231
2235
  return t();
2232
2236
  },
@@ -2237,7 +2241,7 @@ function Kt(t) {
2237
2241
  })
2238
2242
  });
2239
2243
  },
2240
- children: (n) => b($a, {
2244
+ children: (n) => b(eo, {
2241
2245
  get row() {
2242
2246
  return n();
2243
2247
  },
@@ -2250,7 +2254,7 @@ function Kt(t) {
2250
2254
  }
2251
2255
  })
2252
2256
  })), x((r) => {
2253
- var i = qa(e.definition.id), a = e.definition.id, c = e.state().pin || void 0, l = Li(e), u = Ii(e), d = e.definition.align, f = e.definition.numeric || void 0, p = t() ? "" : void 0, m = o() ? "" : void 0, h = n()?.stale ? "" : void 0, g = n()?.pending ? "" : void 0, _ = n()?.conflict ? "" : void 0;
2257
+ var i = Ja(e.definition.id), a = e.definition.id, c = e.state().pin || void 0, l = Li(e), u = Ii(e), d = e.definition.align, f = e.definition.numeric || void 0, p = t() ? "" : void 0, m = o() ? "" : void 0, h = n()?.stale ? "" : void 0, g = n()?.pending ? "" : void 0, _ = n()?.conflict ? "" : void 0;
2254
2258
  return i !== r.e && w(s, "aria-colindex", r.e = i), a !== r.t && w(s, "data-column", r.t = a), c !== r.a && w(s, "data-pin", r.a = c), l !== r.o && w(s, "data-pin-edge", r.o = l), r.i = fe(s, u, r.i), d !== r.n && w(s, "data-align", r.n = d), f !== r.s && w(s, "data-numeric", r.s = f), p !== r.h && w(s, "data-editable", r.h = p), m !== r.r && w(s, "data-invalid", r.r = m), h !== r.d && w(s, "data-stale", r.d = h), g !== r.l && w(s, "data-pending", r.l = g), _ !== r.u && w(s, "data-conflict", r.u = _), r;
2255
2259
  }, {
2256
2260
  e: void 0,
@@ -2272,8 +2276,8 @@ function Kt(t) {
2272
2276
  }
2273
2277
  if (t.actions === void 0) return (() => {
2274
2278
  var a = St();
2275
- return D((t) => ia(t, e.item().index), a), a.$$click = (e) => va(e, n()), a.$$keydown = (e) => _a(e, n()), a.addEventListener("focus", () => la(e.key)), T(a, "min-block-size", Qi), S(a, b(o, {})), x((o) => {
2276
- var s = e.key, c = r()?.row.id, l = i()?.group.id, u = e.item().index, d = r() && Y(r()?.row.id ?? "") ? "" : void 0, f = r()?.pending ? "" : void 0, p = r() && r()?.error !== null ? "" : void 0, m = ua() === e.key ? 0 : t.onRowActivate || L || $ ? -1 : void 0, h = Ja(e.item().index), g = $ ? r()?.depth ?? 1 : void 0, _ = $ ? n().position : void 0, ee = $ ? n().setSize : void 0, te = i()?.expanded ?? (r()?.canExpand ? r()?.expanded : void 0), v = L && r() ? Y(r()?.row.id ?? "") : void 0, y = r()?.pending ? !0 : void 0, ne = Ci(), re = `translateY(${e.item().start}px)`, ie = t.variableRowHeight ? void 0 : Qi;
2279
+ return D((t) => oa(t, e.item().index), a), a.$$click = (e) => ya(e, n()), a.$$keydown = (e) => va(e, n()), a.addEventListener("focus", () => ua(e.key)), T(a, "min-block-size", Qi), S(a, b(o, {})), x((o) => {
2280
+ var s = e.key, c = r()?.row.id, l = i()?.group.id, u = e.item().index, d = r() && Y(r()?.row.id ?? "") ? "" : void 0, f = r()?.pending ? "" : void 0, p = r() && r()?.error !== null ? "" : void 0, m = da() === e.key ? 0 : t.onRowActivate || L || $ ? -1 : void 0, h = Ya(e.item().index), g = $ ? r()?.depth ?? 1 : void 0, _ = $ ? n().position : void 0, ee = $ ? n().setSize : void 0, te = i()?.expanded ?? (r()?.canExpand ? r()?.expanded : void 0), v = L && r() ? Y(r()?.row.id ?? "") : void 0, y = r()?.pending ? !0 : void 0, ne = Ci(), re = `translateY(${e.item().start}px)`, ie = t.variableRowHeight ? void 0 : Qi;
2277
2281
  return s !== o.e && w(a, "data-row-key", o.e = s), c !== o.t && w(a, "data-row-id", o.t = c), l !== o.a && w(a, "data-group-id", o.a = l), u !== o.o && w(a, "data-index", o.o = u), d !== o.i && w(a, "data-selected", o.i = d), f !== o.n && w(a, "data-loading", o.n = f), p !== o.s && w(a, "data-load-error", o.s = p), m !== o.h && w(a, "tabindex", o.h = m), h !== o.r && w(a, "aria-rowindex", o.r = h), g !== o.d && w(a, "aria-level", o.d = g), _ !== o.l && w(a, "aria-posinset", o.l = _), ee !== o.u && w(a, "aria-setsize", o.u = ee), te !== o.c && w(a, "aria-expanded", o.c = te), v !== o.w && w(a, "aria-selected", o.w = v), y !== o.m && w(a, "aria-busy", o.m = y), ne !== o.f && T(a, "grid-template-columns", o.f = ne), re !== o.y && T(a, "transform", o.y = re), ie !== o.g && T(a, "block-size", o.g = ie), o;
2278
2282
  }, {
2279
2283
  e: void 0,
@@ -2331,10 +2335,10 @@ function Kt(t) {
2331
2335
  return r() && r()?.error !== null ? "" : void 0;
2332
2336
  },
2333
2337
  get tabIndex() {
2334
- return C(() => ua() === e.key)() ? 0 : t.onRowActivate || L || $ || E().length > 0 ? -1 : void 0;
2338
+ return C(() => da() === e.key)() ? 0 : t.onRowActivate || L || $ || E().length > 0 ? -1 : void 0;
2335
2339
  },
2336
2340
  get "aria-rowindex"() {
2337
- return Ja(e.item().index);
2341
+ return Ya(e.item().index);
2338
2342
  },
2339
2343
  get "aria-level"() {
2340
2344
  return $ ? r()?.depth ?? 1 : void 0;
@@ -2354,12 +2358,12 @@ function Kt(t) {
2354
2358
  get "aria-busy"() {
2355
2359
  return r()?.pending ? !0 : void 0;
2356
2360
  },
2357
- onFocus: () => la(e.key),
2358
- onKeyDown: (e) => _a(e, n()),
2359
- onClick: (e) => va(e, n()),
2361
+ onFocus: () => ua(e.key),
2362
+ onKeyDown: (e) => va(e, n()),
2363
+ onClick: (e) => ya(e, n()),
2360
2364
  ref: (t) => {
2361
2365
  if (!(t instanceof HTMLTableRowElement)) throw Error("DataTable context rows must render as table rows");
2362
- ia(t, e.item().index);
2366
+ oa(t, e.item().index);
2363
2367
  },
2364
2368
  get style() {
2365
2369
  return {
@@ -2374,11 +2378,11 @@ function Kt(t) {
2374
2378
  }
2375
2379
  });
2376
2380
  }
2377
- })), x((t) => T(e, "height", `${na.getTotalSize()}px`)), e;
2381
+ })), x((t) => T(e, "height", `${ia.getTotalSize()}px`)), e;
2378
2382
  }
2379
2383
  }), null), S(i, b(k, {
2380
2384
  get when() {
2381
- return La();
2385
+ return Ra();
2382
2386
  },
2383
2387
  get children() {
2384
2388
  var e = tt(), t = e.firstChild;
@@ -2396,9 +2400,9 @@ function Kt(t) {
2396
2400
  var t = xt();
2397
2401
  return w(t, "role", $ ? "gridcell" : void 0), S(t, (() => {
2398
2402
  var t = C(() => typeof e.definition.footer == "function");
2399
- return () => t() ? e.definition.footer(Ia()) : e.definition.footer ?? "";
2403
+ return () => t() ? e.definition.footer(La()) : e.definition.footer ?? "";
2400
2404
  })()), x((n) => {
2401
- var r = qa(e.definition.id), i = e.definition.id, a = e.state().pin || void 0, o = Li(e), s = Ii(e), c = e.definition.align, l = e.definition.numeric || void 0;
2405
+ var r = Ja(e.definition.id), i = e.definition.id, a = e.state().pin || void 0, o = Li(e), s = Ii(e), c = e.definition.align, l = e.definition.numeric || void 0;
2402
2406
  return r !== n.e && w(t, "aria-colindex", n.e = r), i !== n.t && w(t, "data-column", n.t = i), a !== n.a && w(t, "data-pin", n.a = a), o !== n.o && w(t, "data-pin-edge", n.o = o), n.i = fe(t, s, n.i), c !== n.n && w(t, "data-align", n.n = c), l !== n.s && w(t, "data-numeric", n.s = l), n;
2403
2407
  }, {
2404
2408
  e: void 0,
@@ -2411,7 +2415,7 @@ function Kt(t) {
2411
2415
  }), t;
2412
2416
  })()
2413
2417
  }), null), x((e) => {
2414
- var n = Xa(), r = Ci();
2418
+ var n = Za(), r = Ci();
2415
2419
  return n !== e.e && w(t, "aria-rowindex", e.e = n), r !== e.t && T(t, "grid-template-columns", e.t = r), e;
2416
2420
  }, {
2417
2421
  e: void 0,
@@ -2426,7 +2430,7 @@ function Kt(t) {
2426
2430
  Bn = e;
2427
2431
  }, e), S(e, b(k, {
2428
2432
  get when() {
2429
- return Oa().length > 0;
2433
+ return ka().length > 0;
2430
2434
  },
2431
2435
  get fallback() {
2432
2436
  return (() => {
@@ -2439,7 +2443,7 @@ function Kt(t) {
2439
2443
  var e = Ct(), t = e.firstChild;
2440
2444
  return S(t, () => P().loading), S(e, b(O, {
2441
2445
  get each() {
2442
- return Ba.slice(0, 3);
2446
+ return Va.slice(0, 3);
2443
2447
  },
2444
2448
  children: () => (() => {
2445
2449
  var e = Tt();
@@ -2477,7 +2481,7 @@ function Kt(t) {
2477
2481
  return b(pe, {
2478
2482
  onClick: fr,
2479
2483
  get children() {
2480
- return Fa();
2484
+ return Ia();
2481
2485
  }
2482
2486
  });
2483
2487
  }
@@ -2497,7 +2501,7 @@ function Kt(t) {
2497
2501
  return [
2498
2502
  b(k, {
2499
2503
  get when() {
2500
- return !!(L || Ma().length);
2504
+ return !!(L || Na().length);
2501
2505
  },
2502
2506
  get children() {
2503
2507
  var e = nt();
@@ -2511,20 +2515,20 @@ function Kt(t) {
2511
2515
  return P().selectPage;
2512
2516
  },
2513
2517
  get checked() {
2514
- return C(() => Aa().length > 0)() && ja() === Aa().length;
2518
+ return C(() => ja().length > 0)() && Ma() === ja().length;
2515
2519
  },
2516
2520
  get indeterminate() {
2517
- return C(() => ja() > 0)() && ja() < Aa().length;
2521
+ return C(() => Ma() > 0)() && Ma() < ja().length;
2518
2522
  },
2519
2523
  get disabled() {
2520
- return q() || Aa().length === 0;
2524
+ return q() || ja().length === 0;
2521
2525
  },
2522
- onCheckedChange: Ua
2526
+ onCheckedChange: Wa
2523
2527
  });
2524
2528
  }
2525
2529
  }), null), S(e, b(k, {
2526
2530
  get when() {
2527
- return Ma().length > 0;
2531
+ return Na().length > 0;
2528
2532
  },
2529
2533
  get children() {
2530
2534
  return b(ge, {
@@ -2532,7 +2536,7 @@ function Kt(t) {
2532
2536
  return P().sort;
2533
2537
  },
2534
2538
  get items() {
2535
- return Ma();
2539
+ return Na();
2536
2540
  },
2537
2541
  get disabled() {
2538
2542
  return q();
@@ -2546,13 +2550,13 @@ function Kt(t) {
2546
2550
  var e = rt();
2547
2551
  return S(e, b(Te, {
2548
2552
  get each() {
2549
- return Oa();
2553
+ return ka();
2550
2554
  },
2551
2555
  children: (e) => {
2552
- let n = e, r = () => Dt(n()), i = !!(t.onRowActivate || L || $ || E().length > 0), a = () => i ? Na() === n().key ? 0 : -1 : void 0;
2556
+ let n = e, r = () => Dt(n()), i = !!(t.onRowActivate || L || $ || E().length > 0), a = () => i ? Pa() === n().key ? 0 : -1 : void 0;
2553
2557
  return (() => {
2554
2558
  var e = Et();
2555
- return e.$$click = (e) => va(e, n()), e.$$keydown = (e) => Ga(e, n()), e.addEventListener("focus", () => la(n().key)), S(e, b(ro, { get row() {
2559
+ return e.$$click = (e) => ya(e, n()), e.$$keydown = (e) => Ka(e, n()), e.addEventListener("focus", () => ua(n().key)), S(e, b(io, { get row() {
2556
2560
  return n();
2557
2561
  } })), x((t) => {
2558
2562
  var i = n().key, o = r()?.row.id, s = Ot(n())?.group.id, c = r() && Y(r()?.row.id ?? "") ? "" : void 0, l = r()?.pending ? "" : void 0, u = r() && r()?.error !== null ? "" : void 0, d = a(), f = r()?.pending ? !0 : void 0;
@@ -2573,7 +2577,7 @@ function Kt(t) {
2573
2577
  })(),
2574
2578
  b(k, {
2575
2579
  get when() {
2576
- return La();
2580
+ return Ra();
2577
2581
  },
2578
2582
  get children() {
2579
2583
  var e = it();
@@ -2585,7 +2589,7 @@ function Kt(t) {
2585
2589
  var t = Ye(), n = t.firstChild, r = n.nextSibling;
2586
2590
  return S(n, () => e.definition.header), S(r, (() => {
2587
2591
  var t = C(() => typeof e.definition.footer == "function");
2588
- return () => t() ? e.definition.footer(Ia()) : e.definition.footer;
2592
+ return () => t() ? e.definition.footer(La()) : e.definition.footer;
2589
2593
  })()), t;
2590
2594
  })()
2591
2595
  })), e;
@@ -2593,7 +2597,7 @@ function Kt(t) {
2593
2597
  }),
2594
2598
  b(k, {
2595
2599
  get when() {
2596
- return Da();
2600
+ return Oa();
2597
2601
  },
2598
2602
  children: (e) => b(k, {
2599
2603
  get when() {
@@ -2617,7 +2621,7 @@ function Kt(t) {
2617
2621
  get disabled() {
2618
2622
  return Jn();
2619
2623
  },
2620
- onPageChange: Ha
2624
+ onPageChange: Ua
2621
2625
  });
2622
2626
  }
2623
2627
  })
@@ -2671,7 +2675,7 @@ function Kt(t) {
2671
2675
  }
2672
2676
  }), null), S(e, b(k, {
2673
2677
  get when() {
2674
- return Ea();
2678
+ return Da();
2675
2679
  },
2676
2680
  children: (e) => b(ve, {
2677
2681
  class: "sheen-data-table-pagination",
@@ -2695,7 +2699,7 @@ function Kt(t) {
2695
2699
  return e();
2696
2700
  } })
2697
2701
  }), null), x((n) => {
2698
- var r = Va(), a = ne(), s = ue(), c = t.variableRowHeight ? "" : void 0, l = qn() ? "" : void 0, u = Jn() ? "" : void 0, d = qn() || void 0, f = Ya(), p = za(), m = Ci();
2702
+ var r = Ha(), a = ne(), s = ue(), c = t.variableRowHeight ? "" : void 0, l = qn() ? "" : void 0, u = Jn() ? "" : void 0, d = qn() || void 0, f = Xa(), p = Ba(), m = Ci();
2699
2703
  return r !== n.e && le(e, n.e = r), a !== n.t && w(e, "data-variant", n.t = a), s !== n.a && w(e, "data-sheen-density", n.a = s), c !== n.o && w(e, "data-variable-height", n.o = c), l !== n.i && w(e, "data-pending", n.i = l), u !== n.n && w(e, "data-previous-results", n.n = u), d !== n.s && w(e, "aria-busy", n.s = d), f !== n.h && w(i, "aria-rowcount", n.h = f), p !== n.r && w(i, "aria-colcount", n.r = p), m !== n.d && T(o, "grid-template-columns", n.d = m), n;
2700
2704
  }, {
2701
2705
  e: void 0,
package/dist/facets.js CHANGED
@@ -18,14 +18,16 @@ function e(e, t, n) {
18
18
  for (let t = 0; t < e.length; t++) {
19
19
  let r = e[t];
20
20
  if (r === void 0) throw Error(`Missing facet row at index ${t}`);
21
- for (let e of i) {
22
- let i = n.getValue(r, e.column);
23
- if (i == null) {
24
- e.missing++;
21
+ for (let e = 0; e < i.length; e++) {
22
+ let a = i[e];
23
+ if (!a) throw Error(`Missing facet column at index ${e}`);
24
+ let o = n.getValue(r, a.column);
25
+ if (o == null) {
26
+ a.missing++;
25
27
  continue;
26
28
  }
27
- if (typeof i != "string" || !e.counts.has(i)) throw Error(`Invalid enum value for facet ${e.column} at row ${t}`);
28
- e.counts.set(i, (e.counts.get(i) ?? 0) + 1);
29
+ if (typeof o != "string" || !a.counts.has(o)) throw Error(`Invalid enum value for facet ${a.column} at row ${t}`);
30
+ a.counts.set(o, (a.counts.get(o) ?? 0) + 1);
29
31
  }
30
32
  }
31
33
  return Object.freeze(i.map((e) => Object.freeze({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gemologic/sheen-table",
3
- "version": "0.1.0-rc.2",
3
+ "version": "0.1.0",
4
4
  "description": "Compact accessible data tables and query-building components for Sheen SolidJS applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,14 +49,14 @@
49
49
  "./styles.css": "./src/styles.css"
50
50
  },
51
51
  "peerDependencies": {
52
- "@gemologic/sheen": "0.1.0-rc.2",
52
+ "@gemologic/sheen": "0.1.0",
53
53
  "solid-js": "1.9.15"
54
54
  },
55
55
  "dependencies": {
56
56
  "@tanstack/solid-virtual": "3.13.37"
57
57
  },
58
58
  "devDependencies": {
59
- "@gemologic/sheen": "0.1.0-rc.2",
59
+ "@gemologic/sheen": "0.1.0",
60
60
  "solid-js": "1.9.15",
61
61
  "vite-plugin-solid": "2.11.14"
62
62
  },
package/src/DataTable.tsx CHANGED
@@ -230,8 +230,8 @@ interface DisplayDataRow<Row extends object> {
230
230
  readonly row: StableRow<Row>;
231
231
  readonly parentId: string | null;
232
232
  readonly depth: number;
233
- position: number;
234
- setSize: number;
233
+ readonly position: number;
234
+ readonly setSize: number;
235
235
  readonly canExpand: boolean;
236
236
  readonly expanded: boolean;
237
237
  readonly unloaded: boolean;
@@ -883,12 +883,8 @@ export function DataTable<Row extends object>(props: DataTableProps<Row>): JSX.E
883
883
  }
884
884
  function flatDisplayRow(row: StableRow<Row>, index: number, setSize: number): DisplayDataRow<Row> {
885
885
  const existing = flatDisplayCache.get(row.id);
886
- if (existing) {
887
- existing.position = index + 1;
888
- existing.setSize = setSize;
889
- return existing;
890
- }
891
- const created: DisplayDataRow<Row> = { kind: "data", key: `row:${row.id}`, row, parentId: null, depth: 1, position: index + 1, setSize, canExpand: false, expanded: false, unloaded: false, pending: false, error: null };
886
+ if (existing && existing.row === row && existing.position === index + 1 && existing.setSize === setSize) return existing;
887
+ const created: DisplayDataRow<Row> = Object.freeze({ kind: "data", key: `row:${row.id}`, row, parentId: null, depth: 1, position: index + 1, setSize, canExpand: false, expanded: false, unloaded: false, pending: false, error: null });
892
888
  flatDisplayCache.set(row.id, created);
893
889
  return created;
894
890
  }
@@ -1574,13 +1570,15 @@ export function DataTable<Row extends object>(props: DataTableProps<Row>): JSX.E
1574
1570
  if (typeof rowHeight !== "string" || rowHeight.trim() === "") throw new Error("rowHeight must be a nonempty CSS length");
1575
1571
  const effectiveDensity = (): DataTableDensity => density() ?? theme.state().density;
1576
1572
  const estimatedRowHeight = (): number => props.estimatedRowHeight ?? (effectiveDensity() === "compact" ? 28 : effectiveDensity() === "spacious" ? 42 : 34);
1577
- if (!Number.isFinite(estimatedRowHeight()) || estimatedRowHeight() <= 0) throw new Error("estimatedRowHeight must be a positive finite number");
1573
+ let measuredDensity = effectiveDensity();
1574
+ let measuredRowHeight = estimatedRowHeight();
1575
+ if (!Number.isFinite(measuredRowHeight) || measuredRowHeight <= 0) throw new Error("estimatedRowHeight must be a positive finite number");
1578
1576
  const initialViewportHeight = props.initialViewportHeight ?? 400;
1579
1577
  if (!Number.isFinite(initialViewportHeight) || initialViewportHeight <= 0) throw new Error("initialViewportHeight must be a positive finite number");
1580
1578
  const virtualizer = createVirtualizer<HTMLDivElement, HTMLTableRowElement>({
1581
1579
  get count() { return rowCount(); },
1582
1580
  getScrollElement: () => viewport ?? null,
1583
- estimateSize: estimatedRowHeight,
1581
+ estimateSize: () => measuredRowHeight,
1584
1582
  getItemKey: index => props.variableRowHeight ? rowAt(index)?.key ?? index : index,
1585
1583
  initialRect: { width: 1024, height: initialViewportHeight },
1586
1584
  overscan: 8,
@@ -1597,31 +1595,36 @@ export function DataTable<Row extends object>(props: DataTableProps<Row>): JSX.E
1597
1595
  for (const element of viewport?.querySelectorAll<HTMLTableRowElement>("tbody tr[data-row-key]") ?? []) virtualizer.measureElement(element);
1598
1596
  }
1599
1597
  });
1600
- let measuredDensity = effectiveDensity();
1601
1598
  createEffect(() => {
1602
1599
  const currentDensity = effectiveDensity();
1603
- if (virtualizerMounted && currentDensity !== measuredDensity) virtualizer.measure();
1600
+ const height = estimatedRowHeight();
1601
+ if (!Number.isFinite(height) || height <= 0) throw new Error("estimatedRowHeight must be a positive finite number");
1602
+ const changed = height !== measuredRowHeight || currentDensity !== measuredDensity;
1603
+ measuredRowHeight = height;
1604
1604
  measuredDensity = currentDensity;
1605
+ if (virtualizerMounted && changed) virtualizer.measure();
1605
1606
  });
1606
1607
  const renderedRowCache = new Map<string, RenderedRow<Row>>();
1607
1608
  const renderedRows = createMemo<readonly RenderedRow<Row>[]>(() => {
1608
1609
  const retained = new Set<string>();
1609
- const rows = virtualizer.getVirtualItems().flatMap(item => {
1610
+ const rows: RenderedRow<Row>[] = [];
1611
+ for (const item of virtualizer.getVirtualItems()) {
1610
1612
  const row = rowAt(item.index);
1611
- if (!row) return [];
1613
+ if (!row) continue;
1612
1614
  retained.add(row.key);
1613
1615
  const existing = renderedRowCache.get(row.key);
1614
1616
  if (existing) {
1615
1617
  existing.updateRow(row);
1616
1618
  existing.updateItem(item);
1617
- return [existing];
1619
+ rows.push(existing);
1620
+ continue;
1618
1621
  }
1619
- const [currentRow, setCurrentRow] = createSignal(row, { equals: false });
1620
- const [currentItem, setCurrentItem] = createSignal(item, { equals: false });
1622
+ const [currentRow, setCurrentRow] = createSignal(row);
1623
+ const [currentItem, setCurrentItem] = createSignal(item);
1621
1624
  const rendered = Object.freeze({ key: row.key, row: currentRow, updateRow: (next: DisplayRow<Row>): void => { setCurrentRow(next); }, item: currentItem, updateItem: (next: VirtualItem): void => { setCurrentItem(next); } });
1622
1625
  renderedRowCache.set(row.key, rendered);
1623
- return [rendered];
1624
- });
1626
+ rows.push(rendered);
1627
+ }
1625
1628
  for (const id of renderedRowCache.keys()) if (!retained.has(id)) renderedRowCache.delete(id);
1626
1629
  return rows;
1627
1630
  });
@@ -2188,7 +2191,9 @@ export function DataTable<Row extends object>(props: DataTableProps<Row>): JSX.E
2188
2191
  <tbody style={{ height: `${virtualizer.getTotalSize()}px` }}>
2189
2192
  <For each={renderedRows()}>{current => {
2190
2193
  const row = () => current.row();
2191
- const dataRow = () => displayDataRow(row());
2194
+ const dataRow = treePresentation ? () => displayDataRow(row()) : createMemo(() => displayDataRow(row()), undefined, {
2195
+ equals: (previous, next) => previous?.row === next?.row,
2196
+ });
2192
2197
  const groupRow = () => displayGroupRow(row());
2193
2198
  const labelColumn = () => {
2194
2199
  const visible = visibleDefinitions();
@@ -2202,10 +2207,10 @@ export function DataTable<Row extends object>(props: DataTableProps<Row>): JSX.E
2202
2207
  </Show>
2203
2208
  </Show>
2204
2209
  <For each={visibleDefinitions()}>{column => {
2205
- const edit = createMemo(() => {
2210
+ const edit = column.definition.editor ? createMemo(() => {
2206
2211
  const value = dataRow();
2207
2212
  return value ? cellEditRecord(value.row, column) : undefined;
2208
- });
2213
+ }) : () => undefined;
2209
2214
  const state = () => editSnapshot(edit());
2210
2215
  const invalid = () => {
2211
2216
  const currentState = state();
package/src/facets.ts CHANGED
@@ -31,7 +31,9 @@ export function countClientFacets<Row>(rows: readonly Row[], columns: readonly F
31
31
  for (let index = 0; index < rows.length; index++) {
32
32
  const row = rows[index];
33
33
  if (row === undefined) throw new Error(`Missing facet row at index ${index}`);
34
- for (const facet of facets) {
34
+ for (let facetIndex = 0; facetIndex < facets.length; facetIndex++) {
35
+ const facet = facets[facetIndex];
36
+ if (!facet) throw new Error(`Missing facet column at index ${facetIndex}`);
35
37
  const value = evaluation.getValue(row, facet.column);
36
38
  if (value === null || value === undefined) { facet.missing++; continue; }
37
39
  if (typeof value !== "string" || !facet.counts.has(value)) throw new Error(`Invalid enum value for facet ${facet.column} at row ${index}`);