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.3.9 to 1.3.10

6

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

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

var DataTable_vue_vue_type_style_index_1_lang = "";
const _withScopeId = (n) => (pushScopeId("data-v-22ac962b"), n = n(), popScopeId(), n);
const _withScopeId = (n) => (pushScopeId("data-v-19f57423"), n = n(), popScopeId(), n);
const _hoisted_1 = ["onClick"];

@@ -590,3 +590,3 @@ const _hoisted_2 = {

useCssVars((_ctx) => ({
"d1affc10": unref(tableHeightPx)
"942c975c": unref(tableHeightPx)
}));

@@ -1198,3 +1198,3 @@ const tableHeightPx = computed(() => props.tableHeight ? `${props.tableHeight}px` : null);

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

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

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

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

"private": false,
"version": "1.3.9",
"version": "1.3.10",
"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