Skip to content

Commit 1b9c6d4

Browse files
authored
Merge pull request #177 from com-pas/upstream-v0.21.0
Merge version v0.21.0 from OpenSCD
2 parents dd8716d + 454fca2 commit 1b9c6d4

32 files changed

+2258
-488
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
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.
44

5+
## [0.21.0](https://github.com/openscd/open-scd/compare/v0.20.0...v0.21.0) (2022-08-08)
6+
7+
8+
### Features
9+
10+
* **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))
11+
* **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))
12+
* **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))
13+
14+
15+
### Bug Fixes
16+
17+
* **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))
18+
519
## [0.20.0](https://github.com/openscd/open-scd/compare/v0.19.0...v0.20.0) (2022-07-31)
620

721

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@
4040
"purpose": "maskable"
4141
}
4242
],
43-
"version": "0.20.0"
43+
"version": "0.21.0"
4444
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "open-scd",
3-
"version": "0.20.0",
3+
"version": "0.21.0",
44
"repository": "https://github.com/openscd/open-scd.git",
55
"description": "A bottom-up substation configuration designer for projects described using SCL `IEC 61850-6` Edition 2 or greater.",
66
"keywords": [

src/editors/Publisher.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default class PublisherPlugin extends LitElement {
2121
/** The document being edited as provided to plugins by [[`OpenSCD`]]. */
2222
@property({ attribute: false })
2323
doc!: XMLDocument;
24+
2425
@state()
2526
private publisherType: 'Report' | 'GOOSE' | 'SampledValue' | 'DataSet' =
2627
'GOOSE';

src/editors/cleanup/control-blocks-container.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
query,
1111
queryAll,
1212
} from 'lit-element';
13+
import { classMap } from 'lit-html/directives/class-map';
1314
import { translate } from 'lit-translate';
1415

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

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

88-
@property()
89+
@property({ attribute: false })
8990
selectedControlItems: MWCListIndex | [] = [];
9091

9192
@query('.deleteButton')
@@ -118,7 +119,9 @@ export class CleanupControlBlocks extends LitElement {
118119
*/
119120
private toggleHiddenClass(selectorType: string) {
120121
this.cleanupList!.querySelectorAll(`.${selectorType}`).forEach(element => {
121-
element.classList.toggle('hidden');
122+
element.classList.toggle('hiddenontypefilter');
123+
if (element.hasAttribute('disabled')) element.removeAttribute('disabled');
124+
else element.setAttribute('disabled', 'true');
122125
});
123126
}
124127

@@ -164,7 +167,13 @@ export class CleanupControlBlocks extends LitElement {
164167
private renderListItem(controlBlock: Element): TemplateResult {
165168
return html`<mwc-check-list-item
166169
twoline
167-
class="cleanupListItem t${controlBlock.tagName}"
170+
class="${classMap({
171+
cleanupListItem: true,
172+
tReportControl: controlBlock.tagName === 'ReportControl',
173+
tLogControl: controlBlock.tagName === 'LogControl',
174+
tGSEControl: controlBlock.tagName === 'GSEControl',
175+
tSampledValueControl: controlBlock.tagName === 'SampledValueControl',
176+
})}"
168177
value="${identity(controlBlock)}"
169178
graphic="large"
170179
><span class="unreferencedControl"
@@ -228,13 +237,15 @@ export class CleanupControlBlocks extends LitElement {
228237
* @returns html for the Delete Button of this container.
229238
*/
230239
private renderDeleteButton(): TemplateResult {
240+
const sizeSelectedItems = (<Set<number>>this.selectedControlItems).size;
241+
231242
return html`<mwc-button
232243
outlined
233244
icon="delete"
234245
class="deleteButton"
235-
label="${translate('cleanup.unreferencedControls.deleteButton')} (${(<
236-
Set<number>
237-
>this.selectedControlItems).size || '0'})"
246+
label="${translate(
247+
'cleanup.unreferencedControls.deleteButton'
248+
)} (${sizeSelectedItems || '0'})"
238249
?disabled=${(<Set<number>>this.selectedControlItems).size === 0 ||
239250
(Array.isArray(this.selectedControlItems) &&
240251
!this.selectedControlItems.length)}
@@ -399,22 +410,12 @@ export class CleanupControlBlocks extends LitElement {
399410
opacity: 1;
400411
}
401412
402-
/* items are disabled if the filter is deselected */
403-
.tGSEControl,
404-
.tSampledValueControl,
405-
.tLogControl,
406-
.tReportControl {
413+
/* Make sure to type filter here
414+
.hidden is set on string filter in filtered-list and must always filter*/
415+
.cleanupListItem.hiddenontypefilter:not(.hidden) {
407416
display: none;
408417
}
409418
410-
/* items enabled if filter is selected */
411-
.tGSEControlFilter[on] ~ .cleanupList > .tGSEControl,
412-
.tSampledValueControlFilter[on] ~ .cleanupList > .tSampledValueControl,
413-
.tLogControlFilter[on] ~ .cleanupList > .tLogControl,
414-
.tReportControlFilter[on] ~ .cleanupList > .tReportControl {
415-
display: flex;
416-
}
417-
418419
/* filter disabled, Material Design guidelines for opacity */
419420
.tGSEControlFilter,
420421
.tSampledValueControlFilter,

src/editors/cleanup/datasets-container.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { cleanSCLItems, identitySort } from './foundation.js';
3838
@customElement('cleanup-datasets')
3939
export class CleanupDatasets extends LitElement {
4040
/** The document being edited as provided to plugins by [[`OpenSCD`]]. */
41-
@property()
41+
@property({ attribute: false })
4242
doc!: XMLDocument;
4343

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

50-
@property()
50+
@property({ attribute: false })
5151
selectedDatasetItems: MWCListIndex | [] = [];
5252

5353
@query('.deleteButton')
@@ -107,13 +107,15 @@ export class CleanupDatasets extends LitElement {
107107
* @returns html for the Delete Button of this container.
108108
*/
109109
private renderDeleteButton(): TemplateResult {
110+
const sizeSelectedItems = (<Set<number>>this.selectedDatasetItems).size;
111+
110112
return html` <mwc-button
111113
outlined
112114
icon="delete"
113115
class="deleteButton cleanupDeleteButton"
114-
label="${translate('cleanup.unreferencedDataSets.deleteButton')} (${(<
115-
Set<number>
116-
>this.selectedDatasetItems).size || '0'})"
116+
label="${translate(
117+
'cleanup.unreferencedDataSets.deleteButton'
118+
)} (${sizeSelectedItems || '0'})"
117119
?disabled=${(<Set<number>>this.selectedDatasetItems).size === 0 ||
118120
(Array.isArray(this.selectedDatasetItems) &&
119121
!this.selectedDatasetItems.length)}

src/editors/publisher/data-set-editor.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,21 @@ import { styles } from './foundation.js';
2626
export class DataSetEditor extends LitElement {
2727
/** The document being edited as provided to plugins by [[`OpenSCD`]]. */
2828
@property({ attribute: false })
29-
doc!: XMLDocument;
29+
set doc(newDoc: XMLDocument) {
30+
if (this._doc === newDoc) return;
31+
32+
this.selectedDataSet = undefined;
33+
if (this.selectionList && this.selectionList.selected)
34+
(this.selectionList.selected as ListItem).selected = false;
35+
36+
this._doc = newDoc;
37+
38+
this.requestUpdate();
39+
}
40+
get doc(): XMLDocument {
41+
return this._doc;
42+
}
43+
private _doc!: XMLDocument;
3044

3145
@state()
3246
selectedDataSet?: Element;
@@ -113,5 +127,9 @@ export class DataSetEditor extends LitElement {
113127

114128
static styles = css`
115129
${styles}
130+
131+
data-set-element-editor {
132+
flex: auto;
133+
}
116134
`;
117135
}

src/editors/publisher/data-set-element-editor.ts

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ import { identity } from '../../foundation.js';
1818

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

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

37+
private renderContent(): TemplateResult {
38+
return html`<wizard-textfield
39+
label="name"
40+
.maybeValue=${this.name}
41+
helper="${translate('scl.name')}"
42+
required
43+
>
44+
</wizard-textfield>
45+
<wizard-textfield
46+
label="desc"
47+
.maybeValue=${this.desc}
48+
helper="${translate('scl.desc')}"
49+
nullable
50+
>
51+
</wizard-textfield>
52+
<filtered-list
53+
>${Array.from(this.element!.querySelectorAll('FCDA')).map(fcda => {
54+
const [ldInst, prefix, lnClass, lnInst, doName, daName, fc] = [
55+
'ldInst',
56+
'prefix',
57+
'lnClass',
58+
'lnInst',
59+
'doName',
60+
'daName',
61+
'fc',
62+
].map(attributeName => fcda.getAttribute(attributeName) ?? '');
63+
64+
return html`<mwc-list-item selected twoline value="${identity(fcda)}"
65+
><span
66+
>${doName}${daName
67+
? '.' + daName + ' ' + '[' + fc + ']'
68+
: ' ' + '[' + fc + ']'}</span
69+
><span slot="secondary"
70+
>${ldInst + '/' + prefix + lnClass + lnInst}</span
71+
>
72+
</mwc-list-item>`;
73+
})}</filtered-list
74+
>`;
75+
}
76+
3377
render(): TemplateResult {
3478
if (this.element)
3579
return html`<div class="content">
3680
<h2>
3781
<div>DataSet</div>
3882
<div class="headersubtitle">${identity(this.element)}</div>
3983
</h2>
40-
<wizard-textfield
41-
label="name"
42-
.maybeValue=${this.name}
43-
helper="${translate('scl.name')}"
44-
required
45-
>
46-
</wizard-textfield>
47-
<wizard-textfield
48-
label="desc"
49-
.maybeValue=${this.desc}
50-
helper="${translate('scl.desc')}"
51-
nullable
52-
>
53-
</wizard-textfield>
54-
<filtered-list
55-
>${Array.from(this.element.querySelectorAll('FCDA')).map(fcda => {
56-
const [ldInst, prefix, lnClass, lnInst, doName, daName] = [
57-
'ldInst',
58-
'prefix',
59-
'lnClass',
60-
'lnInst',
61-
'doName',
62-
'daName',
63-
].map(attributeName => fcda.getAttribute(attributeName) ?? '');
64-
65-
return html`<mwc-list-item
66-
selected
67-
twoline
68-
value="${identity(fcda)}"
69-
><span>${doName + '.' + daName}</span
70-
><span slot="secondary"
71-
>${ldInst + '/' + prefix + lnClass + lnInst}</span
72-
>
73-
</mwc-list-item>`;
74-
})}</filtered-list
75-
>
84+
${this.renderContent()}
7685
</div>`;
7786

7887
return html`<div class="content">
79-
<h2>${translate('publisher.nodataset')}</h2>
88+
<h2>
89+
<div>DataSet</div>
90+
<div class="headersubtitle">${translate('publisher.nodataset')}</div>
91+
</h2>
8092
</div>`;
8193
}
8294

src/editors/publisher/foundation.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ export const styles = css`
2121
display: flex;
2222
}
2323
24-
data-set-element-editor {
25-
width: calc(100% - 6px);
26-
}
27-
2824
.listitem.header {
2925
font-weight: 500;
3026
}
@@ -37,6 +33,12 @@ export const styles = css`
3733
display: none;
3834
}
3935
36+
@media (max-width: 950px) {
37+
.elementeditorcontainer {
38+
display: block;
39+
}
40+
}
41+
4042
@media (max-width: 599px) {
4143
.content {
4244
height: 100%;
@@ -54,6 +56,10 @@ export const styles = css`
5456
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
5557
}
5658
59+
.elementeditorcontainer {
60+
display: block;
61+
}
62+
5763
data-set-element-editor {
5864
width: calc(100% - 16px);
5965
}

0 commit comments

Comments
 (0)