@larva.io/webcomponents
Version:
Fentrica SmartUnits WebComponents package
475 lines (474 loc) • 16.9 kB
JavaScript
/*!
* (C) Fentrica http://fentrica.com - Seee LICENSE.md
*/
import { h } from "@stencil/core";
export class InnerRangeArea {
constructor() {
/////// LarvaNode base properties
/**
* Component main icon
*/
this.icon = 'security';
/**
* The color to use from your application's color palette.
* Detrouble options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
*/
this.color = 'primary';
/**
* Allow node indication color automatic change based on feedback/node value. Defaults to false
*/
this.allowIndicationAutoColoring = false;
/**
* Allow node color automatic change based on feedback/node value. Defaults to true
*/
this.allowNodeAutoColoring = true;
/**
* Is logging for this component enabled (lar-log subcomponent loaded)
*/
this.log = false;
/**
* Node size
*/
this.nodeSize = 'default';
/////// LarvaNode base properties and events - end
this.armed = false;
this.alarm = false;
this.loading = true;
}
/**
* Larva error input
*/
async error(data) {
if (this.node) {
this.node.error(data);
}
this.loading = false;
}
/**
* Larva input message
*/
async input(data) {
if (data && data.State) {
this.armed = data.State === 'Armed';
this.loading = false;
}
}
componentDidLoad() {
const el = this.el.shadowRoot || this.el;
this.node = el.querySelector('lar-node');
this.loading = true;
this.output.emit();
}
armDisarm() {
if (this.loading === false) {
this.loading = true;
return this.output.emit({ command: this.armed ? 'disarm' : 'arm' });
}
}
render() {
const iconSmall = this.armed ? 'lock' : 'unlock';
const componentProps = {
onClick: () => this.armDisarm(),
value: this.armed ? 'area.arm' : 'area.disarm',
icon: iconSmall,
disabled: this.loading,
color: this.colorInputs || this.color
};
return [
h("lar-node", { key: '68c1426d8546c37dda212da711fe4525aa8e75f6', value: this.armed ? 'area.armed' : 'area.disarmed', hideTitles: this.hideTitles, iconSmall: iconSmall, icon: this.icon, colorIconSmall: this.alarm && this.allowIndicationAutoColoring === true ? 'danger' : this.colorIconSmall, color: this.alarm && this.allowNodeAutoColoring === true ? 'danger' : this.color, supTitle: this.supTitle, mainTitle: this.mainTitle, subTitle: this.subTitle, colorModal: this.alarm && this.allowNodeAutoColoring === true ? 'danger' : this.colorModal, colorInputs: this.colorInputs, log: this.log, loading: this.loading, nodeSize: this.nodeSize, component: "lar-inner-range-area-door-content", componentProps: componentProps }, h("slot", { key: '943acad917c59f853434db7b8aaa89dcaddc4949' }))
];
}
static get is() { return "lar-inner-range-area"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["inner-range-area.scss"]
};
}
static get styleUrls() {
return {
"$": ["inner-range-area.css"]
};
}
static get properties() {
return {
"icon": {
"type": "string",
"mutable": true,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "Component main icon"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "icon",
"defaultValue": "'security'"
},
"color": {
"type": "string",
"mutable": true,
"complexType": {
"original": "Color",
"resolved": "string",
"references": {
"Color": {
"location": "import",
"path": "../../interface",
"id": "src/interface.d.ts::Color"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "The color to use from your application's color palette.\nDetrouble options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`."
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "color",
"defaultValue": "'primary'"
},
"colorModal": {
"type": "string",
"mutable": true,
"complexType": {
"original": "Color",
"resolved": "string",
"references": {
"Color": {
"location": "import",
"path": "../../interface",
"id": "src/interface.d.ts::Color"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "The color to use from your application's color palette for Components modal window."
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "color-modal"
},
"colorInputs": {
"type": "string",
"mutable": true,
"complexType": {
"original": "Color",
"resolved": "string",
"references": {
"Color": {
"location": "import",
"path": "../../interface",
"id": "src/interface.d.ts::Color"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "The color to use from your application's color palette for inputs"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "color-inputs"
},
"colorIconSmall": {
"type": "string",
"mutable": false,
"complexType": {
"original": "Color",
"resolved": "string",
"references": {
"Color": {
"location": "import",
"path": "../../interface",
"id": "src/interface.d.ts::Color"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "The color to use from your application's color palette for indication icon"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "color-icon-small"
},
"allowIndicationAutoColoring": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Allow node indication color automatic change based on feedback/node value. Defaults to false"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "allow-indication-auto-coloring",
"defaultValue": "false"
},
"allowNodeAutoColoring": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Allow node color automatic change based on feedback/node value. Defaults to true"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "allow-node-auto-coloring",
"defaultValue": "true"
},
"hideTitles": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "Hide node titles"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "hide-titles"
},
"supTitle": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "Component superscript title"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "sup-title"
},
"subTitle": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "Component subtitle"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "sub-title"
},
"log": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Is logging for this component enabled (lar-log subcomponent loaded)"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "log",
"defaultValue": "false"
},
"mainTitle": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": true,
"optional": false,
"docs": {
"tags": [],
"text": "Component main title"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "main-title"
},
"nodeSize": {
"type": "string",
"mutable": false,
"complexType": {
"original": "Size",
"resolved": "\"default\" | \"small\"",
"references": {
"Size": {
"location": "import",
"path": "../../interface",
"id": "src/interface.d.ts::Size"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "Node size"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "node-size",
"defaultValue": "'default'"
}
};
}
static get states() {
return {
"armed": {},
"alarm": {},
"loading": {}
};
}
static get events() {
return [{
"method": "output",
"name": "output",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [{
"name": "see",
"text": "{@link ../readme.md} chapter \"Components input and output\" for further information."
}],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}, {
"method": "request",
"name": "request",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [{
"name": "see",
"text": "{@link ../readme.md} chapter \"Sub-Components requests and responses\" for further information."
}],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}];
}
static get methods() {
return {
"error": {
"complexType": {
"signature": "(data: any) => Promise<void>",
"parameters": [{
"name": "data",
"type": "any",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "Larva error input",
"tags": []
}
},
"input": {
"complexType": {
"signature": "(data: any) => Promise<void>",
"parameters": [{
"name": "data",
"type": "any",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "Larva input message",
"tags": []
}
}
};
}
static get elementRef() { return "el"; }
}
//# sourceMappingURL=inner-range-area.js.map