@compas-oscd/open-scd 0.34.17 → 0.34.18

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.
Files changed (250) hide show
  1. package/dist/WizardDivider.d.ts +8 -8
  2. package/dist/WizardDivider.js +26 -26
  3. package/dist/Wizarding.js +36 -36
  4. package/dist/Wizarding.js.map +1 -1
  5. package/dist/action-icon.d.ts +25 -25
  6. package/dist/action-icon.js +51 -51
  7. package/dist/action-pane.d.ts +25 -25
  8. package/dist/action-pane.js +86 -86
  9. package/dist/addons/Editor.d.ts +25 -25
  10. package/dist/addons/Editor.js +105 -105
  11. package/dist/addons/Editor.js.map +1 -1
  12. package/dist/addons/History.d.ts +86 -93
  13. package/dist/addons/History.js +301 -302
  14. package/dist/addons/History.js.map +1 -1
  15. package/dist/addons/Layout.d.ts +96 -96
  16. package/dist/addons/Layout.js +448 -448
  17. package/dist/addons/Layout.js.map +1 -1
  18. package/dist/addons/Settings.d.ts +68 -68
  19. package/dist/addons/Settings.js +272 -272
  20. package/dist/addons/Settings.js.map +1 -1
  21. package/dist/addons/Waiter.d.ts +14 -14
  22. package/dist/addons/Waiter.js +40 -40
  23. package/dist/addons/Waiter.js.map +1 -1
  24. package/dist/addons/Wizards.d.ts +15 -15
  25. package/dist/addons/Wizards.js +46 -46
  26. package/dist/addons/editor/edit-action-to-v1-converter.d.ts +3 -3
  27. package/dist/addons/editor/edit-action-to-v1-converter.js +95 -95
  28. package/dist/addons/editor/edit-action-to-v1-converter.js.map +1 -1
  29. package/dist/addons/editor/edit-v1-to-v2-converter.d.ts +2 -2
  30. package/dist/addons/editor/edit-v1-to-v2-converter.js +36 -36
  31. package/dist/addons/editor/edit-v1-to-v2-converter.js.map +1 -1
  32. package/dist/addons/history/get-log-text.d.ts +5 -5
  33. package/dist/addons/history/get-log-text.js +25 -25
  34. package/dist/addons/history/get-log-text.js.map +1 -1
  35. package/dist/addons/menu-tabs/menu-tabs.d.ts +22 -22
  36. package/dist/addons/menu-tabs/menu-tabs.js +59 -59
  37. package/dist/addons/plugin-manager/custom-plugin-dialog.d.ts +28 -28
  38. package/dist/addons/plugin-manager/custom-plugin-dialog.js +71 -71
  39. package/dist/addons/plugin-manager/plugin-manager.d.ts +20 -20
  40. package/dist/addons/plugin-manager/plugin-manager.js +77 -77
  41. package/dist/core/api/api.js +7 -0
  42. package/dist/core/api/api.js.map +1 -0
  43. package/dist/core/api/editor/subject.js +22 -0
  44. package/dist/core/api/editor/subject.js.map +1 -0
  45. package/dist/core/api/editor/xml-editor.js +82 -0
  46. package/dist/core/api/editor/xml-editor.js.map +1 -0
  47. package/dist/core/api/plugin-state-api.js +27 -0
  48. package/dist/core/api/plugin-state-api.js.map +1 -0
  49. package/dist/core/foundation/cyrb64.js +26 -0
  50. package/dist/core/foundation/cyrb64.js.map +1 -0
  51. package/dist/core/foundation/deprecated/edit-event.js +44 -0
  52. package/dist/core/foundation/deprecated/edit-event.js.map +1 -0
  53. package/dist/core/foundation/deprecated/editor.js +94 -0
  54. package/dist/core/foundation/deprecated/editor.js.map +1 -0
  55. package/dist/core/foundation/deprecated/history.js +17 -0
  56. package/dist/core/foundation/deprecated/history.js.map +1 -0
  57. package/dist/core/foundation/deprecated/open-event.js +9 -0
  58. package/dist/core/foundation/deprecated/open-event.js.map +1 -0
  59. package/dist/core/foundation/deprecated/settings.js +19 -0
  60. package/dist/core/foundation/deprecated/settings.js.map +1 -0
  61. package/dist/core/foundation/deprecated/validation.js +8 -0
  62. package/dist/core/foundation/deprecated/validation.js.map +1 -0
  63. package/dist/core/foundation/deprecated/waiter.js +12 -0
  64. package/dist/core/foundation/deprecated/waiter.js.map +1 -0
  65. package/dist/core/foundation/edit-completed-event.js +11 -0
  66. package/dist/core/foundation/edit-completed-event.js.map +1 -0
  67. package/dist/core/foundation/edit-event.js +8 -0
  68. package/dist/core/foundation/edit-event.js.map +1 -0
  69. package/dist/core/foundation/edit.js +31 -0
  70. package/dist/core/foundation/edit.js.map +1 -0
  71. package/dist/core/foundation/handle-edit.js +151 -0
  72. package/dist/core/foundation/handle-edit.js.map +1 -0
  73. package/dist/core/foundation/open-event.js +8 -0
  74. package/dist/core/foundation/open-event.js.map +1 -0
  75. package/dist/core/foundation/plugin.js +2 -0
  76. package/dist/core/foundation/plugin.js.map +1 -0
  77. package/dist/core/foundation.js +14 -0
  78. package/dist/core/foundation.js.map +1 -0
  79. package/dist/core/locales.js +21 -0
  80. package/dist/core/locales.js.map +1 -0
  81. package/dist/filtered-list.d.ts +27 -27
  82. package/dist/filtered-list.js +118 -118
  83. package/dist/finder-list.d.ts +37 -37
  84. package/dist/finder-list.js +153 -153
  85. package/dist/foundation/compare.d.ts +79 -79
  86. package/dist/foundation/compare.js +216 -216
  87. package/dist/foundation/dai.d.ts +30 -30
  88. package/dist/foundation/dai.js +126 -126
  89. package/dist/foundation/generators.d.ts +13 -13
  90. package/dist/foundation/generators.js +66 -66
  91. package/dist/foundation/ied.d.ts +22 -22
  92. package/dist/foundation/ied.js +83 -83
  93. package/dist/foundation/ied.js.map +1 -1
  94. package/dist/foundation/nsd.d.ts +4 -4
  95. package/dist/foundation/nsd.js +12 -12
  96. package/dist/foundation/nsdoc.d.ts +14 -14
  97. package/dist/foundation/nsdoc.js +178 -178
  98. package/dist/foundation/scl.d.ts +1 -1
  99. package/dist/foundation/scl.js +63 -63
  100. package/dist/foundation.d.ts +230 -230
  101. package/dist/foundation.js +1921 -1921
  102. package/dist/foundation.js.map +1 -1
  103. package/dist/icons/compare.d.ts +3 -3
  104. package/dist/icons/compare.js +4 -4
  105. package/dist/icons/icons.d.ts +41 -41
  106. package/dist/icons/icons.js +92 -92
  107. package/dist/icons/ied-icons.d.ts +3 -3
  108. package/dist/icons/ied-icons.js +4 -4
  109. package/dist/icons/lnode.d.ts +16 -16
  110. package/dist/icons/lnode.js +17 -17
  111. package/dist/open-scd.d.ts +131 -131
  112. package/dist/open-scd.js +438 -438
  113. package/dist/open-scd.js.map +1 -1
  114. package/dist/openscd/src/WizardDivider.js +37 -0
  115. package/dist/openscd/src/WizardDivider.js.map +1 -0
  116. package/dist/openscd/src/Wizarding.js +38 -0
  117. package/dist/openscd/src/Wizarding.js.map +1 -0
  118. package/dist/openscd/src/action-icon.js +220 -0
  119. package/dist/openscd/src/action-icon.js.map +1 -0
  120. package/dist/openscd/src/action-pane.js +176 -0
  121. package/dist/openscd/src/action-pane.js.map +1 -0
  122. package/dist/openscd/src/addons/Editor.js +106 -0
  123. package/dist/openscd/src/addons/Editor.js.map +1 -0
  124. package/dist/openscd/src/addons/History.js +490 -0
  125. package/dist/openscd/src/addons/History.js.map +1 -0
  126. package/dist/openscd/src/addons/Layout.js +619 -0
  127. package/dist/openscd/src/addons/Layout.js.map +1 -0
  128. package/dist/openscd/src/addons/Settings.js +465 -0
  129. package/dist/openscd/src/addons/Settings.js.map +1 -0
  130. package/dist/openscd/src/addons/Waiter.js +45 -0
  131. package/dist/openscd/src/addons/Waiter.js.map +1 -0
  132. package/dist/openscd/src/addons/Wizards.js +48 -0
  133. package/dist/openscd/src/addons/Wizards.js.map +1 -0
  134. package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js +96 -0
  135. package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js.map +1 -0
  136. package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js +37 -0
  137. package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js.map +1 -0
  138. package/dist/openscd/src/addons/history/get-log-text.js +26 -0
  139. package/dist/openscd/src/addons/history/get-log-text.js.map +1 -0
  140. package/dist/openscd/src/addons/menu-tabs/menu-tabs.js +74 -0
  141. package/dist/openscd/src/addons/menu-tabs/menu-tabs.js.map +1 -0
  142. package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js +177 -0
  143. package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js.map +1 -0
  144. package/dist/openscd/src/addons/plugin-manager/plugin-manager.js +165 -0
  145. package/dist/openscd/src/addons/plugin-manager/plugin-manager.js.map +1 -0
  146. package/dist/openscd/src/filtered-list.js +168 -0
  147. package/dist/openscd/src/filtered-list.js.map +1 -0
  148. package/dist/openscd/src/finder-list.js +207 -0
  149. package/dist/openscd/src/finder-list.js.map +1 -0
  150. package/dist/openscd/src/foundation/compare.js +273 -0
  151. package/dist/openscd/src/foundation/compare.js.map +1 -0
  152. package/dist/openscd/src/foundation/dai.js +127 -0
  153. package/dist/openscd/src/foundation/dai.js.map +1 -0
  154. package/dist/openscd/src/foundation/generators.js +67 -0
  155. package/dist/openscd/src/foundation/generators.js.map +1 -0
  156. package/dist/openscd/src/foundation/ied.js +84 -0
  157. package/dist/openscd/src/foundation/ied.js.map +1 -0
  158. package/dist/openscd/src/foundation/nsd.js +13 -0
  159. package/dist/openscd/src/foundation/nsd.js.map +1 -0
  160. package/dist/openscd/src/foundation/nsdoc.js +180 -0
  161. package/dist/openscd/src/foundation/nsdoc.js.map +1 -0
  162. package/dist/openscd/src/foundation/scl.js +64 -0
  163. package/dist/openscd/src/foundation/scl.js.map +1 -0
  164. package/dist/openscd/src/foundation.js +1922 -0
  165. package/dist/openscd/src/foundation.js.map +1 -0
  166. package/dist/openscd/src/icons/compare.js +11 -0
  167. package/dist/openscd/src/icons/compare.js.map +1 -0
  168. package/dist/openscd/src/icons/icons.js +611 -0
  169. package/dist/openscd/src/icons/icons.js.map +1 -0
  170. package/dist/openscd/src/icons/ied-icons.js +11 -0
  171. package/dist/openscd/src/icons/ied-icons.js.map +1 -0
  172. package/dist/openscd/src/icons/lnode.js +50 -0
  173. package/dist/openscd/src/icons/lnode.js.map +1 -0
  174. package/dist/openscd/src/open-scd.js +483 -0
  175. package/dist/openscd/src/open-scd.js.map +1 -0
  176. package/dist/openscd/src/oscd-filter-button.js +89 -0
  177. package/dist/openscd/src/oscd-filter-button.js.map +1 -0
  178. package/dist/openscd/src/plain-compare-list.js +132 -0
  179. package/dist/openscd/src/plain-compare-list.js.map +1 -0
  180. package/dist/openscd/src/plugin-tag.js +23 -0
  181. package/dist/openscd/src/plugin-tag.js.map +1 -0
  182. package/dist/openscd/src/plugin.events.js +12 -0
  183. package/dist/openscd/src/plugin.events.js.map +1 -0
  184. package/dist/openscd/src/plugin.js +2 -0
  185. package/dist/openscd/src/plugin.js.map +1 -0
  186. package/dist/openscd/src/plugins.js +256 -0
  187. package/dist/openscd/src/plugins.js.map +1 -0
  188. package/dist/openscd/src/schemas.js +9325 -0
  189. package/dist/openscd/src/schemas.js.map +1 -0
  190. package/dist/openscd/src/themes.js +122 -0
  191. package/dist/openscd/src/themes.js.map +1 -0
  192. package/dist/openscd/src/translations/de.js +954 -0
  193. package/dist/openscd/src/translations/de.js.map +1 -0
  194. package/dist/openscd/src/translations/en.js +950 -0
  195. package/dist/openscd/src/translations/en.js.map +1 -0
  196. package/dist/openscd/src/translations/loader.js +10 -0
  197. package/dist/openscd/src/translations/loader.js.map +1 -0
  198. package/dist/openscd/src/wizard-checkbox.js +152 -0
  199. package/dist/openscd/src/wizard-checkbox.js.map +1 -0
  200. package/dist/openscd/src/wizard-dialog.js +374 -0
  201. package/dist/openscd/src/wizard-dialog.js.map +1 -0
  202. package/dist/openscd/src/wizard-select.js +115 -0
  203. package/dist/openscd/src/wizard-select.js.map +1 -0
  204. package/dist/openscd/src/wizard-textfield.js +191 -0
  205. package/dist/openscd/src/wizard-textfield.js.map +1 -0
  206. package/dist/openscd/src/wizards.js +196 -0
  207. package/dist/openscd/src/wizards.js.map +1 -0
  208. package/dist/oscd-filter-button.d.ts +27 -27
  209. package/dist/oscd-filter-button.js +59 -59
  210. package/dist/plain-compare-list.d.ts +36 -36
  211. package/dist/plain-compare-list.js +70 -70
  212. package/dist/plugin-tag.d.ts +6 -6
  213. package/dist/plugin-tag.js +22 -22
  214. package/dist/plugin.d.ts +23 -23
  215. package/dist/plugin.events.d.ts +15 -15
  216. package/dist/plugin.events.js +11 -11
  217. package/dist/plugin.js +1 -1
  218. package/dist/plugin.js.map +1 -1
  219. package/dist/plugins.d.ts +3 -3
  220. package/dist/plugins.js +255 -255
  221. package/dist/schemas.d.ts +58 -58
  222. package/dist/schemas.js +59 -59
  223. package/dist/themes.d.ts +3 -3
  224. package/dist/themes.js +13 -13
  225. package/dist/themes.js.map +1 -1
  226. package/dist/translations/de.d.ts +2 -2
  227. package/dist/translations/de.js +952 -952
  228. package/dist/translations/en.d.ts +963 -963
  229. package/dist/translations/en.js +948 -948
  230. package/dist/translations/loader.d.ts +12 -12
  231. package/dist/translations/loader.js +9 -9
  232. package/dist/translations/loader.js.map +1 -1
  233. package/dist/wizard-checkbox.d.ts +37 -37
  234. package/dist/wizard-checkbox.js +130 -130
  235. package/dist/wizard-dialog.d.ts +45 -45
  236. package/dist/wizard-dialog.js +235 -235
  237. package/dist/wizard-dialog.js.map +1 -1
  238. package/dist/wizard-select.d.ts +31 -31
  239. package/dist/wizard-select.js +102 -102
  240. package/dist/wizard-textfield.d.ts +50 -50
  241. package/dist/wizard-textfield.js +162 -162
  242. package/dist/wizards.d.ts +23 -23
  243. package/dist/wizards.js +148 -148
  244. package/dist/wizards.js.map +1 -1
  245. package/dist/xml/src/foundation.js +67 -0
  246. package/dist/xml/src/foundation.js.map +1 -0
  247. package/dist/xml/src/index.js +2 -0
  248. package/dist/xml/src/index.js.map +1 -0
  249. package/package.json +29 -127
  250. package/dist/Wizarding.d.ts +0 -10
