import{Z as He,z as Ae,D as De,aU as te,a0 as Ve,T as Be,N as Te}from"./CfjfYOu4.js";import{s as de}from"./lGy7RumW.js";import{J as we,c as t,o as s,d as w,n as L,e as C,j as k,l as $e,a as ge,g as b,f as Ee,D as W,r as ve,h as Ne,i as je,U as Fe,K as fe,F as f,k as M,q as Q,t as x,b as z,w as X,u as B,x as Me}from"./BVo-4L0X.js";const qe={name:"STableHeading",components:{SIcon:He},props:{column:{type:Object,required:!0},sortable:Boolean,sort:Object,position:String,headerClass:{type:String,default:"!bg-primary"},headerTextClass:{type:String,default:""}},emits:["sort-change"],setup(d,_){const u=b(()=>({"s-table-header__column-wrapper--left":d.position==="left","s-table-header__column-wrapper--right":d.position==="right","s-table-header__column-wrapper--center":d.position==="center"})),a=q=>{const{sortable:T}=q;return typeof T=="boolean"?T&&d.sortable:d.sortable};return{isSortableColumn:a,sortBy:(q,T)=>{a(T)&&_.emit("sort-change",{sortKey:q,item:T})},columnPositionClass:u}}},Oe=["scope","rowspan","colspan"],Re={class:"relative"},We=["aria-label"];function ze(d,_,u,a,q,T){var Y,I,U,ee,le,ae;const oe=we("SIcon");return s(),t("th",{"data-test-id":"s-table-heading__root",class:L(["s-table-header__column text-theme-muted s-text-small-bold select-none whitespace-nowrap !uppercase",{"s-table-header__column--active":u.column.active},u.headerClass,(Y=u.column)!=null&&Y.class?u.column.class:""]),scope:((I=u.column)==null?void 0:I.scope)??"col",rowspan:(U=u.column)==null?void 0:U.rowspan,colspan:(ee=u.column)==null?void 0:ee.colspan},[w("div",Re,[w("div",{"data-test-id":"s-table-heading__column-wrapper",class:L(["flex flex-col items-start justify-start",["s-table-header__column-wrapper",a.columnPositionClass,{"cursor-pointer":a.isSortableColumn(u.column)},u.headerTextClass]]),onClick:_[1]||(_[1]=O=>a.sortBy(u.column.field,u.column))},[C(d.$slots,"table-column-heading",{column:u.column}),a.isSortableColumn(u.column)?(s(),t("span",{key:0,"data-test-id":"s-table-heading__column-icon",tabindex:"0","aria-label":u.column.ariaLabel+((le=u.sort)!=null&&le.isAsc?" ascending":" descending"),role:"group",title:"Click to sort",class:L(["icon sorting-icon top-[14px] absolute left-0",["s-table-header__column-icon",{active:u.column.active},u.sort&&((ae=u.sort)!=null&&ae.isAsc)?"asc":"desc"]]),onKeydown:_[0]||(_[0]=$e(O=>a.sortBy(u.column.field,u.column),["enter"]))},[ge(oe,{name:"icon-carat-up","aria-hidden":"true",size:"small",class:"carat-icon text-primary"})],42,We)):k("",!0)],2)])],10,Oe)}const Ie=de(qe,[["render",ze]]),Ue={name:"STableCell",props:{column:{type:Object,required:!0},row:{type:Object,required:!0},footCell:Boolean},setup(d){return{rowValue:b(()=>{var _,u;if((_=d==null?void 0:d.column)!=null&&_.field&&(d!=null&&d.row)&&d.column.field in d.row){const a=((u=d.row)==null?void 0:u[d.column.field])??"";return Number.isNaN(a)?"":a}return""})}}};function Ke(d,_,u,a,q,T){return s(),z(Me(u.column.isRowHeader?"th":"td"),{class:L(["s-text-regular",{"s-table-whole-td-clickable":u.column.isColumnClickable,"s-table-body_cell s-text-regular !s-text-paragraph-small":!0,"s-table-row__column--active":u.column.active,"s-table-body_cell ":!u.footCell}]),scope:u.column.isRowHeader?"row":void 0},{default:X(()=>[C(d.$slots,"table-row-cell",{column:u.column,row:u.row,rowValue:a.rowValue})]),_:3},8,["class","scope"])}const ie=de(Ue,[["render",Ke]]),Pe=["aria-label"],Je={key:1,class:"s-table-header__row s-table-header__row--heading"},Ze=["id","colspan","rowspan"],Ge=["aria-label"],Qe=["aria-label"],Xe={class:"s-table-body"},Ye={key:0},el=["colspan"],ll={key:0,class:"s-table-body__row--ad"},al=["colspan"],sl={class:"relative w-full"},tl={key:1,class:"s-table-body__row--ad"},ol=["colspan"],rl={key:0,class:"s-table-body__row--group-title-row"},nl=["colspan"],ul={key:1,class:"s-table-body__row--group-title-row"},cl=["colspan"],il=["innerHTML"],dl=["src"],ml={key:1,class:"row-image flex"},pl=["href"],hl={key:2,class:"row-image flex"},bl=["src"],yl={class:"hidden sm:block"},vl=["innerHTML"],fl={key:1,class:"s-table-foot"},wl=["innerHTML"],gl="s-table",kl=Ee({__name:"STable",props:{...Ae(),tableAriaLabel:{type:String,default:void 0},position:{type:String,validator:d=>["left","right","center"].includes(d),default:"left"},initialSort:Object,sortable:Boolean,alternate:{type:Boolean,default:!1},stickyColumns:{type:String,default:void 0},highlightOnHover:{type:Boolean,default:!1},headingColumns:Array,stickyHeadEnabled:{type:Boolean,default:!1},stickyHeadClass:{type:String,default:"max-h-[70vh]"},columns:Array,rows:Array,footRows:Array,adAfterRow:{type:Number,default:2},htlads:{type:Boolean,default:!1},disableScroll:{type:Boolean,default:!1},groupedConfig:{type:Object,default:()=>{}},minWidth:{type:String,required:!1,default:null},ariaLabel:{type:String,required:!1,default:null},customEmptyTableMsg:{type:String,required:!1,default:null},headerClass:{type:String,default:"!bg-primary"},headerTextClass:{type:String,default:""},hideDefaultHeader:{type:Boolean,default:!1},useSortColumnOnHideDefaultHeader:{type:Boolean,default:!1},wrapperClass:{type:String}},emits:["sortChange"],setup(d,{expose:_,emit:u}){const a=d,q=W("siteBucket"),T=W("siteDefaultPersonImage"),oe=W("isDesktop",b(()=>!1)),Y=W("isTabletToDesktop",b(()=>!1)),I=W("isMobileToTablet",b(()=>!1)),U=W("isMobile",b(()=>!1)),ee=["light-theme","dark-theme"],{themeClasses:le}=De(a,gl,ee),ae=u;let O=0;const m=ve(null),ke=l=>{const e=l+1;return a.rows&&e=15?e<=8?e%8===0?(o++,!0):!1:(e-8)%25===0?(o++,!0):!1:!1};ne([oe,i,y,u],(l,e)=>{l!=e&&(O=0)});const _e=b(()=>[le.value,{"s-table--left":a.position==="left","s-table--right":a.position==="right","s-table--center":a.position==="center","s-table--alternate":a.alternate,"s-table--sortable":a.sortable,"s-table--sticky":a.stickyColumns==="1"||a.stickyColumns==="2","s-table--sticky1":a.stickyColumns==="1","s-table--sticky2":a.stickyColumns==="2","s-table--highlight-on-hover":a.highlightOnHover}]),Se=b(()=>a.adAfterRow),re=b(()=>xe.value),r=ve({key:"",isAsc:!1,isAlphaNum:!1,altSort:!1,hasDash:void 0,hasDashorSlash:!1});r.value=a.initialSort||r.value;const ne=()=>{var o,n,y,S,A,D,N,j,c;if(a.stickyColumns==="2"){let h=(n=(o=m==null?void 0:m.value)==null?void 0:o.querySelector(".s-table-header__column:first-child"))==null?void 0:n.getBoundingClientRect().width;h=h??((S=(y=m==null?void 0:m.value)==null?void 0:y.querySelector(".s-table-body_cell:first-child"))==null?void 0:S.getBoundingClientRect().width);const p=(A=m==null?void 0:m.value)==null?void 0:A.querySelectorAll("tfoot td:nth-child(2)"),g=(D=m==null?void 0:m.value)==null?void 0:D.querySelectorAll(".s-table-body_cell:nth-child(2)"),v=(N=m==null?void 0:m.value)==null?void 0:N.querySelectorAll(".s-table-header__column:nth-child(2)");g&&(g.forEach(V=>{V.style.left=`${h}px`}),v.forEach(V=>{V.style.left=`${h}px`})),p&&p.forEach(V=>{V.style.left=`${h}px`})}const l=m.value,e=l==null?void 0:l.parentElement;(l==null?void 0:l.scrollLeft)!==0?(j=e==null?void 0:e.classList)==null||j.add("border-sticky"):(c=e==null?void 0:e.classList)==null||c.remove("border-sticky")},me=({sortKey:l,item:e})=>{r.value.isAsc=r.value.key===l?!r.value.isAsc:!1,r.value.isAlphaNum=e.isAlphaNum??!1,r.value.hasDash=e.hasDash??void 0,r.value.hasDashorSlash=e.hasDashorSlash??!1,r.value.altSort=e.altSort??!1,r.value.key=l,a.columns&&a.columns.length&&a.columns.forEach(o=>o.active=!1),e.active=!0,ae("sortChange",r.value)},xe=b(()=>{if(!a.sortable)return a.rows;if(a.rows){const l=a.rows.slice();if(r.value.key){const e=/[^a-z]/gi;r.value.isAlphaNum?l.sort((o,n)=>{r.value.altSort?(o=(o==null?void 0:o["altSort_"+r.value.key])??o[r.value.key],n=(n==null?void 0:n["altSort_"+r.value.key])??n[r.value.key]):(o=o[r.value.key],n=n[r.value.key]),o=String(o),n=String(n);const y=+o,S=+n;if(y===S){const A=o.replace(e,""),D=n.replace(e,"");return(A===D?0:A>D?1:-1)*(r.value.isAsc?1:-1)}else return(y===S?0:y>S?1:-1)*(r.value.isAsc?1:-1)}):r.value.hasDash?l.sort((o,n)=>{const y=r.value.hasDash??"";return o=+o[y],n=+n[y],(o===n?0:o>n?1:-1)*(r.value.isAsc?1:-1)}):r.value.hasDashorSlash?l.sort((o,n)=>(o=o[r.value.key].includes("-")?+o[r.value.key].split("-")[0]:+o[r.value.key].split("/")[0],n=n[r.value.key].includes("-")?+n[r.value.key].split("-")[0]:+n[r.value.key].split("/")[0],(o===n?0:o>n?1:-1)*(r.value.isAsc?1:-1))):l.sort((o,n)=>(o=o[r.value.key],n=n[r.value.key],(o===n?0:o>n?1:-1)*(r.value.isAsc?1:-1)))}return l}return[]}),$=b(()=>a.columns),Ce=b(()=>a.sortable),se=b(()=>a.position),H=b(()=>a.groupedConfig),ue=b(()=>a.headingColumns),pe=b(()=>a.footRows),Le=b(()=>{var e;const l={};return a!=null&&a.minWidth?l["min-width"]=a.minWidth:(e=a==null?void 0:a.columns)!=null&&e.length&&a.columns.length>=4&&(I.value&&(l["min-width"]="39rem"),U.value&&(l["min-width"]="42rem")),l}),ce=()=>{var o,n,y,S,A,D,N,j,c,h,p,g,v,V,K,P,J,Z,G,F,R,i,E,ye;const l=m.value,e=l==null?void 0:l.parentElement;(l==null?void 0:l.scrollLeft)!=null&&(l==null?void 0:l.offsetWidth)!=null&&(Math.round((l==null?void 0:l.scrollLeft)+(l==null?void 0:l.offsetWidth)+2)<(l==null?void 0:l.scrollWidth)?(o=e==null?void 0:e.classList)!=null&&o.contains("scroll-right")||((n=e==null?void 0:e.classList)==null||n.add("scroll-right"),(y=e==null?void 0:e.classList)==null||y.remove("rounded-r-[10px]")):(S=e==null?void 0:e.classList)!=null&&S.contains("scroll-right")&&((A=e==null?void 0:e.classList)==null||A.remove("scroll-right"),(D=e==null?void 0:e.classList)==null||D.add("rounded-r-[10px]"))),(l==null?void 0:l.scrollLeft)!==0?(N=e==null?void 0:e.classList)!=null&&N.contains("scroll-left")||((j=e==null?void 0:e.classList)==null||j.add("scroll-left"),a.stickyColumns||((c=e==null?void 0:e.classList)==null||c.remove("rounded-l-[10px]"))):(h=e==null?void 0:e.classList)!=null&&h.contains("scroll-left")&&((p=e==null?void 0:e.classList)==null||p.remove("scroll-left"),a.stickyColumns||((g=e==null?void 0:e.classList)==null||g.add("rounded-l-[10px]"))),(l==null?void 0:l.scrollTop)!=null&&(l==null?void 0:l.offsetHeight)!=null&&(Math.round((l==null?void 0:l.scrollTop)+(l==null?void 0:l.offsetHeight)+2)<(l==null?void 0:l.scrollHeight)?(v=e==null?void 0:e.classList)!=null&&v.contains("scroll-bottom")||((V=e==null?void 0:e.classList)==null||V.add("scroll-bottom"),(K=e==null?void 0:e.classList)==null||K.remove("rounded-br-[10px]"),(P=e==null?void 0:e.classList)==null||P.remove("rounded-bl-[10px]"),(J=e==null?void 0:e.classList)==null||J.add("rounded-br-none"),(Z=e==null?void 0:e.classList)==null||Z.add("rounded-bl-none")):(G=e==null?void 0:e.classList)!=null&&G.contains("scroll-bottom")&&((F=e==null?void 0:e.classList)==null||F.remove("scroll-bottom"),(R=e==null?void 0:e.classList)==null||R.add("rounded-br-[10px]"),(i=e==null?void 0:e.classList)==null||i.add("rounded-bl-[10px]"),(E=e==null?void 0:e.classList)==null||E.remove("rounded-br-none"),(ye=e==null?void 0:e.classList)==null||ye.remove("rounded-bl-none")))},he=()=>{ce(),ne()},be=()=>{ce(),ne()};return je(()=>{console.log("[STable] --> hydrated"),a.disableScroll||(m.value&&m.value.addEventListener("scroll",be),ce(),ne(),window.addEventListener("resize",he))}),Fe(()=>{a.disableScroll||(m.value&&m.value.removeEventListener("scroll",be),window.removeEventListener("resize",he))}),_({sortBy:me}),(l,e)=>{var n,y,S,A,D,N,j;const o=we("SAdvert");return s(),t("div",{"data-test-id":"s-table__root",class:L(["s-table max-w-full overflow-hidden rounded-l-[10px] rounded-r-[10px]",..._e.value,{relative:l.stickyHeadEnabled}])},[w("div",{ref_key:"scrollingTableRef",ref:m,class:L(["s-table__wrapper scrolling-table-x overflow-x-auto",[{"scrolling-table-y overflow-y-auto":l.stickyHeadEnabled},l.stickyHeadEnabled&&l.stickyHeadClass?l.stickyHeadClass:"",l.wrapperClass]])},[w("table",{class:"w-full","aria-label":l.tableAriaLabel,style:fe(Le.value)},[w("thead",{class:L(["s-table-header",{"sticky top-0":l.stickyHeadEnabled}])},[l.hideDefaultHeader?C(l.$slots,"table-header-row-slot",{key:0},void 0,!0):k("",!0),(n=ue.value)!=null&&n.length&&!l.hideDefaultHeader?(s(),t("tr",Je,[(s(!0),t(f,null,M(ue.value,(c,h)=>{var p,g;return s(),t("th",{id:c.id,key:h,"data-test-id":"s-table__header-column",colspan:c!=null&&c.colspan&&c.colspan==="auto"&&((p=$.value)!=null&&p.length)?(g=$.value)==null?void 0:g.length:c.colspan,rowspan:c.rowspan,scope:"colgroup",class:L(["s-table-header__column s-text-small-bold !bg-primary select-none whitespace-nowrap !uppercase",c!=null&&c.class?c.class:""])},[C(l.$slots,"table-heading-column",{column:c},()=>[Q(x(c.label),1)],!0)],10,Ze)}),128))])):k("",!0),(y=$.value)!=null&&y.length&&(!l.hideDefaultHeader||l.useSortColumnOnHideDefaultHeader)?(s(),t("tr",{key:2,class:L(["s-table-header__row",{"s-table-header__row--subheading":(S=ue.value)==null?void 0:S.length}])},[(s(!0),t(f,null,M($.value,(c,h)=>(s(),z(Ie,{key:h,headerClass:l.headerClass,headerTextClass:l.headerTextClass,column:c,sortable:Ce.value,position:se.value,sort:r.value,onSortChange:me},{"table-column-heading":X(p=>[C(l.$slots,"table-column",{column:p.column},()=>[p.column.label===""?(s(),t("span",{key:0,class:"s-table-header__column-label sr-only","aria-label":p.column.ariaLabel},x(p.column.sronly||"-"),9,Ge)):(s(),t("span",{key:1,class:"s-table-header__column-label","aria-label":p.column.ariaLabel},x(p.column.label),9,Qe))],!0)]),_:2},1032,["headerClass","headerTextClass","column","sortable","position","sort"]))),128))],2)):k("",!0)],2),C(l.$slots,"table-body-slot",{},void 0,!0),w("tbody",Xe,[C(l.$slots,"table-row-slot",{},void 0,!0),((A=re.value)==null?void 0:A.length)==0&&l.customEmptyTableMsg?(s(),t("tr",Ye,[w("td",{colspan:((D=l.columns)==null?void 0:D.length)+1,class:"!text-center"},x(l.customEmptyTableMsg),9,el)])):k("",!0),(s(!0),t(f,null,M(re.value,(c,h)=>{var p,g,v,V,K,P,J,Z,G;return s(),t(f,{key:h},[l.htlads&&ke(h)?(s(),t("tr",ll,[w("td",{class:"!m-0 w-[100px] !py-4",colspan:(p=l.columns)==null?void 0:p.length},[w("div",sl,[w("div",{class:"relative sticky left-[24px] right-[24px] flex justify-center",style:fe({width:(g=m.value)!=null&&g.offsetWidth?`${((v=m.value)==null?void 0:v.offsetWidth)-48}px`:"100vw"})},[ge(o,{adSlotName:"htlad-common-middle"+(B(O)>1?B(O):"")},null,8,["adSlotName"])],4)])],8,al)])):k("",!0),l.$slots.ad&&Se.value===h?(s(),t("tr",tl,[w("td",{class:"!m-0 !p-0",colspan:(V=l.columns)==null?void 0:V.length},[C(l.$slots,"ad",{},void 0,!0)],8,ol)])):k("",!0),H.value&&((K=H.value)!=null&&K.listField)&&((P=H.value)!=null&&P.dateField||(J=H.value)!=null&&J.groupField)?(s(),t(f,{key:2},[(Z=H.value)!=null&&Z.dateField?(s(),t("tr",rl,[w("td",{class:"s-table-body__row--group-title-column s-text-paragraph-bold",colspan:$.value.length},x(B(te)(c,H.value.dateField)?B(Ve)(new Date(B(te)(c,H.value.dateField)).toISOString(),"cccc, LLLL d"):""),9,nl)])):k("",!0),(G=H.value)!=null&&G.groupField?(s(),t("tr",ul,[w("td",{class:"s-table-body__row--group-title-column s-text-paragraph-bold",colspan:$.value.length},x(B(te)(c,H.value.groupField)?B(te)(c,H.value.groupField):""),9,cl)])):k("",!0),(s(!0),t(f,null,M(c[H.value.listField],F=>(s(),t("tr",{key:F.id,class:L(["s-table-body__row",["s-table-body__row--index-"+h]])},[(s(!0),t(f,null,M($.value,(R,i)=>(s(),z(ie,{key:i,position:se.value,row:F,column:R},{"table-row-cell":X(E=>[C(l.$slots,"table-cell-"+R.field,{column:E.column,row:E.row,rowValue:E.rowValue},()=>[E.column.html?(s(),t("span",{key:1,innerHTML:E.rowValue},null,8,il)):(s(),t(f,{key:0},[Q(x(E.rowValue),1)],64))],!0)]),_:2},1032,["position","row","column"]))),128))],2))),128))],64)):(s(),t("tr",{key:3,class:L(["s-table-body__row",["s-table-body__row--index-"+h]])},[(s(!0),t(f,null,M($.value,(F,R)=>(s(),z(ie,{key:R,position:se.value,row:c,column:F},{"table-row-cell":X(i=>[C(l.$slots,"table-cell-"+F.field,{column:i.column,row:i.row,rowValue:i.rowValue},()=>[i.column.image?(s(),t("img",{key:0,src:i.rowValue,alt:"-",class:"object-cover"},null,8,dl)):i.column.imageWithLabel?(s(),t("div",ml,[i.rowValue?(s(),z(Be,{key:0,alt:i.row[i.column.labelStr]||"",class:"mr-3 hidden max-h-[21px] max-w-[21px] rounded-full object-cover sm:block",images:[{breakpoint:0,image:i.rowValue?B(Te)({url:i.rowValue,bucket:B(q)}):B(T),width:21,height:21}]},null,8,["alt","images"])):k("",!0),c.playerUrl?(s(),t("a",{key:1,href:c.playerUrl,class:"text-theme-link-light s-text-paragraph-bold flex !underline"},x(i.row[i.column.labelStr]),9,pl)):(s(),t(f,{key:2},[Q(x(i.row[i.column.labelStr]),1)],64))])):i.column.imageWithLabelHiddenLabel?(s(),t("div",hl,[i.rowValue?(s(),t("img",{key:0,src:i.rowValue,alt:"",class:"rounded-full object-cover"},null,8,bl)):k("",!0),w("span",yl,x(i.row[i.column.labelStr]),1)])):i.column.html?(s(),t("span",{key:4,innerHTML:i.rowValue},null,8,vl)):(s(),t(f,{key:3},[Q(x(i.rowValue),1)],64))],!0)]),_:2},1032,["position","row","column"]))),128))],2))],64)}),128))]),((N=re.value)==null?void 0:N.length)!=0?C(l.$slots,"footer",{key:0},void 0,!0):k("",!0),(j=pe.value)!=null&&j.length?(s(),t("tfoot",fl,[(s(!0),t(f,null,M(pe.value,(c,h)=>(s(),t("tr",{key:h,class:L(["s-table-foot__row",["s-table-foot__row--index-"+h]])},[(s(!0),t(f,null,M($.value,(p,g)=>(s(),z(ie,{key:g,position:se.value,row:c,column:{...p,isRowHeader:p.isFootRowHeader},footCell:""},{"table-row-cell":X(v=>[C(l.$slots,"table-foot-cell-"+p.field,{column:v.column,row:v.row,rowValue:v.rowValue},()=>[v.column.html?(s(),t("span",{key:1,innerHTML:v.rowValue},null,8,wl)):(s(),t(f,{key:0},[Q(x(v.rowValue),1)],64))],!0)]),_:2},1032,["position","row","column"]))),128))],2))),128))])):k("",!0)],12,Pe)],2)],2)}}}),Cl=de(kl,[["__scopeId","data-v-8aad6335"]]);export{Cl as default};

AltStyle によって変換されたページ (->オリジナル) /