From de8e8199ca4b27b9a4f526d8e40949abb97a0604 Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Fri, 31 May 2024 22:32:43 +0200 Subject: [PATCH] Side bar now has proper scrolling --- amd/build/report-viewer-components.min.js | 2 +- amd/build/report-viewer-components.min.js.map | 2 +- amd/build/studyplan-editor-components.min.js | 2 +- .../studyplan-editor-components.min.js.map | 2 +- amd/build/vue/vue.min.js | 11912 +--------------- amd/build/vue/vue.min.js.map | 1 + amd/src/report-viewer-components.js | 1 - amd/src/studyplan-editor-components.js | 89 +- amd/src/vue/vue.js | 11907 +-------------- css/devstyles.css | 83 +- scss/psidebar.scss | 2 + scss/studyplan.scss | 74 +- styles.css | 83 +- 13 files changed, 282 insertions(+), 23878 deletions(-) create mode 100644 amd/build/vue/vue.min.js.map diff --git a/amd/build/report-viewer-components.min.js b/amd/build/report-viewer-components.min.js index 12274a3..70e18e8 100644 --- a/amd/build/report-viewer-components.min.js +++ b/amd/build/report-viewer-components.min.js @@ -1,3 +1,3 @@ -define("local_treestudyplan/report-viewer-components",["exports","./simpleline/simpleline","core/str","./util/string-helper","./util/date-helper","core/ajax","core/notification","./util/svgarc","./util/debugger","core/config","./studyplan-processor","./treestudyplan-components","./util/premium","./util/fittext-vue"],(function(_exports,_simpleline,_str,_stringHelper,_dateHelper,_ajax,_notification,_svgarc,_debugger,_config,_studyplanProcessor,_treestudyplanComponents,_premium,_fittextVue){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_notification=_interopRequireDefault(_notification),_debugger=_interopRequireDefault(_debugger),_config=_interopRequireDefault(_config),_treestudyplanComponents=_interopRequireDefault(_treestudyplanComponents),_fittextVue=_interopRequireDefault(_fittextVue);const π=Math.PI,ENROLLABLE_SELF=1,ENROLLABLE_ROLE=2,ENROLLABLE_SELF_ROLE=3;var _default={install(Vue){Vue.use(_treestudyplanComponents.default),Vue.use(_fittextVue.default);new _debugger.default("treestudyplan-viewer");let lastCaller=null;function scrollCurrentIntoView(handle){const elCurrentHeader=document.querySelector(".r-studyplan-scrollable").querySelector(".s-studyline-header-period.current");!elCurrentHeader||handle&&handle==lastCaller||(lastCaller=handle,elCurrentHeader.scrollIntoView({behavior:"smooth",block:"start",inline:"center"}))}let strings=(0,_stringHelper.load_strings)({report:{loading:"loadinghelp@core",studyplan_past:"studyplan_past",studyplan_present:"studyplan_present",studyplan_future:"studyplan_future",back:"back"},invalid:{error:"error"},grading:{ungraded:"ungraded",graded:"graded",allgraded:"allgraded",unsubmitted:"unsubmitted",nogrades:"nogrades",unknown:"unknown"},completion:{completed:"completion_completed",incomplete:"completion_incomplete",completed_pass:"completion_passed",completed_fail:"completion_failed",ungraded:"ungraded",aggregation_all:"aggregation_all",aggregation_any:"aggregation_any",aggregation_one:"aggregation_one",aggregation_overall_all:"aggregation_overall_all",aggregation_overall_any:"aggregation_overall_any",aggregation_overall_one:"aggregation_overall_one",completion_not_configured:"completion_not_configured",configure_completion:"configure_completion",view_completion_report:"view_completion_report",completion_incomplete:"completion_incomplete",completion_failed:"completion_failed",completion_pending:"completion_pending",completion_progress:"completion_progress",completion_completed:"completion_completed",completion_good:"completion_good",completion_excellent:"completion_excellent",view_feedback:"view_feedback",coursetiming_past:"coursetiming_past",coursetiming_present:"coursetiming_present",coursetiming_future:"coursetiming_future",required_goal:"required_goal",student_not_tracked:"student_not_tracked",completion_not_enabled:"completion_not_enabled"},badge:{share_badge:"share_badge",dateissued:"dateissued",dateexpire:"dateexpire",badgeinfo:"badgeinfo",badgeissuedstats:"badgeissuedstats",completion_incomplete:"completion_incomplete_badge",completion_completed:"completion_completed_badge",completioninfo:"completioninfo",badgedisabled:"badgedisabled"},course:{completion_incomplete:"completion_incomplete",completion_failed:"completion_failed",completion_pending:"completion_pending",completion_progress:"completion_progress",completion_completed:"completion_completed",completion_good:"completion_good",completion_excellent:"completion_excellent",view_feedback:"view_feedback",coursetiming_past:"coursetiming_past",coursetiming_present:"coursetiming_present",coursetiming_future:"coursetiming_future",required_goal:"required_goal",student_not_tracked:"student_not_tracked",not_enrolled:"not_enrolled",noenddate:"noenddate"},teachercourse:{select_conditions:"select_conditions",select_grades:"select_grades",coursetiming_past:"coursetiming_past",coursetiming_present:"coursetiming_present",coursetiming_future:"coursetiming_future",grade_include:"grade_include",grade_require:"grade_require",required_goal:"required_goal",student_from_plan_enrolled:"student_from_plan_enrolled",students_from_plan_enrolled:"students_from_plan_enrolled",noenddate:"noenddate"},competency:{competency_not_configured:"competency_not_configured",configure_competency:"configure_competency",when:"when",required:"required",points:"points@core_grades",heading:"competency_heading",details:"competency_details",results:"results",unrated:"unrated",progress:"completion_progress",view_feedback:"view_feedback"},pageinfo:{edit:"period_edit",fullname:"studyplan_name",shortname:"studyplan_shortname",startdate:"studyplan_startdate",enddate:"studyplan_enddate",description:"studyplan_description",duration:"studyplan_duration",details:"studyplan_details",overview:"overviewreport:all",oveviewperiod:"overviewreport:period"},lineheader:{cannot_enrol:"line_cannot_enrol",can_enrol:"line_can_enrol",is_enrolled:"line_is_enrolled",enrol:"line_enrol",unenrol:"line_unenrol",enrolled:"line_enrolled",notenrolled:"line_notenrolled",enrol_question:"line_enrol_question",enrollments:"line_enrollments",enrollment:"line_enrollment",info:"info@core",confirm:"confirm@core",yes:"yes@core",no:"no@core",enrolled_in:"line_enrolled_in",since:"since@core",byname:"byname@core",students:"students@core",firstname:"firstname@core",lastname:"lastname@core",email:"email@core",enrol_student_question:"line_enrol_student_question",unenrol_student_question:"line_unenrol_student_question"}});function isVisible(elem){return!!(elem.offsetWidth||elem.offsetHeight||elem.getClientRects().length)}const ItemEventBus=new Vue;Vue.component("r-progress-circle",{props:{value:{type:Number},max:{type:Number,default:100},min:{type:Number,default:0},stroke:{type:Number,default:.2},bgopacity:{type:Number,default:.2},title:{type:String,default:""},icon:{type:String}},data:()=>({selectedstudyplan:null}),computed:{range(){return this.max-this.min},fraction(){return this.max-this.min==0?0:(this.value-this.min)/(this.max-this.min)},radius(){return 50-50*this.stroke},arcpath(){let fraction=0;const r=50-50*this.stroke;this.max-this.min!=0&&(fraction=(this.value-this.min)/(this.max-this.min));const Δ=2*fraction*π;return(0,_svgarc.svgarcpath)([50,50],[r,r],[0,Δ],1.5*π)}},methods:{},template:'\n
\n \n {{title}}\n \n \n \n \n \n \n \n
\n '}),Vue.component("r-report",{props:{invitekey:{type:String,default:()=>null},userid:{type:Number,default:()=>0},type:{type:String,default:()=>"own"}},data:()=>({text:strings.report,studyplans:{past:[],present:[],future:[]},selectedstudyplan:null,loadingstudyplan:!1,loading:!0}),computed:{teachermode(){return"teaching"==this.type},guestmode(){return"invited"==this.type},verified_type(){return["invited","other","teaching","own"].includes(this.type)?this.type:"own"},studyplancount(){return this.studyplans.past.length+this.studyplans.present.length+this.studyplans.future.length}},updated(){},mounted(){this.loadStudyplans()},methods:{call_args(o){const args={};return"object"!=typeof o||Array.isArray(o)||null===o||(0,_studyplanProcessor.objCopy)(args,o),"invited"==this.verified_type?args.invitekey=this.invitekey:"other"==this.verified_type&&(args.userid=this.userid),args},loadStudyplans(){const self=this;this.loading=!0,(0,_ajax.call)([{methodname:`local_treestudyplan_list_${this.verified_type}_studyplans`,args:this.call_args()}])[0].then((function(response){console.info("Loaded: plans",response);const plans={future:[],present:[],past:[]};for(const ix in response){const plan=response[ix];plans[(0,_dateHelper.studyplanTiming)(plan)].push(plan)}for(const ix in plans)plans[ix].sort(((a,b)=>{const t=new Date(b.startdate).getTime()-new Date(a.startdate).getTime();return 0==t&&(t=a.name.localeCompare(b.name)),t}));self.studyplans=plans,self.loading=!1;const parts=window.location.hash.replace("#","").split("-");if(parts&&parts.length>0)for(const k in self.studyplans){const list=self.studyplans[k];for(const idx in list){const plan=list[idx];if(plan.id==parts[0]&&!plan.suspended)return void self.selectStudyplan(plan)}}if(1==this.studyplancount)if(self.studyplans.present.length>0){const plan=self.studyplans.present[0];plan.suspended||self.selectStudyplan(plan)}else if(self.studyplans.future.lengh>0){const plan=self.studyplans.future[0];plan.suspended||self.selectStudyplan(plan)}else{const plan=self.studyplans.past[0];plan.suspended||self.selectStudyplan(plan)}})).catch(_notification.default.exception)},selectStudyplan(plan){const self=this;this.loadingstudyplan=!0,(0,_ajax.call)([{methodname:`local_treestudyplan_get_${this.verified_type}_studyplan`,args:this.call_args({studyplanid:plan.id})}])[0].then((function(response){self.selectedstudyplan=(0,_studyplanProcessor.ProcessStudyplan)(response),self.loadingstudyplan=!1,window.location.hash=self.selectedstudyplan.id})).catch(_notification.default.exception)},deselectStudyplan(){this.selectedstudyplan=null,this.loadStudyplans(),window.location.hash=""}},template:"\n
\n
\n \n
\n "}),Vue.component("r-studyplan",{props:{value:{type:Object},guestmode:{type:Boolean,default:!1},teachermode:{type:Boolean,default:!1},coaching:{type:Boolean,default:!1}},data:()=>({selectedpageindex:-1,text:strings.pageinfo}),computed:{selectedpage(){return this.value.pages[this.selectedpageindex]},startpageindex(){let startpageindex=0,firststart=null;for(const ix in this.value.pages){const page=this.value.pages[ix];if("present"==(0,_dateHelper.studyplanPageTiming)(page)){const s=new Date(page.startdate);(!firststart||firststart>s)&&(startpageindex=ix,firststart=s)}}return startpageindex},wwwroot:()=>_config.default.wwwroot},methods:{pageduration:page=>(0,_dateHelper.format_date)(page.startdate,!1)+" - "+(0,_dateHelper.format_date)(page.enddate,!1),columns:page=>1+2*page.periods,columns_stylerule(page){let s="grid-template-columns: var(--studyplan-filter-width)";for(let i=0;imaxLayer&&(maxLayer=item.layer)}for(const ix in line.slots[i].filters){const item=line.slots[i].filters[ix];item.layer>maxLayer&&(maxLayer=item.layer)}}return maxLayer>=0?maxLayer+1:1},showslot(page,line,index,layeridx,type){const forGradable="gradable"==type,periods=page.periods;let show=!0;for(let i=0;i0&&item.span-i>0&&(show=!1):item.span-i>1&&(show=!1))}}return show},selectedpageChanged(newTabIndex,prevTabIndex){ItemEventBus.$emit("redrawLines",null),scrollCurrentIntoView(this.selectedpage.id)}},mounted(){this.$root.$emit("redrawLines")},updated(){scrollCurrentIntoView(this.selectedpage.id),ItemEventBus.$emit("lineHeightChange",null),this.$root.$emit("redrawLines"),ItemEventBus.$emit("redrawLines")},template:'\n
\n \n \n \n \n \n \n \n \n {{ text.shortname}}\n \n {{ page.shortname }}\n \n \n \n {{ text.duration}}\n \n {{ pageduration(page) }}\n \n \n \n {{ text.description}}\n \n \n \n \n \n \n \n \n