@@ -1,84 +1,84 @@
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
- }
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
84
  //# sourceMappingURL=ied.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ied.js","sourceRoot":"","sources":["../../src/foundation/ied.ts"],"names":[],"mappings":"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","sourcesContent":["import { find, identity } from '../foundation.js';\nimport { Delete } from '@compas-oscd/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"]}
1
+ {"version":3,"file":"ied.js","sourceRoot":"","sources":["../../src/foundation/ied.ts"],"names":[],"mappings":"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","sourcesContent":["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"]}
@@ -1,4 +1,4 @@
1
- export declare const iec6185074: Promise<Document>;
2
- export declare const iec6185073: Promise<Document>;
3
- export declare const iec6185072: Promise<Document>;
4
- export declare const iec6185081: Promise<Document>;
1
+ export declare const iec6185074: Promise<Document>;
2
+ export declare const iec6185073: Promise<Document>;
3
+ export declare const iec6185072: Promise<Document>;
4
+ export declare const iec6185081: Promise<Document>;
@@ -1,13 +1,13 @@
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'));
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
13
  //# sourceMappingURL=nsd.js.map
@@ -1,14 +1,14 @@
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;
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;
@@ -1,180 +1,180 @@
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 {
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
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
- }
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
180
  //# sourceMappingURL=nsdoc.js.map
@@ -1 +1 @@
1
- export declare function existFcdaReference(fcda: Element, ied: Element): boolean;
1
+ export declare function existFcdaReference(fcda: Element, ied: Element): boolean;