@mjsz-vbr-elements/core 2.1.0-beta.44 → 2.1.0-beta.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.iife.js +2 -2
- package/dist/index.iife.js.br +0 -0
- package/dist/index.iife.js.gz +0 -0
- package/dist/index.js +3 -1
- package/package.json +2 -2
package/dist/index.iife.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @mjsz-vbr-elements/core
|
|
3
|
-
* version: v2.1.0-beta.
|
|
3
|
+
* version: v2.1.0-beta.45 - 06/11/2023, 14:57:52
|
|
4
4
|
* (c) 2023
|
|
5
5
|
* description: Data visualization for MJSZ VBR
|
|
6
6
|
* author: Ákos Stegner <akos.stegner@gmail.com>
|
|
@@ -19,4 +19,4 @@ var MjszVbrElementsCore=function(S,n){"use strict";const rt=t=>({}.VITE_CSS_CLAS
|
|
|
19
19
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20
20
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
21
|
PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
-
***************************************************************************** */function ln(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var o,s,a=r.call(t),i=[];try{for(;(e===void 0||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(l){s={error:l}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(s)throw s.error}}return i}var cn;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(cn||(cn={}));var ki={type:"xstate.init"};function Oe(t){return t===void 0?[]:[].concat(t)}function un(t,e){return typeof(t=typeof t=="string"&&e&&e[t]?e[t]:t)=="string"?{type:t}:typeof t=="function"?{type:t.name,exec:t}:t}function Pe(t){return function(e){return t===e}}function $i(t){return typeof t=="string"?{type:t}:t}function dn(t,e){return{value:t,context:e,actions:[],changed:!1,matches:Pe(t)}}function fn(t,e,r){var o=e,s=!1;return[t.filter(function(a){if(a.type==="xstate.assign"){s=!0;var i=Object.assign({},o);return typeof a.assignment=="function"?i=a.assignment(o,r):Object.keys(a.assignment).forEach(function(l){i[l]=typeof a.assignment[l]=="function"?a.assignment[l](o,r):a.assignment[l]}),o=i,!1}return!0}),o,s]}function Ai(t,e){e===void 0&&(e={});var r=ln(fn(Oe(t.states[t.initial].entry).map(function(i){return un(i,e.actions)}),t.context,ki),2),o=r[0],s=r[1],a={config:t,_options:e,initialState:{value:t.initial,actions:o,context:s,matches:Pe(t.initial)},transition:function(i,l){var c,u,p=typeof i=="string"?{value:i,context:t.context}:i,m=p.value,d=p.context,f=$i(l),h=t.states[m];if(h.on){var g=Oe(h.on[f.type]);try{for(var y=function(w){var P=typeof Symbol=="function"&&Symbol.iterator,x=P&&w[P],M=0;if(x)return x.call(w);if(w&&typeof w.length=="number")return{next:function(){return w&&M>=w.length&&(w=void 0),{value:w&&w[M++],done:!w}}};throw new TypeError(P?"Object is not iterable.":"Symbol.iterator is not defined.")}(g),k=y.next();!k.done;k=y.next()){var $=k.value;if($===void 0)return dn(m,d);var O=typeof $=="string"?{target:$}:$,v=O.target,D=O.actions,B=D===void 0?[]:D,R=O.cond,F=R===void 0?function(){return!0}:R,L=v===void 0,N=v??m,I=t.states[N];if(F(d,f)){var U=ln(fn((L?Oe(B):[].concat(h.exit,B,I.entry).filter(function(w){return w})).map(function(w){return un(w,a._options.actions)}),d,f),3),E=U[0],T=U[1],_=U[2],A=v??m;return{value:A,context:T,actions:E,changed:v!==m||E.length>0||_,matches:Pe(A)}}}}catch(w){c={error:w}}finally{try{k&&!k.done&&(u=y.return)&&u.call(y)}finally{if(c)throw c.error}}}return dn(m,d)}};return a}const Ei=Ai({id:"sort",initial:ot,states:{[ot]:{on:{DIRECTION1:b,DIRECTION2:C}},[b]:{on:{DIRECTION1:C,DIRECTION2:ot}},[C]:{on:{DIRECTION1:ot,DIRECTION2:b}}}}),Oi=(t,e)=>{const r=e===C?"DIRECTION2":"DIRECTION1";return Ei.transition(t,r).value};function Pi(t={}){const{sortTarget:e=null,orders:r=[]}=t,o=n.reactive({sortTarget:e,orders:r});return{sort:o,change:({target:a,orders:i})=>{if(o.sortTarget!==a){o.sortTarget=a,o.orders=i;return}const l=i.map((c,u)=>({...c,direction:Oi(o.orders[u].direction,c.direction)}));o.sortTarget=a,o.orders=l}}}function Ni(t=!1,e=nt,r=nt){const o=Nn();n.watch(o,s=>{if(n.unref(t)){if(s==="visible")return e();r()}})}const xi=(t=[])=>({result:[...t],filteredRowsLength:0,isFiltered:!1,value(){return{rows:this.result,totalItems:this.filteredRowsLength,totalItems:this.isFiltered?this.filteredRowsLength:t.length}},filter(e,r=[],o=!1){if(e){const s=r.map(i=>o?fe(lr(i),Ft(e)):fe(St(i),ra,Vo(e))),a=Xe(uo([...s]),this.result);this.isFiltered=!0,this.filteredRowsLength=a.length,this.result=a}return this},sorted(e){if(!e.sortTarget)return this;if(e.orders[0].direction===ot)return this;const r=Io(Ft(C),ar(ce),ar(Oo));return this.result=cr(e.orders.map(o=>sr(r(o.direction),St)(o.target)))(this.result),this},addIndex(e=null){return this.result.reduce((r,o,s)=>{const a=r[r.length-1]||[],i=e&&a[e]===o[e];return o.index=i?a.index:s+1,o.indexClass=i?"is-duplicated":null,r.push(o),r},[]),this},addContinuousIndex(){return this.result=this.result.map((e,r)=>({...e,index:r+1})),this},pagination(e,r){e=Number(e),r=Number(r);const o=(e-1)*r,s=o+r;return this.result=this.result.slice(o,s),this},playerName(){return this.result=this.result.map(e=>({...e,name:`${e.lastName} ${e.firstName}`})),this},teamName(){return this.result=this.result.map(e=>({...e,teamName:e.team.longName})),this},schedule(e="",r="hu"){return this.result=this.result.map(o=>({...o,gameResult:`${o.homeTeamScore}-${o.awayTeamScore}`,gameDateDate:Qt(o.gameDate,"L dddd",e,r),gameDateTime:Qt(o.gameDate,"HH:mm",e,r)})),this},gameDateFilter(e){return e===null?this:(this.result=this.result.filter(r=>new Date(r.gameDate).getMonth()==e),this)},convertTimes(e=[]){return this.result=this.result.map(r=>(e.map(o=>r[o]?r[`${o}Sec`]=$e(r[o]):r),r)),this},groupByDays(){return this.result=Co(e=>Qt(e.gameDate,"YYYY-MM-DD"))(this.result),this}}),vi=(t,...e)=>pt(sr(...e))(t),Di=t=>{var e;return{...t,...t.lastName&&t.firstName&&{name:`${t.lastName} ${t.firstName}`},...((e=t.player)==null?void 0:e.playerId)&&{name:`${t.player.lastName} ${t.player.firstName}`}}},Li=t=>{var e;return{...t,...((e=t==null?void 0:t.team)==null?void 0:e.id)&&{teamName:t.team.longName}}},Mi=(t=[])=>e=>{var r;return{...e,[t]:(r=e[t])==null?void 0:r.toUpperCase()}},Ci=(t=[])=>e=>(t.map(r=>e[r]?e[`${r}Sec`]=$e(e[r]):e),e),Bi=(t=[])=>e=>(t.map(r=>e[r]?e[`${r}Min`]=rn(e[r]):e),e),Ii=(t=[])=>e=>(t.map(r=>e[`${r}Min`]=en(e[r])),e),zi=cr([(t,e)=>new Date(t.gameDate).getTime()-new Date(e.gameDate).getTime(),ce(St("id")),ce(St("gameId"))]),Vi=(t,e)=>{const r=Ne("gameResolver")||t;return typeof r=="function"?r(e):r?r+e:hr+e},Ri=(t,e)=>{const r=Ne("teamResolver")||t;return typeof r=="function"?r(e):encodeURI(r?r+e:br+e)},Gi=(t,e)=>{const r=Ne("playerResolver")||t;return typeof r=="function"?r(e):encodeURI(r?r+e:yr+e)},Ne=(t="")=>{var e;return(e=window==null?void 0:window.__MJSZ_VBR_WIDGET__)==null?void 0:e[t]},ji={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Fi=n.createElementVNode("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"},null,-1),Yi=n.createElementVNode("line",{x1:"8",y1:"21",x2:"16",y2:"21"},null,-1),Ui=n.createElementVNode("line",{x1:"12",y1:"17",x2:"12",y2:"21"},null,-1),Hi=[Fi,Yi,Ui];function Wi(t,e){return n.openBlock(),n.createElementBlock("svg",ji,Hi)}const Ki={render:Wi},Zi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},qi=n.createElementVNode("circle",{cx:"12",cy:"12",r:"1"},null,-1),Xi=n.createElementVNode("circle",{cx:"12",cy:"5",r:"1"},null,-1),Ji=n.createElementVNode("circle",{cx:"12",cy:"19",r:"1"},null,-1),Qi=[qi,Xi,Ji];function tl(t,e){return n.openBlock(),n.createElementBlock("svg",Zi,Qi)}const el={render:tl},rl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},nl=n.createElementVNode("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"},null,-1),ol=n.createElementVNode("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",ry:"1"},null,-1),al=[nl,ol];function sl(t,e){return n.openBlock(),n.createElementBlock("svg",rl,al)}const il={render:sl},ll={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},cl=n.createElementVNode("path",{d:"M22.54 6.42a2.78 2.78 0 0 0-1.94-2C18.88 4 12 4 12 4s-6.88 0-8.6.46a2.78 2.78 0 0 0-1.94 2A29 29 0 0 0 1 11.75a29 29 0 0 0 .46 5.33A2.78 2.78 0 0 0 3.4 19c1.72.46 8.6.46 8.6.46s6.88 0 8.6-.46a2.78 2.78 0 0 0 1.94-2 29 29 0 0 0 .46-5.25 29 29 0 0 0-.46-5.33z"},null,-1),ul=n.createElementVNode("polygon",{points:"9.75 15.02 15.5 11.75 9.75 8.48 9.75 15.02"},null,-1),dl=[cl,ul];function fl(t,e){return n.openBlock(),n.createElementBlock("svg",ll,dl)}const ml={render:fl},pl={class:"is-team-name-long"},hl={class:"is-team-name-short"},gl={class:"is-team-name-long"},yl={class:"is-team-name-short"},bl={key:0,class:"is-text-dark"},wl=["href","target"],Sl={key:0,class:"label"},_l={key:1,class:"label"},Tl={key:2,class:"label"},kl={key:1},$l=["onClick","onFocus","onBlur"],Al={class:"is-dropdown-menu"},El=["href","target"],Ol={key:0},Pl=["href"],Nl={__name:"ScheduleTable",props:{rows:{type:Array,default:()=>[]},isLoading:{type:Boolean,deafult:!1},hideColumns:{type:String,default:""},offsetName:{type:String,default:""},externalGameResolver:{type:Function,required:!0},externalGameResolverTarget:{type:String,default:"_blank"}},setup(t){const e=t,r=n.ref(null),{onError:o}=_e(),{columns:s,error:a}=Ae(an,n.computed(()=>e.hideColumns),n.computed(()=>({offsetName:e.offsetName})));wn(a,()=>o(new Ee(Mt.message,{...Mt.options,cause:{column:a.value}})),{immediate:!0});const{t:i}=it();return(l,c)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(ke,null,{default:n.withCtx(({el:u})=>[n.createVNode(Se,{columns:n.unref(s),rows:e.rows,"is-loading":t.isLoading,"append-to":r.value||u},{"cell-homeTeamName":n.withCtx(({row:p})=>[n.createElementVNode("span",pl,n.toDisplayString(p.homeTeam.longName),1),n.createElementVNode("span",hl,n.toDisplayString(p.homeTeam.shortName),1)]),"cell-awayTeamName":n.withCtx(({row:p})=>[n.createElementVNode("span",gl,n.toDisplayString(p.awayTeam.longName),1),n.createElementVNode("span",yl,n.toDisplayString(p.awayTeam.shortName),1)]),"cell-homeTeamLogo":n.withCtx(({row:p})=>[(n.openBlock(),n.createBlock(yt,{class:"is-logo-image is-right",key:p.homeTeam.id,src:p.homeTeam.logo},null,8,["src"]))]),"cell-awayTeamLogo":n.withCtx(({row:p})=>[(n.openBlock(),n.createBlock(yt,{class:"is-logo-image is-right",key:p.awayTeam.id,src:p.awayTeam.logo},null,8,["src"]))]),"cell-gameResult":n.withCtx(({row:p})=>[p.gameStatus===0?(n.openBlock(),n.createElementBlock("span",bl,"-:-")):(n.openBlock(),n.createElementBlock("a",{key:1,href:t.externalGameResolver(p.gameId),target:t.externalGameResolverTarget,class:n.normalizeClass({"is-text-dark":p.gameStatus!==1,"is-text-accent":p.gameStatus===1})},n.toDisplayString(p.homeTeamScore)+":"+n.toDisplayString(p.awayTeamScore),11,wl))]),"cell-gameResultType":n.withCtx(({row:p})=>[p.isOvertime?(n.openBlock(),n.createElementBlock("span",Sl,n.toDisplayString(n.unref(i)("common.overtimeShort")),1)):n.createCommentVNode("",!0),p.isShootout?(n.openBlock(),n.createElementBlock("span",_l,n.toDisplayString(n.unref(i)("common.shootoutShort")),1)):n.createCommentVNode("",!0),p.seriesStandings?(n.openBlock(),n.createElementBlock("span",Tl,n.toDisplayString(p.seriesStandings),1)):n.createCommentVNode("",!0)]),"cell-broadcast":n.withCtx(({row:p})=>[p.broadcast?(n.openBlock(),n.createBlock(n.unref(Ki),{key:0})):(n.openBlock(),n.createElementBlock("span",kl))]),"cell-location":n.withCtx(({row:p})=>{var m;return[n.createTextVNode(n.toDisplayString(((m=p.location)==null?void 0:m.locationName)??""),1)]}),"cell-more":n.withCtx(({row:p})=>[n.createVNode(we,{offset:2,placement:"left",theme:"content","append-to":u},{default:n.withCtx(({setRef:m,show:d,hide:f})=>[n.createElementVNode("button",{ref:m,onClick:n.withModifiers(d,["stop"]),onFocus:d,onBlur:f},[n.createVNode(n.unref(el))],40,$l)]),content:n.withCtx(()=>[n.createElementVNode("ul",Al,[n.createElementVNode("li",null,[n.createElementVNode("a",{href:t.externalGameResolver(p.gameId),class:"is-dropdown-item",target:t.externalGameResolverTarget},[n.createVNode(n.unref(il),{width:"14"}),n.createTextVNode(" "+n.toDisplayString(n.unref(i)("common.report")),1)],8,El)]),p.video?(n.openBlock(),n.createElementBlock("li",Ol,[n.createElementVNode("a",{href:p.video,class:"is-dropdown-item",target:"_blank"},[n.createVNode(n.unref(ml),{width:"14"}),n.createTextVNode(" "+n.toDisplayString(n.unref(i)("common.video")),1)],8,Pl)])):n.createCommentVNode("",!0)])]),_:2},1032,["append-to"])]),loading:n.withCtx(()=>[n.createVNode(Te)]),_:2},1032,["columns","rows","is-loading","append-to"])]),_:1}),n.createElementVNode("div",{ref_key:"tooltipContainer",ref:r},null,512)],64))}},xl={class:"g-row"},vl=["value"],Dl={key:0},Ll=["onClick"],Ml={__name:"SeasonSelector",props:{seasons:{type:Array,default:()=>[]},championshipId:{type:Number,default:0},sections:{type:Array,default:()=>[]},sectionId:{type:Number,default:0},isSectionSelectionDisabled:{type:Boolean,default:!1}},emits:["onChangeSeason","onChangeSection"],setup(t,{emit:e}){const r=t,{t:o}=it(),s=n.computed({get(){return r.championshipId},set(i){e("onChangeSeason",i)}});function a(i){e("onChangeSection",i)}return(i,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",xl,[n.createElementVNode("div",null,[n.createElementVNode("label",{for:"season",class:n.normalizeClass(n.unref(rt)("label"))},n.toDisplayString(n.unref(o)("selection.season")),3),n.createVNode(ve,{id:"season",modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=c=>s.value=c)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.seasons,c=>(n.openBlock(),n.createElementBlock("option",{key:c.championshipId,value:c.championshipId},n.toDisplayString(c.seasonName),9,vl))),128))]),_:1},8,["modelValue"])])]),t.isSectionSelectionDisabled?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",Dl,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.sections,c=>(n.openBlock(),n.createElementBlock("button",{key:c.phaseId,onClick:u=>a(c),class:n.normalizeClass([n.unref(rt)("tab-button"),{"is-active":c.sectionId===t.sectionId}])},n.toDisplayString(c.sectionName),11,Ll))),128))]))],64))}},Cl={};function Bl(t,e){return n.openBlock(),n.createElementBlock("div",null," Test-8 ")}const Il=Ur(Cl,[["render",Bl]]),zl={locale:{type:String,default:"hu"},championshipId:{type:String,default:""},division:{type:String,default:""},apiKey:{type:String,default:""},hideColumns:{type:String,default:""}},mn={externalTeamLink:{type:[String,Function],default:""},isTeamLinked:{type:Boolean,default:!1}},Vl={limit:{type:Number,default:20},teamFilterByName:{type:String,default:""},externalPlayerLink:{type:[String,Function],default:""},isPlayerLinked:{type:Boolean,default:!1},...mn},Rl=({modules:t=[],apiKey:e,gameResolver:r,teamResolver:o,playerResolver:s})=>{if(window.__MJSZ_VBR_WIDGET__={apiKey:e,gameResolver:r,teamResolver:o,playerResolver:s},t.length===0)throw new Error("At least one module must be set");t.forEach(a=>{if(a.register)return a.register();a==null||a()})};return S.AVAILABLE_TIMEZONES_BY_COUNTRY=Sr,S.BaseSelect=ve,S.COLUMNS_FIELD_PLAYERS=di,S.COLUMNS_FIELD_PLAYERS_PENALTY=fi,S.COLUMNS_GOALIES=mi,S.COLUMNS_SCHEDULE=an,S.COLUMNS_SCORING_EFFICIENCY=bi,S.COLUMNS_STANDINGS_P_2=ui,S.COLUMNS_STANDINGS_P_3=ci,S.COLUMNS_TEAMS_FAIRPLAY=hi,S.COLUMNS_TEAMS_PENALTY_KILLING=gi,S.COLUMNS_TEAMS_POWERPLAY=yi,S.COLUMNS_TEAM_ATTENDANCE=pi,S.DEFAULT_EXTERNAL_BASE_URL=hr,S.DEFAULT_EXTERNAL_PLAYER_URL=yr,S.DEFAULT_EXTERNAL_TEAM_URL=br,S.DEFAULT_PORTRAIT_IMAGE_URL=gr,S.DataTable=Se,S.ErrorNotice=Qa,S.ErrorProvider=es,S.FloatingPanel=we,S.I18NProvider=ss,S.Image=yt,S.InvalidSeasonName=Ks,S.LAZY_LOADING_STATE_DELAY=_r,S.LOCALE_FOR_LANG=wr,S.LoadingIndicator=Te,S.Paginator=Ns,S.REFRESH_DELAY=la,S.ResponsiveTable=ke,S.SORT_STATE_ASCEND=C,S.SORT_STATE_DESCEND=b,S.SORT_STATE_ORIGINAL=ot,S.ScheduleTable=Nl,S.SeasonSelector=Ml,S.StatisticsTable=li,S.Test=Il,S.TimezoneSelector=Ws,S.UndefinedColumn=Mt,S.VBR_API_BASE_URL=pr,S.WidgetError=Ee,S.appendTo=Gr,S.baseProps=zl,S.convert=xi,S.convertMinToMinSec=rn,S.convertMinToSec=$e,S.convertSecToMin=en,S.convertTimes=Ci,S.convertTimesMinToMinSec=Bi,S.convertTimesSecToMin=Ii,S.createConfig=Rl,S.createI18n=dr,S.externalGameLinkResolver=Vi,S.externalPlayerLinkResolver=Gi,S.externalTeamLinkResolver=Ri,S.fetchVBRData=sn,S.format=Qt,S.getLocalTimezone=tn,S.i18n=mr,S.isBetween=Ys,S.isSame=Us,S.isSameOrBefore=nn,S.offsetName=Lt,S.playerName=Di,S.playerStatsProps=Vl,S.rawConvert=vi,S.sortGames=zi,S.teamName=Li,S.teamStatsProps=mn,S.toKebabCase=jr,S.upperCase=Mi,S.useColumns=Ae,S.useError=_e,S.useErrorProvider=Yr,S.useI18n=it,S.useLazyLoadingState=Re,S.useMainClass=rt,S.usePage=_i,S.useServices=Ti,S.useSort=Pi,S.useVisibilityChange=Ni,S.validateColumnsName=on,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}),S}({},Vue);
|
|
22
|
+
***************************************************************************** */function ln(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var o,s,a=r.call(t),i=[];try{for(;(e===void 0||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(l){s={error:l}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(s)throw s.error}}return i}var cn;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(cn||(cn={}));var ki={type:"xstate.init"};function Oe(t){return t===void 0?[]:[].concat(t)}function un(t,e){return typeof(t=typeof t=="string"&&e&&e[t]?e[t]:t)=="string"?{type:t}:typeof t=="function"?{type:t.name,exec:t}:t}function Pe(t){return function(e){return t===e}}function $i(t){return typeof t=="string"?{type:t}:t}function dn(t,e){return{value:t,context:e,actions:[],changed:!1,matches:Pe(t)}}function fn(t,e,r){var o=e,s=!1;return[t.filter(function(a){if(a.type==="xstate.assign"){s=!0;var i=Object.assign({},o);return typeof a.assignment=="function"?i=a.assignment(o,r):Object.keys(a.assignment).forEach(function(l){i[l]=typeof a.assignment[l]=="function"?a.assignment[l](o,r):a.assignment[l]}),o=i,!1}return!0}),o,s]}function Ai(t,e){e===void 0&&(e={});var r=ln(fn(Oe(t.states[t.initial].entry).map(function(i){return un(i,e.actions)}),t.context,ki),2),o=r[0],s=r[1],a={config:t,_options:e,initialState:{value:t.initial,actions:o,context:s,matches:Pe(t.initial)},transition:function(i,l){var c,u,p=typeof i=="string"?{value:i,context:t.context}:i,m=p.value,d=p.context,f=$i(l),h=t.states[m];if(h.on){var g=Oe(h.on[f.type]);try{for(var y=function(w){var P=typeof Symbol=="function"&&Symbol.iterator,x=P&&w[P],M=0;if(x)return x.call(w);if(w&&typeof w.length=="number")return{next:function(){return w&&M>=w.length&&(w=void 0),{value:w&&w[M++],done:!w}}};throw new TypeError(P?"Object is not iterable.":"Symbol.iterator is not defined.")}(g),k=y.next();!k.done;k=y.next()){var $=k.value;if($===void 0)return dn(m,d);var O=typeof $=="string"?{target:$}:$,v=O.target,D=O.actions,B=D===void 0?[]:D,R=O.cond,F=R===void 0?function(){return!0}:R,L=v===void 0,N=v??m,I=t.states[N];if(F(d,f)){var U=ln(fn((L?Oe(B):[].concat(h.exit,B,I.entry).filter(function(w){return w})).map(function(w){return un(w,a._options.actions)}),d,f),3),E=U[0],T=U[1],_=U[2],A=v??m;return{value:A,context:T,actions:E,changed:v!==m||E.length>0||_,matches:Pe(A)}}}}catch(w){c={error:w}}finally{try{k&&!k.done&&(u=y.return)&&u.call(y)}finally{if(c)throw c.error}}}return dn(m,d)}};return a}const Ei=Ai({id:"sort",initial:ot,states:{[ot]:{on:{DIRECTION1:b,DIRECTION2:C}},[b]:{on:{DIRECTION1:C,DIRECTION2:ot}},[C]:{on:{DIRECTION1:ot,DIRECTION2:b}}}}),Oi=(t,e)=>{const r=e===C?"DIRECTION2":"DIRECTION1";return Ei.transition(t,r).value};function Pi(t={}){const{sortTarget:e=null,orders:r=[]}=t,o=n.reactive({sortTarget:e,orders:r});return{sort:o,change:({target:a,orders:i})=>{if(o.sortTarget!==a){o.sortTarget=a,o.orders=i;return}const l=i.map((c,u)=>({...c,direction:Oi(o.orders[u].direction,c.direction)}));o.sortTarget=a,o.orders=l}}}function Ni(t=!1,e=nt,r=nt){const o=Nn();n.watch(o,s=>{if(n.unref(t)){if(s==="visible")return e();r()}})}const xi=(t=[])=>({result:[...t],filteredRowsLength:0,isFiltered:!1,value(){return{rows:this.result,totalItems:this.filteredRowsLength,totalItems:this.isFiltered?this.filteredRowsLength:t.length}},filter(e,r=[],o=!1){if(e){const s=r.map(i=>o?fe(lr(i),Ft(e)):fe(St(i),ra,Vo(e))),a=Xe(uo([...s]),this.result);this.isFiltered=!0,this.filteredRowsLength=a.length,this.result=a}return this},sorted(e){if(!e.sortTarget)return this;if(e.orders[0].direction===ot)return this;const r=Io(Ft(C),ar(ce),ar(Oo));return this.result=cr(e.orders.map(o=>sr(r(o.direction),St)(o.target)))(this.result),this},addIndex(e=null){return this.result.reduce((r,o,s)=>{const a=r[r.length-1]||[],i=e&&a[e]===o[e];return o.index=i?a.index:s+1,o.indexClass=i?"is-duplicated":null,r.push(o),r},[]),this},addContinuousIndex(){return this.result=this.result.map((e,r)=>({...e,index:r+1})),this},pagination(e,r){if(!r)return this;e=Number(e),r=Number(r);const o=(e-1)*r,s=o+r;return this.result=this.result.slice(o,s),this},playerName(){return this.result=this.result.map(e=>({...e,name:`${e.lastName} ${e.firstName}`})),this},teamName(){return this.result=this.result.map(e=>({...e,teamName:e.team.longName})),this},schedule(e="",r="hu"){return this.result=this.result.map(o=>({...o,gameResult:`${o.homeTeamScore}-${o.awayTeamScore}`,gameDateDate:Qt(o.gameDate,"L dddd",e,r),gameDateTime:Qt(o.gameDate,"HH:mm",e,r)})),this},gameDateFilter(e){return e===null?this:(this.result=this.result.filter(r=>new Date(r.gameDate).getMonth()==e),this)},convertTimes(e=[]){return this.result=this.result.map(r=>(e.map(o=>r[o]?r[`${o}Sec`]=$e(r[o]):r),r)),this},groupByDays(){return this.result=Co(e=>Qt(e.gameDate,"YYYY-MM-DD"))(this.result),this}}),vi=(t,...e)=>pt(sr(...e))(t),Di=t=>{var e;return{...t,...t.lastName&&t.firstName&&{name:`${t.lastName} ${t.firstName}`},...((e=t.player)==null?void 0:e.playerId)&&{name:`${t.player.lastName} ${t.player.firstName}`}}},Li=t=>{var e;return{...t,...((e=t==null?void 0:t.team)==null?void 0:e.id)&&{teamName:t.team.longName}}},Mi=(t=[])=>e=>{var r;return{...e,[t]:(r=e[t])==null?void 0:r.toUpperCase()}},Ci=(t=[])=>e=>(t.map(r=>e[r]?e[`${r}Sec`]=$e(e[r]):e),e),Bi=(t=[])=>e=>(t.map(r=>e[r]?e[`${r}Min`]=rn(e[r]):e),e),Ii=(t=[])=>e=>(t.map(r=>e[`${r}Min`]=en(e[r])),e),zi=cr([(t,e)=>new Date(t.gameDate).getTime()-new Date(e.gameDate).getTime(),ce(St("id")),ce(St("gameId"))]),Vi=(t,e)=>{const r=Ne("gameResolver")||t;return typeof r=="function"?r(e):r?r+e:hr+e},Ri=(t,e)=>{const r=Ne("teamResolver")||t;return typeof r=="function"?r(e):encodeURI(r?r+e:br+e)},Gi=(t,e)=>{const r=Ne("playerResolver")||t;return typeof r=="function"?r(e):encodeURI(r?r+e:yr+e)},Ne=(t="")=>{var e;return(e=window==null?void 0:window.__MJSZ_VBR_WIDGET__)==null?void 0:e[t]},ji={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Fi=n.createElementVNode("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"},null,-1),Yi=n.createElementVNode("line",{x1:"8",y1:"21",x2:"16",y2:"21"},null,-1),Ui=n.createElementVNode("line",{x1:"12",y1:"17",x2:"12",y2:"21"},null,-1),Hi=[Fi,Yi,Ui];function Wi(t,e){return n.openBlock(),n.createElementBlock("svg",ji,Hi)}const Ki={render:Wi},Zi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},qi=n.createElementVNode("circle",{cx:"12",cy:"12",r:"1"},null,-1),Xi=n.createElementVNode("circle",{cx:"12",cy:"5",r:"1"},null,-1),Ji=n.createElementVNode("circle",{cx:"12",cy:"19",r:"1"},null,-1),Qi=[qi,Xi,Ji];function tl(t,e){return n.openBlock(),n.createElementBlock("svg",Zi,Qi)}const el={render:tl},rl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},nl=n.createElementVNode("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"},null,-1),ol=n.createElementVNode("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",ry:"1"},null,-1),al=[nl,ol];function sl(t,e){return n.openBlock(),n.createElementBlock("svg",rl,al)}const il={render:sl},ll={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},cl=n.createElementVNode("path",{d:"M22.54 6.42a2.78 2.78 0 0 0-1.94-2C18.88 4 12 4 12 4s-6.88 0-8.6.46a2.78 2.78 0 0 0-1.94 2A29 29 0 0 0 1 11.75a29 29 0 0 0 .46 5.33A2.78 2.78 0 0 0 3.4 19c1.72.46 8.6.46 8.6.46s6.88 0 8.6-.46a2.78 2.78 0 0 0 1.94-2 29 29 0 0 0 .46-5.25 29 29 0 0 0-.46-5.33z"},null,-1),ul=n.createElementVNode("polygon",{points:"9.75 15.02 15.5 11.75 9.75 8.48 9.75 15.02"},null,-1),dl=[cl,ul];function fl(t,e){return n.openBlock(),n.createElementBlock("svg",ll,dl)}const ml={render:fl},pl={class:"is-team-name-long"},hl={class:"is-team-name-short"},gl={class:"is-team-name-long"},yl={class:"is-team-name-short"},bl={key:0,class:"is-text-dark"},wl=["href","target"],Sl={key:0,class:"label"},_l={key:1,class:"label"},Tl={key:2,class:"label"},kl={key:1},$l=["onClick","onFocus","onBlur"],Al={class:"is-dropdown-menu"},El=["href","target"],Ol={key:0},Pl=["href"],Nl={__name:"ScheduleTable",props:{rows:{type:Array,default:()=>[]},isLoading:{type:Boolean,deafult:!1},hideColumns:{type:String,default:""},offsetName:{type:String,default:""},externalGameResolver:{type:Function,required:!0},externalGameResolverTarget:{type:String,default:"_blank"}},setup(t){const e=t,r=n.ref(null),{onError:o}=_e(),{columns:s,error:a}=Ae(an,n.computed(()=>e.hideColumns),n.computed(()=>({offsetName:e.offsetName})));wn(a,()=>o(new Ee(Mt.message,{...Mt.options,cause:{column:a.value}})),{immediate:!0});const{t:i}=it();return(l,c)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(ke,null,{default:n.withCtx(({el:u})=>[n.createVNode(Se,{columns:n.unref(s),rows:e.rows,"is-loading":t.isLoading,"append-to":r.value||u},{"cell-homeTeamName":n.withCtx(({row:p})=>[n.createElementVNode("span",pl,n.toDisplayString(p.homeTeam.longName),1),n.createElementVNode("span",hl,n.toDisplayString(p.homeTeam.shortName),1)]),"cell-awayTeamName":n.withCtx(({row:p})=>[n.createElementVNode("span",gl,n.toDisplayString(p.awayTeam.longName),1),n.createElementVNode("span",yl,n.toDisplayString(p.awayTeam.shortName),1)]),"cell-homeTeamLogo":n.withCtx(({row:p})=>[(n.openBlock(),n.createBlock(yt,{class:"is-logo-image is-right",key:p.homeTeam.id,src:p.homeTeam.logo},null,8,["src"]))]),"cell-awayTeamLogo":n.withCtx(({row:p})=>[(n.openBlock(),n.createBlock(yt,{class:"is-logo-image is-right",key:p.awayTeam.id,src:p.awayTeam.logo},null,8,["src"]))]),"cell-gameResult":n.withCtx(({row:p})=>[p.gameStatus===0?(n.openBlock(),n.createElementBlock("span",bl,"-:-")):(n.openBlock(),n.createElementBlock("a",{key:1,href:t.externalGameResolver(p.gameId),target:t.externalGameResolverTarget,class:n.normalizeClass({"is-text-dark":p.gameStatus!==1,"is-text-accent":p.gameStatus===1})},n.toDisplayString(p.homeTeamScore)+":"+n.toDisplayString(p.awayTeamScore),11,wl))]),"cell-gameResultType":n.withCtx(({row:p})=>[p.isOvertime?(n.openBlock(),n.createElementBlock("span",Sl,n.toDisplayString(n.unref(i)("common.overtimeShort")),1)):n.createCommentVNode("",!0),p.isShootout?(n.openBlock(),n.createElementBlock("span",_l,n.toDisplayString(n.unref(i)("common.shootoutShort")),1)):n.createCommentVNode("",!0),p.seriesStandings?(n.openBlock(),n.createElementBlock("span",Tl,n.toDisplayString(p.seriesStandings),1)):n.createCommentVNode("",!0)]),"cell-broadcast":n.withCtx(({row:p})=>[p.broadcast?(n.openBlock(),n.createBlock(n.unref(Ki),{key:0})):(n.openBlock(),n.createElementBlock("span",kl))]),"cell-location":n.withCtx(({row:p})=>{var m;return[n.createTextVNode(n.toDisplayString(((m=p.location)==null?void 0:m.locationName)??""),1)]}),"cell-more":n.withCtx(({row:p})=>[n.createVNode(we,{offset:2,placement:"left",theme:"content","append-to":u},{default:n.withCtx(({setRef:m,show:d,hide:f})=>[n.createElementVNode("button",{ref:m,onClick:n.withModifiers(d,["stop"]),onFocus:d,onBlur:f},[n.createVNode(n.unref(el))],40,$l)]),content:n.withCtx(()=>[n.createElementVNode("ul",Al,[n.createElementVNode("li",null,[n.createElementVNode("a",{href:t.externalGameResolver(p.gameId),class:"is-dropdown-item",target:t.externalGameResolverTarget},[n.createVNode(n.unref(il),{width:"14"}),n.createTextVNode(" "+n.toDisplayString(n.unref(i)("common.report")),1)],8,El)]),p.video?(n.openBlock(),n.createElementBlock("li",Ol,[n.createElementVNode("a",{href:p.video,class:"is-dropdown-item",target:"_blank"},[n.createVNode(n.unref(ml),{width:"14"}),n.createTextVNode(" "+n.toDisplayString(n.unref(i)("common.video")),1)],8,Pl)])):n.createCommentVNode("",!0)])]),_:2},1032,["append-to"])]),loading:n.withCtx(()=>[n.createVNode(Te)]),_:2},1032,["columns","rows","is-loading","append-to"])]),_:1}),n.createElementVNode("div",{ref_key:"tooltipContainer",ref:r},null,512)],64))}},xl={class:"g-row"},vl=["value"],Dl={key:0},Ll=["onClick"],Ml={__name:"SeasonSelector",props:{seasons:{type:Array,default:()=>[]},championshipId:{type:Number,default:0},sections:{type:Array,default:()=>[]},sectionId:{type:Number,default:0},isSectionSelectionDisabled:{type:Boolean,default:!1}},emits:["onChangeSeason","onChangeSection"],setup(t,{emit:e}){const r=t,{t:o}=it(),s=n.computed({get(){return r.championshipId},set(i){e("onChangeSeason",i)}});function a(i){e("onChangeSection",i)}return(i,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",xl,[n.createElementVNode("div",null,[n.createElementVNode("label",{for:"season",class:n.normalizeClass(n.unref(rt)("label"))},n.toDisplayString(n.unref(o)("selection.season")),3),n.createVNode(ve,{id:"season",modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=c=>s.value=c)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.seasons,c=>(n.openBlock(),n.createElementBlock("option",{key:c.championshipId,value:c.championshipId},n.toDisplayString(c.seasonName),9,vl))),128))]),_:1},8,["modelValue"])])]),t.isSectionSelectionDisabled?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",Dl,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.sections,c=>(n.openBlock(),n.createElementBlock("button",{key:c.phaseId,onClick:u=>a(c),class:n.normalizeClass([n.unref(rt)("tab-button"),{"is-active":c.sectionId===t.sectionId}])},n.toDisplayString(c.sectionName),11,Ll))),128))]))],64))}},Cl={};function Bl(t,e){return n.openBlock(),n.createElementBlock("div",null," Test-8 ")}const Il=Ur(Cl,[["render",Bl]]),zl={locale:{type:String,default:"hu"},championshipId:{type:String,default:""},division:{type:String,default:""},apiKey:{type:String,default:""},hideColumns:{type:String,default:""}},mn={externalTeamLink:{type:[String,Function],default:""},isTeamLinked:{type:Boolean,default:!1}},Vl={limit:{type:Number,default:20},teamFilterByName:{type:String,default:""},externalPlayerLink:{type:[String,Function],default:""},isPlayerLinked:{type:Boolean,default:!1},...mn},Rl=({modules:t=[],apiKey:e,gameResolver:r,teamResolver:o,playerResolver:s})=>{if(window.__MJSZ_VBR_WIDGET__={apiKey:e,gameResolver:r,teamResolver:o,playerResolver:s},t.length===0)throw new Error("At least one module must be set");t.forEach(a=>{if(a.register)return a.register();a==null||a()})};return S.AVAILABLE_TIMEZONES_BY_COUNTRY=Sr,S.BaseSelect=ve,S.COLUMNS_FIELD_PLAYERS=di,S.COLUMNS_FIELD_PLAYERS_PENALTY=fi,S.COLUMNS_GOALIES=mi,S.COLUMNS_SCHEDULE=an,S.COLUMNS_SCORING_EFFICIENCY=bi,S.COLUMNS_STANDINGS_P_2=ui,S.COLUMNS_STANDINGS_P_3=ci,S.COLUMNS_TEAMS_FAIRPLAY=hi,S.COLUMNS_TEAMS_PENALTY_KILLING=gi,S.COLUMNS_TEAMS_POWERPLAY=yi,S.COLUMNS_TEAM_ATTENDANCE=pi,S.DEFAULT_EXTERNAL_BASE_URL=hr,S.DEFAULT_EXTERNAL_PLAYER_URL=yr,S.DEFAULT_EXTERNAL_TEAM_URL=br,S.DEFAULT_PORTRAIT_IMAGE_URL=gr,S.DataTable=Se,S.ErrorNotice=Qa,S.ErrorProvider=es,S.FloatingPanel=we,S.I18NProvider=ss,S.Image=yt,S.InvalidSeasonName=Ks,S.LAZY_LOADING_STATE_DELAY=_r,S.LOCALE_FOR_LANG=wr,S.LoadingIndicator=Te,S.Paginator=Ns,S.REFRESH_DELAY=la,S.ResponsiveTable=ke,S.SORT_STATE_ASCEND=C,S.SORT_STATE_DESCEND=b,S.SORT_STATE_ORIGINAL=ot,S.ScheduleTable=Nl,S.SeasonSelector=Ml,S.StatisticsTable=li,S.Test=Il,S.TimezoneSelector=Ws,S.UndefinedColumn=Mt,S.VBR_API_BASE_URL=pr,S.WidgetError=Ee,S.appendTo=Gr,S.baseProps=zl,S.convert=xi,S.convertMinToMinSec=rn,S.convertMinToSec=$e,S.convertSecToMin=en,S.convertTimes=Ci,S.convertTimesMinToMinSec=Bi,S.convertTimesSecToMin=Ii,S.createConfig=Rl,S.createI18n=dr,S.externalGameLinkResolver=Vi,S.externalPlayerLinkResolver=Gi,S.externalTeamLinkResolver=Ri,S.fetchVBRData=sn,S.format=Qt,S.getLocalTimezone=tn,S.i18n=mr,S.isBetween=Ys,S.isSame=Us,S.isSameOrBefore=nn,S.offsetName=Lt,S.playerName=Di,S.playerStatsProps=Vl,S.rawConvert=vi,S.sortGames=zi,S.teamName=Li,S.teamStatsProps=mn,S.toKebabCase=jr,S.upperCase=Mi,S.useColumns=Ae,S.useError=_e,S.useErrorProvider=Yr,S.useI18n=it,S.useLazyLoadingState=Re,S.useMainClass=rt,S.usePage=_i,S.useServices=Ti,S.useSort=Pi,S.useVisibilityChange=Ni,S.validateColumnsName=on,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}),S}({},Vue);
|
package/dist/index.iife.js.br
CHANGED
|
Binary file
|
package/dist/index.iife.js.gz
CHANGED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @mjsz-vbr-elements/core
|
|
3
|
-
* version: v2.1.0-beta.
|
|
3
|
+
* version: v2.1.0-beta.45 - 06/11/2023, 14:57:52
|
|
4
4
|
* (c) 2023
|
|
5
5
|
* description: Data visualization for MJSZ VBR
|
|
6
6
|
* author: Ákos Stegner <akos.stegner@gmail.com>
|
|
@@ -4945,6 +4945,8 @@ const gc = (t = []) => ({
|
|
|
4945
4945
|
})), this;
|
|
4946
4946
|
},
|
|
4947
4947
|
pagination(e, r) {
|
|
4948
|
+
if (!r)
|
|
4949
|
+
return this;
|
|
4948
4950
|
e = Number(e), r = Number(r);
|
|
4949
4951
|
const n = (e - 1) * r, a = n + r;
|
|
4950
4952
|
return this.result = this.result.slice(n, a), this;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Data visualization for MJSZ VBR",
|
|
4
4
|
"author": "Ákos Stegner <akos.stegner@gmail.com>",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.1.0-beta.
|
|
6
|
+
"version": "2.1.0-beta.45",
|
|
7
7
|
"homepage": "https://api.icehockey.hu/widgets/docs/v2/",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"files": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dayjs": "^1.11.7",
|
|
39
39
|
"ramda": "^0.29.0",
|
|
40
40
|
"vue": "^3.3.4",
|
|
41
|
-
"@mjsz-vbr-elements/shared": "^2.1.0-beta.
|
|
41
|
+
"@mjsz-vbr-elements/shared": "^2.1.0-beta.45"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@vitejs/plugin-vue": "^4.2.3",
|