Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: styling issue with SubEquipment editor #1130

Merged
merged 2 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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