mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 18:03:39 +01:00
Fix some CSS / layout issues with labels
- Fix label nowrap stopped working - Fix et2-label-fixed stopped working
This commit is contained in:
parent
faf6a21836
commit
b34e6905ce
@ -108,6 +108,9 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
--icon-width: 20px;
|
--icon-width: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-control--has-label::part(form-control-label) {
|
||||||
|
margin-right: var(--sl-spacing-medium);
|
||||||
|
}
|
||||||
|
|
||||||
::slotted(img), img {
|
::slotted(img), img {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
@ -1037,7 +1040,10 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
return html`
|
return html`
|
||||||
${this._styleTemplate()}
|
${this._styleTemplate()}
|
||||||
<sl-select
|
<sl-select
|
||||||
exportparts="prefix, tags, display-input, expand-icon, combobox, combobox:base, listbox, option"
|
class=${classMap({
|
||||||
|
"form-control--has-label": this.label !== ""
|
||||||
|
})}
|
||||||
|
exportparts="form-control-label, prefix, tags, display-input, expand-icon, combobox, combobox:base, listbox, option"
|
||||||
label=${this.label}
|
label=${this.label}
|
||||||
placeholder=${this.placeholder || (this.multiple && this.emptyLabel ? this.emptyLabel : "")}
|
placeholder=${this.placeholder || (this.multiple && this.emptyLabel ? this.emptyLabel : "")}
|
||||||
?multiple=${this.multiple}
|
?multiple=${this.multiple}
|
||||||
|
@ -107,52 +107,58 @@ const Et2WidgetMixin = <T extends Constructor>(superClass : T) =>
|
|||||||
return [
|
return [
|
||||||
...(super.styles ? (Array.isArray(super.styles) ? super.styles : [super.styles]) : []),
|
...(super.styles ? (Array.isArray(super.styles) ? super.styles : [super.styles]) : []),
|
||||||
css`
|
css`
|
||||||
:host([disabled]) {
|
:host([disabled]) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CSS to align internal inputs according to box alignment */
|
|
||||||
:host([align="center"]) .input-group__input {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
:host([align="right"]) .input-group__input {
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Put widget label to the left of the widget */
|
/* CSS to align internal inputs according to box alignment */
|
||||||
|
|
||||||
::part(form-control) {
|
:host([align="center"]) .input-group__input {
|
||||||
display: flex;
|
justify-content: center;
|
||||||
align-items: center;
|
}
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
::part(form-control-label) {
|
:host([align="right"]) .input-group__input {
|
||||||
flex: 0 0 auto;
|
justify-content: flex-end;
|
||||||
white-space: normal;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
::part(form-control-input) {
|
/* Put widget label to the left of the widget */
|
||||||
flex: 1 1 auto;
|
|
||||||
position: relative;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
::part(form-control-help-text) {
|
::part(form-control), .form-control {
|
||||||
flex-basis: 100%;
|
display: flex;
|
||||||
position: relative;
|
align-items: center;
|
||||||
}
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
/* Use .et2-label-fixed class to give fixed label size */
|
::part(form-control-label), .form-control-label {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
:host(.et2-label-fixed)::part(form-control-label) {
|
.form-control--has-label .form-control-label {
|
||||||
width: initial;
|
margin-right: var(--sl-spacing-medium);
|
||||||
width: var(--label-width, 8em);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
:host(.et2-label-fixed)::part(form-control-help-text) {
|
::part(form-control-input), .form-control-input {
|
||||||
left: calc(var(--sl-spacing-medium) + var(--label-width, 8em));
|
flex: 1 1 auto;
|
||||||
}
|
position: relative;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
::part(form-control-help-text), .form-control-help-text {
|
||||||
|
flex-basis: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Use .et2-label-fixed class to give fixed label size */
|
||||||
|
|
||||||
|
:host(.et2-label-fixed)::part(form-control-label), :host(.et2-label-fixed) .form-control-label {
|
||||||
|
width: initial;
|
||||||
|
width: var(--label-width, 8em);
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.et2-label-fixed)::part(form-control-help-text), :host(.et2-label-fixed) .form-control-help-text {
|
||||||
|
left: calc(var(--sl-spacing-medium) + var(--label-width, 8em));
|
||||||
|
}
|
||||||
`];
|
`];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user