@dcodegroup-au/dsg-vue 0.1.33 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { _ as xe, D as dt, a as go, b as Ta, c as pn, k as xo, d as Ot, e as Li, u as yo, f as Da, g as wo, h as mo, i as Ao, j as Eo } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-CDChHXRp.js";
1
+ import { _ as xe, D as dt, a as go, b as Ta, c as pn, k as xo, d as Ot, e as Li, u as yo, f as Da, g as wo, h as mo, i as Ao, j as Eo } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-CPJO9rNB.js";
2
2
  import { defineComponent as ve, openBlock as E, createElementBlock as O, normalizeClass as q, unref as je, createVNode as j, normalizeProps as Na, guardReactiveProps as bo, ref as re, renderSlot as W, createCommentVNode as P, createElementVNode as L, Fragment as Oe, renderList as Ke, Transition as Qn, withCtx as Le, useTemplateRef as wt, toDisplayString as X, createBlock as K, reactive as Ht, mergeProps as Ve, toRaw as at, createApp as _o, nextTick as Mr, computed as ge, onMounted as fr, onUnmounted as Ai, h as jr, isVNode as Ra, cloneVNode as Co, watchEffect as Rr, useAttrs as So, onBeforeUnmount as Ei, withKeys as ft, withModifiers as me, withDirectives as qt, vShow as _r, normalizeStyle as tr, createTextVNode as Zt, Teleport as Pa, watch as Lr, useModel as gn, mergeModels as xn, vModelSelect as Io, resolveDynamicComponent as Oo } from "vue";
3
3
  import { C as To } from "./DsgColoursConfig-BseFo6-R.js";
4
4
  import { _ as Ba } from "./DsgLabel.vue_vue_type_style_index_0_lang-BYL1w85l.js";
