moodle_local_treestudyplan/amd/build/util/psidebar-vue.min.js.map
2024-04-21 23:08:03 +02:00

1 line
6.9 KiB
Plaintext

{"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);\n this.setOffset(this.offsetRef);\n this.rePosition(this.right,this.besides);\n this.resizeObserver = new ResizeObserver(() => {\n let wx = 0 - el.getBoundingClientRect().width;\n wx += (wx!=0)?\"px\":\"\";\n el.style.setProperty(\"--p-sidebar-hideoffset\",wx);\n });\n this.resizeObserver.observe(el);\n },\n unmounted() {\n if(this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n },\n template: `\n <div>\n <div ref='container' \n :class=\"'p-sidebar ' + (right?'p-sidebar-right ':'') + (shadow?'p-sidebar-shadow ':'') + (value?'shown ':'hidden ')\"\n ><slot></slot></div>\n </div>\n `,\n });\n },\n};"],"names":["install","Vue","component","props","value","type","Boolean","default","right","shadow","target","String","offsetRef","data","wrapper","contentwrapper","resizeobserver","computed","methods","initWrappers","document","querySelector","this","createElement","setAttribute","appendChild","targetEl","console","info","nodeType","childNodes","length","rePosition","el","$refs","container","insertBefore","nextSibling","setOffset","reference","ref","offsetTop","style","height","marginTop","watch","newVal","mounted","besides","resizeObserver","ResizeObserver","wx","getBoundingClientRect","width","setProperty","observe","unmounted","disconnect","template"],"mappings":"kMAQe,CACXA,QAAQC,KACJA,IAAIC,UAAU,YAAY,CAC1BC,MAAO,CACHC,MAAO,CACHC,KAAMC,QACNC,SAAS,GAEbC,MAAO,CACHH,KAA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