mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-16 10:54:42 +08:00
Color picker improvements
This commit is contained in:
@@ -15,7 +15,7 @@ export default class BoolPinTemplate extends PinTemplate {
|
||||
super.firstUpdated(changedProperties)
|
||||
this.#input = this.element.querySelector(".ueb-pin-input")
|
||||
let self = this
|
||||
this.onChangeHandler = _ => this.element.setDefaultValue(self.#input.checked ? true : false)
|
||||
this.onChangeHandler = _ => this.element.setDefaultValue(self.#input.checked)
|
||||
this.#input.addEventListener("change", this.onChangeHandler)
|
||||
}
|
||||
|
||||
@@ -31,22 +31,10 @@ export default class BoolPinTemplate extends PinTemplate {
|
||||
]
|
||||
}
|
||||
|
||||
getInputs() {
|
||||
return [this.#input.checked ? "true" : "false"]
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Boolean[]} values
|
||||
* @param {String[]} rawValues
|
||||
*/
|
||||
setDefaultValue(values = [], rawValues) {
|
||||
this.element.setDefaultValue(values[0])
|
||||
}
|
||||
|
||||
renderInput() {
|
||||
if (this.element.isInput()) {
|
||||
return html`
|
||||
<input type="checkbox" class="ueb-pin-input" checked="${this.element.defaultValue ? "" : nothing}" />
|
||||
<input type="checkbox" class="ueb-pin-input" ?checked="${this.element.defaultValue ? "" : nothing}" />
|
||||
`
|
||||
}
|
||||
return super.renderInput()
|
||||
|
||||
Reference in New Issue
Block a user