Get Details / Groupbox to take all allowed vertical space and scroll internally if contents are too large

This commit is contained in:
nathan 2024-08-28 13:19:33 -06:00
parent 986e83750c
commit 57f8bc0a99
2 changed files with 39 additions and 5 deletions

View File

@ -54,6 +54,14 @@ export class Et2Details extends Et2Widget(SlDetails)
position: relative;
}
/*
.details .details__body {
height: calc(100% - 2em - 2 * var(--sl-spacing-medium));
overflow-x: hidden;
overflow-y: auto;
}
*/
.details.hoist .details__body {
position: absolute;
z-index: var(--sl-z-index-drawer);

View File

@ -8,7 +8,7 @@
*/
import {Et2Details} from "../Et2Details/Et2Details";
import {css, PropertyValues, html} from "lit";
import {css, PropertyValues} from "lit";
import shoelace from "../../Styles/shoelace";
import {property} from "lit/decorators/property.js";
import {customElement} from "lit/decorators/custom-element.js";
@ -31,16 +31,42 @@ export class Et2Groupbox extends Et2Details
...super.styles,
shoelace,
css`
:host {
height: auto;
}
slot[name="collapse-icon"], slot[name="expand-icon"] {
display: none;
}
details {
height: 100%;
position: relative;
margin: 2px;
height: calc(100% - .5rem);
}
/* work around details not respecting flex
height is 100% - header - border radius
*/
.details__body {
height: calc(100% - 3em - var(--sl-border-radius-medium)) !important;
position: relative;
}
.summaryOnTop .details__body {
height: 100% !important;
position: relative;
}
.details__content {
overflow: hidden;
overflow-y: auto;
height: 100%;
}
/* end workaround */
summary {
pointer-events: none;
}