@jielga/tmdatagrid 0.3.0 → 0.5.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.
Files changed (43) hide show
  1. package/dist/index.d.ts +947 -64
  2. package/dist/index.js +2474 -1423
  3. package/dist/index.js.map +1 -1
  4. package/dist/styles.css +1 -1
  5. package/package.json +2 -2
  6. package/skills/columns/SKILL.md +1 -1
  7. package/skills/features/SKILL.md +61 -11
  8. package/skills/getting-started/SKILL.md +1 -1
  9. package/skills/options/SKILL.md +12 -2
  10. package/skills/server-side/SKILL.md +1 -1
  11. package/src/tmdatagrid/TMDataGridContext.ts +26 -0
  12. package/src/tmdatagrid/components/TMDataGrid.module.css +10 -0
  13. package/src/tmdatagrid/components/TMDataGrid.tsx +23 -1
  14. package/src/tmdatagrid/components/TMDataGridColumnsPanel.tsx +5 -5
  15. package/src/tmdatagrid/components/TMDataGridDetailsColumn.module.css +33 -0
  16. package/src/tmdatagrid/components/TMDataGridDetailsColumn.tsx +160 -0
  17. package/src/tmdatagrid/components/TMDataGridFilterPanel.tsx +111 -33
  18. package/src/tmdatagrid/components/TMDataGridFilterPills.tsx +5 -4
  19. package/src/tmdatagrid/components/TMDataGridFooter.tsx +11 -19
  20. package/src/tmdatagrid/components/TMDataGridGroupColumn.tsx +23 -11
  21. package/src/tmdatagrid/components/TMDataGridHeaderCell.module.css +15 -3
  22. package/src/tmdatagrid/components/TMDataGridHeaderCell.tsx +181 -52
  23. package/src/tmdatagrid/components/TMDataGridSearch.tsx +122 -0
  24. package/src/tmdatagrid/components/TMDataGridSelectColumn.tsx +23 -13
  25. package/src/tmdatagrid/components/TMDataGridTable.module.css +127 -6
  26. package/src/tmdatagrid/components/TMDataGridTable.tsx +1003 -30
  27. package/src/tmdatagrid/components/TMDataGridToolbar.tsx +30 -7
  28. package/src/tmdatagrid/components/icons.ts +1 -0
  29. package/src/tmdatagrid/components/sticky.module.css +77 -16
  30. package/src/tmdatagrid/core/autosize.ts +125 -0
  31. package/src/tmdatagrid/core/capabilities.ts +41 -0
  32. package/src/tmdatagrid/core/cellExport.ts +321 -0
  33. package/src/tmdatagrid/core/cellNavigation.ts +103 -0
  34. package/src/tmdatagrid/core/cellRange.ts +118 -0
  35. package/src/tmdatagrid/core/columnOptions.ts +123 -0
  36. package/src/tmdatagrid/core/columnUtils.ts +18 -0
  37. package/src/tmdatagrid/core/expanding.ts +93 -0
  38. package/src/tmdatagrid/core/filterOperators.ts +176 -15
  39. package/src/tmdatagrid/core/labels.ts +211 -0
  40. package/src/tmdatagrid/core/labelsSv.ts +108 -0
  41. package/src/tmdatagrid/core/summary.ts +35 -0
  42. package/src/tmdatagrid/index.ts +70 -0
  43. package/src/tmdatagrid/useTMDataGrid.tsx +328 -12
@@ -27,7 +27,7 @@
27
27
  grid-template-columns: subgrid;
28
28
  position: sticky;
29
29
  top: 0;
30
- z-index: 3;
30
+ z-index: var(--dg-z-header, 6);
31
31
  }
32
32
 
33
33
  .bodyRow {
@@ -98,14 +98,83 @@
98
98
  font-size: var(--dg-font-size);
99
99
  }
100
100
 
