Skip to content

Commit

Permalink
compiled code
Browse files Browse the repository at this point in the history
  • Loading branch information
jogibear9988 committed Sep 20, 2023
1 parent a375463 commit 5499541
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
2 changes: 2 additions & 0 deletions www/dist/frontend/config/ConfigureWebcomponentDesigner.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ serviceContainer.config.openBindingsEditor = async (property, designItems, bindi
}
bnd.converter = cObj;
}
if (dynEdt.events)
bnd.events = dynEdt.events.split(';');
let serializedBnd = IobrokerWebuiBindingsHelper.serializeBinding(designItems[0].element, property.name, bnd);
let group = designItems[0].openGroup('edit_binding');
designItems[0].setAttribute(serializedBnd[0], serializedBnd[1]);
Expand Down
13 changes: 12 additions & 1 deletion www/dist/frontend/config/IobrokerWebuiDynamicsEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class IobrokerWebuiDynamicsEditor extends BaseCustomWebComponentConstruct
this.twoWay = false;
this.expression = '';
this.objectNames = '';
this.events = '';
this.invert = false;
this.converters = [];
this._activeRow = -1;
Expand All @@ -33,6 +34,8 @@ export class IobrokerWebuiDynamicsEditor extends BaseCustomWebComponentConstruct
this.converters.push({ key: c, value: this._binding.converter[c] });
}
}
if (this._binding.changedEvents && this._binding.changedEvents.length)
this.events = this._binding.changedEvents.join(';');
}
this._bindingsParse();
}
Expand All @@ -50,6 +53,11 @@ export class IobrokerWebuiDynamicsEditor extends BaseCustomWebComponentConstruct
this.objectNames = '';
this._bindingsRefresh();
}
_refresh() {
requestAnimationFrame(() => {
this._bindingsRefresh();
});
}
async _select() {
let b = new BindableObjectsBrowser();
b.initialize(window.appShell.serviceContainer);
Expand Down Expand Up @@ -106,8 +114,10 @@ IobrokerWebuiDynamicsEditor.template = html `
</select>
</div>
<div class="row">
<input type="checkbox" disabled="[[!this.twoWayPossible]]" checked="{{this.twoWay::change}}">
<input type="checkbox" disabled="[[!this.twoWayPossible]]" checked="{{this.twoWay::change}}" @change="_refresh">
<span>two way binding</span>
<span style="margin-left: 15px">events:&nbsp;</span>
<input title="to use multiple events, seprate them with semicolon (;)" class="row" disabled="[[!this.twoWay]]" value="{{?this.events::change}}" style="flex-grow: 1; margin-right: 10px;">
</div>
<div class="row">
<input type="checkbox" checked="{{this.invert::change}}">
Expand Down Expand Up @@ -226,6 +236,7 @@ IobrokerWebuiDynamicsEditor.properties = {
twoWay: Boolean,
expression: String,
objectNames: String,
events: String,
invert: Boolean,
converters: Array
};
Expand Down
13 changes: 8 additions & 5 deletions www/dist/frontend/helper/IobrokerWebuiBindingsHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class IobrokerWebuiBindingsHelper {
binding.twoWay = true;
if (element instanceof HTMLInputElement)
binding.events = ['change'];
else if (element instanceof HTMLInputElement)
else if (element instanceof HTMLSelectElement)
binding.events = ['change'];
else
binding.events = [propname + '-changed'];
Expand All @@ -107,7 +107,7 @@ export class IobrokerWebuiBindingsHelper {
if (binding.twoWay && (binding.events == null || binding.events.length == 0)) {
if (element instanceof HTMLInputElement)
binding.events = ['change'];
else if (element instanceof HTMLInputElement)
else if (element instanceof HTMLSelectElement)
binding.events = ['change'];
else
binding.events = [propname + '-changed'];
Expand Down Expand Up @@ -141,12 +141,15 @@ export class IobrokerWebuiBindingsHelper {
return [bindingPrefixCss + PropertiesHelper.camelToDashCase(targetName), (binding.inverted ? '!' : '') + binding.signal];
}
let bindingCopy = { ...binding };
if (!binding.twoWay || (binding.events != null && binding.events.length == 1)) {
if (!binding.twoWay) {
delete bindingCopy.events;
}
else if ((binding.events != null && binding.events.length == 1)) {
if (element instanceof HTMLInputElement && binding.events?.[0] == "change")
delete bindingCopy.events;
else if (element instanceof HTMLInputElement && binding.events?.[0] == "change")
else if (element instanceof HTMLSelectElement && binding.events?.[0] == "change")
delete bindingCopy.events;
else if (element instanceof HTMLInputElement && binding.events?.[0] == targetName + '-changed')
else if (binding.events?.[0] == targetName + '-changed')
delete bindingCopy.events;
}
if (binding.expression === null || binding.expression === '') {
Expand Down
3 changes: 2 additions & 1 deletion www/dist/frontend/services/IobrokerWebuiBindingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export class IobrokerWebuiBindingService {
bindableObjectNames: x[1].signal.split(';'),
expression: x[1].expression,
converter: x[1].converter,
type: x[1].type
type: x[1].type,
changedEvents: x[1].events
}));
}
setBinding(designItem, binding) {
Expand Down
4 changes: 2 additions & 2 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@
webui
</div>
<div style="font-size: 10px;">
version: 0.12.0
version: 0.12.1
</div>
<div style="font-size: 10px;">
hash: e3016df
hash: a375463
</div>
<span class="title">Version</span>
</div>
Expand Down

0 comments on commit 5499541

Please sign in to comment.