@compas-oscd/open-scd 0.34.4 → 0.34.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/WizardDivider.d.ts +0 -8
- package/dist/WizardDivider.js +0 -37
- package/dist/WizardDivider.js.map +0 -1
- package/dist/Wizarding.d.ts +0 -10
- package/dist/Wizarding.js +0 -38
- package/dist/Wizarding.js.map +0 -1
- package/dist/action-icon.d.ts +0 -25
- package/dist/action-icon.js +0 -220
- package/dist/action-icon.js.map +0 -1
- package/dist/action-pane.d.ts +0 -25
- package/dist/action-pane.js +0 -176
- package/dist/action-pane.js.map +0 -1
- package/dist/addons/Editor.d.ts +0 -25
- package/dist/addons/Editor.js +0 -106
- package/dist/addons/Editor.js.map +0 -1
- package/dist/addons/History.d.ts +0 -86
- package/dist/addons/History.js +0 -490
- package/dist/addons/History.js.map +0 -1
- package/dist/addons/Layout.d.ts +0 -96
- package/dist/addons/Layout.js +0 -619
- package/dist/addons/Layout.js.map +0 -1
- package/dist/addons/Settings.d.ts +0 -68
- package/dist/addons/Settings.js +0 -465
- package/dist/addons/Settings.js.map +0 -1
- package/dist/addons/Waiter.d.ts +0 -14
- package/dist/addons/Waiter.js +0 -45
- package/dist/addons/Waiter.js.map +0 -1
- package/dist/addons/Wizards.d.ts +0 -15
- package/dist/addons/Wizards.js +0 -48
- package/dist/addons/Wizards.js.map +0 -1
- package/dist/addons/editor/edit-action-to-v1-converter.d.ts +0 -3
- package/dist/addons/editor/edit-action-to-v1-converter.js +0 -96
- package/dist/addons/editor/edit-action-to-v1-converter.js.map +0 -1
- package/dist/addons/editor/edit-v1-to-v2-converter.d.ts +0 -2
- package/dist/addons/editor/edit-v1-to-v2-converter.js +0 -37
- package/dist/addons/editor/edit-v1-to-v2-converter.js.map +0 -1
- package/dist/addons/history/get-log-text.d.ts +0 -5
- package/dist/addons/history/get-log-text.js +0 -26
- package/dist/addons/history/get-log-text.js.map +0 -1
- package/dist/addons/menu-tabs/menu-tabs.d.ts +0 -22
- package/dist/addons/menu-tabs/menu-tabs.js +0 -74
- package/dist/addons/menu-tabs/menu-tabs.js.map +0 -1
- package/dist/addons/plugin-manager/custom-plugin-dialog.d.ts +0 -28
- package/dist/addons/plugin-manager/custom-plugin-dialog.js +0 -177
- package/dist/addons/plugin-manager/custom-plugin-dialog.js.map +0 -1
- package/dist/addons/plugin-manager/plugin-manager.d.ts +0 -20
- package/dist/addons/plugin-manager/plugin-manager.js +0 -165
- package/dist/addons/plugin-manager/plugin-manager.js.map +0 -1
- package/dist/filtered-list.d.ts +0 -27
- package/dist/filtered-list.js +0 -168
- package/dist/filtered-list.js.map +0 -1
- package/dist/finder-list.d.ts +0 -37
- package/dist/finder-list.js +0 -207
- package/dist/finder-list.js.map +0 -1
- package/dist/foundation/compare.d.ts +0 -79
- package/dist/foundation/compare.js +0 -273
- package/dist/foundation/compare.js.map +0 -1
- package/dist/foundation/dai.d.ts +0 -30
- package/dist/foundation/dai.js +0 -127
- package/dist/foundation/dai.js.map +0 -1
- package/dist/foundation/generators.d.ts +0 -13
- package/dist/foundation/generators.js +0 -67
- package/dist/foundation/generators.js.map +0 -1
- package/dist/foundation/ied.d.ts +0 -22
- package/dist/foundation/ied.js +0 -84
- package/dist/foundation/ied.js.map +0 -1
- package/dist/foundation/nsd.d.ts +0 -4
- package/dist/foundation/nsd.js +0 -13
- package/dist/foundation/nsd.js.map +0 -1
- package/dist/foundation/nsdoc.d.ts +0 -14
- package/dist/foundation/nsdoc.js +0 -180
- package/dist/foundation/nsdoc.js.map +0 -1
- package/dist/foundation/scl.d.ts +0 -1
- package/dist/foundation/scl.js +0 -64
- package/dist/foundation/scl.js.map +0 -1
- package/dist/foundation.d.ts +0 -230
- package/dist/foundation.js +0 -1922
- package/dist/foundation.js.map +0 -1
- package/dist/icons/compare.d.ts +0 -3
- package/dist/icons/compare.js +0 -11
- package/dist/icons/compare.js.map +0 -1
- package/dist/icons/icons.d.ts +0 -41
- package/dist/icons/icons.js +0 -611
- package/dist/icons/icons.js.map +0 -1
- package/dist/icons/ied-icons.d.ts +0 -3
- package/dist/icons/ied-icons.js +0 -11
- package/dist/icons/ied-icons.js.map +0 -1
- package/dist/icons/lnode.d.ts +0 -16
- package/dist/icons/lnode.js +0 -50
- package/dist/icons/lnode.js.map +0 -1
- package/dist/open-scd.d.ts +0 -131
- package/dist/open-scd.js +0 -483
- package/dist/open-scd.js.map +0 -1
- package/dist/oscd-filter-button.d.ts +0 -27
- package/dist/oscd-filter-button.js +0 -89
- package/dist/oscd-filter-button.js.map +0 -1
- package/dist/plain-compare-list.d.ts +0 -36
- package/dist/plain-compare-list.js +0 -132
- package/dist/plain-compare-list.js.map +0 -1
- package/dist/plugin-tag.d.ts +0 -6
- package/dist/plugin-tag.js +0 -23
- package/dist/plugin-tag.js.map +0 -1
- package/dist/plugin.d.ts +0 -23
- package/dist/plugin.events.d.ts +0 -15
- package/dist/plugin.events.js +0 -12
- package/dist/plugin.events.js.map +0 -1
- package/dist/plugin.js +0 -2
- package/dist/plugin.js.map +0 -1
- package/dist/plugins.d.ts +0 -3
- package/dist/plugins.js +0 -256
- package/dist/plugins.js.map +0 -1
- package/dist/schemas.d.ts +0 -58
- package/dist/schemas.js +0 -9325
- package/dist/schemas.js.map +0 -1
- package/dist/themes.d.ts +0 -3
- package/dist/themes.js +0 -122
- package/dist/themes.js.map +0 -1
- package/dist/translations/de.d.ts +0 -2
- package/dist/translations/de.js +0 -954
- package/dist/translations/de.js.map +0 -1
- package/dist/translations/en.d.ts +0 -963
- package/dist/translations/en.js +0 -950
- package/dist/translations/en.js.map +0 -1
- package/dist/translations/loader.d.ts +0 -12
- package/dist/translations/loader.js +0 -10
- package/dist/translations/loader.js.map +0 -1
- package/dist/wizard-checkbox.d.ts +0 -37
- package/dist/wizard-checkbox.js +0 -152
- package/dist/wizard-checkbox.js.map +0 -1
- package/dist/wizard-dialog.d.ts +0 -45
- package/dist/wizard-dialog.js +0 -374
- package/dist/wizard-dialog.js.map +0 -1
- package/dist/wizard-select.d.ts +0 -31
- package/dist/wizard-select.js +0 -115
- package/dist/wizard-select.js.map +0 -1
- package/dist/wizard-textfield.d.ts +0 -50
- package/dist/wizard-textfield.js +0 -191
- package/dist/wizard-textfield.js.map +0 -1
- package/dist/wizards.d.ts +0 -23
- package/dist/wizards.js +0 -196
- package/dist/wizards.js.map +0 -1
package/dist/foundation/dai.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determine which part of the Template Structure still needs to be initialized.
|
|
3
|
-
* With the first call the parent will normally be the LN(0) Element to start from.
|
|
4
|
-
* It will use the list to pop the first element and look if there is a DOI/SDI/DAI
|
|
5
|
-
* Element available with the same name.
|
|
6
|
-
*
|
|
7
|
-
* @param parentElement - The element to search from for a DOI/SDI/DAI
|
|
8
|
-
* @param templateStructure - The templates structure with DO/DA/BDA Elements.
|
|
9
|
-
* @returns The last element initialized element or LN(0) if nothing is initialized. This Element can be used to
|
|
10
|
-
* add the new element to. And the list of Template Elements that still need to be initialized.
|
|
11
|
-
*/
|
|
12
|
-
export declare function determineUninitializedStructure(parentElement: Element, templateStructure: Element[]): [Element, Element[]];
|
|
13
|
-
/**
|
|
14
|
-
* Create a new instance structure defined by the array of template elements passed.
|
|
15
|
-
*
|
|
16
|
-
* @param uninitializedTemplateStructure - The Array of Template Elements for which new instance elements need to be
|
|
17
|
-
* created.
|
|
18
|
-
* @returns The Element created from the last Template Element in the Array.
|
|
19
|
-
*/
|
|
20
|
-
export declare function initializeElements(uninitializedTemplateStructure: Element[]): Element;
|
|
21
|
-
/**
|
|
22
|
-
* Use the path configuration of a Common Data Class to search for all DO/SDO/DA/BDA Elements to create
|
|
23
|
-
* a structure for which DOI/SDI/DAI Elements should be created later. Null will be returned when an invalid
|
|
24
|
-
* Template Structure is described by the path.
|
|
25
|
-
*
|
|
26
|
-
* @param lnElement - The LN Element to use for searching the starting DO Element.
|
|
27
|
-
* @param path - The (S)DO/(B)DA Elements to find in the template structure.
|
|
28
|
-
* @returns List of Elements starting with the DO Element followed by one or more SDO or (B)DA Elements describing the structure.
|
|
29
|
-
*/
|
|
30
|
-
export declare function createTemplateStructure(lnElement: Element, path: string[]): Element[] | null;
|
package/dist/foundation/dai.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { SCL_NAMESPACE } from '../schemas.js';
|
|
2
|
-
/**
|
|
3
|
-
* Determine which part of the Template Structure still needs to be initialized.
|
|
4
|
-
* With the first call the parent will normally be the LN(0) Element to start from.
|
|
5
|
-
* It will use the list to pop the first element and look if there is a DOI/SDI/DAI
|
|
6
|
-
* Element available with the same name.
|
|
7
|
-
*
|
|
8
|
-
* @param parentElement - The element to search from for a DOI/SDI/DAI
|
|
9
|
-
* @param templateStructure - The templates structure with DO/DA/BDA Elements.
|
|
10
|
-
* @returns The last element initialized element or LN(0) if nothing is initialized. This Element can be used to
|
|
11
|
-
* add the new element to. And the list of Template Elements that still need to be initialized.
|
|
12
|
-
*/
|
|
13
|
-
export function determineUninitializedStructure(parentElement, templateStructure) {
|
|
14
|
-
const templateElement = templateStructure.shift();
|
|
15
|
-
if (templateStructure.length > 0) {
|
|
16
|
-
// If there are still Template Elements we didn't reach the DAI Element, so continue checking if any DOI/SDI
|
|
17
|
-
// Element is found with the same name.
|
|
18
|
-
let instanceElement;
|
|
19
|
-
// DO Elements are initialized as DOI, others as SDI.
|
|
20
|
-
if (templateElement.tagName === 'DO') {
|
|
21
|
-
instanceElement = parentElement.querySelector(`DOI[name="${templateElement.getAttribute('name')}"]`);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
instanceElement = parentElement.querySelector(`SDI[name="${templateElement.getAttribute('name')}"]`);
|
|
25
|
-
}
|
|
26
|
-
if (instanceElement) {
|
|
27
|
-
// If instance element found we will search one level lower again.
|
|
28
|
-
// So the parent will become the instance element and the list is 1 smaller.
|
|
29
|
-
return determineUninitializedStructure(instanceElement, templateStructure);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// No instance element found, so the element and all other elements still need to be
|
|
33
|
-
// initialized and returned.
|
|
34
|
-
templateStructure.unshift(templateElement);
|
|
35
|
-
return [parentElement, templateStructure];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
// The last template element in the list, so this should be the DA Element that only needs
|
|
40
|
-
// to be initialized.
|
|
41
|
-
return [parentElement, [templateElement]];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Create a new instance structure defined by the array of template elements passed.
|
|
46
|
-
*
|
|
47
|
-
* @param uninitializedTemplateStructure - The Array of Template Elements for which new instance elements need to be
|
|
48
|
-
* created.
|
|
49
|
-
* @returns The Element created from the last Template Element in the Array.
|
|
50
|
-
*/
|
|
51
|
-
export function initializeElements(uninitializedTemplateStructure) {
|
|
52
|
-
const element = uninitializedTemplateStructure.shift();
|
|
53
|
-
if (uninitializedTemplateStructure.length > 0) {
|
|
54
|
-
// If there are more template elements left this will become a DOI or SDI Element.
|
|
55
|
-
let newElement;
|
|
56
|
-
// Depending on the level create a DOI or SDI Element.
|
|
57
|
-
if (element.tagName === 'DO') {
|
|
58
|
-
newElement = element.ownerDocument.createElementNS(SCL_NAMESPACE, 'DOI');
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
newElement = element.ownerDocument.createElementNS(SCL_NAMESPACE, 'SDI');
|
|
62
|
-
}
|
|
63
|
-
newElement.setAttribute('name', element?.getAttribute('name') ?? '');
|
|
64
|
-
// Create an element from the next one (last) from the shortened array.
|
|
65
|
-
const childElement = initializeElements(uninitializedTemplateStructure);
|
|
66
|
-
newElement.append(childElement);
|
|
67
|
-
return newElement;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
// Create Val Element
|
|
71
|
-
const newValElement = element.ownerDocument.createElementNS(SCL_NAMESPACE, 'Val');
|
|
72
|
-
const valElement = element.querySelector('Val');
|
|
73
|
-
if (valElement) {
|
|
74
|
-
newValElement.textContent = valElement.textContent;
|
|
75
|
-
}
|
|
76
|
-
// Create DAI Element
|
|
77
|
-
const daiElement = element.ownerDocument.createElementNS(SCL_NAMESPACE, 'DAI');
|
|
78
|
-
daiElement.setAttribute('name', element?.getAttribute('name') ?? '');
|
|
79
|
-
daiElement.append(newValElement);
|
|
80
|
-
return daiElement;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Use the path configuration of a Common Data Class to search for all DO/SDO/DA/BDA Elements to create
|
|
85
|
-
* a structure for which DOI/SDI/DAI Elements should be created later. Null will be returned when an invalid
|
|
86
|
-
* Template Structure is described by the path.
|
|
87
|
-
*
|
|
88
|
-
* @param lnElement - The LN Element to use for searching the starting DO Element.
|
|
89
|
-
* @param path - The (S)DO/(B)DA Elements to find in the template structure.
|
|
90
|
-
* @returns List of Elements starting with the DO Element followed by one or more SDO or (B)DA Elements describing the structure.
|
|
91
|
-
*/
|
|
92
|
-
export function createTemplateStructure(lnElement, path) {
|
|
93
|
-
let templateStructure = [];
|
|
94
|
-
const doc = lnElement.ownerDocument;
|
|
95
|
-
const lnType = lnElement.getAttribute('lnType') ?? '';
|
|
96
|
-
let typeElement = doc.querySelector(`LNodeType[id="${lnType}"]`);
|
|
97
|
-
path.forEach(name => {
|
|
98
|
-
// There should be a DOType or DAType set for the current element in the list.
|
|
99
|
-
if (!typeElement) {
|
|
100
|
-
templateStructure = null;
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const dataElement = typeElement.querySelector(`:scope > DO[name="${name}"], :scope > SDO[name="${name}"], :scope > DA[name="${name}"], :scope > BDA[name="${name}"]`);
|
|
104
|
-
// If there is no (S)DO/(B)DA Element found the structure is incorrect, so just stop.
|
|
105
|
-
if (dataElement === null) {
|
|
106
|
-
templateStructure = null;
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
templateStructure.push(dataElement);
|
|
110
|
-
if (dataElement.tagName === 'DO' || dataElement.tagName === 'SDO') {
|
|
111
|
-
const type = dataElement.getAttribute('type') ?? '';
|
|
112
|
-
typeElement = doc.querySelector(`DataTypeTemplates > DOType[id="${type}"]`);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
const bType = dataElement.getAttribute('bType') ?? '';
|
|
116
|
-
if (bType === 'Struct') {
|
|
117
|
-
const type = dataElement.getAttribute('type') ?? '';
|
|
118
|
-
typeElement = doc.querySelector(`DataTypeTemplates > DAType[id="${type}"]`);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
typeElement = null;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return templateStructure;
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=dai.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dai.js","sourceRoot":"","sources":["../../src/foundation/dai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,+BAA+B,CAC7C,aAAsB,EACtB,iBAA4B;IAE5B,MAAM,eAAe,GAAG,iBAAiB,CAAC,KAAK,EAAE,CAAC;IAClD,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;QAChC,4GAA4G;QAC5G,uCAAuC;QACvC,IAAI,eAA+B,CAAC;QACpC,qDAAqD;QACrD,IAAI,eAAgB,CAAC,OAAO,KAAK,IAAI,EAAE;YACrC,eAAe,GAAG,aAAa,CAAC,aAAa,CAC3C,aAAa,eAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CACvD,CAAC;SACH;aAAM;YACL,eAAe,GAAG,aAAa,CAAC,aAAa,CAC3C,aAAa,eAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CACvD,CAAC;SACH;QAED,IAAI,eAAe,EAAE;YACnB,kEAAkE;YAClE,4EAA4E;YAC5E,OAAO,+BAA+B,CACp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ACpD,WAAW,GAAG,GAAG,CAAC,aAAa,CAC7B,kCAAkC,IAAI,IAAI,CAC3C,CAAC;SACH;aAAM;YACL,MAAM,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACtD,IAAI,KAAK,KAAK,QAAQ,EAAE;gBACtB,MAAM,IAAI,GAAG,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACpD,WAAW,GAAG,GAAG,CAAC,aAAa,CAC7B,kCAAkC,IAAI,IAAI,CAC3C,CAAC;aACH;iBAAM;gBACL,WAAW,GAAG,IAAI,CAAC;aACpB;SACF;IACH,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["import { SCL_NAMESPACE } from '../schemas.js';\n\n/**\n * Determine which part of the Template Structure still needs to be initialized.\n * With the first call the parent will normally be the LN(0) Element to start from.\n * It will use the list to pop the first element and look if there is a DOI/SDI/DAI\n * Element available with the same name.\n *\n * @param parentElement - The element to search from for a DOI/SDI/DAI\n * @param templateStructure - The templates structure with DO/DA/BDA Elements.\n * @returns The last element initialized element or LN(0) if nothing is initialized. This Element can be used to\n * add the new element to. And the list of Template Elements that still need to be initialized.\n */\nexport function determineUninitializedStructure(\n parentElement: Element,\n templateStructure: Element[]\n): [Element, Element[]] {\n const templateElement = templateStructure.shift();\n if (templateStructure.length > 0) {\n // If there are still Template Elements we didn't reach the DAI Element, so continue checking if any DOI/SDI\n // Element is found with the same name.\n let instanceElement: Element | null;\n // DO Elements are initialized as DOI, others as SDI.\n if (templateElement!.tagName === 'DO') {\n instanceElement = parentElement.querySelector(\n `DOI[name=\"${templateElement!.getAttribute('name')}\"]`\n );\n } else {\n instanceElement = parentElement.querySelector(\n `SDI[name=\"${templateElement!.getAttribute('name')}\"]`\n );\n }\n\n if (instanceElement) {\n // If instance element found we will search one level lower again.\n // So the parent will become the instance element and the list is 1 smaller.\n return determineUninitializedStructure(\n instanceElement,\n templateStructure\n );\n } else {\n // No instance element found, so the element and all other elements still need to be\n // initialized and returned.\n templateStructure.unshift(templateElement!);\n return [parentElement, templateStructure];\n }\n } else {\n // The last template element in the list, so this should be the DA Element that only needs\n // to be initialized.\n return [parentElement, [templateElement!]];\n }\n}\n\n/**\n * Create a new instance structure defined by the array of template elements passed.\n *\n * @param uninitializedTemplateStructure - The Array of Template Elements for which new instance elements need to be\n * created.\n * @returns The Element created from the last Template Element in the Array.\n */\nexport function initializeElements(\n uninitializedTemplateStructure: Element[]\n): Element {\n const element = uninitializedTemplateStructure.shift();\n if (uninitializedTemplateStructure.length > 0) {\n // If there are more template elements left this will become a DOI or SDI Element.\n let newElement;\n // Depending on the level create a DOI or SDI Element.\n if (element!.tagName === 'DO') {\n newElement = element!.ownerDocument.createElementNS(SCL_NAMESPACE, 'DOI');\n } else {\n newElement = element!.ownerDocument.createElementNS(SCL_NAMESPACE, 'SDI');\n }\n newElement.setAttribute('name', element?.getAttribute('name') ?? '');\n\n // Create an element from the next one (last) from the shortened array.\n const childElement = initializeElements(uninitializedTemplateStructure);\n newElement.append(childElement);\n\n return newElement;\n } else {\n // Create Val Element\n const newValElement = element!.ownerDocument.createElementNS(\n SCL_NAMESPACE,\n 'Val'\n );\n const valElement = element!.querySelector('Val');\n if (valElement) {\n newValElement.textContent = valElement.textContent;\n }\n\n // Create DAI Element\n const daiElement = element!.ownerDocument.createElementNS(\n SCL_NAMESPACE,\n 'DAI'\n );\n daiElement.setAttribute('name', element?.getAttribute('name') ?? '');\n daiElement.append(newValElement);\n return daiElement;\n }\n}\n\n/**\n * Use the path configuration of a Common Data Class to search for all DO/SDO/DA/BDA Elements to create\n * a structure for which DOI/SDI/DAI Elements should be created later. Null will be returned when an invalid\n * Template Structure is described by the path.\n *\n * @param lnElement - The LN Element to use for searching the starting DO Element.\n * @param path - The (S)DO/(B)DA Elements to find in the template structure.\n * @returns List of Elements starting with the DO Element followed by one or more SDO or (B)DA Elements describing the structure.\n */\nexport function createTemplateStructure(\n lnElement: Element,\n path: string[]\n): Element[] | null {\n let templateStructure: Element[] | null = [];\n\n const doc = lnElement.ownerDocument;\n const lnType = lnElement.getAttribute('lnType') ?? '';\n let typeElement = doc.querySelector(`LNodeType[id=\"${lnType}\"]`);\n path.forEach(name => {\n // There should be a DOType or DAType set for the current element in the list.\n if (!typeElement) {\n templateStructure = null;\n return;\n }\n const dataElement = typeElement.querySelector(\n `:scope > DO[name=\"${name}\"], :scope > SDO[name=\"${name}\"], :scope > DA[name=\"${name}\"], :scope > BDA[name=\"${name}\"]`\n );\n // If there is no (S)DO/(B)DA Element found the structure is incorrect, so just stop.\n if (dataElement === null) {\n templateStructure = null;\n return;\n }\n templateStructure!.push(dataElement);\n\n if (dataElement.tagName === 'DO' || dataElement.tagName === 'SDO') {\n const type = dataElement.getAttribute('type') ?? '';\n typeElement = doc.querySelector(\n `DataTypeTemplates > DOType[id=\"${type}\"]`\n );\n } else {\n const bType = dataElement.getAttribute('bType') ?? '';\n if (bType === 'Struct') {\n const type = dataElement.getAttribute('type') ?? '';\n typeElement = doc.querySelector(\n `DataTypeTemplates > DAType[id=\"${type}\"]`\n );\n } else {\n typeElement = null;\n }\n }\n });\n return templateStructure;\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param doc - project xml document
|
|
3
|
-
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
4
|
-
* @returns a function generating increasing unused `MAC-Address` within `doc` on subsequent invocations
|
|
5
|
-
*/
|
|
6
|
-
export declare function mACAddressGenerator(doc: XMLDocument, serviceType: 'SMV' | 'GSE'): () => string;
|
|
7
|
-
/**
|
|
8
|
-
* @param doc - project xml document
|
|
9
|
-
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
10
|
-
* @param type1A - whether the GOOSE is a Trip GOOSE resulting in different APPID range - default false
|
|
11
|
-
* @returns a function generating increasing unused `APPID` within `doc` on subsequent invocations
|
|
12
|
-
*/
|
|
13
|
-
export declare function appIdGenerator(doc: XMLDocument, serviceType: 'SMV' | 'GSE', type1A?: boolean): () => string;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const maxGseMacAddress = 0x010ccd0101ff;
|
|
2
|
-
const minGseMacAddress = 0x010ccd010000;
|
|
3
|
-
const maxSmvMacAddress = 0x010ccd0401ff;
|
|
4
|
-
const minSmvMacAddress = 0x010ccd040000;
|
|
5
|
-
function convertToMac(mac) {
|
|
6
|
-
const str = 0 + mac.toString(16).toUpperCase();
|
|
7
|
-
const arr = str.match(/.{1,2}/g);
|
|
8
|
-
return arr?.join('-');
|
|
9
|
-
}
|
|
10
|
-
const gseMacRange = Array(maxGseMacAddress - minGseMacAddress)
|
|
11
|
-
.fill(1)
|
|
12
|
-
.map((_, i) => convertToMac(minGseMacAddress + i));
|
|
13
|
-
const smvMacRange = Array(maxSmvMacAddress - minSmvMacAddress)
|
|
14
|
-
.fill(1)
|
|
15
|
-
.map((_, i) => convertToMac(minSmvMacAddress + i));
|
|
16
|
-
/**
|
|
17
|
-
* @param doc - project xml document
|
|
18
|
-
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
19
|
-
* @returns a function generating increasing unused `MAC-Address` within `doc` on subsequent invocations
|
|
20
|
-
*/
|
|
21
|
-
export function mACAddressGenerator(doc, serviceType) {
|
|
22
|
-
const macs = new Set(Array.from(doc.querySelectorAll(`${serviceType} > Address > P[type="MAC-Address"]`)).map(macs => macs.textContent));
|
|
23
|
-
const range = serviceType === 'SMV' ? smvMacRange : gseMacRange;
|
|
24
|
-
return () => {
|
|
25
|
-
const uniqueMAC = range.find(mac => !macs.has(mac));
|
|
26
|
-
if (uniqueMAC)
|
|
27
|
-
macs.add(uniqueMAC);
|
|
28
|
-
return uniqueMAC ?? '';
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
const maxGseAppId = 0x3fff;
|
|
32
|
-
const minGseAppId = 0x0000;
|
|
33
|
-
// APPID range for Type1A(Trip) GOOSE acc. IEC 61850-8-1
|
|
34
|
-
const maxGseTripAppId = 0xbfff;
|
|
35
|
-
const minGseTripAppId = 0x8000;
|
|
36
|
-
const maxSmvAppId = 0x7fff;
|
|
37
|
-
const minSmvAppId = 0x4000;
|
|
38
|
-
const gseAppIdRange = Array(maxGseAppId - minGseAppId)
|
|
39
|
-
.fill(1)
|
|
40
|
-
.map((_, i) => (minGseAppId + i).toString(16).toUpperCase().padStart(4, '0'));
|
|
41
|
-
const gseTripAppIdRange = Array(maxGseTripAppId - minGseTripAppId)
|
|
42
|
-
.fill(1)
|
|
43
|
-
.map((_, i) => (minGseTripAppId + i).toString(16).toUpperCase().padStart(4, '0'));
|
|
44
|
-
const smvAppIdRange = Array(maxSmvAppId - minSmvAppId)
|
|
45
|
-
.fill(1)
|
|
46
|
-
.map((_, i) => (minSmvAppId + i).toString(16).toUpperCase().padStart(4, '0'));
|
|
47
|
-
/**
|
|
48
|
-
* @param doc - project xml document
|
|
49
|
-
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
50
|
-
* @param type1A - whether the GOOSE is a Trip GOOSE resulting in different APPID range - default false
|
|
51
|
-
* @returns a function generating increasing unused `APPID` within `doc` on subsequent invocations
|
|
52
|
-
*/
|
|
53
|
-
export function appIdGenerator(doc, serviceType, type1A = false) {
|
|
54
|
-
const appIds = new Set(Array.from(doc.querySelectorAll(`${serviceType} > Address > P[type="APPID"]`)).map(appId => appId.textContent));
|
|
55
|
-
const range = serviceType === 'SMV'
|
|
56
|
-
? smvAppIdRange
|
|
57
|
-
: type1A
|
|
58
|
-
? gseTripAppIdRange
|
|
59
|
-
: gseAppIdRange;
|
|
60
|
-
return () => {
|
|
61
|
-
const uniqueAppId = range.find(appId => !appIds.has(appId));
|
|
62
|
-
if (uniqueAppId)
|
|
63
|
-
appIds.add(uniqueAppId);
|
|
64
|
-
return uniqueAppId ?? '';
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=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AAI,CAAC,CAAC,CAAC;KACP,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,GAAgB,EAChB,WAA0B,EAC1B,MAAM,GAAG,KAAK;IAEd,MAAM,MAAM,GAAG,IAAI,GAAG,CACpB,KAAK,CAAC,IAAI,CACR,GAAG,CAAC,gBAAgB,CAAC,GAAG,WAAW,8BAA8B,CAAC,CACnE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAY,CAAC,CACnC,CAAC;IAEF,MAAM,KAAK,GACT,WAAW,KAAK,KAAK;QACnB,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,aAAa,CAAC;IAEpB,OAAO,GAAG,EAAE;QACV,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5D,IAAI,WAAW;YAAE,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzC,OAAO,WAAW,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["const maxGseMacAddress = 0x010ccd0101ff;\nconst minGseMacAddress = 0x010ccd010000;\n\nconst maxSmvMacAddress = 0x010ccd0401ff;\nconst minSmvMacAddress = 0x010ccd040000;\n\nfunction convertToMac(mac: number): string {\n const str = 0 + mac.toString(16).toUpperCase();\n const arr = str.match(/.{1,2}/g)!;\n return arr?.join('-');\n}\n\nconst gseMacRange = Array(maxGseMacAddress - minGseMacAddress)\n .fill(1)\n .map((_, i) => convertToMac(minGseMacAddress + i));\n\nconst smvMacRange = Array(maxSmvMacAddress - minSmvMacAddress)\n .fill(1)\n .map((_, i) => convertToMac(minSmvMacAddress + i));\n\n/**\n * @param doc - project xml document\n * @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)\n * @returns a function generating increasing unused `MAC-Address` within `doc` on subsequent invocations\n */\nexport function mACAddressGenerator(\n doc: XMLDocument,\n serviceType: 'SMV' | 'GSE'\n): () => string {\n const macs = new Set(\n Array.from(\n doc.querySelectorAll(`${serviceType} > Address > P[type=\"MAC-Address\"]`)\n ).map(macs => macs.textContent!)\n );\n\n const range = serviceType === 'SMV' ? smvMacRange : gseMacRange;\n\n return () => {\n const uniqueMAC = range.find(mac => !macs.has(mac));\n if (uniqueMAC) macs.add(uniqueMAC);\n return uniqueMAC ?? '';\n };\n}\n\nconst maxGseAppId = 0x3fff;\nconst minGseAppId = 0x0000;\n\n// APPID range for Type1A(Trip) GOOSE acc. IEC 61850-8-1\nconst maxGseTripAppId = 0xbfff;\nconst minGseTripAppId = 0x8000;\n\nconst maxSmvAppId = 0x7fff;\nconst minSmvAppId = 0x4000;\n\nconst gseAppIdRange = Array(maxGseAppId - minGseAppId)\n .fill(1)\n .map((_, i) => (minGseAppId + i).toString(16).toUpperCase().padStart(4, '0'));\n\nconst gseTripAppIdRange = Array(maxGseTripAppId - minGseTripAppId)\n .fill(1)\n .map((_, i) =>\n (minGseTripAppId + i).toString(16).toUpperCase().padStart(4, '0')\n );\n\nconst smvAppIdRange = Array(maxSmvAppId - minSmvAppId)\n .fill(1)\n .map((_, i) => (minSmvAppId + i).toString(16).toUpperCase().padStart(4, '0'));\n\n/**\n * @param doc - project xml document\n * @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)\n * @param type1A - whether the GOOSE is a Trip GOOSE resulting in different APPID range - default false\n * @returns a function generating increasing unused `APPID` within `doc` on subsequent invocations\n */\nexport function appIdGenerator(\n doc: XMLDocument,\n serviceType: 'SMV' | 'GSE',\n type1A = false\n): () => string {\n const appIds = new Set(\n Array.from(\n doc.querySelectorAll(`${serviceType} > Address > P[type=\"APPID\"]`)\n ).map(appId => appId.textContent!)\n );\n\n const range =\n serviceType === 'SMV'\n ? smvAppIdRange\n : type1A\n ? gseTripAppIdRange\n : gseAppIdRange;\n\n return () => {\n const uniqueAppId = range.find(appId => !appIds.has(appId));\n if (uniqueAppId) appIds.add(uniqueAppId);\n return uniqueAppId ?? '';\n };\n}\n"]}
|
package/dist/foundation/ied.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Delete } from '@openscd/core/foundation/deprecated/editor.js';
|
|
2
|
-
/**
|
|
3
|
-
* Get all the FCDA attributes containing values from a specific element.
|
|
4
|
-
*
|
|
5
|
-
* @param elementContainingFcdaReferences - The element to use
|
|
6
|
-
* @returns FCDA references
|
|
7
|
-
*/
|
|
8
|
-
export declare function getFcdaReferences(elementContainingFcdaReferences: Element): string;
|
|
9
|
-
/**
|
|
10
|
-
* Get all the Control attributes containing values from a specific element.
|
|
11
|
-
*
|
|
12
|
-
* @param extRef - The element to use
|
|
13
|
-
* @returns Control references
|
|
14
|
-
*/
|
|
15
|
-
export declare function getControlReferences(extRef: Element): string;
|
|
16
|
-
/**
|
|
17
|
-
* Creating Delete actions in case Inputs elements are empty.
|
|
18
|
-
*
|
|
19
|
-
* @param extRefDeleteActions - All Delete actions for ExtRefs.
|
|
20
|
-
* @returns Possible delete actions for empty Inputs elements.
|
|
21
|
-
*/
|
|
22
|
-
export declare function emptyInputsDeleteActions(extRefDeleteActions: Delete[]): Delete[];
|
package/dist/foundation/ied.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { find, identity } from '../foundation.js';
|
|
2
|
-
/**
|
|
3
|
-
* All available FCDA references that are used to link ExtRefs.
|
|
4
|
-
*/
|
|
5
|
-
const fcdaReferences = [
|
|
6
|
-
'ldInst',
|
|
7
|
-
'lnClass',
|
|
8
|
-
'lnInst',
|
|
9
|
-
'prefix',
|
|
10
|
-
'doName',
|
|
11
|
-
'daName',
|
|
12
|
-
];
|
|
13
|
-
/**
|
|
14
|
-
* Get all the FCDA attributes containing values from a specific element.
|
|
15
|
-
*
|
|
16
|
-
* @param elementContainingFcdaReferences - The element to use
|
|
17
|
-
* @returns FCDA references
|
|
18
|
-
*/
|
|
19
|
-
export function getFcdaReferences(elementContainingFcdaReferences) {
|
|
20
|
-
return fcdaReferences
|
|
21
|
-
.map(fcdaRef => elementContainingFcdaReferences.getAttribute(fcdaRef)
|
|
22
|
-
? `[${fcdaRef}="${elementContainingFcdaReferences.getAttribute(fcdaRef)}"]`
|
|
23
|
-
: '')
|
|
24
|
-
.join('');
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* All available Control references that are used to link ExtRefs.
|
|
28
|
-
*/
|
|
29
|
-
const controlReferences = ['srcLDInst', 'srcLNClass', 'srcLNInst', 'srcCBName'];
|
|
30
|
-
/**
|
|
31
|
-
* Get all the Control attributes containing values from a specific element.
|
|
32
|
-
*
|
|
33
|
-
* @param extRef - The element to use
|
|
34
|
-
* @returns Control references
|
|
35
|
-
*/
|
|
36
|
-
export function getControlReferences(extRef) {
|
|
37
|
-
return controlReferences
|
|
38
|
-
.map(controlRef => extRef.getAttribute(controlRef)
|
|
39
|
-
? `[${controlRef}="${extRef.getAttribute(controlRef)}"]`
|
|
40
|
-
: '')
|
|
41
|
-
.join('');
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Creating Delete actions in case Inputs elements are empty.
|
|
45
|
-
*
|
|
46
|
-
* @param extRefDeleteActions - All Delete actions for ExtRefs.
|
|
47
|
-
* @returns Possible delete actions for empty Inputs elements.
|
|
48
|
-
*/
|
|
49
|
-
export function emptyInputsDeleteActions(extRefDeleteActions) {
|
|
50
|
-
if (!extRefDeleteActions.length)
|
|
51
|
-
return [];
|
|
52
|
-
const inputDeleteActions = [];
|
|
53
|
-
const inputsMap = {};
|
|
54
|
-
for (const extRefDeleteAction of extRefDeleteActions) {
|
|
55
|
-
const extRef = extRefDeleteAction.old.element;
|
|
56
|
-
const inputsElement = extRefDeleteAction.old.parent;
|
|
57
|
-
const id = identity(inputsElement);
|
|
58
|
-
if (!inputsMap[id])
|
|
59
|
-
inputsMap[id] = inputsElement.cloneNode(true);
|
|
60
|
-
// Search the ExtRef in the Cloned Inputs Element
|
|
61
|
-
const linkedExtRef = inputsMap[id].querySelector(`ExtRef${extRef.getAttribute('iedName')
|
|
62
|
-
? `[iedName="${extRef.getAttribute('iedName')}"]`
|
|
63
|
-
: ''}${getFcdaReferences(extRef)}${extRef.getAttribute('serviceType')
|
|
64
|
-
? `[serviceType="${extRef.getAttribute('serviceType')}"]`
|
|
65
|
-
: ''}${getControlReferences(extRef)}`);
|
|
66
|
-
// And if found remove it as child from the Cloned Inputs Element
|
|
67
|
-
if (linkedExtRef)
|
|
68
|
-
inputsMap[id].removeChild(linkedExtRef);
|
|
69
|
-
}
|
|
70
|
-
// Create delete action for each empty inputs
|
|
71
|
-
Object.entries(inputsMap).forEach(([key, value]) => {
|
|
72
|
-
if (value.children.length == 0) {
|
|
73
|
-
const doc = extRefDeleteActions[0].old.parent.ownerDocument;
|
|
74
|
-
const inputs = find(doc, 'Inputs', key);
|
|
75
|
-
if (inputs && inputs.parentElement) {
|
|
76
|
-
inputDeleteActions.push({
|
|
77
|
-
old: { parent: inputs.parentElement, element: inputs },
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
return inputDeleteActions;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=ied.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ied.js","sourceRoot":"","sources":["../../src/foundation/ied.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;GAEG;AACH,MAAM,cAAc,GAAG;IACrB,QAAQ;IACR,SAAS;IACT,QAAQ;IACR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Content":["import { find, identity } from '../foundation.js';\nimport { Delete } from '@openscd/core/foundation/deprecated/editor.js';\n\n/**\n * All available FCDA references that are used to link ExtRefs.\n */\nconst fcdaReferences = [\n 'ldInst',\n 'lnClass',\n 'lnInst',\n 'prefix',\n 'doName',\n 'daName',\n];\n\n/**\n * Get all the FCDA attributes containing values from a specific element.\n *\n * @param elementContainingFcdaReferences - The element to use\n * @returns FCDA references\n */\nexport function getFcdaReferences(\n elementContainingFcdaReferences: Element\n): string {\n return fcdaReferences\n .map(fcdaRef =>\n elementContainingFcdaReferences.getAttribute(fcdaRef)\n ? `[${fcdaRef}=\"${elementContainingFcdaReferences.getAttribute(\n fcdaRef\n )}\"]`\n : ''\n )\n .join('');\n}\n\n/**\n * All available Control references that are used to link ExtRefs.\n */\nconst controlReferences = ['srcLDInst', 'srcLNClass', 'srcLNInst', 'srcCBName'];\n\n/**\n * Get all the Control attributes containing values from a specific element.\n *\n * @param extRef - The element to use\n * @returns Control references\n */\nexport function getControlReferences(extRef: Element): string {\n return controlReferences\n .map(controlRef =>\n extRef.getAttribute(controlRef)\n ? `[${controlRef}=\"${extRef.getAttribute(controlRef)}\"]`\n : ''\n )\n .join('');\n}\n\n/**\n * Creating Delete actions in case Inputs elements are empty.\n *\n * @param extRefDeleteActions - All Delete actions for ExtRefs.\n * @returns Possible delete actions for empty Inputs elements.\n */\nexport function emptyInputsDeleteActions(\n extRefDeleteActions: Delete[]\n): Delete[] {\n if (!extRefDeleteActions.length) return [];\n\n const inputDeleteActions: Delete[] = [];\n const inputsMap: Record<string, Element> = {};\n\n for (const extRefDeleteAction of extRefDeleteActions) {\n const extRef = <Element>extRefDeleteAction.old.element;\n const inputsElement = <Element>extRefDeleteAction.old.parent;\n\n const id = identity(inputsElement);\n if (!inputsMap[id]) inputsMap[id] = <Element>inputsElement.cloneNode(true);\n\n // Search the ExtRef in the Cloned Inputs Element\n const linkedExtRef = inputsMap[id].querySelector(\n `ExtRef${\n extRef.getAttribute('iedName')\n ? `[iedName=\"${extRef.getAttribute('iedName')}\"]`\n : ''\n }${getFcdaReferences(extRef)}${\n extRef.getAttribute('serviceType')\n ? `[serviceType=\"${extRef.getAttribute('serviceType')}\"]`\n : ''\n }${getControlReferences(extRef)}`\n );\n // And if found remove it as child from the Cloned Inputs Element\n if (linkedExtRef) inputsMap[id].removeChild(linkedExtRef);\n }\n\n // Create delete action for each empty inputs\n Object.entries(inputsMap).forEach(([key, value]) => {\n if (value.children.length! == 0) {\n const doc = extRefDeleteActions[0].old.parent.ownerDocument!;\n const inputs = find(doc, 'Inputs', key);\n\n if (inputs && inputs.parentElement) {\n inputDeleteActions.push({\n old: { parent: inputs.parentElement, element: inputs },\n });\n }\n }\n });\n\n return inputDeleteActions;\n}\n"]}
|
package/dist/foundation/nsd.d.ts
DELETED
package/dist/foundation/nsd.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const iec6185074 = fetch('public/xml/IEC_61850-7-4_2007B5.nsd')
|
|
2
|
-
.then(response => response.text())
|
|
3
|
-
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
|
|
4
|
-
export const iec6185073 = fetch('public/xml/IEC_61850-7-3_2007B5.nsd')
|
|
5
|
-
.then(response => response.text())
|
|
6
|
-
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
|
|
7
|
-
export const iec6185072 = fetch('public/xml/IEC_61850-7-2_2007B5.nsd')
|
|
8
|
-
.then(response => response.text())
|
|
9
|
-
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
|
|
10
|
-
export const iec6185081 = fetch('public/xml/IEC_61850-8-1_2003A2.nsd')
|
|
11
|
-
.then(response => response.text())
|
|
12
|
-
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
|
|
13
|
-
//# sourceMappingURL=nsd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nsd.js","sourceRoot":"","sources":["../../src/foundation/nsd.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,qCAAqC,CAAC;KACnE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,qCAAqC,CAAC;KACnE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,qCAAqC,CAAC;KACnE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,qCAAqC,CAAC;KACnE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC","sourcesContent":["export const iec6185074 = fetch('public/xml/IEC_61850-7-4_2007B5.nsd')\n .then(response => response.text())\n .then(str => new DOMParser().parseFromString(str, 'application/xml'));\n\nexport const iec6185073 = fetch('public/xml/IEC_61850-7-3_2007B5.nsd')\n .then(response => response.text())\n .then(str => new DOMParser().parseFromString(str, 'application/xml'));\n\nexport const iec6185072 = fetch('public/xml/IEC_61850-7-2_2007B5.nsd')\n .then(response => response.text())\n .then(str => new DOMParser().parseFromString(str, 'application/xml'));\n\nexport const iec6185081 = fetch('public/xml/IEC_61850-8-1_2003A2.nsd')\n .then(response => response.text())\n .then(str => new DOMParser().parseFromString(str, 'application/xml'));\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface Nsdoc {
|
|
2
|
-
nsdoc72?: XMLDocument;
|
|
3
|
-
nsdoc73?: XMLDocument;
|
|
4
|
-
nsdoc74?: XMLDocument;
|
|
5
|
-
nsdoc81?: XMLDocument;
|
|
6
|
-
getDataDescription: (element: Element, ancestors?: Element[]) => {
|
|
7
|
-
label: string;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Initialize the full Nsdoc object.
|
|
12
|
-
* @returns A fully initialized Nsdoc object for wizards/editors to use.
|
|
13
|
-
*/
|
|
14
|
-
export declare function initializeNsdoc(): Nsdoc;
|
package/dist/foundation/nsdoc.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { iec6185072, iec6185073, iec6185074, iec6185081 } from "./nsd.js";
|
|
2
|
-
const [nsd72, nsd73, nsd74, nsd81] = await Promise.all([iec6185072, iec6185073, iec6185074, iec6185081]);
|
|
3
|
-
let nsdoc72 = undefined;
|
|
4
|
-
let nsdoc73 = undefined;
|
|
5
|
-
let nsdoc74 = undefined;
|
|
6
|
-
let nsdoc81 = undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Initialize the full Nsdoc object.
|
|
9
|
-
* @returns A fully initialized Nsdoc object for wizards/editors to use.
|
|
10
|
-
*/
|
|
11
|
-
export function initializeNsdoc() {
|
|
12
|
-
[nsdoc72, nsdoc73, nsdoc74, nsdoc81] = [
|
|
13
|
-
localStorage.getItem('IEC 61850-7-2') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-7-2'), 'application/xml') : undefined,
|
|
14
|
-
localStorage.getItem('IEC 61850-7-3') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-7-3'), 'application/xml') : undefined,
|
|
15
|
-
localStorage.getItem('IEC 61850-7-4') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-7-4'), 'application/xml') : undefined,
|
|
16
|
-
localStorage.getItem('IEC 61850-8-1') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-8-1'), 'application/xml') : undefined
|
|
17
|
-
];
|
|
18
|
-
const iedElementTagNames = ['LN', 'LN0', 'DO', 'SDO', 'DOI', 'DA', 'BDA', 'DAI'];
|
|
19
|
-
const getDataDescriptions = {
|
|
20
|
-
LN: {
|
|
21
|
-
getDataDescription: getLNDataDescription
|
|
22
|
-
},
|
|
23
|
-
LN0: {
|
|
24
|
-
getDataDescription: getLNDataDescription
|
|
25
|
-
},
|
|
26
|
-
DO: {
|
|
27
|
-
getDataDescription: getDODataDescription
|
|
28
|
-
},
|
|
29
|
-
SDO: {
|
|
30
|
-
getDataDescription: getSDODataDescription
|
|
31
|
-
},
|
|
32
|
-
DOI: {
|
|
33
|
-
getDataDescription: getDODataDescription
|
|
34
|
-
},
|
|
35
|
-
DA: {
|
|
36
|
-
getDataDescription: getDADataDescription
|
|
37
|
-
},
|
|
38
|
-
BDA: {
|
|
39
|
-
getDataDescription: getBDADataDescription
|
|
40
|
-
},
|
|
41
|
-
DAI: {
|
|
42
|
-
getDataDescription: getDADataDescription
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Getting data descriptions for LN(0) elements out of the IEC 61850-7-4 .nsdoc file.
|
|
47
|
-
* @param element - The element to use for searching the LN description.
|
|
48
|
-
* @returns Documentation from the .nsdoc file for this LN(0) file, or the lnClass attribute in case no description can be found.
|
|
49
|
-
*/
|
|
50
|
-
function getLNDataDescription(element) {
|
|
51
|
-
const lnClassAttribute = element.getAttribute('lnClass');
|
|
52
|
-
const lnClass = nsd74.querySelector(`NS > LNClasses > LNClass[name="${lnClassAttribute}"]`);
|
|
53
|
-
const lnClassDescription = getNsdocDocumentation(nsdoc74, lnClass?.getAttribute('titleID'));
|
|
54
|
-
return {
|
|
55
|
-
label: lnClassDescription ? lnClassDescription + ' (' + lnClassAttribute + ')' : lnClassAttribute
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Getting data descriptions for DO(I) elements out of the IEC 61850-7-4 .nsdoc file.
|
|
60
|
-
* @param element - The element to use for searching the DO description.
|
|
61
|
-
* @returns Documentation from the .nsdoc file for this DO(I) file, or the name attribute in case no description can be found.
|
|
62
|
-
*/
|
|
63
|
-
function getDODataDescription(element) {
|
|
64
|
-
const doName = element.getAttribute('name');
|
|
65
|
-
const lnClass = nsd74.querySelector(`NS > LNClasses > LNClass[name="${element.parentElement?.getAttribute('lnClass')}"]`);
|
|
66
|
-
const base = lnClass?.getAttribute('base');
|
|
67
|
-
const dObject = lnClass?.querySelector(`DataObject[name="${doName}"]`) ?? getInheritedDataObject(base, doName);
|
|
68
|
-
return {
|
|
69
|
-
label: getNsdocDocumentation(nsdoc74, dObject?.getAttribute('descID')) ?? doName
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Getting data descriptions for SDO elements out of the IEC 61850-7-3 .nsdoc file.
|
|
74
|
-
* @param element - The element to use for searching the SDO description.
|
|
75
|
-
* @returns Documentation from the .nsdoc file for this SDO element, or the name attribute in case no description can be found.
|
|
76
|
-
*/
|
|
77
|
-
function getSDODataDescription(element) {
|
|
78
|
-
const sdoName = element.getAttribute('name');
|
|
79
|
-
const subDataObject = nsd73.querySelector(`CDCs > CDC[name="${element.parentElement?.getAttribute('cdc')}"] > SubDataObject[name="${sdoName}"]`);
|
|
80
|
-
return {
|
|
81
|
-
label: getNsdocDocumentation(nsdoc73, subDataObject?.getAttribute('descID')) ?? sdoName
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Getting data descriptions for DA(I) elements out of the IEC 61850-7-3 and IEC 61850-8-1 .nsdoc file.
|
|
86
|
-
* @param element - The element to use for searching the DA description.
|
|
87
|
-
* @returns Documentation from the .nsdoc file for this DA(I) element, or the name attribute in case no description can be found.
|
|
88
|
-
*/
|
|
89
|
-
function getDADataDescription(element) {
|
|
90
|
-
const daElementName = element.getAttribute('name');
|
|
91
|
-
const cdcName = element.closest('DOType').getAttribute('cdc');
|
|
92
|
-
const serviceDataAttr = nsd81.querySelector(`ServiceCDCs > ServiceCDC[cdc="${cdcName}"] > ServiceDataAttribute[name="${daElementName}"]`);
|
|
93
|
-
if (serviceDataAttr) {
|
|
94
|
-
const id = serviceDataAttr?.getAttribute('descID') ??
|
|
95
|
-
nsd81.querySelector(`ServiceConstructedAttributes > ServiceConstructedAttribute[name="${daElementName}"]`)?.getAttribute('titleID') ?? '';
|
|
96
|
-
return {
|
|
97
|
-
label: getNsdocDocumentation(nsdoc81, id) ?? daElementName
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
const dataAttr = nsd73.querySelector(`NS > CDCs > CDC[name="${cdcName}"] > DataAttribute[name="${daElementName}"]`);
|
|
102
|
-
return {
|
|
103
|
-
label: getNsdocDocumentation(nsdoc73, dataAttr?.getAttribute('descID')) ?? daElementName
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Getting data descriptions for BDA elements out of the IEC 61850-7-3 and IEC 61850-8-1 .nsdoc file.
|
|
109
|
-
* @param element - The element to use for searching the BDA description.
|
|
110
|
-
* @param ancestors - In this function, we need an ancestor to get a 'CDC' attribute.
|
|
111
|
-
* @returns Documentation from the .nsdoc file for this BDA element, or the name attribute in case no description can be found.
|
|
112
|
-
*/
|
|
113
|
-
function getBDADataDescription(element, ancestors) {
|
|
114
|
-
const bdaElementName = element.getAttribute('name');
|
|
115
|
-
const daParent = ancestors?.filter(x => x.tagName === 'DA')[0];
|
|
116
|
-
const serviceDataAttr = nsd81.querySelector(`ServiceConstructedAttributes > ServiceConstructedAttribute[name="${daParent.getAttribute('name')}"]`);
|
|
117
|
-
if (serviceDataAttr) {
|
|
118
|
-
if (serviceDataAttr.querySelector(`SubDataAttribute[name="${ancestors[0].getAttribute('name')}"]`)?.getAttribute('type') == 'Originator') {
|
|
119
|
-
const subDataAttr = nsd72.querySelector(`ConstructedAttributes > ConstructedAttribute[name="Originator"] > SubDataAttribute[name="${bdaElementName}"]`);
|
|
120
|
-
return {
|
|
121
|
-
label: getNsdocDocumentation(nsdoc72, subDataAttr?.getAttribute('descID')) ?? bdaElementName
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
label: getNsdocDocumentation(nsdoc81, serviceDataAttr.querySelector(`SubDataAttribute[name="${bdaElementName}"]`)?.getAttribute('descID')) ?? bdaElementName
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
const dataAttrParent = nsd73.querySelector(`NS > CDCs > CDC[name="${daParent.closest('DOType')?.getAttribute('cdc')}"] >
|
|
130
|
-
DataAttribute[name="${daParent.getAttribute('name')}"]`);
|
|
131
|
-
return {
|
|
132
|
-
label: getNsdocDocumentation(nsdoc73, getSubDataAttribute(dataAttrParent, bdaElementName)?.getAttribute('descID')) ?? bdaElementName
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Get the SubDataAttribute from the IEC-61850-7-3.
|
|
138
|
-
* @param parent - The parent element in which to search for a SubDataAttribute.
|
|
139
|
-
* @param bdaElementName - The name of the element to search.
|
|
140
|
-
* @returns A SubDataAttribute, or null.
|
|
141
|
-
*/
|
|
142
|
-
function getSubDataAttribute(parent, bdaElementName) {
|
|
143
|
-
if (!parent)
|
|
144
|
-
return null;
|
|
145
|
-
const subDataAttr = nsd73.querySelector(`ConstructedAttributes > ConstructedAttribute[name="${parent?.getAttribute('type')}"] > SubDataAttribute[name="${bdaElementName}"]`);
|
|
146
|
-
return subDataAttr ?? getSubDataAttribute(nsd73.querySelector(`ConstructedAttributes > ConstructedAttribute[name="${parent?.getAttribute('type')}"] > SubDataAttribute`), bdaElementName);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Get the potential inherited data object based on a LNClass base.
|
|
150
|
-
* @param lnClassBase - The base of a LNClass element.
|
|
151
|
-
* @param doName - The name of the DO(I) to search for.
|
|
152
|
-
* @returns the DataObject in case found, otherwise null.
|
|
153
|
-
*/
|
|
154
|
-
function getInheritedDataObject(lnClassBase, doName) {
|
|
155
|
-
if (!lnClassBase)
|
|
156
|
-
return null;
|
|
157
|
-
const lnClass = nsd74.querySelector(`NS > LNClasses > AbstractLNClass[name="${lnClassBase}"]`);
|
|
158
|
-
const base = lnClass?.getAttribute('base');
|
|
159
|
-
return lnClass?.querySelector(`DataObject[name="${doName}"]`) ?? getInheritedDataObject(base, doName);
|
|
160
|
-
}
|
|
161
|
-
return {
|
|
162
|
-
nsdoc72: nsdoc72,
|
|
163
|
-
nsdoc73: nsdoc73,
|
|
164
|
-
nsdoc74: nsdoc74,
|
|
165
|
-
nsdoc81: nsdoc81,
|
|
166
|
-
getDataDescription: function getDataDescription(element, ancestors) {
|
|
167
|
-
return getDataDescriptions[element.tagName].getDataDescription(element, ancestors);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Get the documentation from a given nsdoc file.
|
|
173
|
-
* @param nsdoc - The .nsdoc file to use for searching
|
|
174
|
-
* @param id - The id of the doc to search for.
|
|
175
|
-
* @returns - The documentation belonging to the id.
|
|
176
|
-
*/
|
|
177
|
-
function getNsdocDocumentation(nsdoc, id) {
|
|
178
|
-
return nsdoc?.querySelector(`NSDoc > Doc[id="${id ?? ''}"]`)?.textContent;
|
|
179
|
-
}
|
|
180
|
-
//# sourceMappingURL=nsdoc.js.map
|