@svelte-lean/table 0.13.3 → 0.13.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @svelte-lean/table
2
2
 
3
+ ## 0.13.4
4
+
5
+ ### Patch Changes
6
+
7
+ - c97ea03: A grid-layout table with grouped columns draws its header rows straight again: a header row kept the cells that span down to it after the grouped ones, and grid auto-placement, which never moves back along a row, pushed the grouped leaves onto a second line. The cells are now in column order, and the room a spanning cell leaves above it takes the header's surface.
8
+
3
9
  ## 0.13.3
4
10
 
5
11
  ### Patch Changes
package/dist/style.css CHANGED
@@ -936,6 +936,10 @@
936
936
  }
937
937
  /* Each body row its own stacking context: sticky pinned cells then layerize per row, not per
938
938
  cell, which keeps compositing cheap while a long page scrolls. */
939
+ /* A header row is a grid too: the room a spanning cell leaves above it is the head's surface. */
940
+ :where(.slean-table[data-layout='grid'] > .slean-table-scroll > table > thead > tr) {
941
+ background: var(--slean-table-header-bg);
942
+ }
939
943
  :where(.slean-table[data-layout='grid'] > .slean-table-scroll > table > tbody > tr) {
940
944
  isolation: isolate;
941
945
  }
@@ -776,7 +776,8 @@
776
776
  /**
777
777
  * Header rows. In grid layout every row is a grid of its own, so a cell spanning rows sits in
778
778
  * the lowest row it spans, placed at its first column; the leading control headers sit there
779
- * too.
779
+ * too. A row's cells are kept in column order: auto-placement never moves back along a row, so
780
+ * a cell placed before one to its left would push that one onto a second grid row.
780
781
  */
781
782
  const leafIndex = $derived(new Map(cols.map((col, i) => [col.id, i])));
782
783
  function firstLeaf(column: Column<T>): number {
@@ -787,15 +788,19 @@
787
788
  const levels = table.headers;
788
789
  if (!grid) return levels.map((row) => row.map((cell) => ({ cell })));
789
790
  const lead = leads.length;
790
- const result: { cell: HeaderCell<T>; place?: string }[][] = levels.map(() => []);
791
+ const result: { cell: HeaderCell<T>; place?: string; start: number }[][] = levels.map(() => []);
791
792
  levels.forEach((row, level) =>
792
793
  row.forEach((cell) => {
793
794
  const target = Math.min(levels.length - 1, level + cell.rowSpan - 1);
794
795
  const start = lead + firstLeaf(cell.column) + 1;
795
- result[target]!.push({ cell, place: `grid-column:${start} / span ${cell.colSpan};` });
796
+ result[target]!.push({
797
+ cell,
798
+ start,
799
+ place: `grid-column:${start} / span ${cell.colSpan};`
800
+ });
796
801
  })
797
802
  );
798
- return result;
803
+ return result.map((row) => row.sort((a, b) => a.start - b.start));
799
804
  });
800
805
  const leadLevel = $derived(grid ? table.headers.length - 1 : 0);
801
806
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svelte-lean/table",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "description": "A Svelte-native table and data-grid engine that ships only the features you use.",
5
5
  "license": "MIT",
6
6
  "author": "Ömer Say",