collective-webcomponents
Version:
Stencil Component Starter
40 lines (39 loc) • 1.41 kB
JavaScript
export class CollectiveProductsChooserButton {
constructor() {
this.showSearch = false;
}
valueChanged() {
if (this.productsChooser) {
this.productsChooser.value = this.value;
}
}
render() {
return (h("div", null,
h("ion-button", { onClick: () => {
this.showSearch = !this.showSearch;
}, color: this.showSearch ? "light" : "primary" }, this.showSearch ? "Collapse" : "Choose products"),
this.showSearch && (h("collective-products-chooser", { style: { height: "500px", width: "100%" }, value: this.value, onChange: (event) => this.change.emit(event.detail) }))));
}
static get is() { return "collective-products-chooser-button"; }
static get properties() { return {
"element": {
"elementRef": true
},
"showSearch": {
"state": true
},
"value": {
"type": "Any",
"attr": "value",
"watchCallbacks": ["valueChanged"]
}
}; }
static get events() { return [{
"name": "change",
"method": "change",
"bubbles": true,
"cancelable": true,
"composed": true
}]; }
static get style() { return "/**style-placeholder:collective-products-chooser-button:**/"; }
}