Mergin better performance branch

This commit is contained in:
barsdeveloper
2022-09-04 14:33:22 +02:00
parent 47c15fbf8d
commit 715dee6a5a
97 changed files with 2725 additions and 2833 deletions

View File

@@ -1,6 +1,4 @@
// @ts-check
import html from "./html"
import { html } from "lit"
import IInputPinTemplate from "./IInputPinTemplate"
/**
@@ -14,9 +12,10 @@ export default class BoolPinTemplate extends IInputPinTemplate {
/**
* @param {PinElement} pin
* @param {Map} changedProperties
*/
setup(pin) {
super.setup(pin)
firstUpdated(pin, changedProperties) {
super.firstUpdated(pin, changedProperties)
this.#input = pin.querySelector(".ueb-pin-input")
let self = this
this.onChangeHandler = _ => pin.entity.DefaultValue = self.#input.checked ? "true" : "false"
@@ -38,22 +37,13 @@ export default class BoolPinTemplate extends IInputPinTemplate {
return [this.#input.checked ? "true" : "false"]
}
/**
* @param {PinElement} pin
* @param {String[]?} value
*/
setInputs(pin, value = []) {
pin.entity.DefaultValue = value.length ? value[0] : this.getInput(pin)
this.#input.checked = pin.entity.DefaultValue == "true"
}
/**
* @param {PinElement} pin
*/
renderInput(pin) {
if (pin.isInput()) {
return html`
<input type="checkbox" class="ueb-pin-input" ${pin.entity.DefaultValue == "true" ? "checked" : ""} />
<input type="checkbox" class="ueb-pin-input" .checked=${pin.defaultValue == "true"} />
`
}
return super.renderInput(pin)