From 942c02ac4014a6727ae2169f83a05647834d262a Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Sat, 11 Nov 2023 20:18:05 +0100 Subject: [PATCH] Fixed bug where lines didn't show on subsequent pages --- amd/build/report-viewer-components.min.js | 2 +- amd/build/report-viewer-components.min.js.map | 2 +- amd/src/report-viewer-components.js | 52 ++++++++----------- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/amd/build/report-viewer-components.min.js b/amd/build/report-viewer-components.min.js index 85063fe..05aa0d1 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","./treestudyplan-components"],(function(_exports,_simpleline,_str,_stringHelper,_dateHelper,_ajax,_notification,_svgarc,_debugger,_config,_treestudyplanComponents){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);const π=Math.PI;var _default={install(Vue){Vue.use(_treestudyplanComponents.default),new _debugger.default("treestudyplan-viewer").warn(_config.default);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)({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"},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"},pageinfo:{edit:"period_edit",fullname:"studyplan_name",shortname:"studyplan_shortname",startdate:"studyplan_startdate",enddate:"studyplan_enddate",description:"studyplan_description",duration:"studyplan_duration"}});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:{value:{type:Array},guestmode:{type:Boolean,default:!1},teachermode:{type:Boolean,default:!1}},data:()=>({selectedstudyplan:null}),computed:{displayedstudyplan(){return this.selectedstudyplan?this.selectedstudyplan:this.value&&this.value.length>0?this.value[0]:null}},methods:{selectstudyplan(plan){this.selectedstudyplan=plan}},template:"\n
\n \n {{studyplan.name}}\n \n \n
\n "}),Vue.component("r-studyplan",{props:{value:{type:Object},guestmode:{type:Boolean,default:!1},teachermode:{type:Boolean,default:!1}},data:()=>({selectedpageindex:0,text:strings.pageinfo}),computed:{selectedpage(){return this.value.pages[this.selectedpageindex]}},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){this.value.pages[newTabIndex];scrollCurrentIntoView(this.value.id)}},mounted(){scrollCurrentIntoView(this.value.id)},updated(){scrollCurrentIntoView(this.value.id),ItemEventBus.$emit("lineHeightChange",null)},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
\n \x3c!-- First paint the headings--\x3e\n
\n
\n \x3c!-- Next, paint all the cells in the scrollable --\x3e\n
\n
\n \x3c!-- add period information --\x3e\n \n\n \x3c!-- Line by line add the items --\x3e\n \x3c!-- The grid layout handles putting it in rows and columns --\x3e\n