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.5.1 to 1.5.2

198

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

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

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

@@ -492,14 +492,17 @@ const fixedHeadersFromUser = computed(() => {

const generateClientSortOptions = (sortByValue, sortTypeValue) => {
if (sortByValue !== "") {
if (Array.isArray(sortByValue) && Array.isArray(sortTypeValue)) {
return {
sortBy: sortByValue,
sortDesc: sortTypeValue === "desc"
sortDesc: sortTypeValue.map((val) => val === "desc")
};
}
if (sortByValue !== "") {
return {
sortBy: sortBy.value,
sortDesc: sortType.value === "desc"
};
}
return null;
};
const clientSortOptions = ref(generateClientSortOptions(sortBy.value, sortType.value));
watch([sortBy, sortType], () => {
clientSortOptions.value = generateClientSortOptions(sortBy.value, sortType.value);
});
const headersForRender = computed(() => {

@@ -512,9 +515,19 @@ var _a;

const headersSorting = fixedHeaders.map((header) => {
const headerSorting = header;
if (header.sortable)
const headerSorting = Object.assign(header);
if (multiSort.value)
headerSorting.sortable = true;
if (headerSorting.sortable)
headerSorting.sortType = "none";
if (serverOptionsComputed.value && header.value === serverOptionsComputed.value.sortBy && serverOptionsComputed.value.sortType) {
headerSorting.sortType = serverOptionsComputed.value.sortType;
if (serverOptionsComputed.value) {
if (Array.isArray(serverOptionsComputed.value.sortBy) && Array.isArray(serverOptionsComputed.value.sortType) && serverOptionsComputed.value.sortBy.includes(headerSorting.value)) {
const index = serverOptionsComputed.value.sortBy.indexOf(headerSorting.value);
headerSorting.sortType = serverOptionsComputed.value.sortType[index];
} else if (headerSorting.value === serverOptionsComputed.value.sortBy && serverOptionsComputed.value.sortType) {
headerSorting.sortType = serverOptionsComputed.value.sortType;
}
}
if (!isServerSideMode.value && clientSortOptions.value && header.value === clientSortOptions.value.sortBy) {
if (clientSortOptions.value && Array.isArray(clientSortOptions.value.sortBy) && Array.isArray(clientSortOptions.value.sortDesc) && clientSortOptions.value.sortBy.includes(headerSorting.value)) {
const index = clientSortOptions.value.sortBy.indexOf(headerSorting.value);
headerSorting.sortType = clientSortOptions.value.sortDesc[index] ? "desc" : "asc";
} else if (clientSortOptions.value && headerSorting.value === clientSortOptions.value.sortBy) {
headerSorting.sortType = clientSortOptions.value.sortDesc ? "desc" : "asc";

@@ -574,2 +587,16 @@ }

updateServerOptionsSort(newSortBy, newSortType);
}
if (clientSortOptions.value && Array.isArray(clientSortOptions.value.sortBy) && Array.isArray(clientSortOptions.value.sortDesc)) {
const index = clientSortOptions.value.sortBy.indexOf(newSortBy);
if (index === -1) {
if (newSortType !== null) {
clientSortOptions.value.sortBy.push(newSortBy);
clientSortOptions.value.sortDesc.push(newSortType === "desc");
}
} else if (newSortType === null) {
clientSortOptions.value.sortDesc.splice(index, 1);
clientSortOptions.value.sortBy.splice(index, 1);
} else {
clientSortOptions.value.sortDesc[index] = newSortType === "desc";
}
} else if (newSortType === null) {

@@ -588,2 +615,22 @@ clientSortOptions.value = null;

};
const isMultiSorting = (headerText) => {
if (serverOptionsComputed.value) {
if (Array.isArray(serverOptionsComputed.value.sortBy))
return serverOptionsComputed.value.sortBy.includes(headerText);
}
if (clientSortOptions.value && Array.isArray(clientSortOptions.value.sortBy)) {
return clientSortOptions.value.sortBy.includes(headerText);
}
return false;
};
const getMultiSortNumber = (headerText) => {
if (serverOptionsComputed.value) {
if (Array.isArray(serverOptionsComputed.value.sortBy))
return serverOptionsComputed.value.sortBy.indexOf(headerText) + 1;
}
if (clientSortOptions.value && Array.isArray(clientSortOptions.value.sortBy)) {
return clientSortOptions.value.sortBy.indexOf(headerText) + 1;
}
return false;
};
return {

@@ -593,3 +640,5 @@ clientSortOptions,

headersForRender,
updateSortField
updateSortField,
isMultiSorting,
getMultiSortNumber
};

@@ -737,3 +786,3 @@ }

}
function useServerOptions(serverOptions, emits) {
function useServerOptions(serverOptions, multiSort, emits) {
const serverOptionsComputed = computed({

@@ -778,6 +827,20 @@ get: () => {

if (serverOptionsComputed.value) {
serverOptionsComputed.value = __spreadProps(__spreadValues({}, serverOptionsComputed.value), {
sortBy: newSortType !== null ? newSortBy : null,
sortType: newSortType
});
if (multiSort.value && Array.isArray(serverOptionsComputed.value.sortBy) && Array.isArray(serverOptionsComputed.value.sortType)) {
const index = serverOptionsComputed.value.sortBy.findIndex((val) => val === newSortBy);
if (index === -1 && newSortType !== null) {
serverOptionsComputed.value.sortBy.push(newSortBy);
serverOptionsComputed.value.sortType.push(newSortType);
}
if (newSortType === null) {
serverOptionsComputed.value.sortBy.splice(index, 1);
serverOptionsComputed.value.sortType.splice(index, 1);
} else {
serverOptionsComputed.value.sortType[index] = newSortType;
}
} else {
serverOptionsComputed.value = __spreadProps(__spreadValues({}, serverOptionsComputed.value), {
sortBy: newSortType !== null ? newSortBy : null,
sortType: newSortType
});
}
}

@@ -812,3 +875,3 @@ };

}
function useTotalItems(clientSortOptions, filterOptions, isServerSideMode, items, itemsSelected, searchField, searchValue, serverItemsLength, emits) {
function useTotalItems(clientSortOptions, filterOptions, isServerSideMode, items, itemsSelected, searchField, searchValue, serverItemsLength, multiSort, emits) {
const itemsSearching = computed(() => {

@@ -855,2 +918,24 @@ if (!isServerSideMode.value && searchValue.value !== "") {

});
function recursionMuiltSort(sortByArr, sortDescArr, itemsToSort, index) {
const sortBy = sortByArr[index];
const sortDesc = sortDescArr[index];
const sorted = (index === 0 ? itemsToSort : recursionMuiltSort(sortByArr, sortDescArr, itemsToSort, index - 1)).sort((a, b) => {
let isAllSame = true;
for (let i = 0; i < index; i += 1) {
if (getItemValue(sortByArr[i], a) !== getItemValue(sortByArr[i], b)) {
isAllSame = false;
break;
}
}
if (isAllSame) {
if (getItemValue(sortBy, a) < getItemValue(sortBy, b))
return sortDesc ? 1 : -1;
if (getItemValue(sortBy, a) > getItemValue(sortBy, b))
return sortDesc ? -1 : 1;
return 0;
}
return 0;
});
return sorted;
}
const totalItems = computed(() => {

@@ -863,2 +948,7 @@ if (isServerSideMode.value)

const itemsFilteringSorted = [...itemsFiltering.value];
if (multiSort && Array.isArray(sortBy) && Array.isArray(sortDesc)) {
if (sortBy.length === 0)
return itemsFilteringSorted;
return recursionMuiltSort(sortBy, sortDesc, itemsFilteringSorted, sortBy.length - 1);
}
return itemsFilteringSorted.sort((a, b) => {

@@ -1015,9 +1105,13 @@ if (getItemValue(sortBy, a) < getItemValue(sortBy, b))

sortBy: {
type: String,
type: [String, Array],
default: ""
},
sortType: {
type: String,
type: [String, Array],
default: "asc"
},
multiSort: {
type: Boolean,
default: false
},
tableMinHeight: {

@@ -1070,3 +1164,3 @@ type: Number,

var DataTable_vue_vue_type_style_index_1_scoped_true_lang = "";
const _withScopeId = (n) => (pushScopeId("data-v-2351cc61"), n = n(), popScopeId(), n);
const _withScopeId = (n) => (pushScopeId("data-v-27767bc4"), n = n(), popScopeId(), n);
const _hoisted_1 = ["onClick"];

@@ -1077,24 +1171,28 @@ const _hoisted_2 = {

};
const _hoisted_3 = ["onClick"];
const _hoisted_3 = {
key: 3,
class: "multi-sort__number"
};
const _hoisted_4 = ["onClick"];
const _hoisted_5 = ["colspan"];
const _hoisted_6 = {
const _hoisted_5 = ["onClick"];
const _hoisted_6 = ["colspan"];
const _hoisted_7 = {
key: 0,
class: "vue3-easy-data-table__loading"
};
const _hoisted_7 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "vue3-easy-data-table__loading-mask" }, null, -1));
const _hoisted_8 = { class: "loading-entity" };
const _hoisted_9 = {
const _hoisted_8 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "vue3-easy-data-table__loading-mask" }, null, -1));
const _hoisted_9 = { class: "loading-entity" };
const _hoisted_10 = {
key: 1,
class: "vue3-easy-data-table__message"
};
const _hoisted_10 = {
const _hoisted_11 = {
key: 0,
class: "vue3-easy-data-table__footer"
};
const _hoisted_11 = {
const _hoisted_12 = {
key: 0,
class: "pagination__rows-per-page"
};
const _hoisted_12 = { class: "pagination__items-index" };
const _hoisted_13 = { class: "pagination__items-index" };
const _sfc_main = /* @__PURE__ */ defineComponent({

@@ -1121,4 +1219,4 @@ props: __spreadProps(__spreadValues({}, propsWithDefault), {

useCssVars((_ctx) => ({
"11cca481": unref(tableMinHeightPx),
"610141e2": unref(tableHeightPx)
"68c269a9": unref(tableMinHeightPx),
"dac82a32": unref(tableHeightPx)
}));

@@ -1142,2 +1240,3 @@ const {

mustSort,
multiSort,
rowsItems,

@@ -1179,3 +1278,3 @@ rowsPerPage,

updateServerOptionsRowsPerPage
} = useServerOptions(serverOptions, emits);
} = useServerOptions(serverOptions, multiSort, emits);
const {

@@ -1185,4 +1284,6 @@ clientSortOptions,

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

@@ -1199,3 +1300,3 @@ rowsItemsComputed,

toggleSelectItem
} = useTotalItems(clientSortOptions, filterOptions, isServerSideMode, items, itemsSelected, searchField, searchValue, serverItemsLength, emits);
} = useTotalItems(clientSortOptions, filterOptions, isServerSideMode, items, itemsSelected, searchField, searchValue, serverItemsLength, multiSort, emits);
const {

@@ -1341,3 +1442,4 @@ currentPaginationNumber,

class: normalizeClass(["sortType-icon", { "desc": header.sortType === "desc" }])
}, null, 2)) : createCommentVNode("", true)
}, null, 2)) : createCommentVNode("", true),
unref(multiSort) && unref(isMultiSorting)(header.value) ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(unref(getMultiSortNumber)(header.value)), 1)) : createCommentVNode("", true)
], 2))

@@ -1393,5 +1495,5 @@ ], 14, _hoisted_1);

], 64))
], 14, _hoisted_4);
], 14, _hoisted_5);
}), 128))
], 10, _hoisted_3),
], 10, _hoisted_4),
unref(ifHasExpandSlot) && unref(expandingItemIndexList).includes(index + unref(prevPageEndIndex)) ? (openBlock(), createElementBlock("tr", {

@@ -1410,3 +1512,3 @@ key: 0,

renderSlot(_ctx.$slots, "expand", normalizeProps(guardReactiveProps(item)), void 0, true)
], 8, _hoisted_5)
], 8, _hoisted_6)
], 2)) : createCommentVNode("", true)

