@conectate/ct-checkbox
Advanced tools
Comparing version 3.12.1 to 3.12.2
@@ -14,3 +14,3 @@ import "@conectate/ct-icon"; | ||
export declare class CtCheckbox extends CtLit { | ||
indeterminate?: boolean; | ||
indeterminate: boolean; | ||
disabled: boolean; | ||
@@ -27,2 +27,3 @@ checked: boolean; | ||
toogleCheck(): void; | ||
private handleChange; | ||
change(): void; | ||
@@ -29,0 +30,0 @@ } |
@@ -17,2 +17,3 @@ import { __decorate } from "tslib"; | ||
super(...arguments); | ||
this.indeterminate = false; | ||
this.disabled = false; | ||
@@ -144,3 +145,3 @@ this.checked = false; | ||
return html ` | ||
<input id="input" type="checkbox" @click=${this.toogleCheck} .checked=${this.checked} .disabled=${this.disabled} /> | ||
<input id="input" type="checkbox" @click=${this.toogleCheck} .checked=${this.checked} .disabled=${this.disabled} @change=${this.handleChange} /> | ||
<div class="c"> | ||
@@ -171,2 +172,8 @@ <span id="box"> | ||
} | ||
handleChange(event) { | ||
const target = event.target; | ||
this.checked = target.checked; | ||
this.indeterminate = target.indeterminate; | ||
redispatchEvent(this, event); | ||
} | ||
change() { | ||
@@ -203,1 +210,10 @@ if (this.checked) | ||
export { CtCheckbox }; | ||
function redispatchEvent(wc, event) { | ||
if (event.bubbles && (!wc.shadowRoot || event.composed)) | ||
event.stopPropagation(); | ||
const copy = Reflect.construct(event.constructor, [event.type, event]); | ||
const dispatched = wc.dispatchEvent(copy); | ||
if (!dispatched) | ||
event.preventDefault(); | ||
return dispatched; | ||
} |
{ | ||
"name": "@conectate/ct-checkbox", | ||
"version": "3.12.1", | ||
"version": "3.12.2", | ||
"description": "HTML checkbox web component based on Material design", | ||
@@ -45,3 +45,3 @@ "main": "ct-checkbox.js", | ||
}, | ||
"gitHead": "253f2b158bcb209f7399053597b3b708df06d388" | ||
"gitHead": "2dc5e0654aba1106ed4e502d2ae9ca6cb5906dd0" | ||
} |
10500
246