Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue3-easy-data-table

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-easy-data-table - npm Package Compare versions

Comparing version 1.2.11 to 1.2.12-beta.0

44

dist/vue3-easy-data-table.es.js

@@ -591,23 +591,23 @@ var __defProp = Object.defineProperty;

useCssVars((_ctx) => ({
"7465ce4c": unref(tableBorderColor),
"aa6a7f20": unref(minHeightPx),
"04158ba8": unref(tableHeightPx),
"2d45a6f1": unref(loadingWrapperSizePx),
"f93a6810": unref(rowHeightPx),
"45dd6ac9": unref(fontSizePx),
"284709ea": unref(rowFontColor),
"08d3c04c": unref(rowBackgroundColor),
"03eaaa9a": unref(shadowRightPx),
"20f2b8e4": unref(rowBorderColor),
"e44e7994": unref(headerFontColor),
"3db40792": __props.headerBackgroundColor,
"58efd28b": unref(sortTypeIconSizePx),
"55a8960e": unref(sortTypeAscIconMarginTopPx),
"086ac37c": unref(sortTypeDescIconMarginTopPx),
"c1e7623c": unref(rowHoverBackgroundColor),
"fe1d9bbe": unref(rowHoverFontColor),
"f2c8ee76": unref(evenRowFontColor),
"789c1a86": unref(evenRowBackgroundColor),
"5cb5eb69": unref(footerBackgroundColor),
"33107fe8": unref(footerFontColor)
"9dddacda": unref(tableBorderColor),
"51e93fd2": unref(minHeightPx),
"1c8c8c13": unref(tableHeightPx),
"7b9e99ac": unref(loadingWrapperSizePx),
"a0b928c2": unref(rowHeightPx),
"36c6ba42": unref(fontSizePx),
"47afd044": unref(rowFontColor),
"335686c5": unref(rowBackgroundColor),
"1ca1fc9a": unref(shadowRightPx),
"b84ce2f2": unref(rowBorderColor),
"63e3375d": unref(headerFontColor),
"2cc711c4": __props.headerBackgroundColor,
"f91acdf8": unref(sortTypeIconSizePx),
"3f4458f2": unref(sortTypeAscIconMarginTopPx),
"574595ba": unref(sortTypeDescIconMarginTopPx),
"63cfac09": unref(rowHoverBackgroundColor),
"03a18ef0": unref(rowHoverFontColor),
"71df997e": unref(evenRowFontColor),
"7ef4fc7f": unref(evenRowBackgroundColor),
"652c6650": unref(footerBackgroundColor),
"091af40f": unref(footerFontColor)
}));

@@ -1208,3 +1208,3 @@ const {

});
var DataTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-750e8d62"]]);
var DataTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-36dbd8fe"]]);
export { DataTable as default };

@@ -1,1 +0,1 @@

