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.4.11 to 1.4.12

15

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

@@ -481,3 +481,3 @@ var __defProp = Object.defineProperty;

}
function useHeaders(checkboxColumnWidth, expandColumnWidth, fixedCheckbox, fixedExpand, fixedIndex, headers, ifHasExpandSlot, indexColumnWidth, isMultipleSelectable, isServerSideMode, mustSort, serverOptionsComputed, showIndex, sortBy, sortType, updateServerOptionsSort) {
function useHeaders(checkboxColumnWidth, expandColumnWidth, fixedCheckbox, fixedExpand, fixedIndex, headers, ifHasExpandSlot, indexColumnWidth, isMultipleSelectable, isServerSideMode, mustSort, serverOptionsComputed, showIndex, sortBy, sortType, updateServerOptionsSort, emits) {
const hasFixedColumnsFromUser = computed(() => headers.value.findIndex((header) => header.fixed) !== -1);

@@ -575,2 +575,6 @@ const fixedHeadersFromUser = computed(() => {

}
emits("updateSort", {
sortType: newSortType,
sortBy: newSortBy
});
};

@@ -1021,3 +1025,3 @@ return {

var DataTable_vue_vue_type_style_index_1_scoped_true_lang = "";
const _withScopeId = (n) => (pushScopeId("data-v-05aef81b"), n = n(), popScopeId(), n);
const _withScopeId = (n) => (pushScopeId("data-v-efe62624"), n = n(), popScopeId(), n);
const _hoisted_1 = ["onClick"];

@@ -1068,2 +1072,3 @@ const _hoisted_2 = {

"expandRow",
"updateSort",
"update:itemsSelected",

@@ -1075,3 +1080,3 @@ "update:serverOptions"

useCssVars((_ctx) => ({
"5523b5fb": unref(tableHeightPx)
"0505f0ef": unref(tableHeightPx)
}));

@@ -1132,3 +1137,3 @@ const {

updateSortField
} = useHeaders(checkboxColumnWidth, expandColumnWidth, fixedCheckbox, fixedExpand, fixedIndex, headers, ifHasExpandSlot, indexColumnWidth, isMultipleSelectable, isServerSideMode, mustSort, serverOptionsComputed, showIndex, sortBy, sortType, updateServerOptionsSort);
} = useHeaders(checkboxColumnWidth, expandColumnWidth, fixedCheckbox, fixedExpand, fixedIndex, headers, ifHasExpandSlot, indexColumnWidth, isMultipleSelectable, isServerSideMode, mustSort, serverOptionsComputed, showIndex, sortBy, sortType, updateServerOptionsSort, emits);
const {

@@ -1387,3 +1392,3 @@ rowsItemsComputed,

});
var DataTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-05aef81b"]]);
var DataTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-efe62624"]]);
if (typeof window !== "undefined" && window.Vue) {

@@ -1390,0 +1395,0 @@ window.Vue.createApp({}).component("Vue3EasyDataTable", DataTable);

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

(function(e,C){typeof exports=="object"&&typeof module!="undefined"?module.exports=C(require("vue")):typeof define=="function"&&define.amd?define(["vue"],C):(e=typeof globalThis!="undefined"?globalThis:e||self,e["vue3-easy-data-table"]=C(e.Vue))})(this,function(e){"use strict";var Rt=Object.defineProperty,zt=Object.defineProperties;var At=Object.getOwnPropertyDescriptors;var xe=Object.getOwnPropertySymbols;var Ht=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable;var Pe=(e,C,b)=>C in e?Rt(e,C,{enumerable:!0,configurable:!0,writable:!0,value:b}):e[C]=b,v=(e,C)=>{for(var b in C||(C={}))Ht.call(C,b)&&Pe(e,b,C[b]);if(xe)for(var b of xe(C))Ot.call(C,b)&&Pe(e,b,C[b]);return e},W=(e,C)=>zt(e,At(C));var C="",b=(n,o)=>{const t=n.__vccOpts||n;for(const[i,c]of o)t[i]=c;return t};const Ce=n=>(e.pushScopeId("data-v-e0a0b7f0"),n=n(),e.popScopeId(),n),Ne=["onClick"],Se=["checked"],Be=Ce(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var we=b(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(n,{emit:o}){const t=n;e.useCssVars(l=>({"51ab8a49":e.unref(r)}));const i=e.computed(()=>t.status==="allSelected"),c=()=>{o("change",!i.value)},r=e.inject("themeColor");return(l,s)=>(e.openBlock(),e.createElementBlock("div",{class:"easy-checkbox",onClick:e.withModifiers(c,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(i),class:e.normalizeClass(n.status)},null,10,Se),Be],8,Ne))}}),[["__scopeId","data-v-e0a0b7f0"]]),jt="";const Ie=n=>(e.pushScopeId("data-v-7e69a276"),n=n(),e.popScopeId(),n),Ee=["checked"],$e=Ie(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var Ve=b(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(n,{emit:o}){e.useCssVars(i=>({fdaf7e9e:e.unref(t)}));const t=e.inject("themeColor");return(i,c)=>(e.openBlock(),e.createElementBlock("div",{class:"easy-checkbox",onClick:c[0]||(c[0]=e.withModifiers(r=>o("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:n.checked},null,8,Ee),$e]))}}),[["__scopeId","data-v-7e69a276"]]),Wt="";const ve=n=>(e.pushScopeId("data-v-384d1036"),n=n(),e.popScopeId(),n),Le={class:"easy-data-table__rows-selector"},Fe={class:"rows-input"},Te=ve(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),Re=["onClick"];var ze=b(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(n,{emit:o}){const t=n;e.useCssVars(g=>({"40595ee7":e.unref(k)}));const i=e.ref(!1),c=e.ref(!1),r=e.inject("dataTable");e.watch(i,g=>{if(g&&r){const y=window.innerHeight,f=r.value.getBoundingClientRect().height,x=r.value.getBoundingClientRect().top;y-(f+x)<=100?c.value=!0:c.value=!1}});const l=e.computed({get:()=>t.modelValue,set:g=>{o("update:modelValue",g)}}),s=g=>{l.value=g,i.value=!1},a=(g,y)=>{let f=g.parentNode;for(;f!=null;){if(f.classList&&f.classList.contains(y))return!0;f=f.parentNode}return!1},d=g=>{a(g.target,"easy-data-table__rows-selector")||(i.value=!1)};e.onMounted(()=>{document.addEventListener("click",d)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",d)});const k=e.inject("themeColor");return(g,y)=>(e.openBlock(),e.createElementBlock("div",Le,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:y[0]||(y[0]=f=>i.value=!i.value)},[e.createElementVNode("div",Fe,e.toDisplayString(e.unref(l)),1),Te]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:i.value,inside:c.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.rowsItems,f=>(e.openBlock(),e.createElementBlock("li",{key:f,class:e.normalizeClass({selected:f===e.unref(l)}),onClick:x=>s(f)},e.toDisplayString(f),11,Re))),128))],2)]))}}),[["__scopeId","data-v-384d1036"]]),Jt="";const q=n=>(e.pushScopeId("data-v-1fa3a520"),n=n(),e.popScopeId(),n),Ae={class:"lds-ring"},He=[q(()=>e.createElementVNode("div",null,null,-1)),q(()=>e.createElementVNode("div",null,null,-1)),q(()=>e.createElementVNode("div",null,null,-1)),q(()=>e.createElementVNode("div",null,null,-1))];var Oe=b(e.defineComponent({setup(n){e.useCssVars(t=>({"26774109":e.unref(o)}));const o=e.inject("themeColor");return(t,i)=>(e.openBlock(),e.createElementBlock("div",Ae,He))}}),[["__scopeId","data-v-1fa3a520"]]),Yt="";const De={class:"loader-line"};var je=b(e.defineComponent({setup(n){e.useCssVars(t=>({"0d327f57":e.unref(o)}));const o=e.inject("themeColor");return(t,i)=>(e.openBlock(),e.createElementBlock("div",De))}}),[["__scopeId","data-v-7d281cac"]]),en="";const Me={class:"buttons-pagination"},We=["onClick"];var qe=b(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(n,{emit:o}){const t=n;e.useCssVars(s=>({"40dd4f07":e.unref(l)}));const i=7,c=s=>{s.type==="button"&&!s.active&&o("updatePage",s.page)},r=e.computed(()=>{const s=[];if(t.maxPaginationNumber<=i)for(let a=1;a<=t.maxPaginationNumber;a+=1)s.push({type:"button",page:a,active:a===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber});else if([1,2,t.maxPaginationNumber,t.maxPaginationNumber-1].includes(t.currentPaginationNumber))for(let a=1;a<=i;a+=1)if(a<=3)s.push({type:"button",page:a,active:a===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber});else if(a===4)s.push({type:"omission"});else{const d=t.maxPaginationNumber-(i-a);s.push({type:"button",page:d,active:d===t.currentPaginationNumber,activePrev:d+1===t.currentPaginationNumber})}else if([3,4].includes(t.currentPaginationNumber))for(let a=1;a<=i;a+=1)a<=5?s.push({type:"button",page:a,active:a===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber}):a===6?s.push({type:"omission"}):s.push({type:"button",page:t.maxPaginationNumber,active:t.maxPaginationNumber===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber});else if([t.maxPaginationNumber-2,t.maxPaginationNumber-3].includes(t.currentPaginationNumber))for(let a=1;a<=i;a+=1)if(a===1)s.push({type:"button",page:1,active:t.currentPaginationNumber===1,activePrev:a+1===t.currentPaginationNumber});else if(a===2)s.push({type:"omission"});else{const d=t.maxPaginationNumber-(i-a);s.push({type:"button",page:d,active:d===t.currentPaginationNumber,activePrev:d+1===t.currentPaginationNumber})}else for(let a=1;a<=i;a+=1)if(a===1)s.push({type:"button",page:1,active:t.currentPaginationNumber===1,activePrev:a+1===t.currentPaginationNumber});else if(a===2||a===6)s.push({type:"omission"});else if(a===7)s.push({type:"button",page:t.maxPaginationNumber,active:t.maxPaginationNumber===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber});else{const d=4-a,k=t.currentPaginationNumber-d;s.push({type:"button",page:k,active:k===t.currentPaginationNumber,activePrev:k+1===t.currentPaginationNumber})}return s}),l=e.inject("themeColor");return(s,a)=>(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),(d,k)=>(e.openBlock(),e.createElementBlock("div",{key:k,class:e.normalizeClass(["item",{button:d.type==="button",active:d.type==="button"&&d.active,"active-prev":d.type==="button"&&d.activePrev,omission:d.type==="omission"}]),onClick:g=>c(d)},e.toDisplayString(d.type==="button"?d.page:"..."),11,We))),128))]))}}),[["__scopeId","data-v-4c681fa2"]]),nn="";const oe=n=>(e.pushScopeId("data-v-c9da5286"),n=n(),e.popScopeId(),n),Je=[oe(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],Ue=[oe(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var Ge=b(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(n,{emit:o}){const t=e.useSlots();return(i,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":n.isFirstPage}]),onClick:c[0]||(c[0]=r=>o("clickPrevPage"))},Je,2),e.unref(t).buttonsPagination?e.renderSlot(i.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":n.isLastPage}]),onClick:c[1]||(c[1]=r=>o("clickNextPage"))},Ue,2)],64))}}),[["__scopeId","data-v-c9da5286"]]);function Ke(n,o,t){return{clickRow:c=>{const r=v({},c);if(n.value){const{checkbox:l}=c;delete r.checkbox,r.isSelected=l}if(o.value){const{index:l}=c;delete r.index,r.indexInCurrentPage=l}t("clickRow",r)}}}function Qe(n,o){const t=e.ref([]);return{expandingItemIndexList:t,updateExpandingItemIndexList:(r,l,s)=>{s.stopPropagation();const a=t.value.indexOf(r);a!==-1?t.value.splice(a,1):(o("expandRow",n.value.findIndex(d=>d===l)),t.value.push(r))},clearExpandingItemIndexList:()=>{t.value=[]}}}function Xe(n){const o=e.computed(()=>n.value.filter(c=>c.fixed)),t=e.computed(()=>o.value.length?o.value[o.value.length-1].value:""),i=e.computed(()=>{if(!o.value.length)return[];const c=o.value.map(r=>{var l;return(l=r.width)!=null?l:100});return o.value.map((r,l)=>{var s,a;return{value:r.value,fixed:(s=r.fixed)!=null?s:!0,width:(a=r.width)!=null?a:100,distance:l===0?0:c.reduce((d,k,g)=>{let y=d;return g<l&&(y+=k),y})}})});return{fixedHeaders:o,lastFixedColumn:t,fixedColumnsInfos:i}}function Ye(n,o,t,i,c,r,l,s,a,d,k,g,y,f,x,N){const p=e.computed(()=>r.value.findIndex(S=>S.fixed)!==-1),P=e.computed(()=>p.value?r.value.filter(S=>S.fixed):[]),h=e.computed(()=>r.value.filter(S=>!S.fixed)),_=e.ref((()=>f.value!==""?{sortBy:f.value,sortDesc:x.value==="desc"}:null)()),V=e.computed(()=>{var J;const T=[...P.value,...h.value].map(E=>{const z=E;return E.sortable&&(z.sortType="none"),g.value&&E.value===g.value.sortBy&&g.value.sortType&&(z.sortType=g.value.sortType),!d.value&&_.value&&E.value===_.value.sortBy&&(z.sortType=_.value.sortDesc?"desc":"asc"),z});let I=[];l.value?I=[i.value||p.value?{text:"",value:"expand",fixed:!0,width:o.value}:{text:"",value:"expand"},...T]:I=T;let F=[];y.value?F=[c.value||p.value?{text:"#",value:"index",fixed:!0,width:s.value}:{text:"#",value:"index"},...I]:F=I;let D=[];return a.value?D=[t.value||p.value?{text:"checkbox",value:"checkbox",fixed:!0,width:(J=n.value)!=null?J:36}:{text:"checkbox",value:"checkbox"},...F]:D=F,D}),B=e.computed(()=>V.value.map(S=>S.value));return{clientSortOptions:_,headerColumns:B,headersForRender:V,updateSortField:(S,T)=>{let I=null;T==="none"?I="asc":T==="asc"?I="desc":I=k.value?"asc":null,d.value?N(S,I):I===null?_.value=null:_.value={sortBy:S,sortDesc:I==="desc"}}}}function Ze(n,o,t,i,c,r,l,s,a){const d=e.computed(()=>(n.value-1)*c.value+1),k=e.computed(()=>t.value?Math.min(a.value,n.value*c.value):Math.min(s.value.length,n.value*c.value)),g=e.computed(()=>t.value?i.value:s.value.slice(d.value-1,k.value)),y=e.computed(()=>l.value?g.value.map((N,p)=>v({index:d.value+p},N)):g.value),f=e.computed(()=>r.value.length===0||r.value.every(p=>s.value.findIndex(P=>JSON.stringify(p)===JSON.stringify(P))===-1)?"noneSelected":r.value.length===s.value.length&&r.value.every(P=>s.value.findIndex(h=>JSON.stringify(P)===JSON.stringify(h))!==-1)?"allSelected":"partSelected"),x=e.computed(()=>o.value?f.value==="allSelected"?y.value.map(N=>v({checkbox:!0},N)):f.value==="noneSelected"?y.value.map(N=>v({checkbox:!1},N)):y.value.map(N=>{const p=r.value.findIndex(P=>{const h=v({},N);return delete h.index,JSON.stringify(P)===JSON.stringify(h)})!==-1;return v({checkbox:p},N)}):y.value);return{currentPageFirstIndex:d,currentPageLastIndex:k,multipleSelectStatus:f,pageItems:x}}function et(n,o,t,i,c,r){const l=e.ref(c.value?c.value.page:1),s=e.computed(()=>Math.ceil(t.value/i.value)),a=e.computed(()=>l.value===s.value),d=e.computed(()=>l.value===1);return{currentPaginationNumber:l,maxPaginationNumber:s,isLastPage:a,isFirstPage:d,nextPage:()=>{if(!a.value&&!o.value)if(n.value){const x=l.value+1;r(x)}else l.value+=1},prevPage:()=>{if(!d.value&&!o.value)if(n.value){const x=l.value-1;r(x)}else l.value-=1},updatePage:x=>{o.value||(n.value?r(x):l.value=x)},updateCurrentPaginationNumber:x=>{l.value=x}}}function tt(n,o,t,i){const c=e.computed(()=>!n.value&&o.value.findIndex(l=>l===i.value)===-1?[i.value,...o.value]:o.value),r=e.ref(t.value?t.value.rowsPerPage:i.value);return{rowsItemsComputed:c,rowsPerPageRef:r}}function nt(n,o){const t=e.computed({get:()=>{if(n.value){const{page:l,rowsPerPage:s,sortBy:a,sortType:d}=n.value;return{page:l,rowsPerPage:s,sortBy:a!=null?a:null,sortType:d!=null?d:null}}return null},set:l=>{o("update:serverOptions",l)}});return{serverOptionsComputed:t,updateServerOptionsPage:l=>{t.value&&(t.value=W(v({},t.value),{page:l}))},updateServerOptionsSort:(l,s)=>{t.value&&(t.value=W(v({},t.value),{sortBy:s!==null?l:null,sortType:s}))},updateServerOptionsRowsPerPage:l=>{t.value&&(t.value=W(v({},t.value),{page:1,rowsPerPage:l}))}}}function H(n,o){if(n.includes(".")){let t="";return n.split(".").forEach((c,r)=>{t=r===0?o[c]:t[c]}),t}return o[n]}function at(n,o){const t=H(n,o);return Array.isArray(t)?t.join(","):t}function ot(n,o,t,i,c,r,l,s,a){const d=e.computed(()=>{if(!t.value&&l.value!==""){const p=new RegExp(l.value,"i");return i.value.filter(P=>p.test(r.value!==""?P[r.value]:Object.values(P).join(" ")))}return i.value}),k=e.computed(()=>{let p=[...d.value];return o.value?(o.value.forEach(P=>{p=p.filter(h=>{const{field:_,comparison:V,criteria:B}=P;if(typeof V=="function")return V(h[_],B);switch(V){case"=":return h[_]===B;case"!=":return h[_]!==B;case">":return h[_]>B;case"<":return h[_]<B;case"<=":return h[_]<=B;case">=":return h[_]>=B;case"between":return h[_]>=Math.min(...B)&&h[_]<=Math.max(...B);default:return h[_]===B}})}),p):d.value}),g=e.computed(()=>{if(t.value)return i.value;if(n.value===null)return k.value;const{sortBy:p,sortDesc:P}=n.value;return[...k.value].sort((_,V)=>H(p,_)<H(p,V)?P?1:-1:H(p,_)>H(p,V)?P?-1:1:0)}),y=e.computed(()=>t.value?s.value:g.value.length),f=e.computed({get:()=>{var p;return(p=c.value)!=null?p:[]},set:p=>{a("update:itemsSelected",p)}});return{totalItems:g,selectItemsComputed:f,totalItemsLength:y,toggleSelectAll:p=>{f.value=p?g.value:[]},toggleSelectItem:p=>{const P=p.checkbox;if(delete p.checkbox,delete p.index,P)f.value=f.value.filter(h=>JSON.stringify(h)!==JSON.stringify(p));else{const h=f.value;h.unshift(p),f.value=h}}}}var lt={alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},checkboxColumnWidth:{type:Number,default:null},emptyMessage:{type:String,default:"No Available Data"},expandColumnWidth:{type:Number,default:36},filterOptions:{type:Array,default:null},fixedExpand:{type:Boolean,default:!1},fixedHeader:{type:Boolean,default:!0},fixedCheckbox:{type:Boolean,default:!1},fixedIndex:{type:Boolean,default:!1},hideFooter:{type:Boolean,default:!1},hideRowsPerPage:{type:Boolean,default:!1},hideHeader:{type:Boolean,default:!1},indexColumnWidth:{type:Number,default:60},itemsSelected:{type:Array,default:null},loading:{type:Boolean,deault:!1},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowsPerPageMessage:{type:String,default:"rows per page:"},searchField:{type:String,default:""},searchValue:{type:String,default:""},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},showIndex:{type:Boolean,default:!1},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},tableHeight:{type:Number,default:null},themeColor:{type:String,default:"#42b883"},tableClassName:{type:String,default:""},headerClassName:{type:String,default:""},headerItemClassName:{type:[Function,String],default:""},bodyRowClassName:{type:[Function,String],default:""},bodyItemClassName:{type:[Function,String],default:""},noHover:{type:Boolean,default:!1},borderCell:{type:Boolean,default:!1},mustSort:{type:Boolean,default:!1}},rn="",sn="";const rt=n=>(e.pushScopeId("data-v-05aef81b"),n=n(),e.popScopeId(),n),st=["onClick"],it={key:1,class:"header"},ct={key:1,class:"header-text"},dt=["onClick"],ut=["onClick"],pt=["colspan"],ft={key:0,class:"vue3-easy-data-table__loading"},mt=rt(()=>e.createElementVNode("div",{class:"vue3-easy-data-table__loading-mask"},null,-1)),gt={class:"loading-entity"},ht={key:1,class:"vue3-easy-data-table__message"},_t={key:0,class:"vue3-easy-data-table__footer"},yt={key:0,class:"pagination__rows-per-page"},kt={class:"pagination__items-index"},bt=e.defineComponent({props:W(v({},lt),{items:{type:Array,required:!0},headers:{type:Array,required:!0}}),emits:["clickRow","expandRow","update:itemsSelected","update:serverOptions"],setup(n,{expose:o,emit:t}){const i=n;e.useCssVars(m=>({"5523b5fb":e.unref(J)}));const{checkboxColumnWidth:c,expandColumnWidth:r,filterOptions:l,fixedCheckbox:s,fixedExpand:a,fixedHeader:d,fixedIndex:k,headers:g,indexColumnWidth:y,items:f,itemsSelected:x,loading:N,mustSort:p,rowsItems:P,rowsPerPage:h,searchField:_,searchValue:V,serverItemsLength:B,serverOptions:O,showIndex:S,sortBy:T,sortType:I,tableHeight:F,themeColor:D}=e.toRefs(i),J=e.computed(()=>F.value?`${F.value}px`:null);e.provide("themeColor",D.value);const E=e.useSlots(),z=e.computed(()=>!!E.pagination),xt=e.computed(()=>!!E.loading),re=e.computed(()=>!!E.expand),se=e.ref(),K=e.ref();e.provide("dataTable",se);const ie=e.ref(!1);e.onMounted(()=>{K.value.addEventListener("scroll",()=>{ie.value=K.value.scrollLeft>0})});const Q=e.computed(()=>x.value!==null),R=e.computed(()=>O.value!==null),{serverOptionsComputed:X,updateServerOptionsPage:Pt,updateServerOptionsSort:Ct,updateServerOptionsRowsPerPage:Nt}=nt(O,t),{clientSortOptions:ce,headerColumns:de,headersForRender:j,updateSortField:St}=Ye(c,r,s,a,k,g,re,y,Q,R,p,X,S,T,I,Ct),{rowsItemsComputed:Bt,rowsPerPageRef:A}=tt(R,P,O,h),{totalItems:wt,selectItemsComputed:It,totalItemsLength:U,toggleSelectAll:Et,toggleSelectItem:$t}=ot(ce,l,R,f,x,_,V,B,t),{currentPaginationNumber:M,maxPaginationNumber:Y,isLastPage:Z,isFirstPage:ee,nextPage:te,prevPage:ne,updatePage:G,updateCurrentPaginationNumber:Vt}=et(R,N,U,A,O,Pt),{currentPageFirstIndex:ue,currentPageLastIndex:pe,multipleSelectStatus:fe,pageItems:me}=Ze(M,Q,R,f,A,It,S,wt,U),{expandingItemIndexList:ge,updateExpandingItemIndexList:vt,clearExpandingItemIndexList:he}=Qe(f,t),{fixedHeaders:ae,lastFixedColumn:_e,fixedColumnsInfos:Lt}=Xe(j),{clickRow:Ft}=Ke(Q,S,t),Tt=m=>{var u;const L=(u=m.width)!=null?u:ae.value.length?100:null;if(L)return`width: ${L}px; min-width: ${L}px;`},ye=(m,L="th")=>{if(!ae.value.length)return;const u=Lt.value.find(w=>w.value===m);if(u)return`left: ${u.distance}px;z-index: ${L==="th"?3:1};position: sticky;`};return e.watch(N,(m,L)=>{X.value&&m===!1&&L===!0&&(Vt(X.value.page),he())}),e.watch(f,()=>{R.value||G(1)},{deep:!0}),e.watch(A,m=>{R.value?Nt(m):G(1)}),e.watch([M,ce,_,V,l],()=>{he()},{deep:!0}),o({currentPageFirstIndex:ue,currentPageLastIndex:pe,clientItemsLength:U,maxPaginationNumber:Y,currentPaginationNumber:M,isLastPage:Z,isFirstPage:ee,nextPage:te,prevPage:ne,updatePage:G}),(m,L)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:se,class:e.normalizeClass(["vue3-easy-data-table",[m.tableClassName]])},[e.createElementVNode("div",{ref_key:"tableBody",ref:K,class:e.normalizeClass(["vue3-easy-data-table__main",{"fixed-header":e.unref(d),"fixed-height":e.unref(F),"show-shadow":ie.value,"table-fixed":e.unref(ae).length,hoverable:!m.noHover,"border-cell":m.borderCell}])},[e.createElementVNode("table",null,[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(j),(u,w)=>(e.openBlock(),e.createElementBlock("col",{key:w,style:e.normalizeStyle(Tt(u))},null,4))),128))]),e.unref(j).length&&!m.hideHeader?(e.openBlock(),e.createElementBlock("thead",{key:0,class:e.normalizeClass(["vue3-easy-data-table__header",[m.headerClassName]])},[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(j),(u,w)=>(e.openBlock(),e.createElementBlock("th",{key:w,class:e.normalizeClass([{sortable:u.sortable,none:u.sortable&&u.sortType==="none",desc:u.sortable&&u.sortType==="desc",asc:u.sortable&&u.sortType==="asc",shadow:u.value===e.unref(_e)},typeof m.headerItemClassName=="string"?m.headerItemClassName:m.headerItemClassName(u,w)]),style:e.normalizeStyle(ye(u.value)),onClick:e.withModifiers($=>u.sortable&&u.sortType?e.unref(St)(u.value,u.sortType):null,["stop"])},[u.text==="checkbox"?(e.openBlock(),e.createBlock(we,{key:e.unref(fe),status:e.unref(fe),onChange:e.unref(Et)},null,8,["status","onChange"])):(e.openBlock(),e.createElementBlock("span",it,[e.unref(E)[`header-${u.value}`]?e.renderSlot(m.$slots,`header-${u.value}`,e.normalizeProps(e.mergeProps({key:0},u)),void 0,!0):(e.openBlock(),e.createElementBlock("span",ct,e.toDisplayString(u.text),1)),u.sortable?(e.openBlock(),e.createElementBlock("i",{key:u.sortType?u.sortType:"none",class:e.normalizeClass(["sortType-icon",{desc:u.sortType==="desc"}])},null,2)):e.createCommentVNode("",!0)]))],14,st))),128))])],2)):e.createCommentVNode("",!0),e.unref(f).length&&e.unref(de).length?(e.openBlock(),e.createElementBlock("tbody",{key:1,class:e.normalizeClass(["vue3-easy-data-table__body",{"row-alternation":m.alternating}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(me),(u,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w},[e.createElementVNode("tr",{class:e.normalizeClass([{"even-row":(w+1)%2===0},typeof m.bodyRowClassName=="string"?m.bodyRowClassName:m.bodyRowClassName(u,w)]),onClick:$=>e.unref(Ft)(u)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(de),($,ke)=>(e.openBlock(),e.createElementBlock("td",{key:ke,style:e.normalizeStyle(ye($,"td")),class:e.normalizeClass([{shadow:$===e.unref(_e),"can-expand":$==="expand"},typeof m.bodyItemClassName=="string"?m.bodyItemClassName:m.bodyItemClassName($,ke)]),onClick:be=>$==="expand"?e.unref(vt)(w,u,be):null},[e.unref(E)[`item-${$}`]?e.renderSlot(m.$slots,`item-${$}`,e.normalizeProps(e.mergeProps({key:0},u)),void 0,!0):$==="expand"?(e.openBlock(),e.createElementBlock("i",{key:1,class:e.normalizeClass(["expand-icon",{expanding:e.unref(ge).includes(w)}])},null,2)):$==="checkbox"?(e.openBlock(),e.createBlock(Ve,{key:2,checked:u[$],onChange:be=>e.unref($t)(u)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(e.unref(at)($,u)),1)],64))],14,ut))),128))],10,dt),e.unref(re)&&e.unref(ge).includes(w)?(e.openBlock(),e.createElementBlock("tr",{key:0,class:e.normalizeClass({"even-row":(w+1)%2===0})},[e.createElementVNode("td",{colspan:e.unref(j).length,class:"expand"},[u.expandLoading?(e.openBlock(),e.createBlock(je,{key:0,class:"expand-loading"})):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"expand",e.normalizeProps(e.guardReactiveProps(u)),void 0,!0)],8,pt)],2)):e.createCommentVNode("",!0)],64))),128))],2)):e.createCommentVNode("",!0)]),e.unref(N)?(e.openBlock(),e.createElementBlock("div",ft,[mt,e.createElementVNode("div",gt,[e.unref(xt)?e.renderSlot(m.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock(Oe,{key:1}))])])):e.createCommentVNode("",!0),!e.unref(me).length&&!e.unref(N)?(e.openBlock(),e.createElementBlock("div",ht,e.toDisplayString(m.emptyMessage),1)):e.createCommentVNode("",!0)],2),m.hideFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_t,[m.hideRowsPerPage?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",yt,[e.createTextVNode(e.toDisplayString(m.rowsPerPageMessage)+" ",1),e.createVNode(ze,{modelValue:e.unref(A),"onUpdate:modelValue":L[0]||(L[0]=u=>e.isRef(A)?A.value=u:null),"rows-items":e.unref(Bt)},null,8,["modelValue","rows-items"])])),e.createElementVNode("div",kt,e.toDisplayString(`${e.unref(ue)}\u2013${e.unref(pe)}`)+" of "+e.toDisplayString(e.unref(U)),1),e.unref(z)?e.renderSlot(m.$slots,"pagination",e.normalizeProps(e.mergeProps({key:1},{isFirstPage:e.unref(ee),isLastPage:e.unref(Z),currentPaginationNumber:e.unref(M),maxPaginationNumber:e.unref(Y),nextPage:e.unref(te),prevPage:e.unref(ne)})),void 0,!0):(e.openBlock(),e.createBlock(Ge,{key:2,"is-first-page":e.unref(ee),"is-last-page":e.unref(Z),onClickNextPage:e.unref(te),onClickPrevPage:e.unref(ne)},e.createSlots({_:2},[m.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(qe,{"current-pagination-number":e.unref(M),"max-pagination-number":e.unref(Y),onUpdatePage:e.unref(G)},null,8,["current-pagination-number","max-pagination-number","onUpdatePage"])])}:void 0]),1032,["is-first-page","is-last-page","onClickNextPage","onClickPrevPage"]))]))],2))}});var le=b(bt,[["__scopeId","data-v-05aef81b"]]);return typeof window!="undefined"&&window.Vue&&window.Vue.createApp({}).component("Vue3EasyDataTable",le),le});
(function(e,C){typeof exports=="object"&&typeof module!="undefined"?module.exports=C(require("vue")):typeof define=="function"&&define.amd?define(["vue"],C):(e=typeof globalThis!="undefined"?globalThis:e||self,e["vue3-easy-data-table"]=C(e.Vue))})(this,function(e){"use strict";var Rt=Object.defineProperty,zt=Object.defineProperties;var At=Object.getOwnPropertyDescriptors;var Pe=Object.getOwnPropertySymbols;var Ht=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable;var Ce=(e,C,b)=>C in e?Rt(e,C,{enumerable:!0,configurable:!0,writable:!0,value:b}):e[C]=b,V=(e,C)=>{for(var b in C||(C={}))Ht.call(C,b)&&Ce(e,b,C[b]);if(Pe)for(var b of Pe(C))Ot.call(C,b)&&Ce(e,b,C[b]);return e},q=(e,C)=>zt(e,At(C));var C="",b=(n,o)=>{const t=n.__vccOpts||n;for(const[i,c]of o)t[i]=c;return t};const Ne=n=>(e.pushScopeId("data-v-e0a0b7f0"),n=n(),e.popScopeId(),n),Se=["onClick"],Be=["checked"],we=Ne(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var Ie=b(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(n,{emit:o}){const t=n;e.useCssVars(l=>({"51ab8a49":e.unref(r)}));const i=e.computed(()=>t.status==="allSelected"),c=()=>{o("change",!i.value)},r=e.inject("themeColor");return(l,s)=>(e.openBlock(),e.createElementBlock("div",{class:"easy-checkbox",onClick:e.withModifiers(c,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(i),class:e.normalizeClass(n.status)},null,10,Be),we],8,Se))}}),[["__scopeId","data-v-e0a0b7f0"]]),jt="";const Ee=n=>(e.pushScopeId("data-v-7e69a276"),n=n(),e.popScopeId(),n),$e=["checked"],Ve=Ee(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var ve=b(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(n,{emit:o}){e.useCssVars(i=>({fdaf7e9e:e.unref(t)}));const t=e.inject("themeColor");return(i,c)=>(e.openBlock(),e.createElementBlock("div",{class:"easy-checkbox",onClick:c[0]||(c[0]=e.withModifiers(r=>o("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:n.checked},null,8,$e),Ve]))}}),[["__scopeId","data-v-7e69a276"]]),Wt="";const Le=n=>(e.pushScopeId("data-v-384d1036"),n=n(),e.popScopeId(),n),Fe={class:"easy-data-table__rows-selector"},Te={class:"rows-input"},Re=Le(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),ze=["onClick"];var Ae=b(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(n,{emit:o}){const t=n;e.useCssVars(g=>({"40595ee7":e.unref(k)}));const i=e.ref(!1),c=e.ref(!1),r=e.inject("dataTable");e.watch(i,g=>{if(g&&r){const y=window.innerHeight,p=r.value.getBoundingClientRect().height,x=r.value.getBoundingClientRect().top;y-(p+x)<=100?c.value=!0:c.value=!1}});const l=e.computed({get:()=>t.modelValue,set:g=>{o("update:modelValue",g)}}),s=g=>{l.value=g,i.value=!1},a=(g,y)=>{let p=g.parentNode;for(;p!=null;){if(p.classList&&p.classList.contains(y))return!0;p=p.parentNode}return!1},d=g=>{a(g.target,"easy-data-table__rows-selector")||(i.value=!1)};e.onMounted(()=>{document.addEventListener("click",d)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",d)});const k=e.inject("themeColor");return(g,y)=>(e.openBlock(),e.createElementBlock("div",Fe,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:y[0]||(y[0]=p=>i.value=!i.value)},[e.createElementVNode("div",Te,e.toDisplayString(e.unref(l)),1),Re]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:i.value,inside:c.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.rowsItems,p=>(e.openBlock(),e.createElementBlock("li",{key:p,class:e.normalizeClass({selected:p===e.unref(l)}),onClick:x=>s(p)},e.toDisplayString(p),11,ze))),128))],2)]))}}),[["__scopeId","data-v-384d1036"]]),Jt="";const J=n=>(e.pushScopeId("data-v-1fa3a520"),n=n(),e.popScopeId(),n),He={class:"lds-ring"},Oe=[J(()=>e.createElementVNode("div",null,null,-1)),J(()=>e.createElementVNode("div",null,null,-1)),J(()=>e.createElementVNode("div",null,null,-1)),J(()=>e.createElementVNode("div",null,null,-1))];var De=b(e.defineComponent({setup(n){e.useCssVars(t=>({"26774109":e.unref(o)}));const o=e.inject("themeColor");return(t,i)=>(e.openBlock(),e.createElementBlock("div",He,Oe))}}),[["__scopeId","data-v-1fa3a520"]]),Yt="";const je={class:"loader-line"};var Me=b(e.defineComponent({setup(n){e.useCssVars(t=>({"0d327f57":e.unref(o)}));const o=e.inject("themeColor");return(t,i)=>(e.openBlock(),e.createElementBlock("div",je))}}),[["__scopeId","data-v-7d281cac"]]),en="";const We={class:"buttons-pagination"},qe=["onClick"];var Je=b(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(n,{emit:o}){const t=n;e.useCssVars(s=>({"40dd4f07":e.unref(l)}));const i=7,c=s=>{s.type==="button"&&!s.active&&o("updatePage",s.page)},r=e.computed(()=>{const s=[];if(t.maxPaginationNumber<=i)for(let a=1;a<=t.maxPaginationNumber;a+=1)s.push({type:"button",page:a,active:a===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber});else if([1,2,t.maxPaginationNumber,t.maxPaginationNumber-1].includes(t.currentPaginationNumber))for(let a=1;a<=i;a+=1)if(a<=3)s.push({type:"button",page:a,active:a===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber});else if(a===4)s.push({type:"omission"});else{const d=t.maxPaginationNumber-(i-a);s.push({type:"button",page:d,active:d===t.currentPaginationNumber,activePrev:d+1===t.currentPaginationNumber})}else if([3,4].includes(t.currentPaginationNumber))for(let a=1;a<=i;a+=1)a<=5?s.push({type:"button",page:a,active:a===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber}):a===6?s.push({type:"omission"}):s.push({type:"button",page:t.maxPaginationNumber,active:t.maxPaginationNumber===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber});else if([t.maxPaginationNumber-2,t.maxPaginationNumber-3].includes(t.currentPaginationNumber))for(let a=1;a<=i;a+=1)if(a===1)s.push({type:"button",page:1,active:t.currentPaginationNumber===1,activePrev:a+1===t.currentPaginationNumber});else if(a===2)s.push({type:"omission"});else{const d=t.maxPaginationNumber-(i-a);s.push({type:"button",page:d,active:d===t.currentPaginationNumber,activePrev:d+1===t.currentPaginationNumber})}else for(let a=1;a<=i;a+=1)if(a===1)s.push({type:"button",page:1,active:t.currentPaginationNumber===1,activePrev:a+1===t.currentPaginationNumber});else if(a===2||a===6)s.push({type:"omission"});else if(a===7)s.push({type:"button",page:t.maxPaginationNumber,active:t.maxPaginationNumber===t.currentPaginationNumber,activePrev:a+1===t.currentPaginationNumber});else{const d=4-a,k=t.currentPaginationNumber-d;s.push({type:"button",page:k,active:k===t.currentPaginationNumber,activePrev:k+1===t.currentPaginationNumber})}return s}),l=e.inject("themeColor");return(s,a)=>(e.openBlock(),e.createElementBlock("div",We,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),(d,k)=>(e.openBlock(),e.createElementBlock("div",{key:k,class:e.normalizeClass(["item",{button:d.type==="button",active:d.type==="button"&&d.active,"active-prev":d.type==="button"&&d.activePrev,omission:d.type==="omission"}]),onClick:g=>c(d)},e.toDisplayString(d.type==="button"?d.page:"..."),11,qe))),128))]))}}),[["__scopeId","data-v-4c681fa2"]]),nn="";const le=n=>(e.pushScopeId("data-v-c9da5286"),n=n(),e.popScopeId(),n),Ue=[le(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],Ge=[le(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var Ke=b(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(n,{emit:o}){const t=e.useSlots();return(i,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":n.isFirstPage}]),onClick:c[0]||(c[0]=r=>o("clickPrevPage"))},Ue,2),e.unref(t).buttonsPagination?e.renderSlot(i.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":n.isLastPage}]),onClick:c[1]||(c[1]=r=>o("clickNextPage"))},Ge,2)],64))}}),[["__scopeId","data-v-c9da5286"]]);function Qe(n,o,t){return{clickRow:c=>{const r=V({},c);if(n.value){const{checkbox:l}=c;delete r.checkbox,r.isSelected=l}if(o.value){const{index:l}=c;delete r.index,r.indexInCurrentPage=l}t("clickRow",r)}}}function Xe(n,o){const t=e.ref([]);return{expandingItemIndexList:t,updateExpandingItemIndexList:(r,l,s)=>{s.stopPropagation();const a=t.value.indexOf(r);a!==-1?t.value.splice(a,1):(o("expandRow",n.value.findIndex(d=>d===l)),t.value.push(r))},clearExpandingItemIndexList:()=>{t.value=[]}}}function Ye(n){const o=e.computed(()=>n.value.filter(c=>c.fixed)),t=e.computed(()=>o.value.length?o.value[o.value.length-1].value:""),i=e.computed(()=>{if(!o.value.length)return[];const c=o.value.map(r=>{var l;return(l=r.width)!=null?l:100});return o.value.map((r,l)=>{var s,a;return{value:r.value,fixed:(s=r.fixed)!=null?s:!0,width:(a=r.width)!=null?a:100,distance:l===0?0:c.reduce((d,k,g)=>{let y=d;return g<l&&(y+=k),y})}})});return{fixedHeaders:o,lastFixedColumn:t,fixedColumnsInfos:i}}function Ze(n,o,t,i,c,r,l,s,a,d,k,g,y,p,x,N,f){const _=e.computed(()=>r.value.findIndex(I=>I.fixed)!==-1),h=e.computed(()=>_.value?r.value.filter(I=>I.fixed):[]),P=e.computed(()=>r.value.filter(I=>!I.fixed)),S=e.ref((()=>p.value!==""?{sortBy:p.value,sortDesc:x.value==="desc"}:null)()),w=e.computed(()=>{var F;const T=[...h.value,...P.value].map(L=>{const H=L;return L.sortable&&(H.sortType="none"),g.value&&L.value===g.value.sortBy&&g.value.sortType&&(H.sortType=g.value.sortType),!d.value&&S.value&&L.value===S.value.sortBy&&(H.sortType=S.value.sortDesc?"desc":"asc"),H});let B=[];l.value?B=[i.value||_.value?{text:"",value:"expand",fixed:!0,width:o.value}:{text:"",value:"expand"},...T]:B=T;let A=[];y.value?A=[c.value||_.value?{text:"#",value:"index",fixed:!0,width:s.value}:{text:"#",value:"index"},...B]:A=B;let j=[];return a.value?j=[t.value||_.value?{text:"checkbox",value:"checkbox",fixed:!0,width:(F=n.value)!=null?F:36}:{text:"checkbox",value:"checkbox"},...A]:j=A,j}),z=e.computed(()=>w.value.map(I=>I.value));return{clientSortOptions:S,headerColumns:z,headersForRender:w,updateSortField:(I,T)=>{let B=null;T==="none"?B="asc":T==="asc"?B="desc":B=k.value?"asc":null,d.value?N(I,B):B===null?S.value=null:S.value={sortBy:I,sortDesc:B==="desc"},f("updateSort",{sortType:B,sortBy:I})}}}function et(n,o,t,i,c,r,l,s,a){const d=e.computed(()=>(n.value-1)*c.value+1),k=e.computed(()=>t.value?Math.min(a.value,n.value*c.value):Math.min(s.value.length,n.value*c.value)),g=e.computed(()=>t.value?i.value:s.value.slice(d.value-1,k.value)),y=e.computed(()=>l.value?g.value.map((N,f)=>V({index:d.value+f},N)):g.value),p=e.computed(()=>r.value.length===0||r.value.every(f=>s.value.findIndex(_=>JSON.stringify(f)===JSON.stringify(_))===-1)?"noneSelected":r.value.length===s.value.length&&r.value.every(_=>s.value.findIndex(h=>JSON.stringify(_)===JSON.stringify(h))!==-1)?"allSelected":"partSelected"),x=e.computed(()=>o.value?p.value==="allSelected"?y.value.map(N=>V({checkbox:!0},N)):p.value==="noneSelected"?y.value.map(N=>V({checkbox:!1},N)):y.value.map(N=>{const f=r.value.findIndex(_=>{const h=V({},N);return delete h.index,JSON.stringify(_)===JSON.stringify(h)})!==-1;return V({checkbox:f},N)}):y.value);return{currentPageFirstIndex:d,currentPageLastIndex:k,multipleSelectStatus:p,pageItems:x}}function tt(n,o,t,i,c,r){const l=e.ref(c.value?c.value.page:1),s=e.computed(()=>Math.ceil(t.value/i.value)),a=e.computed(()=>l.value===s.value),d=e.computed(()=>l.value===1);return{currentPaginationNumber:l,maxPaginationNumber:s,isLastPage:a,isFirstPage:d,nextPage:()=>{if(!a.value&&!o.value)if(n.value){const x=l.value+1;r(x)}else l.value+=1},prevPage:()=>{if(!d.value&&!o.value)if(n.value){const x=l.value-1;r(x)}else l.value-=1},updatePage:x=>{o.value||(n.value?r(x):l.value=x)},updateCurrentPaginationNumber:x=>{l.value=x}}}function nt(n,o,t,i){const c=e.computed(()=>!n.value&&o.value.findIndex(l=>l===i.value)===-1?[i.value,...o.value]:o.value),r=e.ref(t.value?t.value.rowsPerPage:i.value);return{rowsItemsComputed:c,rowsPerPageRef:r}}function at(n,o){const t=e.computed({get:()=>{if(n.value){const{page:l,rowsPerPage:s,sortBy:a,sortType:d}=n.value;return{page:l,rowsPerPage:s,sortBy:a!=null?a:null,sortType:d!=null?d:null}}return null},set:l=>{o("update:serverOptions",l)}});return{serverOptionsComputed:t,updateServerOptionsPage:l=>{t.value&&(t.value=q(V({},t.value),{page:l}))},updateServerOptionsSort:(l,s)=>{t.value&&(t.value=q(V({},t.value),{sortBy:s!==null?l:null,sortType:s}))},updateServerOptionsRowsPerPage:l=>{t.value&&(t.value=q(V({},t.value),{page:1,rowsPerPage:l}))}}}function D(n,o){if(n.includes(".")){let t="";return n.split(".").forEach((c,r)=>{t=r===0?o[c]:t[c]}),t}return o[n]}function ot(n,o){const t=D(n,o);return Array.isArray(t)?t.join(","):t}function lt(n,o,t,i,c,r,l,s,a){const d=e.computed(()=>{if(!t.value&&l.value!==""){const f=new RegExp(l.value,"i");return i.value.filter(_=>f.test(r.value!==""?_[r.value]:Object.values(_).join(" ")))}return i.value}),k=e.computed(()=>{let f=[...d.value];return o.value?(o.value.forEach(_=>{f=f.filter(h=>{const{field:P,comparison:S,criteria:w}=_;if(typeof S=="function")return S(h[P],w);switch(S){case"=":return h[P]===w;case"!=":return h[P]!==w;case">":return h[P]>w;case"<":return h[P]<w;case"<=":return h[P]<=w;case">=":return h[P]>=w;case"between":return h[P]>=Math.min(...w)&&h[P]<=Math.max(...w);default:return h[P]===w}})}),f):d.value}),g=e.computed(()=>{if(t.value)return i.value;if(n.value===null)return k.value;const{sortBy:f,sortDesc:_}=n.value;return[...k.value].sort((P,S)=>D(f,P)<D(f,S)?_?1:-1:D(f,P)>D(f,S)?_?-1:1:0)}),y=e.computed(()=>t.value?s.value:g.value.length),p=e.computed({get:()=>{var f;return(f=c.value)!=null?f:[]},set:f=>{a("update:itemsSelected",f)}});return{totalItems:g,selectItemsComputed:p,totalItemsLength:y,toggleSelectAll:f=>{p.value=f?g.value:[]},toggleSelectItem:f=>{const _=f.checkbox;if(delete f.checkbox,delete f.index,_)p.value=p.value.filter(h=>JSON.stringify(h)!==JSON.stringify(f));else{const h=p.value;h.unshift(f),p.value=h}}}}var rt={alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},checkboxColumnWidth:{type:Number,default:null},emptyMessage:{type:String,default:"No Available Data"},expandColumnWidth:{type:Number,default:36},filterOptions:{type:Array,default:null},fixedExpand:{type:Boolean,default:!1},fixedHeader:{type:Boolean,default:!0},fixedCheckbox:{type:Boolean,default:!1},fixedIndex:{type:Boolean,default:!1},hideFooter:{type:Boolean,default:!1},hideRowsPerPage:{type:Boolean,default:!1},hideHeader:{type:Boolean,default:!1},indexColumnWidth:{type:Number,default:60},itemsSelected:{type:Array,default:null},loading:{type:Boolean,deault:!1},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowsPerPageMessage:{type:String,default:"rows per page:"},searchField:{type:String,default:""},searchValue:{type:String,default:""},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},showIndex:{type:Boolean,default:!1},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},tableHeight:{type:Number,default:null},themeColor:{type:String,default:"#42b883"},tableClassName:{type:String,default:""},headerClassName:{type:String,default:""},headerItemClassName:{type:[Function,String],default:""},bodyRowClassName:{type:[Function,String],default:""},bodyItemClassName:{type:[Function,String],default:""},noHover:{type:Boolean,default:!1},borderCell:{type:Boolean,default:!1},mustSort:{type:Boolean,default:!1}},rn="",sn="";const st=n=>(e.pushScopeId("data-v-efe62624"),n=n(),e.popScopeId(),n),it=["onClick"],ct={key:1,class:"header"},dt={key:1,class:"header-text"},ut=["onClick"],pt=["onClick"],ft=["colspan"],mt={key:0,class:"vue3-easy-data-table__loading"},gt=st(()=>e.createElementVNode("div",{class:"vue3-easy-data-table__loading-mask"},null,-1)),ht={class:"loading-entity"},_t={key:1,class:"vue3-easy-data-table__message"},yt={key:0,class:"vue3-easy-data-table__footer"},kt={key:0,class:"pagination__rows-per-page"},bt={class:"pagination__items-index"},xt=e.defineComponent({props:q(V({},rt),{items:{type:Array,required:!0},headers:{type:Array,required:!0}}),emits:["clickRow","expandRow","updateSort","update:itemsSelected","update:serverOptions"],setup(n,{expose:o,emit:t}){const i=n;e.useCssVars(m=>({"0505f0ef":e.unref(j)}));const{checkboxColumnWidth:c,expandColumnWidth:r,filterOptions:l,fixedCheckbox:s,fixedExpand:a,fixedHeader:d,fixedIndex:k,headers:g,indexColumnWidth:y,items:p,itemsSelected:x,loading:N,mustSort:f,rowsItems:_,rowsPerPage:h,searchField:P,searchValue:S,serverItemsLength:w,serverOptions:z,showIndex:U,sortBy:I,sortType:T,tableHeight:B,themeColor:A}=e.toRefs(i),j=e.computed(()=>B.value?`${B.value}px`:null);e.provide("themeColor",A.value);const F=e.useSlots(),L=e.computed(()=>!!F.pagination),H=e.computed(()=>!!F.loading),se=e.computed(()=>!!F.expand),ie=e.ref(),Q=e.ref();e.provide("dataTable",ie);const ce=e.ref(!1);e.onMounted(()=>{Q.value.addEventListener("scroll",()=>{ce.value=Q.value.scrollLeft>0})});const X=e.computed(()=>x.value!==null),R=e.computed(()=>z.value!==null),{serverOptionsComputed:Y,updateServerOptionsPage:Pt,updateServerOptionsSort:Ct,updateServerOptionsRowsPerPage:Nt}=at(z,t),{clientSortOptions:de,headerColumns:ue,headersForRender:M,updateSortField:St}=Ze(c,r,s,a,k,g,se,y,X,R,f,Y,U,I,T,Ct,t),{rowsItemsComputed:Bt,rowsPerPageRef:O}=nt(R,_,z,h),{totalItems:wt,selectItemsComputed:It,totalItemsLength:G,toggleSelectAll:Et,toggleSelectItem:$t}=lt(de,l,R,p,x,P,S,w,t),{currentPaginationNumber:W,maxPaginationNumber:Z,isLastPage:ee,isFirstPage:te,nextPage:ne,prevPage:ae,updatePage:K,updateCurrentPaginationNumber:Vt}=tt(R,N,G,O,z,Pt),{currentPageFirstIndex:pe,currentPageLastIndex:fe,multipleSelectStatus:me,pageItems:ge}=et(W,X,R,p,O,It,U,wt,G),{expandingItemIndexList:he,updateExpandingItemIndexList:vt,clearExpandingItemIndexList:_e}=Xe(p,t),{fixedHeaders:oe,lastFixedColumn:ye,fixedColumnsInfos:Lt}=Ye(M),{clickRow:Ft}=Qe(X,U,t),Tt=m=>{var u;const v=(u=m.width)!=null?u:oe.value.length?100:null;if(v)return`width: ${v}px; min-width: ${v}px;`},ke=(m,v="th")=>{if(!oe.value.length)return;const u=Lt.value.find(E=>E.value===m);if(u)return`left: ${u.distance}px;z-index: ${v==="th"?3:1};position: sticky;`};return e.watch(N,(m,v)=>{Y.value&&m===!1&&v===!0&&(Vt(Y.value.page),_e())}),e.watch(p,()=>{R.value||K(1)},{deep:!0}),e.watch(O,m=>{R.value?Nt(m):K(1)}),e.watch([W,de,P,S,l],()=>{_e()},{deep:!0}),o({currentPageFirstIndex:pe,currentPageLastIndex:fe,clientItemsLength:G,maxPaginationNumber:Z,currentPaginationNumber:W,isLastPage:ee,isFirstPage:te,nextPage:ne,prevPage:ae,updatePage:K}),(m,v)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:ie,class:e.normalizeClass(["vue3-easy-data-table",[m.tableClassName]])},[e.createElementVNode("div",{ref_key:"tableBody",ref:Q,class:e.normalizeClass(["vue3-easy-data-table__main",{"fixed-header":e.unref(d),"fixed-height":e.unref(B),"show-shadow":ce.value,"table-fixed":e.unref(oe).length,hoverable:!m.noHover,"border-cell":m.borderCell}])},[e.createElementVNode("table",null,[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(M),(u,E)=>(e.openBlock(),e.createElementBlock("col",{key:E,style:e.normalizeStyle(Tt(u))},null,4))),128))]),e.unref(M).length&&!m.hideHeader?(e.openBlock(),e.createElementBlock("thead",{key:0,class:e.normalizeClass(["vue3-easy-data-table__header",[m.headerClassName]])},[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(M),(u,E)=>(e.openBlock(),e.createElementBlock("th",{key:E,class:e.normalizeClass([{sortable:u.sortable,none:u.sortable&&u.sortType==="none",desc:u.sortable&&u.sortType==="desc",asc:u.sortable&&u.sortType==="asc",shadow:u.value===e.unref(ye)},typeof m.headerItemClassName=="string"?m.headerItemClassName:m.headerItemClassName(u,E)]),style:e.normalizeStyle(ke(u.value)),onClick:e.withModifiers($=>u.sortable&&u.sortType?e.unref(St)(u.value,u.sortType):null,["stop"])},[u.text==="checkbox"?(e.openBlock(),e.createBlock(Ie,{key:e.unref(me),status:e.unref(me),onChange:e.unref(Et)},null,8,["status","onChange"])):(e.openBlock(),e.createElementBlock("span",ct,[e.unref(F)[`header-${u.value}`]?e.renderSlot(m.$slots,`header-${u.value}`,e.normalizeProps(e.mergeProps({key:0},u)),void 0,!0):(e.openBlock(),e.createElementBlock("span",dt,e.toDisplayString(u.text),1)),u.sortable?(e.openBlock(),e.createElementBlock("i",{key:u.sortType?u.sortType:"none",class:e.normalizeClass(["sortType-icon",{desc:u.sortType==="desc"}])},null,2)):e.createCommentVNode("",!0)]))],14,it))),128))])],2)):e.createCommentVNode("",!0),e.unref(p).length&&e.unref(ue).length?(e.openBlock(),e.createElementBlock("tbody",{key:1,class:e.normalizeClass(["vue3-easy-data-table__body",{"row-alternation":m.alternating}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ge),(u,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:E},[e.createElementVNode("tr",{class:e.normalizeClass([{"even-row":(E+1)%2===0},typeof m.bodyRowClassName=="string"?m.bodyRowClassName:m.bodyRowClassName(u,E)]),onClick:$=>e.unref(Ft)(u)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ue),($,be)=>(e.openBlock(),e.createElementBlock("td",{key:be,style:e.normalizeStyle(ke($,"td")),class:e.normalizeClass([{shadow:$===e.unref(ye),"can-expand":$==="expand"},typeof m.bodyItemClassName=="string"?m.bodyItemClassName:m.bodyItemClassName($,be)]),onClick:xe=>$==="expand"?e.unref(vt)(E,u,xe):null},[e.unref(F)[`item-${$}`]?e.renderSlot(m.$slots,`item-${$}`,e.normalizeProps(e.mergeProps({key:0},u)),void 0,!0):$==="expand"?(e.openBlock(),e.createElementBlock("i",{key:1,class:e.normalizeClass(["expand-icon",{expanding:e.unref(he).includes(E)}])},null,2)):$==="checkbox"?(e.openBlock(),e.createBlock(ve,{key:2,checked:u[$],onChange:xe=>e.unref($t)(u)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(e.unref(ot)($,u)),1)],64))],14,pt))),128))],10,ut),e.unref(se)&&e.unref(he).includes(E)?(e.openBlock(),e.createElementBlock("tr",{key:0,class:e.normalizeClass({"even-row":(E+1)%2===0})},[e.createElementVNode("td",{colspan:e.unref(M).length,class:"expand"},[u.expandLoading?(e.openBlock(),e.createBlock(Me,{key:0,class:"expand-loading"})):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"expand",e.normalizeProps(e.guardReactiveProps(u)),void 0,!0)],8,ft)],2)):e.createCommentVNode("",!0)],64))),128))],2)):e.createCommentVNode("",!0)]),e.unref(N)?(e.openBlock(),e.createElementBlock("div",mt,[gt,e.createElementVNode("div",ht,[e.unref(H)?e.renderSlot(m.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock(De,{key:1}))])])):e.createCommentVNode("",!0),!e.unref(ge).length&&!e.unref(N)?(e.openBlock(),e.createElementBlock("div",_t,e.toDisplayString(m.emptyMessage),1)):e.createCommentVNode("",!0)],2),m.hideFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",yt,[m.hideRowsPerPage?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",kt,[e.createTextVNode(e.toDisplayString(m.rowsPerPageMessage)+" ",1),e.createVNode(Ae,{modelValue:e.unref(O),"onUpdate:modelValue":v[0]||(v[0]=u=>e.isRef(O)?O.value=u:null),"rows-items":e.unref(Bt)},null,8,["modelValue","rows-items"])])),e.createElementVNode("div",bt,e.toDisplayString(`${e.unref(pe)}\u2013${e.unref(fe)}`)+" of "+e.toDisplayString(e.unref(G)),1),e.unref(L)?e.renderSlot(m.$slots,"pagination",e.normalizeProps(e.mergeProps({key:1},{isFirstPage:e.unref(te),isLastPage:e.unref(ee),currentPaginationNumber:e.unref(W),maxPaginationNumber:e.unref(Z),nextPage:e.unref(ne),prevPage:e.unref(ae)})),void 0,!0):(e.openBlock(),e.createBlock(Ke,{key:2,"is-first-page":e.unref(te),"is-last-page":e.unref(ee),onClickNextPage:e.unref(ne),onClickPrevPage:e.unref(ae)},e.createSlots({_:2},[m.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(Je,{"current-pagination-number":e.unref(W),"max-pagination-number":e.unref(Z),onUpdatePage:e.unref(K)},null,8,["current-pagination-number","max-pagination-number","onUpdatePage"])])}:void 0]),1032,["is-first-page","is-last-page","onClickNextPage","onClickPrevPage"]))]))],2))}});var re=b(xt,[["__scopeId","data-v-efe62624"]]);return typeof window!="undefined"&&window.Vue&&window.Vue.createApp({}).component("Vue3EasyDataTable",re),re});

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

"private": false,
"version": "1.4.11",
"version": "1.4.12",
"types": "./types/main.d.ts",

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

@@ -45,4 +45,9 @@ export type SortType = 'asc' | 'desc'

export type UpdateSortArgument = {
sortType: SortType | null
sortBy: string
}
export type HeaderItemClassNameFunction = (header: Header, index: number) => string
export type BodyRowClassNameFunction = (item: Item, index: number) => string
export type BodyItemClassNameFunction = (column: string, index: number) => string

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