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(editor-container): minor UI issues #371

Merged
merged 4 commits into from
Nov 10, 2021
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
10 changes: 8 additions & 2 deletions __snapshots__/bay-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
#### `looks like the latest snapshot`

```html
<editor-container nomargin="">
<editor-container
nomargin=""
tabindex="0"
>
<abbr
slot="header"
title="[lnode.tooltip]"
Expand Down Expand Up @@ -60,7 +63,10 @@
#### `looks like the latest snapshot`

```html
<editor-container nomargin="">
<editor-container
nomargin=""
tabindex="0"
>
<abbr
slot="header"
title="[lnode.tooltip]"
Expand Down
4 changes: 2 additions & 2 deletions __snapshots__/substation-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#### `looks like the latest snapshot`

```html
<editor-container>
<editor-container tabindex="0">
<abbr
slot="header"
title="[lnode.tooltip]"
Expand Down Expand Up @@ -52,7 +52,7 @@
#### `looks like the latest snapshot`

```html
<editor-container>
<editor-container tabindex="0">
<abbr
slot="header"
title="[lnode.tooltip]"
Expand Down
14 changes: 10 additions & 4 deletions __snapshots__/voltage-level-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#### `looks like the latest snapshot`

```html
<editor-container header="E1 - Voltage Level
(110.0 kV)">
<editor-container
header="E1 - Voltage Level
(110.0 kV)"
tabindex="0"
>
<abbr
slot="header"
title="[lnode.tooltip]"
Expand Down Expand Up @@ -55,8 +58,11 @@
#### `looks like the latest snapshot`

```html
<editor-container header="E1 - Voltage Level
(110.0 kV)">
<editor-container
header="E1 - Voltage Level
(110.0 kV)"
tabindex="0"
>
<abbr
slot="header"
title="[lnode.tooltip]"
Expand Down
7 changes: 3 additions & 4 deletions src/editor-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export class EditorContainer extends LitElement {
async firstUpdated(): Promise<void> {
await super.updateComplete;

this.tabIndex = 0;

if (this.addMenu) this.addMenu.anchor = this.headerContainer;

const parentEditorContainer =
Expand All @@ -91,8 +93,6 @@ export class EditorContainer extends LitElement {
);

this.contrasted = !parentEditorContainer.contrasted;

this.tabIndex = 0;
}

private renderAddButtons(): TemplateResult[] {
Expand Down Expand Up @@ -199,7 +199,7 @@ export class EditorContainer extends LitElement {
transition: all 200ms linear;
outline-style: solid;
margin: 8px 12px 16px;
overflow: hidden;
padding: 0.05px;
outline-width: 0px;
outline-color: var(--mdc-theme-primary);
opacity: 1;
Expand All @@ -219,7 +219,6 @@ export class EditorContainer extends LitElement {

.nomargin {
margin: 0px;
overflow: visible;
}

:host {
Expand Down
88 changes: 41 additions & 47 deletions src/zeroline/substation-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,53 +70,47 @@ export class SubstationEditor extends LitElement {
}

render(): TemplateResult {
return html`
<editor-container
.element=${this.element}
>
${this.renderIedContainer()}
<abbr slot="header" title="${translate('lnode.tooltip')}">
<mwc-icon-button
icon="account_tree"
@click=${() => this.openLNodeWizard()}
></mwc-icon-button>
</abbr>
<abbr slot="header" title="${translate('duplicate')}">
<mwc-icon-button
icon="content_copy"
@click=${() => cloneSubstationElement(this)}
></mwc-icon-button>
</abbr>
<abbr slot="header" title="${translate('edit')}">
<mwc-icon-button
icon="edit"
@click=${() => this.openEditWizard()}
></mwc-icon-button>
</abbr>
<abbr slot="header" title="${translate('move')}">
<mwc-icon-button
icon="forward"
@click=${() =>
startMove(this, SubstationEditor, SubstationEditor)}
></mwc-icon-button>
</abbr>
<abbr slot="header" title="${translate('remove')}">
<mwc-icon-button
icon="delete"
@click=${() => this.remove()}
></mwc-icon-button> </abbr
>${Array.from(
this.element.querySelectorAll(selectors.VoltageLevel)
).map(
voltageLevel =>
html`<voltage-level-editor
.element=${voltageLevel}
.getAttachedIeds=${this.getAttachedIeds}
?readonly=${this.readonly}
></voltage-level-editor>`
)}</editor-container>
</section>
`;
return html`<editor-container .element=${this.element}>
<abbr slot="header" title="${translate('lnode.tooltip')}">
<mwc-icon-button
icon="account_tree"
@click=${() => this.openLNodeWizard()}
></mwc-icon-button>
</abbr>
<abbr slot="header" title="${translate('duplicate')}">
<mwc-icon-button
icon="content_copy"
@click=${() => cloneSubstationElement(this)}
></mwc-icon-button>
</abbr>
<abbr slot="header" title="${translate('edit')}">
<mwc-icon-button
icon="edit"
@click=${() => this.openEditWizard()}
></mwc-icon-button>
</abbr>
<abbr slot="header" title="${translate('move')}">
<mwc-icon-button
icon="forward"
@click=${() => startMove(this, SubstationEditor, SubstationEditor)}
></mwc-icon-button>
</abbr>
<abbr slot="header" title="${translate('remove')}">
<mwc-icon-button
icon="delete"
@click=${() => this.remove()}
></mwc-icon-button
></abbr>
${this.renderIedContainer()}
${Array.from(this.element.querySelectorAll(selectors.VoltageLevel)).map(
voltageLevel =>
html`<voltage-level-editor
.element=${voltageLevel}
.getAttachedIeds=${this.getAttachedIeds}
?readonly=${this.readonly}
></voltage-level-editor>`
)}</editor-container
>`;
}

static styles = css`
Expand Down