Files
ueblueprint/js/template/pin/BoolPinTemplate.js
BarsDev 6ba2705386 Large refactoring and new nodes
* Fix node reference when changing elements

* Fix ScriptVariables parsing

* Fix invariant text and niagara types

* Niagara convert nodes

* Move node tests to own files

* More Niagara tests

* Niagara float and smaller fixes

* More Decoding

* More decoding

* WIP

* Float is real

* WIP

* More types and colors

* Test case and small polish

* WIP

* WIP

* Fix niagara script variables merging

* Fix Niagara variables

* Fixing mirrored ExportPath

* Fix Export paths name adjustments

* Simplify arc calculation

* Simplify a bit arc calculation

* source / destionation => origin / target

* Minor refactoring

* Fix switched link position

* Rename some properties for uniformity

* Fix input escape

* Simplify test

* About window

* Dialog backdrop style

* About dialog touches

* Remove dependency and minot improvement

* Light mode

* Fix link location and css small improvement

* Link direction and minor fixes

* Some minor fixes and refactoring

* Refactoring WIP

* Shorting repetitive bits

* More tests

* Simplify linking tests
2025-02-07 00:36:03 +02:00

49 lines
1.3 KiB
JavaScript
Executable File

import { html } from "lit"
import BooleanEntity from "../../entity/BooleanEntity.js"
import MouseIgnore from "../../input/mouse/MouseIgnore.js"
import PinTemplate from "./PinTemplate.js"
/** @extends PinTemplate<BooleanEntity> */
export default class BoolPinTemplate extends PinTemplate {
/** @type {HTMLInputElement?} */
#input
#onChangeHandler = () => {
const entity = this.element.getDefaultValue(true)
entity.value = this.#input.checked
this.element.setDefaultValue(entity)
}
/** @param {PropertyValues} changedProperties */
firstUpdated(changedProperties) {
super.firstUpdated(changedProperties)
this.#input = this.element.querySelector(".ueb-pin-input")
}
setup() {
super.setup()
this.#input?.addEventListener("change", this.#onChangeHandler)
}
cleanup() {
super.cleanup()
this.#input?.removeEventListener("change", this.#onChangeHandler)
}
createInputObjects() {
return [
...super.createInputObjects(),
new MouseIgnore(this.#input, this.blueprint),
]
}
renderInput() {
return html`
<input type="checkbox" class="ueb-pin-input-wrapper ueb-pin-input"
?checked="${this.element.defaultValue?.valueOf() === true}"
/>
`
}
}