@iamproperty/components 5.7.0 → 5.7.1-beta2

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.
Files changed (36) hide show
  1. package/README.md +1 -102
  2. package/assets/js/components/accordion/accordion.component.min.js +1 -1
  3. package/assets/js/components/actionbar/actionbar.component.min.js +1 -1
  4. package/assets/js/components/address-lookup/address-lookup.component.min.js +1 -1
  5. package/assets/js/components/applied-filters/applied-filters.component.min.js +1 -1
  6. package/assets/js/components/card/card.component.min.js +1 -1
  7. package/assets/js/components/carousel/carousel.component.min.js +1 -1
  8. package/assets/js/components/collapsible-side/collapsible-side.component.min.js +1 -1
  9. package/assets/js/components/fileupload/fileupload.component.min.js +1 -1
  10. package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
  11. package/assets/js/components/header/header.component.min.js +1 -1
  12. package/assets/js/components/inline-edit/inline-edit.component.min.js +1 -1
  13. package/assets/js/components/marketing/marketing.component.min.js +1 -1
  14. package/assets/js/components/multiselect/multiselect.component.min.js +1 -1
  15. package/assets/js/components/nav/nav.component.js +1 -0
  16. package/assets/js/components/nav/nav.component.min.js +5 -5
  17. package/assets/js/components/nav/nav.component.min.js.map +1 -1
  18. package/assets/js/components/notification/notification.component.min.js +1 -1
  19. package/assets/js/components/pagination/pagination.component.min.js +1 -1
  20. package/assets/js/components/search/search.component.min.js +1 -1
  21. package/assets/js/components/slider/slider.component.min.js +1 -1
  22. package/assets/js/components/table/table.component.js +1 -4
  23. package/assets/js/components/table/table.component.min.js +3 -3
  24. package/assets/js/components/table/table.component.min.js.map +1 -1
  25. package/assets/js/components/tabs/tabs.component.min.js +1 -1
  26. package/assets/js/dynamic.min.js +1 -1
  27. package/assets/js/scripts.bundle.js +3 -3
  28. package/assets/js/scripts.bundle.js.map +1 -1
  29. package/assets/js/scripts.bundle.min.js +2 -2
  30. package/assets/js/scripts.bundle.min.js.map +1 -1
  31. package/assets/ts/components/nav/nav.component.ts +1 -0
  32. package/assets/ts/components/table/table.component.ts +2 -5
  33. package/dist/components.es.js +11 -11
  34. package/dist/components.umd.js +46 -41
  35. package/package.json +1 -1
  36. package/src/components/Table/Table.vue +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.0
