Skip to content

Commit

Permalink
Merge pull request #177 from com-pas/upstream-v0.21.0
Browse files Browse the repository at this point in the history
Merge version v0.21.0 from OpenSCD
  • Loading branch information
juancho0202 authored Aug 9, 2022
2 parents dd8716d + 454fca2 commit 1b9c6d4
Show file tree
Hide file tree
Showing 32 changed files with 2,258 additions and 488 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [0.21.0](https://github.com/openscd/open-scd/compare/v0.20.0...v0.21.0) (2022-08-08)


### Features

* **editors/publisher:** add read only gse-control-element-editor ([#917](https://github.com/openscd/open-scd/issues/917)) ([2aee3cc](https://github.com/openscd/open-scd/commits/2aee3ccb78cbe1c18a2b55769b130e196bc45869))
* **editors/publisher:** add sampled-value-control-element-editor ([#920](https://github.com/openscd/open-scd/issues/920)) ([e95dfc5](https://github.com/openscd/open-scd/commits/e95dfc509b710dafc53f2980f5ac93e303cc995d))
* **plugin:** add read-only report-control-element-editor ([#913](https://github.com/openscd/open-scd/issues/913)) ([21732c9](https://github.com/openscd/open-scd/commits/21732c984c5af0e1a31424f3485cb98ccaa70f6a))


### Bug Fixes

* **editors/cleanup:** Fix filter issue with in cleanup plugin ([#910](https://github.com/openscd/open-scd/issues/910)) ([92e7390](https://github.com/openscd/open-scd/commits/92e7390a9cfb42d25858578b71bf935304cc4691))

## [0.20.0](https://github.com/openscd/open-scd/compare/v0.19.0...v0.20.0) (2022-07-31)


Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
"purpose": "maskable"
}
],
"version": "0.20.0"
"version": "0.21.0"
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open-scd",
"version": "0.20.0",
"version": "0.21.0",
"repository": "https://github.com/openscd/open-scd.git",
"description": "A bottom-up substation configuration designer for projects described using SCL `IEC 61850-6` Edition 2 or greater.",
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions src/editors/Publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class PublisherPlugin extends LitElement {
/** The document being edited as provided to plugins by [[`OpenSCD`]]. */
@property({ attribute: false })
doc!: XMLDocument;

@state()
private publisherType: 'Report' | 'GOOSE' | 'SampledValue' | 'DataSet' =
'GOOSE';
Expand Down
41 changes: 21 additions & 20 deletions src/editors/cleanup/control-blocks-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
query,
queryAll,
} from 'lit-element';
import { classMap } from 'lit-html/directives/class-map';
import { translate } from 'lit-translate';

import '@material/mwc-button';
Expand Down Expand Up @@ -76,7 +77,7 @@ function getCommAddress(controlBlock: Element): Element | null | undefined {
@customElement('cleanup-control-blocks')
export class CleanupControlBlocks extends LitElement {
/** The document being edited as provided to plugins by [[`OpenSCD`]]. */
@property()
@property({ attribute: false })
doc!: XMLDocument;

@property({ type: Boolean })
Expand All @@ -85,7 +86,7 @@ export class CleanupControlBlocks extends LitElement {
@property({ type: Array })
unreferencedControls: Element[] = [];

@property()
@property({ attribute: false })
selectedControlItems: MWCListIndex | [] = [];

@query('.deleteButton')
Expand Down Expand Up @@ -118,7 +119,9 @@ export class CleanupControlBlocks extends LitElement {
*/
private toggleHiddenClass(selectorType: string) {
this.cleanupList!.querySelectorAll(`.${selectorType}`).forEach(element => {
element.classList.toggle('hidden');
element.classList.toggle('hiddenontypefilter');
if (element.hasAttribute('disabled')) element.removeAttribute('disabled');
else element.setAttribute('disabled', 'true');
});
}

Expand Down Expand Up @@ -164,7 +167,13 @@ export class CleanupControlBlocks extends LitElement {
private renderListItem(controlBlock: Element): TemplateResult {
return html`<mwc-check-list-item
twoline
class="cleanupListItem t${controlBlock.tagName}"
class="${classMap({
cleanupListItem: true,
tReportControl: controlBlock.tagName === 'ReportControl',
tLogControl: controlBlock.tagName === 'LogControl',
tGSEControl: controlBlock.tagName === 'GSEControl',
tSampledValueControl: controlBlock.tagName === 'SampledValueControl',
})}"
value="${identity(controlBlock)}"
graphic="large"
><span class="unreferencedControl"
Expand Down Expand Up @@ -228,13 +237,15 @@ export class CleanupControlBlocks extends LitElement {
* @returns html for the Delete Button of this container.
*/
private renderDeleteButton(): TemplateResult {
const sizeSelectedItems = (<Set<number>>this.selectedControlItems).size;

return html`<mwc-button
outlined
icon="delete"
class="deleteButton"
label="${translate('cleanup.unreferencedControls.deleteButton')} (${(<
Set<number>
>this.selectedControlItems).size || '0'})"
label="${translate(
'cleanup.unreferencedControls.deleteButton'
)} (${sizeSelectedItems || '0'})"
?disabled=${(<Set<number>>this.selectedControlItems).size === 0 ||
(Array.isArray(this.selectedControlItems) &&
!this.selectedControlItems.length)}
Expand Down Expand Up @@ -399,22 +410,12 @@ export class CleanupControlBlocks extends LitElement {
opacity: 1;
}
/* items are disabled if the filter is deselected */
.tGSEControl,
.tSampledValueControl,
.tLogControl,
.tReportControl {
/* Make sure to type filter here
.hidden is set on string filter in filtered-list and must always filter*/
.cleanupListItem.hiddenontypefilter:not(.hidden) {
display: none;
}
/* items enabled if filter is selected */
.tGSEControlFilter[on] ~ .cleanupList > .tGSEControl,
.tSampledValueControlFilter[on] ~ .cleanupList > .tSampledValueControl,
.tLogControlFilter[on] ~ .cleanupList > .tLogControl,
.tReportControlFilter[on] ~ .cleanupList > .tReportControl {
display: flex;
}
/* filter disabled, Material Design guidelines for opacity */
.tGSEControlFilter,
.tSampledValueControlFilter,
Expand Down
12 changes: 7 additions & 5 deletions src/editors/cleanup/datasets-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { cleanSCLItems, identitySort } from './foundation.js';
@customElement('cleanup-datasets')
export class CleanupDatasets extends LitElement {
/** The document being edited as provided to plugins by [[`OpenSCD`]]. */
@property()
@property({ attribute: false })
doc!: XMLDocument;

@property({ type: Boolean })
Expand All @@ -47,7 +47,7 @@ export class CleanupDatasets extends LitElement {
@property({ type: Array })
unreferencedDataSets: Element[] = [];

@property()
@property({ attribute: false })
selectedDatasetItems: MWCListIndex | [] = [];

@query('.deleteButton')
Expand Down Expand Up @@ -107,13 +107,15 @@ export class CleanupDatasets extends LitElement {
* @returns html for the Delete Button of this container.
*/
private renderDeleteButton(): TemplateResult {
const sizeSelectedItems = (<Set<number>>this.selectedDatasetItems).size;

return html` <mwc-button
outlined
icon="delete"
class="deleteButton cleanupDeleteButton"
label="${translate('cleanup.unreferencedDataSets.deleteButton')} (${(<
Set<number>
>this.selectedDatasetItems).size || '0'})"
label="${translate(
'cleanup.unreferencedDataSets.deleteButton'
)} (${sizeSelectedItems || '0'})"
?disabled=${(<Set<number>>this.selectedDatasetItems).size === 0 ||
(Array.isArray(this.selectedDatasetItems) &&
!this.selectedDatasetItems.length)}
Expand Down
20 changes: 19 additions & 1 deletion src/editors/publisher/data-set-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,21 @@ import { styles } from './foundation.js';
export class DataSetEditor extends LitElement {
/** The document being edited as provided to plugins by [[`OpenSCD`]]. */
@property({ attribute: false })
doc!: XMLDocument;
set doc(newDoc: XMLDocument) {
if (this._doc === newDoc) return;

this.selectedDataSet = undefined;
if (this.selectionList && this.selectionList.selected)
(this.selectionList.selected as ListItem).selected = false;

this._doc = newDoc;

this.requestUpdate();
}
get doc(): XMLDocument {
return this._doc;
}
private _doc!: XMLDocument;

@state()
selectedDataSet?: Element;
Expand Down Expand Up @@ -113,5 +127,9 @@ export class DataSetEditor extends LitElement {

static styles = css`
${styles}
data-set-element-editor {
flex: auto;
}
`;
}
86 changes: 49 additions & 37 deletions src/editors/publisher/data-set-element-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import { identity } from '../../foundation.js';

@customElement('data-set-element-editor')
export class DataSetElementEditor extends LitElement {
/** The document being edited as provided to plugins by [[`OpenSCD`]]. */
@property({ attribute: false })
doc!: XMLDocument;
/** The element being edited as provided to plugins by [[`OpenSCD`]]. */
@property({ attribute: false })
element!: Element | null;

Expand All @@ -30,53 +34,61 @@ export class DataSetElementEditor extends LitElement {
return this.element ? this.element.getAttribute('desc') : 'UNDEFINED';
}

private renderContent(): TemplateResult {
return html`<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, fc] = [
'ldInst',
'prefix',
'lnClass',
'lnInst',
'doName',
'daName',
'fc',
].map(attributeName => fcda.getAttribute(attributeName) ?? '');
return html`<mwc-list-item selected twoline value="${identity(fcda)}"
><span
>${doName}${daName
? '.' + daName + ' ' + '[' + fc + ']'
: ' ' + '[' + fc + ']'}</span
><span slot="secondary"
>${ldInst + '/' + prefix + lnClass + lnInst}</span
>
</mwc-list-item>`;
})}</filtered-list
>`;
}

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
>
${this.renderContent()}
</div>`;

return html`<div class="content">
<h2>${translate('publisher.nodataset')}</h2>
<h2>
<div>DataSet</div>
<div class="headersubtitle">${translate('publisher.nodataset')}</div>
</h2>
</div>`;
}

Expand Down
14 changes: 10 additions & 4 deletions src/editors/publisher/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ export const styles = css`
display: flex;
}
data-set-element-editor {
width: calc(100% - 6px);
}
.listitem.header {
font-weight: 500;
}
Expand All @@ -37,6 +33,12 @@ export const styles = css`
display: none;
}
@media (max-width: 950px) {
.elementeditorcontainer {
display: block;
}
}
@media (max-width: 599px) {
.content {
height: 100%;
Expand All @@ -54,6 +56,10 @@ export const styles = css`
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
}
.elementeditorcontainer {
display: block;
}
data-set-element-editor {
width: calc(100% - 16px);
}
Expand Down
Loading

0 comments on commit 1b9c6d4

Please sign in to comment.