moodle_local_treestudyplan/amd/build/util/psidebar-vue.min.js.map
2024-05-10 15:22:52 +02:00

1 line
7.5 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 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 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":["debug","install","Vue","component","props","value","type","Boolean","default","right","shadow","target","String","offsetRef","data","wrapper","contentwrapper","resizeobserver","computed","methods","initWrappers","initializeWrapperContent","document","querySelector","this","createElement","setAttribute","appendChild","targetEl","console","info","nodeType","warn","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":"kMAOIA,MAAQ,yEAAa,0BAEV,CACXC,QAAQC,KACJA,IAAIC,UAAU,YAAY,CAC1BC,MAAO,CACHC,MAAO,CACHC,KAAMC,QACNC,SAAS,GAEbC,MAAO,CACHH,KAAMC,QACNC,SAAS,GAEbE,OAAQ,CACJJ,KAAMC,QACNC,SAAS,GAEbG,OAAQ,CACJL,KAAMM,OACNJ,QAAS,QAEbK,UAAW,CACPP,KAAMM,OACNJ,QAAS,KAGjBM,KAAI,KACO,CACHC,QAAS,KACTC,eAAgB,KAChBC,eAAgB,OAGxBC,SAAU,GAEVC,QAAS,CACLC,aAAaT,YACLU,0BAA2B,UAG1BN,QAAUO,SAASC,cAAc,sBACjCC,KAAKT,UACNM,0BAA2B,OAEtBN,QAAUO,SAASG,cAAc,YACjCV,QAAQW,aAAa,KAAK,2BAG9BV,eAAiBM,SAASC,cAAc,6BACxCC,KAAKR,iBACNK,0BAA2B,OAEtBL,eAAiBM,SAASG,cAAc,YACxCT,eAAeU,aAAa,KAAK,iCACjCX,QAAQY,YAAYH,KAAKR,iBAG9BK,yBAA0B,KAEtBO,SAAWN,SAASC,cAAcZ,YAClCkB,QAAQC,KAAM,cAAanB,cAAciB,UACxCA,UAAiC,QAArBA,SAASG,WACtBH,SAAWN,SAASC,cAAc,SAEtCvB,MAAMgC,KAAM,gDAA+CJ,UAEpDA,SAASK,WAAWC,OAAQ,QAC1BlB,eAAeW,YAAYC,SAASK,WAAW,IAGxDL,SAASD,YAAYH,KAAKT,WAIlCoB,WAAW1B,aAED2B,GAAKZ,KAAKa,MAAMC,UACnB7B,WACMM,QAAQwB,aAAaH,GAAGZ,KAAKR,eAAewB,kBAE5CzB,QAAQwB,aAAaH,GAAGZ,KAAKR,iBAG1CyB,UAAUC,iBACAC,IAAMD,UAAUpB,SAASC,cAAcmB,WAAW,KACxDb,QAAQC,KAAM,wBAAuBY,aAAaC,SAC9CC,UAAaD,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