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.26 to 1.2.27

70

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

@@ -394,11 +394,11 @@ var __defProp = Object.defineProperty;

const _hoisted_1 = { key: 0 };
const _hoisted_2 = {
const _hoisted_2 = ["onClick"];
const _hoisted_3 = {
key: 1,
class: "header-item"
};
const _hoisted_3 = {
const _hoisted_4 = {
key: 1,
class: "header-text"
};
const _hoisted_4 = ["onClick"];
const _hoisted_5 = ["onClick"];

@@ -606,25 +606,23 @@ const _hoisted_6 = { class: "loading-entity" };

useCssVars((_ctx) => ({
"5d44e5d3": unref(tableBorderColor),
"7402fbd7": unref(minHeightPx),
"bce799f6": unref(rowBackgroundColor),
"5a0c37d3": unref(tableHeightPx),
"79ac4f6a": unref(loadingWrapperSizePx),
"4c9b075f": unref(rowHeightPx),
"128ca682": unref(fontSizePx),
"49abac84": unref(rowFontColor),
"5a21a85a": unref(shadowRightPx),
"164f5ac7": unref(rowBorderColor),
"4026f31d": unref(headerFontColor),
"219462de": __props.headerBackgroundColor,
"1caf7578": unref(sortTypeIconSizePx),
"55433fc7": unref(sortTypeAscIconMarginTopPx),
"673af6d6": unref(sortClickAreaSizePx),
"772f2789": unref(sortClickAreaOffsetSizePx),
"07b55e3a": unref(sortTypeDescIconMarginTopPx),
"7d7ba7c9": unref(rowHoverBackgroundColor),
"4f19f770": unref(rowHoverFontColor),
"1e1355be": unref(evenRowFontColor),
"45fa88bf": unref(evenRowBackgroundColor),
"c5b75be0": unref(footerBackgroundColor),
"3542a062": unref(footerFontColor)
"6a4cb2dd": unref(tableBorderColor),
"061db08d": unref(minHeightPx),
"e85634e2": unref(rowBackgroundColor),
"5f66d1ee": unref(tableHeightPx),
"16daf118": unref(loadingWrapperSizePx),
"429487d6": unref(rowHeightPx),
"408d830c": unref(fontSizePx),
"0a30e2e4": unref(rowFontColor),
"5f3bf0e0": unref(shadowRightPx),
"681ae251": unref(rowBorderColor),
"27cc5cd3": unref(headerFontColor),
"03752c14": __props.headerBackgroundColor,
"481e1064": unref(sortTypeIconSizePx),
"0cc46f5e": unref(sortTypeAscIconMarginTopPx),
"39c84cce": unref(sortTypeDescIconMarginTopPx),
"6a4efb7f": unref(rowHoverBackgroundColor),
"6c64d87e": unref(rowHoverFontColor),
"2b1b22c8": unref(evenRowFontColor),
"bf9a336e": unref(evenRowBackgroundColor),
"7f051b46": unref(footerBackgroundColor),
"65f7ccf6": unref(footerFontColor)
}));

@@ -652,4 +650,4 @@ const {

const sortTypeIconSizePx = computed(() => `${sortTypeIconSize.value}px`);
const sortClickAreaSizePx = computed(() => `${sortTypeIconSize.value * 5}px`);
const sortClickAreaOffsetSizePx = computed(() => `-${sortTypeIconSize.value * 2.5}px`);
computed(() => `${sortTypeIconSize.value * 5}px`);
computed(() => `-${sortTypeIconSize.value * 2.5}px`);
const sortTypeIconMargin = computed(() => Math.round(sortTypeIconSize.value));

@@ -1126,3 +1124,4 @@ const sortTypeAscIconMarginTopPx = computed(() => `-${sortTypeIconMargin.value}px`);

}),
style: normalizeStyle(getFixedDistance(header.value))
style: normalizeStyle(getFixedDistance(header.value)),
onClick: withModifiers(($event) => header.sortable && header.sortType ? updateSortField(header.value, header.sortType) : null, ["stop"])
}, [

@@ -1133,11 +1132,10 @@ header.text === "checkbox" ? (openBlock(), createBlock(MutipleSelectCheckBox, {

onChange: toggleSelectAll
}, null, 8, ["status"])) : (openBlock(), createElementBlock("span", _hoisted_2, [
unref(slots)[`header-${header.value}`] ? renderSlot(_ctx.$slots, `header-${header.value}`, normalizeProps(mergeProps({ key: 0 }, header)), void 0, true) : (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(header.text), 1)),
}, null, 8, ["status"])) : (openBlock(), createElementBlock("span", _hoisted_3, [
unref(slots)[`header-${header.value}`] ? renderSlot(_ctx.$slots, `header-${header.value}`, normalizeProps(mergeProps({ key: 0 }, header)), void 0, true) : (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(header.text), 1)),
header.sortable ? (openBlock(), createElementBlock("i", {
key: header.sortType ? header.sortType : "none",
class: normalizeClass(["sortType-icon", { "desc": header.sortType === "desc" }]),
onClick: withModifiers(($event) => header.sortable && header.sortType ? updateSortField(header.value, header.sortType) : null, ["stop"])
}, null, 10, _hoisted_4)) : createCommentVNode("", true)
class: normalizeClass(["sortType-icon", { "desc": header.sortType === "desc" }])
}, null, 2)) : createCommentVNode("", true)
]))
], 6);
], 14, _hoisted_2);
}), 128))

@@ -1232,3 +1230,3 @@ ])

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

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

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

(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 $t=Object.defineProperty,It=Object.defineProperties;var Et=Object.getOwnPropertyDescriptors;var _e=Object.getOwnPropertySymbols;var Vt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable;var ke=(e,_,g)=>_ in e?$t(e,_,{enumerable:!0,configurable:!0,writable:!0,value:g}):e[_]=g,C=(e,_)=>{for(var g in _||(_={}))Vt.call(_,g)&&ke(e,g,_[g]);if(_e)for(var g of _e(_))Ft.call(_,g)&&ke(e,g,_[g]);return e},H=(e,_)=>It(e,Et(_));var _="",g=(a,k)=>{const l=a.__vccOpts||a;for(const[n,p]of k)l[n]=p;return l};const xe=a=>(e.pushScopeId("data-v-566775ba"),a=a(),e.popScopeId(),a),be=["onClick"],Ce=["checked"],Se=xe(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var Be=g(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(a,{emit:k}){const l=a;e.useCssVars(w=>({"7f84b28f":e.unref(b)}));const n=e.computed(()=>l.status==="allSelected"),p=()=>{k("change",!n.value)},b=e.inject("themeColor");return(w,T)=>(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(a.status)},null,10,Ce),Se],8,be))}}),[["__scopeId","data-v-566775ba"]]),zt="";const Pe=a=>(e.pushScopeId("data-v-39f156fd"),a=a(),e.popScopeId(),a),we=["checked"],Ne=Pe(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var $e=g(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(a,{emit:k}){e.useCssVars(n=>({"20cfc5a0":e.unref(l)}));const l=e.inject("themeColor");return(n,p)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:p[0]||(p[0]=e.withModifiers(b=>k("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:a.checked},null,8,we),Ne]))}}),[["__scopeId","data-v-39f156fd"]]),Ot="";const Ie=a=>(e.pushScopeId("data-v-0ed08e20"),a=a(),e.popScopeId(),a),Ee={class:"easy-data-table__rows-selector"},Ve={class:"rows-input"},Fe=Ie(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),Te=["onClick"];var ze=g(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(a,{emit:k}){const l=a;e.useCssVars(h=>({"83c11052":e.unref(m),"6b60f418":e.unref(s),"346ac97c":e.unref(d)}));const n=e.ref(!1),p=e.ref(!1),b=e.inject("dataTable");e.watch(n,h=>{if(h&&b){const S=window.innerHeight,x=b.value.getBoundingClientRect().height,I=b.value.getBoundingClientRect().top;S-(x+I)<=100?p.value=!0:p.value=!1}});const w=e.computed({get:()=>l.modelValue,set:h=>{k("update:modelValue",h)}}),T=h=>{w.value=h,n.value=!1},O=(h,S)=>{let x=h.parentNode;for(;x!=null;){if(x.classList&&x.classList.contains(S))return!0;x=x.parentNode}return!1},z=h=>{O(h.target,"easy-data-table__rows-selector")||(n.value=!1)};e.onMounted(()=>{document.addEventListener("click",z)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",z)});const d=e.inject("themeColor"),s=e.inject("footerBackgroundColor"),m=e.inject("footerFontColor");return(h,S)=>(e.openBlock(),e.createElementBlock("div",Ee,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:S[0]||(S[0]=x=>n.value=!n.value)},[e.createElementVNode("div",Ve,e.toDisplayString(e.unref(w)),1),Fe]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:n.value,inside:p.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.rowsItems,x=>(e.openBlock(),e.createElementBlock("li",{key:x,class:e.normalizeClass({selected:x===e.unref(w)}),onClick:I=>T(x)},e.toDisplayString(x),11,Te))),128))],2)]))}}),[["__scopeId","data-v-0ed08e20"]]),Rt="";const M=a=>(e.pushScopeId("data-v-969989cc"),a=a(),e.popScopeId(),a),He={class:"lds-ring"},Oe=[M(()=>e.createElementVNode("div",null,null,-1)),M(()=>e.createElementVNode("div",null,null,-1)),M(()=>e.createElementVNode("div",null,null,-1)),M(()=>e.createElementVNode("div",null,null,-1))];var Le=g(e.defineComponent({setup(a){e.useCssVars(n=>({"284c10f4":e.unref(l),"90c4d0a4":e.unref(k)}));const k=e.inject("themeColor"),l=e.inject("loadingEntitySizePx");return(n,p)=>(e.openBlock(),e.createElementBlock("div",He,Oe))}}),[["__scopeId","data-v-969989cc"]]),Wt="";const Re={class:"buttons-pagination"},Ae=["onClick"];var Me=g(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(a,{emit:k}){const l=a;e.useCssVars(d=>({aa5730a0:e.unref(T),"24829312":e.unref(O),"98a0e762":e.unref(z)}));const n=7,p=d=>{d.type==="button"&&!d.active&&k("updatePage",d.page)},b=e.computed(()=>{const d=[];if(l.maxPaginationNumber<=n)for(let s=1;s<=l.maxPaginationNumber;s+=1)d.push({type:"button",page:s,active:s===l.currentPaginationNumber});else if([1,2,l.maxPaginationNumber,l.maxPaginationNumber-1].includes(l.currentPaginationNumber))for(let s=1;s<=n;s+=1)if(s<=3)d.push({type:"button",page:s,active:s===l.currentPaginationNumber});else if(s===4)d.push({type:"omission"});else{const m=l.maxPaginationNumber-(n-s);d.push({type:"button",page:m,active:m===l.currentPaginationNumber})}else if([3,4].includes(l.currentPaginationNumber))for(let s=1;s<=n;s+=1)s<=5?d.push({type:"button",page:s,active:s===l.currentPaginationNumber}):s===6?d.push({type:"omission"}):d.push({type:"button",page:l.maxPaginationNumber,active:l.maxPaginationNumber===l.currentPaginationNumber});else if([l.maxPaginationNumber-2,l.maxPaginationNumber-3].includes(l.currentPaginationNumber))for(let s=1;s<=n;s+=1)if(s===1)d.push({type:"button",page:1,active:l.currentPaginationNumber===1});else if(s===2)d.push({type:"omission"});else{const m=l.maxPaginationNumber-(n-s);d.push({type:"button",page:m,active:m===l.currentPaginationNumber})}else for(let s=1;s<=n;s+=1)if(s===1)d.push({type:"button",page:1,active:l.currentPaginationNumber===1});else if(s===2||s===6)d.push({type:"omission"});else if(s===7)d.push({type:"button",page:l.maxPaginationNumber,active:l.maxPaginationNumber===l.currentPaginationNumber});else{const m=4-s,h=l.currentPaginationNumber-m;d.push({type:"button",page:h,active:h===l.currentPaginationNumber})}return d}),w=e.inject("rowHeight"),T=e.computed(()=>`${w*.6}px`),O=e.inject("rowBorderColor"),z=e.inject("themeColor");return(d,s)=>(e.openBlock(),e.createElementBlock("div",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(m,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["item",{button:m.type==="button",active:m.type==="button"&&m.active,omission:m.type==="omission"}]),onClick:S=>p(m)},e.toDisplayString(m.type==="button"?m.page:"..."),11,Ae))),128))]))}}),[["__scopeId","data-v-4f534e20"]]),Ut="";const ee=a=>(e.pushScopeId("data-v-c9da5286"),a=a(),e.popScopeId(),a),De=[ee(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],je=[ee(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var qe=g(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(a,{emit:k}){const l=e.useSlots();return(n,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":a.isFirstPage}]),onClick:p[0]||(p[0]=b=>k("clickPrevPage"))},De,2),e.unref(l).buttonsPagination?e.renderSlot(n.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":a.isLastPage}]),onClick:p[1]||(p[1]=b=>k("clickNextPage"))},je,2)],64))}}),[["__scopeId","data-v-c9da5286"]]),Xt="";const We={key:0},Je={key:1,class:"header-item"},Ue={key:1,class:"header-text"},Ge=["onClick"],Ke=["onClick"],Qe={class:"loading-entity"},Xe={key:1,class:"data-table__message"},Ye={key:0,class:"data-table__footer"},Ze={key:0,class:"footer__rows-per-page"},ve={class:"footer__items-index"};var te=g(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},rowBorderColor:{type:String,default:"#e0e0e0"},tableBorderColor:{type:String,default:"#e0e0e0"},rowBackgroundColor:{type:String,default:"#fff"},footerBackgroundColor:{type:String,default:"#fff"},rowFontColor:{type:String,default:"#212121"},footerFontColor:{type:String,default:"#212121"},emptyMessage:{type:String,default:"No Available Data"},fixedHeader:{type:Boolean,default:!0},headerFontColor:{type:String,default:"#373737"},headerBackgroundColor:{type:String,default:"#fff"},tableFontSize:{type:Number,default:12},evenRowBackgroundColor:{type:String,default:"#fafafa"},evenRowFontColor:{type:String,default:"#212121"},headers:{type:Array,required:!0},hoverToChangeColor:{type:Boolean,default:!0},items:{type:Array,required:!0},tableHeight:{type:Number,default:()=>null},itemsSelected:{type:Array,default:null},searchField:{type:String,default:""},searchValue:{type:String,default:""},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowHoverBackgroundColor:{type:String,default:"#eee"},rowHoverFontColor:{type:String,default:"#212121"},loading:{type:Boolean,deault:!1},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},themeColor:{type:String,default:"#42b883"},dense:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},hideFooter:{type:Boolean,default:!1},filterOptions:{type:Array,default:null},fixedCheckbox:{type:Boolean,default:!1},fixedIndex:{type:Boolean,default:!1},indexColumnWidth:{type:Number,default:60},checkboxColumnWidth:{type:Number,default:null},hideRowsPerPage:{type:Boolean,default:!1},noThPadding:{type:Boolean,default:!1},noTdPadding:{type:Boolean,default:!1},rowsPerPageMessage:{type:String,default:"rows per page:"}},emits:["update:itemsSelected","update:serverOptions","clickRow"],setup(a,{expose:k,emit:l}){const n=a;e.useCssVars(o=>({"5d44e5d3":e.unref(b),"7402fbd7":e.unref(nt),bce799f6:e.unref(s),"5a0c37d3":e.unref(ot),"79ac4f6a":e.unref(dt),"4c9b075f":e.unref(et),"128ca682":e.unref(x),"49abac84":e.unref(T),"5a21a85a":e.unref(tt),"164f5ac7":e.unref(p),"4026f31d":e.unref(w),"219462de":a.headerBackgroundColor,"1caf7578":e.unref(rt),"55433fc7":e.unref(st),"673af6d6":e.unref(at),"772f2789":e.unref(lt),"07b55e3a":e.unref(it),"7d7ba7c9":e.unref(O),"4f19f770":e.unref(z),"1e1355be":e.unref(h),"45fa88bf":e.unref(m),c5b75be0:e.unref(d),"3542a062":e.unref(S)}));const{rowBorderColor:p,tableBorderColor:b,headerFontColor:w,rowFontColor:T,rowHoverBackgroundColor:O,rowHoverFontColor:z,footerBackgroundColor:d,rowBackgroundColor:s,evenRowBackgroundColor:m,evenRowFontColor:h,footerFontColor:S}=e.toRefs(n),x=e.computed(()=>`${n.tableFontSize}px`),I=e.computed(()=>n.tableFontSize*(n.dense?2:3)),et=e.computed(()=>`${I.value}px`),tt=e.computed(()=>`-${I.value}px`),ot=e.computed(()=>n.tableHeight?`${n.tableHeight}px`:null),nt=e.computed(()=>`${I.value*5}px`),D=e.computed(()=>Math.round(n.tableFontSize/2.5)),rt=e.computed(()=>`${D.value}px`),at=e.computed(()=>`${D.value*5}px`),lt=e.computed(()=>`-${D.value*2.5}px`),oe=e.computed(()=>Math.round(D.value)),st=e.computed(()=>`-${oe.value}px`),it=e.computed(()=>`${oe.value}px`),ct=e.computed(()=>`${n.tableFontSize*5}px`),dt=e.computed(()=>n.tableHeight?`${n.tableHeight-I.value}px`:`${n.tableFontSize*5*2}px`),ut=e.computed(()=>{var o;return(o=n.checkboxColumnWidth)!=null?o:1.3*n.tableFontSize+20});e.provide("themeColor",n.themeColor),e.provide("loadingEntitySizePx",ct.value),e.provide("rowHeight",I.value),e.provide("rowBorderColor",p.value),e.provide("footerBackgroundColor",d.value),e.provide("footerFontColor",S.value);const L=e.useSlots(),pt=e.computed(()=>L.body),ft=e.computed(()=>L.pagination),mt=e.computed(()=>L.loading),ne=e.ref(),G=e.ref();e.provide("dataTable",ne);const re=e.ref(!1);e.onMounted(()=>{G.value.addEventListener("scroll",()=>{re.value=G.value.scrollLeft>0})});const u=e.computed({get:()=>{if(n.serverOptions){const{page:o,rowsPerPage:r,sortBy:t,sortType:i}=n.serverOptions;return{page:o,rowsPerPage:r,sortBy:t!=null?t:null,sortType:i!=null?i:null}}return null},set:o=>{l("update:serverOptions",o)}}),K=e.computed(()=>n.itemsSelected!==null),B=e.computed(()=>u.value!==null),gt=e.computed(()=>!B.value&&n.rowsItems.findIndex(o=>o===n.rowsPerPage)===-1?[n.rowsPerPage,...n.rowsItems]:n.rowsItems),ht=()=>n.sortBy!==""?{sortBy:n.sortBy,sortDesc:n.sortType==="desc"}:null,E=e.ref(ht()),Q=e.computed(()=>n.headers.findIndex(o=>o.fixed)!==-1),yt=e.computed(()=>Q.value?n.headers.filter(o=>o.fixed):[]),_t=e.computed(()=>n.headers.filter(o=>!o.fixed)),R=e.computed(()=>{const r=[...yt.value,..._t.value].map(c=>{const f=c;return c.sortable&&(f.sortType="none"),u.value&&c.value===u.value.sortBy&&u.value.sortType&&(f.sortType=u.value.sortType),!B.value&&E.value&&c.value===E.value.sortBy&&(f.sortType=E.value.sortDesc?"desc":"asc"),f});let t=[];n.showIndex?t=[n.fixedIndex||Q.value?{text:"#",value:"index",fixed:!0,width:n.indexColumnWidth}:{text:"#",value:"index"},...r]:t=r;let i=[];return K.value?i=[n.fixedCheckbox||Q.value?{text:"checkbox",value:"checkbox",fixed:!0,width:ut.value}:{text:"checkbox",value:"checkbox"},...t]:i=t,i}),N=e.computed(()=>R.value.filter(o=>o.fixed)),ae=e.computed(()=>N.value.length?N.value[N.value.length-1].value:""),kt=o=>{var t;const r=(t=o.width)!=null?t:N.value.length?100:null;if(r)return`width: ${r}px; min-width: ${r}px;`},xt=e.computed(()=>{if(!N.value.length)return[];const o=N.value.map(r=>{var t;return(t=r.width)!=null?t:100});return N.value.map((r,t)=>{var i,c;return{value:r.value,fixed:(i=r.fixed)!=null?i:!0,width:(c=r.width)!=null?c:100,distance:t===0?0:o.reduce((f,he,Nt)=>{let ye=f;return Nt<t&&(ye+=he),ye})}})}),le=(o,r="th")=>{if(!N.value.length)return;const t=xt.value.find(i=>i.value===o);if(t)return`left: ${t.distance}px;z-index: ${r==="th"?3:1}; position: sticky`},se=e.computed(()=>R.value.map(o=>o.value)),A=(o,r)=>{if(o.includes(".")){let t="";return o.split(".").forEach((c,f)=>{t=f===0?r[c]:t[c]}),t}return r[o]},bt=(o,r)=>{const t=A(o,r);return Array.isArray(t)?t.join(","):t},P=e.computed({get:()=>{var o;return(o=n.itemsSelected)!=null?o:[]},set:o=>{l("update:itemsSelected",o)}}),ie=e.computed(()=>{if(!B.value&&n.searchValue!==""){const o=new RegExp(n.searchValue,"i");return n.items.filter(r=>o.test(n.searchField!==""?r[n.searchField]:Object.values(r).join(" ")))}return n.items}),V=e.computed(()=>{let o=[...ie.value];return n.filterOptions?(n.filterOptions.forEach(r=>{o=o.filter(t=>{const{field:i,comparison:c,criteria:f}=r;switch(c){case"=":return t[i]===f;case"!=":return t[i]!==f;case">":return t[i]>f;case"<":return t[i]<f;case"<=":return t[i]<=f;case">=":return t[i]>=f;case"between":return t[i]>=Math.min(...f)&&t[i]<=Math.max(...f);default:return t[i]===f}})}),o):ie.value}),j=e.computed(()=>P.value.length===0||P.value.every(r=>V.value.findIndex(t=>JSON.stringify(r)===JSON.stringify(t))===-1)?"noneSelected":P.value.length===V.value.length&&P.value.every(t=>V.value.findIndex(i=>JSON.stringify(t)===JSON.stringify(i))!==-1)?"allSelected":"partSelected"),y=e.ref(B.value?n.serverOptions.page:1),{items:X}=e.toRefs(n);e.watch(X,()=>{B.value||(y.value=1)},{deep:!0});const $=e.ref(B.value?n.serverOptions.rowsPerPage:n.rowsPerPage);e.watch($,o=>{u.value&&(u.value=H(C({},u.value),{page:1,rowsPerPage:o})),y.value=1});const Ct=(o,r)=>{let t=null;r==="none"?t="asc":r==="asc"?t="desc":t=null,u.value?u.value=H(C({},u.value),{sortBy:t!==null?o:null,sortType:t}):t===null?E.value=null:E.value={sortBy:o,sortDesc:t==="desc"}},ce=e.computed(()=>{if(B.value)return n.items;if(E.value===null)return V.value;const{sortBy:o,sortDesc:r}=E.value;return[...V.value].sort((i,c)=>A(o,i)<A(o,c)?r?1:-1:A(o,i)>A(o,c)?r?-1:1:0)}),Y=e.computed(()=>B.value?n.serverItemsLength:V.value.length),de=e.computed(()=>B.value?y.value*$.value:Math.min(V.value.length,y.value*$.value)),ue=e.computed(()=>(y.value-1)*$.value+1),q=e.computed(()=>Math.ceil(Y.value/$.value)),W=e.computed(()=>y.value===q.value),J=e.computed(()=>y.value===1),{loading:F}=e.toRefs(n),Z=()=>{if(!W.value&&!F.value)if(u.value){const o=y.value+1;u.value=H(C({},u.value),{page:o})}else y.value+=1},v=()=>{if(!J.value&&!F.value)if(u.value){const o=y.value-1;u.value=H(C({},u.value),{page:o})}else y.value-=1},pe=o=>{F.value||(u.value?u.value=H(C({},u.value),{page:o}):y.value=o)};e.watch(F,(o,r)=>{u.value&&o===!1&&r===!0&&(y.value=u.value.page)});const fe=e.computed(()=>B.value?n.items:ce.value.slice(ue.value-1,de.value)),me=e.computed(()=>$.value*(y.value-1)+1),St=e.computed(()=>$.value*y.value),U=e.computed(()=>n.showIndex?fe.value.map((o,r)=>C({index:me.value+r},o)):fe.value),ge=e.computed(()=>K.value?j.value==="allSelected"?U.value.map(o=>C({checkbox:!0},o)):j.value==="noneSelected"?U.value.map(o=>C({checkbox:!1},o)):U.value.map(o=>{const r=P.value.findIndex(t=>{const i=C({},o);return delete i.index,JSON.stringify(t)===JSON.stringify(i)})!==-1;return C({checkbox:r},o)}):U.value),Bt=o=>{P.value=o?ce.value:[]},Pt=o=>{const r=o.checkbox;if(delete o.checkbox,delete o.index,r)P.value=P.value.filter(t=>JSON.stringify(t)!==JSON.stringify(o));else{const t=P.value;t.unshift(o),P.value=t}},wt=o=>{const r=C({},o);if(K.value){const{checkbox:t}=o;delete r.checkbox,r.isSelected=t}if(n.showIndex){const{index:t}=o;delete r.index,r.indexInCurrentPage=t}l("clickRow",r)};return k({clientItemsLength:Y,currentPageFirstIndex:me,currentPageLastIndex:St,maxPaginationNumber:q,currentPaginationNumber:y,isLastPage:W,isFirstPage:J,nextPage:Z,prevPage:v,updatePage:pe}),(o,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:ne,class:"vue3-easy-data-table"},[e.createElementVNode("div",{ref_key:"tableBody",ref:G,class:e.normalizeClass(["data-table__body",{"fixed-header":a.fixedHeader,"fixed-height":a.tableHeight,"show-shadow":re.value}])},[e.createElementVNode("table",{class:e.normalizeClass({fixed:e.unref(N).length})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(R),(t,i)=>(e.openBlock(),e.createElementBlock("col",{key:i,style:e.normalizeStyle(kt(t))},null,4))),128))]),e.unref(R).length?(e.openBlock(),e.createElementBlock("thead",We,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(R),(t,i)=>(e.openBlock(),e.createElementBlock("th",{key:i,class:e.normalizeClass({sortable:t.sortable,none:t.sortable&&t.sortType==="none",desc:t.sortable&&t.sortType==="desc",asc:t.sortable&&t.sortType==="asc",fixed:t.fixed,"has-shadow":t.value===e.unref(ae),"no-padding":a.noThPadding}),style:e.normalizeStyle(le(t.value))},[t.text==="checkbox"?(e.openBlock(),e.createBlock(Be,{key:e.unref(j),status:e.unref(j),onChange:Bt},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",Je,[e.unref(L)[`header-${t.value}`]?e.renderSlot(o.$slots,`header-${t.value}`,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):(e.openBlock(),e.createElementBlock("span",Ue,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"}]),onClick:e.withModifiers(c=>t.sortable&&t.sortType?Ct(t.value,t.sortType):null,["stop"])},null,10,Ge)):e.createCommentVNode("",!0)]))],6))),128))])])):e.createCommentVNode("",!0),e.unref(pt)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(X).length&&e.unref(se).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":a.alternating,"hover-to-change-color":a.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ge),(t,i)=>(e.openBlock(),e.createElementBlock("tr",{key:i,onClick:c=>wt(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(se),(c,f)=>(e.openBlock(),e.createElementBlock("td",{key:f,style:e.normalizeStyle(le(c,"td")),class:e.normalizeClass({"has-shadow":c===e.unref(ae),"no-padding":a.noTdPadding})},[e.unref(L)[`item-${c}`]?e.renderSlot(o.$slots,`item-${c}`,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):c==="checkbox"?(e.openBlock(),e.createBlock($e,{key:1,checked:t[c],onChange:he=>Pt(t)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(bt(c,t)),1)],64))],6))),128))],8,Ke))),128))],2)):e.createCommentVNode("",!0)],64))],2),e.unref(F)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-wrapper",{"initial-loading":!e.unref(X).length&&e.unref(F)}])},[e.createElementVNode("div",{class:e.normalizeClass(["loading-mask",{"no-footer":a.hideFooter}])},null,2),e.createElementVNode("div",Qe,[e.unref(mt)?e.renderSlot(o.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock(Le,{key:1}))])],2)):e.createCommentVNode("",!0),!e.unref(ge).length&&!e.unref(F)?(e.openBlock(),e.createElementBlock("div",Xe,e.toDisplayString(a.emptyMessage),1)):e.createCommentVNode("",!0)],2),a.hideFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ye,[a.hideRowsPerPage?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ze,[e.createTextVNode(e.toDisplayString(a.rowsPerPageMessage)+" ",1),e.createVNode(ze,{modelValue:$.value,"onUpdate:modelValue":r[0]||(r[0]=t=>$.value=t),"rows-items":e.unref(gt)},null,8,["modelValue","rows-items"])])),e.createElementVNode("div",ve,e.toDisplayString(`${e.unref(ue)}-${e.unref(de)}`)+" of "+e.toDisplayString(e.unref(Y)),1),e.unref(ft)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:1},{isFirstPage:e.unref(J),isLastPage:e.unref(W),currentPaginationNumber:y.value,maxPaginationNumber:e.unref(q),nextPage:Z,prevPage:v})),void 0,!0):(e.openBlock(),e.createBlock(qe,{key:2,"is-first-page":e.unref(J),"is-last-page":e.unref(W),onClickNextPage:Z,onClickPrevPage:v},e.createSlots({_:2},[a.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(Me,{"current-pagination-number":y.value,"max-pagination-number":e.unref(q),onUpdatePage:pe},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))]))],512))}}),[["__scopeId","data-v-ffbe8c06"]]);return typeof window!="undefined"&&window.Vue&&window.Vue.createApp({}).component("Vue3EasyDataTable",te),te});
(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 wt=Object.defineProperty,Nt=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var _e=Object.getOwnPropertySymbols;var It=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var ke=(e,_,g)=>_ in e?wt(e,_,{enumerable:!0,configurable:!0,writable:!0,value:g}):e[_]=g,C=(e,_)=>{for(var g in _||(_={}))It.call(_,g)&&ke(e,g,_[g]);if(_e)for(var g of _e(_))Et.call(_,g)&&ke(e,g,_[g]);return e},H=(e,_)=>Nt(e,$t(_));var _="",g=(a,k)=>{const l=a.__vccOpts||a;for(const[n,p]of k)l[n]=p;return l};const xe=a=>(e.pushScopeId("data-v-566775ba"),a=a(),e.popScopeId(),a),be=["onClick"],Ce=["checked"],Se=xe(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var Be=g(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(a,{emit:k}){const l=a;e.useCssVars(w=>({"7f84b28f":e.unref(b)}));const n=e.computed(()=>l.status==="allSelected"),p=()=>{k("change",!n.value)},b=e.inject("themeColor");return(w,T)=>(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(a.status)},null,10,Ce),Se],8,be))}}),[["__scopeId","data-v-566775ba"]]),Ft="";const Pe=a=>(e.pushScopeId("data-v-39f156fd"),a=a(),e.popScopeId(),a),we=["checked"],Ne=Pe(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var $e=g(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(a,{emit:k}){e.useCssVars(n=>({"20cfc5a0":e.unref(l)}));const l=e.inject("themeColor");return(n,p)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:p[0]||(p[0]=e.withModifiers(b=>k("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:a.checked},null,8,we),Ne]))}}),[["__scopeId","data-v-39f156fd"]]),zt="";const Ie=a=>(e.pushScopeId("data-v-0ed08e20"),a=a(),e.popScopeId(),a),Ee={class:"easy-data-table__rows-selector"},Ve={class:"rows-input"},Fe=Ie(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),Te=["onClick"];var ze=g(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(a,{emit:k}){const l=a;e.useCssVars(h=>({"83c11052":e.unref(m),"6b60f418":e.unref(s),"346ac97c":e.unref(d)}));const n=e.ref(!1),p=e.ref(!1),b=e.inject("dataTable");e.watch(n,h=>{if(h&&b){const S=window.innerHeight,x=b.value.getBoundingClientRect().height,I=b.value.getBoundingClientRect().top;S-(x+I)<=100?p.value=!0:p.value=!1}});const w=e.computed({get:()=>l.modelValue,set:h=>{k("update:modelValue",h)}}),T=h=>{w.value=h,n.value=!1},O=(h,S)=>{let x=h.parentNode;for(;x!=null;){if(x.classList&&x.classList.contains(S))return!0;x=x.parentNode}return!1},z=h=>{O(h.target,"easy-data-table__rows-selector")||(n.value=!1)};e.onMounted(()=>{document.addEventListener("click",z)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",z)});const d=e.inject("themeColor"),s=e.inject("footerBackgroundColor"),m=e.inject("footerFontColor");return(h,S)=>(e.openBlock(),e.createElementBlock("div",Ee,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:S[0]||(S[0]=x=>n.value=!n.value)},[e.createElementVNode("div",Ve,e.toDisplayString(e.unref(w)),1),Fe]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:n.value,inside:p.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.rowsItems,x=>(e.openBlock(),e.createElementBlock("li",{key:x,class:e.normalizeClass({selected:x===e.unref(w)}),onClick:I=>T(x)},e.toDisplayString(x),11,Te))),128))],2)]))}}),[["__scopeId","data-v-0ed08e20"]]),Ot="";const M=a=>(e.pushScopeId("data-v-969989cc"),a=a(),e.popScopeId(),a),He={class:"lds-ring"},Oe=[M(()=>e.createElementVNode("div",null,null,-1)),M(()=>e.createElementVNode("div",null,null,-1)),M(()=>e.createElementVNode("div",null,null,-1)),M(()=>e.createElementVNode("div",null,null,-1))];var Le=g(e.defineComponent({setup(a){e.useCssVars(n=>({"284c10f4":e.unref(l),"90c4d0a4":e.unref(k)}));const k=e.inject("themeColor"),l=e.inject("loadingEntitySizePx");return(n,p)=>(e.openBlock(),e.createElementBlock("div",He,Oe))}}),[["__scopeId","data-v-969989cc"]]),jt="";const Re={class:"buttons-pagination"},Ae=["onClick"];var Me=g(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(a,{emit:k}){const l=a;e.useCssVars(d=>({aa5730a0:e.unref(T),"24829312":e.unref(O),"98a0e762":e.unref(z)}));const n=7,p=d=>{d.type==="button"&&!d.active&&k("updatePage",d.page)},b=e.computed(()=>{const d=[];if(l.maxPaginationNumber<=n)for(let s=1;s<=l.maxPaginationNumber;s+=1)d.push({type:"button",page:s,active:s===l.currentPaginationNumber});else if([1,2,l.maxPaginationNumber,l.maxPaginationNumber-1].includes(l.currentPaginationNumber))for(let s=1;s<=n;s+=1)if(s<=3)d.push({type:"button",page:s,active:s===l.currentPaginationNumber});else if(s===4)d.push({type:"omission"});else{const m=l.maxPaginationNumber-(n-s);d.push({type:"button",page:m,active:m===l.currentPaginationNumber})}else if([3,4].includes(l.currentPaginationNumber))for(let s=1;s<=n;s+=1)s<=5?d.push({type:"button",page:s,active:s===l.currentPaginationNumber}):s===6?d.push({type:"omission"}):d.push({type:"button",page:l.maxPaginationNumber,active:l.maxPaginationNumber===l.currentPaginationNumber});else if([l.maxPaginationNumber-2,l.maxPaginationNumber-3].includes(l.currentPaginationNumber))for(let s=1;s<=n;s+=1)if(s===1)d.push({type:"button",page:1,active:l.currentPaginationNumber===1});else if(s===2)d.push({type:"omission"});else{const m=l.maxPaginationNumber-(n-s);d.push({type:"button",page:m,active:m===l.currentPaginationNumber})}else for(let s=1;s<=n;s+=1)if(s===1)d.push({type:"button",page:1,active:l.currentPaginationNumber===1});else if(s===2||s===6)d.push({type:"omission"});else if(s===7)d.push({type:"button",page:l.maxPaginationNumber,active:l.maxPaginationNumber===l.currentPaginationNumber});else{const m=4-s,h=l.currentPaginationNumber-m;d.push({type:"button",page:h,active:h===l.currentPaginationNumber})}return d}),w=e.inject("rowHeight"),T=e.computed(()=>`${w*.6}px`),O=e.inject("rowBorderColor"),z=e.inject("themeColor");return(d,s)=>(e.openBlock(),e.createElementBlock("div",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(m,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["item",{button:m.type==="button",active:m.type==="button"&&m.active,omission:m.type==="omission"}]),onClick:S=>p(m)},e.toDisplayString(m.type==="button"?m.page:"..."),11,Ae))),128))]))}}),[["__scopeId","data-v-4f534e20"]]),Wt="";const ee=a=>(e.pushScopeId("data-v-c9da5286"),a=a(),e.popScopeId(),a),De=[ee(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],je=[ee(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var qe=g(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(a,{emit:k}){const l=e.useSlots();return(n,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":a.isFirstPage}]),onClick:p[0]||(p[0]=b=>k("clickPrevPage"))},De,2),e.unref(l).buttonsPagination?e.renderSlot(n.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":a.isLastPage}]),onClick:p[1]||(p[1]=b=>k("clickNextPage"))},je,2)],64))}}),[["__scopeId","data-v-c9da5286"]]),Kt="";const We={key:0},Je=["onClick"],Ue={key:1,class:"header-item"},Ge={key:1,class:"header-text"},Ke=["onClick"],Qe={class:"loading-entity"},Xe={key:1,class:"data-table__message"},Ye={key:0,class:"data-table__footer"},Ze={key:0,class:"footer__rows-per-page"},ve={class:"footer__items-index"};var te=g(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},rowBorderColor:{type:String,default:"#e0e0e0"},tableBorderColor:{type:String,default:"#e0e0e0"},rowBackgroundColor:{type:String,default:"#fff"},footerBackgroundColor:{type:String,default:"#fff"},rowFontColor:{type:String,default:"#212121"},footerFontColor:{type:String,default:"#212121"},emptyMessage:{type:String,default:"No Available Data"},fixedHeader:{type:Boolean,default:!0},headerFontColor:{type:String,default:"#373737"},headerBackgroundColor:{type:String,default:"#fff"},tableFontSize:{type:Number,default:12},evenRowBackgroundColor:{type:String,default:"#fafafa"},evenRowFontColor:{type:String,default:"#212121"},headers:{type:Array,required:!0},hoverToChangeColor:{type:Boolean,default:!0},items:{type:Array,required:!0},tableHeight:{type:Number,default:()=>null},itemsSelected:{type:Array,default:null},searchField:{type:String,default:""},searchValue:{type:String,default:""},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowHoverBackgroundColor:{type:String,default:"#eee"},rowHoverFontColor:{type:String,default:"#212121"},loading:{type:Boolean,deault:!1},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},themeColor:{type:String,default:"#42b883"},dense:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},hideFooter:{type:Boolean,default:!1},filterOptions:{type:Array,default:null},fixedCheckbox:{type:Boolean,default:!1},fixedIndex:{type:Boolean,default:!1},indexColumnWidth:{type:Number,default:60},checkboxColumnWidth:{type:Number,default:null},hideRowsPerPage:{type:Boolean,default:!1},noThPadding:{type:Boolean,default:!1},noTdPadding:{type:Boolean,default:!1},rowsPerPageMessage:{type:String,default:"rows per page:"}},emits:["update:itemsSelected","update:serverOptions","clickRow"],setup(a,{expose:k,emit:l}){const n=a;e.useCssVars(o=>({"6a4cb2dd":e.unref(b),"061db08d":e.unref(nt),e85634e2:e.unref(s),"5f66d1ee":e.unref(ot),"16daf118":e.unref(it),"429487d6":e.unref(et),"408d830c":e.unref(x),"0a30e2e4":e.unref(T),"5f3bf0e0":e.unref(tt),"681ae251":e.unref(p),"27cc5cd3":e.unref(w),"03752c14":a.headerBackgroundColor,"481e1064":e.unref(rt),"0cc46f5e":e.unref(at),"39c84cce":e.unref(lt),"6a4efb7f":e.unref(O),"6c64d87e":e.unref(z),"2b1b22c8":e.unref(h),bf9a336e:e.unref(m),"7f051b46":e.unref(d),"65f7ccf6":e.unref(S)}));const{rowBorderColor:p,tableBorderColor:b,headerFontColor:w,rowFontColor:T,rowHoverBackgroundColor:O,rowHoverFontColor:z,footerBackgroundColor:d,rowBackgroundColor:s,evenRowBackgroundColor:m,evenRowFontColor:h,footerFontColor:S}=e.toRefs(n),x=e.computed(()=>`${n.tableFontSize}px`),I=e.computed(()=>n.tableFontSize*(n.dense?2:3)),et=e.computed(()=>`${I.value}px`),tt=e.computed(()=>`-${I.value}px`),ot=e.computed(()=>n.tableHeight?`${n.tableHeight}px`:null),nt=e.computed(()=>`${I.value*5}px`),D=e.computed(()=>Math.round(n.tableFontSize/2.5)),rt=e.computed(()=>`${D.value}px`);e.computed(()=>`${D.value*5}px`),e.computed(()=>`-${D.value*2.5}px`);const oe=e.computed(()=>Math.round(D.value)),at=e.computed(()=>`-${oe.value}px`),lt=e.computed(()=>`${oe.value}px`),st=e.computed(()=>`${n.tableFontSize*5}px`),it=e.computed(()=>n.tableHeight?`${n.tableHeight-I.value}px`:`${n.tableFontSize*5*2}px`),ct=e.computed(()=>{var o;return(o=n.checkboxColumnWidth)!=null?o:1.3*n.tableFontSize+20});e.provide("themeColor",n.themeColor),e.provide("loadingEntitySizePx",st.value),e.provide("rowHeight",I.value),e.provide("rowBorderColor",p.value),e.provide("footerBackgroundColor",d.value),e.provide("footerFontColor",S.value);const L=e.useSlots(),dt=e.computed(()=>L.body),ut=e.computed(()=>L.pagination),pt=e.computed(()=>L.loading),ne=e.ref(),G=e.ref();e.provide("dataTable",ne);const re=e.ref(!1);e.onMounted(()=>{G.value.addEventListener("scroll",()=>{re.value=G.value.scrollLeft>0})});const u=e.computed({get:()=>{if(n.serverOptions){const{page:o,rowsPerPage:r,sortBy:t,sortType:i}=n.serverOptions;return{page:o,rowsPerPage:r,sortBy:t!=null?t:null,sortType:i!=null?i:null}}return null},set:o=>{l("update:serverOptions",o)}}),K=e.computed(()=>n.itemsSelected!==null),B=e.computed(()=>u.value!==null),ft=e.computed(()=>!B.value&&n.rowsItems.findIndex(o=>o===n.rowsPerPage)===-1?[n.rowsPerPage,...n.rowsItems]:n.rowsItems),mt=()=>n.sortBy!==""?{sortBy:n.sortBy,sortDesc:n.sortType==="desc"}:null,E=e.ref(mt()),Q=e.computed(()=>n.headers.findIndex(o=>o.fixed)!==-1),gt=e.computed(()=>Q.value?n.headers.filter(o=>o.fixed):[]),ht=e.computed(()=>n.headers.filter(o=>!o.fixed)),R=e.computed(()=>{const r=[...gt.value,...ht.value].map(c=>{const f=c;return c.sortable&&(f.sortType="none"),u.value&&c.value===u.value.sortBy&&u.value.sortType&&(f.sortType=u.value.sortType),!B.value&&E.value&&c.value===E.value.sortBy&&(f.sortType=E.value.sortDesc?"desc":"asc"),f});let t=[];n.showIndex?t=[n.fixedIndex||Q.value?{text:"#",value:"index",fixed:!0,width:n.indexColumnWidth}:{text:"#",value:"index"},...r]:t=r;let i=[];return K.value?i=[n.fixedCheckbox||Q.value?{text:"checkbox",value:"checkbox",fixed:!0,width:ct.value}:{text:"checkbox",value:"checkbox"},...t]:i=t,i}),N=e.computed(()=>R.value.filter(o=>o.fixed)),ae=e.computed(()=>N.value.length?N.value[N.value.length-1].value:""),yt=o=>{var t;const r=(t=o.width)!=null?t:N.value.length?100:null;if(r)return`width: ${r}px; min-width: ${r}px;`},_t=e.computed(()=>{if(!N.value.length)return[];const o=N.value.map(r=>{var t;return(t=r.width)!=null?t:100});return N.value.map((r,t)=>{var i,c;return{value:r.value,fixed:(i=r.fixed)!=null?i:!0,width:(c=r.width)!=null?c:100,distance:t===0?0:o.reduce((f,he,Pt)=>{let ye=f;return Pt<t&&(ye+=he),ye})}})}),le=(o,r="th")=>{if(!N.value.length)return;const t=_t.value.find(i=>i.value===o);if(t)return`left: ${t.distance}px;z-index: ${r==="th"?3:1}; position: sticky`},se=e.computed(()=>R.value.map(o=>o.value)),A=(o,r)=>{if(o.includes(".")){let t="";return o.split(".").forEach((c,f)=>{t=f===0?r[c]:t[c]}),t}return r[o]},kt=(o,r)=>{const t=A(o,r);return Array.isArray(t)?t.join(","):t},P=e.computed({get:()=>{var o;return(o=n.itemsSelected)!=null?o:[]},set:o=>{l("update:itemsSelected",o)}}),ie=e.computed(()=>{if(!B.value&&n.searchValue!==""){const o=new RegExp(n.searchValue,"i");return n.items.filter(r=>o.test(n.searchField!==""?r[n.searchField]:Object.values(r).join(" ")))}return n.items}),V=e.computed(()=>{let o=[...ie.value];return n.filterOptions?(n.filterOptions.forEach(r=>{o=o.filter(t=>{const{field:i,comparison:c,criteria:f}=r;switch(c){case"=":return t[i]===f;case"!=":return t[i]!==f;case">":return t[i]>f;case"<":return t[i]<f;case"<=":return t[i]<=f;case">=":return t[i]>=f;case"between":return t[i]>=Math.min(...f)&&t[i]<=Math.max(...f);default:return t[i]===f}})}),o):ie.value}),j=e.computed(()=>P.value.length===0||P.value.every(r=>V.value.findIndex(t=>JSON.stringify(r)===JSON.stringify(t))===-1)?"noneSelected":P.value.length===V.value.length&&P.value.every(t=>V.value.findIndex(i=>JSON.stringify(t)===JSON.stringify(i))!==-1)?"allSelected":"partSelected"),y=e.ref(B.value?n.serverOptions.page:1),{items:X}=e.toRefs(n);e.watch(X,()=>{B.value||(y.value=1)},{deep:!0});const $=e.ref(B.value?n.serverOptions.rowsPerPage:n.rowsPerPage);e.watch($,o=>{u.value&&(u.value=H(C({},u.value),{page:1,rowsPerPage:o})),y.value=1});const xt=(o,r)=>{let t=null;r==="none"?t="asc":r==="asc"?t="desc":t=null,u.value?u.value=H(C({},u.value),{sortBy:t!==null?o:null,sortType:t}):t===null?E.value=null:E.value={sortBy:o,sortDesc:t==="desc"}},ce=e.computed(()=>{if(B.value)return n.items;if(E.value===null)return V.value;const{sortBy:o,sortDesc:r}=E.value;return[...V.value].sort((i,c)=>A(o,i)<A(o,c)?r?1:-1:A(o,i)>A(o,c)?r?-1:1:0)}),Y=e.computed(()=>B.value?n.serverItemsLength:V.value.length),de=e.computed(()=>B.value?y.value*$.value:Math.min(V.value.length,y.value*$.value)),ue=e.computed(()=>(y.value-1)*$.value+1),q=e.computed(()=>Math.ceil(Y.value/$.value)),W=e.computed(()=>y.value===q.value),J=e.computed(()=>y.value===1),{loading:F}=e.toRefs(n),Z=()=>{if(!W.value&&!F.value)if(u.value){const o=y.value+1;u.value=H(C({},u.value),{page:o})}else y.value+=1},v=()=>{if(!J.value&&!F.value)if(u.value){const o=y.value-1;u.value=H(C({},u.value),{page:o})}else y.value-=1},pe=o=>{F.value||(u.value?u.value=H(C({},u.value),{page:o}):y.value=o)};e.watch(F,(o,r)=>{u.value&&o===!1&&r===!0&&(y.value=u.value.page)});const fe=e.computed(()=>B.value?n.items:ce.value.slice(ue.value-1,de.value)),me=e.computed(()=>$.value*(y.value-1)+1),bt=e.computed(()=>$.value*y.value),U=e.computed(()=>n.showIndex?fe.value.map((o,r)=>C({index:me.value+r},o)):fe.value),ge=e.computed(()=>K.value?j.value==="allSelected"?U.value.map(o=>C({checkbox:!0},o)):j.value==="noneSelected"?U.value.map(o=>C({checkbox:!1},o)):U.value.map(o=>{const r=P.value.findIndex(t=>{const i=C({},o);return delete i.index,JSON.stringify(t)===JSON.stringify(i)})!==-1;return C({checkbox:r},o)}):U.value),Ct=o=>{P.value=o?ce.value:[]},St=o=>{const r=o.checkbox;if(delete o.checkbox,delete o.index,r)P.value=P.value.filter(t=>JSON.stringify(t)!==JSON.stringify(o));else{const t=P.value;t.unshift(o),P.value=t}},Bt=o=>{const r=C({},o);if(K.value){const{checkbox:t}=o;delete r.checkbox,r.isSelected=t}if(n.showIndex){const{index:t}=o;delete r.index,r.indexInCurrentPage=t}l("clickRow",r)};return k({clientItemsLength:Y,currentPageFirstIndex:me,currentPageLastIndex:bt,maxPaginationNumber:q,currentPaginationNumber:y,isLastPage:W,isFirstPage:J,nextPage:Z,prevPage:v,updatePage:pe}),(o,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:ne,class:"vue3-easy-data-table"},[e.createElementVNode("div",{ref_key:"tableBody",ref:G,class:e.normalizeClass(["data-table__body",{"fixed-header":a.fixedHeader,"fixed-height":a.tableHeight,"show-shadow":re.value}])},[e.createElementVNode("table",{class:e.normalizeClass({fixed:e.unref(N).length})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(R),(t,i)=>(e.openBlock(),e.createElementBlock("col",{key:i,style:e.normalizeStyle(yt(t))},null,4))),128))]),e.unref(R).length?(e.openBlock(),e.createElementBlock("thead",We,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(R),(t,i)=>(e.openBlock(),e.createElementBlock("th",{key:i,class:e.normalizeClass({sortable:t.sortable,none:t.sortable&&t.sortType==="none",desc:t.sortable&&t.sortType==="desc",asc:t.sortable&&t.sortType==="asc",fixed:t.fixed,"has-shadow":t.value===e.unref(ae),"no-padding":a.noThPadding}),style:e.normalizeStyle(le(t.value)),onClick:e.withModifiers(c=>t.sortable&&t.sortType?xt(t.value,t.sortType):null,["stop"])},[t.text==="checkbox"?(e.openBlock(),e.createBlock(Be,{key:e.unref(j),status:e.unref(j),onChange:Ct},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",Ue,[e.unref(L)[`header-${t.value}`]?e.renderSlot(o.$slots,`header-${t.value}`,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):(e.openBlock(),e.createElementBlock("span",Ge,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,Je))),128))])])):e.createCommentVNode("",!0),e.unref(dt)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(X).length&&e.unref(se).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":a.alternating,"hover-to-change-color":a.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ge),(t,i)=>(e.openBlock(),e.createElementBlock("tr",{key:i,onClick:c=>Bt(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(se),(c,f)=>(e.openBlock(),e.createElementBlock("td",{key:f,style:e.normalizeStyle(le(c,"td")),class:e.normalizeClass({"has-shadow":c===e.unref(ae),"no-padding":a.noTdPadding})},[e.unref(L)[`item-${c}`]?e.renderSlot(o.$slots,`item-${c}`,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):c==="checkbox"?(e.openBlock(),e.createBlock($e,{key:1,checked:t[c],onChange:he=>St(t)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(kt(c,t)),1)],64))],6))),128))],8,Ke))),128))],2)):e.createCommentVNode("",!0)],64))],2),e.unref(F)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-wrapper",{"initial-loading":!e.unref(X).length&&e.unref(F)}])},[e.createElementVNode("div",{class:e.normalizeClass(["loading-mask",{"no-footer":a.hideFooter}])},null,2),e.createElementVNode("div",Qe,[e.unref(pt)?e.renderSlot(o.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock(Le,{key:1}))])],2)):e.createCommentVNode("",!0),!e.unref(ge).length&&!e.unref(F)?(e.openBlock(),e.createElementBlock("div",Xe,e.toDisplayString(a.emptyMessage),1)):e.createCommentVNode("",!0)],2),a.hideFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ye,[a.hideRowsPerPage?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ze,[e.createTextVNode(e.toDisplayString(a.rowsPerPageMessage)+" ",1),e.createVNode(ze,{modelValue:$.value,"onUpdate:modelValue":r[0]||(r[0]=t=>$.value=t),"rows-items":e.unref(ft)},null,8,["modelValue","rows-items"])])),e.createElementVNode("div",ve,e.toDisplayString(`${e.unref(ue)}-${e.unref(de)}`)+" of "+e.toDisplayString(e.unref(Y)),1),e.unref(ut)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:1},{isFirstPage:e.unref(J),isLastPage:e.unref(W),currentPaginationNumber:y.value,maxPaginationNumber:e.unref(q),nextPage:Z,prevPage:v})),void 0,!0):(e.openBlock(),e.createBlock(qe,{key:2,"is-first-page":e.unref(J),"is-last-page":e.unref(W),onClickNextPage:Z,onClickPrevPage:v},e.createSlots({_:2},[a.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(Me,{"current-pagination-number":y.value,"max-pagination-number":e.unref(q),onUpdatePage:pe},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))]))],512))}}),[["__scopeId","data-v-70147218"]]);return typeof window!="undefined"&&window.Vue&&window.Vue.createApp({}).component("Vue3EasyDataTable",te),te});

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

"private": false,
"version": "1.2.26",
"version": "1.2.27",
"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