moodle_local_treestudyplan/amd/build/util/psidebar-vue.min.js.map

1 line
6.9 KiB
Plaintext
Raw Normal View History

2024-04-21 23:08:03 +02:00
{"version":3,"file":"psidebar-vue.min.js","sources":["../../src/util/psidebar-vue.js"],"sourcesContent":["/*eslint no-unused-vars: warn */\n/*eslint max-len: [\"error\", { \"code\": 160 }] */\n/*eslint-disable no-trailing-spaces */\n/*eslint-disable no-console */\n/*eslint-env es6*/\n\nimport {calc} from \"./css-calc\";\n\nexport default {\n install(Vue/*,options*/){\n Vue.component('p-sidebar',{\n props: {\n value: {\n type: Boolean,\n default: true,\n },\n right: {\n type: Boolean,\n default: false,\n },\n shadow: {\n type: Boolean,\n default: false,\n },\n target: {\n type: String,\n default: 'body',\n },\n offsetRef: {\n type: String,\n default: '',\n }\n },\n data() {\n return {\n wrapper: null,\n contentwrapper: null,\n resizeobserver: null,\n };\n },\n computed: {\n },\n methods: {\n initWrappers(target) {\n // First check if the sidebar wrapper already exists.\n this.wrapper = document.querySelector(\"#p-sidebar-wrapper\");\n if (! this.wrapper) {\n // Otherwise, create it.\n this.wrapper = document.createElement(\"div\");\n this.wrapper.setAttribute(\"id\",\"p-sidebar-wrapper\");\n }\n // First check if the contentwrapper already exists\n this.contentwrapper = document.querySelector(\"#p-sidebar-contentwrapper\");\n if (!this.contentwrapper) {\n // Otherwise, create it.\n this.contentwrapper = document.createElement(\"div\");\n this.contentwrapper.setAttribute(\"id\",\"p-sidebar-contentwrapper\");\n this.wrapper.appendChild(this.contentwrapper);\n }\n\n // Find containing target (otherwise use body)\n let targetEl = document.querySelector(target);\n console.info(`Targeting '${target}' to `,targetEl);\n if (!targetEl || targetEl.nodeType == \"HTML\") {\n targetEl = document.querySelector(\"body\");\n }\n // Move all target content parts to content wrapper....\n while (targetEl.childNodes.length >0) {\n this.contentwrapper.appendChild(targetEl.childNodes[0]);\n }\n // Add sidebar wrapper to target Element\n targetEl.appendChild(this.wrapper);\n \n },\n rePosition(right) {\n // Place the container elsewhere in the DOM.\n const el = this.$refs.container;\n\n\n if(right) {\n this.wrapper.insertBefore(el,this.contentwrapper.nextSibling);\n } else {\n this.wrapper.insertBefore(el,this.contentwrapper);\n }\n },\n setOffset(reference) {\n const ref = reference?document.querySelector(reference):null;\n console.info(`Setting offset from '${reference}'`,ref);\n let offsetTop = (ref?ref.offsetTop:0);\n offsetTop+=(offsetTop!=0)?\"px\":\"\";\n const el = this.$refs.container;\n el.style.height=`calc( 100vh - ${offsetTop})`;\n el.style.marginTop=offsetTop;\n }\n\n },\n watch: {\n right(newVal) {\n this.rePosition(newVal);\n },\n offsetRef(reference) {\n this.setOffset(reference);\n }\n },\n mounted() {\n const self = this;\n const el = self.$refs.container;\n this.initWrappers(this.target)