@@ -1429,12 +1531,12 @@ ], 64);

]),
unref(loading) ? (openBlock(), createElementBlock("div", _hoisted_6, [
_hoisted_7,
createElementVNode("div", _hoisted_8, [
unref(loading) ? (openBlock(), createElementBlock("div", _hoisted_7, [
_hoisted_8,
createElementVNode("div", _hoisted_9, [
unref(ifHasLoadingSlot) ? renderSlot(_ctx.$slots, "loading", { key: 0 }, void 0, true) : (openBlock(), createBlock(Loading, { key: 1 }))
])
])) : createCommentVNode("", true),
!unref(pageItems).length && !unref(loading) ? (openBlock(), createElementBlock("div", _hoisted_9, toDisplayString(_ctx.emptyMessage), 1)) : createCommentVNode("", true)
!unref(pageItems).length && !unref(loading) ? (openBlock(), createElementBlock("div", _hoisted_10, toDisplayString(_ctx.emptyMessage), 1)) : createCommentVNode("", true)
], 2),
!_ctx.hideFooter ? (openBlock(), createElementBlock("div", _hoisted_10, [
!_ctx.hideRowsPerPage ? (openBlock(), createElementBlock("div", _hoisted_11, [
!_ctx.hideFooter ? (openBlock(), createElementBlock("div", _hoisted_11, [
!_ctx.hideRowsPerPage ? (openBlock(), createElementBlock("div", _hoisted_12, [
createTextVNode(toDisplayString(_ctx.rowsPerPageMessage) + " ", 1),

@@ -1447,3 +1549,3 @@ createVNode(RowsSelector, {

])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_12, toDisplayString(`${unref(currentPageFirstIndex)}\u2013${unref(currentPageLastIndex)}`) + " of " + toDisplayString(unref(totalItemsLength)), 1),
createElementVNode("div", _hoisted_13, toDisplayString(`${unref(currentPageFirstIndex)}\u2013${unref(currentPageLastIndex)}`) + " of " + toDisplayString(unref(totalItemsLength)), 1),
unref(ifHasPaginationSlot) ? renderSlot(_ctx.$slots, "pagination", normalizeProps(mergeProps({ key: 1 }, {

@@ -1479,3 +1581,3 @@ isFirstPage: unref(isFirstPage),

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

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

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

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

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

"private": false,
"version": "1.5.1",
"version": "1.5.2",
"types": "./types/main.d.ts",

@@ -35,3 +35,3 @@ "license": "MIT",

"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"build": "vite build",
"preview": "vite preview",

@@ -38,0 +38,0 @@ "lint": "eslint --fix 'src/**/*.{vue,html,css,js,ts}'",

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

rowsPerPage: number
sortBy?: string
sortType?: SortType
sortBy?: string | string[]
sortType?: SortType | SortType[]
}

@@ -40,0 +40,0 @@

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