@keenmate/web-grid 1.1.0 → 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.1.0",
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);
package/src/css/_tree.css CHANGED
@@ -2,70 +2,68 @@
2
2
  TREE COLUMN
3
3
  ==============================================================================
4
4
  Indent + chevron rendered inside a cell when column.isTree is true.
5
- The chevron is absolutely positioned so it can't affect row height; the
6
- wrapper's padding-left reserves space for (level * indent + chevron + gap).
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.
7
8
  */
8
9
 
9
10
  :host {
10
- --wg-tree-indent: 1.6rem; /* per-level indent */
11
- --wg-tree-chevron-size: 1.6rem; /* chevron width/height */
11
+ --wg-tree-indent: 1.25rem; /* per-level indent */
12
+ --wg-tree-chevron-size: 1rem; /* chevron width/height (also used for leaf spacer) */
12
13
  --wg-tree-chevron-color: var(--wg-text-color-2);
13
- --wg-tree-chevron-gap: var(--wg-spacing-xs);
14
+ --wg-tree-chevron-gap: 4px; /* gap between chevron and content */
14
15
  }
15
16
 
16
17
  .wg__tree-cell {
17
- position: relative;
18
- width: 100%;
19
- min-width: 0;
20
- /* padding-left + width: 100% would overflow the cell with content-box; force
21
- padding to be included in the width so the wrapper exactly fills the cell. */
22
- box-sizing: border-box;
23
- /* Fill the cell vertically so clicks anywhere inside the cell land on the
24
- wrapper, not the cell's padding band. Helps for the dblclick-toggle hit area. */
25
- min-height: 100%;
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 */
26
22
  }
27
23
 
28
- .wg__tree-cell-content {
24
+ .wg__tree-cell-body {
25
+ min-width: 0;
29
26
  overflow: hidden;
30
27
  text-overflow: inherit;
31
28
  white-space: inherit;
32
29
  }
33
30
 
34
31
  .wg__tree-chevron {
35
- position: absolute;
36
- top: 50%;
37
- /* `left` is set inline by JS = level * indent */
38
- transform: translateY(-50%);
32
+ all: unset;
39
33
  display: inline-flex;
40
34
  align-items: center;
41
35
  justify-content: center;
42
36
  width: var(--wg-tree-chevron-size);
43
37
  height: var(--wg-tree-chevron-size);
44
- padding: 0;
45
- border: 0;
46
- background: transparent;
47
- color: var(--wg-tree-chevron-color);
48
- font-size: 0.9em;
38
+ border-radius: 2px;
39
+ font-size: 0.85em;
49
40
  line-height: 1;
41
+ color: var(--wg-tree-chevron-color);
50
42
  cursor: pointer;
51
- user-select: none;
52
- border-radius: 3px;
43
+ flex-shrink: 0;
44
+ transition: transform 0.12s ease, background 0.1s ease;
53
45
  }
54
46
 
55
47
  .wg__tree-chevron:hover:not(.wg__tree-chevron--leaf) {
56
48
  background: var(--wg-hover-bg);
57
49
  }
58
50
 
59
- .wg__tree-chevron--leaf {
60
- cursor: default;
61
- pointer-events: none;
62
- background: transparent;
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;
63
60
  }
64
61
 
65
62
  /* While the cell is being edited, let the editor absolute-fill the <td> as it
66
63
  normally does. The chevron/indent are visual aids for display mode; they come
67
64
  back when editing ends. */
68
- .wg__cell--editing .wg__tree-chevron {
65
+ .wg__cell--editing .wg__tree-chevron,
66
+ .wg__cell--editing .wg__tree-leaf-spacer {
69
67
  display: none;
70
68
  }
71
69
  .wg__cell--editing .wg__tree-cell {