@keenmate/web-grid 1.0.5 → 1.2.0-rc01

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keenmate/web-grid",
3
- "version": "1.0.5",
3
+ "version": "1.2.0-rc01",
4
4
  "description": "Framework-agnostic data grid web component with sorting, filtering, inline editing, and keyboard navigation",
5
5
  "type": "module",
6
6
  "main": "./dist/web-grid.umd.js",
@@ -36,7 +36,10 @@
36
36
  "build:types": "tsc",
37
37
  "preview": "vite preview",
38
38
  "clean": "rimraf dist --glob \"*.tgz\"",
39
- "clean:dist": "rimraf dist"
39
+ "clean:dist": "rimraf dist",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest",
42
+ "test:ui": "vitest --ui"
40
43
  },
41
44
  "keywords": [
42
45
  "grid",
@@ -69,9 +72,12 @@
69
72
  },
70
73
  "homepage": "https://github.com/KeenMate/web-grid#readme",
71
74
  "devDependencies": {
75
+ "@vitest/ui": "^2.1.0",
76
+ "happy-dom": "^15.0.0",
72
77
  "rimraf": "^5.0.5",
73
78
  "typescript": "^5.3.3",
74
- "vite": "^5.0.8"
79
+ "vite": "^5.0.8",
80
+ "vitest": "^2.1.0"
75
81
  },
76
82
  "dependencies": {
77
83
  "@floating-ui/dom": "^1.7.4"
@@ -19,8 +19,13 @@
19
19
  inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color);
20
20
  }
21
21
 
22
- /* Focused cell styling for editable navigate mode (.wg__cell--focused class) */
23
- .wg--editable .wg__cell.wg__cell--focused {
22
+ /* Focused cell styling (.wg__cell--focused class).
23
+ Applies whenever focusedCell state is set, in any grid mode. Read-only grids
24
+ (default editTrigger, isEditable: false) still set focusedCell on click via
25
+ the cell-selection module; the indicator needs to be visible there too,
26
+ otherwise tree-shortcut Ctrl+Arrows look like they're losing focus after a
27
+ re-render destroys/rebuilds the tbody. */
28
+ .wg__cell.wg__cell--focused {
24
29
  box-shadow:
25
30
  inset 0 0 0 var(--wg-focus-border-width) var(--wg-focus-border-color),
26
31
  inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color);
@@ -67,7 +67,13 @@ web-grid:not(:defined) {
67
67
  ============================================================================== */
68
68
  .wg__table {
69
69
  width: 100%;
70
- min-width: max-content; /* Expand beyond container if columns are wide */
70
+ /* `min-width: max-content` was here to force the table to extend past the
71
+ container when column widths sum > container. But with table-layout: fixed,
72
+ the explicit column widths from the first row already cause that overflow
73
+ naturally — the min-width was redundant and triggered pathological
74
+ intrinsic-size computation in some browsers (Firefox especially) when cells
75
+ contained absolutely-positioned editors, blowing the filler width up to
76
+ hundreds of thousands of px. */
71
77
  border-collapse: collapse;
72
78
  table-layout: fixed;
73
79
  background: var(--wg-table-bg);
@@ -0,0 +1,71 @@
1
+ /* ==============================================================================
2
+ TREE COLUMN
3
+ ==============================================================================
4
+ Indent + chevron rendered inside a cell when column.isTree is true.
5
+ Inline-flex wrapper: chevron (or leaf spacer) + cell-body sit on one row.
6
+ Per-level depth comes from `padding-inline-start: level * --wg-tree-indent`,
7
+ set inline by JS.
8
+ */
9
+
10
+ :host {
11
+ --wg-tree-indent: 1.25rem; /* per-level indent */
12
+ --wg-tree-chevron-size: 1rem; /* chevron width/height (also used for leaf spacer) */
13
+ --wg-tree-chevron-color: var(--wg-text-color-2);
14
+ --wg-tree-chevron-gap: 4px; /* gap between chevron and content */
15
+ }
16
+
17
+ .wg__tree-cell {
18
+ display: inline-flex;
19
+ align-items: center;
20
+ gap: var(--wg-tree-chevron-gap);
21
+ /* `padding-inline-start: level * --wg-tree-indent` is set inline by JS */
22
+ }
23
+
24
+ .wg__tree-cell-body {
25
+ min-width: 0;
26
+ overflow: hidden;
27
+ text-overflow: inherit;
28
+ white-space: inherit;
29
+ }
30
+
31
+ .wg__tree-chevron {
32
+ all: unset;
33
+ display: inline-flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ width: var(--wg-tree-chevron-size);
37
+ height: var(--wg-tree-chevron-size);
38
+ border-radius: 2px;
39
+ font-size: 0.85em;
40
+ line-height: 1;
41
+ color: var(--wg-tree-chevron-color);
42
+ cursor: pointer;
43
+ flex-shrink: 0;
44
+ transition: transform 0.12s ease, background 0.1s ease;
45
+ }
46
+
47
+ .wg__tree-chevron:hover:not(.wg__tree-chevron--leaf) {
48
+ background: var(--wg-hover-bg);
49
+ }
50
+
51
+ .wg__tree-chevron--expanded {
52
+ transform: rotate(90deg);
53
+ }
54
+
55
+ .wg__tree-leaf-spacer {
56
+ display: inline-block;
57
+ width: var(--wg-tree-chevron-size);
58
+ height: var(--wg-tree-chevron-size);
59
+ flex-shrink: 0;
60
+ }
61
+
62
+ /* While the cell is being edited, let the editor absolute-fill the <td> as it
63
+ normally does. The chevron/indent are visual aids for display mode; they come
64
+ back when editing ends. */
65
+ .wg__cell--editing .wg__tree-chevron,
66
+ .wg__cell--editing .wg__tree-leaf-spacer {
67
+ display: none;
68
+ }
69
+ .wg__cell--editing .wg__tree-cell {
70
+ display: contents; /* wrapper disappears from layout */
71
+ }
package/src/css/main.css CHANGED
@@ -48,4 +48,5 @@
48
48
  @import '_modifiers.css';
49
49
  @import '_dialogs.css';
50
50
  @import '_virtual-scroll.css';
51
+ @import '_tree.css';
51
52
  @import '_dark-mode.css';