fix(ts_web): handle slotted config section content visibility and field row borders correctly
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-04-07 - 2.12.1 - fix(ts_web)
|
||||||
|
handle slotted config section content visibility and field row borders correctly
|
||||||
|
|
||||||
|
- track whether the default slot has assigned content and hide the slot container when empty
|
||||||
|
- wrap rendered fields in a dedicated list so the last field row border is removed correctly when slot content is present
|
||||||
|
|
||||||
## 2026-04-07 - 2.12.0 - feat(elements)
|
## 2026-04-07 - 2.12.0 - feat(elements)
|
||||||
standardize dashboard and detail views on dees tile and stats grid components
|
standardize dashboard and detail views on dees tile and stats grid components
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/catalog',
|
name: '@serve.zone/catalog',
|
||||||
version: '2.12.0',
|
version: '2.12.1',
|
||||||
description: 'UI component catalog for serve.zone'
|
description: 'UI component catalog for serve.zone'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,6 +126,9 @@ export class SzConfigSection extends DeesElement {
|
|||||||
@state()
|
@state()
|
||||||
accessor isCollapsed: boolean = false;
|
accessor isCollapsed: boolean = false;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
accessor hasSlottedContent: boolean = false;
|
||||||
|
|
||||||
public static styles = [
|
public static styles = [
|
||||||
cssManager.defaultStyles,
|
cssManager.defaultStyles,
|
||||||
css`
|
css`
|
||||||
@@ -347,6 +350,11 @@ export class SzConfigSection extends DeesElement {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fields-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
/* Field rows */
|
/* Field rows */
|
||||||
.field-row {
|
.field-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -357,7 +365,7 @@ export class SzConfigSection extends DeesElement {
|
|||||||
gap: 16px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-row:last-child {
|
.fields-list .field-row:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,9 +480,8 @@ export class SzConfigSection extends DeesElement {
|
|||||||
border-top: 1px solid ${cssManager.bdTheme('#f4f4f5', '#1a1a1e')};
|
border-top: 1px solid ${cssManager.bdTheme('#f4f4f5', '#1a1a1e')};
|
||||||
}
|
}
|
||||||
|
|
||||||
.slot-content:empty {
|
.slot-content.empty {
|
||||||
display: none;
|
display: none;
|
||||||
border-top: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Badge type */
|
/* Badge type */
|
||||||
@@ -506,6 +513,11 @@ export class SzConfigSection extends DeesElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onSlotChange(e: Event) {
|
||||||
|
const slot = e.target as HTMLSlotElement;
|
||||||
|
this.hasSlottedContent = slot.assignedNodes({ flatten: true }).length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
const statusLabels: Record<string, string> = {
|
const statusLabels: Record<string, string> = {
|
||||||
'enabled': 'Enabled',
|
'enabled': 'Enabled',
|
||||||
@@ -551,9 +563,13 @@ export class SzConfigSection extends DeesElement {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section-content">
|
<div class="section-content">
|
||||||
${this.fields.map(field => this.renderField(field))}
|
${this.fields.length > 0 ? html`
|
||||||
<div class="slot-content">
|
<div class="fields-list">
|
||||||
<slot></slot>
|
${this.fields.map(field => this.renderField(field))}
|
||||||
|
</div>
|
||||||
|
` : ''}
|
||||||
|
<div class="slot-content ${!this.hasSlottedContent ? 'empty' : ''}">
|
||||||
|
<slot @slotchange=${this.onSlotChange}></slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
${this.links.length > 0 || this.actions.length > 0 ? html`
|
${this.links.length > 0 || this.actions.length > 0 ? html`
|
||||||
|
|||||||
Reference in New Issue
Block a user