Allow to restore the selection by setting the value.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tp/tp-multi-toggle",
|
"name": "@tp/tp-multi-toggle",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "tp-multi-toggle.js",
|
"main": "tp-multi-toggle.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -62,6 +62,16 @@ class TpMultiToggle extends FormElement(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set value(val) {
|
||||||
|
this.querySelectorAll('tp-button').forEach(el => {
|
||||||
|
if (el.getAttribute(this.attr || 'id') === val) {
|
||||||
|
el.setAttribute('selected', '');
|
||||||
|
} else {
|
||||||
|
el.removeAttribute('selected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.boundClick = this.onClick.bind(this);
|
this.boundClick = this.onClick.bind(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user