platypush/platypush/backend/http/webapp/dist/static/js/chunk-4b03f49b.2f384634.js.map

1 line
6.9 KiB
Plaintext

{"version":3,"sources":["webpack:///./src/components/panels/Switches/Switch.vue","webpack:///./src/components/panels/Switches/Switch.vue?75fc","webpack:///./src/components/panels/Switches/Switch.vue?3142","webpack:///./src/components/panels/Switches/Mixin.vue","webpack:///./src/components/panels/Switches/Mixin.vue?618b"],"names":["class","onToggle","loading","hasInfo","onInfo","disabled","value","state","name","components","Loading","ToggleSwitch","emits","props","type","String","required","Boolean","default","methods","event","stopPropagation","this","$emit","render","__scopeId","mixins","Utils","pluginName","bus","Object","config","selected","data","initialized","selectedDevice","devices","onRefreshEvent","refresh","toggle","device","request","response","on","reduce","obj","length","id","mounted","$watch","newValue","unmounted","off"],"mappings":"yNAGSA,MAAM,iC,EAEP,eAAwB,KAArBA,MAAM,cAAY,S,GAIpBA,MAAM,mC,yIARb,eAWM,OAXDA,MAAM,SAAU,QAAK,8CAAO,EAAAC,SAAA,qBAAQ,Y,CACxB,EAAAC,S,iBAAf,eAA0B,Y,sBAC1B,eAKM,MALN,EAKM,CAJU,EAAAC,S,iBAAd,eAES,U,MAFe,QAAK,8CAAU,EAAAC,OAAA,qBAAM,e,CAC3C,K,sBAEF,eAA2C,QAArCJ,MAAM,e,YAAe,eAAa,EAAD,O,0BAEzC,eAEM,MAFN,EAEM,CADJ,eAAqE,GAAtDK,SAAU,EAAAH,QAAUI,MAAO,EAAAC,MAAQ,QAAO,EAAAN,U,sEAShD,GACbO,KAAM,SACNC,WAAY,CAACC,UAAA,KAASC,eAAA,MACtBC,MAAO,CAAC,SAAU,QAElBC,MAAO,CACLL,KAAM,CACJM,KAAMC,OACNC,UAAU,GAGZT,MAAO,CACLO,KAAMG,QACNC,SAAS,GAGXhB,QAAS,CACPY,KAAMG,QACNC,SAAS,GAGXf,QAAS,CACPW,KAAMG,QACNC,SAAS,IAIbC,QAAS,CACPf,OADO,SACAgB,GAGL,OAFAA,EAAMC,kBACNC,KAA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ElB","file":"static/js/chunk-4b03f49b.2f384634.js","sourcesContent":["<template>\n <div class=\"switch\" @click.stop=\"onToggle\">\n <Loading v-if=\"loading\" />\n <div class=\"name col-l-10 col-m-9 col-s-8\">\n <button v-if=\"hasInfo\" @click.prevent=\"onInfo\">\n <i class=\"fa fa-info\" />\n </button>\n <span class=\"name-content\" v-text=\"name\" />\n </div>\n <div class=\"toggler col-l-2 col-m-3 col-s-4\">\n <ToggleSwitch :disabled=\"loading\" :value=\"state\" @input=\"onToggle\" />\n </div>\n </div>\n</template>\n\n<script>\nimport ToggleSwitch from \"@/components/elements/ToggleSwitch\";\nimport Loading from \"@/components/Loading\";\n\nexport default {\n name: \"Switch\",\n components: {Loading, ToggleSwitch},\n emits: ['toggle', 'info'],\n\n props: {\n name: {\n type: String,\n required: true,\n },\n\n state: {\n type: Boolean,\n default: false,\n },\n\n loading: {\n type: Boolean,\n default: false,\n },\n\n hasInfo: {\n type: Boolean,\n default: false,\n },\n },\n\n methods: {\n onInfo(event) {\n event.stopPropagation()\n this.$emit('info')\n return false\n },\n\n onToggle(event) {\n event.stopPropagation()\n this.$emit('toggle')\n return false\n },\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.switch {\n width: 100%;\n display: flex;\n position: relative;\n align-items: center;\n padding: .75em .5em;\n border-bottom: $default-border-2;\n cursor: pointer;\n\n &:hover {\n background: $hover-bg;\n }\n\n .toggler {\n text-align: right;\n }\n\n button {\n background: none;\n border: none;\n\n &:hover {\n color: $default-hover-fg-2;\n }\n }\n}\n</style>\n","import { render } from \"./Switch.vue?vue&type=template&id=755a3c5f&scoped=true\"\nimport script from \"./Switch.vue?vue&type=script&lang=js\"\nexport * from \"./Switch.vue?vue&type=script&lang=js\"\n\nimport \"./Switch.vue?vue&type=style&index=0&id=755a3c5f&lang=scss&scoped=true\"\nscript.render = render\nscript.__scopeId = \"data-v-755a3c5f\"\n\nexport default script","export * from \"-!../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader-v16/dist/index.js??ref--0-1!./Switch.vue?vue&type=style&index=0&id=755a3c5f&lang=scss&scoped=true\"","<script>\nimport Utils from \"@/Utils\";\n\nexport default {\n name: \"SwitchesMixin\",\n mixins: [Utils],\n\n props: {\n pluginName: {\n type: String,\n required: true,\n },\n\n bus: {\n type: Object,\n required: true,\n },\n\n config: {\n type: Object,\n default: () => { return {} },\n },\n\n selected: {\n type: Boolean,\n default: false,\n }\n },\n\n data() {\n return {\n loading: false,\n initialized: false,\n selectedDevice: null,\n devices: {},\n }\n },\n\n methods: {\n onRefreshEvent(pluginName) {\n if (pluginName !== this.pluginName)\n return\n\n this.refresh()\n },\n\n async toggle(device) {\n const response = await this.request(`${this.pluginName}.toggle`, {device: device})\n this.devices[device].on = response.on\n },\n\n async refresh() {\n this.loading = true\n try {\n this.devices = (await this.request(`${this.pluginName}.switch_status`)).reduce((obj, device) => {\n const name = device.name?.length ? device.name : device.id\n obj[name] = device\n return obj\n }, {})\n } finally {\n this.loading = false\n }\n }\n },\n\n mounted() {\n this.$watch(() => this.selected, (newValue) => {\n if (newValue && !this.initialized) {\n this.refresh()\n this.initialized = true\n }\n })\n\n this.bus.on('refresh', this.onRefreshEvent)\n },\n\n unmounted() {\n this.bus.off('refresh', this.onRefreshEvent)\n },\n}\n</script>\n","import script from \"./Mixin.vue?vue&type=script&lang=js\"\nexport * from \"./Mixin.vue?vue&type=script&lang=js\"\n\nexport default script"],"sourceRoot":""}