@@ -1441,6 +1441,7 @@ const zs = { class: "dsg-alert__wrapper" }, Ws = ["innerHTML"], za = /* @__PURE_
1441
1441
  message: n,
1442
1442
  type: e,
1443
1443
  hasCloseButton: a.hasCloseButton,
1444
+ useToast: !0,
1444
1445
  timeout: a.timeout
1445
1446
  },
1446
1447
  onClick: () => {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),y=require("./DsgTablePerPage.vue_vue_type_style_index_0_lang-DJgKuZ6X.cjs"),j=require("./dsg-vue.helpers-string.cjs"),te=require("./dsg-vue.helpers-object.cjs"),De=require("./dsg-vue.helpers.cjs"),xe={class:"dsg-table--pagination"},Ve=["disabled"],$e=["disabled"],Te=["onClick","innerHTML"],Ne=["onClick","innerHTML"],Re=["disabled"],Fe=["disabled"],se=e.defineComponent({__name:"DsgTablePagination",props:e.mergeModels({onEachSide:{default:3},firstPage:{default:1},showFirstLast:{type:Boolean,default:!0},firstIcon:{default:"chevron-left-double"},lastIcon:{default:"chevron-right-double"},prevIcon:{default:"chevron-left"},nextIcon:{default:"chevron-right"}},{pagination:{default:null},paginationModifiers:{}}),emits:e.mergeModels(["dsg-table:change-page"],["update:pagination"]),setup(t,{expose:D,emit:g}){const d=e.useModel(t,"pagination"),C=e.computed(()=>d.value===null?0:d.value?.last_page-t.firstPage+1),x=e.computed(()=>d.value===null?0:d.value?.last_page),u=e.computed(()=>d.value===null?!1:d.value?.current_page===t.firstPage),f=e.computed(()=>d.value===null?!1:d.value?.current_page===x.value),V=e.computed(()=>C.value<t.onEachSide*2+4),S=e.computed(()=>t.onEachSide*2+1),E=e.computed(()=>!d.value||d.value?.current_page<=t.onEachSide?1:d.value?.current_page>=C.value-t.onEachSide?C.value-t.onEachSide*2:d.value?.current_page-t.onEachSide),b=g,n=k=>{b("dsg-table:change-page",k)},c=k=>k===d.value?.current_page;return D({loadPage:n}),(k,h)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",xe,[t.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:h[0]||(h[0]=p=>n(t.firstPage)),class:e.normalizeClass([[u.value?"disabled":""],"dsg-table--pagination-link"]),disabled:u.value,title:"First","aria-label":"First"},[e.createVNode(y._sfc_main,{icon:t.firstIcon,size:"sm"},null,8,["icon"])],10,Ve)):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:h[1]||(h[1]=p=>n("prev")),class:e.normalizeClass([[u.value?"disabled":""],"dsg-table--pagination-link"]),disabled:u.value,title:"Previous","aria-label":"Previous"},[e.createVNode(y._sfc_main,{icon:t.prevIcon,size:"sm"},null,8,["icon"])],10,$e),V.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(C.value,(p,N)=>(e.openBlock(),e.createElementBlock("a",{key:N,onClick:A=>n(N+t.firstPage),class:e.normalizeClass([[c(N+t.firstPage)?"active":""],"dsg-table--pagination-link"]),innerHTML:p},null,10,Te))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(S.value,(p,N)=>(e.openBlock(),e.createElementBlock("a",{key:N,onClick:A=>n(E.value+N+t.firstPage-1),class:e.normalizeClass([[c(E.value+N+t.firstPage-1)?"active":""],"dsg-table--pagination-link"]),innerHTML:E.value+p-1},null,10,Ne))),128)),e.createElementVNode("a",{onClick:h[2]||(h[2]=p=>n("next")),class:e.normalizeClass([[f.value?"disabled":""],"dsg-table--pagination-link"]),disabled:f.value,title:"Next","aria-label":"Next"},[e.createVNode(y._sfc_main,{icon:t.nextIcon,size:"sm"},null,8,["icon"])],10,Re),t.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:3,onClick:h[3]||(h[3]=p=>n(x.value)),class:e.normalizeClass([[f.value?"disabled":""],"dsg-table--pagination-link"]),disabled:f.value,title:"Last","aria-label":"Last"},[e.createVNode(y._sfc_main,{icon:t.lastIcon,size:"sm"},null,8,["icon"])],10,Fe)):e.createCommentVNode("",!0)],512)),[[e.vShow,d.value&&x.value>t.firstPage]])}}),Me=["innerHTML"],re=e.defineComponent({__name:"DsgTablePaginationInfo",props:e.mergeModels({infoTemplate:{default:"Displaying {from} to {to} of {total} items"},noDataTemplate:{default:"No relevant data"}},{pagination:{default:null},paginationModifiers:{}}),emits:["update:pagination"],setup(t){const D=e.useModel(t,"pagination"),g=e.computed(()=>D.value==null||D.value.total==0?t.noDataTemplate:t.infoTemplate.replace("{from}",(D.value?.from||0).toString()).replace("{to}",(D.value?.to||0).toString()).replace("{total}",(D.value?.total||0).toString()));return(d,C)=>(e.openBlock(),e.createElementBlock("div",{class:"dsg-table--pagination-info",innerHTML:g.value},null,8,Me))}}),Le={class:"dsg-table--actions",ref:"dsgTableActions"},ze={class:"dsg-table--action-trigger"},Ae={key:0,class:"dsg-table--actions-menu-wrapper"},Ue=["href","target","onClick"],He=["textContent"],Ie={key:0},qe={key:1},Oe=["href","target","onClick"],We={class:"flex-1"},ie=e.defineComponent({__name:"DsgTableActions",props:{placement:{default:"auto"}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:action-archive","dsg-table:link-clicked"],setup(t,{emit:D}){const g=e.ref(!1);e.useTemplateRef("dsgTableActions");const d=e.useAttrs(),C=e.ref(d.data.rowData?.actions??null),x=e.ref(d.data.rowData?.links??null),u=e.ref(d.data.rowData??null),f=b=>{switch(b){case"edit":return"edit-05";case"view":return"eye";case"delete":return"trash-01";case"archive":return"eye-off";default:return"dots-horizontal"}},V=(b,n,c)=>{switch(n){case"edit":E("dsg-table:action-edit",c,u.value);break;case"view":E("dsg-table:action-view",c,u.value);break;case"delete":E("dsg-table:action-delete",c,u.value);break;case"archive":E("dsg-table:action-archive",c,u.value);break}},S=(b,n)=>{const c=b.actionId||b.label.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-");E("dsg-table:link-clicked",n,c,u.value)},E=D;return(b,n)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(e.unref(y.kt),{triggers:[],placement:t.placement,"handle-resize":!0,strategy:"absolute",shown:g.value,class:"dsg-table--actions__popper",onHide:n[1]||(n[1]=c=>g.value=!1),ref:"floatingVueFilterDropdown"},{popper:e.withCtx(()=>[g.value?(e.openBlock(),e.createElementBlock("div",Ae,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,(c,k)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[["edit","view","delete","archive"].includes(String(k))?(e.openBlock(),e.createElementBlock("a",{key:k,href:c?.link,target:c?.target||"_self",onClick:h=>V(c,String(k),h)},[e.createElementVNode("div",{class:e.normalizeClass(["dsg-table--actions-menu-item",String(k)])},[e.createVNode(y._sfc_main,{icon:f(String(k)),size:"sm"},null,8,["icon"]),e.createElementVNode("span",{class:"flex-1",textContent:e.toDisplayString(e.unref(j.ucfirst)(String(k)))},null,8,He)],2)],8,Ue)):e.createCommentVNode("",!0)],64))),256)),C.value&&x.value?(e.openBlock(),e.createElementBlock("hr",Ie)):e.createCommentVNode("",!0),x.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(x.value,c=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:c.label},[c.hasOwnProperty("component")?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.component),{key:0,quote:e.unref(d).data.data.rowData,"row-data":e.unref(d).data.data.rowData},null,8,["quote","row-data"])):c.hasOwnProperty("type")&&c.type=="break"?(e.openBlock(),e.createElementBlock("hr",qe)):(e.openBlock(),e.createElementBlock("a",{key:2,href:c.link,target:c.target||"_self",class:e.normalizeClass(["dsg-table--actions-menu-item",c.class]),onClick:k=>S(c,k)},[c.icon?(e.openBlock(),e.createBlock(y._sfc_main,{key:0,icon:c.icon,size:"sm"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",We,e.toDisplayString(c.label),1)],10,Oe))],64))),128)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("div",ze,[e.createElementVNode("button",{type:"button",class:"dsg-table--actions-button","aria-expanded":"false","aria-haspopup":"true",onClick:n[0]||(n[0]=c=>g.value=!g.value)},[e.renderSlot(b.$slots,"dsg-table-action-button-content",{},()=>[e.createVNode(y._sfc_main,{icon:"dots-vertical",size:"sm"})])])])]),_:3},8,["placement","shown"])])),[[e.unref(y.vOnClickOutside),()=>g.value=!1]])}}),je={class:"dsg-table--search"},de=e.defineComponent({__name:"DsgTableSearch",props:{name:{},id:{},placeholder:{default:"Search"},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},hidden:{type:Boolean,default:!1},extraClasses:{},eventName:{},replaceState:{type:Boolean,default:!0}},emits:["dsg-table:term-changed"],setup(t,{emit:D}){const g=e.ref("");e.onMounted(()=>{const u=new URL(window.location.href).searchParams.get("term");u&&(g.value=u,d("dsg-table:term-changed",u))});const d=D,C=y.useDebounceFn(x=>{if(g.value=x,t.replaceState){const u=new URL(window.location.href);g.value?u.searchParams.set("term",g.value):u.searchParams.delete("term"),window.history.pushState({},"",u.toString())}d("dsg-table:term-changed",g.value)},300);return(x,u)=>(e.openBlock(),e.createElementBlock("div",je,[e.createVNode(y._sfc_main$4,{modelValue:g.value,"onUpdate:modelValue":u[0]||(u[0]=f=>g.value=f),name:t.name,id:t.id||t.name,placeholder:t.placeholder,disabled:t.disabled,required:t.required,readonly:t.readonly,hidden:t.hidden,"has-clear-button":!0,autocomplete:"off",size:"sm",icon:"search-sm","icon-clickable":!0,onIconClicked:u[1]||(u[1]=f=>e.unref(C)(f)),onEnterPressed:u[2]||(u[2]=f=>e.unref(C)(f)),onOnClear:u[3]||(u[3]=()=>e.unref(C)(""))},null,8,["modelValue","name","id","placeholder","disabled","required","readonly","hidden"])]))}}),Qe={class:"dsg-table--header-row"},Ke={key:0,class:"dsg-table--th dsg-table--th-checkbox",scope:"col"},Ye={key:1,class:"dsg-table--th dsg-table--th-expand-detail",scope:"col"},Ge=["title","id","onClick"],Je={key:0,class:"dsg-table--th-sort-icon"},Xe=["innerHTML"],Ze=["innerHTML"],_e=["innerHTML"],et=["innerHTML"],ce=e.defineComponent({__name:"DsgTableRowHeader",props:e.mergeModels({fields:{},scrollVisible:{type:Boolean},hasSelectAll:{type:Boolean,default:!1},showExpandDetail:{type:Boolean,default:!0},tableDataLength:{default:0}},{sortField:{default:null},sortFieldModifiers:{},selectedRows:{default:[]},selectedRowsModifiers:{},hasSelected:{type:Boolean,default:!1},hasSelectedModifiers:{}}),emits:e.mergeModels(["dsg-table:sort-field","dsg-table:on-select-all","dsg-table:on-deselect-all"],["update:sortField","update:selectedRows","update:hasSelected"]),setup(t,{emit:D}){const g=e.useModel(t,"sortField"),d=e.useModel(t,"selectedRows"),C=e.useModel(t,"hasSelected"),x=e.ref("17px"),u=E=>{C.value&&d.value.length>0&&d.value.length!==t.tableDataLength?(C.value=!0,f("dsg-table:on-select-all")):!C.value&&d.value.length===0?(C.value=!1,f("dsg-table:on-select-all")):f("dsg-table:on-deselect-all")},f=D,V=(E,b)=>[E,E+"-"+j.toSnakeCase(String(b?.name)),b.titleClass||"",{sortable:b.sortable},{"sort-active":g.value?.name===b.name}],S=E=>{E.sortable&&(g.value={name:String(E?.name),field:String(E?.sortField),direction:g.value?.name===E.name&&g.value?.direction==="asc"?"desc":"asc"},f("dsg-table:sort-field",E))};return(E,b)=>(e.openBlock(),e.createElementBlock("tr",Qe,[t.hasSelectAll?(e.openBlock(),e.createElementBlock("th",Ke,[e.createVNode(y._sfc_main$2,{modelValue:C.value,"onUpdate:modelValue":[b[0]||(b[0]=n=>C.value=n),u],indeterminate:d.value.length>0&&d.value.length!==t.tableDataLength},null,8,["modelValue","indeterminate"])])):e.createCommentVNode("",!0),t.showExpandDetail?(e.openBlock(),e.createElementBlock("th",Ye)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,(n,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n?.visible?(e.openBlock(),e.createElementBlock("th",{key:c,class:e.normalizeClass(V("dsg-table--th",n)),style:e.normalizeStyle([{width:n.width||void 0},n.style]),title:n.title+(n.sortable?" Sort":""),id:"_"+n.name,onClick:k=>S(n),scope:"col"},[n.sortable?(e.openBlock(),e.createElementBlock("div",Je,[n.tooltip?(e.openBlock(),e.createBlock(y._sfc_main$1,e.mergeProps({key:0,ref_for:!0},n.tooltip,{class:"dsg-table--th-tooltip"}),{"dsg-tooltip--trigger":e.withCtx(()=>[n.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:"dsg-table--th-title",innerHTML:n.title},null,8,Xe)):e.createCommentVNode("",!0),n.tooltip.icon?(e.openBlock(),e.createBlock(y._sfc_main,{key:1,icon:n.tooltip.icon,class:"inline-flex",size:"xs"},null,8,["icon"])):e.createCommentVNode("",!0)]),_:2},1040)):n.title?(e.openBlock(),e.createElementBlock("span",{key:1,class:"dsg-table--th-title",innerHTML:n.title},null,8,Ze)):e.createCommentVNode("",!0),n.sortable&&g.value?.name!==n.name?(e.openBlock(),e.createBlock(y._sfc_main,{key:2,icon:"chevron-selector-vertical",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),n.sortable&&g.value?.name===n.name&&g.value?.direction==="asc"?(e.openBlock(),e.createBlock(y._sfc_main,{key:3,icon:"chevron-down",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),n.sortable&&g.value?.name===n.name&&g.value?.direction==="desc"?(e.openBlock(),e.createBlock(y._sfc_main,{key:4,icon:"chevron-up",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n.tooltip?(e.openBlock(),e.createBlock(y._sfc_main$1,e.mergeProps({key:0,ref_for:!0},n.tooltip,{class:"dsg-table--th-tooltip"}),{"dsg-tooltip--trigger":e.withCtx(()=>[e.createElementVNode("span",{class:"dsg-table--th-title",innerHTML:e.unref(j.ucwords)(String(n?.title))},null,8,_e),n.tooltip.icon?(e.openBlock(),e.createBlock(y._sfc_main,{key:0,icon:n.tooltip.icon,class:"inline-flex",size:"xs"},null,8,["icon"])):e.createCommentVNode("",!0)]),_:2},1040)):(e.openBlock(),e.createElementBlock("span",{key:1,class:"dsg-table--th-title",innerHTML:e.unref(j.ucwords)(String(n?.title))},null,8,et))],64))],14,Ge)):e.createCommentVNode("",!0)],64))),256)),t.scrollVisible?(e.openBlock(),e.createElementBlock("th",{key:2,style:e.normalizeStyle({width:x.value}),class:"dsg-table--th-col-gutter"},null,4)):e.createCommentVNode("",!0)]))}}),tt={class:"dsg-table--wrapper"},at=["span"],lt={key:0,class:"dsg-table--loading"},nt=["colspan"],ot=["colspan"],st=["onClick","onDblclick","onMouseover"],rt={key:0,class:"dsg-table--tbody-cell dsg-table--tbody-cell-checkbox"},it={key:1,class:"dsg-table--tbody-cell dsg-table--tbody-cell-expand"},dt=["aria-expanded","onClick"],ct=["onClick","onDblclick","onContextmenu"],ut=["innerHTML"],gt=["onClick"],mt=["colspan"],ft={key:2},vt=["colspan"],bt={class:"dsg-table--footer"},ht=e.defineComponent({__name:"DsgTableComponent",props:e.mergeModels({fields:{default:()=>[]},isDraggable:{type:Boolean,default:!1},dragApi:{default:""},loadOnStart:{type:Boolean,default:!0},apiUrl:{default:""},httpMethod:{default:"get"},reactiveApiUrl:{type:Boolean,default:!0},apiMode:{type:Boolean,default:!0},data:{default:null},dataManager:{type:[Function,null],default:null},dataPath:{default:"data"},tableLayout:{default:"fixed"},paginationPath:{default:"links.pagination"},queryParams:{default:()=>({sort:"sort",order:"order",page:"page",perPage:"per_page"})},httpOptions:{default:()=>({})},hasDetailRow:{type:Boolean,default:!1},showExpandDetail:{type:Boolean,default:!0},expandableRows:{type:Boolean,default:!1},expandMultiple:{type:Boolean,default:!1},initialPage:{default:1},firstPage:{default:1},sortOrder:{default:()=>[]},multiSort:{type:Boolean},tableHeight:{default:null},multiSortKey:{},rowClass:{type:[String,Function],default:""},detailRowComponent:{},detailRowTransition:{default:"fade"},detailRowClass:{type:[String,Function]},detailRowOptions:{default:()=>({})},trackBy:{default:"id"},css:{default:()=>({tableWrapper:"dsg-table-wrapper",thead:"dsg-table-thead",tbody:"dsg-table-tbody",table:"dsg-table-component"})},minRows:{default:0},noDataTemplate:{default:"No Data Available"},showSortIcons:{type:Boolean},headerRows:{},transform:{type:[Function,null],default:null},sortParams:{type:[Function,null],default:null},fieldPrefix:{},eventPrefix:{},selectable:{type:Boolean,default:!1},replaceState:{type:Boolean,default:!0},replaceStrategy:{default:"window"}},{filterParams:{default:{}},filterParamsModifiers:{},perPage:{default:20},perPageModifiers:{}}),emits:e.mergeModels(["dsg-table:loading","dsg-table:loaded","dsg-table:load-success","dsg-table:load-error","dsg-table:pagination-data","dsg-table:rows-selected","dsg-table:row-clicked","dsg-table:row-hover","dsg-table:row-dblclick","dsg-table:row-expanded","dsg-table:row-collapsed"],["update:filterParams","update:perPage"]),setup(t,{expose:D,emit:g}){const d=a=>a.map((l,s)=>({field:l.field||"",title:l.title||"",name:l.name||"",titleClass:l.titleClass||"",dataClass:l.dataClass||"",visible:l.visible??!0,width:l.width||void 0,sortField:l.sortField||null,sortable:l.sortField,formatter:l.formatter||null,tooltip:l.tooltip??null,$_index:s})),C=()=>{if(!t.apiMode)return null;const l=y.getQueryStrings().find(s=>s.key===t.queryParams.sort);if(l&&l.value.length>0){const s=l.value[0],w=s.startsWith("-"),m=w?s.substring(1):s,P=t.fields.find(U=>U.sortField===m||U.name===m||U.field===m);return P?{name:String(P.name||P.field),field:m,direction:w?"desc":"asc"}:{name:m,field:m,direction:w?"desc":"asc"}}return null},x=()=>{if(!(!t.apiMode||!t.replaceState)&&t.replaceStrategy==="window"){const a=new URL(window.location.href),l=new URLSearchParams(a.search);if(l.delete(t.queryParams.sort),h.value){const w=(h.value.direction==="desc"?"-":"")+h.value.field;l.set(t.queryParams.sort,w)}const s=`${a.pathname}${l.toString()?"?"+l.toString():""}`;window.history.pushState({},"",s)}},u=e.ref(d(t.fields)),f=e.ref(t.data),V=e.ref(null),S=e.ref(t.initialPage),E=e.ref("17px"),b=e.ref(!1),n=e.ref({}),c=e.ref(0),k=e.ref(!0),h=e.ref(C()),p=e.ref(null),N=e.ref(0),A=e.useModel(t,"filterParams"),I=e.useModel(t,"perPage"),$=e.ref([]),H=e.ref(!1),R=e.ref(new Set),M=e.computed(()=>t.tableHeight!=null),L=e.computed(()=>{let a=u.value.filter(l=>l.visible).length;return t.selectable&&a++,t.hasDetailRow&&t.expandableRows&&a++,a});e.watch(()=>$.value.length,a=>{H.value=t.selectable&&a>0},{immediate:!0}),e.watch(()=>t.fields,a=>{u.value=d(a)},{immediate:!0,deep:!0}),e.watch(()=>A.value,a=>{z()},{deep:!0}),e.watch(()=>I.value,()=>{z()}),e.watch(()=>t.apiUrl,(a,l)=>{t.apiMode&&a!==l&&a&&z()}),e.watch(()=>h.value,()=>{x()},{deep:!0});const T=g,Q=(a,l)=>a.formatter&&typeof a.formatter=="function"?a.formatter(a,l):te.data_get(l,String(a?.name),""),K=a=>"dsg-field--"+a.name?.toLowerCase().replaceAll(/[_ ]/g,"-"),Y=(a,l)=>{const s={odd:l%2===0,even:l%2!==0,"row-selected":a.selected};if(!t.rowClass)return s;let w={};if(typeof t.rowClass=="function"){const m=t.rowClass(a,l);typeof m=="string"?m.split(" ").forEach(P=>{P.trim()&&(w[P.trim()]=!0)}):Array.isArray(m)?m.forEach(P=>{typeof P=="string"&&P.trim()&&(w[P.trim()]=!0)}):typeof m=="object"&&m!==null&&(w=m)}else typeof t.rowClass=="string"&&t.rowClass.split(" ").forEach(m=>{m.trim()&&(w[m.trim()]=!0)});return{...s,...w}},F=a=>R.value.has(a[t.trackBy]),q=(a,l)=>{const s=a[t.trackBy];R.value.has(s)?(R.value.delete(s),T("dsg-table:row-collapsed",a,l)):(t.expandMultiple||R.value.clear(),R.value.add(s),T("dsg-table:row-expanded",a,l))},G=a=>{const l=a[t.trackBy];R.value.has(l)||(t.expandMultiple||R.value.clear(),R.value.add(l))},J=a=>{R.value.delete(a[t.trackBy])},X=()=>{f.value?.forEach(a=>{R.value.add(a[t.trackBy])})},Z=()=>{R.value.clear()},_=()=>R.value,O=a=>{if(t.selectable){if(a.selected)$.value.push(a);else{const l=$.value.findIndex(s=>s[t.trackBy]===a[t.trackBy]);l!==-1&&$.value.splice(l,1)}T("dsg-table:rows-selected",$.value)}},ee=()=>{t.selectable&&(f.value?.forEach(a=>{a.selected=!0}),$.value=f.value?.filter(a=>a.selected)??[],T("dsg-table:rows-selected",$.value))},r=()=>{t.selectable&&(f.value?.forEach(a=>{a.selected=!1}),$.value=[],T("dsg-table:rows-selected",$.value))},o=a=>{f.value=Array.isArray(a)?a:[],t.selectable&&f.value.forEach(l=>{l.selected=l.selected??!1})},i=()=>f.value??[],v=a=>{a==="prev"?S.value>t.firstPage&&S.value--:a==="next"?S.value<(V.value?.last_page??0)&&S.value++:a!=S.value&&a>=t.firstPage&&a<=(V.value?.last_page??0)&&(S.value=a),z()},B=()=>({[t.queryParams?.sort]:h.value?(h.value?.direction==="desc"?"-":"")+h.value?.field:void 0,[t.queryParams?.order]:h.value?.direction,[t.queryParams?.page]:S.value,[t.queryParams?.perPage]:I.value}),W=()=>{p.value&&(p.value.abort(),p.value=null)},pe=(a,l)=>{W(),N.value++;const s=N.value,w=new AbortController;return l.signal=w.signal,p.value=w,(t.httpMethod.toLowerCase()==="get"?y.axios.get(a,l):(()=>{const P=l.params;return delete l.params,y.axios.post(a,P,l)})()).then(P=>({...P,_requestId:s,_apiUrl:a}),P=>{throw P.name==="AbortError"||P.code==="ERR_CANCELED"?{...P,_requestId:s,_cancelled:!0}:{...P,_requestId:s}})},ae=a=>{if(a._requestId&&a._requestId!==N.value||a._apiUrl&&a._apiUrl!==t.apiUrl)return;T("dsg-table:load-success",a);const l=t.transform?t.transform(a.data):a.data;f.value=te.data_get(l,t.dataPath,null),t.selectable&&f.value?.forEach(s=>{s.selected=s.selected??!1}),V.value=te.data_get(l,t.paginationPath,null)??null,c.value=f.value?.length?f.value[0].order:c,!De.isEmpty(t.paginationPath)&&V.value===null&&console.warn('DsgTable: pagination-path "'+t.paginationPath+`" not found. It looks like the data returned from the server does not have pagination information or you may have set it incorrectly.
2
- You can explicitly suppress this warning by setting pagination-path="".`),p.value=null,T("dsg-table:pagination-data",V.value),V.value&&S.value>(V.value?.last_page||0)&&f.value?.length===0&&(S.value=t.initialPage,z()),T("dsg-table:loaded"),k.value=!1},le=a=>{a._requestId&&a._requestId!==N.value||a._apiUrl&&a._apiUrl!==t.apiUrl||a._cancelled||(console.error("load-error",a),p.value=null,T("dsg-table:load-error",a),T("dsg-table:loaded"),k.value=!1)},ne=()=>{if(t.data!==null&&Array.isArray(t.data)){o(t.data),k.value=!1;return}if(t.dataManager&&typeof t.dataManager=="function"){const a=t.dataManager();o(a),k.value=!1}else o(t.data),k.value=!1},z=(a=ae,l=le,s={})=>{const w=a||ae,m=l||le;if(!t.apiMode){ne();return}return k.value=!0,T("dsg-table:loading",k.value),t.httpOptions.params={...B(),...A.value},pe(t.apiUrl,t.httpOptions).then(w).catch(P=>m(P))},we=(a,l,s)=>{T("dsg-table:row-clicked",a,l,s)},ye=(a,l,s)=>{T("dsg-table:row-dblclick",a,l,s)},Be=(a,l,s)=>{},Ce=(a,l,s,w)=>{},Ee=(a,l,s,w)=>{},Pe=(a,l,s,w)=>{},Se=(a,l,s)=>{};e.onMounted(()=>{t.apiMode===!0?z():ne()});const oe=()=>{t.apiMode&&($.value=[],W(),z())};return D({changePage:v,reload:oe,getData:i,setData:o,setLoading:a=>{k.value=a,T("dsg-table:loading",k.value)},expandRow:G,collapseRow:J,toggleRowExpand:q,expandAllRows:X,collapseAllRows:Z,getExpandedRows:_,isRowExpanded:F}),(a,l)=>(e.openBlock(),e.createElementBlock("div",tt,[e.createElementVNode("div",{ref:"dsgTableBodyWrapper",class:e.normalizeClass(["dsg-table-body-wrapper",{"fixed-header":M.value}]),style:e.normalizeStyle({height:t.tableHeight||void 0})},[e.createElementVNode("table",{class:e.normalizeClass(["dsg-table-main",M.value?"fixed-header":"",n.value.table,"table-"+t.tableLayout])},[e.createElementVNode("colgroup",{span:L.value},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(s,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[s?.visible?(e.openBlock(),e.createElementBlock("col",{key:w,style:e.normalizeStyle({width:s.width||void 0}),class:e.normalizeClass("dsg-table--col-"+s.name+" "+s.titleClass)},null,6)):e.createCommentVNode("",!0)],64))),256)),!M.value&&b.value?(e.openBlock(),e.createElementBlock("col",{key:0,style:e.normalizeStyle({width:E.value}),class:"dsg-table--col-gutter"},null,4)):e.createCommentVNode("",!0)],8,at),e.createElementVNode("thead",{class:e.normalizeClass([[n.value.thead,{sticky:M.value,"top-0":M.value}],"dsg-table--head"])},[e.renderSlot(a.$slots,"tableHeader",{fields:u.value},()=>[e.createVNode(ce,{fields:u.value,"has-select-all":t.selectable,"selected-rows":$.value,"onUpdate:selectedRows":l[0]||(l[0]=s=>$.value=s),"has-selected":H.value,"onUpdate:hasSelected":l[1]||(l[1]=s=>H.value=s),"scroll-visible":b.value,"show-expand-detail":t.hasDetailRow&&t.showExpandDetail,"table-data-length":f.value?.length,"sort-field":h.value,"onUpdate:sortField":l[2]||(l[2]=s=>h.value=s),"onDsgTable:sortField":l[3]||(l[3]=s=>oe()),"onDsgTable:onSelectAll":ee,"onDsgTable:onDeselectAll":r},null,8,["fields","has-select-all","selected-rows","has-selected","scroll-visible","show-expand-detail","table-data-length","sort-field"])])],2),e.createElementVNode("tbody",{class:e.normalizeClass(["dsg-table--body",n.value.tbody])},[k.value?(e.openBlock(),e.createElementBlock("tr",lt,[e.createElementVNode("td",{colspan:L.value},[e.createElementVNode("div",{"aria-label":"Loading...",role:"status",class:"flex items-center space-x-3 h-12 w-full justify-center",colspan:L.value},[e.renderSlot(a.$slots,"dsg-table-loading",{},()=>[e.createVNode(y._sfc_main,{icon:"loading-02",class:"animate-spin"}),l[4]||(l[4]=e.createElementVNode("span",{class:"text-xs font-medium text-gray-500"},"Loading...",-1))])],8,ot)],8,nt)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(f.value,(s,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w},[e.createElementVNode("tr",{class:e.normalizeClass(["dsg-table--tbody-row",Y(s,w)]),onClick:m=>we(m,w,s),onDblclick:m=>ye(m,w,s),onMouseover:m=>Be()},[t.selectable?(e.openBlock(),e.createElementBlock("td",rt,[e.createVNode(y._sfc_main$2,{modelValue:s.selected,"onUpdate:modelValue":[m=>s.selected=m,m=>O(s)]},null,8,["modelValue","onUpdate:modelValue"])])):e.createCommentVNode("",!0),t.hasDetailRow&&t.expandableRows?(e.openBlock(),e.createElementBlock("td",it,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["dsg-table--expand-toggle",{"is-expanded":F(s)}]),"aria-expanded":F(s),"aria-label":"Toggle row details",onClick:e.withModifiers(m=>q(s,w),["stop"])},[e.createVNode(y._sfc_main,{icon:"chevron-right",size:"sm",class:"dsg-table--expand-icon"})],10,dt)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(m,P)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:P},[m.visible?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["dsg-table--tbody-cell",m.dataClass]),style:e.normalizeStyle({width:m.width||void 0}),onClick:U=>Ce(),onDblclick:U=>Ee(),onContextmenu:U=>Pe()},[e.renderSlot(a.$slots,K(m),{rowData:s,rowIndex:w,rowField:m},()=>[e.createElementVNode("span",{innerHTML:Q(m,s)},null,8,ut)])],46,ct)):e.createCommentVNode("",!0)],64))),128))],42,st),t.hasDetailRow&&(!t.expandableRows||F(s))?(e.openBlock(),e.createBlock(e.Transition,{key:0,name:t.detailRowTransition},{default:e.withCtx(()=>[e.createElementVNode("tr",{class:e.normalizeClass(["dsg-table--tbody-detail-row",{"is-expanded":t.expandableRows&&F(s)}]),onClick:m=>Se()},[e.createElementVNode("td",{colspan:L.value},[e.renderSlot(a.$slots,"dsg-table-detail-row",{rowData:s,rowIndex:w,options:t.detailRowOptions,isExpanded:t.expandableRows?F(s):!0})],8,mt)],10,gt)]),_:2},1032,["name"])):e.createCommentVNode("",!0)],64))),128)),!k.value&&!f.value?.length&&t.noDataTemplate.length?(e.openBlock(),e.createElementBlock("tr",ft,[e.createElementVNode("td",{colspan:L.value,class:"dsg-table--empty-result"},[e.renderSlot(a.$slots,"dsg-table-empty-result",{},()=>[e.createTextVNode(e.toDisplayString(t.noDataTemplate),1)])],8,vt)])):e.createCommentVNode("",!0)],2),e.createElementVNode("tfoot",bt,[e.renderSlot(a.$slots,"dsg-table-footer",{fields:u.value,data:f.value})])],2)],6)]))}}),kt={class:"dsg-table"},pt={key:0,class:"dsg-table--pre-header"},wt={class:"dsg-table--pre-header-left"},yt=["textContent"],Bt={class:"dsg-table--pre-header-right"},Ct={key:1,class:"dsg-table--search-header",ref:"dsgTableSearchHeaderEl"},Et={class:"dsg-table--search-top"},Pt={key:2,class:"dsg-table--footer",ref:"dsgTableFooterEl"},St={class:"dsg-table--footer-left"},Dt={class:"dsg-table--footer-center"},xt={class:"dsg-table--footer-right"},Vt=e.defineComponent({__name:"DsgTable",props:{getUrl:{},fields:{},loadOnStart:{type:Boolean,default:!0},displaySearch:{type:Boolean,default:!0},displayPaginationInfo:{type:Boolean,default:!0},reloadOnChangeTimer:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},trackBy:{default:"id"},title:{default:""},filters:{default:()=>{}},initialFilters:{default:()=>({})},filterEntity:{default:""},filterEndpoint:{default:""},filterSearchEndpoint:{default:""},tableLayout:{default:"fixed"},autoSortFilters:{type:Boolean,default:!0},data:{default:null},hasHeader:{type:Boolean,default:!0},hasFooter:{type:Boolean,default:!0},perPage:{default:20},paginationPath:{default:"meta"},css:{default:()=>({tableWrapper:"border-b"})},rowClass:{type:[String,Function],default:void 0},apiMode:{type:Boolean,default:!0},replaceState:{type:Boolean,default:!0},replaceStrategy:{default:"window"},hasDetailRow:{type:Boolean,default:!1},expandableRows:{type:Boolean,default:!1},expandMultiple:{type:Boolean,default:!1},showExpandDetail:{type:Boolean,default:!0},detailRowTransition:{default:"fade"},detailRowOptions:{default:()=>({})}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:action-archive","dsg-table:link-clicked","dsg-table:rows-selected","dsg-table:row-clicked","dsg-table:row-hover","dsg-table:row-dblclick","dsg-table:filter-updated","dsg-table:term-changed","dsg-table:data-loaded","dsg-table:row-expanded","dsg-table:row-collapsed"],setup(t,{expose:D,emit:g}){const d=r=>{k.value=r},C=e.ref(t.apiMode&&!!(t.filterEntity||t.filterEndpoint||t.getUrl)),x=()=>{if(C.value){let r={};return y.getQueryStrings().forEach(o=>{if(o.key.startsWith("filter[")){const i=o.key.replace("filter[","").replace("]",""),v=o.value;r[`filter[${i}]`]=v.join(",")}}),r}else return{}},u=e.computed(()=>({...t.css,tableWrapper:"border-b "+(t.css?.tableWrapper||"")})),f=e.useSlots(),V=e.ref(!0),S=e.ref(null),E=e.ref("<p>Showing {from} to {to} of {total}</p>"),b=e.ref(null),n=e.useTemplateRef("dsgTable"),c=e.ref({perPage:t.perPage,change:d}),k=e.ref(t.perPage),h=e.ref({...x(),...t.initialFilters}),p=g,N=r=>{n.value?.changePage(r)},A=r=>{b.value=r},I=({data:r})=>{S.value=r,p("dsg-table:data-loaded",r)},$=()=>{n.value?.reload()},H=r=>{n.value?.setLoading(r)},R=r=>{const o=n.value?.getData?.()??[];n.value?.setData(o.map(i=>i.id===r.id?r:i))},M=r=>{const o=n.value?.getData?.()??[];n.value?.setData([...o,r])},L=r=>{const o=n.value?.getData?.()??[];n.value?.setData(o.filter(i=>i.id!==r.id))},T=r=>{n.value?.setData(r)},Q=()=>n.value?.getData()??[],K=r=>{const o=n.value?.getData()??[],i=r(o);i&&n.value?.setData(i)},Y=r=>{n.value?.expandRow(r)},F=r=>{n.value?.collapseRow(r)},q=(r,o)=>{n.value?.toggleRowExpand(r,o)},G=()=>{n.value?.expandAllRows()},J=()=>{n.value?.collapseAllRows()},X=()=>n.value?.getExpandedRows()??new Set,Z=r=>{h.value=r},_=()=>h.value??{},O=r=>{const o={...h.value};!r||r.trim()===""?delete o["filter[term]"]:o["filter[term]"]=r,h.value=o,e.nextTick(()=>{$()}),p("dsg-table:term-changed",r)},ee=(r,o,i)=>{let v={};h.value["filter[term]"]&&(v["filter[term]"]=h.value["filter[term]"]),Object.keys(r).forEach(B=>{r[B]!==null&&r[B]!==void 0&&r[B]!==""&&(v[B]=r[B])}),h.value=v,e.nextTick(()=>{$()}),p("dsg-table:filter-updated",h.value,o,i)};return D({reloadTable:$,updateRowTable:R,addRowTable:M,deleteRowTable:L,setData:T,getData:Q,mutateData:K,termChanged:O,setFilters:Z,getFilters:_,setLoading:H,expandRow:Y,collapseRow:F,toggleRowExpand:q,expandAllRows:G,collapseAllRows:J,getExpandedRows:X,changePage:N}),(r,o)=>(e.openBlock(),e.createElementBlock("div",kt,[t.hasHeader?(e.openBlock(),e.createElementBlock("div",pt,[e.renderSlot(r.$slots,"dsg-table--pre-header",{},()=>[e.createElementVNode("div",wt,[e.renderSlot(r.$slots,"dsg-table--page-title",{data:S.value,title:t.title},()=>[t.title.length>0?(e.openBlock(),e.createElementBlock("h1",{key:0,class:"dsg-table--title",textContent:e.toDisplayString(t.title)},null,8,yt)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Bt,[e.renderSlot(r.$slots,"dsg-table--page-actions",{data:S.value})])])])):e.createCommentVNode("",!0),t.displaySearch?(e.openBlock(),e.createElementBlock("div",Ct,[e.createElementVNode("div",Et,[e.renderSlot(r.$slots,"dsg-table--search-header",{data:S.value},()=>[e.createVNode(de,{name:"term","onDsgTable:termChanged":o[0]||(o[0]=i=>O(i))}),e.createVNode(y._sfc_main$7,{entity:t.filterEntity,"filter-endpoint":t.filterEndpoint,"search-endpoint":t.filterSearchEndpoint,"auto-sort":t.autoSortFilters,filters:t.filters,"onDsgTable:filterUpdated":o[1]||(o[1]=(i,v,B)=>ee(i,v,B))},null,8,["entity","filter-endpoint","search-endpoint","auto-sort","filters"]),e.renderSlot(r.$slots,"dsg-table--search-actions",{data:S.value})])]),e.renderSlot(r.$slots,"dsg-table--search-navigation")],512)):e.createCommentVNode("",!0),e.createVNode(ht,{ref:"dsgTable","api-url":t.getUrl,"filter-params":h.value,"onUpdate:filterParams":o[7]||(o[7]=i=>h.value=i),"per-page":k.value,"onUpdate:perPage":o[8]||(o[8]=i=>k.value=i),fields:t.fields,"load-on-start":t.loadOnStart,"pagination-path":t.paginationPath,selectable:t.selectable,"track-by":t.trackBy,"table-layout":t.tableLayout,css:u.value,data:t.data,"row-class":t.rowClass,"api-mode":C.value,"replace-state":t.replaceState,"replace-strategy":t.replaceStrategy,"has-detail-row":t.hasDetailRow,"expandable-rows":t.expandableRows,"expand-multiple":t.expandMultiple,"show-expand-detail":t.showExpandDetail,"detail-row-transition":t.detailRowTransition,"detail-row-options":t.detailRowOptions,"onDsgTable:loading":o[9]||(o[9]=i=>V.value=!0),"onDsgTable:loaded":o[10]||(o[10]=i=>V.value=!1),"onDsgTable:paginationData":A,"onDsgTable:loadSuccess":I,"onDsgTable:rowsSelected":o[11]||(o[11]=i=>p("dsg-table:rows-selected",i)),"onDsgTable:rowClicked":o[12]||(o[12]=(i,v,B)=>p("dsg-table:row-clicked",i,v,B)),"onDsgTable:rowHover":o[13]||(o[13]=(i,v,B)=>p("dsg-table:row-hover",i,v,B)),"onDsgTable:rowDblclick":o[14]||(o[14]=(i,v,B)=>p("dsg-table:row-dblclick",i,v,B)),"onDsgTable:rowExpanded":o[15]||(o[15]=(i,v)=>p("dsg-table:row-expanded",i,v)),"onDsgTable:rowCollapsed":o[16]||(o[16]=(i,v)=>p("dsg-table:row-collapsed",i,v))},e.createSlots({"dsg-field--actions":e.withCtx(i=>[e.renderSlot(r.$slots,"dsg-table-actions",{data:i},()=>[(e.openBlock(),e.createBlock(ie,{key:i.rowIndex,data:i,"onDsgTable:actionEdit":o[2]||(o[2]=(v,B)=>p("dsg-table:action-edit",v,B)),"onDsgTable:actionView":o[3]||(o[3]=(v,B)=>p("dsg-table:action-view",v,B)),"onDsgTable:actionDelete":o[4]||(o[4]=(v,B)=>p("dsg-table:action-delete",v,B)),"onDsgTable:actionArchive":o[5]||(o[5]=(v,B)=>p("dsg-table:action-archive",v,B)),"onDsgTable:linkClicked":o[6]||(o[6]=(v,B,W)=>p("dsg-table:link-clicked",v,B,W))},null,8,["data"]))])]),_:2},[e.renderList(e.unref(f),(i,v)=>({name:v,fn:e.withCtx(B=>[String(v)!=="dsg-field--actions"?e.renderSlot(r.$slots,v,e.normalizeProps(e.mergeProps({key:0},B))):e.createCommentVNode("",!0)])}))]),1032,["api-url","filter-params","per-page","fields","load-on-start","pagination-path","selectable","track-by","table-layout","css","data","row-class","api-mode","replace-state","replace-strategy","has-detail-row","expandable-rows","expand-multiple","show-expand-detail","detail-row-transition","detail-row-options"]),t.hasFooter?(e.openBlock(),e.createElementBlock("div",Pt,[e.createElementVNode("div",St,[e.renderSlot(r.$slots,"dsg-table--footer-left",{data:b.value,perPage:c.value},()=>[t.displayPaginationInfo?(e.openBlock(),e.createBlock(re,{key:0,ref:"paginationInfoStart",pagination:b.value,"onUpdate:pagination":o[17]||(o[17]=i=>b.value=i),"info-template":E.value},null,8,["pagination","info-template"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"dsg-table--footer-left-extras",{data:b.value,perPage:c.value})])]),e.createElementVNode("div",Dt,[e.renderSlot(r.$slots,"dsg-table--footer-center",{data:b.value,perPage:c.value},()=>[e.renderSlot(r.$slots,"dsg-table--footer-center-extras",{data:b.value,perPage:c.value})])]),e.createElementVNode("div",xt,[e.renderSlot(r.$slots,"dsg-table--footer-right",{data:b.value,perPage:c.value},()=>[V.value===!1&&t.displayPaginationInfo?(e.openBlock(),e.createBlock(se,{key:0,ref:"pagination",pagination:b.value,"onUpdate:pagination":o[18]||(o[18]=i=>b.value=i),"onDsgTable:changePage":N},null,8,["pagination"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"dsg-table--footer-right-extras",{data:b.value,perPage:c.value})])])],512)):e.createCommentVNode("",!0)]))}}),$t={class:"dsg-table--per-page"},Tt=["value","textContent"],Nt=e.defineComponent({__name:"DsgTablePerPage",props:{perPageOptions:{default:()=>[10,20,30,50,100]},perPage:{}},setup(t){return(D,g)=>(e.openBlock(),e.createElementBlock("div",$t,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":g[0]||(g[0]=d=>t.perPage.perPage=d),class:"dsg-table--per-page-select",onChange:g[1]||(g[1]=d=>t.perPage.change(t.perPage.perPage))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.perPageOptions,d=>(e.openBlock(),e.createElementBlock("option",{key:d,value:d,textContent:e.toDisplayString(d)},null,8,Tt))),128))],544),[[e.vModelSelect,t.perPage.perPage]])]))}}),ue=Vt,ge=ie,me=Nt,fe=y._sfc_main$7,ve=se,be=re,he=de,ke=ce,Rt={DsgTable:ue,DsgTableActions:ge,DsgTablePerPage:me,DsgTableFilter:fe,DsgTablePagination:ve,DsgTablePaginationInfo:be,DsgTableSearch:he,DsgTableRowHeader:ke};exports.DsgTable=ue;exports.DsgTableActions=ge;exports.DsgTableFilter=fe;exports.DsgTablePagination=ve;exports.DsgTablePaginationInfo=be;exports.DsgTablePerPage=me;exports.DsgTableRowHeader=ke;exports.DsgTableSearch=he;exports.default=Rt;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("./DsgTablePerPage.vue_vue_type_style_index_0_lang-DPCoss-A.cjs"),G=require("./dsg-vue.helpers-string.cjs"),le=require("./dsg-vue.helpers-object.cjs"),Ie=require("./dsg-vue.helpers.cjs"),Oe={class:"dsg-table--pagination"},We=["disabled"],je=["disabled"],Ke=["onClick","innerHTML"],Qe=["onClick","innerHTML"],Ye=["disabled"],Ge=["disabled"],me=e.defineComponent({__name:"DsgTablePagination",props:e.mergeModels({onEachSide:{default:3},firstPage:{default:1},showFirstLast:{type:Boolean,default:!0},firstIcon:{default:"chevron-left-double"},lastIcon:{default:"chevron-right-double"},prevIcon:{default:"chevron-left"},nextIcon:{default:"chevron-right"}},{pagination:{default:null},paginationModifiers:{}}),emits:e.mergeModels(["dsg-table:change-page"],["update:pagination"]),setup(t,{expose:x,emit:f}){const c=e.useModel(t,"pagination"),S=e.computed(()=>c.value===null?0:c.value?.last_page-t.firstPage+1),$=e.computed(()=>c.value===null?0:c.value?.last_page),g=e.computed(()=>c.value===null?!1:c.value?.current_page===t.firstPage),m=e.computed(()=>c.value===null?!1:c.value?.current_page===$.value),V=e.computed(()=>S.value<t.onEachSide*2+4),P=e.computed(()=>t.onEachSide*2+1),E=e.computed(()=>!c.value||c.value?.current_page<=t.onEachSide?1:c.value?.current_page>=S.value-t.onEachSide?S.value-t.onEachSide*2:c.value?.current_page-t.onEachSide),h=f,n=w=>{h("dsg-table:change-page",w)},u=w=>w===c.value?.current_page;return x({loadPage:n}),(w,k)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",Oe,[t.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:k[0]||(k[0]=y=>n(t.firstPage)),class:e.normalizeClass([[g.value?"disabled":""],"dsg-table--pagination-link"]),disabled:g.value,title:"First","aria-label":"First"},[e.createVNode(p._sfc_main,{icon:t.firstIcon,size:"sm"},null,8,["icon"])],10,We)):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:k[1]||(k[1]=y=>n("prev")),class:e.normalizeClass([[g.value?"disabled":""],"dsg-table--pagination-link"]),disabled:g.value,title:"Previous","aria-label":"Previous"},[e.createVNode(p._sfc_main,{icon:t.prevIcon,size:"sm"},null,8,["icon"])],10,je),V.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(S.value,(y,N)=>(e.openBlock(),e.createElementBlock("a",{key:N,onClick:I=>n(N+t.firstPage),class:e.normalizeClass([[u(N+t.firstPage)?"active":""],"dsg-table--pagination-link"]),innerHTML:y},null,10,Ke))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(P.value,(y,N)=>(e.openBlock(),e.createElementBlock("a",{key:N,onClick:I=>n(E.value+N+t.firstPage-1),class:e.normalizeClass([[u(E.value+N+t.firstPage-1)?"active":""],"dsg-table--pagination-link"]),innerHTML:E.value+y-1},null,10,Qe))),128)),e.createElementVNode("a",{onClick:k[2]||(k[2]=y=>n("next")),class:e.normalizeClass([[m.value?"disabled":""],"dsg-table--pagination-link"]),disabled:m.value,title:"Next","aria-label":"Next"},[e.createVNode(p._sfc_main,{icon:t.nextIcon,size:"sm"},null,8,["icon"])],10,Ye),t.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:3,onClick:k[3]||(k[3]=y=>n($.value)),class:e.normalizeClass([[m.value?"disabled":""],"dsg-table--pagination-link"]),disabled:m.value,title:"Last","aria-label":"Last"},[e.createVNode(p._sfc_main,{icon:t.lastIcon,size:"sm"},null,8,["icon"])],10,Ge)):e.createCommentVNode("",!0)],512)),[[e.vShow,c.value&&$.value>t.firstPage]])}}),Je=["innerHTML"],ve=e.defineComponent({__name:"DsgTablePaginationInfo",props:e.mergeModels({infoTemplate:{default:"Displaying {from} to {to} of {total} items"},noDataTemplate:{default:"No relevant data"}},{pagination:{default:null},paginationModifiers:{}}),emits:["update:pagination"],setup(t){const x=e.useModel(t,"pagination"),f=e.computed(()=>x.value==null||x.value.total==0?t.noDataTemplate:t.infoTemplate.replace("{from}",(x.value?.from||0).toString()).replace("{to}",(x.value?.to||0).toString()).replace("{total}",(x.value?.total||0).toString()));return(c,S)=>(e.openBlock(),e.createElementBlock("div",{class:"dsg-table--pagination-info",innerHTML:f.value},null,8,Je))}}),Xe={class:"dsg-table--actions",ref:"dsgTableActions"},Ze={class:"dsg-table--action-trigger"},_e={key:0,class:"dsg-table--actions-menu-wrapper"},et=["href","target","onClick"],tt=["textContent"],at={key:0},lt={key:1},nt=["href","target","onClick"],ot={class:"flex-1"},be=e.defineComponent({__name:"DsgTableActions",props:{placement:{default:"auto"}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:action-archive","dsg-table:link-clicked"],setup(t,{emit:x}){const f=e.ref(!1);e.useTemplateRef("dsgTableActions");const c=e.useAttrs(),S=e.ref(c.data.rowData?.actions??null),$=e.ref(c.data.rowData?.links??null),g=e.ref(c.data.rowData??null),m=h=>{switch(h){case"edit":return"edit-05";case"view":return"eye";case"delete":return"trash-01";case"archive":return"eye-off";default:return"dots-horizontal"}},V=(h,n,u)=>{switch(n){case"edit":E("dsg-table:action-edit",u,g.value);break;case"view":E("dsg-table:action-view",u,g.value);break;case"delete":E("dsg-table:action-delete",u,g.value);break;case"archive":E("dsg-table:action-archive",u,g.value);break}},P=(h,n)=>{const u=h.actionId||h.label.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-");E("dsg-table:link-clicked",n,u,g.value)},E=x;return(h,n)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",Xe,[e.createVNode(e.unref(p.kt),{triggers:[],placement:t.placement,"handle-resize":!0,strategy:"absolute",shown:f.value,class:"dsg-table--actions__popper",onHide:n[1]||(n[1]=u=>f.value=!1),ref:"floatingVueFilterDropdown"},{popper:e.withCtx(()=>[f.value?(e.openBlock(),e.createElementBlock("div",_e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,(u,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[["edit","view","delete","archive"].includes(String(w))?(e.openBlock(),e.createElementBlock("a",{key:w,href:u?.link,target:u?.target||"_self",onClick:k=>V(u,String(w),k)},[e.createElementVNode("div",{class:e.normalizeClass(["dsg-table--actions-menu-item",String(w)])},[e.createVNode(p._sfc_main,{icon:m(String(w)),size:"sm"},null,8,["icon"]),e.createElementVNode("span",{class:"flex-1",textContent:e.toDisplayString(e.unref(G.ucfirst)(String(w)))},null,8,tt)],2)],8,et)):e.createCommentVNode("",!0)],64))),256)),S.value&&$.value?(e.openBlock(),e.createElementBlock("hr",at)):e.createCommentVNode("",!0),$.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList($.value,u=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u.label},[u.hasOwnProperty("component")?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.component),{key:0,quote:e.unref(c).data.data.rowData,"row-data":e.unref(c).data.data.rowData},null,8,["quote","row-data"])):u.hasOwnProperty("type")&&u.type=="break"?(e.openBlock(),e.createElementBlock("hr",lt)):(e.openBlock(),e.createElementBlock("a",{key:2,href:u.link,target:u.target||"_self",class:e.normalizeClass(["dsg-table--actions-menu-item",u.class]),onClick:w=>P(u,w)},[u.icon?(e.openBlock(),e.createBlock(p._sfc_main,{key:0,icon:u.icon,size:"sm"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",ot,e.toDisplayString(u.label),1)],10,nt))],64))),128)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("div",Ze,[e.createElementVNode("button",{type:"button",class:"dsg-table--actions-button","aria-expanded":"false","aria-haspopup":"true",onClick:n[0]||(n[0]=u=>f.value=!f.value)},[e.renderSlot(h.$slots,"dsg-table-action-button-content",{},()=>[e.createVNode(p._sfc_main,{icon:"dots-vertical",size:"sm"})])])])]),_:3},8,["placement","shown"])])),[[e.unref(p.vOnClickOutside),()=>f.value=!1]])}}),st={class:"dsg-table--search"},he=e.defineComponent({__name:"DsgTableSearch",props:{name:{},id:{},placeholder:{default:"Search"},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},hidden:{type:Boolean,default:!1},extraClasses:{},eventName:{},replaceState:{type:Boolean,default:!0}},emits:["dsg-table:term-changed"],setup(t,{emit:x}){const f=e.ref("");e.onMounted(()=>{const g=new URL(window.location.href).searchParams.get("term");g&&(f.value=g,c("dsg-table:term-changed",g))});const c=x,S=p.useDebounceFn($=>{if(f.value=$,t.replaceState){const g=new URL(window.location.href);f.value?g.searchParams.set("term",f.value):g.searchParams.delete("term"),window.history.pushState({},"",g.toString())}c("dsg-table:term-changed",f.value)},300);return($,g)=>(e.openBlock(),e.createElementBlock("div",st,[e.createVNode(p._sfc_main$4,{modelValue:f.value,"onUpdate:modelValue":g[0]||(g[0]=m=>f.value=m),name:t.name,id:t.id||t.name,placeholder:t.placeholder,disabled:t.disabled,required:t.required,readonly:t.readonly,hidden:t.hidden,"has-clear-button":!0,autocomplete:"off",size:"sm",icon:"search-sm","icon-clickable":!0,onIconClicked:g[1]||(g[1]=m=>e.unref(S)(m)),onEnterPressed:g[2]||(g[2]=m=>e.unref(S)(m)),onOnClear:g[3]||(g[3]=()=>e.unref(S)(""))},null,8,["modelValue","name","id","placeholder","disabled","required","readonly","hidden"])]))}}),rt={class:"dsg-table--header-row"},it={key:0,class:"dsg-table--th dsg-table--th-checkbox",scope:"col"},dt={key:1,class:"dsg-table--th dsg-table--th-expand-detail",scope:"col"},ct=["title","id","onClick"],ut={key:0,class:"dsg-table--th-sort-icon"},gt=["innerHTML"],ft=["innerHTML"],mt=["innerHTML"],vt=["innerHTML"],ke=e.defineComponent({__name:"DsgTableRowHeader",props:e.mergeModels({fields:{},scrollVisible:{type:Boolean},hasSelectAll:{type:Boolean,default:!1},showExpandDetail:{type:Boolean,default:!0},tableDataLength:{default:0}},{sortField:{default:null},sortFieldModifiers:{},selectedRows:{default:[]},selectedRowsModifiers:{},hasSelected:{type:Boolean,default:!1},hasSelectedModifiers:{}}),emits:e.mergeModels(["dsg-table:sort-field","dsg-table:on-select-all","dsg-table:on-deselect-all"],["update:sortField","update:selectedRows","update:hasSelected"]),setup(t,{emit:x}){const f=e.useModel(t,"sortField"),c=e.useModel(t,"selectedRows"),S=e.useModel(t,"hasSelected"),$=e.ref("17px"),g=E=>{S.value&&c.value.length>0&&c.value.length!==t.tableDataLength?(S.value=!0,m("dsg-table:on-select-all")):!S.value&&c.value.length===0?(S.value=!1,m("dsg-table:on-select-all")):m("dsg-table:on-deselect-all")},m=x,V=(E,h)=>[E,E+"-"+G.toSnakeCase(String(h?.name)),h.titleClass||"",{sortable:h.sortable},{"sort-active":f.value?.name===h.name}],P=E=>{E.sortable&&(f.value={name:String(E?.name),field:String(E?.sortField),direction:f.value?.name===E.name&&f.value?.direction==="asc"?"desc":"asc"},m("dsg-table:sort-field",E))};return(E,h)=>(e.openBlock(),e.createElementBlock("tr",rt,[t.hasSelectAll?(e.openBlock(),e.createElementBlock("th",it,[e.createVNode(p._sfc_main$2,{modelValue:S.value,"onUpdate:modelValue":[h[0]||(h[0]=n=>S.value=n),g],indeterminate:c.value.length>0&&c.value.length!==t.tableDataLength},null,8,["modelValue","indeterminate"])])):e.createCommentVNode("",!0),t.showExpandDetail?(e.openBlock(),e.createElementBlock("th",dt)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,(n,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n?.visible?(e.openBlock(),e.createElementBlock("th",{key:u,class:e.normalizeClass(V("dsg-table--th",n)),style:e.normalizeStyle([{width:n.width||void 0},n.style]),title:n.title+(n.sortable?" Sort":""),id:"_"+n.name,onClick:w=>P(n),scope:"col"},[n.sortable?(e.openBlock(),e.createElementBlock("div",ut,[n.tooltip?(e.openBlock(),e.createBlock(p._sfc_main$1,e.mergeProps({key:0,ref_for:!0},n.tooltip,{class:"dsg-table--th-tooltip"}),{"dsg-tooltip--trigger":e.withCtx(()=>[n.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:"dsg-table--th-title",innerHTML:n.title},null,8,gt)):e.createCommentVNode("",!0),n.tooltip.icon?(e.openBlock(),e.createBlock(p._sfc_main,{key:1,icon:n.tooltip.icon,class:"inline-flex",size:"xs"},null,8,["icon"])):e.createCommentVNode("",!0)]),_:2},1040)):n.title?(e.openBlock(),e.createElementBlock("span",{key:1,class:"dsg-table--th-title",innerHTML:n.title},null,8,ft)):e.createCommentVNode("",!0),n.sortable&&f.value?.name!==n.name?(e.openBlock(),e.createBlock(p._sfc_main,{key:2,icon:"chevron-selector-vertical",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),n.sortable&&f.value?.name===n.name&&f.value?.direction==="asc"?(e.openBlock(),e.createBlock(p._sfc_main,{key:3,icon:"chevron-down",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),n.sortable&&f.value?.name===n.name&&f.value?.direction==="desc"?(e.openBlock(),e.createBlock(p._sfc_main,{key:4,icon:"chevron-up",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n.tooltip?(e.openBlock(),e.createBlock(p._sfc_main$1,e.mergeProps({key:0,ref_for:!0},n.tooltip,{class:"dsg-table--th-tooltip"}),{"dsg-tooltip--trigger":e.withCtx(()=>[e.createElementVNode("span",{class:"dsg-table--th-title",innerHTML:e.unref(G.ucwords)(String(n?.title))},null,8,mt),n.tooltip.icon?(e.openBlock(),e.createBlock(p._sfc_main,{key:0,icon:n.tooltip.icon,class:"inline-flex",size:"xs"},null,8,["icon"])):e.createCommentVNode("",!0)]),_:2},1040)):(e.openBlock(),e.createElementBlock("span",{key:1,class:"dsg-table--th-title",innerHTML:e.unref(G.ucwords)(String(n?.title))},null,8,vt))],64))],14,ct)):e.createCommentVNode("",!0)],64))),256)),t.scrollVisible?(e.openBlock(),e.createElementBlock("th",{key:2,style:e.normalizeStyle({width:$.value}),class:"dsg-table--th-col-gutter"},null,4)):e.createCommentVNode("",!0)]))}}),bt=["span"],ht={key:0,class:"dsg-table--loading"},kt=["colspan"],wt=["colspan"],yt=["onClick","onDblclick","onMouseover","onMouseenter"],pt=["onClickCapture"],Bt={key:1,class:"dsg-table--tbody-cell dsg-table--tbody-cell-expand"},Ct=["aria-expanded","onClick"],St=["onClick","onDblclick","onContextmenu"],Et=["innerHTML"],Pt=["onClick"],Dt=["colspan"],xt={key:2},$t=["colspan"],Vt={class:"dsg-table--footer"},Tt=e.defineComponent({__name:"DsgTableComponent",props:e.mergeModels({fields:{default:()=>[]},isDraggable:{type:Boolean,default:!1},dragApi:{default:""},loadOnStart:{type:Boolean,default:!0},apiUrl:{default:""},httpMethod:{default:"get"},reactiveApiUrl:{type:Boolean,default:!0},apiMode:{type:Boolean,default:!0},data:{default:null},dataManager:{type:[Function,null],default:null},dataPath:{default:"data"},tableLayout:{default:"fixed"},paginationPath:{default:"links.pagination"},queryParams:{default:()=>({sort:"sort",order:"order",page:"page",perPage:"per_page"})},httpOptions:{default:()=>({})},hasDetailRow:{type:Boolean,default:!1},showExpandDetail:{type:Boolean,default:!0},expandableRows:{type:Boolean,default:!1},expandMultiple:{type:Boolean,default:!1},initialPage:{default:1},firstPage:{default:1},sortOrder:{default:()=>[]},multiSort:{type:Boolean},tableHeight:{default:null},multiSortKey:{},rowClass:{type:[String,Function],default:""},detailRowComponent:{},detailRowTransition:{default:"fade"},detailRowClass:{type:[String,Function]},detailRowOptions:{default:()=>({})},trackBy:{default:"id"},css:{default:()=>({tableWrapper:"dsg-table-wrapper",thead:"dsg-table-thead",tbody:"dsg-table-tbody",table:"dsg-table-component"})},minRows:{default:0},noDataTemplate:{default:"No Data Available"},showSortIcons:{type:Boolean},headerRows:{},transform:{type:[Function,null],default:null},sortParams:{type:[Function,null],default:null},fieldPrefix:{},eventPrefix:{},selectable:{type:Boolean,default:!1},shiftSelectHighlight:{default:()=>{}},selectedRowHighlight:{default:()=>{}},replaceState:{type:Boolean,default:!0},replaceStrategy:{default:"window"}},{filterParams:{default:{}},filterParamsModifiers:{},perPage:{default:20},perPageModifiers:{}}),emits:e.mergeModels(["dsg-table:loading","dsg-table:loaded","dsg-table:load-success","dsg-table:load-error","dsg-table:pagination-data","dsg-table:rows-selected","dsg-table:row-clicked","dsg-table:row-hover","dsg-table:row-dblclick","dsg-table:row-expanded","dsg-table:row-collapsed"],["update:filterParams","update:perPage"]),setup(t,{expose:x,emit:f}){const c=a=>a.map((l,o)=>({field:l.field||"",title:l.title||"",name:l.name||"",titleClass:l.titleClass||"",dataClass:l.dataClass||"",visible:l.visible??!0,width:l.width||void 0,sortField:l.sortField||null,sortable:l.sortField,formatter:l.formatter||null,tooltip:l.tooltip??null,$_index:o})),S=()=>{if(!t.apiMode)return null;const l=p.getQueryStrings().find(o=>o.key===t.queryParams.sort);if(l&&l.value.length>0){const o=l.value[0],v=o.startsWith("-"),d=v?o.substring(1):o,C=t.fields.find(L=>L.sortField===d||L.name===d||L.field===d);return C?{name:String(C.name||C.field),field:d,direction:v?"desc":"asc"}:{name:d,field:d,direction:v?"desc":"asc"}}return null},$=()=>{if(!(!t.apiMode||!t.replaceState)&&t.replaceStrategy==="window"){const a=new URL(window.location.href),l=new URLSearchParams(a.search);if(l.delete(t.queryParams.sort),k.value){const v=(k.value.direction==="desc"?"-":"")+k.value.field;l.set(t.queryParams.sort,v)}const o=`${a.pathname}${l.toString()?"?"+l.toString():""}`;window.history.pushState({},"",o)}},g=e.ref(c(t.fields)),m=e.ref(t.data),V=e.ref(null),P=e.ref(t.initialPage),E=e.ref("17px"),h=e.ref(!1),n=e.ref({}),u=e.ref(0),w=e.ref(!0),k=e.ref(S()),y=e.ref(null),N=e.ref(0),I=e.useModel(t,"filterParams"),j=e.useModel(t,"perPage"),D=e.ref([]),O=e.ref(!1),M=e.ref(new Set),R=e.ref(null),F=e.ref(null),z=e.ref(!1),A=e.computed(()=>t.tableHeight!=null),U=e.computed(()=>{let a=g.value.filter(l=>l.visible).length;return t.selectable&&a++,t.hasDetailRow&&t.expandableRows&&a++,a}),J=e.computed(()=>{const a={};return t.shiftSelectHighlight&&(a["--dsg-shift-select-bg"]=t.shiftSelectHighlight),t.selectedRowHighlight&&(a["--dsg-selected-row-bg"]=t.selectedRowHighlight),Object.keys(a).length>0?a:void 0});e.watch(()=>D.value.length,a=>{O.value=t.selectable&&a>0},{immediate:!0}),e.watch(()=>t.fields,a=>{g.value=c(a)},{immediate:!0,deep:!0}),e.watch(()=>I.value,a=>{q()},{deep:!0}),e.watch(()=>j.value,()=>{q()}),e.watch(()=>t.apiUrl,(a,l)=>{t.apiMode&&a!==l&&a&&q()}),e.watch(()=>k.value,()=>{$()},{deep:!0});const T=f,X=(a,l)=>a.formatter&&typeof a.formatter=="function"?a.formatter(a,l):le.data_get(l,String(a?.name),""),Z=a=>"dsg-field--"+a.name?.toLowerCase().replaceAll(/[_ ]/g,"-"),_=(a,l)=>{const o={odd:l%2===0,even:l%2!==0,"row-selected":a.selected};if(!t.rowClass)return o;let v={};if(typeof t.rowClass=="function"){const d=t.rowClass(a,l);typeof d=="string"?d.split(" ").forEach(C=>{C.trim()&&(v[C.trim()]=!0)}):Array.isArray(d)?d.forEach(C=>{typeof C=="string"&&C.trim()&&(v[C.trim()]=!0)}):typeof d=="object"&&d!==null&&(v=d)}else typeof t.rowClass=="string"&&t.rowClass.split(" ").forEach(d=>{d.trim()&&(v[d.trim()]=!0)});return{...o,...v}},H=a=>M.value.has(a[t.trackBy]),K=(a,l)=>{const o=a[t.trackBy];M.value.has(o)?(M.value.delete(o),T("dsg-table:row-collapsed",a,l)):(t.expandMultiple||M.value.clear(),M.value.add(o),T("dsg-table:row-expanded",a,l))},ee=a=>{const l=a[t.trackBy];M.value.has(l)||(t.expandMultiple||M.value.clear(),M.value.add(l))},Q=a=>{M.value.delete(a[t.trackBy])},te=()=>{m.value?.forEach(a=>{M.value.add(a[t.trackBy])})},s=()=>{M.value.clear()},r=()=>M.value,i=(a,l)=>{if(t.selectable){if(l!==void 0&&(R.value=l),a.selected)D.value.push(a);else{const o=D.value.findIndex(v=>v[t.trackBy]===a[t.trackBy]);o!==-1&&D.value.splice(o,1)}T("dsg-table:rows-selected",D.value)}},b=(a,l,o)=>{if(t.selectable&&a.shiftKey&&R.value!==null){a.stopPropagation(),a.preventDefault();const v=Math.min(R.value,o),d=Math.max(R.value,o),C=!l.selected;for(let L=v;L<=d;L++){const W=m.value?.[L];if(W){const ge=W.selected;if(W.selected=C,C&&!ge)D.value.push(W);else if(!C&&ge){const fe=D.value.findIndex(qe=>qe[t.trackBy]===W[t.trackBy]);fe!==-1&&D.value.splice(fe,1)}}}R.value=o,F.value=null,T("dsg-table:rows-selected",D.value)}},B=()=>{t.selectable&&(m.value?.forEach(a=>{a.selected=!0}),D.value=m.value?.filter(a=>a.selected)??[],R.value=null,T("dsg-table:rows-selected",D.value))},ae=()=>{t.selectable&&(m.value?.forEach(a=>{a.selected=!1}),D.value=[],R.value=null,T("dsg-table:rows-selected",D.value))},Y=a=>{m.value=Array.isArray(a)?a:[],t.selectable&&(R.value=null,m.value.forEach(l=>{l.selected=l.selected??!1}))},De=()=>m.value??[],xe=a=>{a==="prev"?P.value>t.firstPage&&P.value--:a==="next"?P.value<(V.value?.last_page??0)&&P.value++:a!=P.value&&a>=t.firstPage&&a<=(V.value?.last_page??0)&&(P.value=a),q()},$e=()=>({[t.queryParams?.sort]:k.value?(k.value?.direction==="desc"?"-":"")+k.value?.field:void 0,[t.queryParams?.order]:k.value?.direction,[t.queryParams?.page]:P.value,[t.queryParams?.perPage]:j.value}),ne=()=>{y.value&&(y.value.abort(),y.value=null)},Ve=(a,l)=>{ne(),N.value++;const o=N.value,v=new AbortController;return l.signal=v.signal,y.value=v,(t.httpMethod.toLowerCase()==="get"?p.axios.get(a,l):(()=>{const C=l.params;return delete l.params,p.axios.post(a,C,l)})()).then(C=>({...C,_requestId:o,_apiUrl:a}),C=>{throw C.name==="AbortError"||C.code==="ERR_CANCELED"?{...C,_requestId:o,_cancelled:!0}:{...C,_requestId:o}})},oe=a=>{if(a._requestId&&a._requestId!==N.value||a._apiUrl&&a._apiUrl!==t.apiUrl)return;T("dsg-table:load-success",a);const l=t.transform?t.transform(a.data):a.data;m.value=le.data_get(l,t.dataPath,null),t.selectable&&(R.value=null,m.value?.forEach(o=>{o.selected=o.selected??!1})),V.value=le.data_get(l,t.paginationPath,null)??null,u.value=m.value?.length?m.value[0].order:u,!Ie.isEmpty(t.paginationPath)&&V.value===null&&console.warn('DsgTable: pagination-path "'+t.paginationPath+`" not found. It looks like the data returned from the server does not have pagination information or you may have set it incorrectly.
2
+ You can explicitly suppress this warning by setting pagination-path="".`),y.value=null,T("dsg-table:pagination-data",V.value),V.value&&P.value>(V.value?.last_page||0)&&m.value?.length===0&&(P.value=t.initialPage,q()),T("dsg-table:loaded"),w.value=!1},se=a=>{a._requestId&&a._requestId!==N.value||a._apiUrl&&a._apiUrl!==t.apiUrl||a._cancelled||(console.error("load-error",a),y.value=null,T("dsg-table:load-error",a),T("dsg-table:loaded"),w.value=!1)},re=()=>{if(t.data!==null&&Array.isArray(t.data)){Y(t.data),w.value=!1;return}if(t.dataManager&&typeof t.dataManager=="function"){const a=t.dataManager();Y(a),w.value=!1}else Y(t.data),w.value=!1},q=(a=oe,l=se,o={})=>{const v=a||oe,d=l||se;if(!t.apiMode){re();return}return w.value=!0,T("dsg-table:loading",w.value),t.httpOptions.params={...$e(),...I.value},Ve(t.apiUrl,t.httpOptions).then(v).catch(C=>d(C))},Te=(a,l,o)=>{T("dsg-table:row-clicked",a,l,o)},Ne=(a,l,o)=>{T("dsg-table:row-dblclick",a,l,o)},Re=(a,l,o)=>{},Me=(a,l,o,v)=>{},Fe=(a,l,o,v)=>{},Le=(a,l,o,v)=>{},ze=(a,l,o)=>{},ie=a=>{a.key==="Shift"&&(z.value=!0)},de=a=>{a.key==="Shift"&&(z.value=!1,F.value=null)},ce=()=>{z.value=!1,F.value=null},He=a=>{t.selectable&&z.value&&R.value!==null&&(F.value=a)},Ae=()=>{F.value=null},Ue=a=>{if(!t.selectable||!z.value||R.value===null||F.value===null)return!1;const l=Math.min(R.value,F.value),o=Math.max(R.value,F.value);return a>=l&&a<=o};e.onMounted(()=>{t.apiMode===!0?q():re(),t.selectable&&(document.addEventListener("keydown",ie),document.addEventListener("keyup",de),window.addEventListener("blur",ce))}),e.onUnmounted(()=>{t.selectable&&(document.removeEventListener("keydown",ie),document.removeEventListener("keyup",de),window.removeEventListener("blur",ce))});const ue=()=>{t.apiMode&&(D.value=[],ne(),q())};return x({changePage:xe,reload:ue,getData:De,setData:Y,setLoading:a=>{w.value=a,T("dsg-table:loading",w.value)},expandRow:ee,collapseRow:Q,toggleRowExpand:K,expandAllRows:te,collapseAllRows:s,getExpandedRows:r,isRowExpanded:H}),(a,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dsg-table--wrapper",{"dsg-table--shift-active":t.selectable&&z.value}]),style:e.normalizeStyle(J.value)},[e.createElementVNode("div",{ref:"dsgTableBodyWrapper",class:e.normalizeClass(["dsg-table-body-wrapper",{"fixed-header":A.value}]),style:e.normalizeStyle({height:t.tableHeight||void 0})},[e.createElementVNode("table",{class:e.normalizeClass(["dsg-table-main",A.value?"fixed-header":"",n.value.table,"table-"+t.tableLayout])},[e.createElementVNode("colgroup",{span:U.value},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(o,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o?.visible?(e.openBlock(),e.createElementBlock("col",{key:v,style:e.normalizeStyle({width:o.width||void 0}),class:e.normalizeClass("dsg-table--col-"+o.name+" "+o.titleClass)},null,6)):e.createCommentVNode("",!0)],64))),256)),!A.value&&h.value?(e.openBlock(),e.createElementBlock("col",{key:0,style:e.normalizeStyle({width:E.value}),class:"dsg-table--col-gutter"},null,4)):e.createCommentVNode("",!0)],8,bt),e.createElementVNode("thead",{class:e.normalizeClass([[n.value.thead,{sticky:A.value,"top-0":A.value}],"dsg-table--head"])},[e.renderSlot(a.$slots,"tableHeader",{fields:g.value},()=>[e.createVNode(ke,{fields:g.value,"has-select-all":t.selectable,"selected-rows":D.value,"onUpdate:selectedRows":l[0]||(l[0]=o=>D.value=o),"has-selected":O.value,"onUpdate:hasSelected":l[1]||(l[1]=o=>O.value=o),"scroll-visible":h.value,"show-expand-detail":t.hasDetailRow&&t.showExpandDetail,"table-data-length":m.value?.length,"sort-field":k.value,"onUpdate:sortField":l[2]||(l[2]=o=>k.value=o),"onDsgTable:sortField":l[3]||(l[3]=o=>ue()),"onDsgTable:onSelectAll":B,"onDsgTable:onDeselectAll":ae},null,8,["fields","has-select-all","selected-rows","has-selected","scroll-visible","show-expand-detail","table-data-length","sort-field"])])],2),e.createElementVNode("tbody",{class:e.normalizeClass(["dsg-table--body",n.value.tbody])},[w.value?(e.openBlock(),e.createElementBlock("tr",ht,[e.createElementVNode("td",{colspan:U.value},[e.createElementVNode("div",{"aria-label":"Loading...",role:"status",class:"flex items-center space-x-3 h-12 w-full justify-center",colspan:U.value},[e.renderSlot(a.$slots,"dsg-table-loading",{},()=>[e.createVNode(p._sfc_main,{icon:"loading-02",class:"animate-spin"}),l[5]||(l[5]=e.createElementVNode("span",{class:"text-xs font-medium text-gray-500"},"Loading...",-1))])],8,wt)],8,kt)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(m.value,(o,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v},[e.createElementVNode("tr",{class:e.normalizeClass(["dsg-table--tbody-row",[_(o,v),{"dsg-table--shift-range":t.selectable&&Ue(v)}]]),onClick:d=>Te(d,v,o),onDblclick:d=>Ne(d,v,o),onMouseover:d=>Re(),onMouseenter:d=>He(v),onMouseleave:l[4]||(l[4]=d=>Ae())},[t.selectable?(e.openBlock(),e.createElementBlock("td",{key:0,class:"dsg-table--tbody-cell dsg-table--tbody-cell-checkbox",onClickCapture:d=>b(d,o,v)},[e.createVNode(p._sfc_main$2,{modelValue:o.selected,"onUpdate:modelValue":[d=>o.selected=d,d=>i(o,v)]},null,8,["modelValue","onUpdate:modelValue"])],40,pt)):e.createCommentVNode("",!0),t.hasDetailRow&&t.expandableRows?(e.openBlock(),e.createElementBlock("td",Bt,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["dsg-table--expand-toggle",{"is-expanded":H(o)}]),"aria-expanded":H(o),"aria-label":"Toggle row details",onClick:e.withModifiers(d=>K(o,v),["stop"])},[e.createVNode(p._sfc_main,{icon:"chevron-right",size:"sm",class:"dsg-table--expand-icon"})],10,Ct)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(d,C)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:C},[d.visible?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["dsg-table--tbody-cell",d.dataClass]),style:e.normalizeStyle({width:d.width||void 0}),onClick:L=>Me(),onDblclick:L=>Fe(),onContextmenu:L=>Le()},[e.renderSlot(a.$slots,Z(d),{rowData:o,rowIndex:v,rowField:d},()=>[e.createElementVNode("span",{innerHTML:X(d,o)},null,8,Et)])],46,St)):e.createCommentVNode("",!0)],64))),128))],42,yt),t.hasDetailRow&&(!t.expandableRows||H(o))?(e.openBlock(),e.createBlock(e.Transition,{key:0,name:t.detailRowTransition},{default:e.withCtx(()=>[e.createElementVNode("tr",{class:e.normalizeClass(["dsg-table--tbody-detail-row",{"is-expanded":t.expandableRows&&H(o)}]),onClick:d=>ze()},[e.createElementVNode("td",{colspan:U.value},[e.renderSlot(a.$slots,"dsg-table-detail-row",{rowData:o,rowIndex:v,options:t.detailRowOptions,isExpanded:t.expandableRows?H(o):!0})],8,Dt)],10,Pt)]),_:2},1032,["name"])):e.createCommentVNode("",!0)],64))),128)),!w.value&&!m.value?.length&&t.noDataTemplate.length?(e.openBlock(),e.createElementBlock("tr",xt,[e.createElementVNode("td",{colspan:U.value,class:"dsg-table--empty-result"},[e.renderSlot(a.$slots,"dsg-table-empty-result",{},()=>[e.createTextVNode(e.toDisplayString(t.noDataTemplate),1)])],8,$t)])):e.createCommentVNode("",!0)],2),e.createElementVNode("tfoot",Vt,[e.renderSlot(a.$slots,"dsg-table-footer",{fields:g.value,data:m.value})])],2)],6)],6))}}),Nt={class:"dsg-table"},Rt={key:0,class:"dsg-table--pre-header"},Mt={class:"dsg-table--pre-header-left"},Ft=["textContent"],Lt={class:"dsg-table--pre-header-right"},zt={key:1,class:"dsg-table--search-header",ref:"dsgTableSearchHeaderEl"},Ht={class:"dsg-table--search-top"},At={key:2,class:"dsg-table--footer",ref:"dsgTableFooterEl"},Ut={class:"dsg-table--footer-left"},qt={class:"dsg-table--footer-center"},It={class:"dsg-table--footer-right"},Ot=e.defineComponent({__name:"DsgTable",props:{getUrl:{},fields:{},loadOnStart:{type:Boolean,default:!0},displaySearch:{type:Boolean,default:!0},displayPaginationInfo:{type:Boolean,default:!0},reloadOnChangeTimer:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},shiftSelectHighlight:{default:()=>{}},selectedRowHighlight:{default:()=>{}},trackBy:{default:"id"},title:{default:""},filters:{default:()=>{}},initialFilters:{default:()=>({})},filterEntity:{default:""},filterEndpoint:{default:""},filterSearchEndpoint:{default:""},tableLayout:{default:"fixed"},autoSortFilters:{type:Boolean,default:!0},data:{default:null},hasHeader:{type:Boolean,default:!0},hasFooter:{type:Boolean,default:!0},perPage:{default:20},paginationPath:{default:"meta"},css:{default:()=>({tableWrapper:"border-b"})},rowClass:{type:[String,Function],default:void 0},apiMode:{type:Boolean,default:!0},replaceState:{type:Boolean,default:!0},replaceStrategy:{default:"window"},hasDetailRow:{type:Boolean,default:!1},expandableRows:{type:Boolean,default:!1},expandMultiple:{type:Boolean,default:!1},showExpandDetail:{type:Boolean,default:!0},detailRowTransition:{default:"fade"},detailRowOptions:{default:()=>({})}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:action-archive","dsg-table:link-clicked","dsg-table:rows-selected","dsg-table:row-clicked","dsg-table:row-hover","dsg-table:row-dblclick","dsg-table:filter-updated","dsg-table:term-changed","dsg-table:data-loaded","dsg-table:row-expanded","dsg-table:row-collapsed"],setup(t,{expose:x,emit:f}){const c=s=>{w.value=s},S=e.ref(t.apiMode&&!!(t.filterEntity||t.filterEndpoint||t.getUrl)),$=()=>{if(S.value){let s={};return p.getQueryStrings().forEach(r=>{if(r.key.startsWith("filter[")){const i=r.key.replace("filter[","").replace("]",""),b=r.value;s[`filter[${i}]`]=b.join(",")}}),s}else return{}},g=e.computed(()=>({...t.css,tableWrapper:"border-b "+(t.css?.tableWrapper||"")})),m=e.useSlots(),V=e.ref(!0),P=e.ref(null),E=e.ref("<p>Showing {from} to {to} of {total}</p>"),h=e.ref(null),n=e.useTemplateRef("dsgTable"),u=e.ref({perPage:t.perPage,change:c}),w=e.ref(t.perPage),k=e.ref({...$(),...t.initialFilters}),y=f,N=s=>{n.value?.changePage(s)},I=s=>{h.value=s},j=({data:s})=>{P.value=s,y("dsg-table:data-loaded",s)},D=()=>{n.value?.reload()},O=s=>{n.value?.setLoading(s)},M=s=>{const r=n.value?.getData?.()??[];n.value?.setData(r.map(i=>i.id===s.id?s:i))},R=s=>{const r=n.value?.getData?.()??[];n.value?.setData([...r,s])},F=s=>{const r=n.value?.getData?.()??[];n.value?.setData(r.filter(i=>i.id!==s.id))},z=s=>{n.value?.setData(s)},A=()=>n.value?.getData()??[],U=s=>{const r=n.value?.getData()??[],i=s(r);i&&n.value?.setData(i)},J=s=>{n.value?.expandRow(s)},T=s=>{n.value?.collapseRow(s)},X=(s,r)=>{n.value?.toggleRowExpand(s,r)},Z=()=>{n.value?.expandAllRows()},_=()=>{n.value?.collapseAllRows()},H=()=>n.value?.getExpandedRows()??new Set,K=s=>{k.value=s},ee=()=>k.value??{},Q=s=>{const r={...k.value};!s||s.trim()===""?delete r["filter[term]"]:r["filter[term]"]=s,k.value=r,e.nextTick(()=>{D()}),y("dsg-table:term-changed",s)},te=(s,r,i)=>{let b={};k.value["filter[term]"]&&(b["filter[term]"]=k.value["filter[term]"]),Object.keys(s).forEach(B=>{s[B]!==null&&s[B]!==void 0&&s[B]!==""&&(b[B]=s[B])}),k.value=b,e.nextTick(()=>{D()}),y("dsg-table:filter-updated",k.value,r,i)};return x({reloadTable:D,updateRowTable:M,addRowTable:R,deleteRowTable:F,setData:z,getData:A,mutateData:U,termChanged:Q,setFilters:K,getFilters:ee,setLoading:O,expandRow:J,collapseRow:T,toggleRowExpand:X,expandAllRows:Z,collapseAllRows:_,getExpandedRows:H,changePage:N}),(s,r)=>(e.openBlock(),e.createElementBlock("div",Nt,[t.hasHeader?(e.openBlock(),e.createElementBlock("div",Rt,[e.renderSlot(s.$slots,"dsg-table--pre-header",{},()=>[e.createElementVNode("div",Mt,[e.renderSlot(s.$slots,"dsg-table--page-title",{data:P.value,title:t.title},()=>[t.title.length>0?(e.openBlock(),e.createElementBlock("h1",{key:0,class:"dsg-table--title",textContent:e.toDisplayString(t.title)},null,8,Ft)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Lt,[e.renderSlot(s.$slots,"dsg-table--page-actions",{data:P.value})])])])):e.createCommentVNode("",!0),t.displaySearch?(e.openBlock(),e.createElementBlock("div",zt,[e.createElementVNode("div",Ht,[e.renderSlot(s.$slots,"dsg-table--search-header",{data:P.value},()=>[e.createVNode(he,{name:"term","onDsgTable:termChanged":r[0]||(r[0]=i=>Q(i))}),e.createVNode(p._sfc_main$7,{entity:t.filterEntity,"filter-endpoint":t.filterEndpoint,"search-endpoint":t.filterSearchEndpoint,"auto-sort":t.autoSortFilters,filters:t.filters,"onDsgTable:filterUpdated":r[1]||(r[1]=(i,b,B)=>te(i,b,B))},null,8,["entity","filter-endpoint","search-endpoint","auto-sort","filters"]),e.renderSlot(s.$slots,"dsg-table--search-actions",{data:P.value})])]),e.renderSlot(s.$slots,"dsg-table--search-navigation")],512)):e.createCommentVNode("",!0),e.createVNode(Tt,{ref:"dsgTable","api-url":t.getUrl,"filter-params":k.value,"onUpdate:filterParams":r[7]||(r[7]=i=>k.value=i),"per-page":w.value,"onUpdate:perPage":r[8]||(r[8]=i=>w.value=i),fields:t.fields,"load-on-start":t.loadOnStart,"pagination-path":t.paginationPath,selectable:t.selectable,"shift-select-highlight":t.shiftSelectHighlight,"selected-row-highlight":t.selectedRowHighlight,"track-by":t.trackBy,"table-layout":t.tableLayout,css:g.value,data:t.data,"row-class":t.rowClass,"api-mode":S.value,"replace-state":t.replaceState,"replace-strategy":t.replaceStrategy,"has-detail-row":t.hasDetailRow,"expandable-rows":t.expandableRows,"expand-multiple":t.expandMultiple,"show-expand-detail":t.showExpandDetail,"detail-row-transition":t.detailRowTransition,"detail-row-options":t.detailRowOptions,"onDsgTable:loading":r[9]||(r[9]=i=>V.value=!0),"onDsgTable:loaded":r[10]||(r[10]=i=>V.value=!1),"onDsgTable:paginationData":I,"onDsgTable:loadSuccess":j,"onDsgTable:rowsSelected":r[11]||(r[11]=i=>y("dsg-table:rows-selected",i)),"onDsgTable:rowClicked":r[12]||(r[12]=(i,b,B)=>y("dsg-table:row-clicked",i,b,B)),"onDsgTable:rowHover":r[13]||(r[13]=(i,b,B)=>y("dsg-table:row-hover",i,b,B)),"onDsgTable:rowDblclick":r[14]||(r[14]=(i,b,B)=>y("dsg-table:row-dblclick",i,b,B)),"onDsgTable:rowExpanded":r[15]||(r[15]=(i,b)=>y("dsg-table:row-expanded",i,b)),"onDsgTable:rowCollapsed":r[16]||(r[16]=(i,b)=>y("dsg-table:row-collapsed",i,b))},e.createSlots({"dsg-field--actions":e.withCtx(i=>[e.renderSlot(s.$slots,"dsg-table-actions",{data:i},()=>[(e.openBlock(),e.createBlock(be,{key:i.rowIndex,data:i,"onDsgTable:actionEdit":r[2]||(r[2]=(b,B)=>y("dsg-table:action-edit",b,B)),"onDsgTable:actionView":r[3]||(r[3]=(b,B)=>y("dsg-table:action-view",b,B)),"onDsgTable:actionDelete":r[4]||(r[4]=(b,B)=>y("dsg-table:action-delete",b,B)),"onDsgTable:actionArchive":r[5]||(r[5]=(b,B)=>y("dsg-table:action-archive",b,B)),"onDsgTable:linkClicked":r[6]||(r[6]=(b,B,ae)=>y("dsg-table:link-clicked",b,B,ae))},null,8,["data"]))])]),_:2},[e.renderList(e.unref(m),(i,b)=>({name:b,fn:e.withCtx(B=>[String(b)!=="dsg-field--actions"?e.renderSlot(s.$slots,b,e.normalizeProps(e.mergeProps({key:0},B))):e.createCommentVNode("",!0)])}))]),1032,["api-url","filter-params","per-page","fields","load-on-start","pagination-path","selectable","shift-select-highlight","selected-row-highlight","track-by","table-layout","css","data","row-class","api-mode","replace-state","replace-strategy","has-detail-row","expandable-rows","expand-multiple","show-expand-detail","detail-row-transition","detail-row-options"]),t.hasFooter?(e.openBlock(),e.createElementBlock("div",At,[e.createElementVNode("div",Ut,[e.renderSlot(s.$slots,"dsg-table--footer-left",{data:h.value,perPage:u.value},()=>[t.displayPaginationInfo?(e.openBlock(),e.createBlock(ve,{key:0,ref:"paginationInfoStart",pagination:h.value,"onUpdate:pagination":r[17]||(r[17]=i=>h.value=i),"info-template":E.value},null,8,["pagination","info-template"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"dsg-table--footer-left-extras",{data:h.value,perPage:u.value})])]),e.createElementVNode("div",qt,[e.renderSlot(s.$slots,"dsg-table--footer-center",{data:h.value,perPage:u.value},()=>[e.renderSlot(s.$slots,"dsg-table--footer-center-extras",{data:h.value,perPage:u.value})])]),e.createElementVNode("div",It,[e.renderSlot(s.$slots,"dsg-table--footer-right",{data:h.value,perPage:u.value},()=>[V.value===!1&&t.displayPaginationInfo?(e.openBlock(),e.createBlock(me,{key:0,ref:"pagination",pagination:h.value,"onUpdate:pagination":r[18]||(r[18]=i=>h.value=i),"onDsgTable:changePage":N},null,8,["pagination"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"dsg-table--footer-right-extras",{data:h.value,perPage:u.value})])])],512)):e.createCommentVNode("",!0)]))}}),Wt={class:"dsg-table--per-page"},jt=["value","textContent"],Kt=e.defineComponent({__name:"DsgTablePerPage",props:{perPageOptions:{default:()=>[10,20,30,50,100]},perPage:{}},setup(t){return(x,f)=>(e.openBlock(),e.createElementBlock("div",Wt,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":f[0]||(f[0]=c=>t.perPage.perPage=c),class:"dsg-table--per-page-select",onChange:f[1]||(f[1]=c=>t.perPage.change(t.perPage.perPage))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.perPageOptions,c=>(e.openBlock(),e.createElementBlock("option",{key:c,value:c,textContent:e.toDisplayString(c)},null,8,jt))),128))],544),[[e.vModelSelect,t.perPage.perPage]])]))}}),we=Ot,ye=be,pe=Kt,Be=p._sfc_main$7,Ce=me,Se=ve,Ee=he,Pe=ke,Qt={DsgTable:we,DsgTableActions:ye,DsgTablePerPage:pe,DsgTableFilter:Be,DsgTablePagination:Ce,DsgTablePaginationInfo:Se,DsgTableSearch:Ee,DsgTableRowHeader:Pe};exports.DsgTable=we;exports.DsgTableActions=ye;exports.DsgTableFilter=Be;exports.DsgTablePagination=Ce;exports.DsgTablePaginationInfo=Se;exports.DsgTablePerPage=pe;exports.DsgTableRowHeader=Pe;exports.DsgTableSearch=Ee;exports.default=Qt;