mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-15 09:44:49 +08:00
Dropdown implementation, switch refactoring
* Various fixes * Fix tests * Dropdown names deduced from pin names * Remove update callbacks * Fix double pins issue * return undefined if not switch
This commit is contained in:
37
js/element/DropdownElement.js
Normal file
37
js/element/DropdownElement.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import DropdownTemplate from "../template/pin/DropdownTemplate.js"
|
||||
import IElement from "./IElement.js"
|
||||
|
||||
/** @extends {IElement<Object, DropdownTemplate>} */
|
||||
export default class DropdownElement extends IElement {
|
||||
|
||||
static properties = {
|
||||
...super.properties,
|
||||
options: {
|
||||
type: Object,
|
||||
},
|
||||
selected: {
|
||||
type: String,
|
||||
},
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
super.initialize({}, new DropdownTemplate())
|
||||
this.options = /** @type {[String, String][]} */([])
|
||||
this.selected = ""
|
||||
}
|
||||
|
||||
/** @param {[String, String][]} options */
|
||||
static newObject(options) {
|
||||
const result = new DropdownElement()
|
||||
return result
|
||||
}
|
||||
|
||||
initialize() {
|
||||
// Initialized in the constructor, this method does nothing
|
||||
}
|
||||
|
||||
getValue() {
|
||||
return this.template.getSelectedValue()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user