Skip to content

Commit

Permalink
fix: styling issue with SubEquipment editor (#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobVogelsang committed Jan 14, 2023
1 parent da4c4c0 commit d0e9657
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 80 deletions.
41 changes: 18 additions & 23 deletions src/editors/substation/conducting-equipment-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import '../../action-icon.js';
import '../../action-pane.js';
import './eq-function-editor.js';
import './l-node-editor.js';
import './sub-equipment-editor.js';
import { startMove, getIcon, styles } from './foundation.js';
import {
getChildElementsByTagName,
Expand All @@ -32,8 +33,6 @@ import {
import { BayEditor } from './bay-editor.js';
import { emptyWizard, wizards } from '../../wizards/wizard-library.js';

import './sub-equipment-editor.js';

function childTags(element: Element | null | undefined): SCLTag[] {
if (!element) return [];

Expand Down Expand Up @@ -127,6 +126,23 @@ export class ConductingEquipmentEditor extends LitElement {
)}`;
}

private renderSubEquipments(): TemplateResult {
if (!this.showfunctions) return html``;

const subEquipments = getChildElementsByTagName(
this.element,
'SubEquipment'
);

return html` ${subEquipments.map(
subEquipment =>
html`<sub-equipment-editor
.doc=${this.doc}
.element=${subEquipment}
></sub-equipment-editor>`
)}`;
}

private renderAddButtons(): TemplateResult[] {
return childTags(this.element).map(
child =>
Expand Down Expand Up @@ -222,27 +238,6 @@ export class ConductingEquipmentEditor extends LitElement {
></mwc-fab>`;
}

private renderSubEquipments(): TemplateResult {
if (!this.showfunctions) return html``;

const subEquipments = getChildElementsByTagName(
this.element,
'SubEquipment'
);

return subEquipments.length
? html`<div class="container subequipment">
${subEquipments.map(
subEquipment =>
html`<sub-equipment-editor
.doc=${this.doc}
.element=${subEquipment}
></sub-equipment-editor>`
)}
</div>`
: html``;
}

render(): TemplateResult {
if (this.showfunctions)
return html`<action-pane label="${this.name}"
Expand Down
8 changes: 0 additions & 8 deletions src/editors/substation/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,14 +659,6 @@ export const styles = css`
grid-template-columns: repeat(auto-fit, minmax(64px, auto));
}
.container.subequipment {
display: grid;
grid-gap: 12px;
padding: 8px 12px 16px;
box-sizing: border-box;
grid-template-columns: repeat(auto-fit, minmax(64px, auto));
}
mwc-dialog {
display: flex;
flex-direction: column;
Expand Down
42 changes: 19 additions & 23 deletions src/editors/substation/powertransformer-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import { Menu } from '@material/mwc-menu';

import '../../action-icon.js';
import '../../action-pane.js';
import './sub-equipment-editor.js';
import './eq-function-editor.js';
import './transformer-winding-editor.js';
import { powerTransformerTwoWindingIcon } from '../../icons/icons.js';
import { emptyWizard, wizards } from '../../wizards/wizard-library.js';
import {
Expand All @@ -33,9 +36,6 @@ import { SubstationEditor } from './substation-editor.js';
import { BayEditor } from './bay-editor.js';
import { VoltageLevelEditor } from './voltage-level-editor.js';

import './sub-equipment-editor.js';
import './transformer-winding-editor.js';

function childTags(element: Element | null | undefined): SCLTag[] {
if (!element) return [];

Expand Down Expand Up @@ -130,6 +130,22 @@ export class PowerTransformerEditor extends LitElement {
)}`;
}

private renderSubEquipments(): TemplateResult {
if (!this.showfunctions) return html``;
const subEquipments = getChildElementsByTagName(
this.element,
'SubEquipment'
);

return html` ${subEquipments.map(
subEquipment =>
html`<sub-equipment-editor
.doc=${this.doc}
.element=${subEquipment}
></sub-equipment-editor>`
)}`;
}

private renderAddButtons(): TemplateResult[] {
return childTags(this.element).map(
child =>
Expand Down Expand Up @@ -201,26 +217,6 @@ export class PowerTransformerEditor extends LitElement {
</abbr>`;
}

private renderSubEquipments(): TemplateResult {
if (!this.showfunctions) return html``;
const subEquipments = getChildElementsByTagName(
this.element,
'SubEquipment'
);

return subEquipments.length
? html`<div class="container subequipment">
${subEquipments.map(
subEquipment =>
html`<sub-equipment-editor
.doc=${this.doc}
.element=${subEquipment}
></sub-equipment-editor>`
)}
</div>`
: html``;
}

private renderTransformerWinding(): TemplateResult {
if (!this.showfunctions) return html``;
const transformerWindings = getChildElementsByTagName(
Expand Down
18 changes: 10 additions & 8 deletions src/editors/substation/sub-equipment-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { Menu } from '@material/mwc-menu';

import '../../action-icon.js';
import '../../action-pane.js';

import { styles } from './foundation.js';
import './l-node-editor.js';
import './eq-function-editor.js';
import {
getChildElementsByTagName,
newWizardEvent,
Expand Down Expand Up @@ -178,15 +178,17 @@ export class SubEquipmentEditor extends LitElement {
}

static styles = css`
${styles}
:host(.moving) {
opacity: 0.3;
}
abbr {
text-decoration: none;
border-bottom: none;
}
.container.lnode {
display: grid;
grid-gap: 12px;
padding: 8px 12px 16px;
box-sizing: border-box;
grid-template-columns: repeat(auto-fit, minmax(64px, auto));
}
`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -458,16 +458,14 @@ snapshots["conducting-equipment-editor rendered as action pane with SubEquipment
</mwc-list-item>
</mwc-menu>
</abbr>
<div class="container subequipment">
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
</div>
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
</action-pane>
`;
/* end snapshot conducting-equipment-editor rendered as action pane with SubEquipment children looks like the latest snapshot */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,14 +461,12 @@ snapshots["powertransformer-editor rendered as action pane with SubEquipment chi
</mwc-list-item>
</mwc-menu>
</abbr>
<div class="container subequipment">
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
</div>
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
<sub-equipment-editor>
</sub-equipment-editor>
</action-pane>
`;
/* end snapshot powertransformer-editor rendered as action pane with SubEquipment children looks like the latest snapshot */
Expand Down

0 comments on commit d0e9657

Please sign in to comment.