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.0.26 to 1.0.27

8

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

@@ -195,5 +195,5 @@ var __defProp = Object.defineProperty;

useCssVars((_ctx) => ({
"e0267a50": unref(borderColor),
"6e139f9a": unref(buttonSizePx),
"c360928e": unref(themeColor)
"6949e965": unref(buttonSizePx),
"3d3093ad": unref(borderColor),
"5993f744": unref(themeColor)
}));

@@ -329,3 +329,3 @@ const totalVisible = 7;

});
var ButtonsPagination = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-69ff0f2b"]]);
var ButtonsPagination = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-5cf6ad2e"]]);
var PaginationArrows_vue_vue_type_style_index_0_scoped_true_lang = "";

@@ -332,0 +332,0 @@ const _withScopeId = (n) => (pushScopeId("data-v-c9da5286"), n = n(), popScopeId(), n);

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

(function(e,f){typeof exports=="object"&&typeof module!="undefined"?module.exports=f(require("vue")):typeof define=="function"&&define.amd?define(["vue"],f):(e=typeof globalThis!="undefined"?globalThis:e||self,e["vue3-easy-data-table"]=f(e.Vue))})(this,function(e){"use strict";var Qe=Object.defineProperty,Xe=Object.defineProperties;var Ye=Object.getOwnPropertyDescriptors;var Y=Object.getOwnPropertySymbols;var Ze=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var Z=(e,f,u)=>f in e?Qe(e,f,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[f]=u,b=(e,f)=>{for(var u in f||(f={}))Ze.call(f,u)&&Z(e,u,f[u]);if(Y)for(var u of Y(f))ve.call(f,u)&&Z(e,u,f[u]);return e},V=(e,f)=>Xe(e,Ye(f));var f="",u=(a,m)=>{const r=a.__vccOpts||a;for(const[t,p]of m)r[t]=p;return r};const v=a=>(e.pushScopeId("data-v-566775ba"),a=a(),e.popScopeId(),a),ee=["onClick"],te=["checked"],oe=v(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var ne=u(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(a,{emit:m}){const r=a;e.useCssVars(B=>({"7f84b28f":e.unref(y)}));const t=e.computed(()=>r.status==="allSelected"),p=()=>{m("change",!t.value)},y=e.inject("themeColor");return(B,S)=>(e.openBlock(),e.createElementBlock("div",{class:"multi-select__checkbox",onClick:e.withModifiers(p,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(t),class:e.normalizeClass(a.status)},null,10,te),oe],8,ee))}}),[["__scopeId","data-v-566775ba"]]),tt="";const ae=a=>(e.pushScopeId("data-v-39f156fd"),a=a(),e.popScopeId(),a),re=["checked"],se=ae(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var le=u(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(a,{emit:m}){e.useCssVars(t=>({"20cfc5a0":e.unref(r)}));const r=e.inject("themeColor");return(t,p)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:p[0]||(p[0]=e.withModifiers(y=>m("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:a.checked},null,8,re),se]))}}),[["__scopeId","data-v-39f156fd"]]),nt="";const ce=a=>(e.pushScopeId("data-v-14bcddac"),a=a(),e.popScopeId(),a),ie={class:"easy-data-table__rows-selector"},de={class:"rows-input"},pe=ce(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),ue=["onClick"];var fe=u(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(a,{emit:m}){const r=a;e.useCssVars(l=>({df3a4a04:e.unref($),ba579354:e.unref(E)}));const t=e.ref(!1),p=e.computed({get:()=>r.modelValue,set:l=>{m("update:modelValue",l)}}),y=l=>{p.value=l,t.value=!1},B=(l,s)=>{let c=l.parentNode;for(;c!=null;){if(c.classList&&c.classList.contains(s))return!0;c=c.parentNode}return!1},S=l=>{B(l.target,"easy-data-table__rows-selector")||(t.value=!1)};e.onMounted(()=>{document.addEventListener("click",S)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",S)});const E=e.inject("themeColor"),$=e.inject("footerBackgroundColor");return(l,s)=>(e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:s[0]||(s[0]=c=>t.value=!t.value)},[e.createElementVNode("div",de,e.toDisplayString(e.unref(p)),1),pe]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:t.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.rowsItems,c=>(e.openBlock(),e.createElementBlock("li",{key:c,class:e.normalizeClass({selected:c===e.unref(p)}),onClick:P=>y(c)},e.toDisplayString(c),11,ue))),128))],2)]))}}),[["__scopeId","data-v-14bcddac"]]),rt="";const me={class:"loader-line"};var ge=u(e.defineComponent({setup(a){e.useCssVars(r=>({"38295e65":e.unref(m)}));const m=e.inject("themeColor");return(r,t)=>(e.openBlock(),e.createElementBlock("div",me))}}),[["__scopeId","data-v-1ec0ad4e"]]),lt="";const _e={class:"buttons-pagination"},he=["onClick"];var ye=u(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(a,{emit:m}){const r=a;e.useCssVars(l=>({e0267a50:e.unref(E),"6e139f9a":e.unref(S),c360928e:e.unref($)}));const t=7,p=l=>{l.type==="button"&&!l.active&&m("updatePage",l.page)},y=e.computed(()=>{const l=[];if(r.maxPaginationNumber<=t)for(let s=1;s<=r.maxPaginationNumber;s+=1)l.push({type:"button",page:s,active:s===r.currentPaginationNumber});else if([1,2,r.maxPaginationNumber,r.maxPaginationNumber-1].includes(r.currentPaginationNumber))for(let s=1;s<=t;s+=1)if(s<=3)l.push({type:"button",page:s,active:s===r.currentPaginationNumber});else if(s===4)l.push({type:"omission"});else{const c=r.maxPaginationNumber-(t-s);l.push({type:"button",page:c,active:c===r.currentPaginationNumber})}else if([3,4].includes(r.currentPaginationNumber))for(let s=1;s<=t;s+=1)s<=5?l.push({type:"button",page:s,active:s===r.currentPaginationNumber}):s===6?l.push({type:"omission"}):l.push({type:"button",page:r.maxPaginationNumber,active:r.maxPaginationNumber===r.currentPaginationNumber});else if([r.maxPaginationNumber-2,r.maxPaginationNumber-3].includes(r.currentPaginationNumber))for(let s=1;s<=t;s+=1)if(s===1)l.push({type:"button",page:1,active:r.currentPaginationNumber===1});else if(s===2)l.push({type:"omission"});else{const c=r.maxPaginationNumber-(t-s);l.push({type:"button",page:c,active:c===r.currentPaginationNumber})}else for(let s=1;s<=t;s+=1)if(s===1)l.push({type:"button",page:1,active:r.currentPaginationNumber===1});else if(s===2||s===6)l.push({type:"omission"});else if(s===7)l.push({type:"button",page:r.maxPaginationNumber,active:r.maxPaginationNumber===r.currentPaginationNumber});else{const c=4-s,P=r.currentPaginationNumber-c;l.push({type:"button",page:P,active:P===r.currentPaginationNumber})}return l}),B=e.inject("rowHeight"),S=e.computed(()=>`${B*.6}px`),E=e.inject("borderColor"),$=e.inject("themeColor");return(l,s)=>(e.openBlock(),e.createElementBlock("div",_e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),(c,P)=>(e.openBlock(),e.createElementBlock("div",{key:P,class:e.normalizeClass(["item",{button:c.type==="button",active:c.type==="button"&&c.active,omission:c.type==="omission"}]),onClick:q=>p(c)},e.toDisplayString(c.type==="button"?c.page:"..."),11,he))),128))]))}}),[["__scopeId","data-v-69ff0f2b"]]),it="";const j=a=>(e.pushScopeId("data-v-c9da5286"),a=a(),e.popScopeId(),a),ke=[j(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],be=[j(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var Ce=u(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(a,{emit:m}){const r=e.useSlots();return(t,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":a.isFirstPage}]),onClick:p[0]||(p[0]=y=>m("clickPrevPage"))},ke,2),e.unref(r).buttonsPagination?e.renderSlot(t.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":a.isLastPage}]),onClick:p[1]||(p[1]=y=>m("clickNextPage"))},be,2)],64))}}),[["__scopeId","data-v-c9da5286"]]);const xe={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48"},Be=[e.createElementVNode("path",{d:"M576 234.688V1024H448V234.688L213.312 469.312 128 384 512 0l384 384-85.312 85.312L576 234.688z",fill:"#373D41"},null,-1)];function Se(a,m){return e.openBlock(),e.createElementBlock("svg",xe,Be)}var Pe={render:Se},mt="";const Ne={class:"data-table"},we={key:0},$e=["onClick"],Ve={key:1,class:"header-text__wrapper"},Ee={class:"header-text"},Ie=["colspan"],Fe={key:0,class:"data-table__message"},Le={key:1,class:"data-table__message"},Te={class:"data-table__footer"},Oe={class:"footer__rows-per-page"},ze=e.createTextVNode(" rows per page: "),De={class:"footer__items-index"};var He=u(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},borderColor:{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"},bodyFontSize:{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},maxHeight:{type:Number,default:()=>null},wrapLines:{type:Boolean,default:!1},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},loadingMessage:{type:String,default:"Loading, please wait."},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}},emits:["update:itemsSelected","update:serverOptions"],setup(a,{expose:m,emit:r}){const t=a;e.useCssVars(o=>({"313b2afd":e.unref(p),"4aa0f779":e.unref(Ae),"6d2efb16":e.unref(l),"07a765f2":e.unref(q),"0a4f9422":e.unref(Re),"180a59ad":e.unref(y),"7f56c524":a.headerBackgroundColor,"6d177e59":e.unref(S),"451706d8":e.unref(E),"63144ff4":e.unref(B),"429cc12e":e.unref(c),"7f41a02f":e.unref(s),"3be48ca0":e.unref($),"857bd342":e.unref(P)}));const{borderColor:p,headerFontColor:y,rowFontColor:B,rowHoverBackgroundColor:S,rowHoverFontColor:E,footerBackgroundColor:$,rowBackgroundColor:l,evenRowBackgroundColor:s,evenRowFontColor:c,footerFontColor:P}=e.toRefs(t),q=e.computed(()=>`${t.bodyFontSize}px`),J=e.computed(()=>t.bodyFontSize*(t.dense?2:3)),Re=e.computed(()=>`${J.value}px`),Ae=e.computed(()=>t.maxHeight?`${t.maxHeight}px`:null);e.provide("themeColor",t.themeColor),e.provide("rowHeight",J.value),e.provide("borderColor",p.value),e.provide("footerBackgroundColor",$.value);const D=e.useSlots(),Me=e.computed(()=>D.body),je=e.computed(()=>D.pagination),h=e.computed({get:()=>{if(t.serverOptions){const{page:o,rowsPerPage:i,sortBy:n,sortType:d}=t.serverOptions;return{page:o,rowsPerPage:i,sortBy:n!=null?n:null,sortType:d!=null?d:null}}return{page:1,rowsPerPage:25,sortBy:null,sortType:null}},set:o=>{r("update:serverOptions",o)}}),W=e.computed(()=>t.itemsSelected!==null),_=e.computed(()=>t.serverOptions!==null),qe=()=>t.sortBy!==""?{sortBy:t.sortBy,sortDesc:t.sortType==="desc"}:null,N=e.ref(qe()),H=e.computed(()=>{const o=t.headers.map(d=>{const k=d;return d.sortable&&(k.sortType="none"),_.value&&d.value===h.value.sortBy&&h.value.sortType&&(k.sortType=h.value.sortType),!_.value&&N.value&&d.value===N.value.sortBy&&(k.sortType=N.value.sortDesc?"desc":"asc"),k}),i=t.showIndex?[{text:"#",value:"index"},...o]:o;return W.value?[{text:"checkbox",value:"checkbox"},...i]:i}),R=e.computed(()=>H.value.map(o=>o.value)),C=e.computed({get:()=>{var o;return(o=t.itemsSelected)!=null?o:[]},set:o=>{r("update:itemsSelected",o)}}),F=e.computed(()=>C.value.length===t.items.length?"allSelected":C.value.length===0?"noneSelected":"partSelected"),I=e.computed(()=>{if(!_.value&&t.searchValue!==""){const o=new RegExp(t.searchValue,"i");return t.items.filter(i=>o.test(t.searchField!==""?i[t.searchField]:Object.values(i).join(" ")))}return t.items}),g=e.ref(_.value?t.serverOptions.page:1),x=e.ref(_.value?t.serverOptions.rowsPerPage:t.rowsPerPage);e.watch(x,o=>{_.value&&(h.value=V(b({},h.value),{page:1,rowsPerPage:o})),g.value=1});const Je=(o,i)=>{let n=null;i==="none"?n="asc":i==="asc"?n="desc":n=null,_.value?h.value=V(b({},h.value),{sortBy:n!==null?o:null,sortType:n}):n===null?N.value=null:N.value={sortBy:o,sortDesc:n==="desc"}},We=e.computed(()=>{if(_.value)return t.items;if(N.value===null)return I.value;const{sortBy:o,sortDesc:i}=N.value;return[...I.value].sort((d,k)=>d[o]<k[o]?i?1:-1:d[o]>k[o]?i?-1:1:0)}),U=e.computed(()=>_.value?t.serverItemsLength:I.value.length),G=e.computed(()=>_.value?g.value*x.value:Math.min(I.value.length,g.value*x.value)),K=e.computed(()=>(g.value-1)*x.value+1),L=e.computed(()=>Math.ceil(U.value/x.value)),T=e.computed(()=>g.value===L.value),O=e.computed(()=>g.value===1),{loading:w}=e.toRefs(t),A=()=>{if(!T.value&&!w.value)if(_.value){const o=g.value+1;h.value=V(b({},h.value),{page:o})}else g.value+=1},M=()=>{if(!O.value&&!w.value)if(_.value){const o=g.value-1;h.value=V(b({},h.value),{page:o})}else g.value-=1};m({maxPaginationNumber:L,currentPaginationNumber:g,isLastPage:T,isFirstPage:O,nextPage:A,prevPage:M});const Ue=o=>{w.value||(_.value?h.value=V(b({},h.value),{page:o}):g.value=o)};e.watch(w,(o,i)=>{_.value&&o===!1&&i===!0&&(g.value=h.value.page)});const Q=e.computed(()=>_.value?t.items:We.value.slice(K.value-1,G.value)),z=e.computed(()=>{if(t.showIndex){const o=x.value*(g.value-1);return Q.value.map((i,n)=>b({index:o+n+1},i))}return Q.value}),X=e.computed(()=>W.value?F.value==="allSelected"?z.value.map(o=>b({checkbox:!0},o)):F.value==="noneSelected"?z.value.map(o=>b({checkbox:!1},o)):z.value.map(o=>{const i=C.value.findIndex(n=>JSON.stringify(n)===JSON.stringify(o))!==-1;return b({checkbox:i},o)}):z.value),Ge=o=>{C.value=o?I.value:[]},Ke=o=>{const i=o.checkbox;if(delete o.checkbox,i)C.value=C.value.filter(n=>JSON.stringify(n)!==JSON.stringify(o));else{const n=C.value;n.unshift(o),C.value=n}};return(o,i)=>(e.openBlock(),e.createElementBlock("div",Ne,[e.createElementVNode("div",{class:e.normalizeClass(["data-table__body",{"fixed-header":a.fixedHeader,"wrap-lines":a.wrapLines}])},[e.createElementVNode("table",null,[e.unref(H).length?(e.openBlock(),e.createElementBlock("thead",we,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(H),(n,d)=>(e.openBlock(),e.createElementBlock("th",{key:d,class:e.normalizeClass({sortable:n.sortable,none:n.sortable&&n.sortType==="none",desc:n.sortable&&n.sortType==="desc",asc:n.sortable&&n.sortType==="asc"}),onClick:k=>n.sortable&&n.sortType?Je(n.value,n.sortType):null},[n.text==="checkbox"?(e.openBlock(),e.createBlock(ne,{key:e.unref(F),status:e.unref(F),onChange:Ge},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",Ve,[e.createElementVNode("span",Ee,e.toDisplayString(n.text),1),n.sortable?(e.openBlock(),e.createBlock(e.unref(Pe),{key:n.sortType?n.sortType:"none",class:e.normalizeClass(["sortType-icon",{desc:n.sortType==="desc"}])},null,8,["class"])):e.createCommentVNode("",!0)]))],10,$e))),128))]),e.unref(w)?(e.openBlock(),e.createElementBlock("th",{key:0,class:"loading-th",colspan:e.unref(R).length},[e.createVNode(ge)],8,Ie)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.unref(Me)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[a.items.length&&e.unref(R).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":a.alternating,"hover-to-change-color":a.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(X),n=>(e.openBlock(),e.createElementBlock("tr",{key:JSON.stringify(n)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(R),(d,k)=>(e.openBlock(),e.createElementBlock("td",{key:k},[e.unref(D)[d]?e.renderSlot(o.$slots,d,e.normalizeProps(e.mergeProps({key:0},n)),void 0,!0):d==="checkbox"?(e.openBlock(),e.createBlock(le,{key:1,checked:n[d],onChange:_t=>Ke(n)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(Array.isArray(n[d])?n[d].join(","):n[d]),1)],64))]))),128))]))),128))],2)):e.createCommentVNode("",!0)],64))]),!e.unref(X).length&&!e.unref(w)?(e.openBlock(),e.createElementBlock("div",Fe,e.toDisplayString(a.emptyMessage),1)):e.createCommentVNode("",!0),!a.items.length&&e.unref(w)?(e.openBlock(),e.createElementBlock("div",Le,e.toDisplayString(a.loadingMessage),1)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",Te,[e.createElementVNode("div",Oe,[ze,e.createVNode(fe,{modelValue:x.value,"onUpdate:modelValue":i[0]||(i[0]=n=>x.value=n),"rows-items":a.rowsItems},null,8,["modelValue","rows-items"])]),e.createElementVNode("div",De,e.toDisplayString(`${e.unref(K)}-${e.unref(G)}`)+" of "+e.toDisplayString(e.unref(U)),1),e.unref(je)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:0},{isFirstPage:e.unref(O),isLastPage:e.unref(T),currentPaginationNumber:g.value,maxPaginationNumber:e.unref(L),nextPage:A,prevPage:M})),void 0,!0):(e.openBlock(),e.createBlock(Ce,{key:1,"is-first-page":e.unref(O),"is-last-page":e.unref(T),onClickNextPage:A,onClickPrevPage:M},e.createSlots({_:2},[a.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(ye,{"current-pagination-number":g.value,"max-pagination-number":e.unref(L),onUpdatePage:Ue},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))])]))}}),[["__scopeId","data-v-06fdce20"]]);return He});
(function(e,m){typeof exports=="object"&&typeof module!="undefined"?module.exports=m(require("vue")):typeof define=="function"&&define.amd?define(["vue"],m):(e=typeof globalThis!="undefined"?globalThis:e||self,e["vue3-easy-data-table"]=m(e.Vue))})(this,function(e){"use strict";var Qe=Object.defineProperty,Xe=Object.defineProperties;var Ye=Object.getOwnPropertyDescriptors;var Y=Object.getOwnPropertySymbols;var Ze=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var Z=(e,m,u)=>m in e?Qe(e,m,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[m]=u,b=(e,m)=>{for(var u in m||(m={}))Ze.call(m,u)&&Z(e,u,m[u]);if(Y)for(var u of Y(m))ve.call(m,u)&&Z(e,u,m[u]);return e},V=(e,m)=>Xe(e,Ye(m));var m="",u=(a,f)=>{const r=a.__vccOpts||a;for(const[t,p]of f)r[t]=p;return r};const v=a=>(e.pushScopeId("data-v-566775ba"),a=a(),e.popScopeId(),a),ee=["onClick"],te=["checked"],oe=v(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var ne=u(e.defineComponent({props:{status:{type:String,required:!0}},emits:["change"],setup(a,{emit:f}){const r=a;e.useCssVars(B=>({"7f84b28f":e.unref(y)}));const t=e.computed(()=>r.status==="allSelected"),p=()=>{f("change",!t.value)},y=e.inject("themeColor");return(B,S)=>(e.openBlock(),e.createElementBlock("div",{class:"multi-select__checkbox",onClick:e.withModifiers(p,["stop","prevent"])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(t),class:e.normalizeClass(a.status)},null,10,te),oe],8,ee))}}),[["__scopeId","data-v-566775ba"]]),tt="";const ae=a=>(e.pushScopeId("data-v-39f156fd"),a=a(),e.popScopeId(),a),re=["checked"],se=ae(()=>e.createElementVNode("label",{for:"checbox"},null,-1));var le=u(e.defineComponent({props:{checked:{type:Boolean,required:!0}},emits:["change"],setup(a,{emit:f}){e.useCssVars(t=>({"20cfc5a0":e.unref(r)}));const r=e.inject("themeColor");return(t,p)=>(e.openBlock(),e.createElementBlock("div",{class:"single-select__checkbox",onClick:p[0]||(p[0]=e.withModifiers(y=>f("change"),["stop","prevent"]))},[e.createElementVNode("input",{type:"checkbox",checked:a.checked},null,8,re),se]))}}),[["__scopeId","data-v-39f156fd"]]),nt="";const ce=a=>(e.pushScopeId("data-v-14bcddac"),a=a(),e.popScopeId(),a),ie={class:"easy-data-table__rows-selector"},de={class:"rows-input"},pe=ce(()=>e.createElementVNode("div",{class:"triangle"},null,-1)),ue=["onClick"];var me=u(e.defineComponent({props:{modelValue:{type:Number,required:!0},rowsItems:{type:Array,required:!0}},emits:["update:modelValue"],setup(a,{emit:f}){const r=a;e.useCssVars(l=>({df3a4a04:e.unref($),ba579354:e.unref(E)}));const t=e.ref(!1),p=e.computed({get:()=>r.modelValue,set:l=>{f("update:modelValue",l)}}),y=l=>{p.value=l,t.value=!1},B=(l,s)=>{let c=l.parentNode;for(;c!=null;){if(c.classList&&c.classList.contains(s))return!0;c=c.parentNode}return!1},S=l=>{B(l.target,"easy-data-table__rows-selector")||(t.value=!1)};e.onMounted(()=>{document.addEventListener("click",S)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",S)});const E=e.inject("themeColor"),$=e.inject("footerBackgroundColor");return(l,s)=>(e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("div",{class:"rows-input__wrapper",onClick:s[0]||(s[0]=c=>t.value=!t.value)},[e.createElementVNode("div",de,e.toDisplayString(e.unref(p)),1),pe]),e.createElementVNode("ul",{class:e.normalizeClass(["select-items",{show:t.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.rowsItems,c=>(e.openBlock(),e.createElementBlock("li",{key:c,class:e.normalizeClass({selected:c===e.unref(p)}),onClick:P=>y(c)},e.toDisplayString(c),11,ue))),128))],2)]))}}),[["__scopeId","data-v-14bcddac"]]),rt="";const fe={class:"loader-line"};var ge=u(e.defineComponent({setup(a){e.useCssVars(r=>({"38295e65":e.unref(f)}));const f=e.inject("themeColor");return(r,t)=>(e.openBlock(),e.createElementBlock("div",fe))}}),[["__scopeId","data-v-1ec0ad4e"]]),lt="";const _e={class:"buttons-pagination"},he=["onClick"];var ye=u(e.defineComponent({props:{maxPaginationNumber:{type:Number,required:!0},currentPaginationNumber:{type:Number,required:!0}},emits:["updatePage"],setup(a,{emit:f}){const r=a;e.useCssVars(l=>({"6949e965":e.unref(S),"3d3093ad":e.unref(E),"5993f744":e.unref($)}));const t=7,p=l=>{l.type==="button"&&!l.active&&f("updatePage",l.page)},y=e.computed(()=>{const l=[];if(r.maxPaginationNumber<=t)for(let s=1;s<=r.maxPaginationNumber;s+=1)l.push({type:"button",page:s,active:s===r.currentPaginationNumber});else if([1,2,r.maxPaginationNumber,r.maxPaginationNumber-1].includes(r.currentPaginationNumber))for(let s=1;s<=t;s+=1)if(s<=3)l.push({type:"button",page:s,active:s===r.currentPaginationNumber});else if(s===4)l.push({type:"omission"});else{const c=r.maxPaginationNumber-(t-s);l.push({type:"button",page:c,active:c===r.currentPaginationNumber})}else if([3,4].includes(r.currentPaginationNumber))for(let s=1;s<=t;s+=1)s<=5?l.push({type:"button",page:s,active:s===r.currentPaginationNumber}):s===6?l.push({type:"omission"}):l.push({type:"button",page:r.maxPaginationNumber,active:r.maxPaginationNumber===r.currentPaginationNumber});else if([r.maxPaginationNumber-2,r.maxPaginationNumber-3].includes(r.currentPaginationNumber))for(let s=1;s<=t;s+=1)if(s===1)l.push({type:"button",page:1,active:r.currentPaginationNumber===1});else if(s===2)l.push({type:"omission"});else{const c=r.maxPaginationNumber-(t-s);l.push({type:"button",page:c,active:c===r.currentPaginationNumber})}else for(let s=1;s<=t;s+=1)if(s===1)l.push({type:"button",page:1,active:r.currentPaginationNumber===1});else if(s===2||s===6)l.push({type:"omission"});else if(s===7)l.push({type:"button",page:r.maxPaginationNumber,active:r.maxPaginationNumber===r.currentPaginationNumber});else{const c=4-s,P=r.currentPaginationNumber-c;l.push({type:"button",page:P,active:P===r.currentPaginationNumber})}return l}),B=e.inject("rowHeight"),S=e.computed(()=>`${B*.6}px`),E=e.inject("borderColor"),$=e.inject("themeColor");return(l,s)=>(e.openBlock(),e.createElementBlock("div",_e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),(c,P)=>(e.openBlock(),e.createElementBlock("div",{key:P,class:e.normalizeClass(["item",{button:c.type==="button",active:c.type==="button"&&c.active,omission:c.type==="omission"}]),onClick:q=>p(c)},e.toDisplayString(c.type==="button"?c.page:"..."),11,he))),128))]))}}),[["__scopeId","data-v-5cf6ad2e"]]),it="";const j=a=>(e.pushScopeId("data-v-c9da5286"),a=a(),e.popScopeId(),a),ke=[j(()=>e.createElementVNode("span",{class:"arrow arrow-right"},null,-1))],be=[j(()=>e.createElementVNode("span",{class:"arrow arrow-left"},null,-1))];var Ce=u(e.defineComponent({props:{isFirstPage:{type:Boolean,required:!1},isLastPage:{type:Boolean,required:!1}},emits:["clickPrevPage","clickNextPage"],setup(a,{emit:f}){const r=e.useSlots();return(t,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["previous-page__click-button",{"first-page":a.isFirstPage}]),onClick:p[0]||(p[0]=y=>f("clickPrevPage"))},ke,2),e.unref(r).buttonsPagination?e.renderSlot(t.$slots,"buttonsPagination",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["next-page__click-button",{"last-page":a.isLastPage}]),onClick:p[1]||(p[1]=y=>f("clickNextPage"))},be,2)],64))}}),[["__scopeId","data-v-c9da5286"]]);const xe={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48"},Be=[e.createElementVNode("path",{d:"M576 234.688V1024H448V234.688L213.312 469.312 128 384 512 0l384 384-85.312 85.312L576 234.688z",fill:"#373D41"},null,-1)];function Se(a,f){return e.openBlock(),e.createElementBlock("svg",xe,Be)}var Pe={render:Se},ft="";const Ne={class:"data-table"},we={key:0},$e=["onClick"],Ve={key:1,class:"header-text__wrapper"},Ee={class:"header-text"},Ie=["colspan"],Fe={key:0,class:"data-table__message"},Le={key:1,class:"data-table__message"},Te={class:"data-table__footer"},Oe={class:"footer__rows-per-page"},ze=e.createTextVNode(" rows per page: "),De={class:"footer__items-index"};var He=u(e.defineComponent({props:{alternating:{type:Boolean,default:!1},buttonsPagination:{type:Boolean,default:!1},borderColor:{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"},bodyFontSize:{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},maxHeight:{type:Number,default:()=>null},wrapLines:{type:Boolean,default:!1},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},loadingMessage:{type:String,default:"Loading, please wait."},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}},emits:["update:itemsSelected","update:serverOptions"],setup(a,{expose:f,emit:r}){const t=a;e.useCssVars(o=>({"313b2afd":e.unref(p),"4aa0f779":e.unref(Ae),"6d2efb16":e.unref(l),"07a765f2":e.unref(q),"0a4f9422":e.unref(Re),"180a59ad":e.unref(y),"7f56c524":a.headerBackgroundColor,"6d177e59":e.unref(S),"451706d8":e.unref(E),"63144ff4":e.unref(B),"429cc12e":e.unref(c),"7f41a02f":e.unref(s),"3be48ca0":e.unref($),"857bd342":e.unref(P)}));const{borderColor:p,headerFontColor:y,rowFontColor:B,rowHoverBackgroundColor:S,rowHoverFontColor:E,footerBackgroundColor:$,rowBackgroundColor:l,evenRowBackgroundColor:s,evenRowFontColor:c,footerFontColor:P}=e.toRefs(t),q=e.computed(()=>`${t.bodyFontSize}px`),J=e.computed(()=>t.bodyFontSize*(t.dense?2:3)),Re=e.computed(()=>`${J.value}px`),Ae=e.computed(()=>t.maxHeight?`${t.maxHeight}px`:null);e.provide("themeColor",t.themeColor),e.provide("rowHeight",J.value),e.provide("borderColor",p.value),e.provide("footerBackgroundColor",$.value);const D=e.useSlots(),Me=e.computed(()=>D.body),je=e.computed(()=>D.pagination),h=e.computed({get:()=>{if(t.serverOptions){const{page:o,rowsPerPage:i,sortBy:n,sortType:d}=t.serverOptions;return{page:o,rowsPerPage:i,sortBy:n!=null?n:null,sortType:d!=null?d:null}}return{page:1,rowsPerPage:25,sortBy:null,sortType:null}},set:o=>{r("update:serverOptions",o)}}),W=e.computed(()=>t.itemsSelected!==null),_=e.computed(()=>t.serverOptions!==null),qe=()=>t.sortBy!==""?{sortBy:t.sortBy,sortDesc:t.sortType==="desc"}:null,N=e.ref(qe()),H=e.computed(()=>{const o=t.headers.map(d=>{const k=d;return d.sortable&&(k.sortType="none"),_.value&&d.value===h.value.sortBy&&h.value.sortType&&(k.sortType=h.value.sortType),!_.value&&N.value&&d.value===N.value.sortBy&&(k.sortType=N.value.sortDesc?"desc":"asc"),k}),i=t.showIndex?[{text:"#",value:"index"},...o]:o;return W.value?[{text:"checkbox",value:"checkbox"},...i]:i}),R=e.computed(()=>H.value.map(o=>o.value)),C=e.computed({get:()=>{var o;return(o=t.itemsSelected)!=null?o:[]},set:o=>{r("update:itemsSelected",o)}}),F=e.computed(()=>C.value.length===t.items.length?"allSelected":C.value.length===0?"noneSelected":"partSelected"),I=e.computed(()=>{if(!_.value&&t.searchValue!==""){const o=new RegExp(t.searchValue,"i");return t.items.filter(i=>o.test(t.searchField!==""?i[t.searchField]:Object.values(i).join(" ")))}return t.items}),g=e.ref(_.value?t.serverOptions.page:1),x=e.ref(_.value?t.serverOptions.rowsPerPage:t.rowsPerPage);e.watch(x,o=>{_.value&&(h.value=V(b({},h.value),{page:1,rowsPerPage:o})),g.value=1});const Je=(o,i)=>{let n=null;i==="none"?n="asc":i==="asc"?n="desc":n=null,_.value?h.value=V(b({},h.value),{sortBy:n!==null?o:null,sortType:n}):n===null?N.value=null:N.value={sortBy:o,sortDesc:n==="desc"}},We=e.computed(()=>{if(_.value)return t.items;if(N.value===null)return I.value;const{sortBy:o,sortDesc:i}=N.value;return[...I.value].sort((d,k)=>d[o]<k[o]?i?1:-1:d[o]>k[o]?i?-1:1:0)}),U=e.computed(()=>_.value?t.serverItemsLength:I.value.length),G=e.computed(()=>_.value?g.value*x.value:Math.min(I.value.length,g.value*x.value)),K=e.computed(()=>(g.value-1)*x.value+1),L=e.computed(()=>Math.ceil(U.value/x.value)),T=e.computed(()=>g.value===L.value),O=e.computed(()=>g.value===1),{loading:w}=e.toRefs(t),A=()=>{if(!T.value&&!w.value)if(_.value){const o=g.value+1;h.value=V(b({},h.value),{page:o})}else g.value+=1},M=()=>{if(!O.value&&!w.value)if(_.value){const o=g.value-1;h.value=V(b({},h.value),{page:o})}else g.value-=1};f({maxPaginationNumber:L,currentPaginationNumber:g,isLastPage:T,isFirstPage:O,nextPage:A,prevPage:M});const Ue=o=>{w.value||(_.value?h.value=V(b({},h.value),{page:o}):g.value=o)};e.watch(w,(o,i)=>{_.value&&o===!1&&i===!0&&(g.value=h.value.page)});const Q=e.computed(()=>_.value?t.items:We.value.slice(K.value-1,G.value)),z=e.computed(()=>{if(t.showIndex){const o=x.value*(g.value-1);return Q.value.map((i,n)=>b({index:o+n+1},i))}return Q.value}),X=e.computed(()=>W.value?F.value==="allSelected"?z.value.map(o=>b({checkbox:!0},o)):F.value==="noneSelected"?z.value.map(o=>b({checkbox:!1},o)):z.value.map(o=>{const i=C.value.findIndex(n=>JSON.stringify(n)===JSON.stringify(o))!==-1;return b({checkbox:i},o)}):z.value),Ge=o=>{C.value=o?I.value:[]},Ke=o=>{const i=o.checkbox;if(delete o.checkbox,i)C.value=C.value.filter(n=>JSON.stringify(n)!==JSON.stringify(o));else{const n=C.value;n.unshift(o),C.value=n}};return(o,i)=>(e.openBlock(),e.createElementBlock("div",Ne,[e.createElementVNode("div",{class:e.normalizeClass(["data-table__body",{"fixed-header":a.fixedHeader,"wrap-lines":a.wrapLines}])},[e.createElementVNode("table",null,[e.unref(H).length?(e.openBlock(),e.createElementBlock("thead",we,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(H),(n,d)=>(e.openBlock(),e.createElementBlock("th",{key:d,class:e.normalizeClass({sortable:n.sortable,none:n.sortable&&n.sortType==="none",desc:n.sortable&&n.sortType==="desc",asc:n.sortable&&n.sortType==="asc"}),onClick:k=>n.sortable&&n.sortType?Je(n.value,n.sortType):null},[n.text==="checkbox"?(e.openBlock(),e.createBlock(ne,{key:e.unref(F),status:e.unref(F),onChange:Ge},null,8,["status"])):(e.openBlock(),e.createElementBlock("span",Ve,[e.createElementVNode("span",Ee,e.toDisplayString(n.text),1),n.sortable?(e.openBlock(),e.createBlock(e.unref(Pe),{key:n.sortType?n.sortType:"none",class:e.normalizeClass(["sortType-icon",{desc:n.sortType==="desc"}])},null,8,["class"])):e.createCommentVNode("",!0)]))],10,$e))),128))]),e.unref(w)?(e.openBlock(),e.createElementBlock("th",{key:0,class:"loading-th",colspan:e.unref(R).length},[e.createVNode(ge)],8,Ie)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.unref(Me)?e.renderSlot(o.$slots,"body",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[a.items.length&&e.unref(R).length?(e.openBlock(),e.createElementBlock("tbody",{key:0,class:e.normalizeClass({"row-alternation":a.alternating,"hover-to-change-color":a.hoverToChangeColor})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(X),n=>(e.openBlock(),e.createElementBlock("tr",{key:JSON.stringify(n)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(R),(d,k)=>(e.openBlock(),e.createElementBlock("td",{key:k},[e.unref(D)[d]?e.renderSlot(o.$slots,d,e.normalizeProps(e.mergeProps({key:0},n)),void 0,!0):d==="checkbox"?(e.openBlock(),e.createBlock(le,{key:1,checked:n[d],onChange:_t=>Ke(n)},null,8,["checked","onChange"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(Array.isArray(n[d])?n[d].join(","):n[d]),1)],64))]))),128))]))),128))],2)):e.createCommentVNode("",!0)],64))]),!e.unref(X).length&&!e.unref(w)?(e.openBlock(),e.createElementBlock("div",Fe,e.toDisplayString(a.emptyMessage),1)):e.createCommentVNode("",!0),!a.items.length&&e.unref(w)?(e.openBlock(),e.createElementBlock("div",Le,e.toDisplayString(a.loadingMessage),1)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",Te,[e.createElementVNode("div",Oe,[ze,e.createVNode(me,{modelValue:x.value,"onUpdate:modelValue":i[0]||(i[0]=n=>x.value=n),"rows-items":a.rowsItems},null,8,["modelValue","rows-items"])]),e.createElementVNode("div",De,e.toDisplayString(`${e.unref(K)}-${e.unref(G)}`)+" of "+e.toDisplayString(e.unref(U)),1),e.unref(je)?e.renderSlot(o.$slots,"pagination",e.normalizeProps(e.mergeProps({key:0},{isFirstPage:e.unref(O),isLastPage:e.unref(T),currentPaginationNumber:g.value,maxPaginationNumber:e.unref(L),nextPage:A,prevPage:M})),void 0,!0):(e.openBlock(),e.createBlock(Ce,{key:1,"is-first-page":e.unref(O),"is-last-page":e.unref(T),onClickNextPage:A,onClickPrevPage:M},e.createSlots({_:2},[a.buttonsPagination?{name:"buttonsPagination",fn:e.withCtx(()=>[e.createVNode(ye,{"current-pagination-number":g.value,"max-pagination-number":e.unref(L),onUpdatePage:Ue},null,8,["current-pagination-number","max-pagination-number"])])}:void 0]),1032,["is-first-page","is-last-page"]))])]))}}),[["__scopeId","data-v-06fdce20"]]);return He});

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

"private": false,
"version": "1.0.26",
"version": "1.0.27",
"types": "./types/main.d.ts",

@@ -9,0 +9,0 @@ "files": [

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