@omicronenergy/oscd-scl-dialogs 0.0.9 → 0.0.11
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/CHANGELOG.md +20 -0
- package/custom-elements.json +449 -6
- package/dist/OscdTextEditor.d.ts +7 -14
- package/dist/OscdTextEditor.js +33 -33
- package/dist/OscdTextEditor.js.map +1 -1
- package/dist/ace-editor/AceEditor.d.ts +65 -0
- package/dist/ace-editor/AceEditor.js +205 -0
- package/dist/ace-editor/AceEditor.js.map +1 -0
- package/dist/ace-editor/debounce.d.ts +24 -0
- package/dist/ace-editor/debounce.js +41 -0
- package/dist/ace-editor/debounce.js.map +1 -0
- package/dist/ace-editor/property-decorators.d.ts +66 -0
- package/dist/ace-editor/property-decorators.js +171 -0
- package/dist/ace-editor/property-decorators.js.map +1 -0
- package/dist/wizards/dotype.js +1 -1
- package/dist/wizards/dotype.js.map +1 -1
- package/dist/wizards/function.js +2 -2
- package/dist/wizards/function.js.map +1 -1
- package/dist/wizards/generalEquipment.js +1 -1
- package/dist/wizards/generalEquipment.js.map +1 -1
- package/dist/wizards/ldevice.js +7 -5
- package/dist/wizards/ldevice.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Converts a camelCase property name to a kebab-case attribute name.
|
|
19
|
+
*/
|
|
20
|
+
function getAttributeName(propertyName) {
|
|
21
|
+
return propertyName
|
|
22
|
+
.replace(/[A-Z]+/g, sub => `-${sub}`)
|
|
23
|
+
.replace(/^-/, '')
|
|
24
|
+
.toLowerCase();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Defines that the target property should be exposed as an attribute, and
|
|
28
|
+
* that changes to the attribute should trigger a `notifyPropertyChanged`
|
|
29
|
+
* callback.
|
|
30
|
+
*
|
|
31
|
+
* @param attribute Override the attribute name to use. If ommitted, the
|
|
32
|
+
* property name is used (coverted from camelCase, to kebab-case).
|
|
33
|
+
*/
|
|
34
|
+
export function NotifyAttribute(attribute) {
|
|
35
|
+
return function (target, key) {
|
|
36
|
+
const attr = attribute || getAttributeName(key);
|
|
37
|
+
if (target.addObservedAttribute) {
|
|
38
|
+
target.addObservedAttribute(attr);
|
|
39
|
+
}
|
|
40
|
+
Object.defineProperty(target, key, {
|
|
41
|
+
get() {
|
|
42
|
+
return this.getAttribute(attr);
|
|
43
|
+
},
|
|
44
|
+
set(value) {
|
|
45
|
+
if (value === null || value === undefined) {
|
|
46
|
+
this.removeAttribute(attr);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.setAttribute(attr, value);
|
|
50
|
+
}
|
|
51
|
+
this.notifyPropertyChanged(key);
|
|
52
|
+
},
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Defines that the target property should be exposed as boolean attribute, and
|
|
60
|
+
* that changes to the attribute should trigger a `notifyPropertyChanged`
|
|
61
|
+
* callback.
|
|
62
|
+
*
|
|
63
|
+
* @param attribute Override the attribute name to use. If ommitted, the
|
|
64
|
+
* property name is used (coverted from camelCase, to snake-case).
|
|
65
|
+
*/
|
|
66
|
+
export function NotifyBooleanAttribute(attribute) {
|
|
67
|
+
return function (target, key) {
|
|
68
|
+
const attr = attribute || getAttributeName(key);
|
|
69
|
+
if (target.addObservedAttribute) {
|
|
70
|
+
target.addObservedAttribute(attr);
|
|
71
|
+
}
|
|
72
|
+
Object.defineProperty(target, key, {
|
|
73
|
+
get() {
|
|
74
|
+
return this.hasAttribute(attr);
|
|
75
|
+
},
|
|
76
|
+
set(value) {
|
|
77
|
+
if (value) {
|
|
78
|
+
this.setAttribute(attr, '');
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.removeAttribute(attr);
|
|
82
|
+
}
|
|
83
|
+
this.notifyPropertyChanged(key);
|
|
84
|
+
},
|
|
85
|
+
enumerable: true,
|
|
86
|
+
configurable: true,
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Defines that the target property should be exposed as numeric attribute, and
|
|
92
|
+
* that changes to the attribute should trigger a `notifyPropertyChanged`
|
|
93
|
+
* callback.
|
|
94
|
+
*
|
|
95
|
+
* @param attribute Override the attribute name to use. If ommitted, the
|
|
96
|
+
* property name is used (coverted from camelCase, to snake-case).
|
|
97
|
+
*/
|
|
98
|
+
export function NotifyNumericAttribute(attribute) {
|
|
99
|
+
return function (target, key) {
|
|
100
|
+
const attr = attribute || getAttributeName(key);
|
|
101
|
+
if (target.addObservedAttribute) {
|
|
102
|
+
target.addObservedAttribute(attr);
|
|
103
|
+
}
|
|
104
|
+
Object.defineProperty(target, key, {
|
|
105
|
+
get() {
|
|
106
|
+
const value = Number(this.getAttribute(attr));
|
|
107
|
+
if (isNaN(value)) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
return value;
|
|
111
|
+
},
|
|
112
|
+
set(value) {
|
|
113
|
+
if (value === null || value === undefined) {
|
|
114
|
+
this.removeAttribute(attr);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this.setAttribute(attr, value);
|
|
118
|
+
}
|
|
119
|
+
this.notifyPropertyChanged(key);
|
|
120
|
+
},
|
|
121
|
+
enumerable: true,
|
|
122
|
+
configurable: true,
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Defines that the target property should trigger a `notifyPropertyChanged`
|
|
128
|
+
* callback when the property changes.
|
|
129
|
+
*
|
|
130
|
+
* @param attribute Expose the property as an attribute. Note that when
|
|
131
|
+
* attribute is specified, this method has the same behavior as
|
|
132
|
+
* `NotifyAttribute`.
|
|
133
|
+
*/
|
|
134
|
+
export function Notify(attribute) {
|
|
135
|
+
if (attribute) {
|
|
136
|
+
return NotifyAttribute(attribute);
|
|
137
|
+
}
|
|
138
|
+
return function (target, key) {
|
|
139
|
+
Object.defineProperty(target, key, {
|
|
140
|
+
get() {
|
|
141
|
+
return this[`$__${key}`];
|
|
142
|
+
},
|
|
143
|
+
set(value) {
|
|
144
|
+
this[`$__${key}`] = value;
|
|
145
|
+
this.notifyPropertyChanged(key);
|
|
146
|
+
},
|
|
147
|
+
enumerable: true,
|
|
148
|
+
configurable: true,
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Creates an alias for the given property with a getter and a setter.
|
|
154
|
+
*
|
|
155
|
+
* @param alias Name of the alias.
|
|
156
|
+
*/
|
|
157
|
+
export function Alias(alias) {
|
|
158
|
+
return function (target, key) {
|
|
159
|
+
Object.defineProperty(target, alias, {
|
|
160
|
+
get() {
|
|
161
|
+
return this[key];
|
|
162
|
+
},
|
|
163
|
+
set(value) {
|
|
164
|
+
this[key] = value;
|
|
165
|
+
},
|
|
166
|
+
enumerable: true,
|
|
167
|
+
configurable: false,
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=property-decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property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IAAI;YAChB,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Describes notification target for the `Notify` decorators.\n */\ninterface NotifyTarget {\n notifyPropertyChanged: (name: string) => void;\n addObservedAttribute?: (name: string) => void;\n [key: string]: any;\n}\n\n/**\n * Converts a camelCase property name to a kebab-case attribute name.\n */\nfunction getAttributeName(propertyName: string): string {\n return propertyName\n .replace(/[A-Z]+/g, sub => `-${sub}`)\n .replace(/^-/, '')\n .toLowerCase();\n}\n\n/**\n * Defines that the target property should be exposed as an attribute, and\n * that changes to the attribute should trigger a `notifyPropertyChanged`\n * callback.\n *\n * @param attribute Override the attribute name to use. If ommitted, the\n * property name is used (coverted from camelCase, to kebab-case).\n */\nexport function NotifyAttribute(attribute?: string) {\n return function (target: NotifyTarget & HTMLElement, key: string): void {\n const attr = attribute || getAttributeName(key);\n\n if (target.addObservedAttribute) {\n target.addObservedAttribute(attr);\n }\n\n Object.defineProperty(target, key, {\n get(this: NotifyTarget & HTMLElement) {\n return this.getAttribute(attr);\n },\n set(this: NotifyTarget & HTMLElement, value: any) {\n if (value === null || value === undefined) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, value);\n }\n this.notifyPropertyChanged(key);\n },\n enumerable: true,\n configurable: true,\n });\n };\n}\n\n/**\n * Defines that the target property should be exposed as boolean attribute, and\n * that changes to the attribute should trigger a `notifyPropertyChanged`\n * callback.\n *\n * @param attribute Override the attribute name to use. If ommitted, the\n * property name is used (coverted from camelCase, to snake-case).\n */\nexport function NotifyBooleanAttribute(attribute?: string) {\n return function (target: NotifyTarget & HTMLElement, key: string): void {\n const attr = attribute || getAttributeName(key);\n\n if (target.addObservedAttribute) {\n target.addObservedAttribute(attr);\n }\n\n Object.defineProperty(target, key, {\n get(this: NotifyTarget & HTMLElement) {\n return this.hasAttribute(attr);\n },\n set(this: NotifyTarget & HTMLElement, value: any) {\n if (value) {\n this.setAttribute(attr, '');\n } else {\n this.removeAttribute(attr);\n }\n this.notifyPropertyChanged(key);\n },\n enumerable: true,\n configurable: true,\n });\n };\n}\n\n/**\n * Defines that the target property should be exposed as numeric attribute, and\n * that changes to the attribute should trigger a `notifyPropertyChanged`\n * callback.\n *\n * @param attribute Override the attribute name to use. If ommitted, the\n * property name is used (coverted from camelCase, to snake-case).\n */\nexport function NotifyNumericAttribute(attribute?: string) {\n return function (target: NotifyTarget & HTMLElement, key: string): void {\n const attr = attribute || getAttributeName(key);\n\n if (target.addObservedAttribute) {\n target.addObservedAttribute(attr);\n }\n\n Object.defineProperty(target, key, {\n get(this: NotifyTarget & HTMLElement) {\n const value = Number(this.getAttribute(attr));\n if (isNaN(value)) {\n return undefined;\n }\n return value;\n },\n set(this: NotifyTarget & HTMLElement, value: any) {\n if (value === null || value === undefined) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, value);\n }\n this.notifyPropertyChanged(key);\n },\n enumerable: true,\n configurable: true,\n });\n };\n}\n\n/**\n * Defines that the target property should trigger a `notifyPropertyChanged`\n * callback when the property changes.\n *\n * @param attribute Expose the property as an attribute. Note that when\n * attribute is specified, this method has the same behavior as\n * `NotifyAttribute`.\n */\nexport function Notify(\n attribute?: string,\n): (target: NotifyTarget & HTMLElement, key: string) => void {\n if (attribute) {\n return NotifyAttribute(attribute);\n }\n\n return function (target: NotifyTarget, key: string): void {\n Object.defineProperty(target, key, {\n get(this: NotifyTarget) {\n return this[`$__${key}`];\n },\n set(this: NotifyTarget, value: any) {\n this[`$__${key}`] = value;\n this.notifyPropertyChanged(key);\n },\n enumerable: true,\n configurable: true,\n });\n };\n}\n\n/**\n * Creates an alias for the given property with a getter and a setter.\n *\n * @param alias Name of the alias.\n */\nexport function Alias(alias: string) {\n return function (target: NotifyTarget, key: string): void {\n Object.defineProperty(target, alias, {\n get(this: NotifyTarget) {\n return this[key];\n },\n set(this: NotifyTarget, value: any) {\n this[key] = value;\n },\n enumerable: true,\n configurable: false,\n });\n };\n}\n"]}
|
package/dist/wizards/dotype.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotype.js","sourceRoot":"","sources":["../../wizards/dotype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAG3B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,QAAQ,GAIT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,SAAS,kBAAkB,CAAC,MAAe;IACzC,OAAO,CAAC,MAA4B,EAAY,EAAE;QAChD,MAAM,WAAW,GAAkC,EAAE,CAAC;QACtD,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACzC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACvB,WAAW,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,CAAE,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,aAAa,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;QAE1E,OAAO;YACL,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,MAAM,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E,QAAQ,CAAC,EAAE;SACpE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAe;IAChD,OAAO;QACL,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC;SACnC;QACD,OAAO,EAAE;YACP,IAAI,CAAA;;iBAEO,EAAE;;;;mBAIA,QAAQ,CAAC,OAAO;yBACV;YACnB,IAAI,CAAA;;iBAEO,IAAI;;mBAEF,QAAQ,CAAC,gBAAgB;yBACnB;YACnB,IAAI,CAAA;;iBAEO,KAAK;mBACH,QAAQ,CAAC,GAAG;yBACN;SACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { html } from 'lit';\n\nimport { EditV2 } from '@openscd/oscd-api';\nimport { getReference } from '@openscd/scl-lib';\n\nimport {\n createElement,\n getValue,\n Wizard,\n WizardActor,\n WizardInputElement,\n} from '../foundation.js';\nimport { patterns } from './patterns.js';\n\nfunction createDOTypeAction(parent: Element): WizardActor {\n return (inputs: WizardInputElement[]): EditV2[] => {\n const doTypeAttrs: Record<string, string | null> = {};\n const doTypeKeys = ['id', 'desc', 'cdc'];\n doTypeKeys.forEach(key => {\n doTypeAttrs[key] = getValue(inputs.find(i => i.label === key)!);\n });\n\n const doType = createElement(parent.ownerDocument, 'DOType', doTypeAttrs);\n\n return [\n { parent, node: doType, reference: getReference(parent, 'DOType') },\n ];\n };\n}\n\nexport function createDOTypeWizard(parent: Element): Wizard {\n return {\n title: 'Add DOType',\n primary: {\n icon: 'save',\n label: 'Save',\n action: createDOTypeAction(parent),\n },\n content: [\n html`<scl-text-field\n label=\"id\"\n .value=${''}\n required\n maxlength=\"127\"\n minlength=\"1\"\n pattern=\"${patterns.nmToken}\"\n ></scl-text-field>`,\n html`<scl-text-field\n label=\"desc\"\n .value=${null}\n nullable\n pattern=\"${patterns.normalizedString}\"\n ></scl-text-field>`,\n html`<scl-text-field\n label=\"cdc\"\n .value=${'ENS'}\n pattern=\"${patterns.cdc}\"\n ></scl-text-field>`,\n ],\n };\n}\n"]}
|
package/dist/wizards/function.js
CHANGED
|
@@ -12,12 +12,12 @@ export function contentFunctionWizard(options) {
|
|
|
12
12
|
></scl-text-field>`,
|
|
13
13
|
html `<scl-text-field
|
|
14
14
|
label="desc"
|
|
15
|
-
.
|
|
15
|
+
.value=${options.desc}
|
|
16
16
|
nullable
|
|
17
17
|
></scl-text-field>`,
|
|
18
18
|
html `<scl-text-field
|
|
19
19
|
label="type"
|
|
20
|
-
.
|
|
20
|
+
.value=${options.type}
|
|
21
21
|
nullable
|
|
22
22
|
></scl-text-field>`,
|
|
23
23
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../wizards/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,QAAQ,EACR,aAAa,GAId,MAAM,kBAAkB,CAAC;AAS1B,MAAM,UAAU,qBAAqB,CACnC,OAAsB;IAEtB,OAAO;QACL,IAAI,CAAA;;eAEO,OAAO,CAAC,IAAI;;wBAEH,OAAO,CAAC,cAAc;;uBAEvB;QACnB,IAAI,CAAA;;
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../wizards/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,QAAQ,EACR,aAAa,GAId,MAAM,kBAAkB,CAAC;AAS1B,MAAM,UAAU,qBAAqB,CACnC,OAAsB;IAEtB,OAAO;QACL,IAAI,CAAA;;eAEO,OAAO,CAAC,IAAI;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CAAC;SACH;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { html, TemplateResult } from 'lit';\n\nimport { EditV2 } from '@openscd/oscd-api';\nimport { getReference } from '@openscd/scl-lib';\n\nimport {\n createElement,\n getValue,\n reservedNames,\n Wizard,\n WizardActor,\n WizardInputElement,\n} from '../foundation.js';\n\ntype RenderOptions = {\n name: string | null;\n desc: string | null;\n type: string | null;\n reservedValues: string[];\n};\n\nexport function contentFunctionWizard(\n options: RenderOptions,\n): TemplateResult[] {\n return [\n html`<scl-text-field\n label=\"name\"\n .value=${options.name}\n required\n .reservedValues=${options.reservedValues}\n dialogInitialFocus\n ></scl-text-field>`,\n html`<scl-text-field\n label=\"desc\"\n .value=${options.desc}\n nullable\n ></scl-text-field>`,\n html`<scl-text-field\n label=\"type\"\n .value=${options.type}\n nullable\n ></scl-text-field>`,\n ];\n}\n\nfunction createFunctionAction(parent: Element): WizardActor {\n return (inputs: WizardInputElement[]): EditV2[] => {\n const functionAttrs: Record<string, string | null> = {};\n const functionKeys = ['name', 'desc', 'type'];\n functionKeys.forEach(key => {\n functionAttrs[key] = getValue(inputs.find(i => i.label === key)!);\n });\n\n const fUnction = createElement(\n parent.ownerDocument,\n 'Function',\n functionAttrs,\n );\n\n return [\n { parent, node: fUnction, reference: getReference(parent, 'Function') },\n ];\n };\n}\n\nexport function createFunctionWizard(parent: Element): Wizard {\n const name = '';\n const desc = null;\n const type = null;\n\n return {\n title: 'Add Function',\n primary: {\n icon: 'save',\n label: 'save',\n action: createFunctionAction(parent),\n },\n content: [\n ...contentFunctionWizard({\n name,\n desc,\n type,\n reservedValues: reservedNames(parent, 'Function'),\n }),\n ],\n };\n}\n\nfunction updateFunction(element: Element): WizardActor {\n return (inputs: WizardInputElement[]): EditV2[] => {\n const attributes: Record<string, string | null> = {};\n const functionKeys = ['name', 'desc', 'type'];\n functionKeys.forEach(key => {\n attributes[key] = getValue(inputs.find(i => i.label === key)!);\n });\n\n if (\n functionKeys.some(key => attributes[key] !== element.getAttribute(key))\n ) {\n return [{ element, attributes }];\n }\n\n return [];\n };\n}\n\nexport function editFunctionWizard(element: Element): Wizard {\n const name = element.getAttribute('name');\n const desc = element.getAttribute('desc');\n const type = element.getAttribute('type');\n\n return {\n title: 'Edit Function',\n primary: {\n icon: 'save',\n label: 'save',\n action: updateFunction(element),\n },\n content: [\n ...contentFunctionWizard({\n name,\n desc,\n type,\n reservedValues: reservedNames(element),\n }),\n ],\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generalEquipment.js","sourceRoot":"","sources":["../../wizards/generalEquipment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,QAAQ,EACR,aAAa,GAId,MAAM,kBAAkB,CAAC;AAU1B,MAAM,UAAU,6BAA6B,CAC3C,OAAsB;IAEtB,OAAO;QACL,IAAI,CAAA;;eAEO,OAAO,CAAC,IAAI;;wBAEH,OAAO,CAAC,cAAc;;uBAEvB;QACnB,IAAI,CAAA;;
|
|
1
|
+
{"version":3,"file":"generalEquipment.js","sourceRoot":"","sources":["../../wizards/generalEquipment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,QAAQ,EACR,aAAa,GAId,MAAM,kBAAkB,CAAC;AAU1B,MAAM,UAAU,6BAA6B,CAC3C,OAAsB;IAEtB,OAAO;QACL,IAAI,CAAA;;eAEO,OAAO,CAAC,IAAI;;wBAEH,OAAO,CAAC,cAAc;;uBAEvB;QACnB,IAAI,CAAA;;eAEO,OAAO,CAAC,IAAI;;uBAEJ;QACnB,IAAI,CAAA;;eAEO,OAAO,CAAC,IAAI;;;;uBAIJ;QACnB,IAAI,C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BACJ,IAAI;gBACJ,OAAO;gBACP,cAAc,EAAE,aAAa,CAAC,OAAO,CAAC;aACvC,CAAC;SACH;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { html, TemplateResult } from 'lit';\n\nimport { EditV2 } from '@openscd/oscd-api';\nimport { getReference } from '@openscd/scl-lib';\n\nimport {\n createElement,\n getValue,\n reservedNames,\n Wizard,\n WizardActor,\n WizardInputElement,\n} from '../foundation.js';\n\ntype RenderOptions = {\n name: string | null;\n desc: string | null;\n type: string | null;\n virtual: string | null;\n reservedValues: string[];\n};\n\nexport function contentGeneralEquipmentWizard(\n options: RenderOptions,\n): TemplateResult[] {\n return [\n html`<scl-text-field\n label=\"name\"\n .value=${options.name}\n required\n .reservedValues=${options.reservedValues}\n dialogInitialFocus\n ></scl-text-field>`,\n html`<scl-text-field\n label=\"desc\"\n .value=${options.desc}\n nullable\n ></scl-text-field>`,\n html`<scl-text-field\n label=\"type\"\n .value=${options.type}\n minLength=\"3\"\n pattern=\"AXN|BAT|MOT|FAN|FIL|PMP|TNK|VLV|E[A-Z]*\"\n required\n ></scl-text-field>`,\n html`<scl-checkbox\n label=\"virtual\"\n .value=${options.virtual}\n nullable\n ></scl-checkbox>`,\n ];\n}\n\nfunction createAction(parent: Element): WizardActor {\n return (inputs: WizardInputElement[]): EditV2[] => {\n const attributes: Record<string, string | null> = {};\n const generalEquipmentKeys = ['name', 'desc', 'type', 'virtual'];\n generalEquipmentKeys.forEach(key => {\n attributes[key] = getValue(inputs.find(i => i.label === key)!);\n });\n\n const generalEquipment = createElement(\n parent.ownerDocument,\n 'GeneralEquipment',\n attributes,\n );\n\n return [\n {\n parent,\n node: generalEquipment,\n reference: getReference(parent, 'GeneralEquipment'),\n },\n ];\n };\n}\n\nexport function createGeneralEquipmentWizard(parent: Element): Wizard {\n const name = '';\n const desc = null;\n const type = null;\n const virtual = null;\n\n return {\n title: 'Add GeneralEquipment',\n primary: {\n icon: 'save',\n label: 'save',\n action: createAction(parent),\n },\n content: [\n ...contentGeneralEquipmentWizard({\n name,\n desc,\n type,\n virtual,\n reservedValues: reservedNames(parent, 'GeneralEquipment'),\n }),\n ],\n };\n}\n\nfunction updateAction(element: Element): WizardActor {\n return (inputs: WizardInputElement[]): EditV2[] => {\n const attributes: Record<string, string | null> = {};\n const generalEquipmentKeys = ['name', 'desc', 'type', 'virtual'];\n generalEquipmentKeys.forEach(key => {\n attributes[key] = getValue(inputs.find(i => i.label === key)!);\n });\n\n if (\n generalEquipmentKeys.some(\n key => attributes[key] !== element.getAttribute(key),\n )\n ) {\n return [{ element, attributes }];\n }\n\n return [];\n };\n}\n\nexport function editGeneralEquipmentWizard(element: Element): Wizard {\n const name = element.getAttribute('name');\n const desc = element.getAttribute('desc');\n const type = element.getAttribute('type');\n const virtual = element.getAttribute('virtual');\n\n return {\n title: 'Edit GeneralEquipment',\n primary: {\n icon: 'save',\n label: 'save',\n action: updateAction(element),\n },\n content: [\n ...contentGeneralEquipmentWizard({\n name,\n desc,\n type,\n virtual,\n reservedValues: reservedNames(element),\n }),\n ],\n };\n}\n"]}
|
package/dist/wizards/ldevice.js
CHANGED
|
@@ -100,14 +100,16 @@ export function updateAction(element) {
|
|
|
100
100
|
const ldName = ldNameAllowed
|
|
101
101
|
? getValue(inputs.find(i => i.label === 'ldName'))
|
|
102
102
|
: null;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
const attributes = {
|
|
104
|
+
...(ldNameAllowed && ldName !== element.getAttribute('ldName')
|
|
105
|
+
? { ldName }
|
|
106
|
+
: {}),
|
|
107
|
+
...(desc !== element.getAttribute('desc') ? { desc } : {}),
|
|
108
|
+
};
|
|
107
109
|
return [
|
|
108
110
|
{
|
|
109
111
|
element,
|
|
110
|
-
attributes
|
|
112
|
+
attributes,
|
|
111
113
|
},
|
|
112
114
|
];
|
|
113
115
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ldevice.js","sourceRoot":"","sources":["../../wiz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,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,EAC5B,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,EAC9B,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,EAC5B,mBAAmB,CAAC,OAAO,CAAC,EAC5B,eAAe,CAAC,OAAO,CAAC,EACxB,IAAI,CACL;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { html, TemplateResult } from 'lit';\n\nimport { EditV2 } from '@openscd/oscd-api';\n\nimport { getReference } from '@openscd/scl-lib';\n\nimport {\n createElement,\n getValue,\n Wizard,\n WizardActor,\n WizardInputElement,\n} from '../foundation.js';\nimport { patterns } from './patterns.js';\nimport { SclTextField } from '@openenergytools/scl-text-field';\n\nexport function lDeviceNamePattern(): string {\n return (\n '[A-Za-z][0-9A-Za-z_]{0,2}|' +\n '[A-Za-z][0-9A-Za-z_]{4,63}|' +\n '[A-MO-Za-z][0-9A-Za-z_]{3}|' +\n 'N[0-9A-Za-np-z_][0-9A-Za-z_]{2}|' +\n 'No[0-9A-Za-mo-z_][0-9A-Za-z_]|' +\n 'Non[0-9A-Za-df-z_]'\n );\n}\n\nfunction ldNameIsAllowed(element: Element): boolean {\n return !!element.closest('IED')?.querySelector('Services > ConfLdName');\n}\n\nfunction reservedInstLDevice(currentElement: Element): string[] {\n const ied = currentElement.closest('IED');\n if (!ied) {\n return [];\n }\n\n return Array.from(\n ied.querySelectorAll(':scope > AccessPoint > Server > LDevice'),\n )\n .map(ld => ld.getAttribute('inst') ?? '')\n .filter(name => name !== currentElement.getAttribute('inst'));\n}\n\nfunction render(\n inst: string | null,\n ldName: string | null,\n desc: string | null,\n reservedInsts: string[],\n allowLdName: boolean,\n disableInst: boolean,\n): TemplateResult[] {\n const content = [\n allowLdName\n ? html`<scl-text-field\n label=\"ldName\"\n .value=${ldName}\n nullable\n supportingText=\"Logical device name\"\n validationMessage=\"Required\"\n dialogInitialFocus\n pattern=\"${lDeviceNamePattern()}\"\n ></scl-text-field>`\n : html`<scl-text-field\n label=\"ldName\"\n .value=${ldName}\n supportingText=\"IED doesn't support Functional Naming\"\n helperPersistent\n readOnly\n disabled\n ></scl-text-field>`,\n html`<scl-text-field\n label=\"desc\"\n .value=${desc}\n nullable\n supportingText=\"Logical device description\"\n pattern=\"${patterns.normalizedString}\"\n ></scl-text-field>`,\n html`<scl-text-field\n label=\"inst\"\n .value=${inst}\n ?disabled=${disableInst}\n required\n supportingText=\"Logical device inst\"\n pattern=\"${patterns.normalizedString}\"\n @input=${(e: Event) => {\n const input = e.target as SclTextField;\n const currentValue = getValue(input) ?? '';\n let customValidityMsg = '';\n if (reservedInsts.includes(currentValue)) {\n customValidityMsg = `\"${currentValue}\" is already in use`;\n }\n input.setCustomValidity(customValidityMsg);\n input.reportValidity();\n }}\n .reservedValues=${reservedInsts}\n ></scl-text-field>`,\n ];\n return content;\n}\n\nexport function createAction(parent: Element): WizardActor {\n return (inputs: WizardInputElement[]): EditV2[] => {\n const inst = getValue(inputs.find(i => i.label === 'inst')!)!;\n const ldNameAllowed = ldNameIsAllowed(parent);\n const ldName = ldNameAllowed\n ? getValue(inputs.find(i => i.label === 'ldName')!)\n : null;\n const desc = getValue(inputs.find(i => i.label === 'desc')!);\n const node = createElement(parent.ownerDocument, 'LDevice', {\n inst,\n ldName,\n desc,\n });\n\n return [\n {\n parent,\n node,\n reference: getReference(parent, 'LDevice'),\n },\n ];\n };\n}\n\nexport function updateAction(element: Element): WizardActor {\n return (inputs: WizardInputElement[]): EditV2[] => {\n const ldNameAllowed = ldNameIsAllowed(element);\n const desc = getValue(inputs.find(i => i.label === 'desc')!);\n const ldName = ldNameAllowed\n ? getValue(inputs.find(i => i.label === 'ldName')!)\n : null;\n\n const attributes = {\n ...(ldNameAllowed && ldName !== element.getAttribute('ldName')\n ? { ldName }\n : {}),\n ...(desc !== element.getAttribute('desc') ? { desc } : {}),\n };\n\n return [\n {\n element,\n attributes,\n },\n ];\n };\n}\n\nexport function createLDeviceWizard(parent: Element): Wizard {\n return {\n title: 'Add LDevice',\n primary: {\n icon: '',\n label: 'save',\n action: createAction(parent),\n },\n content: render(\n null,\n null,\n null,\n reservedInstLDevice(parent),\n ldNameIsAllowed(parent),\n false,\n ),\n };\n}\n\nexport function editLDeviceWizard(element: Element): Wizard {\n return {\n title: 'Edit LDevice',\n primary: {\n icon: 'edit',\n label: 'save',\n action: updateAction(element),\n },\n content: render(\n element.getAttribute('inst'),\n element.getAttribute('ldName'),\n element.getAttribute('desc'),\n reservedInstLDevice(element),\n ldNameIsAllowed(element),\n true,\n ),\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@omicronenergy/oscd-scl-dialogs",
|
|
3
3
|
"description": "Provides a resuable dialog for adding and editing SCL elements in OpenSCD.",
|
|
4
4
|
"displayName": "OpenSCD Edit Dialog",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.11",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/OMICRONEnergyOSS/oscd-scl-dialogs.git"
|
|
@@ -97,7 +97,6 @@
|
|
|
97
97
|
"@web/test-runner-commands": "0.9.0",
|
|
98
98
|
"@web/test-runner-playwright": "0.11.1",
|
|
99
99
|
"@web/test-runner-visual-regression": "0.10.0",
|
|
100
|
-
"@webcomponents/scoped-custom-element-registry": "0.0.10",
|
|
101
100
|
"concurrently": "^9.2.1",
|
|
102
101
|
"eslint": "^9.39.1",
|
|
103
102
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -117,6 +116,9 @@
|
|
|
117
116
|
"typedoc": "^0.28.16",
|
|
118
117
|
"typescript": "^5.9.3"
|
|
119
118
|
},
|
|
119
|
+
"overrides": {
|
|
120
|
+
"playwright": "1.54.1"
|
|
121
|
+
},
|
|
120
122
|
"customElements": "custom-elements.json",
|
|
121
123
|
"prettier": {
|
|
122
124
|
"singleQuote": true,
|