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

1 line
7.5 KiB
Plaintext
Raw Normal View History

2024-06-03 23:24:16 +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 Debugger from './debugger';\nlet debug = new Debugger(\"p-sidebar\");\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 let initializeWrapperContent = false;\n // First check if the sidebar wrapper already exists. \n // Creating the wrappers over and over again is a recipe for disaster.\n this.wrapper = document.querySelector(\"#p-sidebar-wrapper\");\n if (!this.wrapper) {\n initializeWrapperContent = true;\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 initializeWrapperContent = true;\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 if (initializeWrapperContent) {\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 debug.warn(`Initializing wrappers with content of target `, targetEl);\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 },\n rePosition(right) {\n // Place the container elsewhere in the DOM.\n const el = this.$refs.container;\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