101
- /* The checkbox column is a fixed 48px track holding a control of a known width,
102
- not text that can ellipsize. Cell padding is sized for text and grows with
103
- the scale, so at `xl` its 18px a side left 12px for a 16px box and the
104
- checkbox was clipped. The lane centres its control instead. */
105
- .bodyCell[data-select-column="true"] {
101
+ /* A control lane — the checkbox, the details chevron — is a fixed 36px track
102
+ holding a control of a known width, not text that can ellipsize. Cell padding
103
+ is sized for text and grows with the scale, so at `xl` its 18px a side left
104
+ 12px for a 16px box and the checkbox was clipped. The lane centres its
105
+ control instead. */
106
+ .bodyCell[data-control-column="true"] {
106
107
  padding: 0;
107
108
  }
108
109
 
110
+ /* A drag is laying down a range. Text selection would otherwise follow the
111
+ pointer across every cell it passes. */
112
+ .grid[data-range-dragging] {
113
+ user-select: none;
114
+ }
115
+
116
+ /* The selected block, under `cellSelection: "range"`.
117
+
118
+ A tint over the row's own background rather than instead of it, so a
119
+ selected cell on a highlighted row still reads as both. `color-mix` keeps
120
+ one declaration for light and dark: it thins the theme's primary colour into
121
+ whatever `--row-bg` the row resolved to. */
122
+ .bodyCell[data-selected="true"] {
123
+ background-color: color-mix(
124
+ in srgb,
125
+ var(--mantine-primary-color-filled) 14%,
126
+ var(--row-bg)
127
+ );
128
+ }
129
+
130
+ /* The outline around the block, drawn edge by edge: only the cells on a side
131
+ of the rectangle draw that side, so they add up to one border around the
132
+ whole thing however it is shaped. A single overlay box would have to be
133
+ positioned against a scrolling grid with sticky lanes in it.
134
+
135
+ Four shadows are always laid down and each is transparent until its edge
136
+ says otherwise. `box-shadow` does not accumulate across rules — a second
137
+ declaration replaces the first — so the alternative is one rule per corner
138
+ combination, and a cell can be on any of fifteen of them. */
139
+ .bodyCell[data-selected="true"] {
140
+ --dg-edge-top: transparent;
141
+ --dg-edge-bottom: transparent;
142
+ --dg-edge-left: transparent;
143
+ --dg-edge-right: transparent;
144
+ box-shadow:
145
+ inset 0 1px 0 0 var(--dg-edge-top),
146
+ inset 0 -1px 0 0 var(--dg-edge-bottom),
147
+ inset 1px 0 0 0 var(--dg-edge-left),
148
+ inset -1px 0 0 0 var(--dg-edge-right);
149
+ }
150
+
151
+ .bodyCell[data-edge-top="true"] {
152
+ --dg-edge-top: var(--mantine-primary-color-filled);
153
+ }
154
+
155
+ .bodyCell[data-edge-bottom="true"] {
156
+ --dg-edge-bottom: var(--mantine-primary-color-filled);
157
+ }
158
+
159
+ .bodyCell[data-edge-left="true"] {
160
+ --dg-edge-left: var(--mantine-primary-color-filled);
161
+ }
162
+
163
+ .bodyCell[data-edge-right="true"] {
164
+ --dg-edge-right: var(--mantine-primary-color-filled);
165
+ }
166
+
167
+ /* The cell the keyboard is on, under `cellSelection`.
168
+
169
+ Painted from `data-focused` rather than `:focus-visible`, because the ring
170
+ has to stay while the focus steps into a control inside the cell — that is
171
+ still where the arrow keys resume from. The offset keeps it inside the
172
+ cell's own box, so a pinned neighbour cannot clip it. */
173
+ .bodyCell[data-focused="true"] {
174
+ outline: 2px solid var(--mantine-primary-color-filled);
175
+ outline-offset: -2px;
176
+ }
177
+
109
178
  .cellContent {
110
179
  min-width: 0;
111
180
  overflow: hidden;
@@ -126,6 +195,23 @@
126
195
  flex: 1 1 auto;
127
196
  }
128
197
 
198
+ /* The panel an expanded row opens. Its own grid row inside .bodyRow, spanning
199
+ every column track — so it is measured together with the row above it.
200
+
201
+ It takes `--row-bg` rather than a colour of its own: the panel belongs to its
202
+ row, and a selected or highlighted row whose panel stayed white would read as
203
+ two separate things. */
204
+ .detailsCell {
205
+ grid-column: 1 / -1;
206
+ border-bottom: 1px solid var(--mantine-color-default-border);
207
+ background-color: var(--row-bg);
208
+ padding: var(--dg-padding);
209
+ /* The row above may be the selection control, which turns text selection off
210
+ for everything inside it. A panel is content, so it takes both back. */
211
+ user-select: text;
212
+ cursor: auto;
213
+ }
214
+
129
215
  .messageRow {
130
216
  grid-column: 1 / -1;
131
217
  display: flex;
@@ -135,3 +221,38 @@
135
221
  gap: var(--mantine-spacing-xs);
136
222
  padding: var(--mantine-spacing-xl);
137
223
  }
224
+
225
+ /* The summary row — one sticky row of column footers along the bottom edge,
226
+ rendered only while at least one column defines `footer`. Same subgrid
227
+ placement as the header, so its cells sit exactly on the body's tracks. */
228
+ .summaryRow {
229
+ display: grid;
230
+ grid-column: 1 / -1;
231
+ grid-template-columns: subgrid;
232
+ position: sticky;
233
+ bottom: 0;
234
+ z-index: var(--dg-z-summary-row, 4);
235
+ }
236
+
237
+ .summaryCell {
238
+ display: flex;
239
+ align-items: center;
240
+ padding: 0 var(--dg-padding);
241
+ border-top: 1px solid var(--mantine-color-default-border);
242
+ /* Opaque: the body scrolls underneath it. */
243
+ background-color: var(--mantine-color-body);
244
+ font-size: var(--dg-font-size);
245
+ font-weight: 600;
246
+ }
247
+
248
+ .summaryCell[data-control-column="true"] {
249
+ padding: 0;
250
+ }
251
+
252
+ .summaryCell[data-align="right"] {
253
+ justify-content: flex-end;
254
+ }
255
+
256
+ .summaryCell[data-align="center"] {
257
+ justify-content: center;
258
+ }