-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editors/publisher): add read only data set element editor (#911)
* feat(editors/publisher): add read only data set element editor * refactor(editors/publisher): resolve review comments
- Loading branch information
1 parent
ed0e71d
commit 45b5440
Showing
19 changed files
with
1,640 additions
and
494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { | ||
css, | ||
customElement, | ||
html, | ||
LitElement, | ||
property, | ||
state, | ||
TemplateResult, | ||
} from 'lit-element'; | ||
import { translate } from 'lit-translate'; | ||
|
||
import '@material/mwc-list/mwc-list-item'; | ||
|
||
import '../../wizard-textfield.js'; | ||
import '../../filtered-list.js'; | ||
|
||
import { identity } from '../../foundation.js'; | ||
|
||
@customElement('data-set-element-editor') | ||
export class DataSetElementEditor extends LitElement { | ||
@property({ attribute: false }) | ||
element!: Element | null; | ||
|
||
@state() | ||
private get name(): string | null { | ||
return this.element ? this.element.getAttribute('name') : 'UNDEFINED'; | ||
} | ||
@state() | ||
private get desc(): string | null { | ||
return this.element ? this.element.getAttribute('desc') : 'UNDEFINED'; | ||
} | ||
|
||
render(): TemplateResult { | ||
if (this.element) | ||
return html`<div class="content"> | ||
<h2> | ||
<div>DataSet</div> | ||
<div class="headersubtitle">${identity(this.element)}</div> | ||
</h2> | ||
<wizard-textfield | ||
label="name" | ||
.maybeValue=${this.name} | ||
helper="${translate('scl.name')}" | ||
required | ||
> | ||
</wizard-textfield> | ||
<wizard-textfield | ||
label="desc" | ||
.maybeValue=${this.desc} | ||
helper="${translate('scl.desc')}" | ||
nullable | ||
> | ||
</wizard-textfield> | ||
<filtered-list | ||
>${Array.from(this.element.querySelectorAll('FCDA')).map(fcda => { | ||
const [ldInst, prefix, lnClass, lnInst, doName, daName] = [ | ||
'ldInst', | ||
'prefix', | ||
'lnClass', | ||
'lnInst', | ||
'doName', | ||
'daName', | ||
].map(attributeName => fcda.getAttribute(attributeName) ?? ''); | ||
return html`<mwc-list-item | ||
selected | ||
twoline | ||
value="${identity(fcda)}" | ||
><span>${doName + '.' + daName}</span | ||
><span slot="secondary" | ||
>${ldInst + '/' + prefix + lnClass + lnInst}</span | ||
> | ||
</mwc-list-item>`; | ||
})}</filtered-list | ||
> | ||
</div>`; | ||
|
||
return html`<div class="content"> | ||
<h2>${translate('publisher.nodataset')}</h2> | ||
</div>`; | ||
} | ||
|
||
static styles = css` | ||
.content { | ||
display: flex; | ||
flex-direction: column; | ||
background-color: var(--mdc-theme-surface); | ||
} | ||
.content > * { | ||
display: block; | ||
margin: 4px 8px 16px; | ||
} | ||
h2 { | ||
color: var(--mdc-theme-on-surface); | ||
font-family: 'Roboto', sans-serif; | ||
font-weight: 300; | ||
margin: 0px; | ||
padding-left: 0.3em; | ||
transition: background-color 150ms linear; | ||
} | ||
.headersubtitle { | ||
font-size: 16px; | ||
font-weight: 200; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
} | ||
*[iconTrailing='search'] { | ||
--mdc-shape-small: 28px; | ||
} | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { css } from 'lit-element'; | ||
|
||
export const styles = css` | ||
.content { | ||
display: flex; | ||
height: calc(100vh - 184px); | ||
} | ||
.selectionlist { | ||
flex: 35%; | ||
margin: 4px 4px 4px 8px; | ||
background-color: var(--mdc-theme-surface); | ||
overflow-y: scroll; | ||
} | ||
.elementeditorcontainer { | ||
flex: 65%; | ||
margin: 4px 8px 4px 4px; | ||
background-color: var(--mdc-theme-surface); | ||
overflow-y: scroll; | ||
display: flex; | ||
} | ||
data-set-element-editor { | ||
width: calc(100% - 6px); | ||
} | ||
.listitem.header { | ||
font-weight: 500; | ||
} | ||
mwc-list-item.hidden[noninteractive] + li[divider] { | ||
display: none; | ||
} | ||
mwc-button { | ||
display: none; | ||
} | ||
@media (max-width: 599px) { | ||
.content { | ||
height: 100%; | ||
} | ||
.selectionlist { | ||
position: absolute; | ||
width: calc(100% - 32px); | ||
height: auto; | ||
top: 110px; | ||
left: 8px; | ||
background-color: var(--mdc-theme-surface); | ||
z-index: 1; | ||
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14), | ||
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2); | ||
} | ||
data-set-element-editor { | ||
width: calc(100% - 16px); | ||
} | ||
.selectionlist.hidden { | ||
display: none; | ||
} | ||
mwc-button { | ||
display: flex; | ||
margin: 4px 8px 8px; | ||
} | ||
} | ||
`; |
Oops, something went wrong.