(function(e,y){typeof exports=="object"&&typeof module!="undefined"?module.exports=y(require("vue")):typeof define=="function"&&define.amd?define(["vue"],y):(e=typeof globalThis!="undefined"?globalThis:e||self,e["vue3-easy-data-table"]=y(e.Vue))})(this,function(e){"use strict";var Nt=Object.defineProperty,$t=Object.defineProperties;var It=Object.getOwnPropertyDescriptors;var he=Object.getOwnPropertySymbols;var Et=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable;var _e=(e,y,g)=>y in e?Nt(e,y,{enumerable:!0,configurable:!0,writable:!0,value:g}):e[y]=g,C=(e,y)=>{for(var g in y||(y={}))Et.call(y,g)&&_e(e,g,y[g]);if(he)for(var g of he(y))Vt.call(y,g)&&_e(e,g,y[g]);return e},H=(e,y)=>$t(e,It(y));var y="",g=(a,k)=>{const s=a.__vccOpts||a;for(const[n,u]of k)s[n]=u;return s};const ye=a=>(e.pushScopeId("data-v-566775ba"),a=a(),e.popScopeId(),a),ke=["onClick"],xe=["checked"],be=ye(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var Ce=g(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(a,{emit:k}){const s=a;e.useCssVars(P=>({"7f84b28f":e.unref(b)}));const n=e.computed(()=>s.status==="allSelected"),u=()=>{k("change",!n.value)},b=e.inject("themeColor");return(P,T)=>(e.openBlock(),e.createElementBlock("div",{class:"multi-select__checkbox",onClick:e.withModifiers(u,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(n),class:e.normalizeClass(a.status)},null,10,xe),be],8,ke))}}),[["__scopeId","data-v-566775ba"]]),Tt="";const Se=a=>(e.pushScopeId("data-v-39f156fd"),a=a(),e.popScopeId(),a),Be=["checked"],we=Se(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var Pe=g(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(a,{emit:k}){e.useCssVars(n=>({"20cfc5a0":e.unref(s)}));const s=e.inject("themeColor");return(n,u)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:u[0]||(u[0]=e.withModifiers(b=>k("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:a.checked},null,8,Be),we]))}}),[["__scopeId","data-v-39f156fd"]]),Ht="";const Ne=a=>(e.pushScopeId("data-v-0ed08e20"),a=a(),e.popScopeId(),a),$e={class:"easy-data-table__rows-selector"},Ie={class:"rows-input"},Ee=Ne(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),Ve=["onClick"];var Fe=g(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(a,{emit:k}){const s=a;e.useCssVars(h=>({"83c11052":e.unref(f),"6b60f418":e.unref(c),"346ac97c":e.unref(i)}));const n=e.ref(!1),u=e.ref(!1),b=e.inject("dataTable");e.watch(n,h=>{if(h&&b){const S=window.innerHeight,x=b.value.getBoundingClientRect().height,$=b.value.getBoundingClientRect().top;S-(x+$)<=100?u.value=!0:u.value=!1}});const P=e.computed({get:()=>s.modelValue,set:h=>{k("update:modelValue",h)}}),T=h=>{P.value=h,n.value=!1},O=(h,S)=>{let x=h.parentNode;for(;x!=null;){if(x.classList&&x.classList.contains(S))return!0;x=x.parentNode}return!1},z=h=>{O(h.target,"easy-data-table__rows-selector")||(n.value=!1)};e.onMounted(()=>{document.addEventListener("click",z)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",z)});const i=e.inject("themeColor"),c=e.inject("footerBackgroundColor"),f=e.inject("footerFontColor");return(h,S)=>(e.openBlock(),e.createElementBlock("div",$e,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:S[0]||(S[0]=x=>n.value=!n.value)},[e.createElementVNode("div",Ie,e.toDisplayString(e.unref(P)),1),Ee]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:n.value,inside:u.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.rowsItems,x=>(e.openBlock(),e.createElementBlock("li",{key:x,class:e.normalizeClass({selected:x===e.unref(P)}),onClick:$=>T(x)},e.toDisplayString(x),11,Ve))),128))],2)]))}}),[["__scopeId","data-v-0ed08e20"]]),Lt="";const A=a=>(e.pushScopeId("data-v-969989cc"),a=a(),e.popScopeId(),a),Te={class:"lds-ring"},ze=[A(()=>e.createElementVNode("div",null,null,-1)),A(()=>e.createElementVNode("div",null,null,-1)),A(()=>e.createElementVNode("div",null,null,-1)),A(()=>e.createElementVNode("div",null,null,-1))];var He=g(e.defineComponent({setup(a){e.useCssVars(n=>({"284c10f4":e.unref(s),"90c4d0a4":e.unref(k)}));const k=e.inject("themeColor"),s=e.inject("loadingEntitySizePx");return(n,u)=>(e.openBlock(),e.createElementBlock("div",Te,ze))}}),[["__scopeId","data-v-969989cc"]]),qt="";const Oe={class:"buttons-pagination"},Le=["onClick"];var Re=g(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(a,{emit:k}){const s=a;e.useCssVars(i=>({aa5730a0:e.unref(T),"24829312":e.unref(O),"98a0e762":e.unref(z)}));const n=7,u=i=>{i.type==="button"&&!i.active&&k("updatePage",i.page)},b=e.computed(()=>{const i=[];if(s.maxPaginationNumber<=n)for(let c=1;c<=s.maxPaginationNumber;c+=1)i.push({type:"button",page:c,active:c===s.currentPaginationNumber});else if([1,2,s.maxPaginationNumber,s.maxPaginationNumber-1].includes(s.currentPaginationNumber))for(let c=1;c<=n;c+=1)if(c<=3)i.push({type:"button",page:c,active:c===s.currentPaginationNumber});else if(c===4)i.push({type:"omission"});else{const f=s.maxPaginationNumber-(n-c);i.push({type:"button",page:f,active:f===s.currentPaginationNumber})}else if([3,4].includes(s.currentPaginationNumber))for(let c=1;c<=n;c+=1)c<=5?i.push({type:"button",page:c,active:c===s.currentPaginationNumber}):c===6?i.push({type:"omission"}):i.push({type:"button",page:s.maxPaginationNumber,active:s.maxPaginationNumber===s.currentPaginationNumber});else if([s.maxPaginationNumber-2,s.maxPaginationNumber-3].includes(s.currentPaginationNumber))for(let c=1;c<=n;c+=1)if(c===1)i.push({type:"button",page:1,active:s.currentPaginationNumber===1});else if(c===2)i.push({type:"omission"});else{const f=s.maxPaginationNumber-(n-c);i.push({type:"button",page:f,active:f===s.currentPaginationNumber})}else for(let c=1;c<=n;c+=1)if(c===1)i.push({type:"button",page:1,active:s.currentPaginationNumber===1});else if(c===2||c===6)i.push({type:"omission"});else if(c===7)i.push({type:"button",page:s.maxPaginationNumber,active:s.maxPaginationNumber===s.currentPaginationNumber});else{const f=4-c,h=s.currentPaginationNumber-f;i.push({type:"button",page:h,active:h===s.currentPaginationNumber})}return i}),P=e.inject("rowHeight"),T=e.computed(()=>`${P*.6}px`),O=e.inject("rowBorderColor"),z=e.inject("themeColor");return(i,c)=>(e.openBlock(),e.createElementBlock("div",Oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(f,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["item",{button:f.type==="button",active:f.type==="button"&&f.active,omission:f.type==="omission"}]),onClick:S=>u(f)},e.toDisplayString(f.type==="button"?f.page:"..."),11,Le))),128))]))}}),[["__scopeId","data-v-4f534e20"]]),Jt="";const v=a=>(e.pushScopeId("data-v-c9da5286"),a=a(),e.popScopeId(),a),Ae=[v(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],De=[v(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var Me=g(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(a,{emit:k}){const s=e.useSlots();return(n,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":a.isFirstPage}]),onClick:u[0]||(u[0]=b=>k("clickPrevPage"))},Ae,2),e.unref(s).buttonsPagination?e.renderSlot(n.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":a.isLastPage}]),onClick:u[1]||(u[1]=b=>k("clickNextPage"))},De,2)],64))}}),[["__scopeId","data-v-c9da5286"]]),Qt="";const je={key:0},qe=["onClick"],We={key:1,class:"header-text__wrapper"},Je={class:"header-text"},Ue=["onClick"],Ge={class:"loading-entity"},Ke={key:1,class:"data-table__message"},Qe={key:0,class:"data-table__footer"},Xe={key:0,class:"footer__rows-per-page"},Ye=e.createTextVNode(" rows per page: "),Ze={class:"footer__items-index"};var ve=g(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},rowBorderColor:{type:String,default:"#e0e0e0"},tableBorderColor:{type:String,default:"#e0e0e0"},rowBackgroundColor:{type:String,default:"#fff"},footerBackgroundColor:{type:String,default:"#fff"},rowFontColor:{type:String,default:"#212121"},footerFontColor:{type:String,default:"#212121"},emptyMessage:{type:String,default:"No Available Data"},fixedHeader:{type:Boolean,default:!0},headerFontColor:{type:String,default:"#373737"},headerBackgroundColor:{type:String,default:"#fff"},tableFontSize:{type:Number,default:12},evenRowBackgroundColor:{type:String,default:"#fafafa"},evenRowFontColor:{type:String,default:"#212121"},headers:{type:Array,required:!0},hoverToChangeColor:{type:Boolean,default:!0},items:{type:Array,required:!0},tableHeight:{type:Number,default:()=>null},itemsSelected:{type:Array,default:null},searchField:{type:String,default:""},searchValue:{type:String,default:""},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowHoverBackgroundColor:{type:String,default:"#eee"},rowHoverFontColor:{type:String,default:"#212121"},loading:{type:Boolean,deault:!1},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},themeColor:{type:String,default:"#42b883"},dense:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},showFooter:{type:Boolean,default:!0},filterOptions:{type:Array,default:null},fixedCheckbox:{type:Boolean,default:!1},fixedIndex:{type:Boolean,default:!1},indexColumnWidth:{type:Number,default:60},checkboxColumnWidth:{type:Number,default:null},hideRowsPerPage:{type:Boolean,default:!1}},emits:["update:itemsSelected","update:serverOptions","clickRow"],setup(a,{expose:k,emit:s}){const n=a;e.useCssVars(o=>({"7465ce4c":e.unref(b),aa6a7f20:e.unref(nt),"04158ba8":e.unref(ot),"2d45a6f1":e.unref(ct),f93a6810:e.unref(et),"45dd6ac9":e.unref(x),"284709ea":e.unref(T),"08d3c04c":e.unref(c),"03eaaa9a":e.unref(tt),"20f2b8e4":e.unref(u),e44e7994:e.unref(P),"3db40792":a.headerBackgroundColor,"58efd28b":e.unref(rt),"55a8960e":e.unref(at),"086ac37c":e.unref(lt),c1e7623c:e.unref(O),fe1d9bbe:e.unref(z),f2c8ee76:e.unref(h),"789c1a86":e.unref(f),"5cb5eb69":e.unref(i),"33107fe8":e.unref(S)}));const{rowBorderColor:u,tableBorderColor:b,headerFontColor:P,rowFontColor:T,rowHoverBackgroundColor:O,rowHoverFontColor:z,footerBackgroundColor:i,rowBackgroundColor:c,evenRowBackgroundColor:f,evenRowFontColor:h,footerFontColor:S}=e.toRefs(n),x=e.computed(()=>`${n.tableFontSize}px`),$=e.computed(()=>n.tableFontSize*(n.dense?2:3)),et=e.computed(()=>`${$.value}px`),tt=e.computed(()=>`-${$.value}px`),ot=e.computed(()=>n.tableHeight?`${n.tableHeight}px`:null),nt=e.computed(()=>`${$.value*5}px`),ee=e.computed(()=>Math.round(n.tableFontSize/2.5)),rt=e.computed(()=>`${ee.value}px`),te=e.computed(()=>Math.round(ee.value)),at=e.computed(()=>`-${te.value}px`),lt=e.computed(()=>`${te.value}px`),st=e.computed(()=>`${n.tableFontSize*5}px`),ct=e.computed(()=>n.tableHeight?`${n.tableHeight-$.value}px`:`${n.tableFontSize*5*2}px`),it=e.computed(()=>{var o;return(o=n.checkboxColumnWidth)!=null?o:1.3*n.tableFontSize+20});e.provide("themeColor",n.themeColor),e.provide("loadingEntitySizePx",st.value),e.provide("rowHeight",$.value),e.provide("rowBorderColor",u.value),e.provide("footerBackgroundColor",i.value),e.provide("footerFontColor",S.value);const D=e.useSlots(),dt=e.computed(()=>D.body),ut=e.computed(()=>D.pagination),pt=e.computed(()=>D.loading),oe=e.ref(),U=e.ref();e.provide("dataTable",oe);const ne=e.ref(!1);e.onMounted(()=>{U.value.addEventListener("scroll",()=>{ne.value=U.value.scrollLeft>0})});const d=e.computed({get:()=>{if(n.serverOptions){const{page:o,rowsPerPage:r,sortBy:t,sortType:l}=n.serverOptions;return{page:o,rowsPerPage:r,sortBy:t!=null?t:null,sortType:l!=null?l:null}}return null},set:o=>{s("update:serverOptions",o)}}),G=e.computed(()=>n.itemsSelected!==null),B=e.computed(()=>d.value!==null),ft=e.computed(()=>!B.value&&n.rowsItems.findIndex(o=>o===n.rowsPerPage)===-1?[n.rowsPerPage,...n.rowsItems]:n.rowsItems),mt=()=>n.sortBy!==""?{sortBy:n.sortBy,sortDesc:n.sortType==="desc"}:null,I=e.ref(mt()),gt=o=>{var t;const r=(t=o.width)!=null?t:o.fixed?100:null;if(r)return`width: ${r}px; min-width: ${r}px;`},K=e.computed(()=>n.headers.findIndex(o=>o.fixed)!==-1),ht=e.computed(()=>K.value?n.headers.filter(o=>o.fixed):[]),_t=e.computed(()=>n.headers.filter(o=>!o.fixed)),L=e.computed(()=>{const r=[...ht.value,..._t.value].map(p=>{const m=p;return p.sortable&&(m.sortType="none"),d.value&&p.value===d.value.sortBy&&d.value.sortType&&(m.sortType=d.value.sortType),!B.value&&I.value&&p.value===I.value.sortBy&&(m.sortType=I.value.sortDesc?"desc":"asc"),m});let t=[];n.showIndex?t=[n.fixedIndex||K.value?{text:"#",value:"index",fixed:!0,width:n.indexColumnWidth}:{text:"#",value:"index"},...r]:t=r;let l=[];return G.value?l=[n.fixedCheckbox||K.value?{text:"checkbox",value:"checkbox",fixed:!0,width:it.value}:{text:"checkbox",value:"checkbox"},...t]:l=t,l}),E=e.computed(()=>L.value.filter(o=>o.fixed)),re=e.computed(()=>E.value.length?E.value[E.value.length-1].value:""),yt=e.computed(()=>{if(!E.value.length)return[];const o=E.value.map(r=>{var t;return(t=r.width)!=null?t:100});return E.value.map((r,t)=>{var l,p;return{value:r.value,fixed:(l=r.fixed)!=null?l:!0,width:(p=r.width)!=null?p:100,distance:t===0?0:o.reduce((m,wt,Pt)=>{let ge=m;return Pt<t&&(ge+=wt),ge})}})}),ae=(o,r="th")=>{if(!E.value.length)return;const t=yt.value.find(l=>l.value===o);if(t)return`left: ${t.distance}px;z-index: ${r==="th"?3:1}; position: sticky`},le=e.computed(()=>L.value.map(o=>o.value)),R=(o,r)=>{if(o.includes(".")){let t="";return o.split(".").forEach((p,m)=>{t=m===0?r[p]:t[p]}),t}return r[o]},kt=(o,r)=>{const t=R(o,r);return Array.isArray(t)?t.join(","):t},w=e.computed({get:()=>{var o;return(o=n.itemsSelected)!=null?o:[]},set:o=>{s("update:itemsSelected",o)}}),se=e.computed(()=>{if(!B.value&&n.searchValue!==""){const o=new RegExp(n.searchValue,"i");return n.items.filter(r=>o.test(n.searchField!==""?r[n.searchField]:Object.values(r).join(" ")))}return n.items}),V=e.computed(()=>{let o=[...se.value];return n.filterOptions?(n.filterOptions.forEach(r=>{o=o.filter(t=>{const{field:l,comparison:p,criteria:m}=r;switch(p){case"=":return t[l]===m;case"!=":return t[l]!==m;case">":return t[l]>m;case"<":return t[l]<m;case"<=":return t[l]<=m;case">=":return t[l]>=m;case"between":return t[l]>=Math.min(...m)&&t[l]<=Math.max(...m);default:return t[l]===m}})}),o):se.value}),M=e.computed(()=>w.value.length===0||w.value.every(r=>V.value.findIndex(t=>JSON.stringify(r)===JSON.stringify(t))===-1)?"noneSelected":w.value.length===V.value.length&&w.value.every(t=>V.value.findIndex(l=>JSON.stringify(t)===JSON.stringify(l))!==-1)?"allSelected":"partSelected"),_=e.ref(B.value?n.serverOptions.page:1),{items:Q}=e.toRefs(n);e.watch(Q,()=>{B.value||(_.value=1)},{deep:!0});const N=e.ref(B.value?n.serverOptions.rowsPerPage:n.rowsPerPage);e.watch(N,o=>{d.value&&(d.value=H(C({},d.value),{page:1,rowsPerPage:o})),_.value=1});const xt=(o,r)=>{let t=null;r==="none"?t="asc":r==="asc"?t="desc":t=null,d.value?d.value=H(C({},d.value),{sortBy:t!==null?o:null,sortType:t}):t===null?I.value=null:I.value={sortBy:o,sortDesc:t==="desc"}},ce=e.computed(()=>{if(B.value)return n.items;if(I.value===null)return V.value;const{sortBy:o,sortDesc:r}=I.value;return[...V.value].sort((l,p)=>R(o,l)<R(o,p)?r?1:-1:R(o,l)>R(o,p)?r?-1:1:0)}),X=e.computed(()=>B.value?n.serverItemsLength:V.value.length),ie=e.computed(()=>B.value?_.value*N.value:Math.min(V.value.length,_.value*N.value)),de=e.computed(()=>(_.value-1)*N.value+1),j=e.computed(()=>Math.ceil(X.value/N.value)),q=e.computed(()=>_.value===j.value),W=e.computed(()=>_.value===1),{loading:F}=e.toRefs(n),Y=()=>{if(!q.value&&!F.value)if(d.value){const o=_.value+1;d.value=H(C({},d.value),{page:o})}else _.value+=1},Z=()=>{if(!W.value&&!F.value)if(d.value){const o=_.value-1;d.value=H(C({},d.value),{page:o})}else _.value-=1},ue=o=>{F.value||(d.value?d.value=H(C({},d.value),{page:o}):_.value=o)};e.watch(F,(o,r)=>{d.value&&o===!1&&r===!0&&(_.value=d.value.page)});const pe=e.computed(()=>B.value?n.items:ce.value.slice(de.value-1,ie.value)),fe=e.computed(()=>N.value*(_.value-1)+1),bt=e.computed(()=>N.value*_.value),J=e.computed(()=>n.showIndex?pe.value.map((o,r)=>C({index:fe.value+r},o)):pe.value),me=e.computed(()=>G.value?M.value==="allSelected"?J.value.map(o=>C({checkbox:!0},o)):M.value==="noneSelected"?J.value.map(o=>C({checkbox:!1},o)):J.value.map(o=>{const r=w.value.findIndex(t=>{const l=C({},o);return delete l.index,JSON.stringify(t)===JSON.stringify(l)})!==-1;return C({checkbox:r},o)}):J.value),Ct=o=>{w.value=o?ce.value:[]},St=o=>{const r=o.checkbox;if(delete o.checkbox,delete o.index,r)w.value=w.value.filter(t=>JSON.stringify(t)!==JSON.stringify(o));else{const t=w.value;t.unshift(o),w.value=t}},Bt=o=>{const r=C({},o);if(G.value){const{checkbox:t}=o;delete r.checkbox,r.isSelected=t}if(n.showIndex){const{index:t}=o;delete r.index,r.indexInCurrentPage=t}s("clickRow",r)};return k({clientItemsLength:X,currentPageFirstIndex:fe,currentPageLastIndex:bt,maxPaginationNumber:j,currentPaginationNumber:_,isLastPage:q,isFirstPage:W,nextPage:Y,prevPage:Z,updatePage:ue}),(o,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:oe,class:"vue3-easy-data-table"},[e.createElementVNode("div",{ref_key:"tableBody",ref:U,class:e.normalizeClass(["data-table__body",{"fixed-header":a.fixedHeader,"fixed-height":a.tableHeight,"show-shadow":ne.value}])},[e.createElementVNode("table",null,[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(L),(t,l)=>(e.openBlock(),e.createElementBlock("col",{key:l,style:e.normalizeStyle(gt(t))},null,4))),128))]),e.unref(L).length?(e.openBlock(),e.createElementBlock("thead",je,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(L),(t,l)=>(e.openBlock(),e.createElementBlock("th",{key:l,colspan:"1",rowspan:"1",class:e.normalizeClass({sortable:t.sortable,none:t.sortable&&t.sortType==="none",desc:t.sortable&&t.sortType==="desc",asc:t.sortable&&t.sortType==="asc",fixed:t.fixed,hasShadow:t.value===e.unref(re)}),style:e.normalizeStyle(ae(t.value)),onClick:p=>t.sortable&&t.sortType?xt(t.value,t.sortType):null},[t.text==="checkbox"?(e.openBlock(),e.createBlock(Ce,{key:e.unref(M),status:e.unref(M),onChange:Ct},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",We,[e.createElementVNode("span",Je,e.toDisplayString(t.text),1),t.sortable?(e.openBlock(),e.createElementBlock("i",{key:t.sortType?t.sortType:"none",class:e.normalizeClass(["sortType-icon",{desc:t.sortType==="desc"}])},null,2)):e.createCommentVNode("",!0)]))],14,qe))),128))])])):e.createCommentVNode("",!0),e.unref(dt)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(Q).length&&e.unref(le).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":a.alternating,"hover-to-change-color":a.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(me),t=>(e.openBlock(),e.createElementBlock("tr",{key:JSON.stringify(t),onClick:l=>Bt(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(le),(l,p)=>(e.openBlock(),e.createElementBlock("td",{key:p,colspan:"1",rowspan:"1",style:e.normalizeStyle(ae(l,"td")),class:e.normalizeClass({hasShadow:l===e.unref(re)})},[e.unref(D)[l]?e.renderSlot(o.$slots,l,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):l==="checkbox"?(e.openBlock(),e.createBlock(Pe,{key:1,checked:t[l],onChange:m=>St(t)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(kt(l,t)),1)],64))],6))),128))],8,Ue))),128))],2)):e.createCommentVNode("",!0)],64))]),e.unref(F)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-wrapper",{"initial-loading":!e.unref(Q).length&&e.unref(F)}])},[e.createElementVNode("div",{class:e.normalizeClass(["loading-mask",{"no-footer":!a.showFooter}])},null,2),e.createElementVNode("div",Ge,[e.unref(pt)?e.renderSlot(o.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock(He,{key:1}))])],2)):e.createCommentVNode("",!0),!e.unref(me).length&&!e.unref(F)?(e.openBlock(),e.createElementBlock("div",Ke,e.toDisplayString(a.emptyMessage),1)):e.createCommentVNode("",!0)],2),a.showFooter?(e.openBlock(),e.createElementBlock("div",Qe,[a.hideRowsPerPage?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Xe,[Ye,e.createVNode(Fe,{modelValue:N.value,"onUpdate:modelValue":r[0]||(r[0]=t=>N.value=t),"rows-items":e.unref(ft)},null,8,["modelValue","rows-items"])])),e.createElementVNode("div",Ze,e.toDisplayString(`${e.unref(de)}-${e.unref(ie)}`)+" of "+e.toDisplayString(e.unref(X)),1),e.unref(ut)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:1},{isFirstPage:e.unref(W),isLastPage:e.unref(q),currentPaginationNumber:_.value,maxPaginationNumber:e.unref(j),nextPage:Y,prevPage:Z})),void 0,!0):(e.openBlock(),e.createBlock(Me,{key:2,"is-first-page":e.unref(W),"is-last-page":e.unref(q),onClickNextPage:Y,onClickPrevPage:Z},e.createSlots({_:2},[a.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(Re,{"current-pagination-number":_.value,"max-pagination-number":e.unref(j),onUpdatePage:ue},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))])):e.createCommentVNode("",!0)],512))}}),[["__scopeId","data-v-750e8d62"]]);return ve});
(function(e,y){typeof exports=="object"&&typeof module!="undefined"?module.exports=y(require("vue")):typeof define=="function"&&define.amd?define(["vue"],y):(e=typeof globalThis!="undefined"?globalThis:e||self,e["vue3-easy-data-table"]=y(e.Vue))})(this,function(e){"use strict";var Nt=Object.defineProperty,$t=Object.defineProperties;var It=Object.getOwnPropertyDescriptors;var he=Object.getOwnPropertySymbols;var Et=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable;var _e=(e,y,g)=>y in e?Nt(e,y,{enumerable:!0,configurable:!0,writable:!0,value:g}):e[y]=g,C=(e,y)=>{for(var g in y||(y={}))Et.call(y,g)&&_e(e,g,y[g]);if(he)for(var g of he(y))Vt.call(y,g)&&_e(e,g,y[g]);return e},H=(e,y)=>$t(e,It(y));var y="",g=(a,k)=>{const s=a.__vccOpts||a;for(const[n,u]of k)s[n]=u;return s};const ye=a=>(e.pushScopeId("data-v-566775ba"),a=a(),e.popScopeId(),a),ke=["onClick"],xe=["checked"],be=ye(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var Ce=g(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(a,{emit:k}){const s=a;e.useCssVars(P=>({"7f84b28f":e.unref(b)}));const n=e.computed(()=>s.status==="allSelected"),u=()=>{k("change",!n.value)},b=e.inject("themeColor");return(P,T)=>(e.openBlock(),e.createElementBlock("div",{class:"multi-select__checkbox",onClick:e.withModifiers(u,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(n),class:e.normalizeClass(a.status)},null,10,xe),be],8,ke))}}),[["__scopeId","data-v-566775ba"]]),Tt="";const Se=a=>(e.pushScopeId("data-v-39f156fd"),a=a(),e.popScopeId(),a),Be=["checked"],we=Se(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var Pe=g(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(a,{emit:k}){e.useCssVars(n=>({"20cfc5a0":e.unref(s)}));const s=e.inject("themeColor");return(n,u)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:u[0]||(u[0]=e.withModifiers(b=>k("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:a.checked},null,8,Be),we]))}}),[["__scopeId","data-v-39f156fd"]]),Ht="";const Ne=a=>(e.pushScopeId("data-v-0ed08e20"),a=a(),e.popScopeId(),a),$e={class:"easy-data-table__rows-selector"},Ie={class:"rows-input"},Ee=Ne(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),Ve=["onClick"];var Fe=g(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(a,{emit:k}){const s=a;e.useCssVars(h=>({"83c11052":e.unref(f),"6b60f418":e.unref(c),"346ac97c":e.unref(i)}));const n=e.ref(!1),u=e.ref(!1),b=e.inject("dataTable");e.watch(n,h=>{if(h&&b){const S=window.innerHeight,x=b.value.getBoundingClientRect().height,$=b.value.getBoundingClientRect().top;S-(x+$)<=100?u.value=!0:u.value=!1}});const P=e.computed({get:()=>s.modelValue,set:h=>{k("update:modelValue",h)}}),T=h=>{P.value=h,n.value=!1},O=(h,S)=>{let x=h.parentNode;for(;x!=null;){if(x.classList&&x.classList.contains(S))return!0;x=x.parentNode}return!1},z=h=>{O(h.target,"easy-data-table__rows-selector")||(n.value=!1)};e.onMounted(()=>{document.addEventListener("click",z)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",z)});const i=e.inject("themeColor"),c=e.inject("footerBackgroundColor"),f=e.inject("footerFontColor");return(h,S)=>(e.openBlock(),e.createElementBlock("div",$e,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:S[0]||(S[0]=x=>n.value=!n.value)},[e.createElementVNode("div",Ie,e.toDisplayString(e.unref(P)),1),Ee]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:n.value,inside:u.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.rowsItems,x=>(e.openBlock(),e.createElementBlock("li",{key:x,class:e.normalizeClass({selected:x===e.unref(P)}),onClick:$=>T(x)},e.toDisplayString(x),11,Ve))),128))],2)]))}}),[["__scopeId","data-v-0ed08e20"]]),Lt="";const A=a=>(e.pushScopeId("data-v-969989cc"),a=a(),e.popScopeId(),a),Te={class:"lds-ring"},ze=[A(()=>e.createElementVNode("div",null,null,-1)),A(()=>e.createElementVNode("div",null,null,-1)),A(()=>e.createElementVNode("div",null,null,-1)),A(()=>e.createElementVNode("div",null,null,-1))];var He=g(e.defineComponent({setup(a){e.useCssVars(n=>({"284c10f4":e.unref(s),"90c4d0a4":e.unref(k)}));const k=e.inject("themeColor"),s=e.inject("loadingEntitySizePx");return(n,u)=>(e.openBlock(),e.createElementBlock("div",Te,ze))}}),[["__scopeId","data-v-969989cc"]]),qt="";const Oe={class:"buttons-pagination"},Le=["onClick"];var Re=g(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(a,{emit:k}){const s=a;e.useCssVars(i=>({aa5730a0:e.unref(T),"24829312":e.unref(O),"98a0e762":e.unref(z)}));const n=7,u=i=>{i.type==="button"&&!i.active&&k("updatePage",i.page)},b=e.computed(()=>{const i=[];if(s.maxPaginationNumber<=n)for(let c=1;c<=s.maxPaginationNumber;c+=1)i.push({type:"button",page:c,active:c===s.currentPaginationNumber});else if([1,2,s.maxPaginationNumber,s.maxPaginationNumber-1].includes(s.currentPaginationNumber))for(let c=1;c<=n;c+=1)if(c<=3)i.push({type:"button",page:c,active:c===s.currentPaginationNumber});else if(c===4)i.push({type:"omission"});else{const f=s.maxPaginationNumber-(n-c);i.push({type:"button",page:f,active:f===s.currentPaginationNumber})}else if([3,4].includes(s.currentPaginationNumber))for(let c=1;c<=n;c+=1)c<=5?i.push({type:"button",page:c,active:c===s.currentPaginationNumber}):c===6?i.push({type:"omission"}):i.push({type:"button",page:s.maxPaginationNumber,active:s.maxPaginationNumber===s.currentPaginationNumber});else if([s.maxPaginationNumber-2,s.maxPaginationNumber-3].includes(s.currentPaginationNumber))for(let c=1;c<=n;c+=1)if(c===1)i.push({type:"button",page:1,active:s.currentPaginationNumber===1});else if(c===2)i.push({type:"omission"});else{const f=s.maxPaginationNumber-(n-c);i.push({type:"button",page:f,active:f===s.currentPaginationNumber})}else for(let c=1;c<=n;c+=1)if(c===1)i.push({type:"button",page:1,active:s.currentPaginationNumber===1});else if(c===2||c===6)i.push({type:"omission"});else if(c===7)i.push({type:"button",page:s.maxPaginationNumber,active:s.maxPaginationNumber===s.currentPaginationNumber});else{const f=4-c,h=s.currentPaginationNumber-f;i.push({type:"button",page:h,active:h===s.currentPaginationNumber})}return i}),P=e.inject("rowHeight"),T=e.computed(()=>`${P*.6}px`),O=e.inject("rowBorderColor"),z=e.inject("themeColor");return(i,c)=>(e.openBlock(),e.createElementBlock("div",Oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(f,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["item",{button:f.type==="button",active:f.type==="button"&&f.active,omission:f.type==="omission"}]),onClick:S=>u(f)},e.toDisplayString(f.type==="button"?f.page:"..."),11,Le))),128))]))}}),[["__scopeId","data-v-4f534e20"]]),Jt="";const v=a=>(e.pushScopeId("data-v-c9da5286"),a=a(),e.popScopeId(),a),Ae=[v(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],De=[v(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var Me=g(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(a,{emit:k}){const s=e.useSlots();return(n,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":a.isFirstPage}]),onClick:u[0]||(u[0]=b=>k("clickPrevPage"))},Ae,2),e.unref(s).buttonsPagination?e.renderSlot(n.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":a.isLastPage}]),onClick:u[1]||(u[1]=b=>k("clickNextPage"))},De,2)],64))}}),[["__scopeId","data-v-c9da5286"]]),Qt="";const je={key:0},qe=["onClick"],We={key:1,class:"header-text__wrapper"},Je={class:"header-text"},Ue=["onClick"],Ge={class:"loading-entity"},Ke={key:1,class:"data-table__message"},Qe={key:0,class:"data-table__footer"},Xe={key:0,class:"footer__rows-per-page"},Ye=e.createTextVNode(" rows per page: "),Ze={class:"footer__items-index"};var ve=g(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},rowBorderColor:{type:String,default:"#e0e0e0"},tableBorderColor:{type:String,default:"#e0e0e0"},rowBackgroundColor:{type:String,default:"#fff"},footerBackgroundColor:{type:String,default:"#fff"},rowFontColor:{type:String,default:"#212121"},footerFontColor:{type:String,default:"#212121"},emptyMessage:{type:String,default:"No Available Data"},fixedHeader:{type:Boolean,default:!0},headerFontColor:{type:String,default:"#373737"},headerBackgroundColor:{type:String,default:"#fff"},tableFontSize:{type:Number,default:12},evenRowBackgroundColor:{type:String,default:"#fafafa"},evenRowFontColor:{type:String,default:"#212121"},headers:{type:Array,required:!0},hoverToChangeColor:{type:Boolean,default:!0},items:{type:Array,required:!0},tableHeight:{type:Number,default:()=>null},itemsSelected:{type:Array,default:null},searchField:{type:String,default:""},searchValue:{type:String,default:""},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowHoverBackgroundColor:{type:String,default:"#eee"},rowHoverFontColor:{type:String,default:"#212121"},loading:{type:Boolean,deault:!1},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},themeColor:{type:String,default:"#42b883"},dense:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},showFooter:{type:Boolean,default:!0},filterOptions:{type:Array,default:null},fixedCheckbox:{type:Boolean,default:!1},fixedIndex:{type:Boolean,default:!1},indexColumnWidth:{type:Number,default:60},checkboxColumnWidth:{type:Number,default:null},hideRowsPerPage:{type:Boolean,default:!1}},emits:["update:itemsSelected","update:serverOptions","clickRow"],setup(a,{expose:k,emit:s}){const n=a;e.useCssVars(o=>({"9dddacda":e.unref(b),"51e93fd2":e.unref(nt),"1c8c8c13":e.unref(ot),"7b9e99ac":e.unref(ct),a0b928c2:e.unref(et),"36c6ba42":e.unref(x),"47afd044":e.unref(T),"335686c5":e.unref(c),"1ca1fc9a":e.unref(tt),b84ce2f2:e.unref(u),"63e3375d":e.unref(P),"2cc711c4":a.headerBackgroundColor,f91acdf8:e.unref(rt),"3f4458f2":e.unref(at),"574595ba":e.unref(lt),"63cfac09":e.unref(O),"03a18ef0":e.unref(z),"71df997e":e.unref(h),"7ef4fc7f":e.unref(f),"652c6650":e.unref(i),"091af40f":e.unref(S)}));const{rowBorderColor:u,tableBorderColor:b,headerFontColor:P,rowFontColor:T,rowHoverBackgroundColor:O,rowHoverFontColor:z,footerBackgroundColor:i,rowBackgroundColor:c,evenRowBackgroundColor:f,evenRowFontColor:h,footerFontColor:S}=e.toRefs(n),x=e.computed(()=>`${n.tableFontSize}px`),$=e.computed(()=>n.tableFontSize*(n.dense?2:3)),et=e.computed(()=>`${$.value}px`),tt=e.computed(()=>`-${$.value}px`),ot=e.computed(()=>n.tableHeight?`${n.tableHeight}px`:null),nt=e.computed(()=>`${$.value*5}px`),ee=e.computed(()=>Math.round(n.tableFontSize/2.5)),rt=e.computed(()=>`${ee.value}px`),te=e.computed(()=>Math.round(ee.value)),at=e.computed(()=>`-${te.value}px`),lt=e.computed(()=>`${te.value}px`),st=e.computed(()=>`${n.tableFontSize*5}px`),ct=e.computed(()=>n.tableHeight?`${n.tableHeight-$.value}px`:`${n.tableFontSize*5*2}px`),it=e.computed(()=>{var o;return(o=n.checkboxColumnWidth)!=null?o:1.3*n.tableFontSize+20});e.provide("themeColor",n.themeColor),e.provide("loadingEntitySizePx",st.value),e.provide("rowHeight",$.value),e.provide("rowBorderColor",u.value),e.provide("footerBackgroundColor",i.value),e.provide("footerFontColor",S.value);const D=e.useSlots(),dt=e.computed(()=>D.body),ut=e.computed(()=>D.pagination),pt=e.computed(()=>D.loading),oe=e.ref(),U=e.ref();e.provide("dataTable",oe);const ne=e.ref(!1);e.onMounted(()=>{U.value.addEventListener("scroll",()=>{ne.value=U.value.scrollLeft>0})});const d=e.computed({get:()=>{if(n.serverOptions){const{page:o,rowsPerPage:r,sortBy:t,sortType:l}=n.serverOptions;return{page:o,rowsPerPage:r,sortBy:t!=null?t:null,sortType:l!=null?l:null}}return null},set:o=>{s("update:serverOptions",o)}}),G=e.computed(()=>n.itemsSelected!==null),B=e.computed(()=>d.value!==null),ft=e.computed(()=>!B.value&&n.rowsItems.findIndex(o=>o===n.rowsPerPage)===-1?[n.rowsPerPage,...n.rowsItems]:n.rowsItems),mt=()=>n.sortBy!==""?{sortBy:n.sortBy,sortDesc:n.sortType==="desc"}:null,I=e.ref(mt()),gt=o=>{var t;const r=(t=o.width)!=null?t:o.fixed?100:null;if(r)return`width: ${r}px; min-width: ${r}px;`},K=e.computed(()=>n.headers.findIndex(o=>o.fixed)!==-1),ht=e.computed(()=>K.value?n.headers.filter(o=>o.fixed):[]),_t=e.computed(()=>n.headers.filter(o=>!o.fixed)),L=e.computed(()=>{const r=[...ht.value,..._t.value].map(p=>{const m=p;return p.sortable&&(m.sortType="none"),d.value&&p.value===d.value.sortBy&&d.value.sortType&&(m.sortType=d.value.sortType),!B.value&&I.value&&p.value===I.value.sortBy&&(m.sortType=I.value.sortDesc?"desc":"asc"),m});let t=[];n.showIndex?t=[n.fixedIndex||K.value?{text:"#",value:"index",fixed:!0,width:n.indexColumnWidth}:{text:"#",value:"index"},...r]:t=r;let l=[];return G.value?l=[n.fixedCheckbox||K.value?{text:"checkbox",value:"checkbox",fixed:!0,width:it.value}:{text:"checkbox",value:"checkbox"},...t]:l=t,l}),E=e.computed(()=>L.value.filter(o=>o.fixed)),re=e.computed(()=>E.value.length?E.value[E.value.length-1].value:""),yt=e.computed(()=>{if(!E.value.length)return[];const o=E.value.map(r=>{var t;return(t=r.width)!=null?t:100});return E.value.map((r,t)=>{var l,p;return{value:r.value,fixed:(l=r.fixed)!=null?l:!0,width:(p=r.width)!=null?p:100,distance:t===0?0:o.reduce((m,wt,Pt)=>{let ge=m;return Pt<t&&(ge+=wt),ge})}})}),ae=(o,r="th")=>{if(!E.value.length)return;const t=yt.value.find(l=>l.value===o);if(t)return`left: ${t.distance}px;z-index: ${r==="th"?3:1}; position: sticky`},le=e.computed(()=>L.value.map(o=>o.value)),R=(o,r)=>{if(o.includes(".")){let t="";return o.split(".").forEach((p,m)=>{t=m===0?r[p]:t[p]}),t}return r[o]},kt=(o,r)=>{const t=R(o,r);return Array.isArray(t)?t.join(","):t},w=e.computed({get:()=>{var o;return(o=n.itemsSelected)!=null?o:[]},set:o=>{s("update:itemsSelected",o)}}),se=e.computed(()=>{if(!B.value&&n.searchValue!==""){const o=new RegExp(n.searchValue,"i");return n.items.filter(r=>o.test(n.searchField!==""?r[n.searchField]:Object.values(r).join(" ")))}return n.items}),V=e.computed(()=>{let o=[...se.value];return n.filterOptions?(n.filterOptions.forEach(r=>{o=o.filter(t=>{const{field:l,comparison:p,criteria:m}=r;switch(p){case"=":return t[l]===m;case"!=":return t[l]!==m;case">":return t[l]>m;case"<":return t[l]<m;case"<=":return t[l]<=m;case">=":return t[l]>=m;case"between":return t[l]>=Math.min(...m)&&t[l]<=Math.max(...m);default:return t[l]===m}})}),o):se.value}),M=e.computed(()=>w.value.length===0||w.value.every(r=>V.value.findIndex(t=>JSON.stringify(r)===JSON.stringify(t))===-1)?"noneSelected":w.value.length===V.value.length&&w.value.every(t=>V.value.findIndex(l=>JSON.stringify(t)===JSON.stringify(l))!==-1)?"allSelected":"partSelected"),_=e.ref(B.value?n.serverOptions.page:1),{items:Q}=e.toRefs(n);e.watch(Q,()=>{B.value||(_.value=1)},{deep:!0});const N=e.ref(B.value?n.serverOptions.rowsPerPage:n.rowsPerPage);e.watch(N,o=>{d.value&&(d.value=H(C({},d.value),{page:1,rowsPerPage:o})),_.value=1});const xt=(o,r)=>{let t=null;r==="none"?t="asc":r==="asc"?t="desc":t=null,d.value?d.value=H(C({},d.value),{sortBy:t!==null?o:null,sortType:t}):t===null?I.value=null:I.value={sortBy:o,sortDesc:t==="desc"}},ce=e.computed(()=>{if(B.value)return n.items;if(I.value===null)return V.value;const{sortBy:o,sortDesc:r}=I.value;return[...V.value].sort((l,p)=>R(o,l)<R(o,p)?r?1:-1:R(o,l)>R(o,p)?r?-1:1:0)}),X=e.computed(()=>B.value?n.serverItemsLength:V.value.length),ie=e.computed(()=>B.value?_.value*N.value:Math.min(V.value.length,_.value*N.value)),de=e.computed(()=>(_.value-1)*N.value+1),j=e.computed(()=>Math.ceil(X.value/N.value)),q=e.computed(()=>_.value===j.value),W=e.computed(()=>_.value===1),{loading:F}=e.toRefs(n),Y=()=>{if(!q.value&&!F.value)if(d.value){const o=_.value+1;d.value=H(C({},d.value),{page:o})}else _.value+=1},Z=()=>{if(!W.value&&!F.value)if(d.value){const o=_.value-1;d.value=H(C({},d.value),{page:o})}else _.value-=1},ue=o=>{F.value||(d.value?d.value=H(C({},d.value),{page:o}):_.value=o)};e.watch(F,(o,r)=>{d.value&&o===!1&&r===!0&&(_.value=d.value.page)});const pe=e.computed(()=>B.value?n.items:ce.value.slice(de.value-1,ie.value)),fe=e.computed(()=>N.value*(_.value-1)+1),bt=e.computed(()=>N.value*_.value),J=e.computed(()=>n.showIndex?pe.value.map((o,r)=>C({index:fe.value+r},o)):pe.value),me=e.computed(()=>G.value?M.value==="allSelected"?J.value.map(o=>C({checkbox:!0},o)):M.value==="noneSelected"?J.value.map(o=>C({checkbox:!1},o)):J.value.map(o=>{const r=w.value.findIndex(t=>{const l=C({},o);return delete l.index,JSON.stringify(t)===JSON.stringify(l)})!==-1;return C({checkbox:r},o)}):J.value),Ct=o=>{w.value=o?ce.value:[]},St=o=>{const r=o.checkbox;if(delete o.checkbox,delete o.index,r)w.value=w.value.filter(t=>JSON.stringify(t)!==JSON.stringify(o));else{const t=w.value;t.unshift(o),w.value=t}},Bt=o=>{const r=C({},o);if(G.value){const{checkbox:t}=o;delete r.checkbox,r.isSelected=t}if(n.showIndex){const{index:t}=o;delete r.index,r.indexInCurrentPage=t}s("clickRow",r)};return k({clientItemsLength:X,currentPageFirstIndex:fe,currentPageLastIndex:bt,maxPaginationNumber:j,currentPaginationNumber:_,isLastPage:q,isFirstPage:W,nextPage:Y,prevPage:Z,updatePage:ue}),(o,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:oe,class:"vue3-easy-data-table"},[e.createElementVNode("div",{ref_key:"tableBody",ref:U,class:e.normalizeClass(["data-table__body",{"fixed-header":a.fixedHeader,"fixed-height":a.tableHeight,"show-shadow":ne.value}])},[e.createElementVNode("table",null,[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(L),(t,l)=>(e.openBlock(),e.createElementBlock("col",{key:l,style:e.normalizeStyle(gt(t))},null,4))),128))]),e.unref(L).length?(e.openBlock(),e.createElementBlock("thead",je,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(L),(t,l)=>(e.openBlock(),e.createElementBlock("th",{key:l,colspan:"1",rowspan:"1",class:e.normalizeClass({sortable:t.sortable,none:t.sortable&&t.sortType==="none",desc:t.sortable&&t.sortType==="desc",asc:t.sortable&&t.sortType==="asc",fixed:t.fixed,hasShadow:t.value===e.unref(re)}),style:e.normalizeStyle(ae(t.value)),onClick:p=>t.sortable&&t.sortType?xt(t.value,t.sortType):null},[t.text==="checkbox"?(e.openBlock(),e.createBlock(Ce,{key:e.unref(M),status:e.unref(M),onChange:Ct},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",We,[e.createElementVNode("span",Je,e.toDisplayString(t.text),1),t.sortable?(e.openBlock(),e.createElementBlock("i",{key:t.sortType?t.sortType:"none",class:e.normalizeClass(["sortType-icon",{desc:t.sortType==="desc"}])},null,2)):e.createCommentVNode("",!0)]))],14,qe))),128))])])):e.createCommentVNode("",!0),e.unref(dt)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(Q).length&&e.unref(le).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":a.alternating,"hover-to-change-color":a.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(me),t=>(e.openBlock(),e.createElementBlock("tr",{key:JSON.stringify(t),onClick:l=>Bt(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(le),(l,p)=>(e.openBlock(),e.createElementBlock("td",{key:p,colspan:"1",rowspan:"1",style:e.normalizeStyle(ae(l,"td")),class:e.normalizeClass({hasShadow:l===e.unref(re)})},[e.unref(D)[l]?e.renderSlot(o.$slots,l,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):l==="checkbox"?(e.openBlock(),e.createBlock(Pe,{key:1,checked:t[l],onChange:m=>St(t)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(kt(l,t)),1)],64))],6))),128))],8,Ue))),128))],2)):e.createCommentVNode("",!0)],64))]),e.unref(F)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-wrapper",{"initial-loading":!e.unref(Q).length&&e.unref(F)}])},[e.createElementVNode("div",{class:e.normalizeClass(["loading-mask",{"no-footer":!a.showFooter}])},null,2),e.createElementVNode("div",Ge,[e.unref(pt)?e.renderSlot(o.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock(He,{key:1}))])],2)):e.createCommentVNode("",!0),!e.unref(me).length&&!e.unref(F)?(e.openBlock(),e.createElementBlock("div",Ke,e.toDisplayString(a.emptyMessage),1)):e.createCommentVNode("",!0)],2),a.showFooter?(e.openBlock(),e.createElementBlock("div",Qe,[a.hideRowsPerPage?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Xe,[Ye,e.createVNode(Fe,{modelValue:N.value,"onUpdate:modelValue":r[0]||(r[0]=t=>N.value=t),"rows-items":e.unref(ft)},null,8,["modelValue","rows-items"])])),e.createElementVNode("div",Ze,e.toDisplayString(`${e.unref(de)}-${e.unref(ie)}`)+" of "+e.toDisplayString(e.unref(X)),1),e.unref(ut)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:1},{isFirstPage:e.unref(W),isLastPage:e.unref(q),currentPaginationNumber:_.value,maxPaginationNumber:e.unref(j),nextPage:Y,prevPage:Z})),void 0,!0):(e.openBlock(),e.createBlock(Me,{key:2,"is-first-page":e.unref(W),"is-last-page":e.unref(q),onClickNextPage:Y,onClickPrevPage:Z},e.createSlots({_:2},[a.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(Re,{"current-pagination-number":_.value,"max-pagination-number":e.unref(j),onUpdatePage:ue},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))])):e.createCommentVNode("",!0)],512))}}),[["__scopeId","data-v-36dbd8fe"]]);return ve});

@@ -6,3 +6,3 @@ {

"private": false,
"version": "1.2.11",
"version": "1.2.12-beta.0",
"types": "./types/main.d.ts",

@@ -9,0 +9,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc