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

vue3-easy-data-table

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.2.6 to 1.2.7

64

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

@@ -568,22 +568,22 @@ var __defProp = Object.defineProperty;

useCssVars((_ctx) => ({
"6e3117a2": unref(tableBorderColor),
"42f6b6b0": unref(minHeightPx),
"2ac6f064": unref(tableHeightPx),
"1b05fc8e": unref(loadingWrapperSizePx),
"91c69fa0": unref(rowHeightPx),
"0dba1f91": unref(fontSizePx),
"2f5f1dd3": unref(rowFontColor),
"28332d14": unref(rowBackgroundColor),
"5cebb456": unref(rowBorderColor),
"65d46924": unref(headerFontColor),
"7a4c0b22": __props.headerBackgroundColor,
"784f3f53": unref(sortTypeIconSizePx),
"5a52bad6": unref(sortTypeAscIconMarginTopPx),
"cdf59098": unref(sortTypeDescIconMarginTopPx),
"388cc1cc": unref(rowHoverBackgroundColor),
"35e5e74e": unref(rowHoverFontColor),
"2eff878d": unref(evenRowFontColor),
"65303964": unref(evenRowBackgroundColor),
"3e69e9a1": unref(footerBackgroundColor),
"724d8820": unref(footerFontColor)
"6c9f4295": unref(tableBorderColor),
"7e6e2dd5": unref(minHeightPx),
"7672e251": unref(tableHeightPx),
"67267b2c": unref(loadingWrapperSizePx),
"5706395d": unref(rowHeightPx),
"4dd78678": unref(fontSizePx),
"e6b28b74": unref(rowFontColor),
"43c26747": unref(rowBackgroundColor),
"f283ffee": unref(rowBorderColor),
"44e613ca": unref(headerFontColor),
"3940a148": __props.headerBackgroundColor,
"d8430cf4": unref(sortTypeIconSizePx),
"fcabdbee": unref(sortTypeAscIconMarginTopPx),
"5c98c6e1": unref(sortTypeDescIconMarginTopPx),
"0cb46672": unref(rowHoverBackgroundColor),
"97378074": unref(rowHoverFontColor),
"2d6db280": unref(evenRowFontColor),
"84ce67fe": unref(evenRowBackgroundColor),
"5eef9e8e": unref(footerBackgroundColor),
"fa769a66": unref(footerFontColor)
}));

