v4web-components
Version:
Stencil Component Starter
87 lines (86 loc) • 2.55 kB
JavaScript
import { h } from '@stencil/core';
export class LabDsQuantify {
constructor() {
this.maxValue = undefined;
this.value = 0;
}
handleIncreaseValueEmit() {
this.handleCounterValue.emit(this.value + 1);
}
handleDecreaseValueEmit() {
this.handleCounterValue.emit(this.value - 1);
}
render() {
return (h("div", { class: "v4-quantify" }, h("button", { disabled: this.value < 1, onClick: () => this.handleDecreaseValueEmit() }, h("lab-ds-icon-not-selectable", { icon: "remove", size: "small" })), h("div", { class: "v4-quantify-counter" }, h("span", { class: "v4-quantify-option-counter" }, this.value), this.maxValue && h("span", { class: "v4-quantify-option-divides" }, "/"), this.maxValue && h("span", { class: "v4-quantify-option-max-item" }, this.maxValue)), h("button", { disabled: this.value >= this.maxValue, onClick: () => this.handleIncreaseValueEmit() }, h("lab-ds-icon-not-selectable", { icon: "add", size: "small" }))));
}
static get is() { return "lab-ds-quantify"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["lab-ds-quantify.css"]
};
}
static get styleUrls() {
return {
"$": ["lab-ds-quantify.css"]
};
}
static get properties() {
return {
"maxValue": {
"type": "number",
"mutable": false,
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "max-value",
"reflect": false
},
"value": {
"type": "number",
"mutable": false,
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "value",
"reflect": false,
"defaultValue": "0"
}
};
}
static get events() {
return [{
"method": "handleCounterValue",
"name": "handleCounterValue",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
}
}];
}
}
//# sourceMappingURL=lab-ds-quantify.js.map