2
+ * iamKey v5.7.1-beta2
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */const B=function(o){return typeof o!="string"?!1:!isNaN(o)&&!isNaN(parseFloat(o))},Q=(o,e)=>String(o).padStart(e,"0"),X=o=>o.charAt(0).toUpperCase()+o.slice(1),S=(o,e,n)=>e.split(/[\.\[\]\'\"]/).filter(a=>a).reduce((a,h)=>a?a[h]:n,o);var Y=function(o,e,n,a){function h(d){return d instanceof n?d:new n(function(i){i(d)})}return new(n||(n=Promise))(function(d,i){function l(c){try{t(a.next(c))}catch(r){i(r)}}function s(c){try{t(a.throw(c))}catch(r){i(r)}}function t(c){c.done?d(c.value):h(c.value).then(l,s)}t((a=a.apply(o,e||[])).next())})};const R=o=>{const e=Array.from(o.querySelectorAll("thead th"));Array.from(o.querySelectorAll("tbody tr")).forEach((a,h)=>{const d=Array.from(a.querySelectorAll("th, td")),i=["0","low","medium","high","unknown","n/a","pending","verified","due","overdue","incomplete","complete","completed","approval required","upcoming","requires approval","to do","on track","not started","warning","error"];d.forEach((l,s)=>{const t=e[s];if(typeof t<"u"){let c=document.createElement("div");c.innerHTML=t.innerHTML;let r=c.textContent||c.innerText||"";l.setAttribute("data-label",r),t.hasAttribute("data-td-class")&&l.setAttribute("class",t.getAttribute("data-td-class")),t.hasAttribute("data-format")&&(l.setAttribute("data-format",t.getAttribute("data-format")),l.innerHTML=D(t.getAttribute("data-format"),l.textContent.trim())),i.includes(l.textContent.trim().toLowerCase())&&l.setAttribute("data-content",l.textContent.trim().toLowerCase())}})})},J=o=>{let e=0;return Array.from(o.querySelectorAll("tbody tr")).forEach((n,a)=>{let h=window.getComputedStyle(document.querySelector("html")),d=n.querySelector(":scope > *:last-child > *:first-child");if(d){d.classList.add("text-nowrap");let i=d.offsetWidth/parseFloat(h.fontSize);i+=1.7,e=e>i?e:i}}),e},G=(o,e)=>{if(e.classList.contains("table--fullwidth")&&!e.hasAttribute("data-expandable")||o.querySelectorAll("thead tr th").length<4&&!e.hasAttribute("data-expandable"))return!1;Array.from(o.querySelectorAll("thead tr")).forEach((n,a)=>{o.querySelectorAll("thead tr th.expand-button-heading").length||n.insertAdjacentHTML("afterbegin",'<th class="th--fixed expand-button-heading"></th>')}),Array.from(o.querySelectorAll("tbody tr")).forEach((n,a)=>{const h=n.getAttribute("data-view")==="full"?"aria-expanded":"";n.insertAdjacentHTML("afterbegin",`<td class="td--fixed td--expand"><button class="btn btn-compact btn-secondary" data-expand-button ${h}>Expand</button></td>`)})},V=o=>{o.addEventListener("click",e=>{if(e&&e.target instanceof HTMLElement&&e.target.closest("[data-expand-button]")){let n=e.target.closest("[data-expand-button]"),a=n.closest("tr");n.toggleAttribute("aria-expanded"),a.getAttribute("data-view")=="full"?a.setAttribute("data-view","default"):a.setAttribute("data-view","full"),n.blur()}})},N=(o,e)=>{let n=e.querySelector("input[data-search]");if(!n)return!1;const a=n.getAttribute("id"),h=n.getAttribute("data-search").split(",");let d=n.parentNode,i={};h.forEach((l,s)=>{Array.from(o.querySelectorAll('td[data-label="'+l.trim()+'"]')).forEach((t,c)=>{t.querySelector(".td__content")?i[t.querySelector(".td__content").textContent]=t.querySelector(".td__content").textContent:i[t.textContent]=t.textContent})}),n.setAttribute("list",`${a}_list`),n.setAttribute("autocomplete","off"),d.querySelector("datalist")||(d.innerHTML+=`<datalist id="${a}_list"></datalist>`),d.querySelector("datalist").innerHTML=`${Object.keys(i).map(l=>`<option value="${l}"></option>`).join("")}`},K=(o,e,n,a,h)=>{var d;let i=function(t,c=!1){if(a.hasAttribute("data-no-submit")||e.classList.contains("processing"))return!1;if(Array.from(e.querySelectorAll("iam-applied-filters")).forEach((r,p)=>{var u=new Event("tags-set");r.dispatchEvent(u)}),t.type=="submit"&&(e.classList.add("processing"),Array.from(e.querySelectorAll("[data-duplicate]")).forEach((r,p)=>{const u=r.getAttribute("data-duplicate"),b=document.getElementById(u),y=document.querySelector(`[for="${u}"] iam-card`);if(b.checked!=r.checked)if(y){let w=new Event("click");y.dispatchEvent(w)}else b.checked=r.checked}),e.classList.remove("processing")),e.hasAttribute("data-ajax")){if(!c){let r=e.querySelector("[data-pagination]");r.value=1,a.setAttribute("data-page",1)}I(o,e,n,a)}else e.hasAttribute("data-submit")?e.submit():(C(o,e,a),$(o,e));if(e.hasAttribute("data-ajax-post")){let r=new FormData(e),p=new URLSearchParams(r).toString();const u=new XMLHttpRequest;u.open("GET",`${window.location.href}?ajax=true&${p}`),u.send()}};e.querySelector("iam-actionbar[data-search]")&&e.querySelector("iam-actionbar[data-search]").addEventListener("search-submit",t=>{e.querySelector("input[data-search]")?e.querySelector("input[data-search]").value=t.detail.search:e.insertAdjacentHTML("beforeend",`<input type="hidden" name="search" data-search="${e.querySelector("iam-actionbar[data-search]").getAttribute("data-search")}" value="${t.detail.search}"/>`),clearTimeout(d),i(t)}),e.addEventListener("keyup",t=>{clearTimeout(d),t&&t.target instanceof HTMLElement&&t.target.closest("input[data-search]")&&(d=setTimeout(function(){i(t)},500))}),e.addEventListener("change",t=>{if(clearTimeout(d),t&&t.target instanceof HTMLElement&&t.target.closest("[data-sort]")&&(e.hasAttribute("data-submit")||O(o,e,h),i(t)),t&&t.target instanceof HTMLElement&&t.target.closest("input[data-search]")&&i(t),t&&t.target instanceof HTMLElement&&t.target.closest("[data-filter][data-no-ajax]")?(C(o,e,a),$(o,e)):(t&&t.target instanceof HTMLElement&&t.target.closest("[data-filter]")&&t.target.closest("form .dialog__wrapper > dialog")||t&&t.target instanceof HTMLElement&&t.target.closest("[data-filter]")&&!t.target.closest("form dialog"))&&i(t),t&&t.target instanceof HTMLElement&&t.target.closest("[data-show]")&&i(t),t&&t.target instanceof HTMLElement&&t.target.closest("[data-mimic]")&&i(t),t&&t.target instanceof HTMLElement&&t.target.hasAttribute("id")){let c=t.target.getAttribute("id");document.querySelector(`[data-duplicate="${c}"]`)&&(document.querySelector(`[data-duplicate="${c}"]`).checked=t.target.checked)}}),e.addEventListener("click",t=>{if(clearTimeout(d),t&&t.target instanceof HTMLElement&&t.target.closest('dialog button:not([type="button"])')&&t.target.closest('dialog button:not([type="button"])').closest("dialog").close(),t&&t.target instanceof HTMLElement&&t.target.closest(".dialog__close")&&(t.preventDefault(),t.stopPropagation()),t&&t.target instanceof HTMLElement&&t.target.closest("[data-clear]")){e.classList.add("processing"),Array.from(e.querySelectorAll(".applied-filters")).forEach((r,p)=>{r.innerHTML=""});let c=e.elements;for(let r=0;r<c.length;r++)switch(c[r].type.toLowerCase()?c[r].type.toLowerCase():"text"){case"text":case"password":case"textarea":c[r].value="";break;case"radio":case"checkbox":if(c[r].checked){let u=c[r],b=u.getAttribute("id"),y=document.querySelector(`[for="${b}"`);if(y.querySelector("iam-card")){let w=y.querySelector("iam-card"),L=new Event("click");w.dispatchEvent(L)}u.checked=!1}break;case"select-one":case"select-multi":c[r].selectedIndex=-1;break}e.classList.remove("processing"),e.hasAttribute("data-submit")||O(o,e,h),i(t)}}),e.addEventListener("submit",t=>{clearTimeout(d),e.hasAttribute("data-submit")||t.preventDefault(),i(t)}),e.addEventListener("force",t=>{i(t)}),e.addEventListener("paginate",t=>{i(t,!0)});let l=[],s=[];Array.from(e.querySelectorAll("[data-mimic]")).forEach((t,c)=>{let r=t.getAttribute("data-mimic");Array.from(document.querySelectorAll(`[name="${r}"]`)).forEach((p,u)=>{let b=p.closest("form");l.includes(b)||l.push(b),s.includes(r)||s.push(r)})}),l.forEach((t,c)=>{const r=function(){let p=[],u=new FormData(t);for(const[b,y]of u)document.querySelector(`[data-mimic="${b}"]`)&&!p.includes(b)?(p.push(b),document.querySelector(`[data-mimic="${b}"]`).value=y):document.querySelector(`[data-mimic="${b}"]`)&&(document.querySelector(`[data-mimic="${b}"]`).value+=","+y);for(const b of p){const y=new Event("force");e.dispatchEvent(y)}for(const b of s)if(!u.has(b)&&t.querySelector(`[name="${b}"]`)){document.querySelector(`[data-mimic="${b}"]`).value="";const y=new Event("force");e.dispatchEvent(y)}};t.addEventListener("force",p=>{r()}),t.addEventListener("change",p=>{r()})})},O=(o,e,n)=>{if(e.getAttribute("data-ajax"))return!1;let a=o.querySelector("tbody"),h=e.querySelector('input[type="radio"][data-sort]:checked');if(e.querySelector("select[data-sort]")){let r=e.querySelector("select[data-sort]");h=e.querySelector(`select[data-sort] option:nth-child(${r.selectedIndex+1})`)}let d=h.getAttribute("data-sort"),i=h.getAttribute("data-order"),l=h.getAttribute("data-format");if(!d)return a.innerHTML=n.innerHTML,R(o),!1;let s=[];["asc","desc","descending"].includes(i)||(s=i.split(","));let t=[];Array.from(a.querySelectorAll("tr")).forEach((r,p)=>{let u=r.querySelector('td[data-label="'+d+'"], th[data-label="'+d+'"]').textContent.trim();r.querySelector('[data-label="'+d+'"] .td__content')&&(u=r.querySelector('[data-label="'+d+'"] .td__content').textContent.trim()),s.length&&s.includes(u)&&(u=s.indexOf(u)),B(u)&&(u=Q(u,10)),l&&l=="date"&&(u=new Date(u));const b={index:u,row:r};t.push(b)}),t.sort((r,p)=>r.index>p.index?1:-1),(i=="descending"||i=="desc")&&(t=t.reverse());let c="";t.forEach((r,p)=>{c+=r.row.outerHTML}),a.innerHTML=c},C=(o,e,n)=>{o.classList.remove("table--filtered");let a=z(e),h=[],d=0,i=e.querySelector("[data-pagination]")?parseInt(e.querySelector("[data-pagination]").value):1,l=e.querySelector("[data-show]")?parseInt(e.querySelector("[data-show]").value):15;if(Array.from(o.querySelectorAll("tbody tr")).forEach((t,c)=>{t.classList.remove("filtered"),t.classList.remove("filtered--matched"),t.classList.remove("filtered--show"),t.removeAttribute("data-filtered-by")}),e.querySelector("input[data-search]")){let t=e.querySelector("input[data-search]");e.querySelector("input[data-search]").getAttribute("data-search").split(",").forEach((r,p)=>{h.push({column:`${r.trim()}`,value:`${t.value}`})})}Array.from(e.querySelectorAll("[data-filter-count]")).forEach((t,c)=>{t.innerHTML="",t.parentNode.classList.remove("hover")});let s=0;Object.values(a).forEach((t,c)=>{typeof t=="object"&&Object.values(t).length?s+=Object.values(t).length:s++}),s&&Array.from(e.querySelectorAll("[data-filter-count]")).forEach((t,c)=>{t.innerHTML+=`(${s})`,t.parentNode.classList.add("hover")}),o.classList.add("table--filtered");for(const[t,c]of Object.entries(a))Array.from(o.querySelectorAll("tbody tr:not(.filtered)")).forEach((r,p)=>{let u=!1;c.forEach((b,y)=>{let w=r.querySelector(`[data-label="${t}"]`);if(b.includes("-date-from")){let f=new Date(b.replace("-date-from","")),g=new Date(w.textContent.toLowerCase());f.setHours(0,0,0,0),g.setHours(0,0,0,0),g<f?(r.classList.add("less-than-from-date"),u=!1):!r.classList.contains("less-than-from-date")&&!r.classList.contains("greater-than-to-date")&&(u=!0)}else if(b.includes("-date-to")){let f=new Date(b.replace("-date-to","")),g=new Date(w.textContent.toLowerCase());f.setHours(0,0,0,0),g.setHours(0,0,0,0),g>f?(r.classList.add("greater-than-to-date"),u=!1):!r.classList.contains("less-than-from-date")&&!r.classList.contains("greater-than-to-date")&&(u=!0)}if(b&&b=="$today")b=D("date",new Date);else if(b&&b=="$yesterday"){let f=new Date;f.setDate(f.getDate()-1),b=D("date",f)}else if(b&&(b=="$thisWeek"||b=="$lastWeek")){let f=new Date,g=new Date(f.setDate(f.getDate()-(f.getDay()-1))),m=new Date(f.setDate(f.getDate()-f.getDay()+7)),x=new Date(w.textContent.toLowerCase());if(f.setHours(0,0,0,0),g.setHours(0,0,0,0),m.setHours(0,0,0,0),x.setHours(0,0,0,0),b=="$thisWeek")u=x>=g&&x<=m;else{let A=new Date(g.setDate(g.getDate()-7)),k=new Date(m.setDate(m.getDate()-7));A.setHours(0,0,0,0),k.setHours(0,0,0,0),u=x>=A&&x<=k}}else if(b&&b=="$thisMonth"){let f=new Date,g=f.getFullYear(),m=f.getMonth();var L=new Date(g,m,1),q=new Date(g,m+1,0);let x=new Date(w.textContent.toLowerCase());L.setHours(0,0,0,0),q.setHours(0,0,0,0),x.setHours(0,0,0,0),u=x>=L&&x<=q}else if(b&&b=="$lastMonth"){let f=new Date,g=f.getFullYear(),m=f.getMonth();var E=new Date(g,m-1,1),v=new Date(g,m,0);let x=new Date(w.textContent.toLowerCase());E.setHours(0,0,0,0),v.setHours(0,0,0,0),x.setHours(0,0,0,0),u=x>=E&&x<=v}w&&w.textContent.toLowerCase().includes(b.replace("-"," ").toLowerCase())&&(u=!0)}),u||(r.classList.add("filtered"),r.setAttribute("data-filtered-by",t))});Array.from(o.querySelectorAll("tbody tr:not(.filtered)")).forEach((t,c)=>{let r=!(h.length>0&&h[0].value.length>=3);h.forEach((p,u)=>{let b=t.querySelector(`[data-label="${p.column}"]`);b&&p.value.length>=3&&b.textContent.toLowerCase().includes(p.value.toLowerCase())&&(r=!0)}),r||t.classList.add("filtered")}),Array.from(o.querySelectorAll("tbody tr:not(.filtered")).forEach((t,c)=>{d++,t.classList.add("filtered--matched"),Math.ceil(d/l)==parseInt(i)&&t.classList.add("filtered--show")}),n&&(n.setAttribute("data-total",d),n.setAttribute("data-show",l),n.setAttribute("data-page",i))},$=(o,e,n)=>{Array.from(e.querySelectorAll("[data-query]")).forEach((h,d)=>{let i=h.getAttribute("data-query"),l=0;if(i=="total")n.hasAttribute("data-total")?l=n.getAttribute("data-total"):l=(o.classList.contains("table--filtered"),o.querySelectorAll("tbody tr").length);else if(!i.includes(" == ")&&i.includes(" & ")){let s=i.split(" & "),t="";s.forEach(c=>{t+=`:not([data-filtered-by="${c}"])`}),l=Array.from(o.querySelectorAll(`tbody tr${t}`)).length}else if(!i.includes(" == "))l=Array.from(o.querySelectorAll(`tbody tr:not([data-filtered-by="${i}"])`)).length;else if(i.includes(" && ")){let s=i.split(" && ");l=Array.from(o.querySelectorAll("tbody tr:not(.filtered)")).filter(function(t){let c=!0;for(const[r,p]of Object.entries(s)){let u=p.split(" == ");(!t.querySelector(`td[data-label="${u[0]}"]`)||t.querySelector(`td[data-label="${u[0]}"]`).textContent!=`${u[1]}`)&&(c=!1)}return c}).length}else{let s=i.split(" == ");l=Array.from(o.querySelectorAll(`tbody tr.filtered--matched td[data-label="${s[0]}"], tbody tr[data-filtered-by="${s[0]}"] td[data-label="${s[0]}"]`)).filter(function(t){return t.textContent===s[1]}).length}h.hasAttribute("data-total")?h.setAttribute("data-total",l):h.innerHTML=l})},Z=function(o,e,n,a){if(a.hasAttribute("data-no-submit"))return!1;n.addEventListener("update-page",h=>{let d=e.querySelector("[data-pagination]"),i=h.detail.page;if(d.value=i,e.dispatchEvent(new Event("paginate")),a.setAttribute("data-page",i),o.hasAttribute("data-show-history")){const l=new URL(location);l.searchParams.set("page",i),history.pushState({type:"pagination",form:e.getAttribute("id"),page:i},"",l)}if(!a.hasAttribute("data-no-scroll")){const s=o.getBoundingClientRect().top+window.pageYOffset+-250;window.scrollTo({top:s,behavior:"smooth"})}}),n.addEventListener("update-show",h=>{let d=e.querySelector("[data-show]"),i=h.detail.show;d.value=i,a.setAttribute("data-show",i),e.dispatchEvent(new Event("submit"))})},tt=(o,e)=>{if(!o)return!1;o.addEventListener("click",n=>{et(e)})},et=function(o){for(var e=[],n=o.getElementsByTagName("tr"),a=0;a<n.length;a++){for(var h=n[a].querySelectorAll("td,th"),d=[],i=0;i<h.length;i++)d.push(`"${h[i].textContent}"`);e.push(d.join(","))}e=e.join(`
5
5
  `);let l=new Blob([e],{type:"text/csv"});var s=document.createElement("a");s.download="export.csv";var t=window.URL.createObjectURL(l);s.href=t,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)},P=function(o,e,n,a){if(R(o),G(o,a),$(o,e,a),a&&a.classList.contains("table--cta")){let d=function(){Array.from(o.querySelectorAll("tr")).forEach((i,l)=>{let s=i.offsetHeight;i.style.setProperty("--row-height",`${s}px`)})};const h=J(o);a.style.setProperty("--cta-width",`${h}rem`),new ResizeObserver(d).observe(o)}},z=function(o){let e=new Object;return Array.from(o.querySelectorAll("[data-filter]")).forEach((a,h)=>{if(!(a.type=="radio"&&!a.checked)&&!(a.type=="checkbox"&&!a.checked)&&a&&a.value){let d=a.getAttribute("data-filter"),i=a.value;a.hasAttribute("data-date-from")&&(i+="-date-from"),a.hasAttribute("data-date-to")&&(i+="-date-to"),e[d]||(e[d]=new Array),e[d].push(i)}}),e},I=function(o,e,n,a){return Y(this,void 0,void 0,function*(){let h=new FormData(e),d=new URLSearchParams(h).toString(),i=o.querySelectorAll("thead tr th:not(.expand-button-heading)"),l=o.querySelector("tbody"),s=e.getAttribute("data-ajax");a.classList.add("table--loading");let t=z(e);Array.from(e.querySelectorAll("[data-filter-count]")).forEach((p,u)=>{p.innerHTML="",p.parentNode.classList.remove("hover")});let c=0;Object.values(t).forEach((p,u)=>{typeof p=="object"&&Object.values(p).length?c+=Object.values(p).length:c++}),c&&Array.from(e.querySelectorAll("[data-filter-count]")).forEach((p,u)=>{p.innerHTML+=`(${c})`,p.parentNode.classList.add("hover")}),window.controller||(window.controller=[]),window.controller[s]&&window.controller[s].abort(),window.controller[s]=new AbortController;const{signal:r}=controller[s];n.setAttribute("data-loading","true"),e.classList.add("processing");try{yield fetch(s+"?"+d,{signal:r,method:"get",credentials:"same-origin",headers:new Headers({"Content-Type":"application/json",Accept:"application/json","X-Requested-With":"XMLHttpRequest"})}).then(p=>p.json()).then(p=>{let u=e.hasAttribute("data-schema")?e.getAttribute("data-schema"):"data",b=e.hasAttribute("data-schema-total")?e.getAttribute("data-schema-total"):"meta.total",y=e.hasAttribute("data-schema-page")?e.getAttribute("data-schema-page"):"meta.current_page",w=S(p,b,15),L=S(p,y,1),q=S(p,u),E=a.hasAttribute("data-empty-msg")?a.getAttribute("data-empty-msg"):"No results found";q?(l.innerHTML="",q.forEach((v,f)=>{var g=document.createElement("tr");i.forEach((m,x)=>{let A="";var k=document.createElement("td");if(k.setAttribute("data-label",m.innerText),m.getAttribute("data-output")){var H=m.getAttribute("data-output");A=H.replace(new RegExp(/{(.*?)}/,"gm"),function(M){return S(v,M.replace("{","").replace("}",""))})}if(m.hasAttribute("data-output-array")){var H=m.getAttribute("data-output");let F=S(v,H.replace("{","").replace("}",""));A="",F.forEach((j,it)=>{let W=m.getAttribute("data-output-array"),T="";if(m.hasAttribute("data-output-array-property")&&m.hasAttribute("data-output-array-transform")){const _=S(j,m.getAttribute("data-output-array-property")),U=JSON.parse(m.getAttribute("data-output-array-transform"))[_];T=W.replace(`{${m.getAttribute("data-output-array-property")}}`,U)}T=T.replace(new RegExp(/{(.*?)}/,"gm"),function(_){return S(j,_.replace("{","").replace("}",""))}),A+=T})}m.hasAttribute("data-transform")&&(A=JSON.parse(m.getAttribute("data-transform"))[A],!A&&m.hasAttribute("data-default")&&(A=m.getAttribute("data-default"))),k.innerHTML=A,g.appendChild(k)}),l.appendChild(g)}),N(o,e),a.setAttribute("data-total",parseInt(w)),a.setAttribute("data-page",parseInt(L)),P(o,e,n,a),Array.from(e.querySelectorAll("[data-ajax-query]")).forEach((v,f)=>{let g=S(p,v.getAttribute("data-ajax-query"),"");v.hasAttribute("data-total")?v.setAttribute("data-total",g):v.innerHTML=g}),parseInt(w)==0&&(l.innerHTML=`<tr><td colspan="100%"><span>${E}</span></td></tr>`),a.classList.remove("table--loading"),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"Ajax table loaded",url:s,formData:d})):l.innerHTML='<tr><td colspan="100%"><span>Error loading table</span></td></tr>',n.removeAttribute("data-loading"),e.classList.remove("processing")})}catch(p){console.log(p)}})},D=(o,e)=>{switch(o){case"datetime":return new Date(e).toLocaleDateString("en-gb",{weekday:"short",year:"2-digit",month:"long",day:"numeric"})+" "+new Date(e).toLocaleTimeString("en-gb",{hour:"2-digit",minute:"2-digit"});case"date":return new Date(e).toLocaleDateString("en-gb",{day:"numeric",month:"long",year:"2-digit"});case"capitalise":return e=X(e)}};class at extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const e=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",n=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${e}/css/core.min.css`,a=document.createElement("template");a.innerHTML=`
@@ -26,7 +26,7 @@
26
26
  <slot></slot>
27
27
  </div>
28
28
  </div>
29
- <iam-pagination class="pagination--table" ${this.hasAttribute("data-page")?`data-page="${this.getAttribute("data-page")}"`:""} ></iam-pagination>
29
+ <iam-pagination part="pagination" class="pagination--table" ${this.hasAttribute("data-page")?`data-page="${this.getAttribute("data-page")}"`:""} ></iam-pagination>
30
30
  `,this.shadowRoot.appendChild(a.content.cloneNode(!0)),document.getElementById("tableExtras")||document.head.insertAdjacentHTML("beforeend",`<style id="tableExtras">*:has(>iam-table){container-type:inline-size}iam-table{--hover-background: var(--colour-light);--row-bg: var(--colour-canvas-2)}iam-table thead tr{background:var(--row-bg)}iam-table tbody tr{background:var(--row-bg)}iam-table tbody tr:is(:hover,:focus-within,.hover){--bg-colour-rgb: 238,238,238;--row-bg: var(--hover-background);background:var(--row-bg)}iam-table[data-expandable] [data-expand-button][aria-expanded]{background-color:rgba(0,0,0,0)}@container (width < 23.4375em){iam-table:not(.table--fullwidth) thead{display:none}iam-table:not(.table--fullwidth) tbody{display:block;overflow:visible}iam-table:not(.table--fullwidth) tbody tr td:first-child{padding-top:0}iam-table:not(.table--fullwidth) tr{display:block;position:relative;border:none;background:var(--row-bg);padding:var(--wrapper-padding);box-shadow:0px 6px 12px rgba(0,0,0,.11);border-radius:0.5rem;height:auto}iam-table:not(.table--fullwidth) tr+tr{margin-top:2rem}iam-table:not(.table--fullwidth) tr:is(:hover,:focus,.hover){--row-bg: var(--colour-canvas-2)}iam-table:not(.table--fullwidth) :is(td,th){display:block;border-color:var(--colour-border);padding-right:0}iam-table:not(.table--fullwidth) :is(td,th):nth-child(1){border-top:none}iam-table:not(.table--fullwidth) :is(td,th)[data-label]:not([data-label=""]):before{content:attr(data-label);color:var(--colour-heading);padding:0 0 0.375rem 0;margin-bottom:0;display:block;font-weight:bold}iam-table:not(.table--fullwidth) td:first-child::after{top:1.75rem !important}iam-table:not(.table--fullwidth) td::after{top:2.5rem}iam-table:not(.table--fullwidth) .td--fixed{padding-right:50%}iam-table:not(.table--fullwidth) tbody tr td:not(:first-child){border-top:var(--border-width) solid currentColor;border-color:var(--colour-border) !important}iam-table:not(.table--fullwidth) tr:not([data-view=full]) td p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}iam-table:not(.table--fullwidth) td:has([data-expand-button]){height:0;padding:0;position:relative}iam-table:not(.table--fullwidth) td:has([data-expand-button])+td{border-top:none !important;padding-top:0 !important}iam-table:not(.table--fullwidth) [data-expand-button]{top:0;right:0;background:rgba(0,0,0,0) !important;border:none;position:absolute;overflow:hidden;--compact-size: 2rem}iam-table:not(.table--fullwidth) [data-expand-button]:before{font-family:"Font Awesome 6 Pro";content:"\uF055";font-weight:300 !important;font-size:1.75rem;line-height:var(--compact-size) !important}iam-table:not(.table--fullwidth) [data-expand-button][aria-expanded]:before{content:"\uF056";font-weight:900 !important}iam-table:not(.table--fullwidth) .dialog__wrapper:not([slot=overflow]){margin-top:-0.5rem;margin-left:-1rem;z-index:10}iam-table:not(.table--fullwidth) tbody tr:not([data-view=full]) td:not(.td--fixed)+td:not(.td--fixed)+td+td{display:none}iam-table.table--cta:not(.table--fullwidth) tr td:not(:first-child):last-child{display:block !important;position:static;width:100%;min-width:100%;margin-left:0;padding-left:0;text-align:left;min-height:0}iam-table.table--cta:not(.table--fullwidth) tr td:not(:first-child):last-child:after{display:none}}@container (width > 23.4375em){iam-table.table--cta:not(.table--loading):has(tr:first-child td:first-child:last-child){padding-right:calc(var(--wrapper-padding) + 1.5rem)}iam-table.table--cta:not(.table--loading):not(:has(tr:first-child td:first-child:last-child)) tr>th:nth-last-child(2),iam-table.table--cta:not(.table--loading):not(:has(tr:first-child td:first-child:last-child)) tr>td:nth-last-child(2){padding-right:var(--cta-width)}iam-table.table--cta:not(.table--loading):not(:has(tr:first-child td:first-child:last-child)) tr>*:not(:first-child):last-child{position:absolute;left:calc(100% - var(--cta-width));top:auto;background:rgba(0,0,0,0);width:var(--cta-width);min-height:calc(var(--row-height) - 2px);text-align:right;background:linear-gradient(90deg, transparent 0%, var(--row-bg) 1.25rem);cursor:default;padding-bottom:0}iam-table.table--cta:not(.table--loading):not(:has(tr:first-child td:first-child:last-child)) tr>*:not(:first-child):last-child a{white-space:nowrap;padding-right:.2rem;padding-bottom:0}iam-table.table--cta:not(.table--loading):not(:has(tr:first-child td:first-child:last-child)) tbody tr:hover>*:not(:first-child):last-child{background:linear-gradient(90deg, transparent 0%, var(--row-bg) 1.25rem)}}iam-table:is(.mh-sm,.mh-md,.mh-lg):not(.table--cta){position:relative}iam-table:is(.mh-sm,.mh-md,.mh-lg):not(.table--cta) thead{position:sticky;top:0;left:0;z-index:1;background-color:var(--row-bg)}iam-table:is(.mh-sm,.mh-md,.mh-lg):not(.table--cta) thead:before{content:"";position:absolute;bottom:0;left:0;width:100%;height:2px;background:var(--colour-primary)}iam-table:is(.mh-sm,.mh-md,.mh-lg):not(.table--cta) tbody{position:relative}iam-table:is(.mh-sm,.mh-md,.mh-lg):not(.table--cta) tbody tr:first-child td{border-top:0}iam-table:is(.mh-sm,.mh-md,.mh-lg):not(.table--cta) tbody tr:last-child td{border-bottom:0}table .hide-status:after{display:none}table :not(.hide-status):is([data-content=low],[data-content=medium],[data-content=high],[data-content=unknown],[data-content=due],[data-content=overdue],[data-content=incomplete],[data-content="requires approval"],[data-content=upcoming],[data-content="approval required"],[data-content=warning],[data-content=verified],[data-content="not started"],[data-content="to do"],[data-content="on track"],[data-content=completed],[data-content=complete],.alert-status:not([data-content="0"]):not([data-content=""]):not(:empty)){position:relative;padding-left:1.5rem}table :not(.hide-status):is([data-content=low],[data-content=medium],[data-content=high],[data-content=unknown],[data-content=due],[data-content=overdue],[data-content=incomplete],[data-content="requires approval"],[data-content=upcoming],[data-content="approval required"],[data-content=warning],[data-content=verified],[data-content="not started"],[data-content="to do"],[data-content="on track"],[data-content=completed],[data-content=complete],.alert-status:not([data-content="0"]):not([data-content=""]):not(:empty))::before{margin-left:-1.5rem !important}table :not(.hide-status):is([data-content=low],[data-content=medium],[data-content=high],[data-content=unknown],[data-content=due],[data-content=overdue],[data-content=incomplete],[data-content="requires approval"],[data-content=upcoming],[data-content="approval required"],[data-content=warning],[data-content=verified],[data-content="not started"],[data-content="to do"],[data-content="on track"],[data-content=completed],[data-content=complete],.alert-status:not([data-content="0"]):not([data-content=""]):not(:empty)):after{font-family:"Font Awesome 6 Pro";position:absolute;top:1rem;left:0;font-size:1rem;line-height:1;height:1rem;width:1rem;display:inline-block}table [data-content=high]:after{content:"\uF325";font-weight:normal;color:var(--colour-danger)}table [data-content=medium]:after{content:"\uF7A4";font-weight:normal;color:var(--colour-warning)}table [data-content=low]:after{content:"\uE404";font-weight:normal;color:var(--colour-complete)}table [data-content=unknown]:after{content:"\uE404";font-weight:normal;color:var(--colour-muted)}table :is([data-content=overdue],[data-content=due],[data-content=incomplete]):after{content:"\uF024";color:var(--colour-danger)}table :is([data-content="not started"],[data-content="to do"],[data-content="on track"]):after{content:"\uF024";color:var(--colour-muted)}table :is([data-content="requires approval"],[data-content="approval required"],[data-content="action required"],[data-content=upcoming]):after{content:"\uF024";color:var(--colour-warning)}table :is([data-content=warning]):after{content:"\uF071";color:var(--colour-warning)}table :is([data-content="manually verified"],[data-content=verified],[data-content=completed],[data-content=complete]):after{content:"\uF00C";font-weight:normal;color:var(--colour-complete)}table .alert-status:not([data-content="0"]):not([data-content=""]):not(:empty):after{content:"\uF0F3";color:var(--colour-primary)}iam-table .table--filtered tbody tr:not(.filtered--show){display:none !important}iam-table table:not(.table--filtered):not(.table--ajax) tbody tr:nth-child(15)~tr{display:none}iam-table input:is([type=radio],[type=checkbox])+label:not(.radio--tick){padding-left:0 !important;margin:0 !important}iam-table input:is([type=radio],[type=checkbox])+label:not(.radio--tick):before,iam-table input:is([type=radio],[type=checkbox])+label:not(.radio--tick):after{top:.75rem !important;left:.25rem !important}iam-table:has([type=checkbox]:checked) tr:has([type=checkbox]) [type=checkbox]{width:100vw;height:100%;max-height:var(--row-height);max-width:100vw;cursor:pointer;pointer-events:all;top:auto;margin:0;margin-top:0rem}@container (width > 23.4375em){iam-table tr:has([type=checkbox]:checked){height:calc(4.625rem - 2px)}}iam-table tr:has([type=checkbox]:checked){--row-bg: #E0E0E0}@container (width < 23.4375em){@media screen and (prefers-color-scheme: light){iam-table:has([slot=before]) iam-actionbar{background-color:#e6eaec}}iam-table:has([slot=before]) .actionbar__sticky+*{margin-top:0 !important}iam-table input:is([type=radio],[type=checkbox])+label:not(.radio--tick){padding-left:0 !important;margin:0 !important;min-height:2rem}iam-table input:is([type=radio],[type=checkbox])+label:not(.radio--tick):before,iam-table input:is([type=radio],[type=checkbox])+label:not(.radio--tick):after{top:.25rem !important;left:0 !important}iam-table:has([type=checkbox]:checked) tr:has([type=checkbox]) [type=checkbox]{width:100%;height:100%;max-height:100%;max-width:100%;margin-top:-2rem}}iam-table.table--fullwidth:not([data-expandable]) th.expand-button-heading{display:none}iam-table.table--fullwidth:not([data-expandable]) td:has([data-expand-button]){display:none}@container (width > 23.4375em){iam-table:not([data-expandable]) th.expand-button-heading{display:none}iam-table:not([data-expandable]) td.td--expand{display:none}iam-table[data-expandable] [data-expand-button]{margin:0}iam-table[data-expandable] [data-expand-button]:before{font-family:"Font Awesome 6 Pro";content:"\uF078";font-weight:500}iam-table[data-expandable] [data-expand-button][aria-expanded]:before{content:"\uF077"}iam-table[data-expandable] tr:not(:has(p)) [data-expand-button]{display:none}iam-table[data-expandable] tr:not([data-view=full]) td p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}}@container (width < 23.4375em){iam-table:not(.table--fullwidth) .td--fixed+td:not(.td--fixed){border-top:none}}@container (width > 23.4375em){iam-table{--width-adjust: 0px}iam-table:has([type=checkbox]){--width-adjust: -1rem}iam-table .th--fixed{min-width:calc(4.5rem + var(--width-adjust));position:absolute;padding:0}iam-table .th--fixed:after{top:auto;left:0;content:"";position:absolute;width:100%;height:calc(var(--row-height) - 2px);background:linear-gradient(90deg, var(--row-bg) calc(100% - 1.5rem), transparent 100%)}iam-table .td--fixed{position:absolute;position:absolute;left:auto;top:auto;z-index:3;padding:0.25rem 0 0 0;min-width:4.5rem;height:calc(var(--row-height) - 2px);text-align:left;background:linear-gradient(90deg, var(--row-bg) calc(100% - 1.5rem), transparent 100%)}iam-table .td--fixed:has([open]){z-index:4}iam-table tr:has(.td--fixed){height:3.5rem}iam-table tr:is(:hover,:focus) .td--fixed{background:linear-gradient(90deg, var(--row-bg) calc(100% - 1.5rem), transparent 100%)}iam-table tr:has([data-expand-button]){height:calc(4.625rem - 2px)}iam-table .th--fixed+th:not(.th--fixed),iam-table .td--fixed+td:not(.td--fixed){padding-left:calc(4.5rem + var(--width-adjust))}iam-table .th--fixed:not(.expand-button-heading)+.th--fixed+th:not(.th--fixed),iam-table .td--fixed:not(.td--expand)+.td--fixed+td:not(.td--fixed){padding-left:calc(7.75rem + var(--width-adjust))}iam-table[data-expandable] .th--fixed+.th--fixed+th:not(.th--fixed),iam-table[data-expandable] .td--fixed+.td--fixed+td:not(.td--fixed){padding-left:calc(7.75rem + var(--width-adjust))}iam-table .th--fixed+.th--fixed,iam-table .td--fixed+.td--fixed{padding-left:calc(3.25rem + var(--width-adjust));min-width:calc(7.75rem + var(--width-adjust))}iam-table .th--fixed:has(+.th--fixed),iam-table .td--fixed:has(+.td--fixed){min-width:calc(3.25rem + var(--width-adjust));z-index:5}iam-table .dialog__wrapper{z-index:10}iam-table .dialog__wrapper:has([open]){z-index:20}iam-table[data-expandable] input:is([type=radio],[type=checkbox])+label:before,iam-table[data-expandable] input:is([type=radio],[type=checkbox])+label:after{left:1.25rem !important}iam-table:not([data-expandable]) th.expand-button-heading+th{padding-left:0 !important}iam-table:not([data-expandable]) td.td--expand+td{padding-left:0 !important}iam-table:not([data-expandable]) th.expand-button-heading+.th--fixed{min-width:calc(4.5rem + var(--width-adjust)) !important}iam-table:not([data-expandable]) td.td--expand+.td--fixed{min-width:calc(4.5rem + var(--width-adjust)) !important}}/*# sourceMappingURL=assets/css/components/table.global.css.map */
31
- </style>`)}connectedCallback(){const e=new URLSearchParams(window.location.search);this.hasAttribute("data-total")||this.setAttribute("data-total",this.querySelectorAll("table tbody tr").length),this.hasAttribute("data-page")||this.setAttribute("data-page",e.has("page")?e.get("page"):1),this.hasAttribute("data-show")||this.setAttribute("data-show",e.has("show")?e.get("show"):15),this.hasAttribute("data-increment")||this.setAttribute("data-increment",this.getAttribute("data-show"));let n=this.classList.toString();if(n=n.replace("table--cta",""),n=n.replace("table--loading",""),this.shadowRoot.querySelector(".table__wrapper").className+=` ${n}`,this.querySelector(".actionbar__sticky")&&this.shadowRoot.querySelector(".table__wrapper").classList.add("has-actionbar"),this.table=this.querySelector("table"),this.savedTableBody=this.table.querySelector("tbody").cloneNode(!0),this.pagination=this.shadowRoot.querySelector("iam-pagination"),this.pagination.setAttribute("data-total",this.getAttribute("data-total")),this.pagination.setAttribute("data-page",this.getAttribute("data-page")),this.pagination.setAttribute("data-show",this.getAttribute("data-show")),this.pagination.setAttribute("data-increment",this.getAttribute("data-show")),this.hasAttribute("data-page-jump")&&this.pagination.setAttribute("data-page-jump","true"),this.hasAttribute("data-per-page")&&this.pagination.setAttribute("data-per-page","true"),this.hasAttribute("data-item-count")&&this.pagination.setAttribute("data-item-count","true"),this.hasAttribute("data-loading")&&this.pagination.setAttribute("data-loading","true"),this.classList.contains("table--fullwidth")&&this.pagination.setAttribute("data-minimal","true"),this.classList.contains("table--cta")||this.shadowRoot.querySelector(".table--cta").classList.remove("table--cta"),this.form=document.createElement("form"),this.hasAttribute("data-filterby")?this.form=document.querySelector(`#${this.getAttribute("data-filterby")}`):this.table.parentNode.insertBefore(this.form,this.table.nextSibling),this.form.hasAttribute("data-ajax")&&this.table.classList.add("table--ajax"),N(this.table,this.form),this.form.querySelector("[data-pagination]")||this.form.insertAdjacentHTML("beforeend",`<input name="page" type="hidden" value="${this.getAttribute("data-page")}" data-pagination="true" />`),this.form.querySelector("[data-show]")||this.form.insertAdjacentHTML("beforeend",`<input name="show" type="hidden" value="${this.getAttribute("data-show")}" data-show="true" />`),V(this.table),K(this.table,this.form,this.pagination,this,this.savedTableBody),Z(this.table,this.form,this.pagination,this),tt(this.shadowRoot.querySelector("[data-export]"),this.table),this.form.getAttribute("data-ajax"))I(this.table,this.form,this.pagination,this);else{let h=function(i=1){return Math.floor(Math.random()*Date.now()*(i+1))};if(this.querySelector("iam-actionbar[data-selectall]")||document.querySelector(`iam-actionbar[data-for='${this.getAttribute("id")}']`)){const i=this.querySelector("iam-actionbar[data-selectall]")?this.querySelector("iam-actionbar[data-selectall]"):document.querySelector(`iam-actionbar[data-for='${this.getAttribute("id")}']`);Array.from(this.table.querySelectorAll("thead tr")).forEach((l,s)=>{l.insertAdjacentHTML("afterbegin",'<th class="th--fixed"></th>')}),Array.from(this.table.querySelectorAll("tbody tr")).forEach((l,s)=>{let t=`row${h(s)}`;l.insertAdjacentHTML("afterbegin",`<td class="td--fixed selectrow"><input type="checkbox" name="row" id="${t}"/><label for="${t}"><span class="visually-hidden">Select row</span></label></td>`)}),this.table.addEventListener("change",l=>{if(l&&l.target instanceof HTMLElement&&l.target.closest(".selectrow input")){let s=this.table.querySelectorAll('.selectrow input[type="checkbox"]').length,t=this.table.querySelectorAll('.selectrow input[type="checkbox"]:checked').length;i.setAttribute("data-selected",s==t?"all":t)}}),i.addEventListener("selected",l=>{l.detail.selected=="0"?Array.from(this.table.querySelectorAll('.selectrow input[type="checkbox"]')).forEach((s,t)=>{s.checked=!1}):l.detail.selected=="all"&&Array.from(this.table.querySelectorAll('.selectrow input[type="checkbox"]')).forEach((s,t)=>{s.checked=!0})})}let d=-1;Array.from(this.table.querySelectorAll("tbody tr")).forEach((i,l)=>{if(i.querySelector(":scope > td > .dialog__wrapper")){let s=i.querySelector(":scope > td > .dialog__wrapper").parentNode;s.classList.add("td--fixed"),d=Array.from(s.parentNode.children).indexOf(s)}}),d!=-1&&(this.table.querySelector(`thead tr th:nth-child(${d+1})`).classList.add("th--fixed"),Array.from(this.table.querySelectorAll(`tbody tr td:nth-child(${d+1})`)).forEach((i,l)=>{i.classList.add("td--fixed")})),P(this.table,this.form,this.pagination,this),this.hasAttribute("data-no-submit")||C(this.table,this.form,this),$(this.table,this.form)}this.shadowRoot.querySelector(".table__wrapper").addEventListener("scroll",h=>{this.table.querySelector("dialog[open]")&&(this.table.querySelector("dialog[open]").close(),this.table.querySelector(".dialog__wrapper > button.active").classList.remove("active"))}),this.pagination.addEventListener("update-show",h=>{let d=h.detail.show;const i=new CustomEvent("update-show",{detail:{show:d}});this.dispatchEvent(i)}),this.pagination.addEventListener("update-page",h=>{let d=h.detail.page;const i=new CustomEvent("update-page",{detail:{page:d}});this.dispatchEvent(i)})}static get observedAttributes(){return["data-total","data-page","data-show"]}attributeChangedCallback(e,n,a){if(this.hasAttribute("data-no-submit"))return!1;switch(this.pagination=this.shadowRoot.querySelector("iam-pagination"),e){case"data-total":{n!=a&&this.pagination.setAttribute("data-total",a);break}case"data-show":{n!=a&&this.pagination.setAttribute("data-show",a);break}case"data-page":{n!=a&&this.pagination.setAttribute("data-page",a);break}}}}export{at as default};
31
+ </style>`)}connectedCallback(){const e=new URLSearchParams(window.location.search);this.hasAttribute("data-total")||this.setAttribute("data-total",this.querySelectorAll("table tbody tr").length),this.hasAttribute("data-page")||this.setAttribute("data-page",e.has("page")?e.get("page"):1),this.hasAttribute("data-show")||this.setAttribute("data-show",e.has("show")?e.get("show"):15),this.hasAttribute("data-increment")||this.setAttribute("data-increment",this.getAttribute("data-show"));let n=this.classList.toString();if(n=n.replace("table--cta",""),n=n.replace("table--loading",""),this.shadowRoot.querySelector(".table__wrapper").className+=` ${n}`,this.querySelector(".actionbar__sticky")&&this.shadowRoot.querySelector(".table__wrapper").classList.add("has-actionbar"),this.table=this.querySelector("table"),this.savedTableBody=this.table.querySelector("tbody").cloneNode(!0),this.pagination=this.shadowRoot.querySelector("iam-pagination"),this.pagination.setAttribute("data-total",this.getAttribute("data-total")),this.pagination.setAttribute("data-page",this.getAttribute("data-page")),this.pagination.setAttribute("data-show",this.getAttribute("data-show")),this.pagination.setAttribute("data-increment",this.getAttribute("data-show")),this.hasAttribute("data-page-jump")&&this.pagination.setAttribute("data-page-jump","true"),this.hasAttribute("data-per-page")&&this.pagination.setAttribute("data-per-page","true"),this.hasAttribute("data-item-count")&&this.pagination.setAttribute("data-item-count","true"),this.hasAttribute("data-loading")&&this.pagination.setAttribute("data-loading","true"),this.classList.contains("table--fullwidth")&&this.pagination.setAttribute("data-minimal","true"),this.classList.contains("table--cta")||this.shadowRoot.querySelector(".table--cta").classList.remove("table--cta"),this.form=document.createElement("form"),this.hasAttribute("data-filterby")?this.form=document.querySelector(`#${this.getAttribute("data-filterby")}`):this.table.parentNode.insertBefore(this.form,this.table.nextSibling),this.form.hasAttribute("data-ajax")&&this.table.classList.add("table--ajax"),N(this.table,this.form),this.form.querySelector("[data-pagination]")||this.form.insertAdjacentHTML("beforeend",`<input name="page" type="hidden" value="${this.getAttribute("data-page")}" data-pagination="true" />`),this.form.querySelector("[data-show]")||this.form.insertAdjacentHTML("beforeend",`<input name="show" type="hidden" value="${this.getAttribute("data-show")}" data-show="true" />`),V(this.table),K(this.table,this.form,this.pagination,this,this.savedTableBody),Z(this.table,this.form,this.pagination,this),tt(this.shadowRoot.querySelector("[data-export]"),this.table),this.form.getAttribute("data-ajax"))I(this.table,this.form,this.pagination,this);else{let h=function(i=1){return Math.floor(Math.random()*Date.now()*(i+1))};if(this.querySelector("iam-actionbar[data-selectall]")||document.querySelector(`iam-actionbar[data-for='${this.getAttribute("id")}']`)){const i=this.querySelector("iam-actionbar[data-selectall]")?this.querySelector("iam-actionbar[data-selectall]"):document.querySelector(`iam-actionbar[data-for='${this.getAttribute("id")}']`);Array.from(this.table.querySelectorAll("thead tr")).forEach((l,s)=>{l.insertAdjacentHTML("afterbegin",'<th class="th--fixed"></th>')}),Array.from(this.table.querySelectorAll("tbody tr")).forEach((l,s)=>{let t=`row${h(s)}`;l.insertAdjacentHTML("afterbegin",`<td class="td--fixed selectrow"><input type="checkbox" name="row" id="${t}"/><label for="${t}"><span class="visually-hidden">Select row</span></label></td>`)}),this.table.addEventListener("change",l=>{if(l&&l.target instanceof HTMLElement&&l.target.closest(".selectrow input")){let s=this.table.querySelectorAll('.selectrow input[type="checkbox"]').length,t=this.table.querySelectorAll('.selectrow input[type="checkbox"]:checked').length;i.setAttribute("data-selected",s==t?"all":t)}}),i.addEventListener("selected",l=>{l.detail.selected=="0"?Array.from(this.table.querySelectorAll('.selectrow input[type="checkbox"]')).forEach((s,t)=>{s.checked=!1}):l.detail.selected=="all"&&Array.from(this.table.querySelectorAll('.selectrow input[type="checkbox"]')).forEach((s,t)=>{s.checked=!0})})}let d=-1;Array.from(this.table.querySelectorAll("tbody tr")).forEach((i,l)=>{if(i.querySelector(":scope > td > .dialog__wrapper")){let s=i.querySelector(":scope > td > .dialog__wrapper").parentNode;s.classList.add("td--fixed"),d=Array.from(s.parentNode.children).indexOf(s)}}),d!=-1&&(this.table.querySelector(`thead tr th:nth-child(${d+1})`).classList.add("th--fixed"),Array.from(this.table.querySelectorAll(`tbody tr td:nth-child(${d+1})`)).forEach((i,l)=>{i.classList.add("td--fixed")})),P(this.table,this.form,this.pagination,this),this.hasAttribute("data-no-submit")||C(this.table,this.form,this),$(this.table,this.form)}this.shadowRoot.querySelector(".table__wrapper").addEventListener("scroll",h=>{this.table.querySelector("dialog[open]")&&(this.table.querySelector("dialog[open]").close(),this.table.querySelector(".dialog__wrapper > button.active").classList.remove("active"))}),this.pagination.addEventListener("update-show",h=>{let d=h.detail.show;const i=new CustomEvent("update-show",{detail:{show:d}});this.dispatchEvent(i)}),this.pagination.addEventListener("update-page",h=>{let d=h.detail.page;const i=new CustomEvent("update-page",{detail:{page:d}});this.dispatchEvent(i)})}static get observedAttributes(){return["data-total","data-page","data-show"]}attributeChangedCallback(e,n,a){switch(this.pagination=this.shadowRoot.querySelector("iam-pagination"),e){case"data-total":{n!=a&&this.pagination.setAttribute("data-total",a);break}case"data-show":{n!=a&&this.pagination.setAttribute("data-show",a);break}case"data-page":{n!=a&&this.pagination.setAttribute("data-page",a);break}}}}export{at as default};
32
32
  //# sourceMappingURL=table.component.min.js.map