Skip to content

Commit aeb4274

Browse files
committed
make details-cell work
1 parent 04ae7af commit aeb4274

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

packages/grid/src/styles/vaadin-grid-base-styles.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,18 @@ export const gridStyles = css`
132132
133133
display: grid;
134134
grid-template-columns: var(--_template-columns);
135+
grid-template-rows: min-content;
135136
width: 100%;
136137
box-sizing: border-box;
137138
margin: 0;
138139
position: relative;
139140
}
140141
142+
[part~='details-opened-row'] {
143+
grid-template-rows: min-content var(--_details-cell-height, 0px);
144+
row-gap: var(--_row-border-width);
145+
}
146+
141147
[part~='row']:not(:focus-within) {
142148
--_non-focused-row-none: none;
143149
}
@@ -149,15 +155,20 @@ export const gridStyles = css`
149155
[part~='row']:where(:not(#sizer)) {
150156
&::before {
151157
content: '';
152-
inset: 0;
158+
inset: calc(var(--_row-border-width) * -1) 0;
153159
position: absolute;
160+
grid-row: 1 / 1;
154161
grid-column: 1 / -1;
155162
background-color: var(--_row-background-color);
156163
background-image: var(--_selected-background-image, none);
157164
border-block: var(--_row-border-width) solid var(--_border-color);
158165
}
159166
}
160167
168+
[part~='details-cell'] {
169+
/* border-bottom: var(--_row-border-width) solid var(--_border-color); */
170+
}
171+
161172
[column-rendering='lazy'] [part~='body-cell']:not([frozen]):not([frozen-to-end]) {
162173
transform: translateX(var(--_grid-lazy-columns-start));
163174
}
@@ -172,11 +183,11 @@ export const gridStyles = css`
172183
z-index: 4;
173184
174185
&:not([part~='selected-row']):not([part~='first-row'])::before {
175-
inset-block-start: var(--_row-border-width);
186+
inset-block-start: 0;
176187
}
177188
178-
&:not([part~='selected-row']):not([part~='last-row'])::before {
179-
inset-block-end: var(--_row-border-width);
189+
&:not([part~='selected-row']):not([part~='last-row']):not([part~='details-opened-row'])::before {
190+
inset-block-end: 0;
180191
}
181192
}
182193
@@ -211,17 +222,14 @@ export const gridStyles = css`
211222
);
212223
--_selected-background-image: linear-gradient(var(--_selected-background-color), var(--_selected-background-color));
213224
z-index: 3;
214-
215-
&::before {
216-
/* inset-block-start: calc(var(--_row-border-width) * -1); */
217-
}
218225
}
219226
220227
/* Cells */
221228
222229
[part~='cell'] {
223230
padding: 0;
224231
box-sizing: border-box;
232+
grid-row-start: 1;
225233
grid-column-end: span var(--_colspan, 1);
226234
background: var(--vaadin-grid-cell-background, var(--vaadin-background-color));
227235
}
@@ -245,7 +253,7 @@ export const gridStyles = css`
245253
}
246254
247255
/* Column borders */
248-
[part~='cell']:not([part~='first-column-cell']) {
256+
[part~='cell']:where(:not([part~='details-cell']):not([part~='first-column-cell'])) {
249257
border-left-style: solid;
250258
}
251259
@@ -265,7 +273,7 @@ export const gridStyles = css`
265273
);
266274
}
267275
268-
[part~='body-cell'] {
276+
[part~='body-cell']:where(:not([part~='details-cell'])) {
269277
background:
270278
var(--_hover-background-image, none) border-box,
271279
var(--_selected-background-image, none) border-box,
@@ -303,8 +311,8 @@ export const gridStyles = css`
303311
304312
[part~='details-cell'] {
305313
position: absolute;
306-
bottom: 0;
307-
width: 100%;
314+
inset-inline: 0;
315+
grid-row-start: 2;
308316
}
309317
310318
[part~='cell'] ::slotted(vaadin-grid-cell-content) {

packages/grid/src/vaadin-grid-row-details-mixin.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const RowDetailsMixin = (superClass) =>
7171

7272
// This workaround is needed until Safari also supports
7373
// ResizeObserver.observe with {box: 'border-box'}
74-
this.__virtualizer.__adapter._resizeHandler();
74+
// this.__virtualizer.__adapter._resizeHandler();
7575
});
7676
}
7777

@@ -161,9 +161,11 @@ export const RowDetailsMixin = (superClass) =>
161161
/** @private */
162162
__updateDetailsRowPadding(row, cell) {
163163
if (cell.hidden) {
164-
row.style.removeProperty('padding-bottom');
164+
row.style.removeProperty('--_details-cell-height', '0px');
165+
// row.style.removeProperty('padding-bottom');
165166
} else {
166-
row.style.setProperty('padding-bottom', `${cell.offsetHeight}px`);
167+
row.style.setProperty('--_details-cell-height', `${cell.offsetHeight}px`);
168+
// row.style.setProperty('padding-bottom', `${cell.offsetHeight}px`);
167169
}
168170
}
169171

0 commit comments

Comments
 (0)