iobroker.webui 1.17.3 → 1.18.0
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/README.md +3 -0
- package/io-package.json +14 -14
- package/package.json +1 -1
- package/www/dist/frontend/config/IobrokerWebuiControlPropertiesEditor.js +4 -1
- package/www/dist/frontend/config/IobrokerWebuiSolutionExplorer.js +17 -11
- package/www/dist/frontend/helper/XmlHelper.js +58 -41
- package/www/index.html +1 -1
package/README.md
CHANGED
package/io-package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "webui",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.18.0",
|
|
5
5
|
"titleLang": {
|
|
6
6
|
"en": "webui",
|
|
7
7
|
"de": "webui",
|
|
@@ -29,6 +29,19 @@
|
|
|
29
29
|
"zh-cn": "使用万维网传送器的高锰用户接口"
|
|
30
30
|
},
|
|
31
31
|
"news": {
|
|
32
|
+
"1.18.0": {
|
|
33
|
+
"en": "screens are now ex- & imported as xml",
|
|
34
|
+
"de": "bildschirme werden jetzt ex- & importiert als xml",
|
|
35
|
+
"ru": "экраны теперь экс-и импортированы как xml",
|
|
36
|
+
"pt": "telas são agora ex- & importadas como xml",
|
|
37
|
+
"nl": "schermen worden nu ex- & geïmporteerd als xml",
|
|
38
|
+
"fr": "les écrans sont maintenant ex- & importés comme xml",
|
|
39
|
+
"it": "schermi sono ora ex- & importati come xml",
|
|
40
|
+
"es": "pantallas ahora son ex- \" importadas como xml",
|
|
41
|
+
"pl": "ekrany są teraz ex- & importowane jako xml",
|
|
42
|
+
"uk": "екрани тепер екс- та імпортовані як xml",
|
|
43
|
+
"zh-cn": "屏幕现在以 xml 导入( i)"
|
|
44
|
+
},
|
|
32
45
|
"1.17.3": {
|
|
33
46
|
"en": "fix compilation",
|
|
34
47
|
"de": "fix compilation",
|
|
@@ -106,19 +119,6 @@
|
|
|
106
119
|
"pl": "błędne domyślne w skrypcie",
|
|
107
120
|
"uk": "неправильний типовий скрипт",
|
|
108
121
|
"zh-cn": "脚本默认错误"
|
|
109
|
-
},
|
|
110
|
-
"1.16.1": {
|
|
111
|
-
"en": "fix base custom webcomp bindings",
|
|
112
|
-
"de": "fix base benutzerdefinierte webcomp bindungen",
|
|
113
|
-
"ru": "исправление базовых пользовательских веб-композиций",
|
|
114
|
-
"pt": "corrigir ligações de webcomp de base personalizada",
|
|
115
|
-
"nl": "fix basis aangepaste webcomp bindingen",
|
|
116
|
-
"fr": "fixer les fixations webcomp personnalisées de base",
|
|
117
|
-
"it": "fissaggio di base personalizzati webcomp binding",
|
|
118
|
-
"es": "fijar bases de unión personalizadas webcomp",
|
|
119
|
-
"pl": "fix bazowe niestandardowe wiązania webcomp",
|
|
120
|
-
"uk": "фіксувати базові користувацькі прив'язки вебкомп'ютера",
|
|
121
|
-
"zh-cn": "固定自定义网络comp 绑定"
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
"icon": "logo.png",
|
package/package.json
CHANGED
|
@@ -87,7 +87,10 @@ export class IobrokerWebuiControlPropertiesEditor extends BaseCustomWebComponent
|
|
|
87
87
|
this._bindingsRefresh();
|
|
88
88
|
}
|
|
89
89
|
addEnumProp() {
|
|
90
|
-
|
|
90
|
+
let p = { name: '', type: 'enum', values: '["a", "b"]' };
|
|
91
|
+
if (this.defaultInternal)
|
|
92
|
+
p.internal = true;
|
|
93
|
+
this.properties.push(p);
|
|
91
94
|
this._bindingsRefresh();
|
|
92
95
|
}
|
|
93
96
|
removeProp(index) {
|
|
@@ -10,6 +10,7 @@ import wunderbaumStyle from 'wunderbaum/dist/wunderbaum.css' with { type: 'css'
|
|
|
10
10
|
import { defaultNewStyle } from "./IobrokerWebuiScreenEditor.js";
|
|
11
11
|
import { IobrokerWebuiIconsView } from "./IobrokerWebuiIconsView.js";
|
|
12
12
|
import { IobrokerWebuiScreensView } from "./IobrokerWebuiScreensView.js";
|
|
13
|
+
import { convertToXml, parseXml } from "../helper/XmlHelper.js";
|
|
13
14
|
export class IobrokerWebuiSolutionExplorer extends BaseCustomWebComponentConstructorAppend {
|
|
14
15
|
static template = html `
|
|
15
16
|
<div id="treeDiv" class="" style="overflow: auto; width:100%; height: 100%;">
|
|
@@ -95,11 +96,21 @@ export class IobrokerWebuiSolutionExplorer extends BaseCustomWebComponentConstru
|
|
|
95
96
|
try {
|
|
96
97
|
let files = await openFileDialog('.' + type, true, 'text');
|
|
97
98
|
for (let f of files) {
|
|
98
|
-
let data =
|
|
99
|
+
let data = null;
|
|
100
|
+
if (f.data[0] === '<') {
|
|
101
|
+
data = parseXml(f.data);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
data = JSON.parse(f.data);
|
|
105
|
+
}
|
|
99
106
|
let nm = f.name;
|
|
100
|
-
if (nm.endsWith('.' + type))
|
|
107
|
+
if (nm.endsWith('.' + type)) {
|
|
101
108
|
nm = nm.substring(0, nm.length - type.length - 1);
|
|
102
|
-
|
|
109
|
+
}
|
|
110
|
+
nm = prompt('Import as:', nm);
|
|
111
|
+
if (nm) {
|
|
112
|
+
await iobrokerHandler.saveObject(type, (dir ?? '') + '/' + nm, data);
|
|
113
|
+
}
|
|
103
114
|
}
|
|
104
115
|
}
|
|
105
116
|
catch (err) {
|
|
@@ -175,15 +186,10 @@ export class IobrokerWebuiSolutionExplorer extends BaseCustomWebComponentConstru
|
|
|
175
186
|
ContextMenu.show([{
|
|
176
187
|
title: 'Export ' + type, action: async () => {
|
|
177
188
|
let data = await iobrokerHandler.getWebuiObject(type, (dir ?? '') + '/' + name);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}, /*{
|
|
181
|
-
title: 'Export Screen as XML', action: async () => {
|
|
182
|
-
let data = await iobrokerHandler.getScreen(name);
|
|
183
|
-
await exportData(screenToXml(data), name + '.screen')
|
|
189
|
+
let xml = convertToXml(type, data);
|
|
190
|
+
await exportData(xml, name + '.' + type);
|
|
184
191
|
}
|
|
185
|
-
}
|
|
186
|
-
{
|
|
192
|
+
}, {
|
|
187
193
|
title: 'Copy ' + type, action: async () => {
|
|
188
194
|
let newName = prompt("New Name", name);
|
|
189
195
|
if (newName && newName != name) {
|
|
@@ -5,20 +5,46 @@ export function parseXml(xml) {
|
|
|
5
5
|
let doc = new DOMParser().parseFromString(xml, "text/xml");
|
|
6
6
|
let obj = {};
|
|
7
7
|
for (let childNode of doc.children[0].children) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
if (childNode.nodeName == 'properties') {
|
|
9
|
+
obj.properties = {};
|
|
10
|
+
for (let p of childNode.children) {
|
|
11
|
+
let prp = {
|
|
12
|
+
type: p.getAttribute('type')
|
|
13
|
+
};
|
|
14
|
+
let def = p.getAttribute('default');
|
|
15
|
+
if (def)
|
|
16
|
+
prp.default = def;
|
|
17
|
+
let values = p.getAttribute('values');
|
|
18
|
+
if (values)
|
|
19
|
+
prp.values = values.split('|');
|
|
20
|
+
let internal = p.getAttribute('internal');
|
|
21
|
+
if (internal)
|
|
22
|
+
prp.internal = internal;
|
|
23
|
+
obj.properties[p.getAttribute('name')] = prp;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else if (childNode.nodeName == 'settings') {
|
|
27
|
+
obj.settings = {};
|
|
28
|
+
for (let p of childNode.children) {
|
|
29
|
+
obj.settings[p.nodeName] = p.textContent;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
let tx = childNode.textContent;
|
|
34
|
+
if (tx[0] === '\n' && tx.endsWith('\n'))
|
|
35
|
+
tx = tx.substring(1, tx.length - 2);
|
|
36
|
+
else if (tx[0] === '\n')
|
|
37
|
+
tx = tx.substring(1);
|
|
38
|
+
else if (tx.endsWith('\n'))
|
|
39
|
+
tx = tx.substring(0, tx.length - 1);
|
|
40
|
+
obj[childNode.nodeName] = tx;
|
|
41
|
+
}
|
|
16
42
|
}
|
|
17
43
|
return obj;
|
|
18
44
|
}
|
|
19
|
-
export function
|
|
45
|
+
export function convertToXml(type, screen) {
|
|
20
46
|
let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
21
|
-
xml += "<screen>\n";
|
|
47
|
+
xml += type == 'screen' ? "<screen>\n" : "<control>\n";
|
|
22
48
|
if (screen.html) {
|
|
23
49
|
xml += " <html><![CDATA[\n";
|
|
24
50
|
xml += escapeCData(screen.html);
|
|
@@ -29,43 +55,34 @@ export function screenToXml(screen) {
|
|
|
29
55
|
xml += escapeCData(screen.style);
|
|
30
56
|
xml += "\n]]></style>\n";
|
|
31
57
|
}
|
|
32
|
-
if (screen.
|
|
33
|
-
xml += " <
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
xml += "</settings>\n";
|
|
38
|
-
}
|
|
39
|
-
xml += "</screen>\n";
|
|
40
|
-
return xml;
|
|
41
|
-
}
|
|
42
|
-
export function controlToXml(control) {
|
|
43
|
-
let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
44
|
-
xml += "<control>\n";
|
|
45
|
-
if (control.html) {
|
|
46
|
-
xml += " <html><![CDATA[\n";
|
|
47
|
-
xml += escapeCData(control.html);
|
|
48
|
-
xml += "\n]]></html>\n";
|
|
49
|
-
}
|
|
50
|
-
if (control.style) {
|
|
51
|
-
xml += " <style><![CDATA[\n";
|
|
52
|
-
xml += escapeCData(control.style);
|
|
53
|
-
xml += "\n]]></style>\n";
|
|
58
|
+
if (screen.script) {
|
|
59
|
+
xml += " <script><![CDATA[\n";
|
|
60
|
+
xml += escapeCData(screen.script);
|
|
61
|
+
xml += "\n]]></script>\n";
|
|
54
62
|
}
|
|
55
|
-
if (
|
|
63
|
+
if (screen.properties && Object.getOwnPropertyNames(screen.properties).length) {
|
|
56
64
|
xml += " <properties>\n";
|
|
57
|
-
for (let p in
|
|
58
|
-
xml += ` <property name="${p}"
|
|
65
|
+
for (let p in screen.properties) {
|
|
66
|
+
xml += ` <property name="${p}"`;
|
|
67
|
+
if (screen.properties[p].type)
|
|
68
|
+
xml += ` type="${screen.properties[p].type}"`;
|
|
69
|
+
if (screen.properties[p].default)
|
|
70
|
+
xml += ` default="${screen.properties[p].default}"`;
|
|
71
|
+
if (screen.properties[p].values)
|
|
72
|
+
xml += ` values="${screen.properties[p].values.join('|')}"`;
|
|
73
|
+
if (screen.properties[p].internal)
|
|
74
|
+
xml += ` internal="${screen.properties[p].internal}"`;
|
|
75
|
+
xml += " />\n";
|
|
59
76
|
}
|
|
60
|
-
xml += "
|
|
77
|
+
xml += " </properties>\n";
|
|
61
78
|
}
|
|
62
|
-
if (
|
|
79
|
+
if (screen.settings) {
|
|
63
80
|
xml += " <settings>\n";
|
|
64
|
-
for (let p in
|
|
65
|
-
xml += " <" + p + ">" +
|
|
81
|
+
for (let p in screen.settings) {
|
|
82
|
+
xml += " <" + p + ">" + screen.settings[p] + "</" + p + ">\n";
|
|
66
83
|
}
|
|
67
|
-
xml += "</settings>\n";
|
|
84
|
+
xml += " </settings>\n";
|
|
68
85
|
}
|
|
69
|
-
xml += "</control>\n";
|
|
86
|
+
xml += type == 'screen' ? "</screen>\n" : "</control>\n";
|
|
70
87
|
return xml;
|
|
71
88
|
}
|
package/www/index.html
CHANGED
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
</button>
|
|
214
214
|
<button data-command="save" title="save" disabled><img src="./node_modules/@node-projects/web-component-designer/assets/icons/save.svg"></button>
|
|
215
215
|
<div style="margin-left: 30px;">
|
|
216
|
-
webui - 1.
|
|
216
|
+
webui - 1.18.0 - ccfc36f
|
|
217
217
|
</div>
|
|
218
218
|
<button style="margin-left: 30px;" data-command="paste" title="paste" disabled><img
|
|
219
219
|
src="./node_modules/@node-projects/web-component-designer/assets/icons/paste.svg"></button>
|