mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 00:42:59 +08:00
1 line
9.8 KiB
JavaScript
1 line
9.8 KiB
JavaScript
import{d as H,aH as D,r as m,q as G,m as I,z as J,o as s,c as r,D as i,b as e,aD as F,e as u,as as $,F as g,E as v,t as w,v as Q,w as j,P as B,I as W,f as _,g as X,A as k,aI as Y,h as ee,k as te}from"./index-e62f5c21.js";const oe={class:"relative"},se={key:0,class:"absolute bg-black bg-opacity-60 z-10 h-full w-full flex items-center justify-center"},le=e("div",{class:"flex items-center"},[e("svg",{"aria-hidden":"true",class:"w-8 h-8 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),e("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})])],-1),re=[le],ae={class:"my-2 flex justify-between items-center w-full"},ne={class:"w-2/4"},ie={key:0,class:"flex sm:flex-row flex-col"},de={key:0,class:"flex flex-row mb-1 sm:mb-0"},ce={class:"relative flex justify-between items-center"},ue=["value"],pe=e("div",{class:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"},[e("svg",{class:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},[e("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})])],-1),he={class:"block relative"},fe=e("span",{class:"h-full absolute inset-y-0 left-0 flex items-center pl-2"},[e("svg",{viewBox:"0 0 24 24",class:"h-4 w-4 fill-current text-gray-500"},[e("path",{d:"M10 4a6 6 0 100 12 6 6 0 000-12zm-8 6a8 8 0 1114.32 4.906l5.387 5.387a1 1 0 01-1.414 1.414l-5.387-5.387A8 8 0 012 10z"})])],-1),be={key:0,class:"flex justify-between items-center"},ge=["onClick"],ve={"aria-hidden":"true",class:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},ye=e("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1),me=[ye],we={class:"ml-1"},_e=e("hr",{class:"mb-4"},null,-1),ke={class:"min-w-full"},xe={key:0,class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},Ce=["checked"],Se=["onClick"],Be={class:"mr-1"},Me={key:0,class:"font-thin text-sm"},qe={class:"bg-white"},De={key:0,class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Fe=["checked","onClick"],$e={key:0},je={key:1},ze={class:"flex justify-between my-4"},Te={key:0,class:"flex sm:flex-row flex-col"},Ae={class:"flex flex-row mb-1 sm:mb-0"},Ne={class:"relative"},Ue=["disabled"],Le=ee('<option value="25">25</option><option value="50">50</option><option value="100">100</option><option value="250">250</option><option value="500">500</option><option value="1000">1000</option><option value="5000">5000</option><option value="10000">10000</option>',8),Ve=[Le],Pe=e("div",{class:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"},[e("svg",{class:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},[e("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})])],-1),Ke={class:"block relative"},Oe=["placeholder"],Re=H({__name:"FelDataTable",props:{columns:{type:Array,required:!0},data:{type:Array,required:!1},toggleColumns:{type:Boolean,required:!0},loading:{type:Boolean,required:!1},paginable:{type:Boolean,required:!1},pageMeta:{type:Object,required:!1},searchable:{type:Boolean,required:!1},filterable:{type:Boolean,required:!1},selectable:{type:Boolean,required:!1},filterMeta:{type:Object,required:!1},allChecked:{type:Boolean,required:!1}},emits:["onSort","onPaginate","onSearch","onSearchKeyUp","onSearchFocus","onCheck","onCheckAll","onFetch"],setup(z,{emit:T}){const y=z;let b=D(y,"columns"),A=D(y,"data");const N=t=>{const l=b.value[t];b.value[t]={...l,hidden:!l.hidden}},p=m(y.filterMeta?.defaultFilter??""),h=m(""),U=()=>{d("onSearch",{sorting:n,filterStatus:p.value,filterText:h.value})},L=()=>{d("onSearchKeyUp",{sorting:n,filterStatus:p.value,filterText:h.value})},V=()=>{d("onSearchFocus",{})},x=m(y.pageMeta?.fetchCount??50),P=()=>{d("onPaginate",{fetchCount:x,sorting:n,filterStatus:p,filterText:h})},C=m(!0),n=G({}),M=t=>n?.name===t?.name,K=t=>{M(t)?Object.assign(n,{...t,sortBy:[1,"asc"].includes(n?.sortBy??"")?"desc":"asc"}):Object.assign(n,{...t,sortBy:t?.sortBy??"asc"}),d("onSort",{sorting:n,filterStatus:p.value,filterText:h.value})},d=T,O=t=>{d("onCheckAll",{checked:t.target.checked})},R=(t,l)=>{d("onCheck",{...t,checked:l.target.checked})},q=(t,l)=>l?.customRender!==void 0?l.customRender(t,l):l.value.split(".").reduce((f,S)=>f?.[S],t),E=t=>t.charAt(0).toUpperCase()+t.slice(1);return(t,l)=>{const f=I("font-awesome-icon"),S=J("tooltip");return s(),r("div",oe,[t.loading?(s(),r("div",se,[...re])):i("",!0),e("div",null,[e("section",ae,[e("div",ne,[t.searchable?(s(),r("div",ie,[t.filterable?(s(),r("div",de,[e("div",ce,[e("div",null,[F(t.$slots,"pre-filter")]),u(e("select",{"onUpdate:modelValue":l[0]||(l[0]=o=>p.value=o),class:"appearance-none h-full rounded-l-sm border block w-full bg-white border-gray-400 text-gray-700 py-2 px-4 pr-8 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"},[(s(!0),r(g,null,v(t.filterMeta?.filters,o=>(s(),r("option",{key:o.value,value:o.value},w(E(o?.name)),9,ue))),128))],512),[[$,p.value]]),pe])])):i("",!0),e("div",he,[fe,u(e("input",{placeholder:"Search ...","onUpdate:modelValue":l[1]||(l[1]=o=>h.value=o),class:"appearance-none rounded-r-sm rounded-l-sm sm:rounded-l-none border border-gray-400 border-b block pl-8 pr-6 py-2 w-full bg-white text-sm placeholder-gray-400 text-gray-700 focus:bg-white focus:placeholder-gray-600 focus:text-gray-700 focus:outline-none",onKeyup:l[2]||(l[2]=o=>L()),onFocus:l[3]||(l[3]=o=>V())},null,544),[[Q,h.value]])]),e("button",{onClick:l[4]||(l[4]=j(o=>U(),["prevent"])),class:"px-2 py-1 ml-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Search ")])):i("",!0)]),e("div",null,[t.toggleColumns?(s(),r("div",be,[e("div",null,[u(e("div",null,[(s(!0),r(g,null,v(_(b),(o,c)=>(s(),r("button",{key:c,class:W(["inline-flex items-center px-2 py-1 mr-2 text-sm font-medium rounded border",[{"text-gray-400 bg-gray-100 border-gray-400":o.hidden,"text-blue-600 bg-blue-100 border-blue-800":!o.hidden,hidden:!(o.showInToggler??!0)}]]),onClick:a=>N(c)},[u((s(),r("svg",ve,[...me],512)),[[B,!o.hidden]]),e("span",we,w(o.name),1)],10,ge))),128))],512),[[B,C.value]])]),u((s(),r("button",{class:"ml-4 text-xl font-semibold text-blue-900",onClick:l[5]||(l[5]=o=>C.value=!C.value)},[X(f,{icon:"fa-ellipsis"})])),[[S,"manage table columns"]])])):i("",!0)])]),_e,e("table",ke,[e("thead",null,[e("tr",null,[t.selectable?(s(),r("th",xe,[e("input",{type:"checkbox",checked:t.allChecked,onClick:l[6]||(l[6]=o=>O(o))},null,8,Ce)])):i("",!0),(s(!0),r(g,null,v(_(b).filter(o=>!o.hidden),(o,c)=>(s(),r("th",{key:c,class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},[e("div",{class:"flex items-center cursor-pointer",onClick:a=>K(o)},[e("span",Be,w(o.name),1),o.sortable?(s(),r("span",Me,[M(o)?n?.sortBy==="asc"?(s(),k(f,{key:1,icon:"fa-solid fa-arrow-up-wide-short",class:"text-gray-800"})):(s(),k(f,{key:2,icon:"fa-solid fa-arrow-down-wide-short",class:"text-gray-800"})):(s(),k(f,{key:0,icon:"fa-sort",class:"text-gray-400"}))])):i("",!0)],8,Se)]))),128))])]),e("tbody",qe,[(s(!0),r(g,null,v(_(A),(o,c)=>(s(),r("tr",{key:c},[t.selectable?(s(),r("td",De,[e("input",{type:"checkbox",checked:o.checked,onClick:a=>R(o,a)},null,8,Fe)])):i("",!0),(s(!0),r(g,null,v(_(b).filter(a=>!a.hidden),(a,Z)=>(s(),r("td",{key:`${c}_${Z}`,class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},[a.customRender&&a?(s(),r("span",$e,[(s(),k(Y(q(o,a))))])):(s(),r("span",je,w(q(o,a)),1))]))),128))]))),128))])]),e("section",ze,[e("div",null,[F(t.$slots,"footer")]),t.paginable?(s(),r("div",Te,[e("div",null,[u(e("button",{class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none",onClick:j(P,["prevent"])}," Show More ",512),[[B,t.pageMeta?.hasNextPage]])]),e("div",null,[e("div",Ae,[e("div",Ne,[u(e("select",{class:"appearance-none h-full rounded-l-sm border block w-full bg-white border-gray-400 text-gray-700 py-2 px-4 pr-8 leading-tight focus:outline-none focus:bg-white focus:border-gray-500","onUpdate:modelValue":l[7]||(l[7]=o=>x.value=o),disabled:!t.pageMeta?.hasNextPage},[...Ve],8,Ue),[[$,x.value,void 0,{number:!0}]]),Pe])])]),e("div",Ke,[e("input",{placeholder:t.pageMeta?.countNone,class:"appearance-none rounded-r-sm rounded-l-sm sm:rounded-l-none border border-gray-400 border-b block pl-8 pr-6 py-2 w-full bg-white text-sm placeholder-gray-400 text-gray-700 focus:bg-white focus:placeholder-gray-600 focus:text-gray-700 focus:outline-none",disabled:""},null,8,Oe)])])):i("",!0)])])])}}}),Ze=te(Re,[["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/components/ui/datatable/FelDataTable.vue"]]);export{Ze as default};
|