@larva.io/webcomponents
Version:
Fentrica SmartUnits WebComponents package
197 lines (196 loc) • 7.14 kB
JavaScript
/*!
* (C) Fentrica http://fentrica.com - Seee LICENSE.md
*/
import { h } from "@stencil/core";
import { createModal } from "../modal/modal-controller";
export class NodeMoreButtons {
constructor() {
this.log = false;
}
/**
* Request response method
*/
async response(data) {
var _a;
switch (data.topic) {
case 'iot-2/evt/getNodeLogs/fmt/json':
if (this.logmodal) {
(await this.logmodal.getComponent()).element
.response((_a = data.payload) === null || _a === void 0 ? void 0 : _a.data);
}
break;
}
}
async openLogModal() {
this.logmodal = await createModal({
mainTitle: 'log.log',
color: this.colorModal || this.colorInputs,
animation: 'bottom',
iconSmall: 'loading',
colorHeaderInputs: this.colorInputs,
icon: 'log',
headerSize: 'small',
component: 'lar-log-modal',
componentProps: {
onRequest: (event) => this.request.emit({
topic: 'iot-2/cmd/getNodeLogs/fmt/json',
payload: {
// reqId ?
data: event.detail
}
}), // pass request event
}
});
await this.logmodal.present();
}
async disconnectedCallback() {
var _a;
return (_a = this.logmodal) === null || _a === void 0 ? void 0 : _a.dismiss();
}
render() {
return (h("div", { key: '05d81daf8acaf8a2c0b664ad5ab7cfba5ab7cff6' }, h("div", { key: '43e9671f1aaa89301bcde7a664c7f264db3a0b95', class: "spacer" }), (this.log || this.log)
&&
h("div", { key: 'fd4ff8b40f116fd068ce79f6aeb899c56c789b48' }, h("lar-list-header", { key: 'f543748aebdde501963c945dcbf9d3055cba0df3' }, h("lar-translate", { key: '1b5a1804890cddb255f3e0cc109676361c275a77', t: "node.more" })), h("div", { key: '1a36fab390be15e9dcbac8f3ea2895e3e70f1155', class: "spacer" })), h("lar-button-group", { key: '8c8a50ec31790da5aedab2a44fd0882a576c896e' }, this.log &&
h("lar-button", { key: '280631daa7f0fbb6f18b0b43c4deca7ae009e4a1', color: (this.colorInputs) === 'dark' ? 'light' : 'dark', expand: "full", onClick: () => this.openLogModal() }, h("lar-translate", { key: 'edf88bac2bc52392607ea59df835877b4126a821', t: "log.log" })))));
}
static get is() { return "lar-node-more-buttons"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["node.scss"]
};
}
static get styleUrls() {
return {
"$": ["node.css"]
};
}
static get properties() {
return {
"colorInputs": {
"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": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "color-inputs"
},
"colorModal": {
"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": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "color-modal"
},
"log": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "log",
"defaultValue": "false"
}
};
}
static get events() {
return [{
"method": "request",
"name": "request",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": "Larva sub-components request event"
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}];
}
static get methods() {
return {
"response": {
"complexType": {
"signature": "(data: InputResponse) => Promise<void>",
"parameters": [{
"name": "data",
"type": "InputResponse",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
},
"InputResponse": {
"location": "import",
"path": "./node-interface",
"id": "src/components/internal/node/node-interface.tsx::InputResponse"
},
"HTMLLarLogModalElement": {
"location": "global",
"id": "global::HTMLLarLogModalElement"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "Request response method",
"tags": []
}
}
};
}
static get elementRef() { return "el"; }
}
//# sourceMappingURL=node-more-buttons.js.map