vue3-easy-data-table
Advanced tools
Comparing version 1.2.8 to 1.2.9
@@ -568,22 +568,22 @@ var __defProp = Object.defineProperty; | ||
useCssVars((_ctx) => ({ | ||
"3b7cb738": unref(tableBorderColor), | ||
"70e5c15c": unref(minHeightPx), | ||
"18c92ee4": unref(tableHeightPx), | ||
"29ba3362": unref(loadingWrapperSizePx), | ||
"bfb5aa4c": unref(rowHeightPx), | ||
"25c2a7a7": unref(fontSizePx), | ||
"6765f869": unref(rowFontColor), | ||
"5dd581ac": unref(rowBackgroundColor), | ||
"a2b37d28": unref(rowBorderColor), | ||
"9aa63dd0": unref(headerFontColor), | ||
"421eaece": __props.headerBackgroundColor, | ||
"21315169": unref(sortTypeIconSizePx), | ||
"e2375228": unref(sortTypeAscIconMarginTopPx), | ||
"12b1c344": unref(sortTypeDescIconMarginTopPx), | ||
"54dd6ac4": unref(rowHoverBackgroundColor), | ||
"7d9540fa": unref(rowHoverFontColor), | ||
"0769b1ba": unref(evenRowFontColor), | ||
"3426fa64": unref(evenRowBackgroundColor), | ||
"5a8097cb": unref(footerBackgroundColor), | ||
"57e49dca": unref(footerFontColor) | ||
"b5e3ab70": unref(tableBorderColor), | ||
"6ef7fb7c": unref(minHeightPx), | ||
"db356104": unref(tableHeightPx), | ||
"79a4515f": unref(loadingWrapperSizePx), | ||
"bdc7e46c": unref(rowHeightPx), | ||
"ac28b292": unref(fontSizePx), | ||
"f569190e": unref(rowFontColor), | ||
"1c162e3a": unref(rowBackgroundColor), | ||
"2dcd8f08": unref(rowBorderColor), | ||
"72ce67f0": unref(headerFontColor), | ||
"209c9f89": __props.headerBackgroundColor, | ||
"6c324079": unref(sortTypeIconSizePx), | ||
"01cd35fc": unref(sortTypeAscIconMarginTopPx), | ||
"3e4bbd64": unref(sortTypeDescIconMarginTopPx), | ||
"49313498": unref(rowHoverBackgroundColor), | ||
"ec5b631a": unref(rowHoverFontColor), | ||
"65dc9a33": unref(evenRowFontColor), | ||
"27f9e174": unref(evenRowBackgroundColor), | ||
"c7a6e28a": unref(footerBackgroundColor), | ||
"6bd088ba": unref(footerFontColor) | ||
})); | ||
@@ -766,3 +766,4 @@ const { | ||
watch(items, () => { | ||
currentPaginationNumber.value = 1; | ||
if (!isServerSideMode.value) | ||
currentPaginationNumber.value = 1; | ||
}, { deep: true }); | ||
@@ -1067,3 +1068,3 @@ const rowsPerPageReactive = ref(isServerSideMode.value ? props.serverOptions.rowsPerPage : props.rowsPerPage); | ||
}); | ||
var DataTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fc863ed0"]]); | ||
var DataTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ecf2a4f2"]]); | ||
export { DataTable as default }; |
@@ -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 pt=Object.defineProperty,ut=Object.defineProperties;var ft=Object.getOwnPropertyDescriptors;var ie=Object.getOwnPropertySymbols;var gt=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable;var de=(e,_,f)=>_ in e?pt(e,_,{enumerable:!0,configurable:!0,writable:!0,value:f}):e[_]=f,C=(e,_)=>{for(var f in _||(_={}))gt.call(_,f)&&de(e,f,_[f]);if(ie)for(var f of ie(_))mt.call(_,f)&&de(e,f,_[f]);return e},z=(e,_)=>ut(e,ft(_));var _="",f=(r,h)=>{const a=r.__vccOpts||r;for(const[n,p]of h)a[n]=p;return a};const pe=r=>(e.pushScopeId("data-v-566775ba"),r=r(),e.popScopeId(),r),ue=["onClick"],fe=["checked"],ge=pe(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var me=f(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(r,{emit:h}){const a=r;e.useCssVars(P=>({"7f84b28f":e.unref(b)}));const n=e.computed(()=>a.status==="allSelected"),p=()=>{h("change",!n.value)},b=e.inject("themeColor");return(P,F)=>(e.openBlock(),e.createElementBlock("div",{class:"multi-select__checkbox",onClick:e.withModifiers(p,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(n),class:e.normalizeClass(r.status)},null,10,fe),ge],8,ue))}}),[["__scopeId","data-v-566775ba"]]),ht="";const _e=r=>(e.pushScopeId("data-v-39f156fd"),r=r(),e.popScopeId(),r),he=["checked"],ye=_e(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var ke=f(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(r,{emit:h}){e.useCssVars(n=>({"20cfc5a0":e.unref(a)}));const a=e.inject("themeColor");return(n,p)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:p[0]||(p[0]=e.withModifiers(b=>h("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:r.checked},null,8,he),ye]))}}),[["__scopeId","data-v-39f156fd"]]),kt="";const be=r=>(e.pushScopeId("data-v-0ed08e20"),r=r(),e.popScopeId(),r),xe={class:"easy-data-table__rows-selector"},Ce={class:"rows-input"},Se=be(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),Be=["onClick"];var Pe=f(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(r,{emit:h}){const a=r;e.useCssVars(g=>({"83c11052":e.unref(u),"6b60f418":e.unref(s),"346ac97c":e.unref(i)}));const n=e.ref(!1),p=e.ref(!1),b=e.inject("dataTable");e.watch(n,g=>{if(g&&b){const S=window.innerHeight,y=b.value.getBoundingClientRect().height,$=b.value.getBoundingClientRect().top;S-(y+$)<=100?p.value=!0:p.value=!1}});const P=e.computed({get:()=>a.modelValue,set:g=>{h("update:modelValue",g)}}),F=g=>{P.value=g,n.value=!1},O=(g,S)=>{let y=g.parentNode;for(;y!=null;){if(y.classList&&y.classList.contains(S))return!0;y=y.parentNode}return!1},T=g=>{O(g.target,"easy-data-table__rows-selector")||(n.value=!1)};e.onMounted(()=>{document.addEventListener("click",T)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",T)});const i=e.inject("themeColor"),s=e.inject("footerBackgroundColor"),u=e.inject("footerFontColor");return(g,S)=>(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:S[0]||(S[0]=y=>n.value=!n.value)},[e.createElementVNode("div",Ce,e.toDisplayString(e.unref(P)),1),Se]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:n.value,inside:p.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.rowsItems,y=>(e.openBlock(),e.createElementBlock("li",{key:y,class:e.normalizeClass({selected:y===e.unref(P)}),onClick:$=>F(y)},e.toDisplayString(y),11,Be))),128))],2)]))}}),[["__scopeId","data-v-0ed08e20"]]),xt="";const L=r=>(e.pushScopeId("data-v-969989cc"),r=r(),e.popScopeId(),r),Ne={class:"lds-ring"},we=[L(()=>e.createElementVNode("div",null,null,-1)),L(()=>e.createElementVNode("div",null,null,-1)),L(()=>e.createElementVNode("div",null,null,-1)),L(()=>e.createElementVNode("div",null,null,-1))];var $e=f(e.defineComponent({setup(r){e.useCssVars(n=>({"284c10f4":e.unref(a),"90c4d0a4":e.unref(h)}));const h=e.inject("themeColor"),a=e.inject("loadingEntitySizePx");return(n,p)=>(e.openBlock(),e.createElementBlock("div",Ne,we))}}),[["__scopeId","data-v-969989cc"]]),wt="";const Ie={class:"buttons-pagination"},Ee=["onClick"];var Ve=f(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(r,{emit:h}){const a=r;e.useCssVars(i=>({aa5730a0:e.unref(F),"24829312":e.unref(O),"98a0e762":e.unref(T)}));const n=7,p=i=>{i.type==="button"&&!i.active&&h("updatePage",i.page)},b=e.computed(()=>{const i=[];if(a.maxPaginationNumber<=n)for(let s=1;s<=a.maxPaginationNumber;s+=1)i.push({type:"button",page:s,active:s===a.currentPaginationNumber});else if([1,2,a.maxPaginationNumber,a.maxPaginationNumber-1].includes(a.currentPaginationNumber))for(let s=1;s<=n;s+=1)if(s<=3)i.push({type:"button",page:s,active:s===a.currentPaginationNumber});else if(s===4)i.push({type:"omission"});else{const u=a.maxPaginationNumber-(n-s);i.push({type:"button",page:u,active:u===a.currentPaginationNumber})}else if([3,4].includes(a.currentPaginationNumber))for(let s=1;s<=n;s+=1)s<=5?i.push({type:"button",page:s,active:s===a.currentPaginationNumber}):s===6?i.push({type:"omission"}):i.push({type:"button",page:a.maxPaginationNumber,active:a.maxPaginationNumber===a.currentPaginationNumber});else if([a.maxPaginationNumber-2,a.maxPaginationNumber-3].includes(a.currentPaginationNumber))for(let s=1;s<=n;s+=1)if(s===1)i.push({type:"button",page:1,active:a.currentPaginationNumber===1});else if(s===2)i.push({type:"omission"});else{const u=a.maxPaginationNumber-(n-s);i.push({type:"button",page:u,active:u===a.currentPaginationNumber})}else for(let s=1;s<=n;s+=1)if(s===1)i.push({type:"button",page:1,active:a.currentPaginationNumber===1});else if(s===2||s===6)i.push({type:"omission"});else if(s===7)i.push({type:"button",page:a.maxPaginationNumber,active:a.maxPaginationNumber===a.currentPaginationNumber});else{const u=4-s,g=a.currentPaginationNumber-u;i.push({type:"button",page:g,active:g===a.currentPaginationNumber})}return i}),P=e.inject("rowHeight"),F=e.computed(()=>`${P*.6}px`),O=e.inject("rowBorderColor"),T=e.inject("themeColor");return(i,s)=>(e.openBlock(),e.createElementBlock("div",Ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(u,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["item",{button:u.type==="button",active:u.type==="button"&&u.active,omission:u.type==="omission"}]),onClick:S=>p(u)},e.toDisplayString(u.type==="button"?u.page:"..."),11,Ee))),128))]))}}),[["__scopeId","data-v-4f534e20"]]),It="";const X=r=>(e.pushScopeId("data-v-c9da5286"),r=r(),e.popScopeId(),r),Fe=[X(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],Te=[X(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var ze=f(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(r,{emit:h}){const a=e.useSlots();return(n,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":r.isFirstPage}]),onClick:p[0]||(p[0]=b=>h("clickPrevPage"))},Fe,2),e.unref(a).buttonsPagination?e.renderSlot(n.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":r.isLastPage}]),onClick:p[1]||(p[1]=b=>h("clickNextPage"))},Te,2)],64))}}),[["__scopeId","data-v-c9da5286"]]),Tt="";const Oe={key:0},He=["onClick"],Le={key:1,class:"header-text__wrapper"},Re={class:"header-text"},Ae=["onClick"],De={class:"loading-entity"},Me={key:1,class:"data-table__message"},je={key:0,class:"data-table__footer"},qe={class:"footer__rows-per-page"},Je=e.createTextVNode(" rows per page: "),We={class:"footer__items-index"};var Ue=f(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},rowBorderColor:{type:String,default:"#e0e0e0"},tableBorderColor:{type:String,default:"#e0e0e0"},rowBackgroundColor:{type:String,default:"#fff"},footerBackgroundColor:{type:String,default:"#fff"},rowFontColor:{type:String,default:"#212121"},footerFontColor:{type:String,default:"#212121"},emptyMessage:{type:String,default:"No Available Data"},fixedHeader:{type:Boolean,default:!0},headerFontColor:{type:String,default:"#373737"},headerBackgroundColor:{type:String,default:"#fff"},tableFontSize:{type:Number,default:12},evenRowBackgroundColor:{type:String,default:"#fafafa"},evenRowFontColor:{type:String,default:"#212121"},headers:{type:Array,required:!0},hoverToChangeColor:{type:Boolean,default:!0},items:{type:Array,required:!0},tableHeight:{type:Number,default:()=>null},itemsSelected:{type:Array,default:null},searchField:{type:String,default:""},searchValue:{type:String,default:""},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowHoverBackgroundColor:{type:String,default:"#eee"},rowHoverFontColor:{type:String,default:"#212121"},loading:{type:Boolean,deault:!1},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},themeColor:{type:String,default:"#42b883"},dense:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},showFooter:{type:Boolean,default:!0},filterOptions:{type:Array,default:null}},emits:["update:itemsSelected","update:serverOptions","clickRow"],setup(r,{expose:h,emit:a}){const n=r;e.useCssVars(o=>({"3b7cb738":e.unref(b),"70e5c15c":e.unref(Qe),"18c92ee4":e.unref(Ke),"29ba3362":e.unref(et),bfb5aa4c:e.unref(Ge),"25c2a7a7":e.unref(y),"6765f869":e.unref(F),"5dd581ac":e.unref(s),a2b37d28:e.unref(p),"9aa63dd0":e.unref(P),"421eaece":r.headerBackgroundColor,"21315169":e.unref(Xe),e2375228:e.unref(Ye),"12b1c344":e.unref(Ze),"54dd6ac4":e.unref(O),"7d9540fa":e.unref(T),"0769b1ba":e.unref(g),"3426fa64":e.unref(u),"5a8097cb":e.unref(i),"57e49dca":e.unref(S)}));const{rowBorderColor:p,tableBorderColor:b,headerFontColor:P,rowFontColor:F,rowHoverBackgroundColor:O,rowHoverFontColor:T,footerBackgroundColor:i,rowBackgroundColor:s,evenRowBackgroundColor:u,evenRowFontColor:g,footerFontColor:S}=e.toRefs(n),y=e.computed(()=>`${n.tableFontSize}px`),$=e.computed(()=>n.tableFontSize*(n.dense?2:3)),Ge=e.computed(()=>`${$.value}px`),Ke=e.computed(()=>n.tableHeight?`${n.tableHeight}px`:null),Qe=e.computed(()=>`${$.value*5}px`),Y=e.computed(()=>Math.round(n.tableFontSize/2.5)),Xe=e.computed(()=>`${Y.value}px`),Z=e.computed(()=>Math.round(Y.value)),Ye=e.computed(()=>`-${Z.value}px`),Ze=e.computed(()=>`${Z.value}px`),ve=e.computed(()=>`${n.tableFontSize*5}px`),et=e.computed(()=>n.tableHeight?`${n.tableHeight-$.value}px`:`${n.tableFontSize*5*2}px`);e.provide("themeColor",n.themeColor),e.provide("loadingEntitySizePx",ve.value),e.provide("rowHeight",$.value),e.provide("rowBorderColor",p.value),e.provide("footerBackgroundColor",i.value),e.provide("footerFontColor",S.value);const R=e.useSlots(),tt=e.computed(()=>R.body),ot=e.computed(()=>R.pagination),nt=e.computed(()=>R.loading),v=e.ref();e.provide("dataTable",v);const d=e.computed({get:()=>{if(n.serverOptions){const{page:o,rowsPerPage:l,sortBy:t,sortType:c}=n.serverOptions;return{page:o,rowsPerPage:l,sortBy:t!=null?t:null,sortType:c!=null?c:null}}return null},set:o=>{a("update:serverOptions",o)}}),J=e.computed(()=>n.itemsSelected!==null),w=e.computed(()=>d.value!==null),rt=()=>n.sortBy!==""?{sortBy:n.sortBy,sortDesc:n.sortType==="desc"}:null,I=e.ref(rt()),W=e.computed(()=>{const o=n.headers.map(c=>{const k=c;return c.sortable&&(k.sortType="none"),d.value&&c.value===d.value.sortBy&&d.value.sortType&&(k.sortType=d.value.sortType),!w.value&&I.value&&c.value===I.value.sortBy&&(k.sortType=I.value.sortDesc?"desc":"asc"),k}),l=n.showIndex?[{text:"#",value:"index"},...o]:o;return J.value?[{text:"checkbox",value:"checkbox"},...l]:l}),ee=e.computed(()=>W.value.map(o=>o.value)),H=(o,l)=>{if(o.includes(".")){let t="";return o.split(".").forEach((k,x)=>{t=x===0?l[k]:t[k]}),t}return l[o]},at=(o,l)=>{const t=H(o,l);return Array.isArray(t)?t.join(","):t},B=e.computed({get:()=>{var o;return(o=n.itemsSelected)!=null?o:[]},set:o=>{a("update:itemsSelected",o)}}),te=e.computed(()=>{if(!w.value&&n.searchValue!==""){const o=new RegExp(n.searchValue,"i");return n.items.filter(l=>o.test(n.searchField!==""?l[n.searchField]:Object.values(l).join(" ")))}return n.items}),E=e.computed(()=>{let o=[...te.value];return n.filterOptions?(n.filterOptions.forEach(l=>{o=o.filter(t=>{const{field:c,comparison:k,criteria:x}=l;switch(k){case"=":return t[c]===x;case"!=":return t[c]!==x;case">":return t[c]>x;case"<":return t[c]<x;case"<=":return t[c]<=x;case">=":return t[c]>=x;case"between":return t[c]>=Math.min(...x)&&t[c]<=Math.max(...x);default:return t[c]===x}})}),o):te.value}),A=e.computed(()=>B.value.length===0||B.value.every(l=>E.value.findIndex(t=>JSON.stringify(l)===JSON.stringify(t))===-1)?"noneSelected":B.value.length===E.value.length&&B.value.every(t=>E.value.findIndex(c=>JSON.stringify(t)===JSON.stringify(c))!==-1)?"allSelected":"partSelected"),m=e.ref(w.value?n.serverOptions.page:1),{items:U}=e.toRefs(n);e.watch(U,()=>{m.value=1},{deep:!0});const N=e.ref(w.value?n.serverOptions.rowsPerPage:n.rowsPerPage);e.watch(N,o=>{d.value&&(d.value=z(C({},d.value),{page:1,rowsPerPage:o})),m.value=1});const lt=(o,l)=>{let t=null;l==="none"?t="asc":l==="asc"?t="desc":t=null,d.value?d.value=z(C({},d.value),{sortBy:t!==null?o:null,sortType:t}):t===null?I.value=null:I.value={sortBy:o,sortDesc:t==="desc"}},oe=e.computed(()=>{if(w.value)return n.items;if(I.value===null)return E.value;const{sortBy:o,sortDesc:l}=I.value;return[...E.value].sort((c,k)=>H(o,c)<H(o,k)?l?1:-1:H(o,c)>H(o,k)?l?-1:1:0)}),G=e.computed(()=>w.value?n.serverItemsLength:E.value.length),ne=e.computed(()=>w.value?m.value*N.value:Math.min(E.value.length,m.value*N.value)),re=e.computed(()=>(m.value-1)*N.value+1),D=e.computed(()=>Math.ceil(G.value/N.value)),M=e.computed(()=>m.value===D.value),j=e.computed(()=>m.value===1),{loading:V}=e.toRefs(n),K=()=>{if(!M.value&&!V.value)if(d.value){const o=m.value+1;d.value=z(C({},d.value),{page:o})}else m.value+=1},Q=()=>{if(!j.value&&!V.value)if(d.value){const o=m.value-1;d.value=z(C({},d.value),{page:o})}else m.value-=1},ae=o=>{V.value||(d.value?d.value=z(C({},d.value),{page:o}):m.value=o)};e.watch(V,(o,l)=>{d.value&&o===!1&&l===!0&&(m.value=d.value.page)});const le=e.computed(()=>w.value?n.items:oe.value.slice(re.value-1,ne.value)),se=e.computed(()=>N.value*(m.value-1)+1),st=e.computed(()=>N.value*m.value),q=e.computed(()=>n.showIndex?le.value.map((o,l)=>C({index:se.value+l},o)):le.value),ce=e.computed(()=>J.value?A.value==="allSelected"?q.value.map(o=>C({checkbox:!0},o)):A.value==="noneSelected"?q.value.map(o=>C({checkbox:!1},o)):q.value.map(o=>{const l=B.value.findIndex(t=>{const c=C({},o);return delete c.index,JSON.stringify(t)===JSON.stringify(c)})!==-1;return C({checkbox:l},o)}):q.value),ct=o=>{B.value=o?oe.value:[]},it=o=>{const l=o.checkbox;if(delete o.checkbox,delete o.index,l)B.value=B.value.filter(t=>JSON.stringify(t)!==JSON.stringify(o));else{const t=B.value;t.unshift(o),B.value=t}},dt=o=>{const l=C({},o);if(J.value){const{checkbox:t}=o;delete l.checkbox,l.isSelected=t}if(n.showIndex){const{index:t}=o;delete l.index,l.indexInCurrentPage=t}a("clickRow",l)};return h({clientItemsLength:G,currentPageFirstIndex:se,currentPageLastIndex:st,maxPaginationNumber:D,currentPaginationNumber:m,isLastPage:M,isFirstPage:j,nextPage:K,prevPage:Q,updatePage:ae}),(o,l)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:v,class:"vue3-easy-data-table"},[e.createElementVNode("div",{class:e.normalizeClass(["data-table__body",{"fixed-header":r.fixedHeader,"fixed-height":r.tableHeight}])},[e.createElementVNode("table",null,[e.unref(W).length?(e.openBlock(),e.createElementBlock("thead",Oe,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(W),(t,c)=>(e.openBlock(),e.createElementBlock("th",{key:c,class:e.normalizeClass({sortable:t.sortable,none:t.sortable&&t.sortType==="none",desc:t.sortable&&t.sortType==="desc",asc:t.sortable&&t.sortType==="asc"}),onClick:k=>t.sortable&&t.sortType?lt(t.value,t.sortType):null},[t.text==="checkbox"?(e.openBlock(),e.createBlock(me,{key:e.unref(A),status:e.unref(A),onChange:ct},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",Le,[e.createElementVNode("span",Re,e.toDisplayString(t.text),1),t.sortable?(e.openBlock(),e.createElementBlock("i",{key:t.sortType?t.sortType:"none",class:e.normalizeClass(["sortType-icon",{desc:t.sortType==="desc"}])},null,2)):e.createCommentVNode("",!0)]))],10,He))),128))])])):e.createCommentVNode("",!0),e.unref(tt)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(U).length&&e.unref(ee).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":r.alternating,"hover-to-change-color":r.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ce),t=>(e.openBlock(),e.createElementBlock("tr",{key:JSON.stringify(t),onClick:c=>dt(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ee),(c,k)=>(e.openBlock(),e.createElementBlock("td",{key:k},[e.unref(R)[c]?e.renderSlot(o.$slots,c,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):c==="checkbox"?(e.openBlock(),e.createBlock(ke,{key:1,checked:t[c],onChange:x=>it(t)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(at(c,t)),1)],64))]))),128))],8,Ae))),128))],2)):e.createCommentVNode("",!0)],64))]),e.unref(V)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-wrapper",{"initial-loading":!e.unref(U).length&&e.unref(V)}])},[e.createElementVNode("div",{class:e.normalizeClass(["loading-mask",{"no-footer":!r.showFooter}])},null,2),e.createElementVNode("div",De,[e.unref(nt)?e.renderSlot(o.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock($e,{key:1}))])],2)):e.createCommentVNode("",!0),!e.unref(ce).length&&!e.unref(V)?(e.openBlock(),e.createElementBlock("div",Me,e.toDisplayString(r.emptyMessage),1)):e.createCommentVNode("",!0)],2),r.showFooter?(e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",qe,[Je,e.createVNode(Pe,{modelValue:N.value,"onUpdate:modelValue":l[0]||(l[0]=t=>N.value=t),"rows-items":r.rowsItems},null,8,["modelValue","rows-items"])]),e.createElementVNode("div",We,e.toDisplayString(`${e.unref(re)}-${e.unref(ne)}`)+" of "+e.toDisplayString(e.unref(G)),1),e.unref(ot)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:0},{isFirstPage:e.unref(j),isLastPage:e.unref(M),currentPaginationNumber:m.value,maxPaginationNumber:e.unref(D),nextPage:K,prevPage:Q})),void 0,!0):(e.openBlock(),e.createBlock(ze,{key:1,"is-first-page":e.unref(j),"is-last-page":e.unref(M),onClickNextPage:K,onClickPrevPage:Q},e.createSlots({_:2},[r.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(Ve,{"current-pagination-number":m.value,"max-pagination-number":e.unref(D),onUpdatePage:ae},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))])):e.createCommentVNode("",!0)],512))}}),[["__scopeId","data-v-fc863ed0"]]);return Ue}); | ||
(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 pt=Object.defineProperty,ut=Object.defineProperties;var ft=Object.getOwnPropertyDescriptors;var ie=Object.getOwnPropertySymbols;var gt=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable;var de=(e,_,f)=>_ in e?pt(e,_,{enumerable:!0,configurable:!0,writable:!0,value:f}):e[_]=f,C=(e,_)=>{for(var f in _||(_={}))gt.call(_,f)&&de(e,f,_[f]);if(ie)for(var f of ie(_))mt.call(_,f)&&de(e,f,_[f]);return e},z=(e,_)=>ut(e,ft(_));var _="",f=(r,h)=>{const a=r.__vccOpts||r;for(const[n,p]of h)a[n]=p;return a};const pe=r=>(e.pushScopeId("data-v-566775ba"),r=r(),e.popScopeId(),r),ue=["onClick"],fe=["checked"],ge=pe(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var me=f(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(r,{emit:h}){const a=r;e.useCssVars(P=>({"7f84b28f":e.unref(b)}));const n=e.computed(()=>a.status==="allSelected"),p=()=>{h("change",!n.value)},b=e.inject("themeColor");return(P,F)=>(e.openBlock(),e.createElementBlock("div",{class:"multi-select__checkbox",onClick:e.withModifiers(p,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(n),class:e.normalizeClass(r.status)},null,10,fe),ge],8,ue))}}),[["__scopeId","data-v-566775ba"]]),ht="";const _e=r=>(e.pushScopeId("data-v-39f156fd"),r=r(),e.popScopeId(),r),he=["checked"],ye=_e(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var ke=f(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(r,{emit:h}){e.useCssVars(n=>({"20cfc5a0":e.unref(a)}));const a=e.inject("themeColor");return(n,p)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:p[0]||(p[0]=e.withModifiers(b=>h("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:r.checked},null,8,he),ye]))}}),[["__scopeId","data-v-39f156fd"]]),kt="";const be=r=>(e.pushScopeId("data-v-0ed08e20"),r=r(),e.popScopeId(),r),xe={class:"easy-data-table__rows-selector"},Ce={class:"rows-input"},Se=be(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),Be=["onClick"];var Pe=f(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(r,{emit:h}){const a=r;e.useCssVars(g=>({"83c11052":e.unref(u),"6b60f418":e.unref(s),"346ac97c":e.unref(i)}));const n=e.ref(!1),p=e.ref(!1),b=e.inject("dataTable");e.watch(n,g=>{if(g&&b){const S=window.innerHeight,y=b.value.getBoundingClientRect().height,$=b.value.getBoundingClientRect().top;S-(y+$)<=100?p.value=!0:p.value=!1}});const P=e.computed({get:()=>a.modelValue,set:g=>{h("update:modelValue",g)}}),F=g=>{P.value=g,n.value=!1},O=(g,S)=>{let y=g.parentNode;for(;y!=null;){if(y.classList&&y.classList.contains(S))return!0;y=y.parentNode}return!1},T=g=>{O(g.target,"easy-data-table__rows-selector")||(n.value=!1)};e.onMounted(()=>{document.addEventListener("click",T)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",T)});const i=e.inject("themeColor"),s=e.inject("footerBackgroundColor"),u=e.inject("footerFontColor");return(g,S)=>(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:S[0]||(S[0]=y=>n.value=!n.value)},[e.createElementVNode("div",Ce,e.toDisplayString(e.unref(P)),1),Se]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:n.value,inside:p.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.rowsItems,y=>(e.openBlock(),e.createElementBlock("li",{key:y,class:e.normalizeClass({selected:y===e.unref(P)}),onClick:$=>F(y)},e.toDisplayString(y),11,Be))),128))],2)]))}}),[["__scopeId","data-v-0ed08e20"]]),xt="";const L=r=>(e.pushScopeId("data-v-969989cc"),r=r(),e.popScopeId(),r),Ne={class:"lds-ring"},we=[L(()=>e.createElementVNode("div",null,null,-1)),L(()=>e.createElementVNode("div",null,null,-1)),L(()=>e.createElementVNode("div",null,null,-1)),L(()=>e.createElementVNode("div",null,null,-1))];var $e=f(e.defineComponent({setup(r){e.useCssVars(n=>({"284c10f4":e.unref(a),"90c4d0a4":e.unref(h)}));const h=e.inject("themeColor"),a=e.inject("loadingEntitySizePx");return(n,p)=>(e.openBlock(),e.createElementBlock("div",Ne,we))}}),[["__scopeId","data-v-969989cc"]]),wt="";const Ie={class:"buttons-pagination"},Ee=["onClick"];var Ve=f(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(r,{emit:h}){const a=r;e.useCssVars(i=>({aa5730a0:e.unref(F),"24829312":e.unref(O),"98a0e762":e.unref(T)}));const n=7,p=i=>{i.type==="button"&&!i.active&&h("updatePage",i.page)},b=e.computed(()=>{const i=[];if(a.maxPaginationNumber<=n)for(let s=1;s<=a.maxPaginationNumber;s+=1)i.push({type:"button",page:s,active:s===a.currentPaginationNumber});else if([1,2,a.maxPaginationNumber,a.maxPaginationNumber-1].includes(a.currentPaginationNumber))for(let s=1;s<=n;s+=1)if(s<=3)i.push({type:"button",page:s,active:s===a.currentPaginationNumber});else if(s===4)i.push({type:"omission"});else{const u=a.maxPaginationNumber-(n-s);i.push({type:"button",page:u,active:u===a.currentPaginationNumber})}else if([3,4].includes(a.currentPaginationNumber))for(let s=1;s<=n;s+=1)s<=5?i.push({type:"button",page:s,active:s===a.currentPaginationNumber}):s===6?i.push({type:"omission"}):i.push({type:"button",page:a.maxPaginationNumber,active:a.maxPaginationNumber===a.currentPaginationNumber});else if([a.maxPaginationNumber-2,a.maxPaginationNumber-3].includes(a.currentPaginationNumber))for(let s=1;s<=n;s+=1)if(s===1)i.push({type:"button",page:1,active:a.currentPaginationNumber===1});else if(s===2)i.push({type:"omission"});else{const u=a.maxPaginationNumber-(n-s);i.push({type:"button",page:u,active:u===a.currentPaginationNumber})}else for(let s=1;s<=n;s+=1)if(s===1)i.push({type:"button",page:1,active:a.currentPaginationNumber===1});else if(s===2||s===6)i.push({type:"omission"});else if(s===7)i.push({type:"button",page:a.maxPaginationNumber,active:a.maxPaginationNumber===a.currentPaginationNumber});else{const u=4-s,g=a.currentPaginationNumber-u;i.push({type:"button",page:g,active:g===a.currentPaginationNumber})}return i}),P=e.inject("rowHeight"),F=e.computed(()=>`${P*.6}px`),O=e.inject("rowBorderColor"),T=e.inject("themeColor");return(i,s)=>(e.openBlock(),e.createElementBlock("div",Ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(u,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["item",{button:u.type==="button",active:u.type==="button"&&u.active,omission:u.type==="omission"}]),onClick:S=>p(u)},e.toDisplayString(u.type==="button"?u.page:"..."),11,Ee))),128))]))}}),[["__scopeId","data-v-4f534e20"]]),It="";const X=r=>(e.pushScopeId("data-v-c9da5286"),r=r(),e.popScopeId(),r),Fe=[X(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],Te=[X(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var ze=f(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(r,{emit:h}){const a=e.useSlots();return(n,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":r.isFirstPage}]),onClick:p[0]||(p[0]=b=>h("clickPrevPage"))},Fe,2),e.unref(a).buttonsPagination?e.renderSlot(n.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":r.isLastPage}]),onClick:p[1]||(p[1]=b=>h("clickNextPage"))},Te,2)],64))}}),[["__scopeId","data-v-c9da5286"]]),Tt="";const Oe={key:0},He=["onClick"],Le={key:1,class:"header-text__wrapper"},Re={class:"header-text"},Ae=["onClick"],De={class:"loading-entity"},Me={key:1,class:"data-table__message"},je={key:0,class:"data-table__footer"},qe={class:"footer__rows-per-page"},Je=e.createTextVNode(" rows per page: "),We={class:"footer__items-index"};var Ue=f(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},rowBorderColor:{type:String,default:"#e0e0e0"},tableBorderColor:{type:String,default:"#e0e0e0"},rowBackgroundColor:{type:String,default:"#fff"},footerBackgroundColor:{type:String,default:"#fff"},rowFontColor:{type:String,default:"#212121"},footerFontColor:{type:String,default:"#212121"},emptyMessage:{type:String,default:"No Available Data"},fixedHeader:{type:Boolean,default:!0},headerFontColor:{type:String,default:"#373737"},headerBackgroundColor:{type:String,default:"#fff"},tableFontSize:{type:Number,default:12},evenRowBackgroundColor:{type:String,default:"#fafafa"},evenRowFontColor:{type:String,default:"#212121"},headers:{type:Array,required:!0},hoverToChangeColor:{type:Boolean,default:!0},items:{type:Array,required:!0},tableHeight:{type:Number,default:()=>null},itemsSelected:{type:Array,default:null},searchField:{type:String,default:""},searchValue:{type:String,default:""},rowsPerPage:{type:Number,default:25},rowsItems:{type:Array,default:()=>[25,50,100]},rowHoverBackgroundColor:{type:String,default:"#eee"},rowHoverFontColor:{type:String,default:"#212121"},loading:{type:Boolean,deault:!1},serverOptions:{type:Object,default:null},serverItemsLength:{type:Number,default:0},sortBy:{type:String,default:""},sortType:{type:String,default:"asc"},themeColor:{type:String,default:"#42b883"},dense:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},showFooter:{type:Boolean,default:!0},filterOptions:{type:Array,default:null}},emits:["update:itemsSelected","update:serverOptions","clickRow"],setup(r,{expose:h,emit:a}){const n=r;e.useCssVars(o=>({b5e3ab70:e.unref(b),"6ef7fb7c":e.unref(Qe),db356104:e.unref(Ke),"79a4515f":e.unref(et),bdc7e46c:e.unref(Ge),ac28b292:e.unref(y),f569190e:e.unref(F),"1c162e3a":e.unref(s),"2dcd8f08":e.unref(p),"72ce67f0":e.unref(P),"209c9f89":r.headerBackgroundColor,"6c324079":e.unref(Xe),"01cd35fc":e.unref(Ye),"3e4bbd64":e.unref(Ze),"49313498":e.unref(O),ec5b631a:e.unref(T),"65dc9a33":e.unref(g),"27f9e174":e.unref(u),c7a6e28a:e.unref(i),"6bd088ba":e.unref(S)}));const{rowBorderColor:p,tableBorderColor:b,headerFontColor:P,rowFontColor:F,rowHoverBackgroundColor:O,rowHoverFontColor:T,footerBackgroundColor:i,rowBackgroundColor:s,evenRowBackgroundColor:u,evenRowFontColor:g,footerFontColor:S}=e.toRefs(n),y=e.computed(()=>`${n.tableFontSize}px`),$=e.computed(()=>n.tableFontSize*(n.dense?2:3)),Ge=e.computed(()=>`${$.value}px`),Ke=e.computed(()=>n.tableHeight?`${n.tableHeight}px`:null),Qe=e.computed(()=>`${$.value*5}px`),Y=e.computed(()=>Math.round(n.tableFontSize/2.5)),Xe=e.computed(()=>`${Y.value}px`),Z=e.computed(()=>Math.round(Y.value)),Ye=e.computed(()=>`-${Z.value}px`),Ze=e.computed(()=>`${Z.value}px`),ve=e.computed(()=>`${n.tableFontSize*5}px`),et=e.computed(()=>n.tableHeight?`${n.tableHeight-$.value}px`:`${n.tableFontSize*5*2}px`);e.provide("themeColor",n.themeColor),e.provide("loadingEntitySizePx",ve.value),e.provide("rowHeight",$.value),e.provide("rowBorderColor",p.value),e.provide("footerBackgroundColor",i.value),e.provide("footerFontColor",S.value);const R=e.useSlots(),tt=e.computed(()=>R.body),ot=e.computed(()=>R.pagination),nt=e.computed(()=>R.loading),v=e.ref();e.provide("dataTable",v);const d=e.computed({get:()=>{if(n.serverOptions){const{page:o,rowsPerPage:l,sortBy:t,sortType:c}=n.serverOptions;return{page:o,rowsPerPage:l,sortBy:t!=null?t:null,sortType:c!=null?c:null}}return null},set:o=>{a("update:serverOptions",o)}}),J=e.computed(()=>n.itemsSelected!==null),N=e.computed(()=>d.value!==null),rt=()=>n.sortBy!==""?{sortBy:n.sortBy,sortDesc:n.sortType==="desc"}:null,I=e.ref(rt()),W=e.computed(()=>{const o=n.headers.map(c=>{const k=c;return c.sortable&&(k.sortType="none"),d.value&&c.value===d.value.sortBy&&d.value.sortType&&(k.sortType=d.value.sortType),!N.value&&I.value&&c.value===I.value.sortBy&&(k.sortType=I.value.sortDesc?"desc":"asc"),k}),l=n.showIndex?[{text:"#",value:"index"},...o]:o;return J.value?[{text:"checkbox",value:"checkbox"},...l]:l}),ee=e.computed(()=>W.value.map(o=>o.value)),H=(o,l)=>{if(o.includes(".")){let t="";return o.split(".").forEach((k,x)=>{t=x===0?l[k]:t[k]}),t}return l[o]},at=(o,l)=>{const t=H(o,l);return Array.isArray(t)?t.join(","):t},B=e.computed({get:()=>{var o;return(o=n.itemsSelected)!=null?o:[]},set:o=>{a("update:itemsSelected",o)}}),te=e.computed(()=>{if(!N.value&&n.searchValue!==""){const o=new RegExp(n.searchValue,"i");return n.items.filter(l=>o.test(n.searchField!==""?l[n.searchField]:Object.values(l).join(" ")))}return n.items}),E=e.computed(()=>{let o=[...te.value];return n.filterOptions?(n.filterOptions.forEach(l=>{o=o.filter(t=>{const{field:c,comparison:k,criteria:x}=l;switch(k){case"=":return t[c]===x;case"!=":return t[c]!==x;case">":return t[c]>x;case"<":return t[c]<x;case"<=":return t[c]<=x;case">=":return t[c]>=x;case"between":return t[c]>=Math.min(...x)&&t[c]<=Math.max(...x);default:return t[c]===x}})}),o):te.value}),A=e.computed(()=>B.value.length===0||B.value.every(l=>E.value.findIndex(t=>JSON.stringify(l)===JSON.stringify(t))===-1)?"noneSelected":B.value.length===E.value.length&&B.value.every(t=>E.value.findIndex(c=>JSON.stringify(t)===JSON.stringify(c))!==-1)?"allSelected":"partSelected"),m=e.ref(N.value?n.serverOptions.page:1),{items:U}=e.toRefs(n);e.watch(U,()=>{N.value||(m.value=1)},{deep:!0});const w=e.ref(N.value?n.serverOptions.rowsPerPage:n.rowsPerPage);e.watch(w,o=>{d.value&&(d.value=z(C({},d.value),{page:1,rowsPerPage:o})),m.value=1});const lt=(o,l)=>{let t=null;l==="none"?t="asc":l==="asc"?t="desc":t=null,d.value?d.value=z(C({},d.value),{sortBy:t!==null?o:null,sortType:t}):t===null?I.value=null:I.value={sortBy:o,sortDesc:t==="desc"}},oe=e.computed(()=>{if(N.value)return n.items;if(I.value===null)return E.value;const{sortBy:o,sortDesc:l}=I.value;return[...E.value].sort((c,k)=>H(o,c)<H(o,k)?l?1:-1:H(o,c)>H(o,k)?l?-1:1:0)}),G=e.computed(()=>N.value?n.serverItemsLength:E.value.length),ne=e.computed(()=>N.value?m.value*w.value:Math.min(E.value.length,m.value*w.value)),re=e.computed(()=>(m.value-1)*w.value+1),D=e.computed(()=>Math.ceil(G.value/w.value)),M=e.computed(()=>m.value===D.value),j=e.computed(()=>m.value===1),{loading:V}=e.toRefs(n),K=()=>{if(!M.value&&!V.value)if(d.value){const o=m.value+1;d.value=z(C({},d.value),{page:o})}else m.value+=1},Q=()=>{if(!j.value&&!V.value)if(d.value){const o=m.value-1;d.value=z(C({},d.value),{page:o})}else m.value-=1},ae=o=>{V.value||(d.value?d.value=z(C({},d.value),{page:o}):m.value=o)};e.watch(V,(o,l)=>{d.value&&o===!1&&l===!0&&(m.value=d.value.page)});const le=e.computed(()=>N.value?n.items:oe.value.slice(re.value-1,ne.value)),se=e.computed(()=>w.value*(m.value-1)+1),st=e.computed(()=>w.value*m.value),q=e.computed(()=>n.showIndex?le.value.map((o,l)=>C({index:se.value+l},o)):le.value),ce=e.computed(()=>J.value?A.value==="allSelected"?q.value.map(o=>C({checkbox:!0},o)):A.value==="noneSelected"?q.value.map(o=>C({checkbox:!1},o)):q.value.map(o=>{const l=B.value.findIndex(t=>{const c=C({},o);return delete c.index,JSON.stringify(t)===JSON.stringify(c)})!==-1;return C({checkbox:l},o)}):q.value),ct=o=>{B.value=o?oe.value:[]},it=o=>{const l=o.checkbox;if(delete o.checkbox,delete o.index,l)B.value=B.value.filter(t=>JSON.stringify(t)!==JSON.stringify(o));else{const t=B.value;t.unshift(o),B.value=t}},dt=o=>{const l=C({},o);if(J.value){const{checkbox:t}=o;delete l.checkbox,l.isSelected=t}if(n.showIndex){const{index:t}=o;delete l.index,l.indexInCurrentPage=t}a("clickRow",l)};return h({clientItemsLength:G,currentPageFirstIndex:se,currentPageLastIndex:st,maxPaginationNumber:D,currentPaginationNumber:m,isLastPage:M,isFirstPage:j,nextPage:K,prevPage:Q,updatePage:ae}),(o,l)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataTable",ref:v,class:"vue3-easy-data-table"},[e.createElementVNode("div",{class:e.normalizeClass(["data-table__body",{"fixed-header":r.fixedHeader,"fixed-height":r.tableHeight}])},[e.createElementVNode("table",null,[e.unref(W).length?(e.openBlock(),e.createElementBlock("thead",Oe,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(W),(t,c)=>(e.openBlock(),e.createElementBlock("th",{key:c,class:e.normalizeClass({sortable:t.sortable,none:t.sortable&&t.sortType==="none",desc:t.sortable&&t.sortType==="desc",asc:t.sortable&&t.sortType==="asc"}),onClick:k=>t.sortable&&t.sortType?lt(t.value,t.sortType):null},[t.text==="checkbox"?(e.openBlock(),e.createBlock(me,{key:e.unref(A),status:e.unref(A),onChange:ct},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",Le,[e.createElementVNode("span",Re,e.toDisplayString(t.text),1),t.sortable?(e.openBlock(),e.createElementBlock("i",{key:t.sortType?t.sortType:"none",class:e.normalizeClass(["sortType-icon",{desc:t.sortType==="desc"}])},null,2)):e.createCommentVNode("",!0)]))],10,He))),128))])])):e.createCommentVNode("",!0),e.unref(tt)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(U).length&&e.unref(ee).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":r.alternating,"hover-to-change-color":r.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ce),t=>(e.openBlock(),e.createElementBlock("tr",{key:JSON.stringify(t),onClick:c=>dt(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ee),(c,k)=>(e.openBlock(),e.createElementBlock("td",{key:k},[e.unref(R)[c]?e.renderSlot(o.$slots,c,e.normalizeProps(e.mergeProps({key:0},t)),void 0,!0):c==="checkbox"?(e.openBlock(),e.createBlock(ke,{key:1,checked:t[c],onChange:x=>it(t)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(at(c,t)),1)],64))]))),128))],8,Ae))),128))],2)):e.createCommentVNode("",!0)],64))]),e.unref(V)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-wrapper",{"initial-loading":!e.unref(U).length&&e.unref(V)}])},[e.createElementVNode("div",{class:e.normalizeClass(["loading-mask",{"no-footer":!r.showFooter}])},null,2),e.createElementVNode("div",De,[e.unref(nt)?e.renderSlot(o.$slots,"loading",{key:0},void 0,!0):(e.openBlock(),e.createBlock($e,{key:1}))])],2)):e.createCommentVNode("",!0),!e.unref(ce).length&&!e.unref(V)?(e.openBlock(),e.createElementBlock("div",Me,e.toDisplayString(r.emptyMessage),1)):e.createCommentVNode("",!0)],2),r.showFooter?(e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",qe,[Je,e.createVNode(Pe,{modelValue:w.value,"onUpdate:modelValue":l[0]||(l[0]=t=>w.value=t),"rows-items":r.rowsItems},null,8,["modelValue","rows-items"])]),e.createElementVNode("div",We,e.toDisplayString(`${e.unref(re)}-${e.unref(ne)}`)+" of "+e.toDisplayString(e.unref(G)),1),e.unref(ot)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:0},{isFirstPage:e.unref(j),isLastPage:e.unref(M),currentPaginationNumber:m.value,maxPaginationNumber:e.unref(D),nextPage:K,prevPage:Q})),void 0,!0):(e.openBlock(),e.createBlock(ze,{key:1,"is-first-page":e.unref(j),"is-last-page":e.unref(M),onClickNextPage:K,onClickPrevPage:Q},e.createSlots({_:2},[r.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(Ve,{"current-pagination-number":m.value,"max-pagination-number":e.unref(D),onUpdatePage:ae},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))])):e.createCommentVNode("",!0)],512))}}),[["__scopeId","data-v-ecf2a4f2"]]);return Ue}); |
@@ -6,3 +6,3 @@ { | ||
"private": false, | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"types": "./types/main.d.ts", | ||
@@ -9,0 +9,0 @@ "license": "MIT", |
@@ -81,4 +81,6 @@ <p align="center"> | ||
## Todo | ||
1. Fixed specific columns | ||
1. Make table header customizable 🎛️. | ||
1. Fixed specific columns. | ||
2. Migrate from color properties to css variables. | ||
3. Make table header customizable 🎛️. | ||
4. Vitual table rows. | ||
@@ -85,0 +87,0 @@ ## ⭐ Stargazers |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80455
1225
93