@@ -679,2 +679,14 @@ const {

const headerColumns = computed(() => headersForRender.value.map((header) => header.value));
const generateColumnContent = (column, item) => {
let content = "";
if (column.includes(".")) {
const propertyArr = column.split(".");
propertyArr.forEach((property, index) => {
content = index === 0 ? item[property] : content[property];
});
} else {
content = item[column];
}
return Array.isArray(content) ? content.join(",") : content;
};
const selectItemsComputed = computed({

@@ -750,2 +762,6 @@ get: () => {

const currentPaginationNumber = ref(isServerSideMode.value ? props.serverOptions.page : 1);
const { items } = toRefs(props);
watch(items, () => {
currentPaginationNumber.value = 1;
}, { deep: true });
const rowsPerPageReactive = ref(isServerSideMode.value ? props.serverOptions.rowsPerPage : props.rowsPerPage);

@@ -971,3 +987,3 @@ watch(rowsPerPageReactive, (value) => {

unref(ifHasBodySlot) ? renderSlot(_ctx.$slots, "body", { key: 1 }, void 0, true) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
__props.items.length && unref(headerColumns).length ? (openBlock(), createElementBlock("tbody", {
unref(items).length && unref(headerColumns).length ? (openBlock(), createElementBlock("tbody", {
key: 0,

@@ -988,3 +1004,3 @@ class: normalizeClass({ "row-alternation": __props.alternating, "hover-to-change-color": __props.hoverToChangeColor })

}, null, 8, ["checked", "onChange"])) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
createTextVNode(toDisplayString(Array.isArray(item[column]) ? item[column].join(",") : item[column]), 1)
createTextVNode(toDisplayString(generateColumnContent(column, item)), 1)
], 64))

@@ -1000,3 +1016,3 @@ ]);

key: 0,
class: normalizeClass(["loading-wrapper", { "initial-loading": !__props.items.length && unref(loading) }])
class: normalizeClass(["loading-wrapper", { "initial-loading": !unref(items).length && unref(loading) }])
}, [

@@ -1052,3 +1068,3 @@ createElementVNode("div", {

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

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

(function(e,m){typeof exports=="object"&&typeof module!="undefined"?module.exports=m(require("vue")):typeof define=="function"&&define.amd?define(["vue"],m):(e=typeof globalThis!="undefined"?globalThis:e||self,e["vue3-easy-data-table"]=m(e.Vue))})(this,function(e){"use strict";var ct=Object.defineProperty,it=Object.defineProperties;var dt=Object.getOwnPropertyDescriptors;var se=Object.getOwnPropertySymbols;var pt=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable;var ce=(e,m,f)=>m in e?ct(e,m,{enumerable:!0,configurable:!0,writable:!0,value:f}):e[m]=f,x=(e,m)=>{for(var f in m||(m={}))pt.call(m,f)&&ce(e,f,m[f]);if(se)for(var f of se(m))ut.call(m,f)&&ce(e,f,m[f]);return e},z=(e,m)=>it(e,dt(m));var m="",f=(r,_)=>{const a=r.__vccOpts||r;for(const[n,p]of _)a[n]=p;return a};const ie=r=>(e.pushScopeId("data-v-566775ba"),r=r(),e.popScopeId(),r),de=["onClick"],pe=["checked"],ue=ie(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var fe=f(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(r,{emit:_}){const a=r;e.useCssVars(P=>({"7f84b28f":e.unref(k)}));const n=e.computed(()=>a.status==="allSelected"),p=()=>{_("change",!n.value)},k=e.inject("themeColor");return(P,F)=>(e.openBlock(),e.createElementBlock("div",{class:"multi-select__checkbox",onClick:e.withModifiers(p,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(n),class:e.normalizeClass(r.status)},null,10,pe),ue],8,de))}}),[["__scopeId","data-v-566775ba"]]),gt="";const ge=r=>(e.pushScopeId("data-v-39f156fd"),r=r(),e.popScopeId(),r),me=["checked"],he=ge(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var _e=f(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(r,{emit:_}){e.useCssVars(n=>({"20cfc5a0":e.unref(a)}));const a=e.inject("themeColor");return(n,p)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:p[0]||(p[0]=e.withModifiers(k=>_("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:r.checked},null,8,me),he]))}}),[["__scopeId","data-v-39f156fd"]]),ht="";const ye=r=>(e.pushScopeId("data-v-0ed08e20"),r=r(),e.popScopeId(),r),ke={class:"easy-data-table__rows-selector"},be={class:"rows-input"},xe=ye(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),Ce=["onClick"];var Se=f(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(r,{emit:_}){const a=r;e.useCssVars(g=>({"83c11052":e.unref(u),"6b60f418":e.unref(l),"346ac97c":e.unref(i)}));const n=e.ref(!1),p=e.ref(!1),k=e.inject("dataTable");e.watch(n,g=>{if(g&&k){const C=window.innerHeight,y=k.value.getBoundingClientRect().height,$=k.value.getBoundingClientRect().top;C-(y+$)<=100?p.value=!0:p.value=!1}});const P=e.computed({get:()=>a.modelValue,set:g=>{_("update:modelValue",g)}}),F=g=>{P.value=g,n.value=!1},O=(g,C)=>{let y=g.parentNode;for(;y!=null;){if(y.classList&&y.classList.contains(C))return!0;y=y.parentNode}return!1},T=g=>{O(g.target,"easy-data-table__rows-selector")||(n.value=!1)};e.onMounted(()=>{document.addEventListener("click",T)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",T)});const i=e.inject("themeColor"),l=e.inject("footerBackgroundColor"),u=e.inject("footerFontColor");return(g,C)=>(e.openBlock(),e.createElementBlock("div",ke,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:C[0]||(C[0]=y=>n.value=!n.value)},[e.createElementVNode("div",be,e.toDisplayString(e.unref(P)),1),xe]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:n.value,inside:p.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.rowsItems,y=>(e.openBlock(),e.createElementBlock("li",{key:y,class:e.normalizeClass({selected:y===e.unref(P)}),onClick:$=>F(y)},e.toDisplayString(y),11,Ce))),128))],2)]))}}),[["__scopeId","data-v-0ed08e20"]]),yt="";const H=r=>(e.pushScopeId("data-v-969989cc"),r=r(),e.popScopeId(),r),Be={class:"lds-ring"},Pe=[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 Ne=f(e.defineComponent({setup(r){e.useCssVars(n=>({"284c10f4":e.unref(a),"90c4d0a4":e.unref(_)}));const _=e.inject("themeColor"),a=e.inject("loadingEntitySizePx");return(n,p)=>(e.openBlock(),e.createElementBlock("div",Be,Pe))}}),[["__scopeId","data-v-969989cc"]]),Bt="";const we={class:"buttons-pagination"},$e=["onClick"];var Ie=f(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(r,{emit:_}){const a=r;e.useCssVars(i=>({aa5730a0:e.unref(F),"24829312":e.unref(O),"98a0e762":e.unref(T)}));const n=7,p=i=>{i.type==="button"&&!i.active&&_("updatePage",i.page)},k=e.computed(()=>{const i=[];if(a.maxPaginationNumber<=n)for(let l=1;l<=a.maxPaginationNumber;l+=1)i.push({type:"button",page:l,active:l===a.currentPaginationNumber});else if([1,2,a.maxPaginationNumber,a.maxPaginationNumber-1].includes(a.currentPaginationNumber))for(let l=1;l<=n;l+=1)if(l<=3)i.push({type:"button",page:l,active:l===a.currentPaginationNumber});else if(l===4)i.push({type:"omission"});else{const u=a.maxPaginationNumber-(n-l);i.push({type:"button",page:u,active:u===a.currentPaginationNumber})}else if([3,4].includes(a.currentPaginationNumber))for(let l=1;l<=n;l+=1)l<=5?i.push({type:"button",page:l,active:l===a.currentPaginationNumber}):l===6?i.push({type:"omission"}):i.push({type:"button",page:a.maxPaginationNumber,active:a.maxPaginationNumber===a.currentPaginationNumber});else if([a.maxPaginationNumber-2,a.maxPaginationNumber-3].includes(a.currentPaginationNumber))for(let l=1;l<=n;l+=1)if(l===1)i.push({type:"button",page:1,active:a.currentPaginationNumber===1});else if(l===2)i.push({type:"omission"});else{const u=a.maxPaginationNumber-(n-l);i.push({type:"button",page:u,active:u===a.currentPaginationNumber})}else for(let l=1;l<=n;l+=1)if(l===1)i.push({type:"button",page:1,active:a.currentPaginationNumber===1});else if(l===2||l===6)i.push({type:"omission"});else if(l===7)i.push({type:"button",page:a.maxPaginationNumber,active:a.maxPaginationNumber===a.currentPaginationNumber});else{const u=4-l,g=a.currentPaginationNumber-u;i.push({type:"button",page:g,active:g===a.currentPaginationNumber})}return i}),P=e.inject("rowHeight"),F=e.computed(()=>`${P*.6}px`),O=e.inject("rowBorderColor"),T=e.inject("themeColor");return(i,l)=>(e.openBlock(),e.createElementBlock("div",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(k),(u,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["item",{button:u.type==="button",active:u.type==="button"&&u.active,omission:u.type==="omission"}]),onClick:C=>p(u)},e.toDisplayString(u.type==="button"?u.page:"..."),11,$e))),128))]))}}),[["__scopeId","data-v-4f534e20"]]),Nt="";const K=r=>(e.pushScopeId("data-v-c9da5286"),r=r(),e.popScopeId(),r),Ee=[K(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],Ve=[K(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var Fe=f(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(r,{emit:_}){const a=e.useSlots();return(n,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":r.isFirstPage}]),onClick:p[0]||(p[0]=k=>_("clickPrevPage"))},Ee,2),e.unref(a).buttonsPagination?e.renderSlot(n.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":r.isLastPage}]),onClick:p[1]||(p[1]=k=>_("clickNextPage"))},Ve,2)],64))}}),[["__scopeId","data-v-c9da5286"]]),Et="";const Te={key:0},ze=["onClick"],Oe={key:1,class:"header-text__wrapper"},He={class:"header-text"},Le=["onClick"],Re={class:"loading-entity"},Ae={key:1,class:"data-table__message"},De={key:0,class:"data-table__footer"},Me={class:"footer__rows-per-page"},je=e.createTextVNode(" rows per page: "),qe={class:"footer__items-index"};var Je=f(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},rowBorderColor:{type:String,default:"#e0e0e0"},tableBorderColor:{type:String,default:"#e0e0e0"},rowBackgroundColor:{type:String,default:"#fff"},footerBackgroundColor:{type:String,default:"#fff"},rowFontColor:{type:String,default:"#212121"},footerFontColor:{type:String,default:"#212121"},emptyMessage:{type:String,default:"No Available Data"},fixedHeader:{type:Boolean,default:!0},headerFontColor:{type:String,default:"#373737"},headerBackgroundColor:{type:String,default:"#fff"},tableFontSize:{type:Number,default:12},evenRowBackgroundColor:{type:String,default:"#fafafa"},evenRowFontColor:{type:String,default:"#212121"},headers:{type:Array,required:!0},hoverToChangeColor:{type:Boolean,default:!0},items:{type:Array,required:!0},tableHeight:{type:Number,default:()=>null},itemsSelected:{type:Array,default:null},searchField:{type:String,default:""},searchValue:{type:String,default:""},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowHoverBackgroundColor:{type:String,default:"#eee"},rowHoverFontColor:{type:String,default:"#212121"},loading:{type:Boolean,deault:!1},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},themeColor:{type:String,default:"#42b883"},dense:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},showFooter:{type:Boolean,default:!0},filterOptions:{type:Array,default:null}},emits:["update:itemsSelected","update:serverOptions","clickRow"],setup(r,{expose:_,emit:a}){const n=r;e.useCssVars(o=>({"6e3117a2":e.unref(k),"42f6b6b0":e.unref(Ge),"2ac6f064":e.unref(Ue),"1b05fc8e":e.unref(Ze),"91c69fa0":e.unref(We),"0dba1f91":e.unref(y),"2f5f1dd3":e.unref(F),"28332d14":e.unref(l),"5cebb456":e.unref(p),"65d46924":e.unref(P),"7a4c0b22":r.headerBackgroundColor,"784f3f53":e.unref(Ke),"5a52bad6":e.unref(Qe),cdf59098:e.unref(Xe),"388cc1cc":e.unref(O),"35e5e74e":e.unref(T),"2eff878d":e.unref(g),"65303964":e.unref(u),"3e69e9a1":e.unref(i),"724d8820":e.unref(C)}));const{rowBorderColor:p,tableBorderColor:k,headerFontColor:P,rowFontColor:F,rowHoverBackgroundColor:O,rowHoverFontColor:T,footerBackgroundColor:i,rowBackgroundColor:l,evenRowBackgroundColor:u,evenRowFontColor:g,footerFontColor:C}=e.toRefs(n),y=e.computed(()=>`${n.tableFontSize}px`),$=e.computed(()=>n.tableFontSize*(n.dense?2:3)),We=e.computed(()=>`${$.value}px`),Ue=e.computed(()=>n.tableHeight?`${n.tableHeight}px`:null),Ge=e.computed(()=>`${$.value*5}px`),Q=e.computed(()=>Math.round(n.tableFontSize/2.5)),Ke=e.computed(()=>`${Q.value}px`),X=e.computed(()=>Math.round(Q.value)),Qe=e.computed(()=>`-${X.value}px`),Xe=e.computed(()=>`${X.value}px`),Ye=e.computed(()=>`${n.tableFontSize*5}px`),Ze=e.computed(()=>n.tableHeight?`${n.tableHeight-$.value}px`:`${n.tableFontSize*5*2}px`);e.provide("themeColor",n.themeColor),e.provide("loadingEntitySizePx",Ye.value),e.provide("rowHeight",$.value),e.provide("rowBorderColor",p.value),e.provide("footerBackgroundColor",i.value),e.provide("footerFontColor",C.value);const L=e.useSlots(),ve=e.computed(()=>L.body),et=e.computed(()=>L.pagination),tt=e.computed(()=>L.loading),Y=e.ref();e.provide("dataTable",Y);const d=e.computed({get:()=>{if(n.serverOptions){const{page:o,rowsPerPage:c,sortBy:t,sortType:s}=n.serverOptions;return{page:o,rowsPerPage:c,sortBy:t!=null?t:null,sortType:s!=null?s:null}}return null},set:o=>{a("update:serverOptions",o)}}),q=e.computed(()=>n.itemsSelected!==null),w=e.computed(()=>d.value!==null),ot=()=>n.sortBy!==""?{sortBy:n.sortBy,sortDesc:n.sortType==="desc"}:null,I=e.ref(ot()),J=e.computed(()=>{const o=n.headers.map(s=>{const b=s;return s.sortable&&(b.sortType="none"),d.value&&s.value===d.value.sortBy&&d.value.sortType&&(b.sortType=d.value.sortType),!w.value&&I.value&&s.value===I.value.sortBy&&(b.sortType=I.value.sortDesc?"desc":"asc"),b}),c=n.showIndex?[{text:"#",value:"index"},...o]:o;return q.value?[{text:"checkbox",value:"checkbox"},...c]:c}),Z=e.computed(()=>J.value.map(o=>o.value)),S=e.computed({get:()=>{var o;return(o=n.itemsSelected)!=null?o:[]},set:o=>{a("update:itemsSelected",o)}}),v=e.computed(()=>{if(!w.value&&n.searchValue!==""){const o=new RegExp(n.searchValue,"i");return n.items.filter(c=>o.test(n.searchField!==""?c[n.searchField]:Object.values(c).join(" ")))}return n.items}),E=e.computed(()=>{let o=[...v.value];return n.filterOptions?(n.filterOptions.forEach(c=>{o=o.filter(t=>{const{field:s,comparison:b,criteria:B}=c;switch(b){case"=":return t[s]===B;case"!=":return t[s]!==B;case">":return t[s]>B;case"<":return t[s]<B;case"<=":return t[s]<=B;case">=":return t[s]>=B;case"between":return t[s]>=Math.min(...B)&&t[s]<=Math.max(...B);default:return t[s]===B}})}),o):v.value}),R=e.computed(()=>S.value.length===0||S.value.every(c=>E.value.findIndex(t=>JSON.stringify(c)===JSON.stringify(t))===-1)?"noneSelected":S.value.length===E.value.length&&S.value.every(t=>E.value.findIndex(s=>JSON.stringify(t)===JSON.stringify(s))!==-1)?"allSelected":"partSelected"),h=e.ref(w.value?n.serverOptions.page:1),N=e.ref(w.value?n.serverOptions.rowsPerPage:n.rowsPerPage);e.watch(N,o=>{d.value&&(d.value=z(x({},d.value),{page:1,rowsPerPage:o})),h.value=1});const nt=(o,c)=>{let t=null;c==="none"?t="asc":c==="asc"?t="desc":t=null,d.value?d.value=z(x({},d.value),{sortBy:t!==null?o:null,sortType:t}):t===null?I.value=null:I.value={sortBy:o,sortDesc:t==="desc"}},ee=e.computed(()=>{if(w.value)return n.items;if(I.value===null)return E.value;const{sortBy:o,sortDesc:c}=I.value;return[...E.value].sort((s,b)=>s[o]<b[o]?c?1:-1:s[o]>b[o]?c?-1:1:0)}),W=e.computed(()=>w.value?n.serverItemsLength:E.value.length),te=e.computed(()=>w.value?h.value*N.value:Math.min(E.value.length,h.value*N.value)),oe=e.computed(()=>(h.value-1)*N.value+1),A=e.computed(()=>Math.ceil(W.value/N.value)),D=e.computed(()=>h.value===A.value),M=e.computed(()=>h.value===1),{loading:V}=e.toRefs(n),U=()=>{if(!D.value&&!V.value)if(d.value){const o=h.value+1;d.value=z(x({},d.value),{page:o})}else h.value+=1},G=()=>{if(!M.value&&!V.value)if(d.value){const o=h.value-1;d.value=z(x({},d.value),{page:o})}else h.value-=1},ne=o=>{V.value||(d.value?d.value=z(x({},d.value),{page:o}):h.value=o)};e.watch(V,(o,c)=>{d.value&&o===!1&&c===!0&&(h.value=d.value.page)});const re=e.computed(()=>w.value?n.items:ee.value.slice(oe.value-1,te.value)),ae=e.computed(()=>N.value*(h.value-1)+1),rt=e.computed(()=>N.value*h.value),j=e.computed(()=>n.showIndex?re.value.map((o,c)=>x({index:ae.value+c},o)):re.value),le=e.computed(()=>q.value?R.value==="allSelected"?j.value.map(o=>x({checkbox:!0},o)):R.value==="noneSelected"?j.value.map(o=>x({checkbox:!1},o)):j.value.map(o=>{const c=S.value.findIndex(t=>{const s=x({},o);return delete s.index,JSON.stringify(t)===JSON.stringify(s)})!==-1;return x({checkbox:c},o)}):j.value),at=o=>{S.value=o?ee.value:[]},lt=o=>{const c=o.checkbox;if(delete o.checkbox,delete o.index,c)S.value=S.value.filter(t=>JSON.stringify(t)!==JSON.stringify(o));else{const t=S.value;t.unshift(o),S.value=t}},st=o=>{const c=x({},o);if(q.value){const{checkbox:t}=o;delete c.checkbox,c.isSelected=t}if(n.showIndex){const{index:t}=o;delete c.index,c.indexInCurrentPage=t}a("clickRow",c)};return _({clientItemsLength:W,currentPageFirstIndex:ae,currentPageLastIndex:rt,maxPaginationNumber:A,currentPaginationNumber:h,isLastPage:D,isFirstPage:M,nextPage:U,prevPage:G,updatePage:ne}),(o,c)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:Y,class:"vue3-easy-data-table"},[e.createElementVNode("div",{class:e.normalizeClass(["data-table__body",{"fixed-header":r.fixedHeader,"fixed-height":r.tableHeight}])},[e.createElementVNode("table",null,[e.unref(J).length?(e.openBlock(),e.createElementBlock("thead",Te,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(J),(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"}),onClick:b=>t.sortable&&t.sortType?nt(t.value,t.sortType):null},[t.text==="checkbox"?(e.openBlock(),e.createBlock(fe,{key:e.unref(R),status:e.unref(R),onChange:at},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",Oe,[e.createElementVNode("span",He,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)]))],10,ze))),128))])])):e.createCommentVNode("",!0),e.unref(ve)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[r.items.length&&e.unref(Z).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":r.alternating,"hover-to-change-color":r.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(le),t=>(e.openBlock(),e.createElementBlock("tr",{key:JSON.stringify(t),onClick:s=>st(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Z),(s,b)=>(e.openBlock(),e.createElementBlock("td",{key:b},[e.unref(L)[s]?e.renderSlot(o.$slots,s,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):s==="checkbox"?(e.openBlock(),e.createBlock(_e,{key:1,checked:t[s],onChange:B=>lt(t)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(Array.isArray(t[s])?t[s].join(","):t[s]),1)],64))]))),128))],8,Le))),128))],2)):e.createCommentVNode("",!0)],64))]),e.unref(V)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-wrapper",{"initial-loading":!r.items.length&&e.unref(V)}])},[e.createElementVNode("div",{class:e.normalizeClass(["loading-mask",{"no-footer":!r.showFooter}])},null,2),e.createElementVNode("div",Re,[e.unref(tt)?e.renderSlot(o.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock(Ne,{key:1}))])],2)):e.createCommentVNode("",!0),!e.unref(le).length&&!e.unref(V)?(e.openBlock(),e.createElementBlock("div",Ae,e.toDisplayString(r.emptyMessage),1)):e.createCommentVNode("",!0)],2),r.showFooter?(e.openBlock(),e.createElementBlock("div",De,[e.createElementVNode("div",Me,[je,e.createVNode(Se,{modelValue:N.value,"onUpdate:modelValue":c[0]||(c[0]=t=>N.value=t),"rows-items":r.rowsItems},null,8,["modelValue","rows-items"])]),e.createElementVNode("div",qe,e.toDisplayString(`${e.unref(oe)}-${e.unref(te)}`)+" of "+e.toDisplayString(e.unref(W)),1),e.unref(et)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:0},{isFirstPage:e.unref(M),isLastPage:e.unref(D),currentPaginationNumber:h.value,maxPaginationNumber:e.unref(A),nextPage:U,prevPage:G})),void 0,!0):(e.openBlock(),e.createBlock(Fe,{key:1,"is-first-page":e.unref(M),"is-last-page":e.unref(D),onClickNextPage:U,onClickPrevPage:G},e.createSlots({_:2},[r.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(Ie,{"current-pagination-number":h.value,"max-pagination-number":e.unref(A),onUpdatePage:ne},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))])):e.createCommentVNode("",!0)],512))}}),[["__scopeId","data-v-ad03fd10"]]);return Je});
(function(e,_){typeof exports=="object"&&typeof module!="undefined"?module.exports=_(require("vue")):typeof define=="function"&&define.amd?define(["vue"],_):(e=typeof globalThis!="undefined"?globalThis:e||self,e["vue3-easy-data-table"]=_(e.Vue))})(this,function(e){"use strict";var dt=Object.defineProperty,pt=Object.defineProperties;var ut=Object.getOwnPropertyDescriptors;var ce=Object.getOwnPropertySymbols;var ft=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable;var ie=(e,_,f)=>_ in e?dt(e,_,{enumerable:!0,configurable:!0,writable:!0,value:f}):e[_]=f,C=(e,_)=>{for(var f in _||(_={}))ft.call(_,f)&&ie(e,f,_[f]);if(ce)for(var f of ce(_))gt.call(_,f)&&ie(e,f,_[f]);return e},z=(e,_)=>pt(e,ut(_));var _="",f=(r,h)=>{const a=r.__vccOpts||r;for(const[n,p]of h)a[n]=p;return a};const de=r=>(e.pushScopeId("data-v-566775ba"),r=r(),e.popScopeId(),r),pe=["onClick"],ue=["checked"],fe=de(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var ge=f(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(r,{emit:h}){const a=r;e.useCssVars(P=>({"7f84b28f":e.unref(b)}));const n=e.computed(()=>a.status==="allSelected"),p=()=>{h("change",!n.value)},b=e.inject("themeColor");return(P,F)=>(e.openBlock(),e.createElementBlock("div",{class:"multi-select__checkbox",onClick:e.withModifiers(p,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(n),class:e.normalizeClass(r.status)},null,10,ue),fe],8,pe))}}),[["__scopeId","data-v-566775ba"]]),_t="";const me=r=>(e.pushScopeId("data-v-39f156fd"),r=r(),e.popScopeId(),r),_e=["checked"],he=me(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var ye=f(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(r,{emit:h}){e.useCssVars(n=>({"20cfc5a0":e.unref(a)}));const a=e.inject("themeColor");return(n,p)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:p[0]||(p[0]=e.withModifiers(b=>h("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:r.checked},null,8,_e),he]))}}),[["__scopeId","data-v-39f156fd"]]),yt="";const ke=r=>(e.pushScopeId("data-v-0ed08e20"),r=r(),e.popScopeId(),r),be={class:"easy-data-table__rows-selector"},xe={class:"rows-input"},Ce=ke(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),Se=["onClick"];var Be=f(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(r,{emit:h}){const a=r;e.useCssVars(g=>({"83c11052":e.unref(u),"6b60f418":e.unref(l),"346ac97c":e.unref(i)}));const n=e.ref(!1),p=e.ref(!1),b=e.inject("dataTable");e.watch(n,g=>{if(g&&b){const S=window.innerHeight,y=b.value.getBoundingClientRect().height,$=b.value.getBoundingClientRect().top;S-(y+$)<=100?p.value=!0:p.value=!1}});const P=e.computed({get:()=>a.modelValue,set:g=>{h("update:modelValue",g)}}),F=g=>{P.value=g,n.value=!1},O=(g,S)=>{let y=g.parentNode;for(;y!=null;){if(y.classList&&y.classList.contains(S))return!0;y=y.parentNode}return!1},T=g=>{O(g.target,"easy-data-table__rows-selector")||(n.value=!1)};e.onMounted(()=>{document.addEventListener("click",T)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",T)});const i=e.inject("themeColor"),l=e.inject("footerBackgroundColor"),u=e.inject("footerFontColor");return(g,S)=>(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:S[0]||(S[0]=y=>n.value=!n.value)},[e.createElementVNode("div",xe,e.toDisplayString(e.unref(P)),1),Ce]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:n.value,inside:p.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.rowsItems,y=>(e.openBlock(),e.createElementBlock("li",{key:y,class:e.normalizeClass({selected:y===e.unref(P)}),onClick:$=>F(y)},e.toDisplayString(y),11,Se))),128))],2)]))}}),[["__scopeId","data-v-0ed08e20"]]),bt="";const H=r=>(e.pushScopeId("data-v-969989cc"),r=r(),e.popScopeId(),r),Pe={class:"lds-ring"},Ne=[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 we=f(e.defineComponent({setup(r){e.useCssVars(n=>({"284c10f4":e.unref(a),"90c4d0a4":e.unref(h)}));const h=e.inject("themeColor"),a=e.inject("loadingEntitySizePx");return(n,p)=>(e.openBlock(),e.createElementBlock("div",Pe,Ne))}}),[["__scopeId","data-v-969989cc"]]),Nt="";const $e={class:"buttons-pagination"},Ie=["onClick"];var Ee=f(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(r,{emit:h}){const a=r;e.useCssVars(i=>({aa5730a0:e.unref(F),"24829312":e.unref(O),"98a0e762":e.unref(T)}));const n=7,p=i=>{i.type==="button"&&!i.active&&h("updatePage",i.page)},b=e.computed(()=>{const i=[];if(a.maxPaginationNumber<=n)for(let l=1;l<=a.maxPaginationNumber;l+=1)i.push({type:"button",page:l,active:l===a.currentPaginationNumber});else if([1,2,a.maxPaginationNumber,a.maxPaginationNumber-1].includes(a.currentPaginationNumber))for(let l=1;l<=n;l+=1)if(l<=3)i.push({type:"button",page:l,active:l===a.currentPaginationNumber});else if(l===4)i.push({type:"omission"});else{const u=a.maxPaginationNumber-(n-l);i.push({type:"button",page:u,active:u===a.currentPaginationNumber})}else if([3,4].includes(a.currentPaginationNumber))for(let l=1;l<=n;l+=1)l<=5?i.push({type:"button",page:l,active:l===a.currentPaginationNumber}):l===6?i.push({type:"omission"}):i.push({type:"button",page:a.maxPaginationNumber,active:a.maxPaginationNumber===a.currentPaginationNumber});else if([a.maxPaginationNumber-2,a.maxPaginationNumber-3].includes(a.currentPaginationNumber))for(let l=1;l<=n;l+=1)if(l===1)i.push({type:"button",page:1,active:a.currentPaginationNumber===1});else if(l===2)i.push({type:"omission"});else{const u=a.maxPaginationNumber-(n-l);i.push({type:"button",page:u,active:u===a.currentPaginationNumber})}else for(let l=1;l<=n;l+=1)if(l===1)i.push({type:"button",page:1,active:a.currentPaginationNumber===1});else if(l===2||l===6)i.push({type:"omission"});else if(l===7)i.push({type:"button",page:a.maxPaginationNumber,active:a.maxPaginationNumber===a.currentPaginationNumber});else{const u=4-l,g=a.currentPaginationNumber-u;i.push({type:"button",page:g,active:g===a.currentPaginationNumber})}return i}),P=e.inject("rowHeight"),F=e.computed(()=>`${P*.6}px`),O=e.inject("rowBorderColor"),T=e.inject("themeColor");return(i,l)=>(e.openBlock(),e.createElementBlock("div",$e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(u,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["item",{button:u.type==="button",active:u.type==="button"&&u.active,omission:u.type==="omission"}]),onClick:S=>p(u)},e.toDisplayString(u.type==="button"?u.page:"..."),11,Ie))),128))]))}}),[["__scopeId","data-v-4f534e20"]]),$t="";const Q=r=>(e.pushScopeId("data-v-c9da5286"),r=r(),e.popScopeId(),r),Ve=[Q(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],Fe=[Q(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var Te=f(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(r,{emit:h}){const a=e.useSlots();return(n,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":r.isFirstPage}]),onClick:p[0]||(p[0]=b=>h("clickPrevPage"))},Ve,2),e.unref(a).buttonsPagination?e.renderSlot(n.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":r.isLastPage}]),onClick:p[1]||(p[1]=b=>h("clickNextPage"))},Fe,2)],64))}}),[["__scopeId","data-v-c9da5286"]]),Ft="";const ze={key:0},Oe=["onClick"],He={key:1,class:"header-text__wrapper"},Le={class:"header-text"},Re=["onClick"],Ae={class:"loading-entity"},De={key:1,class:"data-table__message"},Me={key:0,class:"data-table__footer"},je={class:"footer__rows-per-page"},qe=e.createTextVNode(" rows per page: "),Je={class:"footer__items-index"};var We=f(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},rowBorderColor:{type:String,default:"#e0e0e0"},tableBorderColor:{type:String,default:"#e0e0e0"},rowBackgroundColor:{type:String,default:"#fff"},footerBackgroundColor:{type:String,default:"#fff"},rowFontColor:{type:String,default:"#212121"},footerFontColor:{type:String,default:"#212121"},emptyMessage:{type:String,default:"No Available Data"},fixedHeader:{type:Boolean,default:!0},headerFontColor:{type:String,default:"#373737"},headerBackgroundColor:{type:String,default:"#fff"},tableFontSize:{type:Number,default:12},evenRowBackgroundColor:{type:String,default:"#fafafa"},evenRowFontColor:{type:String,default:"#212121"},headers:{type:Array,required:!0},hoverToChangeColor:{type:Boolean,default:!0},items:{type:Array,required:!0},tableHeight:{type:Number,default:()=>null},itemsSelected:{type:Array,default:null},searchField:{type:String,default:""},searchValue:{type:String,default:""},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowHoverBackgroundColor:{type:String,default:"#eee"},rowHoverFontColor:{type:String,default:"#212121"},loading:{type:Boolean,deault:!1},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},themeColor:{type:String,default:"#42b883"},dense:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},showFooter:{type:Boolean,default:!0},filterOptions:{type:Array,default:null}},emits:["update:itemsSelected","update:serverOptions","clickRow"],setup(r,{expose:h,emit:a}){const n=r;e.useCssVars(o=>({"6c9f4295":e.unref(b),"7e6e2dd5":e.unref(Ke),"7672e251":e.unref(Ge),"67267b2c":e.unref(ve),"5706395d":e.unref(Ue),"4dd78678":e.unref(y),e6b28b74:e.unref(F),"43c26747":e.unref(l),f283ffee:e.unref(p),"44e613ca":e.unref(P),"3940a148":r.headerBackgroundColor,d8430cf4:e.unref(Qe),fcabdbee:e.unref(Xe),"5c98c6e1":e.unref(Ye),"0cb46672":e.unref(O),"97378074":e.unref(T),"2d6db280":e.unref(g),"84ce67fe":e.unref(u),"5eef9e8e":e.unref(i),fa769a66:e.unref(S)}));const{rowBorderColor:p,tableBorderColor:b,headerFontColor:P,rowFontColor:F,rowHoverBackgroundColor:O,rowHoverFontColor:T,footerBackgroundColor:i,rowBackgroundColor:l,evenRowBackgroundColor:u,evenRowFontColor:g,footerFontColor:S}=e.toRefs(n),y=e.computed(()=>`${n.tableFontSize}px`),$=e.computed(()=>n.tableFontSize*(n.dense?2:3)),Ue=e.computed(()=>`${$.value}px`),Ge=e.computed(()=>n.tableHeight?`${n.tableHeight}px`:null),Ke=e.computed(()=>`${$.value*5}px`),X=e.computed(()=>Math.round(n.tableFontSize/2.5)),Qe=e.computed(()=>`${X.value}px`),Y=e.computed(()=>Math.round(X.value)),Xe=e.computed(()=>`-${Y.value}px`),Ye=e.computed(()=>`${Y.value}px`),Ze=e.computed(()=>`${n.tableFontSize*5}px`),ve=e.computed(()=>n.tableHeight?`${n.tableHeight-$.value}px`:`${n.tableFontSize*5*2}px`);e.provide("themeColor",n.themeColor),e.provide("loadingEntitySizePx",Ze.value),e.provide("rowHeight",$.value),e.provide("rowBorderColor",p.value),e.provide("footerBackgroundColor",i.value),e.provide("footerFontColor",S.value);const L=e.useSlots(),et=e.computed(()=>L.body),tt=e.computed(()=>L.pagination),ot=e.computed(()=>L.loading),Z=e.ref();e.provide("dataTable",Z);const d=e.computed({get:()=>{if(n.serverOptions){const{page:o,rowsPerPage:s,sortBy:t,sortType:c}=n.serverOptions;return{page:o,rowsPerPage:s,sortBy:t!=null?t:null,sortType:c!=null?c:null}}return null},set:o=>{a("update:serverOptions",o)}}),q=e.computed(()=>n.itemsSelected!==null),w=e.computed(()=>d.value!==null),nt=()=>n.sortBy!==""?{sortBy:n.sortBy,sortDesc:n.sortType==="desc"}:null,I=e.ref(nt()),J=e.computed(()=>{const o=n.headers.map(c=>{const k=c;return c.sortable&&(k.sortType="none"),d.value&&c.value===d.value.sortBy&&d.value.sortType&&(k.sortType=d.value.sortType),!w.value&&I.value&&c.value===I.value.sortBy&&(k.sortType=I.value.sortDesc?"desc":"asc"),k}),s=n.showIndex?[{text:"#",value:"index"},...o]:o;return q.value?[{text:"checkbox",value:"checkbox"},...s]:s}),v=e.computed(()=>J.value.map(o=>o.value)),rt=(o,s)=>{let t="";return o.includes(".")?o.split(".").forEach((k,x)=>{t=x===0?s[k]:t[k]}):t=s[o],Array.isArray(t)?t.join(","):t},B=e.computed({get:()=>{var o;return(o=n.itemsSelected)!=null?o:[]},set:o=>{a("update:itemsSelected",o)}}),ee=e.computed(()=>{if(!w.value&&n.searchValue!==""){const o=new RegExp(n.searchValue,"i");return n.items.filter(s=>o.test(n.searchField!==""?s[n.searchField]:Object.values(s).join(" ")))}return n.items}),E=e.computed(()=>{let o=[...ee.value];return n.filterOptions?(n.filterOptions.forEach(s=>{o=o.filter(t=>{const{field:c,comparison:k,criteria:x}=s;switch(k){case"=":return t[c]===x;case"!=":return t[c]!==x;case">":return t[c]>x;case"<":return t[c]<x;case"<=":return t[c]<=x;case">=":return t[c]>=x;case"between":return t[c]>=Math.min(...x)&&t[c]<=Math.max(...x);default:return t[c]===x}})}),o):ee.value}),R=e.computed(()=>B.value.length===0||B.value.every(s=>E.value.findIndex(t=>JSON.stringify(s)===JSON.stringify(t))===-1)?"noneSelected":B.value.length===E.value.length&&B.value.every(t=>E.value.findIndex(c=>JSON.stringify(t)===JSON.stringify(c))!==-1)?"allSelected":"partSelected"),m=e.ref(w.value?n.serverOptions.page:1),{items:W}=e.toRefs(n);e.watch(W,()=>{m.value=1},{deep:!0});const N=e.ref(w.value?n.serverOptions.rowsPerPage:n.rowsPerPage);e.watch(N,o=>{d.value&&(d.value=z(C({},d.value),{page:1,rowsPerPage:o})),m.value=1});const at=(o,s)=>{let t=null;s==="none"?t="asc":s==="asc"?t="desc":t=null,d.value?d.value=z(C({},d.value),{sortBy:t!==null?o:null,sortType:t}):t===null?I.value=null:I.value={sortBy:o,sortDesc:t==="desc"}},te=e.computed(()=>{if(w.value)return n.items;if(I.value===null)return E.value;const{sortBy:o,sortDesc:s}=I.value;return[...E.value].sort((c,k)=>c[o]<k[o]?s?1:-1:c[o]>k[o]?s?-1:1:0)}),U=e.computed(()=>w.value?n.serverItemsLength:E.value.length),oe=e.computed(()=>w.value?m.value*N.value:Math.min(E.value.length,m.value*N.value)),ne=e.computed(()=>(m.value-1)*N.value+1),A=e.computed(()=>Math.ceil(U.value/N.value)),D=e.computed(()=>m.value===A.value),M=e.computed(()=>m.value===1),{loading:V}=e.toRefs(n),G=()=>{if(!D.value&&!V.value)if(d.value){const o=m.value+1;d.value=z(C({},d.value),{page:o})}else m.value+=1},K=()=>{if(!M.value&&!V.value)if(d.value){const o=m.value-1;d.value=z(C({},d.value),{page:o})}else m.value-=1},re=o=>{V.value||(d.value?d.value=z(C({},d.value),{page:o}):m.value=o)};e.watch(V,(o,s)=>{d.value&&o===!1&&s===!0&&(m.value=d.value.page)});const ae=e.computed(()=>w.value?n.items:te.value.slice(ne.value-1,oe.value)),le=e.computed(()=>N.value*(m.value-1)+1),lt=e.computed(()=>N.value*m.value),j=e.computed(()=>n.showIndex?ae.value.map((o,s)=>C({index:le.value+s},o)):ae.value),se=e.computed(()=>q.value?R.value==="allSelected"?j.value.map(o=>C({checkbox:!0},o)):R.value==="noneSelected"?j.value.map(o=>C({checkbox:!1},o)):j.value.map(o=>{const s=B.value.findIndex(t=>{const c=C({},o);return delete c.index,JSON.stringify(t)===JSON.stringify(c)})!==-1;return C({checkbox:s},o)}):j.value),st=o=>{B.value=o?te.value:[]},ct=o=>{const s=o.checkbox;if(delete o.checkbox,delete o.index,s)B.value=B.value.filter(t=>JSON.stringify(t)!==JSON.stringify(o));else{const t=B.value;t.unshift(o),B.value=t}},it=o=>{const s=C({},o);if(q.value){const{checkbox:t}=o;delete s.checkbox,s.isSelected=t}if(n.showIndex){const{index:t}=o;delete s.index,s.indexInCurrentPage=t}a("clickRow",s)};return h({clientItemsLength:U,currentPageFirstIndex:le,currentPageLastIndex:lt,maxPaginationNumber:A,currentPaginationNumber:m,isLastPage:D,isFirstPage:M,nextPage:G,prevPage:K,updatePage:re}),(o,s)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:Z,class:"vue3-easy-data-table"},[e.createElementVNode("div",{class:e.normalizeClass(["data-table__body",{"fixed-header":r.fixedHeader,"fixed-height":r.tableHeight}])},[e.createElementVNode("table",null,[e.unref(J).length?(e.openBlock(),e.createElementBlock("thead",ze,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(J),(t,c)=>(e.openBlock(),e.createElementBlock("th",{key:c,class:e.normalizeClass({sortable:t.sortable,none:t.sortable&&t.sortType==="none",desc:t.sortable&&t.sortType==="desc",asc:t.sortable&&t.sortType==="asc"}),onClick:k=>t.sortable&&t.sortType?at(t.value,t.sortType):null},[t.text==="checkbox"?(e.openBlock(),e.createBlock(ge,{key:e.unref(R),status:e.unref(R),onChange:st},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",He,[e.createElementVNode("span",Le,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)]))],10,Oe))),128))])])):e.createCommentVNode("",!0),e.unref(et)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(W).length&&e.unref(v).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":r.alternating,"hover-to-change-color":r.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(se),t=>(e.openBlock(),e.createElementBlock("tr",{key:JSON.stringify(t),onClick:c=>it(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v),(c,k)=>(e.openBlock(),e.createElementBlock("td",{key:k},[e.unref(L)[c]?e.renderSlot(o.$slots,c,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):c==="checkbox"?(e.openBlock(),e.createBlock(ye,{key:1,checked:t[c],onChange:x=>ct(t)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(rt(c,t)),1)],64))]))),128))],8,Re))),128))],2)):e.createCommentVNode("",!0)],64))]),e.unref(V)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-wrapper",{"initial-loading":!e.unref(W).length&&e.unref(V)}])},[e.createElementVNode("div",{class:e.normalizeClass(["loading-mask",{"no-footer":!r.showFooter}])},null,2),e.createElementVNode("div",Ae,[e.unref(ot)?e.renderSlot(o.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock(we,{key:1}))])],2)):e.createCommentVNode("",!0),!e.unref(se).length&&!e.unref(V)?(e.openBlock(),e.createElementBlock("div",De,e.toDisplayString(r.emptyMessage),1)):e.createCommentVNode("",!0)],2),r.showFooter?(e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("div",je,[qe,e.createVNode(Be,{modelValue:N.value,"onUpdate:modelValue":s[0]||(s[0]=t=>N.value=t),"rows-items":r.rowsItems},null,8,["modelValue","rows-items"])]),e.createElementVNode("div",Je,e.toDisplayString(`${e.unref(ne)}-${e.unref(oe)}`)+" of "+e.toDisplayString(e.unref(U)),1),e.unref(tt)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:0},{isFirstPage:e.unref(M),isLastPage:e.unref(D),currentPaginationNumber:m.value,maxPaginationNumber:e.unref(A),nextPage:G,prevPage:K})),void 0,!0):(e.openBlock(),e.createBlock(Te,{key:1,"is-first-page":e.unref(M),"is-last-page":e.unref(D),onClickNextPage:G,onClickPrevPage:K},e.createSlots({_:2},[r.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(Ee,{"current-pagination-number":m.value,"max-pagination-number":e.unref(A),onUpdatePage:re},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))])):e.createCommentVNode("",!0)],512))}}),[["__scopeId","data-v-a8a5512a"]]);return We});

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

"private": false,
"version": "1.2.6",
"version": "1.2.7",
"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