@dcodegroup-au/dsg-vue 0.0.25 → 0.0.26
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.
- package/dist/components/Table/DsgTable.vue.d.ts +4 -0
- package/dist/dsg-vue.table.cjs +2 -2
- package/dist/dsg-vue.table.esm.js +252 -252
- package/dist/table.d.ts +20 -0
- package/package.json +1 -1
|
@@ -304,12 +304,16 @@ declare const __VLS_component: import('vue').DefineComponent<DsgTableProps, {
|
|
|
304
304
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|
|
305
305
|
"dsg-table:action-delete": (ev: Event, rowData: Record<string, any>) => any;
|
|
306
306
|
"dsg-table:link-clicked": (ev: Event, actionId: string | number, rowData: Record<string, any>) => any;
|
|
307
|
+
"dsg-table:term-changed": (term: string | null) => any;
|
|
308
|
+
"dsg-table:filter-updated": (params: any, payload: any, activeFacet: DsgTableSearchFacet | null | undefined) => any;
|
|
307
309
|
"dsg-table:rows-selected": (rows: any) => any;
|
|
308
310
|
}, string, import('vue').PublicProps, Readonly<DsgTableProps> & Readonly<{
|
|
309
311
|
"onDsg-table:action-edit"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
310
312
|
"onDsg-table:action-view"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
311
313
|
"onDsg-table:action-delete"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
312
314
|
"onDsg-table:link-clicked"?: ((ev: Event, actionId: string | number, rowData: Record<string, any>) => any) | undefined;
|
|
315
|
+
"onDsg-table:term-changed"?: ((term: string | null) => any) | undefined;
|
|
316
|
+
"onDsg-table:filter-updated"?: ((params: any, payload: any, activeFacet: DsgTableSearchFacet | null | undefined) => any) | undefined;
|
|
313
317
|
"onDsg-table:rows-selected"?: ((rows: any) => any) | undefined;
|
|
314
318
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
315
319
|
dsgTable: ({
|
package/dist/dsg-vue.table.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),B=require("./DsgTablePerPage.vue_vue_type_style_index_0_lang-C0UR1yia.cjs"),U=require("./dsg-vue.helpers-string.cjs"),O=require("./dsg-vue.helpers-object.cjs"),ge={class:"dsg-table--pagination"},me=["disabled"],fe=["disabled"],ve=["onClick","innerHTML"],pe=["onClick","innerHTML"],be=["disabled"],ke=["disabled"],K=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(a,{expose:h,emit:g}){const s=e.useModel(a,"pagination"),f=e.computed(()=>s.value===null?0:s.value?.last_page-a.firstPage+1),m=e.computed(()=>s.value===null?0:s.value?.last_page),p=e.computed(()=>s.value===null?!1:s.value?.current_page===a.firstPage),v=e.computed(()=>s.value===null?!1:s.value?.current_page===m.value),S=e.computed(()=>f.value<a.onEachSide*2+4),N=e.computed(()=>a.onEachSide*2+1),r=e.computed(()=>!s.value||s.value?.current_page<=a.onEachSide?1:s.value?.current_page>=f.value-a.onEachSide?f.value-a.onEachSide*2:s.value?.current_page-a.onEachSide),b=g,l=i=>{b("dsg-table:change-page",i)},u=i=>i===s.value?.current_page;return h({loadPage:l}),(i,C)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",ge,[i.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:C[0]||(C[0]=D=>l(i.firstPage)),class:e.normalizeClass([[p.value?"disabled":""],"dsg-table--pagination-link"]),disabled:p.value,title:"First","aria-label":"First"},[e.createVNode(B._sfc_main,{icon:i.firstIcon,size:"sm"},null,8,["icon"])],10,me)):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:C[1]||(C[1]=D=>l("prev")),class:e.normalizeClass([[p.value?"disabled":""],"dsg-table--pagination-link"]),disabled:p.value,title:"Previous","aria-label":"Previous"},[e.createVNode(B._sfc_main,{icon:i.prevIcon,size:"sm"},null,8,["icon"])],10,fe),S.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(f.value,(D,y)=>(e.openBlock(),e.createElementBlock("a",{key:y,onClick:T=>l(y+i.firstPage),class:e.normalizeClass([[u(y+i.firstPage)?"active":""],"dsg-table--pagination-link"]),innerHTML:D},null,10,ve))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(N.value,(D,y)=>(e.openBlock(),e.createElementBlock("a",{key:y,onClick:T=>l(r.value+y+i.firstPage-1),class:e.normalizeClass([[u(r.value+y+i.firstPage-1)?"active":""],"dsg-table--pagination-link"]),innerHTML:r.value+D-1},null,10,pe))),128)),e.createElementVNode("a",{onClick:C[2]||(C[2]=D=>l("next")),class:e.normalizeClass([[v.value?"disabled":""],"dsg-table--pagination-link"]),disabled:v.value,title:"Next","aria-label":"Next"},[e.createVNode(B._sfc_main,{icon:i.nextIcon,size:"sm"},null,8,["icon"])],10,be),i.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:3,onClick:C[3]||(C[3]=D=>l(m.value)),class:e.normalizeClass([[v.value?"disabled":""],"dsg-table--pagination-link"]),disabled:v.value,title:"Last","aria-label":"Last"},[e.createVNode(B._sfc_main,{icon:i.lastIcon,size:"sm"},null,8,["icon"])],10,ke)):e.createCommentVNode("",!0)],512)),[[e.vShow,s.value&&m.value>i.firstPage]])}}),he=["innerHTML"],Q=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(a){const h=e.useModel(a,"pagination"),g=e.computed(()=>h.value==null||h.value.total==0?a.noDataTemplate:a.infoTemplate.replace("{from}",(h.value?.from||0).toString()).replace("{to}",(h.value?.to||0).toString()).replace("{total}",(h.value?.total||0).toString()));return(s,f)=>(e.openBlock(),e.createElementBlock("div",{class:"dsg-table--pagination-info",innerHTML:g.value},null,8,he))}}),ye={class:"dsg-table--actions",ref:"dsgTableActions"},Be={class:"dsg-table--action-trigger"},Ce={key:0,class:"dsg-table--actions-menu-wrapper"},we=["href","target","onClick"],Pe=["textContent"],Ee={key:0},Se=["href","target","onClick"],De={class:"flex-1"},Y=e.defineComponent({__name:"DsgTableActions",props:{placement:{default:"auto"}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:link-clicked"],setup(a,{emit:h}){const g=e.ref(!1);e.useTemplateRef("dsgTableActions");const s=e.useAttrs(),f=e.ref(s.data.rowData?.actions??null),m=e.ref(s.data.rowData?.links??null),p=e.ref(s.data.rowData??null),v=b=>{switch(b){case"edit":return"edit-05";case"view":return"eye";case"delete":return"trash-01";default:return"dots-horizontal"}},S=(b,l,u)=>{switch(l){case"edit":r("dsg-table:action-edit",u,p.value);break;case"view":r("dsg-table:action-view",u,p.value);break;case"delete":r("dsg-table:action-delete",u,p.value);break}},N=(b,l)=>{const u=b.actionId||b.label.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-");r("dsg-table:link-clicked",l,u,p.value)},r=h;return(b,l)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(e.unref(B.kt),{triggers:[],placement:b.placement,"handle-resize":!0,strategy:"absolute",shown:g.value,class:"dsg-table--actions__popper",onHide:l[1]||(l[1]=u=>g.value=!1),ref:"floatingVueFilterDropdown"},{popper:e.withCtx(()=>[g.value?(e.openBlock(),e.createElementBlock("div",Ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(u,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[["edit","view","delete"].includes(String(i))?(e.openBlock(),e.createElementBlock("a",{key:i,href:f.value?.link,target:f.value?.target||"_self",onClick:C=>S(u,String(i),C)},[e.createElementVNode("div",{class:e.normalizeClass(["dsg-table--actions-menu-item",String(i)])},[e.createVNode(B._sfc_main,{icon:v(String(i)),size:"sm"},null,8,["icon"]),e.createElementVNode("span",{class:"flex-1",textContent:e.toDisplayString(e.unref(U.ucfirst)(String(i)))},null,8,Pe)],2)],8,we)):e.createCommentVNode("",!0)],64))),256)),f.value&&m.value?(e.openBlock(),e.createElementBlock("hr",Ee)):e.createCommentVNode("",!0),m.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(m.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(s).data.data.rowData,"row-data":e.unref(s).data.data.rowData},null,8,["quote","row-data"])):e.createCommentVNode("",!0),e.createElementVNode("a",{href:u.link,target:u.target||"_self",class:"dsg-table--actions-menu-item",onClick:i=>N(u,i)},[u.icon?(e.openBlock(),e.createBlock(B._sfc_main,{key:0,icon:u.icon,size:"sm"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",De,e.toDisplayString(u.label),1)],8,Se)],64))),128)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("div",Be,[e.createElementVNode("button",{type:"button",class:"dsg-table--actions-button","aria-expanded":"false","aria-haspopup":"true",onClick:l[0]||(l[0]=u=>g.value=!g.value)},[e.renderSlot(b.$slots,"dsg-table-action-button-content",{},()=>[e.createVNode(B._sfc_main,{icon:"dots-vertical",size:"sm"})])])])]),_:3},8,["placement","shown"])])),[[e.unref(B.vOnClickOutside),()=>g.value=!1]])}}),$e={class:"dsg-table--search"},G=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:{}},emits:["dsg-table:term-changed"],setup(a,{emit:h}){const g=e.ref(""),s=h,f=B.useDebounceFn(m=>{g.value=m,s("dsg-table:term-changed",g.value)},300);return(m,p)=>(e.openBlock(),e.createElementBlock("div",$e,[e.createVNode(B._sfc_main$5,{value:g.value,"onUpdate:value":p[0]||(p[0]=v=>g.value=v),name:m.name,id:m.id||m.name,placeholder:m.placeholder,disabled:m.disabled,required:m.required,readonly:m.readonly,hidden:m.hidden,"has-clear-button":!0,autocomplete:"off",size:"sm",icon:"search-sm","icon-clickable":!0,onIconClicked:p[1]||(p[1]=v=>e.unref(f)(v)),onEnterPressed:p[2]||(p[2]=v=>e.unref(f)(v)),onOnClear:p[3]||(p[3]=()=>e.unref(f)(""))},null,8,["value","name","id","placeholder","disabled","required","readonly","hidden"])]))}}),Ve={class:"dsg-table--header-row"},Ne={key:0,class:"dsg-table--th dsg-table--th-checkbox",scope:"col"},Te={key:1,class:"dsg-table--th dsg-table--th-expand-detail",scope:"col"},Fe=["title","id","onClick"],Me={key:0,class:"dsg-table--th-sort-icon"},Le=["innerHTML"],ze=["innerHTML"],J=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(a,{emit:h}){const g=e.useModel(a,"sortField"),s=e.useModel(a,"selectedRows"),f=e.useModel(a,"hasSelected"),m=e.ref("17px"),p=r=>{f.value&&s.value.length>0&&s.value.length!==a.tableDataLength?(f.value=!0,v("dsg-table:on-select-all")):!f.value&&s.value.length===0?(f.value=!1,v("dsg-table:on-select-all")):v("dsg-table:on-deselect-all")},v=h,S=(r,b)=>[r,r+"-"+U.toSnakeCase(String(b?.name)),b.titleClass||"",{sortable:b.sortable},{"sort-active":g.value?.name===b.name}],N=r=>{r.sortable&&(g.value={name:String(r?.name),field:String(r?.sortField),direction:g.value?.name===r.name&&g.value?.direction==="asc"?"desc":"asc"},v("dsg-table:sort-field",r))};return(r,b)=>(e.openBlock(),e.createElementBlock("tr",Ve,[r.hasSelectAll?(e.openBlock(),e.createElementBlock("th",Ne,[e.createVNode(B._sfc_main$2,{modelValue:f.value,"onUpdate:modelValue":[b[0]||(b[0]=l=>f.value=l),p],indeterminate:s.value.length>0&&s.value.length!==r.tableDataLength},null,8,["modelValue","indeterminate"])])):e.createCommentVNode("",!0),r.showExpandDetail?(e.openBlock(),e.createElementBlock("th",Te)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.fields,(l,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[l?.visible?(e.openBlock(),e.createElementBlock("th",{key:u,class:e.normalizeClass(S("dsg-table--th",l)),style:e.normalizeStyle([{width:l.width||void 0},l.style]),title:l.title+(l.sortable?" Sort":""),id:"_"+l.name,onClick:i=>N(l),scope:"col"},[l.sortable?(e.openBlock(),e.createElementBlock("div",Me,[l.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:"dsg-table--th-title",innerHTML:l.title},null,8,Le)):e.createCommentVNode("",!0),l.sortable&&g.value?.name!==l.name?(e.openBlock(),e.createBlock(B._sfc_main,{key:1,icon:"chevron-selector-vertical",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),l.sortable&&g.value?.name===l.name&&g.value?.direction==="asc"?(e.openBlock(),e.createBlock(B._sfc_main,{key:2,icon:"chevron-down",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),l.sortable&&g.value?.name===l.name&&g.value?.direction==="desc"?(e.openBlock(),e.createBlock(B._sfc_main,{key:3,icon:"chevron-up",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("span",{key:1,class:"dsg-table--th-title",innerHTML:e.unref(U.ucwords)(String(l?.title))},null,8,ze))],14,Fe)):e.createCommentVNode("",!0)],64))),256)),r.scrollVisible?(e.openBlock(),e.createElementBlock("th",{key:2,style:e.normalizeStyle({width:m.value}),class:"dsg-table--th-col-gutter"},null,4)):e.createCommentVNode("",!0)]))}}),Re={class:"dsg-table--wrapper"},He=["span"],Ie={key:0,class:"dsg-table--loading"},Ae=["colspan"],Oe=["colspan"],Ue=["onClick","onDblclick","onMouseover"],qe={key:0,class:"dsg-table--tbody-cell dsg-table--tbody-cell-checkbox"},We=["onClick","onDblclick","onContextmenu"],xe=["innerHTML"],je=["onClick"],Ke=["colspan"],Qe={key:2},Ye=["colspan"],Ge={class:"dsg-table--footer"},Je=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},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}},{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"],["update:filterParams","update:perPage"]),setup(a,{expose:h,emit:g}){const s=t=>t.map((n,d)=>({field:n.field||"",title:n.title||"",name:n.name||"",titleClass:n.titleClass||"",dataClass:n.dataClass||"",visible:n.visible!==!1,width:n.width||void 0,sortField:n.sortField||null,sortable:n.sortField,formatter:n.formatter||null,$_index:d})),f=e.ref(s(a.fields)),m=e.ref(a.data),p=e.ref(null),v=e.ref(a.initialPage),S=e.ref("17px"),N=e.ref(!1),r=e.ref({}),b=e.ref(0),l=e.ref(!0),u=e.ref(null),i=e.ref(null),C=e.useModel(a,"filterParams"),D=e.useModel(a,"perPage"),y=e.ref([]),T=e.ref(!1),F=e.computed(()=>a.tableHeight!=null),M=e.computed(()=>f.value.filter(t=>t.visible).length);e.watch(()=>y.value.length,t=>{T.value=a.selectable&&t>0},{immediate:!0}),e.watch(()=>a.fields,t=>{f.value=s(t)},{immediate:!0}),e.watch(()=>C.value,()=>{z()},{deep:!0}),e.watch(()=>D.value,()=>{z()});const $=g,R=(t,n)=>t.formatter&&typeof t.formatter=="function"?t.formatter(t,n):O.data_get(n,String(t?.name),""),H=t=>"dsg-field--"+t.name?.toLowerCase().replaceAll(/[_ ]/g,"-"),o=t=>{if(a.selectable){if(t.selected)y.value.push(t);else{const n=y.value.findIndex(d=>d[a.trackBy]===t[a.trackBy]);n!==-1&&y.value.splice(n,1)}$("dsg-table:rows-selected",y.value)}},c=()=>{a.selectable&&(m.value?.forEach(t=>{t.selected=!0}),y.value=m.value?.filter(t=>t.selected)??[],$("dsg-table:rows-selected",y.value))},k=()=>{a.selectable&&(m.value?.forEach(t=>{t.selected=!1}),y.value=[],$("dsg-table:rows-selected",y.value))},w=t=>{t==="prev"?v.value>a.firstPage&&v.value--:t==="next"?v.value<(p.value?.last_page??0)&&v.value++:t!=v.value&&t>=a.firstPage&&t<=(p.value?.last_page??0)&&(v.value=t),z()},V=()=>({[a.queryParams?.sort]:u.value?(u.value?.direction==="desc"?"-":"")+u.value?.field:void 0,[a.queryParams?.order]:u.value?.direction,[a.queryParams?.page]:v.value,[a.queryParams?.perPage]:D.value}),L=()=>{i.value&&(i.value.abort(),i.value=null)},I=async(t,n)=>{L();const d=new AbortController;if(n.signal=d.signal,i.value=d,a.httpMethod.toLowerCase()==="get")return await B.axios.get(t,n);{const E=n.params;return delete n.params,await B.axios.post(t,E,n)}},q=t=>{$("dsg-table:load-success",t);const n=a.transform?a.transform(t.data):t.data;m.value=O.data_get(n,a.dataPath,null),a.selectable&&m.value?.forEach(d=>{d.selected=d.selected??!1}),p.value=O.data_get(n,a.paginationPath,null)??null,b.value=m.value?.length?m.value[0].order:b,p.value===null&&console.warn('DsgTable: pagination-path "'+a.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="".`),$("dsg-table:pagination-data",p.value),$("dsg-table:loaded"),l.value=!1},W=t=>{console.error("load-error",t),$("dsg-table:load-error",t),$("dsg-table:loaded"),l.value=!1},z=(t=q,n=W,d={})=>{const E=t||q,P=n||W;if(a.apiMode)return l.value=!0,$("dsg-table:loading",l.value),a.httpOptions.params={...V(),...C.value},I(a.apiUrl,a.httpOptions).then(E).catch(A=>P(A))},ne=(t,n,d)=>{},se=(t,n,d)=>{},re=(t,n,d)=>{},ie=(t,n,d,E)=>{},de=(t,n,d,E)=>{},ce=(t,n,d,E)=>{},ue=(t,n,d)=>{};e.onMounted(()=>{a.apiMode===!0&&z()});const x=()=>{a.apiMode&&(v.value=a.initialPage,y.value=[],L(),z())};return h({changePage:w,reload:x}),(t,n)=>(e.openBlock(),e.createElementBlock("div",Re,[e.createElementVNode("div",{ref:"dsgTableBodyWrapper",class:e.normalizeClass(["dsg-table-body-wrapper",{"fixed-header":F.value}]),style:e.normalizeStyle({height:t.tableHeight||void 0})},[e.createElementVNode("table",{class:e.normalizeClass(["dsg-table-main",F.value?"fixed-header":"",r.value.table,"table-"+t.tableLayout])},[e.createElementVNode("colgroup",{span:M.value},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(d,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[d?.visible?(e.openBlock(),e.createElementBlock("col",{key:E,style:e.normalizeStyle({width:d.width||void 0}),class:e.normalizeClass("dsg-table--col-"+d.name+" "+d.titleClass)},null,6)):e.createCommentVNode("",!0)],64))),256)),!F.value&&N.value?(e.openBlock(),e.createElementBlock("col",{key:0,style:e.normalizeStyle({width:S.value}),class:"dsg-table--col-gutter"},null,4)):e.createCommentVNode("",!0)],8,He),e.createElementVNode("thead",{class:e.normalizeClass([[r.value.thead,{sticky:F.value,"top-0":F.value}],"dsg-table--head"])},[e.renderSlot(t.$slots,"tableHeader",{fields:f.value},()=>[e.createVNode(J,{fields:f.value,"has-select-all":t.selectable,"selected-rows":y.value,"onUpdate:selectedRows":n[0]||(n[0]=d=>y.value=d),"has-selected":T.value,"onUpdate:hasSelected":n[1]||(n[1]=d=>T.value=d),"scroll-visible":N.value,"show-expand-detail":t.hasDetailRow&&t.showExpandDetail,"table-data-length":m.value?.length,"sort-field":u.value,"onUpdate:sortField":n[2]||(n[2]=d=>u.value=d),"onDsgTable:sortField":n[3]||(n[3]=d=>x()),"onDsgTable:onSelectAll":c,"onDsgTable:onDeselectAll":k},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",r.value.tbody])},[l.value?(e.openBlock(),e.createElementBlock("tr",Ie,[e.createElementVNode("td",{colspan:M.value},[e.createElementVNode("div",{"aria-label":"Loading...",role:"status",class:"flex items-center space-x-3 h-12 w-full justify-center",colspan:M.value},[e.renderSlot(t.$slots,"dsg-table-loading",{},()=>[e.createVNode(B._sfc_main,{icon:"loading-02",class:"animate-spin"}),n[4]||(n[4]=e.createElementVNode("span",{class:"text-xs font-medium text-gray-500"},"Loading...",-1))])],8,Oe)],8,Ae)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(m.value,(d,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:E},[e.createElementVNode("tr",{class:e.normalizeClass(["dsg-table--tbody-row",{odd:E%2===0,even:E%2!==0,"row-selected":d.selected}]),onClick:P=>ne(),onDblclick:P=>se(),onMouseover:P=>re()},[t.selectable?(e.openBlock(),e.createElementBlock("td",qe,[e.createVNode(B._sfc_main$2,{modelValue:d.selected,"onUpdate:modelValue":[P=>d.selected=P,P=>o(d)]},null,8,["modelValue","onUpdate:modelValue"])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(P,A)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:A},[P.visible?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["dsg-table--tbody-cell",P.dataClass]),style:e.normalizeStyle({width:P.width||void 0}),onClick:j=>ie(),onDblclick:j=>de(),onContextmenu:j=>ce()},[e.renderSlot(t.$slots,H(P),{rowData:d,rowIndex:E,rowField:P},()=>[e.createElementVNode("span",{innerHTML:R(P,d)},null,8,xe)])],46,We)):e.createCommentVNode("",!0)],64))),128))],42,Ue),t.hasDetailRow?(e.openBlock(),e.createBlock(e.Transition,{key:0,name:t.detailRowTransition},{default:e.withCtx(()=>[e.createElementVNode("tr",{class:"dsg-table--tbody-detail-row",onClick:P=>ue()},[e.createElementVNode("td",{colspan:M.value},[e.renderSlot(t.$slots,"dsg-table-detail-row",{rowData:d,rowIndex:E,options:t.detailRowOptions})],8,Ke)],8,je)]),_:2},1032,["name"])):e.createCommentVNode("",!0)],64))),128)),!m.value?.length&&t.noDataTemplate.length?(e.openBlock(),e.createElementBlock("tr",Qe,[e.createElementVNode("td",{colspan:M.value,class:"dsg-table--empty-result"},[e.renderSlot(t.$slots,"dsg-table-empty-result",{},()=>[e.createTextVNode(e.toDisplayString(t.noDataTemplate),1)])],8,Ye)])):e.createCommentVNode("",!0)],2),e.createElementVNode("tfoot",Ge,[e.renderSlot(t.$slots,"dsg-table-footer",{fields:f.value,data:m.value})])],2)],6)]))}}),Xe={class:"dsg-table"},Ze={class:"dsg-table--pre-header"},_e={class:"dsg-table--pre-header-left"},et=["textContent"],tt={class:"dsg-table--pre-header-right"},at={key:0,class:"dsg-table--search-header"},lt={class:"dsg-table--search-top"},ot={class:"dsg-table--footer"},nt={class:"dsg-table--footer-left"},st={class:"dsg-table--footer-center"},rt={class:"dsg-table--footer-right"},it=e.defineComponent({__name:"DsgTable",props:{getUrl:{},fields:{},loadOnStart:{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:()=>{}},filterEntity:{default:""},filterEndpoint:{default:""},filterSearchEndpoint:{default:""},tableLayout:{default:"fixed"}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:link-clicked","dsg-table:rows-selected"],setup(a,{expose:h,emit:g}){const s=o=>{u.value=o},f=e.ref(!!(a.filterEntity||a.filterEndpoint)),m=()=>{if(f.value){let o={};return B.getQueryStrings().forEach(c=>{if(c.key.startsWith("filter[")){const k=c.key.replace("filter[","").replace("]",""),w=c.value;o[`filter[${k}]`]=w.join(",")}}),o}else return{}},p=e.useSlots(),v=e.ref(!0),S=e.ref(null),N=e.ref("<p>Showing {from} to {to} of {total}</p>"),r=e.ref(null),b=e.useTemplateRef("dsgTable"),l=e.ref({perPage:20,change:s}),u=e.ref(20),i=e.ref(m()),C=g,D=o=>{b.value?.changePage(o)},y=o=>{r.value=o},T=({data:o})=>{S.value=o},F=()=>{v.value===!1&&b.value?.reload()},M=o=>{b.value?.setData(b.value?.tableData.map(c=>c.id===o.id?o:c))},$=o=>{i.value=o},R=o=>{i.value["filter[term]"]=o},H=(o,c)=>{i.value={"filter[term]":i.value["filter[term]"],...o}};return h({reloadTable:F,updateRowTable:M,termChanged:R,setFilters:$}),(o,c)=>(e.openBlock(),e.createElementBlock("div",Xe,[e.createElementVNode("div",Ze,[e.renderSlot(o.$slots,"dsg-table--pre-header",{},()=>[e.createElementVNode("div",_e,[e.renderSlot(o.$slots,"dsg-table--page-title",{data:S.value,title:o.title},()=>[o.title.length>0?(e.openBlock(),e.createElementBlock("h1",{key:0,class:"dsg-table--title",textContent:e.toDisplayString(o.title)},null,8,et)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",tt,[e.renderSlot(o.$slots,"dsg-table--page-actions",{data:S.value})])])]),o.displayPaginationInfo?(e.openBlock(),e.createElementBlock("div",at,[e.createElementVNode("div",lt,[e.renderSlot(o.$slots,"dsg-table--search-header",{data:S.value},()=>[e.createVNode(G,{name:"term","onDsgTable:termChanged":c[0]||(c[0]=k=>R(k))}),e.createVNode(B._sfc_main$7,{entity:o.filterEntity,"filter-endpoint":o.filterEndpoint,"search-endpoint":o.filterSearchEndpoint,filters:o.filters,"onDsgTable:filterUpdated":c[1]||(c[1]=(k,w)=>H(k))},null,8,["entity","filter-endpoint","search-endpoint","filters"]),e.renderSlot(o.$slots,"dsg-table--search-actions",{data:S.value})])]),e.renderSlot(o.$slots,"dsg-table--search-navigation")])):e.createCommentVNode("",!0),e.createVNode(Je,{ref:"dsgTable","api-url":o.getUrl,"filter-params":i.value,"onUpdate:filterParams":c[6]||(c[6]=k=>i.value=k),"per-page":u.value,"onUpdate:perPage":c[7]||(c[7]=k=>u.value=k),fields:o.fields,"load-on-start":o.loadOnStart,"pagination-path":"meta",selectable:o.selectable,"track-by":o.trackBy,"table-layout":o.tableLayout,css:{tableWrapper:"border-b"},"onDsgTable:loading":c[8]||(c[8]=k=>v.value=!0),"onDsgTable:loaded":c[9]||(c[9]=k=>v.value=!1),"onDsgTable:paginationData":y,"onDsgTable:loadSuccess":T,"onDsgTable:rowsSelected":c[10]||(c[10]=k=>C("dsg-table:rows-selected",k))},e.createSlots({"dsg-field--actions":e.withCtx(k=>[e.renderSlot(o.$slots,"dsg-table-actions",{data:k},()=>[(e.openBlock(),e.createBlock(Y,{key:k.rowIndex,data:k,"onDsgTable:actionEdit":c[2]||(c[2]=(w,V)=>C("dsg-table:action-edit",w,V)),"onDsgTable:actionView":c[3]||(c[3]=(w,V)=>C("dsg-table:action-view",w,V)),"onDsgTable:actionDelete":c[4]||(c[4]=(w,V)=>C("dsg-table:action-delete",w,V)),"onDsgTable:linkClicked":c[5]||(c[5]=(w,V,L)=>C("dsg-table:link-clicked",w,V,L))},null,8,["data"]))])]),_:2},[e.renderList(e.unref(p),(k,w)=>({name:w,fn:e.withCtx(({rowData:V,rowField:L,rowIndex:I})=>[String(w)!=="dsg-field--actions"?e.renderSlot(o.$slots,w,e.normalizeProps(e.mergeProps({key:0},{rowData:V,rowField:L,rowIndex:I}))):e.createCommentVNode("",!0)])}))]),1032,["api-url","filter-params","per-page","fields","load-on-start","selectable","track-by","table-layout"]),e.createElementVNode("div",ot,[e.createElementVNode("div",nt,[e.renderSlot(o.$slots,"dsg-table--footer-left",{data:r.value,perPage:l.value},()=>[e.createVNode(Q,{"no-data-template":"",ref:"paginationInfoStart",pagination:r.value,"onUpdate:pagination":c[11]||(c[11]=k=>r.value=k),"info-template":N.value},null,8,["pagination","info-template"]),e.renderSlot(o.$slots,"dsg-table--footer-left-extras",{data:r.value,perPage:l.value})])]),e.createElementVNode("div",st,[e.renderSlot(o.$slots,"dsg-table--footer-center",{data:r.value,perPage:l.value},()=>[e.renderSlot(o.$slots,"dsg-table--footer-center-extras",{data:r.value,perPage:l.value})])]),e.createElementVNode("div",rt,[e.renderSlot(o.$slots,"dsg-table--footer-right",{data:r.value,perPage:l.value},()=>[v.value===!1?(e.openBlock(),e.createBlock(K,{key:0,ref:"pagination",pagination:r.value,"onUpdate:pagination":c[12]||(c[12]=k=>r.value=k),"onDsgTable:changePage":D},null,8,["pagination"])):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"dsg-table--footer-right-extras",{data:r.value,perPage:l.value})])])])]))}}),dt={class:"dsg-table--per-page"},ct=["value","textContent"],ut=e.defineComponent({__name:"DsgTablePerPage",props:{perPageOptions:{default:()=>[10,20,30,50,100]},perPage:{}},setup(a){return(h,g)=>(e.openBlock(),e.createElementBlock("div",dt,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":g[0]||(g[0]=s=>h.perPage.perPage=s),class:"dsg-table--per-page-select",onChange:g[1]||(g[1]=s=>h.perPage.change(h.perPage.perPage))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.perPageOptions,s=>(e.openBlock(),e.createElementBlock("option",{key:s,value:s,textContent:e.toDisplayString(s)},null,8,ct))),128))],544),[[e.vModelSelect,h.perPage.perPage]])]))}}),X=it,Z=Y,_=ut,ee=B._sfc_main$7,te=K,ae=Q,le=G,oe=J,gt={DsgTable:X,DsgTableActions:Z,DsgTablePerPage:_,DsgTableFilter:ee,DsgTablePagination:te,DsgTablePaginationInfo:ae,DsgTableSearch:le,DsgTableRowHeader:oe};exports.DsgTable=X;exports.DsgTableActions=Z;exports.DsgTableFilter=ee;exports.DsgTablePagination=te;exports.DsgTablePaginationInfo=ae;exports.DsgTablePerPage=_;exports.DsgTableRowHeader=oe;exports.DsgTableSearch=le;exports.default=gt;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),B=require("./DsgTablePerPage.vue_vue_type_style_index_0_lang-C0UR1yia.cjs"),U=require("./dsg-vue.helpers-string.cjs"),O=require("./dsg-vue.helpers-object.cjs"),ge={class:"dsg-table--pagination"},me=["disabled"],fe=["disabled"],ve=["onClick","innerHTML"],pe=["onClick","innerHTML"],be=["disabled"],ke=["disabled"],K=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(a,{expose:h,emit:g}){const s=e.useModel(a,"pagination"),f=e.computed(()=>s.value===null?0:s.value?.last_page-a.firstPage+1),m=e.computed(()=>s.value===null?0:s.value?.last_page),p=e.computed(()=>s.value===null?!1:s.value?.current_page===a.firstPage),v=e.computed(()=>s.value===null?!1:s.value?.current_page===m.value),S=e.computed(()=>f.value<a.onEachSide*2+4),N=e.computed(()=>a.onEachSide*2+1),r=e.computed(()=>!s.value||s.value?.current_page<=a.onEachSide?1:s.value?.current_page>=f.value-a.onEachSide?f.value-a.onEachSide*2:s.value?.current_page-a.onEachSide),b=g,o=i=>{b("dsg-table:change-page",i)},u=i=>i===s.value?.current_page;return h({loadPage:o}),(i,C)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",ge,[i.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:C[0]||(C[0]=$=>o(i.firstPage)),class:e.normalizeClass([[p.value?"disabled":""],"dsg-table--pagination-link"]),disabled:p.value,title:"First","aria-label":"First"},[e.createVNode(B._sfc_main,{icon:i.firstIcon,size:"sm"},null,8,["icon"])],10,me)):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:C[1]||(C[1]=$=>o("prev")),class:e.normalizeClass([[p.value?"disabled":""],"dsg-table--pagination-link"]),disabled:p.value,title:"Previous","aria-label":"Previous"},[e.createVNode(B._sfc_main,{icon:i.prevIcon,size:"sm"},null,8,["icon"])],10,fe),S.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(f.value,($,y)=>(e.openBlock(),e.createElementBlock("a",{key:y,onClick:T=>o(y+i.firstPage),class:e.normalizeClass([[u(y+i.firstPage)?"active":""],"dsg-table--pagination-link"]),innerHTML:$},null,10,ve))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(N.value,($,y)=>(e.openBlock(),e.createElementBlock("a",{key:y,onClick:T=>o(r.value+y+i.firstPage-1),class:e.normalizeClass([[u(r.value+y+i.firstPage-1)?"active":""],"dsg-table--pagination-link"]),innerHTML:r.value+$-1},null,10,pe))),128)),e.createElementVNode("a",{onClick:C[2]||(C[2]=$=>o("next")),class:e.normalizeClass([[v.value?"disabled":""],"dsg-table--pagination-link"]),disabled:v.value,title:"Next","aria-label":"Next"},[e.createVNode(B._sfc_main,{icon:i.nextIcon,size:"sm"},null,8,["icon"])],10,be),i.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:3,onClick:C[3]||(C[3]=$=>o(m.value)),class:e.normalizeClass([[v.value?"disabled":""],"dsg-table--pagination-link"]),disabled:v.value,title:"Last","aria-label":"Last"},[e.createVNode(B._sfc_main,{icon:i.lastIcon,size:"sm"},null,8,["icon"])],10,ke)):e.createCommentVNode("",!0)],512)),[[e.vShow,s.value&&m.value>i.firstPage]])}}),he=["innerHTML"],Q=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(a){const h=e.useModel(a,"pagination"),g=e.computed(()=>h.value==null||h.value.total==0?a.noDataTemplate:a.infoTemplate.replace("{from}",(h.value?.from||0).toString()).replace("{to}",(h.value?.to||0).toString()).replace("{total}",(h.value?.total||0).toString()));return(s,f)=>(e.openBlock(),e.createElementBlock("div",{class:"dsg-table--pagination-info",innerHTML:g.value},null,8,he))}}),ye={class:"dsg-table--actions",ref:"dsgTableActions"},Be={class:"dsg-table--action-trigger"},Ce={key:0,class:"dsg-table--actions-menu-wrapper"},we=["href","target","onClick"],Pe=["textContent"],Ee={key:0},Se=["href","target","onClick"],De={class:"flex-1"},Y=e.defineComponent({__name:"DsgTableActions",props:{placement:{default:"auto"}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:link-clicked"],setup(a,{emit:h}){const g=e.ref(!1);e.useTemplateRef("dsgTableActions");const s=e.useAttrs(),f=e.ref(s.data.rowData?.actions??null),m=e.ref(s.data.rowData?.links??null),p=e.ref(s.data.rowData??null),v=b=>{switch(b){case"edit":return"edit-05";case"view":return"eye";case"delete":return"trash-01";default:return"dots-horizontal"}},S=(b,o,u)=>{switch(o){case"edit":r("dsg-table:action-edit",u,p.value);break;case"view":r("dsg-table:action-view",u,p.value);break;case"delete":r("dsg-table:action-delete",u,p.value);break}},N=(b,o)=>{const u=b.actionId||b.label.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-");r("dsg-table:link-clicked",o,u,p.value)},r=h;return(b,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(e.unref(B.kt),{triggers:[],placement:b.placement,"handle-resize":!0,strategy:"absolute",shown:g.value,class:"dsg-table--actions__popper",onHide:o[1]||(o[1]=u=>g.value=!1),ref:"floatingVueFilterDropdown"},{popper:e.withCtx(()=>[g.value?(e.openBlock(),e.createElementBlock("div",Ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(u,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[["edit","view","delete"].includes(String(i))?(e.openBlock(),e.createElementBlock("a",{key:i,href:f.value?.link,target:f.value?.target||"_self",onClick:C=>S(u,String(i),C)},[e.createElementVNode("div",{class:e.normalizeClass(["dsg-table--actions-menu-item",String(i)])},[e.createVNode(B._sfc_main,{icon:v(String(i)),size:"sm"},null,8,["icon"]),e.createElementVNode("span",{class:"flex-1",textContent:e.toDisplayString(e.unref(U.ucfirst)(String(i)))},null,8,Pe)],2)],8,we)):e.createCommentVNode("",!0)],64))),256)),f.value&&m.value?(e.openBlock(),e.createElementBlock("hr",Ee)):e.createCommentVNode("",!0),m.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(m.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(s).data.data.rowData,"row-data":e.unref(s).data.data.rowData},null,8,["quote","row-data"])):e.createCommentVNode("",!0),e.createElementVNode("a",{href:u.link,target:u.target||"_self",class:"dsg-table--actions-menu-item",onClick:i=>N(u,i)},[u.icon?(e.openBlock(),e.createBlock(B._sfc_main,{key:0,icon:u.icon,size:"sm"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",De,e.toDisplayString(u.label),1)],8,Se)],64))),128)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("div",Be,[e.createElementVNode("button",{type:"button",class:"dsg-table--actions-button","aria-expanded":"false","aria-haspopup":"true",onClick:o[0]||(o[0]=u=>g.value=!g.value)},[e.renderSlot(b.$slots,"dsg-table-action-button-content",{},()=>[e.createVNode(B._sfc_main,{icon:"dots-vertical",size:"sm"})])])])]),_:3},8,["placement","shown"])])),[[e.unref(B.vOnClickOutside),()=>g.value=!1]])}}),$e={class:"dsg-table--search"},G=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:{}},emits:["dsg-table:term-changed"],setup(a,{emit:h}){const g=e.ref(""),s=h,f=B.useDebounceFn(m=>{g.value=m,s("dsg-table:term-changed",g.value)},300);return(m,p)=>(e.openBlock(),e.createElementBlock("div",$e,[e.createVNode(B._sfc_main$5,{value:g.value,"onUpdate:value":p[0]||(p[0]=v=>g.value=v),name:m.name,id:m.id||m.name,placeholder:m.placeholder,disabled:m.disabled,required:m.required,readonly:m.readonly,hidden:m.hidden,"has-clear-button":!0,autocomplete:"off",size:"sm",icon:"search-sm","icon-clickable":!0,onIconClicked:p[1]||(p[1]=v=>e.unref(f)(v)),onEnterPressed:p[2]||(p[2]=v=>e.unref(f)(v)),onOnClear:p[3]||(p[3]=()=>e.unref(f)(""))},null,8,["value","name","id","placeholder","disabled","required","readonly","hidden"])]))}}),Ve={class:"dsg-table--header-row"},Ne={key:0,class:"dsg-table--th dsg-table--th-checkbox",scope:"col"},Te={key:1,class:"dsg-table--th dsg-table--th-expand-detail",scope:"col"},Fe=["title","id","onClick"],Me={key:0,class:"dsg-table--th-sort-icon"},Le=["innerHTML"],ze=["innerHTML"],J=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(a,{emit:h}){const g=e.useModel(a,"sortField"),s=e.useModel(a,"selectedRows"),f=e.useModel(a,"hasSelected"),m=e.ref("17px"),p=r=>{f.value&&s.value.length>0&&s.value.length!==a.tableDataLength?(f.value=!0,v("dsg-table:on-select-all")):!f.value&&s.value.length===0?(f.value=!1,v("dsg-table:on-select-all")):v("dsg-table:on-deselect-all")},v=h,S=(r,b)=>[r,r+"-"+U.toSnakeCase(String(b?.name)),b.titleClass||"",{sortable:b.sortable},{"sort-active":g.value?.name===b.name}],N=r=>{r.sortable&&(g.value={name:String(r?.name),field:String(r?.sortField),direction:g.value?.name===r.name&&g.value?.direction==="asc"?"desc":"asc"},v("dsg-table:sort-field",r))};return(r,b)=>(e.openBlock(),e.createElementBlock("tr",Ve,[r.hasSelectAll?(e.openBlock(),e.createElementBlock("th",Ne,[e.createVNode(B._sfc_main$2,{modelValue:f.value,"onUpdate:modelValue":[b[0]||(b[0]=o=>f.value=o),p],indeterminate:s.value.length>0&&s.value.length!==r.tableDataLength},null,8,["modelValue","indeterminate"])])):e.createCommentVNode("",!0),r.showExpandDetail?(e.openBlock(),e.createElementBlock("th",Te)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.fields,(o,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o?.visible?(e.openBlock(),e.createElementBlock("th",{key:u,class:e.normalizeClass(S("dsg-table--th",o)),style:e.normalizeStyle([{width:o.width||void 0},o.style]),title:o.title+(o.sortable?" Sort":""),id:"_"+o.name,onClick:i=>N(o),scope:"col"},[o.sortable?(e.openBlock(),e.createElementBlock("div",Me,[o.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:"dsg-table--th-title",innerHTML:o.title},null,8,Le)):e.createCommentVNode("",!0),o.sortable&&g.value?.name!==o.name?(e.openBlock(),e.createBlock(B._sfc_main,{key:1,icon:"chevron-selector-vertical",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),o.sortable&&g.value?.name===o.name&&g.value?.direction==="asc"?(e.openBlock(),e.createBlock(B._sfc_main,{key:2,icon:"chevron-down",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),o.sortable&&g.value?.name===o.name&&g.value?.direction==="desc"?(e.openBlock(),e.createBlock(B._sfc_main,{key:3,icon:"chevron-up",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("span",{key:1,class:"dsg-table--th-title",innerHTML:e.unref(U.ucwords)(String(o?.title))},null,8,ze))],14,Fe)):e.createCommentVNode("",!0)],64))),256)),r.scrollVisible?(e.openBlock(),e.createElementBlock("th",{key:2,style:e.normalizeStyle({width:m.value}),class:"dsg-table--th-col-gutter"},null,4)):e.createCommentVNode("",!0)]))}}),Re={class:"dsg-table--wrapper"},He=["span"],Ie={key:0,class:"dsg-table--loading"},Ae=["colspan"],Oe=["colspan"],Ue=["onClick","onDblclick","onMouseover"],qe={key:0,class:"dsg-table--tbody-cell dsg-table--tbody-cell-checkbox"},We=["onClick","onDblclick","onContextmenu"],xe=["innerHTML"],je=["onClick"],Ke=["colspan"],Qe={key:2},Ye=["colspan"],Ge={class:"dsg-table--footer"},Je=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},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}},{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"],["update:filterParams","update:perPage"]),setup(a,{expose:h,emit:g}){const s=t=>t.map((n,c)=>({field:n.field||"",title:n.title||"",name:n.name||"",titleClass:n.titleClass||"",dataClass:n.dataClass||"",visible:n.visible!==!1,width:n.width||void 0,sortField:n.sortField||null,sortable:n.sortField,formatter:n.formatter||null,$_index:c})),f=e.ref(s(a.fields)),m=e.ref(a.data),p=e.ref(null),v=e.ref(a.initialPage),S=e.ref("17px"),N=e.ref(!1),r=e.ref({}),b=e.ref(0),o=e.ref(!0),u=e.ref(null),i=e.ref(null),C=e.useModel(a,"filterParams"),$=e.useModel(a,"perPage"),y=e.ref([]),T=e.ref(!1),F=e.computed(()=>a.tableHeight!=null),M=e.computed(()=>f.value.filter(t=>t.visible).length);e.watch(()=>y.value.length,t=>{T.value=a.selectable&&t>0},{immediate:!0}),e.watch(()=>a.fields,t=>{f.value=s(t)},{immediate:!0}),e.watch(()=>C.value,()=>{z()},{deep:!0}),e.watch(()=>$.value,()=>{z()});const V=g,R=(t,n)=>t.formatter&&typeof t.formatter=="function"?t.formatter(t,n):O.data_get(n,String(t?.name),""),H=t=>"dsg-field--"+t.name?.toLowerCase().replaceAll(/[_ ]/g,"-"),l=t=>{if(a.selectable){if(t.selected)y.value.push(t);else{const n=y.value.findIndex(c=>c[a.trackBy]===t[a.trackBy]);n!==-1&&y.value.splice(n,1)}V("dsg-table:rows-selected",y.value)}},d=()=>{a.selectable&&(m.value?.forEach(t=>{t.selected=!0}),y.value=m.value?.filter(t=>t.selected)??[],V("dsg-table:rows-selected",y.value))},k=()=>{a.selectable&&(m.value?.forEach(t=>{t.selected=!1}),y.value=[],V("dsg-table:rows-selected",y.value))},w=t=>{t==="prev"?v.value>a.firstPage&&v.value--:t==="next"?v.value<(p.value?.last_page??0)&&v.value++:t!=v.value&&t>=a.firstPage&&t<=(p.value?.last_page??0)&&(v.value=t),z()},D=()=>({[a.queryParams?.sort]:u.value?(u.value?.direction==="desc"?"-":"")+u.value?.field:void 0,[a.queryParams?.order]:u.value?.direction,[a.queryParams?.page]:v.value,[a.queryParams?.perPage]:$.value}),L=()=>{i.value&&(i.value.abort(),i.value=null)},I=async(t,n)=>{L();const c=new AbortController;if(n.signal=c.signal,i.value=c,a.httpMethod.toLowerCase()==="get")return await B.axios.get(t,n);{const E=n.params;return delete n.params,await B.axios.post(t,E,n)}},q=t=>{V("dsg-table:load-success",t);const n=a.transform?a.transform(t.data):t.data;m.value=O.data_get(n,a.dataPath,null),a.selectable&&m.value?.forEach(c=>{c.selected=c.selected??!1}),p.value=O.data_get(n,a.paginationPath,null)??null,b.value=m.value?.length?m.value[0].order:b,p.value===null&&console.warn('DsgTable: pagination-path "'+a.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="".`),V("dsg-table:pagination-data",p.value),V("dsg-table:loaded"),o.value=!1},W=t=>{console.error("load-error",t),V("dsg-table:load-error",t),V("dsg-table:loaded"),o.value=!1},z=(t=q,n=W,c={})=>{const E=t||q,P=n||W;if(a.apiMode)return o.value=!0,V("dsg-table:loading",o.value),a.httpOptions.params={...D(),...C.value},I(a.apiUrl,a.httpOptions).then(E).catch(A=>P(A))},ne=(t,n,c)=>{},se=(t,n,c)=>{},re=(t,n,c)=>{},ie=(t,n,c,E)=>{},de=(t,n,c,E)=>{},ce=(t,n,c,E)=>{},ue=(t,n,c)=>{};e.onMounted(()=>{a.apiMode===!0&&z()});const x=()=>{a.apiMode&&(v.value=a.initialPage,y.value=[],L(),z())};return h({changePage:w,reload:x}),(t,n)=>(e.openBlock(),e.createElementBlock("div",Re,[e.createElementVNode("div",{ref:"dsgTableBodyWrapper",class:e.normalizeClass(["dsg-table-body-wrapper",{"fixed-header":F.value}]),style:e.normalizeStyle({height:t.tableHeight||void 0})},[e.createElementVNode("table",{class:e.normalizeClass(["dsg-table-main",F.value?"fixed-header":"",r.value.table,"table-"+t.tableLayout])},[e.createElementVNode("colgroup",{span:M.value},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(c,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[c?.visible?(e.openBlock(),e.createElementBlock("col",{key:E,style:e.normalizeStyle({width:c.width||void 0}),class:e.normalizeClass("dsg-table--col-"+c.name+" "+c.titleClass)},null,6)):e.createCommentVNode("",!0)],64))),256)),!F.value&&N.value?(e.openBlock(),e.createElementBlock("col",{key:0,style:e.normalizeStyle({width:S.value}),class:"dsg-table--col-gutter"},null,4)):e.createCommentVNode("",!0)],8,He),e.createElementVNode("thead",{class:e.normalizeClass([[r.value.thead,{sticky:F.value,"top-0":F.value}],"dsg-table--head"])},[e.renderSlot(t.$slots,"tableHeader",{fields:f.value},()=>[e.createVNode(J,{fields:f.value,"has-select-all":t.selectable,"selected-rows":y.value,"onUpdate:selectedRows":n[0]||(n[0]=c=>y.value=c),"has-selected":T.value,"onUpdate:hasSelected":n[1]||(n[1]=c=>T.value=c),"scroll-visible":N.value,"show-expand-detail":t.hasDetailRow&&t.showExpandDetail,"table-data-length":m.value?.length,"sort-field":u.value,"onUpdate:sortField":n[2]||(n[2]=c=>u.value=c),"onDsgTable:sortField":n[3]||(n[3]=c=>x()),"onDsgTable:onSelectAll":d,"onDsgTable:onDeselectAll":k},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",r.value.tbody])},[o.value?(e.openBlock(),e.createElementBlock("tr",Ie,[e.createElementVNode("td",{colspan:M.value},[e.createElementVNode("div",{"aria-label":"Loading...",role:"status",class:"flex items-center space-x-3 h-12 w-full justify-center",colspan:M.value},[e.renderSlot(t.$slots,"dsg-table-loading",{},()=>[e.createVNode(B._sfc_main,{icon:"loading-02",class:"animate-spin"}),n[4]||(n[4]=e.createElementVNode("span",{class:"text-xs font-medium text-gray-500"},"Loading...",-1))])],8,Oe)],8,Ae)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(m.value,(c,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:E},[e.createElementVNode("tr",{class:e.normalizeClass(["dsg-table--tbody-row",{odd:E%2===0,even:E%2!==0,"row-selected":c.selected}]),onClick:P=>ne(),onDblclick:P=>se(),onMouseover:P=>re()},[t.selectable?(e.openBlock(),e.createElementBlock("td",qe,[e.createVNode(B._sfc_main$2,{modelValue:c.selected,"onUpdate:modelValue":[P=>c.selected=P,P=>l(c)]},null,8,["modelValue","onUpdate:modelValue"])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(P,A)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:A},[P.visible?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["dsg-table--tbody-cell",P.dataClass]),style:e.normalizeStyle({width:P.width||void 0}),onClick:j=>ie(),onDblclick:j=>de(),onContextmenu:j=>ce()},[e.renderSlot(t.$slots,H(P),{rowData:c,rowIndex:E,rowField:P},()=>[e.createElementVNode("span",{innerHTML:R(P,c)},null,8,xe)])],46,We)):e.createCommentVNode("",!0)],64))),128))],42,Ue),t.hasDetailRow?(e.openBlock(),e.createBlock(e.Transition,{key:0,name:t.detailRowTransition},{default:e.withCtx(()=>[e.createElementVNode("tr",{class:"dsg-table--tbody-detail-row",onClick:P=>ue()},[e.createElementVNode("td",{colspan:M.value},[e.renderSlot(t.$slots,"dsg-table-detail-row",{rowData:c,rowIndex:E,options:t.detailRowOptions})],8,Ke)],8,je)]),_:2},1032,["name"])):e.createCommentVNode("",!0)],64))),128)),!m.value?.length&&t.noDataTemplate.length?(e.openBlock(),e.createElementBlock("tr",Qe,[e.createElementVNode("td",{colspan:M.value,class:"dsg-table--empty-result"},[e.renderSlot(t.$slots,"dsg-table-empty-result",{},()=>[e.createTextVNode(e.toDisplayString(t.noDataTemplate),1)])],8,Ye)])):e.createCommentVNode("",!0)],2),e.createElementVNode("tfoot",Ge,[e.renderSlot(t.$slots,"dsg-table-footer",{fields:f.value,data:m.value})])],2)],6)]))}}),Xe={class:"dsg-table"},Ze={class:"dsg-table--pre-header"},_e={class:"dsg-table--pre-header-left"},et=["textContent"],tt={class:"dsg-table--pre-header-right"},at={key:0,class:"dsg-table--search-header"},lt={class:"dsg-table--search-top"},ot={class:"dsg-table--footer"},nt={class:"dsg-table--footer-left"},st={class:"dsg-table--footer-center"},rt={class:"dsg-table--footer-right"},it=e.defineComponent({__name:"DsgTable",props:{getUrl:{},fields:{},loadOnStart:{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:()=>{}},filterEntity:{default:""},filterEndpoint:{default:""},filterSearchEndpoint:{default:""},tableLayout:{default:"fixed"}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:link-clicked","dsg-table:rows-selected","dsg-table:filter-updated","dsg-table:term-changed"],setup(a,{expose:h,emit:g}){const s=l=>{u.value=l},f=e.ref(!!(a.filterEntity||a.filterEndpoint)),m=()=>{if(f.value){let l={};return B.getQueryStrings().forEach(d=>{if(d.key.startsWith("filter[")){const k=d.key.replace("filter[","").replace("]",""),w=d.value;l[`filter[${k}]`]=w.join(",")}}),l}else return{}},p=e.useSlots(),v=e.ref(!0),S=e.ref(null),N=e.ref("<p>Showing {from} to {to} of {total}</p>"),r=e.ref(null),b=e.useTemplateRef("dsgTable"),o=e.ref({perPage:20,change:s}),u=e.ref(20),i=e.ref(m()),C=g,$=l=>{b.value?.changePage(l)},y=l=>{r.value=l},T=({data:l})=>{S.value=l},F=()=>{v.value===!1&&b.value?.reload()},M=l=>{b.value?.setData(b.value?.tableData.map(d=>d.id===l.id?l:d))},V=l=>{i.value=l},R=l=>{i.value["filter[term]"]=l,C("dsg-table:term-changed",l)},H=(l,d,k)=>{i.value={"filter[term]":i.value["filter[term]"],...l},C("dsg-table:filter-updated",i.value,d,k)};return h({reloadTable:F,updateRowTable:M,termChanged:R,setFilters:V}),(l,d)=>(e.openBlock(),e.createElementBlock("div",Xe,[e.createElementVNode("div",Ze,[e.renderSlot(l.$slots,"dsg-table--pre-header",{},()=>[e.createElementVNode("div",_e,[e.renderSlot(l.$slots,"dsg-table--page-title",{data:S.value,title:l.title},()=>[l.title.length>0?(e.openBlock(),e.createElementBlock("h1",{key:0,class:"dsg-table--title",textContent:e.toDisplayString(l.title)},null,8,et)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",tt,[e.renderSlot(l.$slots,"dsg-table--page-actions",{data:S.value})])])]),l.displayPaginationInfo?(e.openBlock(),e.createElementBlock("div",at,[e.createElementVNode("div",lt,[e.renderSlot(l.$slots,"dsg-table--search-header",{data:S.value},()=>[e.createVNode(G,{name:"term","onDsgTable:termChanged":d[0]||(d[0]=k=>R(k))}),e.createVNode(B._sfc_main$7,{entity:l.filterEntity,"filter-endpoint":l.filterEndpoint,"search-endpoint":l.filterSearchEndpoint,filters:l.filters,"onDsgTable:filterUpdated":d[1]||(d[1]=(k,w,D)=>H(k,w,D))},null,8,["entity","filter-endpoint","search-endpoint","filters"]),e.renderSlot(l.$slots,"dsg-table--search-actions",{data:S.value})])]),e.renderSlot(l.$slots,"dsg-table--search-navigation")])):e.createCommentVNode("",!0),e.createVNode(Je,{ref:"dsgTable","api-url":l.getUrl,"filter-params":i.value,"onUpdate:filterParams":d[6]||(d[6]=k=>i.value=k),"per-page":u.value,"onUpdate:perPage":d[7]||(d[7]=k=>u.value=k),fields:l.fields,"load-on-start":l.loadOnStart,"pagination-path":"meta",selectable:l.selectable,"track-by":l.trackBy,"table-layout":l.tableLayout,css:{tableWrapper:"border-b"},"onDsgTable:loading":d[8]||(d[8]=k=>v.value=!0),"onDsgTable:loaded":d[9]||(d[9]=k=>v.value=!1),"onDsgTable:paginationData":y,"onDsgTable:loadSuccess":T,"onDsgTable:rowsSelected":d[10]||(d[10]=k=>C("dsg-table:rows-selected",k))},e.createSlots({"dsg-field--actions":e.withCtx(k=>[e.renderSlot(l.$slots,"dsg-table-actions",{data:k},()=>[(e.openBlock(),e.createBlock(Y,{key:k.rowIndex,data:k,"onDsgTable:actionEdit":d[2]||(d[2]=(w,D)=>C("dsg-table:action-edit",w,D)),"onDsgTable:actionView":d[3]||(d[3]=(w,D)=>C("dsg-table:action-view",w,D)),"onDsgTable:actionDelete":d[4]||(d[4]=(w,D)=>C("dsg-table:action-delete",w,D)),"onDsgTable:linkClicked":d[5]||(d[5]=(w,D,L)=>C("dsg-table:link-clicked",w,D,L))},null,8,["data"]))])]),_:2},[e.renderList(e.unref(p),(k,w)=>({name:w,fn:e.withCtx(({rowData:D,rowField:L,rowIndex:I})=>[String(w)!=="dsg-field--actions"?e.renderSlot(l.$slots,w,e.normalizeProps(e.mergeProps({key:0},{rowData:D,rowField:L,rowIndex:I}))):e.createCommentVNode("",!0)])}))]),1032,["api-url","filter-params","per-page","fields","load-on-start","selectable","track-by","table-layout"]),e.createElementVNode("div",ot,[e.createElementVNode("div",nt,[e.renderSlot(l.$slots,"dsg-table--footer-left",{data:r.value,perPage:o.value},()=>[e.createVNode(Q,{"no-data-template":"",ref:"paginationInfoStart",pagination:r.value,"onUpdate:pagination":d[11]||(d[11]=k=>r.value=k),"info-template":N.value},null,8,["pagination","info-template"]),e.renderSlot(l.$slots,"dsg-table--footer-left-extras",{data:r.value,perPage:o.value})])]),e.createElementVNode("div",st,[e.renderSlot(l.$slots,"dsg-table--footer-center",{data:r.value,perPage:o.value},()=>[e.renderSlot(l.$slots,"dsg-table--footer-center-extras",{data:r.value,perPage:o.value})])]),e.createElementVNode("div",rt,[e.renderSlot(l.$slots,"dsg-table--footer-right",{data:r.value,perPage:o.value},()=>[v.value===!1?(e.openBlock(),e.createBlock(K,{key:0,ref:"pagination",pagination:r.value,"onUpdate:pagination":d[12]||(d[12]=k=>r.value=k),"onDsgTable:changePage":$},null,8,["pagination"])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"dsg-table--footer-right-extras",{data:r.value,perPage:o.value})])])])]))}}),dt={class:"dsg-table--per-page"},ct=["value","textContent"],ut=e.defineComponent({__name:"DsgTablePerPage",props:{perPageOptions:{default:()=>[10,20,30,50,100]},perPage:{}},setup(a){return(h,g)=>(e.openBlock(),e.createElementBlock("div",dt,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":g[0]||(g[0]=s=>h.perPage.perPage=s),class:"dsg-table--per-page-select",onChange:g[1]||(g[1]=s=>h.perPage.change(h.perPage.perPage))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.perPageOptions,s=>(e.openBlock(),e.createElementBlock("option",{key:s,value:s,textContent:e.toDisplayString(s)},null,8,ct))),128))],544),[[e.vModelSelect,h.perPage.perPage]])]))}}),X=it,Z=Y,_=ut,ee=B._sfc_main$7,te=K,ae=Q,le=G,oe=J,gt={DsgTable:X,DsgTableActions:Z,DsgTablePerPage:_,DsgTableFilter:ee,DsgTablePagination:te,DsgTablePaginationInfo:ae,DsgTableSearch:le,DsgTableRowHeader:oe};exports.DsgTable=X;exports.DsgTableActions=Z;exports.DsgTableFilter=ee;exports.DsgTablePagination=te;exports.DsgTablePaginationInfo=ae;exports.DsgTablePerPage=_;exports.DsgTableRowHeader=oe;exports.DsgTableSearch=le;exports.default=gt;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as W, mergeModels as x, useModel as Y, computed as O, withDirectives as oe, createElementBlock as n, openBlock as a, createCommentVNode as
|
|
1
|
+
import { defineComponent as W, mergeModels as x, useModel as Y, computed as O, withDirectives as oe, createElementBlock as n, openBlock as a, createCommentVNode as P, createElementVNode as h, normalizeClass as B, createVNode as F, Fragment as L, renderList as q, vShow as Se, ref as y, useTemplateRef as ge, useAttrs as Fe, unref as U, withCtx as Z, renderSlot as T, toDisplayString as _, createBlock as N, resolveDynamicComponent as Me, normalizeStyle as J, watch as te, onMounted as Be, Transition as Le, createTextVNode as Ee, useSlots as Re, createSlots as He, normalizeProps as Ie, mergeProps as ze, vModelSelect as Ve } from "vue";
|
|
2
2
|
import { _ as V, k as Ae, v as Oe, g as Ue, u as qe, c as ve, e as ce, i as be, j as Ne } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-BOlPdhxa.js";
|
|
3
3
|
import { ucfirst as We, ucwords as je, toSnakeCase as Ke } from "./dsg-vue.helpers-string.esm.js";
|
|
4
4
|
import { data_get as ne } from "./dsg-vue.helpers-object.esm.js";
|
|
@@ -18,17 +18,17 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
18
18
|
}),
|
|
19
19
|
emits: /* @__PURE__ */ x(["dsg-table:change-page"], ["update:pagination"]),
|
|
20
20
|
setup(t, { expose: $, emit: v }) {
|
|
21
|
-
const i = Y(t, "pagination"), f = O(() => i.value === null ? 0 : i.value?.last_page - t.firstPage + 1), b = O(() => i.value === null ? 0 : i.value?.last_page),
|
|
21
|
+
const i = Y(t, "pagination"), f = O(() => i.value === null ? 0 : i.value?.last_page - t.firstPage + 1), b = O(() => i.value === null ? 0 : i.value?.last_page), m = O(() => i.value === null ? !1 : i.value?.current_page === t.firstPage), p = O(() => i.value === null ? !1 : i.value?.current_page === b.value), R = O(() => f.value < t.onEachSide * 2 + 4), A = O(() => t.onEachSide * 2 + 1), r = O(() => !i.value || i.value?.current_page <= t.onEachSide ? 1 : i.value?.current_page >= f.value - t.onEachSide ? f.value - t.onEachSide * 2 : i.value?.current_page - t.onEachSide), k = v, s = (d) => {
|
|
22
22
|
k("dsg-table:change-page", d);
|
|
23
23
|
}, g = (d) => d === i.value?.current_page;
|
|
24
24
|
return $({
|
|
25
|
-
loadPage:
|
|
26
|
-
}), (d,
|
|
25
|
+
loadPage: s
|
|
26
|
+
}), (d, C) => oe((a(), n("div", Qe, [
|
|
27
27
|
d.showFirstLast ? (a(), n("a", {
|
|
28
28
|
key: 0,
|
|
29
|
-
onClick:
|
|
30
|
-
class: B([[
|
|
31
|
-
disabled:
|
|
29
|
+
onClick: C[0] || (C[0] = (I) => s(d.firstPage)),
|
|
30
|
+
class: B([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
31
|
+
disabled: m.value,
|
|
32
32
|
title: "First",
|
|
33
33
|
"aria-label": "First"
|
|
34
34
|
}, [
|
|
@@ -36,11 +36,11 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
36
36
|
icon: d.firstIcon,
|
|
37
37
|
size: "sm"
|
|
38
38
|
}, null, 8, ["icon"])
|
|
39
|
-
], 10, Ye)) :
|
|
40
|
-
|
|
41
|
-
onClick:
|
|
42
|
-
class: B([[
|
|
43
|
-
disabled:
|
|
39
|
+
], 10, Ye)) : P("", !0),
|
|
40
|
+
h("a", {
|
|
41
|
+
onClick: C[1] || (C[1] = (I) => s("prev")),
|
|
42
|
+
class: B([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
43
|
+
disabled: m.value,
|
|
44
44
|
title: "Previous",
|
|
45
45
|
"aria-label": "Previous"
|
|
46
46
|
}, [
|
|
@@ -49,19 +49,19 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
49
49
|
size: "sm"
|
|
50
50
|
}, null, 8, ["icon"])
|
|
51
51
|
], 10, xe),
|
|
52
|
-
R.value ? (a(!0), n(L, { key: 1 }, q(f.value, (
|
|
52
|
+
R.value ? (a(!0), n(L, { key: 1 }, q(f.value, (I, D) => (a(), n("a", {
|
|
53
53
|
key: D,
|
|
54
|
-
onClick: (j) =>
|
|
54
|
+
onClick: (j) => s(D + d.firstPage),
|
|
55
55
|
class: B([[g(D + d.firstPage) ? "active" : ""], "dsg-table--pagination-link"]),
|
|
56
|
-
innerHTML:
|
|
57
|
-
}, null, 10, Ge))), 128)) : (a(!0), n(L, { key: 2 }, q(A.value, (
|
|
56
|
+
innerHTML: I
|
|
57
|
+
}, null, 10, Ge))), 128)) : (a(!0), n(L, { key: 2 }, q(A.value, (I, D) => (a(), n("a", {
|
|
58
58
|
key: D,
|
|
59
|
-
onClick: (j) =>
|
|
59
|
+
onClick: (j) => s(r.value + D + d.firstPage - 1),
|
|
60
60
|
class: B([[g(r.value + D + d.firstPage - 1) ? "active" : ""], "dsg-table--pagination-link"]),
|
|
61
|
-
innerHTML: r.value +
|
|
61
|
+
innerHTML: r.value + I - 1
|
|
62
62
|
}, null, 10, Je))), 128)),
|
|
63
|
-
|
|
64
|
-
onClick:
|
|
63
|
+
h("a", {
|
|
64
|
+
onClick: C[2] || (C[2] = (I) => s("next")),
|
|
65
65
|
class: B([[p.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
66
66
|
disabled: p.value,
|
|
67
67
|
title: "Next",
|
|
@@ -74,7 +74,7 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
74
74
|
], 10, Xe),
|
|
75
75
|
d.showFirstLast ? (a(), n("a", {
|
|
76
76
|
key: 3,
|
|
77
|
-
onClick:
|
|
77
|
+
onClick: C[3] || (C[3] = (I) => s(b.value)),
|
|
78
78
|
class: B([[p.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
79
79
|
disabled: p.value,
|
|
80
80
|
title: "Last",
|
|
@@ -84,7 +84,7 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
84
84
|
icon: d.lastIcon,
|
|
85
85
|
size: "sm"
|
|
86
86
|
}, null, 8, ["icon"])
|
|
87
|
-
], 10, Ze)) :
|
|
87
|
+
], 10, Ze)) : P("", !0)
|
|
88
88
|
], 512)), [
|
|
89
89
|
[Se, i.value && b.value > d.firstPage]
|
|
90
90
|
]);
|
|
@@ -112,7 +112,7 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
112
112
|
}, tt = { class: "dsg-table--action-trigger" }, at = {
|
|
113
113
|
key: 0,
|
|
114
114
|
class: "dsg-table--actions-menu-wrapper"
|
|
115
|
-
}, lt = ["href", "target", "onClick"], st = ["textContent"], nt = { key: 0 }, ot = ["href", "target", "onClick"], it = { class: "flex-1" },
|
|
115
|
+
}, lt = ["href", "target", "onClick"], st = ["textContent"], nt = { key: 0 }, ot = ["href", "target", "onClick"], it = { class: "flex-1" }, he = /* @__PURE__ */ W({
|
|
116
116
|
__name: "DsgTableActions",
|
|
117
117
|
props: {
|
|
118
118
|
placement: { default: "auto" }
|
|
@@ -121,7 +121,7 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
121
121
|
setup(t, { emit: $ }) {
|
|
122
122
|
const v = y(!1);
|
|
123
123
|
ge("dsgTableActions");
|
|
124
|
-
const i = Fe(), f = y(i.data.rowData?.actions ?? null), b = y(i.data.rowData?.links ?? null),
|
|
124
|
+
const i = Fe(), f = y(i.data.rowData?.actions ?? null), b = y(i.data.rowData?.links ?? null), m = y(i.data.rowData ?? null), p = (k) => {
|
|
125
125
|
switch (k) {
|
|
126
126
|
case "edit":
|
|
127
127
|
return "edit-05";
|
|
@@ -132,23 +132,23 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
132
132
|
default:
|
|
133
133
|
return "dots-horizontal";
|
|
134
134
|
}
|
|
135
|
-
}, R = (k,
|
|
136
|
-
switch (
|
|
135
|
+
}, R = (k, s, g) => {
|
|
136
|
+
switch (s) {
|
|
137
137
|
case "edit":
|
|
138
|
-
r("dsg-table:action-edit", g,
|
|
138
|
+
r("dsg-table:action-edit", g, m.value);
|
|
139
139
|
break;
|
|
140
140
|
case "view":
|
|
141
|
-
r("dsg-table:action-view", g,
|
|
141
|
+
r("dsg-table:action-view", g, m.value);
|
|
142
142
|
break;
|
|
143
143
|
case "delete":
|
|
144
|
-
r("dsg-table:action-delete", g,
|
|
144
|
+
r("dsg-table:action-delete", g, m.value);
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
|
-
}, A = (k,
|
|
147
|
+
}, A = (k, s) => {
|
|
148
148
|
const g = k.actionId || k.label.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
|
|
149
|
-
r("dsg-table:link-clicked",
|
|
149
|
+
r("dsg-table:link-clicked", s, g, m.value);
|
|
150
150
|
}, r = $;
|
|
151
|
-
return (k,
|
|
151
|
+
return (k, s) => oe((a(), n("div", et, [
|
|
152
152
|
F(U(Ae), {
|
|
153
153
|
triggers: [],
|
|
154
154
|
placement: k.placement,
|
|
@@ -156,7 +156,7 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
156
156
|
strategy: "absolute",
|
|
157
157
|
shown: v.value,
|
|
158
158
|
class: "dsg-table--actions__popper",
|
|
159
|
-
onHide:
|
|
159
|
+
onHide: s[1] || (s[1] = (g) => v.value = !1),
|
|
160
160
|
ref: "floatingVueFilterDropdown"
|
|
161
161
|
}, {
|
|
162
162
|
popper: Z(() => [
|
|
@@ -166,23 +166,23 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
166
166
|
key: d,
|
|
167
167
|
href: f.value?.link,
|
|
168
168
|
target: f.value?.target || "_self",
|
|
169
|
-
onClick: (
|
|
169
|
+
onClick: (C) => R(g, String(d), C)
|
|
170
170
|
}, [
|
|
171
|
-
|
|
171
|
+
h("div", {
|
|
172
172
|
class: B(["dsg-table--actions-menu-item", String(d)])
|
|
173
173
|
}, [
|
|
174
174
|
F(V, {
|
|
175
175
|
icon: p(String(d)),
|
|
176
176
|
size: "sm"
|
|
177
177
|
}, null, 8, ["icon"]),
|
|
178
|
-
|
|
178
|
+
h("span", {
|
|
179
179
|
class: "flex-1",
|
|
180
180
|
textContent: _(U(We)(String(d)))
|
|
181
181
|
}, null, 8, st)
|
|
182
182
|
], 2)
|
|
183
|
-
], 8, lt)) :
|
|
183
|
+
], 8, lt)) : P("", !0)
|
|
184
184
|
], 64))), 256)),
|
|
185
|
-
f.value && b.value ? (a(), n("hr", nt)) :
|
|
185
|
+
f.value && b.value ? (a(), n("hr", nt)) : P("", !0),
|
|
186
186
|
b.value ? (a(!0), n(L, { key: 1 }, q(b.value, (g) => (a(), n(L, {
|
|
187
187
|
key: g.label
|
|
188
188
|
}, [
|
|
@@ -190,8 +190,8 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
190
190
|
key: 0,
|
|
191
191
|
quote: U(i).data.data.rowData,
|
|
192
192
|
"row-data": U(i).data.data.rowData
|
|
193
|
-
}, null, 8, ["quote", "row-data"])) :
|
|
194
|
-
|
|
193
|
+
}, null, 8, ["quote", "row-data"])) : P("", !0),
|
|
194
|
+
h("a", {
|
|
195
195
|
href: g.link,
|
|
196
196
|
target: g.target || "_self",
|
|
197
197
|
class: "dsg-table--actions-menu-item",
|
|
@@ -201,22 +201,22 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
201
201
|
key: 0,
|
|
202
202
|
icon: g.icon,
|
|
203
203
|
size: "sm"
|
|
204
|
-
}, null, 8, ["icon"])) :
|
|
205
|
-
|
|
204
|
+
}, null, 8, ["icon"])) : P("", !0),
|
|
205
|
+
h("span", it, _(g.label), 1)
|
|
206
206
|
], 8, ot)
|
|
207
|
-
], 64))), 128)) :
|
|
208
|
-
])) :
|
|
207
|
+
], 64))), 128)) : P("", !0)
|
|
208
|
+
])) : P("", !0)
|
|
209
209
|
]),
|
|
210
210
|
default: Z(() => [
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
h("div", tt, [
|
|
212
|
+
h("button", {
|
|
213
213
|
type: "button",
|
|
214
214
|
class: "dsg-table--actions-button",
|
|
215
215
|
"aria-expanded": "false",
|
|
216
216
|
"aria-haspopup": "true",
|
|
217
|
-
onClick:
|
|
217
|
+
onClick: s[0] || (s[0] = (g) => v.value = !v.value)
|
|
218
218
|
}, [
|
|
219
|
-
|
|
219
|
+
T(k.$slots, "dsg-table-action-button-content", {}, () => [
|
|
220
220
|
F(V, {
|
|
221
221
|
icon: "dots-vertical",
|
|
222
222
|
size: "sm"
|
|
@@ -231,7 +231,7 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
231
231
|
[U(Oe), () => v.value = !1]
|
|
232
232
|
]);
|
|
233
233
|
}
|
|
234
|
-
}), rt = { class: "dsg-table--search" },
|
|
234
|
+
}), rt = { class: "dsg-table--search" }, me = /* @__PURE__ */ W({
|
|
235
235
|
__name: "DsgTableSearch",
|
|
236
236
|
props: {
|
|
237
237
|
name: {},
|
|
@@ -249,10 +249,10 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
249
249
|
const v = y(""), i = $, f = qe((b) => {
|
|
250
250
|
v.value = b, i("dsg-table:term-changed", v.value);
|
|
251
251
|
}, 300);
|
|
252
|
-
return (b,
|
|
252
|
+
return (b, m) => (a(), n("div", rt, [
|
|
253
253
|
F(Ue, {
|
|
254
254
|
value: v.value,
|
|
255
|
-
"onUpdate:value":
|
|
255
|
+
"onUpdate:value": m[0] || (m[0] = (p) => v.value = p),
|
|
256
256
|
name: b.name,
|
|
257
257
|
id: b.id || b.name,
|
|
258
258
|
placeholder: b.placeholder,
|
|
@@ -265,9 +265,9 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
265
265
|
size: "sm",
|
|
266
266
|
icon: "search-sm",
|
|
267
267
|
"icon-clickable": !0,
|
|
268
|
-
onIconClicked:
|
|
269
|
-
onEnterPressed:
|
|
270
|
-
onOnClear:
|
|
268
|
+
onIconClicked: m[1] || (m[1] = (p) => U(f)(p)),
|
|
269
|
+
onEnterPressed: m[2] || (m[2] = (p) => U(f)(p)),
|
|
270
|
+
onOnClear: m[3] || (m[3] = () => U(f)(""))
|
|
271
271
|
}, null, 8, ["value", "name", "id", "placeholder", "disabled", "required", "readonly", "hidden"])
|
|
272
272
|
]));
|
|
273
273
|
}
|
|
@@ -300,7 +300,7 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
300
300
|
}),
|
|
301
301
|
emits: /* @__PURE__ */ x(["dsg-table:sort-field", "dsg-table:on-select-all", "dsg-table:on-deselect-all"], ["update:sortField", "update:selectedRows", "update:hasSelected"]),
|
|
302
302
|
setup(t, { emit: $ }) {
|
|
303
|
-
const v = Y(t, "sortField"), i = Y(t, "selectedRows"), f = Y(t, "hasSelected"), b = y("17px"),
|
|
303
|
+
const v = Y(t, "sortField"), i = Y(t, "selectedRows"), f = Y(t, "hasSelected"), b = y("17px"), m = (r) => {
|
|
304
304
|
f.value && i.value.length > 0 && i.value.length !== t.tableDataLength ? (f.value = !0, p("dsg-table:on-select-all")) : !f.value && i.value.length === 0 ? (f.value = !1, p("dsg-table:on-select-all")) : p("dsg-table:on-deselect-all");
|
|
305
305
|
}, p = $, R = (r, k) => [
|
|
306
306
|
r,
|
|
@@ -320,62 +320,62 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
320
320
|
F(ve, {
|
|
321
321
|
modelValue: f.value,
|
|
322
322
|
"onUpdate:modelValue": [
|
|
323
|
-
k[0] || (k[0] = (
|
|
324
|
-
|
|
323
|
+
k[0] || (k[0] = (s) => f.value = s),
|
|
324
|
+
m
|
|
325
325
|
],
|
|
326
326
|
indeterminate: i.value.length > 0 && i.value.length !== r.tableDataLength
|
|
327
327
|
}, null, 8, ["modelValue", "indeterminate"])
|
|
328
|
-
])) :
|
|
329
|
-
r.showExpandDetail ? (a(), n("th", ct)) :
|
|
330
|
-
(a(!0), n(L, null, q(r.fields, (
|
|
331
|
-
|
|
328
|
+
])) : P("", !0),
|
|
329
|
+
r.showExpandDetail ? (a(), n("th", ct)) : P("", !0),
|
|
330
|
+
(a(!0), n(L, null, q(r.fields, (s, g) => (a(), n(L, null, [
|
|
331
|
+
s?.visible ? (a(), n("th", {
|
|
332
332
|
key: g,
|
|
333
|
-
class: B(R("dsg-table--th",
|
|
334
|
-
style: J([{ width:
|
|
335
|
-
title:
|
|
336
|
-
id: "_" +
|
|
337
|
-
onClick: (d) => A(
|
|
333
|
+
class: B(R("dsg-table--th", s)),
|
|
334
|
+
style: J([{ width: s.width || void 0 }, s.style]),
|
|
335
|
+
title: s.title + (s.sortable ? " Sort" : ""),
|
|
336
|
+
id: "_" + s.name,
|
|
337
|
+
onClick: (d) => A(s),
|
|
338
338
|
scope: "col"
|
|
339
339
|
}, [
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
s.sortable ? (a(), n("div", vt, [
|
|
341
|
+
s.title ? (a(), n("span", {
|
|
342
342
|
key: 0,
|
|
343
343
|
class: "dsg-table--th-title",
|
|
344
|
-
innerHTML:
|
|
345
|
-
}, null, 8, bt)) :
|
|
346
|
-
|
|
344
|
+
innerHTML: s.title
|
|
345
|
+
}, null, 8, bt)) : P("", !0),
|
|
346
|
+
s.sortable && v.value?.name !== s.name ? (a(), N(V, {
|
|
347
347
|
key: 1,
|
|
348
348
|
icon: "chevron-selector-vertical",
|
|
349
349
|
class: "inline-flex",
|
|
350
350
|
size: "xs"
|
|
351
|
-
})) :
|
|
352
|
-
|
|
351
|
+
})) : P("", !0),
|
|
352
|
+
s.sortable && v.value?.name === s.name && v.value?.direction === "asc" ? (a(), N(V, {
|
|
353
353
|
key: 2,
|
|
354
354
|
icon: "chevron-down",
|
|
355
355
|
class: "inline-flex",
|
|
356
356
|
size: "xs"
|
|
357
|
-
})) :
|
|
358
|
-
|
|
357
|
+
})) : P("", !0),
|
|
358
|
+
s.sortable && v.value?.name === s.name && v.value?.direction === "desc" ? (a(), N(V, {
|
|
359
359
|
key: 3,
|
|
360
360
|
icon: "chevron-up",
|
|
361
361
|
class: "inline-flex",
|
|
362
362
|
size: "xs"
|
|
363
|
-
})) :
|
|
363
|
+
})) : P("", !0)
|
|
364
364
|
])) : (a(), n("span", {
|
|
365
365
|
key: 1,
|
|
366
366
|
class: "dsg-table--th-title",
|
|
367
|
-
innerHTML: U(je)(String(
|
|
367
|
+
innerHTML: U(je)(String(s?.title))
|
|
368
368
|
}, null, 8, ft))
|
|
369
|
-
], 14, gt)) :
|
|
369
|
+
], 14, gt)) : P("", !0)
|
|
370
370
|
], 64))), 256)),
|
|
371
371
|
r.scrollVisible ? (a(), n("th", {
|
|
372
372
|
key: 2,
|
|
373
373
|
style: J({ width: b.value }),
|
|
374
374
|
class: "dsg-table--th-col-gutter"
|
|
375
|
-
}, null, 4)) :
|
|
375
|
+
}, null, 4)) : P("", !0)
|
|
376
376
|
]));
|
|
377
377
|
}
|
|
378
|
-
}), pt = { class: "dsg-table--wrapper" },
|
|
378
|
+
}), pt = { class: "dsg-table--wrapper" }, ht = ["span"], mt = {
|
|
379
379
|
key: 0,
|
|
380
380
|
class: "dsg-table--loading"
|
|
381
381
|
}, yt = ["colspan"], kt = ["colspan"], wt = ["onClick", "onDblclick", "onMouseover"], Pt = {
|
|
@@ -441,7 +441,7 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
441
441
|
}),
|
|
442
442
|
emits: /* @__PURE__ */ x(["dsg-table:loading", "dsg-table:loaded", "dsg-table:load-success", "dsg-table:load-error", "dsg-table:pagination-data", "dsg-table:rows-selected"], ["update:filterParams", "update:perPage"]),
|
|
443
443
|
setup(t, { expose: $, emit: v }) {
|
|
444
|
-
const i = (e) => e.map((o,
|
|
444
|
+
const i = (e) => e.map((o, c) => ({
|
|
445
445
|
field: o.field || "",
|
|
446
446
|
title: o.title || "",
|
|
447
447
|
name: o.name || "",
|
|
@@ -452,8 +452,8 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
452
452
|
sortField: o.sortField || null,
|
|
453
453
|
sortable: o.sortField,
|
|
454
454
|
formatter: o.formatter || null,
|
|
455
|
-
$_index:
|
|
456
|
-
})), f = y(i(t.fields)), b = y(t.data),
|
|
455
|
+
$_index: c
|
|
456
|
+
})), f = y(i(t.fields)), b = y(t.data), m = y(null), p = y(t.initialPage), R = y("17px"), A = y(!1), r = y({}), k = y(0), s = y(!0), g = y(null), d = y(null), C = Y(t, "filterParams"), I = Y(t, "perPage"), D = y([]), j = y(!1), K = O(() => t.tableHeight != null), Q = O(() => f.value.filter((e) => e.visible).length);
|
|
457
457
|
te(
|
|
458
458
|
() => D.value.length,
|
|
459
459
|
(e) => {
|
|
@@ -467,78 +467,78 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], xe = ["disable
|
|
|
467
467
|
},
|
|
468
468
|
{ immediate: !0 }
|
|
469
469
|
), te(
|
|
470
|
-
() =>
|
|
470
|
+
() => C.value,
|
|
471
471
|
() => {
|
|
472
472
|
X();
|
|
473
473
|
},
|
|
474
474
|
{ deep: !0 }
|
|
475
475
|
), te(
|
|
476
|
-
() =>
|
|
476
|
+
() => I.value,
|
|
477
477
|
() => {
|
|
478
478
|
X();
|
|
479
479
|
}
|
|
480
480
|
);
|
|
481
|
-
const
|
|
481
|
+
const z = v, ee = (e, o) => e.formatter && typeof e.formatter == "function" ? e.formatter(e, o) : ne(o, String(e?.name), ""), ae = (e) => "dsg-field--" + e.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), l = (e) => {
|
|
482
482
|
if (t.selectable) {
|
|
483
483
|
if (e.selected)
|
|
484
484
|
D.value.push(e);
|
|
485
485
|
else {
|
|
486
|
-
const o = D.value.findIndex((
|
|
486
|
+
const o = D.value.findIndex((c) => c[t.trackBy] === e[t.trackBy]);
|
|
487
487
|
o !== -1 && D.value.splice(o, 1);
|
|
488
488
|
}
|
|
489
|
-
|
|
489
|
+
z("dsg-table:rows-selected", D.value);
|
|
490
490
|
}
|
|
491
|
-
},
|
|
491
|
+
}, u = () => {
|
|
492
492
|
t.selectable && (b.value?.forEach((e) => {
|
|
493
493
|
e.selected = !0;
|
|
494
|
-
}), D.value = b.value?.filter((e) => e.selected) ?? [],
|
|
495
|
-
},
|
|
494
|
+
}), D.value = b.value?.filter((e) => e.selected) ?? [], z("dsg-table:rows-selected", D.value));
|
|
495
|
+
}, w = () => {
|
|
496
496
|
t.selectable && (b.value?.forEach((e) => {
|
|
497
497
|
e.selected = !1;
|
|
498
|
-
}), D.value = [],
|
|
498
|
+
}), D.value = [], z("dsg-table:rows-selected", D.value));
|
|
499
499
|
}, S = (e) => {
|
|
500
|
-
e === "prev" ? p.value > t.firstPage && p.value-- : e === "next" ? p.value < (
|
|
501
|
-
},
|
|
500
|
+
e === "prev" ? p.value > t.firstPage && p.value-- : e === "next" ? p.value < (m.value?.last_page ?? 0) && p.value++ : e != p.value && e >= t.firstPage && e <= (m.value?.last_page ?? 0) && (p.value = e), X();
|
|
501
|
+
}, H = () => ({
|
|
502
502
|
[t.queryParams?.sort]: g.value ? (g.value?.direction === "desc" ? "-" : "") + g.value?.field : void 0,
|
|
503
503
|
[t.queryParams?.order]: g.value?.direction,
|
|
504
504
|
[t.queryParams?.page]: p.value,
|
|
505
|
-
[t.queryParams?.perPage]:
|
|
505
|
+
[t.queryParams?.perPage]: I.value
|
|
506
506
|
}), G = () => {
|
|
507
507
|
d.value && (d.value.abort(), d.value = null);
|
|
508
508
|
}, le = async (e, o) => {
|
|
509
509
|
G();
|
|
510
|
-
const
|
|
511
|
-
if (o.signal =
|
|
510
|
+
const c = new AbortController();
|
|
511
|
+
if (o.signal = c.signal, d.value = c, t.httpMethod.toLowerCase() === "get")
|
|
512
512
|
return await ce.get(e, o);
|
|
513
513
|
{
|
|
514
514
|
const E = o.params;
|
|
515
515
|
return delete o.params, await ce.post(e, E, o);
|
|
516
516
|
}
|
|
517
517
|
}, ie = (e) => {
|
|
518
|
-
|
|
518
|
+
z("dsg-table:load-success", e);
|
|
519
519
|
const o = t.transform ? t.transform(e.data) : e.data;
|
|
520
|
-
b.value = ne(o, t.dataPath, null), t.selectable && b.value?.forEach((
|
|
521
|
-
|
|
522
|
-
}),
|
|
520
|
+
b.value = ne(o, t.dataPath, null), t.selectable && b.value?.forEach((c) => {
|
|
521
|
+
c.selected = c.selected ?? !1;
|
|
522
|
+
}), m.value = ne(o, t.paginationPath, null) ?? null, k.value = b.value?.length ? b.value[0].order : k, m.value === null && console.warn(
|
|
523
523
|
'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.
|
|
524
524
|
You can explicitly suppress this warning by setting pagination-path="".`
|
|
525
|
-
),
|
|
525
|
+
), z("dsg-table:pagination-data", m.value), z("dsg-table:loaded"), s.value = !1;
|
|
526
526
|
}, re = (e) => {
|
|
527
|
-
console.error("load-error", e),
|
|
528
|
-
}, X = (e = ie, o = re,
|
|
527
|
+
console.error("load-error", e), z("dsg-table:load-error", e), z("dsg-table:loaded"), s.value = !1;
|
|
528
|
+
}, X = (e = ie, o = re, c = {}) => {
|
|
529
529
|
const E = e || ie, M = o || re;
|
|
530
530
|
if (t.apiMode)
|
|
531
|
-
return
|
|
532
|
-
...
|
|
533
|
-
...
|
|
531
|
+
return s.value = !0, z("dsg-table:loading", s.value), t.httpOptions.params = {
|
|
532
|
+
...H(),
|
|
533
|
+
...C.value
|
|
534
534
|
}, le(t.apiUrl, t.httpOptions).then(E).catch((se) => M(se));
|
|
535
|
-
}, ke = (e, o,
|
|
536
|
-
}, we = (e, o,
|
|
537
|
-
}, Pe = (e, o,
|
|
538
|
-
}, $e = (e, o,
|
|
539
|
-
}, De = (e, o,
|
|
540
|
-
}, Ce = (e, o,
|
|
541
|
-
}, Te = (e, o,
|
|
535
|
+
}, ke = (e, o, c) => {
|
|
536
|
+
}, we = (e, o, c) => {
|
|
537
|
+
}, Pe = (e, o, c) => {
|
|
538
|
+
}, $e = (e, o, c, E) => {
|
|
539
|
+
}, De = (e, o, c, E) => {
|
|
540
|
+
}, Ce = (e, o, c, E) => {
|
|
541
|
+
}, Te = (e, o, c) => {
|
|
542
542
|
};
|
|
543
543
|
Be(() => {
|
|
544
544
|
t.apiMode === !0 && X();
|
|
@@ -550,83 +550,83 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
550
550
|
changePage: S,
|
|
551
551
|
reload: de
|
|
552
552
|
}), (e, o) => (a(), n("div", pt, [
|
|
553
|
-
|
|
553
|
+
h("div", {
|
|
554
554
|
ref: "dsgTableBodyWrapper",
|
|
555
555
|
class: B(["dsg-table-body-wrapper", { "fixed-header": K.value }]),
|
|
556
556
|
style: J({ height: e.tableHeight || void 0 })
|
|
557
557
|
}, [
|
|
558
|
-
|
|
558
|
+
h("table", {
|
|
559
559
|
class: B(["dsg-table-main", K.value ? "fixed-header" : "", r.value.table, "table-" + e.tableLayout])
|
|
560
560
|
}, [
|
|
561
|
-
|
|
562
|
-
(a(!0), n(L, null, q(f.value, (
|
|
563
|
-
|
|
561
|
+
h("colgroup", { span: Q.value }, [
|
|
562
|
+
(a(!0), n(L, null, q(f.value, (c, E) => (a(), n(L, null, [
|
|
563
|
+
c?.visible ? (a(), n("col", {
|
|
564
564
|
key: E,
|
|
565
|
-
style: J({ width:
|
|
566
|
-
class: B("dsg-table--col-" +
|
|
567
|
-
}, null, 6)) :
|
|
565
|
+
style: J({ width: c.width || void 0 }),
|
|
566
|
+
class: B("dsg-table--col-" + c.name + " " + c.titleClass)
|
|
567
|
+
}, null, 6)) : P("", !0)
|
|
568
568
|
], 64))), 256)),
|
|
569
569
|
!K.value && A.value ? (a(), n("col", {
|
|
570
570
|
key: 0,
|
|
571
571
|
style: J({ width: R.value }),
|
|
572
572
|
class: "dsg-table--col-gutter"
|
|
573
|
-
}, null, 4)) :
|
|
574
|
-
], 8,
|
|
575
|
-
|
|
573
|
+
}, null, 4)) : P("", !0)
|
|
574
|
+
], 8, ht),
|
|
575
|
+
h("thead", {
|
|
576
576
|
class: B([[r.value.thead, { sticky: K.value, "top-0": K.value }], "dsg-table--head"])
|
|
577
577
|
}, [
|
|
578
|
-
|
|
578
|
+
T(e.$slots, "tableHeader", { fields: f.value }, () => [
|
|
579
579
|
F(ye, {
|
|
580
580
|
fields: f.value,
|
|
581
581
|
"has-select-all": e.selectable,
|
|
582
582
|
"selected-rows": D.value,
|
|
583
|
-
"onUpdate:selectedRows": o[0] || (o[0] = (
|
|
583
|
+
"onUpdate:selectedRows": o[0] || (o[0] = (c) => D.value = c),
|
|
584
584
|
"has-selected": j.value,
|
|
585
|
-
"onUpdate:hasSelected": o[1] || (o[1] = (
|
|
585
|
+
"onUpdate:hasSelected": o[1] || (o[1] = (c) => j.value = c),
|
|
586
586
|
"scroll-visible": A.value,
|
|
587
587
|
"show-expand-detail": e.hasDetailRow && e.showExpandDetail,
|
|
588
588
|
"table-data-length": b.value?.length,
|
|
589
589
|
"sort-field": g.value,
|
|
590
|
-
"onUpdate:sortField": o[2] || (o[2] = (
|
|
591
|
-
"onDsgTable:sortField": o[3] || (o[3] = (
|
|
592
|
-
"onDsgTable:onSelectAll":
|
|
593
|
-
"onDsgTable:onDeselectAll":
|
|
590
|
+
"onUpdate:sortField": o[2] || (o[2] = (c) => g.value = c),
|
|
591
|
+
"onDsgTable:sortField": o[3] || (o[3] = (c) => de()),
|
|
592
|
+
"onDsgTable:onSelectAll": u,
|
|
593
|
+
"onDsgTable:onDeselectAll": w
|
|
594
594
|
}, null, 8, ["fields", "has-select-all", "selected-rows", "has-selected", "scroll-visible", "show-expand-detail", "table-data-length", "sort-field"])
|
|
595
595
|
])
|
|
596
596
|
], 2),
|
|
597
|
-
|
|
597
|
+
h("tbody", {
|
|
598
598
|
class: B(["dsg-table--body", r.value.tbody])
|
|
599
599
|
}, [
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
600
|
+
s.value ? (a(), n("tr", mt, [
|
|
601
|
+
h("td", { colspan: Q.value }, [
|
|
602
|
+
h("div", {
|
|
603
603
|
"aria-label": "Loading...",
|
|
604
604
|
role: "status",
|
|
605
605
|
class: "flex items-center space-x-3 h-12 w-full justify-center",
|
|
606
606
|
colspan: Q.value
|
|
607
607
|
}, [
|
|
608
|
-
|
|
608
|
+
T(e.$slots, "dsg-table-loading", {}, () => [
|
|
609
609
|
F(V, {
|
|
610
610
|
icon: "loading-02",
|
|
611
611
|
class: "animate-spin"
|
|
612
612
|
}),
|
|
613
|
-
o[4] || (o[4] =
|
|
613
|
+
o[4] || (o[4] = h("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
|
|
614
614
|
])
|
|
615
615
|
], 8, kt)
|
|
616
616
|
], 8, yt)
|
|
617
|
-
])) : (a(!0), n(L, { key: 1 }, q(b.value, (
|
|
618
|
-
|
|
619
|
-
class: B(["dsg-table--tbody-row", { odd: E % 2 === 0, even: E % 2 !== 0, "row-selected":
|
|
617
|
+
])) : (a(!0), n(L, { key: 1 }, q(b.value, (c, E) => (a(), n(L, { key: E }, [
|
|
618
|
+
h("tr", {
|
|
619
|
+
class: B(["dsg-table--tbody-row", { odd: E % 2 === 0, even: E % 2 !== 0, "row-selected": c.selected }]),
|
|
620
620
|
onClick: (M) => ke(),
|
|
621
621
|
onDblclick: (M) => we(),
|
|
622
622
|
onMouseover: (M) => Pe()
|
|
623
623
|
}, [
|
|
624
624
|
e.selectable ? (a(), n("td", Pt, [
|
|
625
625
|
F(ve, {
|
|
626
|
-
modelValue:
|
|
627
|
-
"onUpdate:modelValue": [(M) =>
|
|
626
|
+
modelValue: c.selected,
|
|
627
|
+
"onUpdate:modelValue": [(M) => c.selected = M, (M) => l(c)]
|
|
628
628
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
629
|
-
])) :
|
|
629
|
+
])) : P("", !0),
|
|
630
630
|
(a(!0), n(L, null, q(f.value, (M, se) => (a(), n(L, { key: se }, [
|
|
631
631
|
M.visible ? (a(), n("td", {
|
|
632
632
|
key: 0,
|
|
@@ -636,16 +636,16 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
636
636
|
onDblclick: (ue) => De(),
|
|
637
637
|
onContextmenu: (ue) => Ce()
|
|
638
638
|
}, [
|
|
639
|
-
|
|
640
|
-
rowData:
|
|
639
|
+
T(e.$slots, ae(M), {
|
|
640
|
+
rowData: c,
|
|
641
641
|
rowIndex: E,
|
|
642
642
|
rowField: M
|
|
643
643
|
}, () => [
|
|
644
|
-
|
|
645
|
-
innerHTML: ee(M,
|
|
644
|
+
h("span", {
|
|
645
|
+
innerHTML: ee(M, c)
|
|
646
646
|
}, null, 8, Dt)
|
|
647
647
|
])
|
|
648
|
-
], 46, $t)) :
|
|
648
|
+
], 46, $t)) : P("", !0)
|
|
649
649
|
], 64))), 128))
|
|
650
650
|
], 42, wt),
|
|
651
651
|
e.hasDetailRow ? (a(), N(Le, {
|
|
@@ -653,13 +653,13 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
653
653
|
name: e.detailRowTransition
|
|
654
654
|
}, {
|
|
655
655
|
default: Z(() => [
|
|
656
|
-
|
|
656
|
+
h("tr", {
|
|
657
657
|
class: "dsg-table--tbody-detail-row",
|
|
658
658
|
onClick: (M) => Te()
|
|
659
659
|
}, [
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
rowData:
|
|
660
|
+
h("td", { colspan: Q.value }, [
|
|
661
|
+
T(e.$slots, "dsg-table-detail-row", {
|
|
662
|
+
rowData: c,
|
|
663
663
|
rowIndex: E,
|
|
664
664
|
options: e.detailRowOptions
|
|
665
665
|
})
|
|
@@ -667,21 +667,21 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
667
667
|
], 8, Ct)
|
|
668
668
|
]),
|
|
669
669
|
_: 2
|
|
670
|
-
}, 1032, ["name"])) :
|
|
670
|
+
}, 1032, ["name"])) : P("", !0)
|
|
671
671
|
], 64))), 128)),
|
|
672
672
|
!b.value?.length && e.noDataTemplate.length ? (a(), n("tr", St, [
|
|
673
|
-
|
|
673
|
+
h("td", {
|
|
674
674
|
colspan: Q.value,
|
|
675
675
|
class: "dsg-table--empty-result"
|
|
676
676
|
}, [
|
|
677
|
-
|
|
677
|
+
T(e.$slots, "dsg-table-empty-result", {}, () => [
|
|
678
678
|
Ee(_(e.noDataTemplate), 1)
|
|
679
679
|
])
|
|
680
680
|
], 8, Ft)
|
|
681
|
-
])) :
|
|
681
|
+
])) : P("", !0)
|
|
682
682
|
], 2),
|
|
683
|
-
|
|
684
|
-
|
|
683
|
+
h("tfoot", Mt, [
|
|
684
|
+
T(e.$slots, "dsg-table-footer", {
|
|
685
685
|
fields: f.value,
|
|
686
686
|
data: b.value
|
|
687
687
|
})
|
|
@@ -711,170 +711,170 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
711
711
|
filterSearchEndpoint: { default: "" },
|
|
712
712
|
tableLayout: { default: "fixed" }
|
|
713
713
|
},
|
|
714
|
-
emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:link-clicked", "dsg-table:rows-selected"],
|
|
714
|
+
emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:link-clicked", "dsg-table:rows-selected", "dsg-table:filter-updated", "dsg-table:term-changed"],
|
|
715
715
|
setup(t, { expose: $, emit: v }) {
|
|
716
|
-
const i = (
|
|
717
|
-
g.value =
|
|
716
|
+
const i = (l) => {
|
|
717
|
+
g.value = l;
|
|
718
718
|
}, f = y(!!(t.filterEntity || t.filterEndpoint)), b = () => {
|
|
719
719
|
if (f.value) {
|
|
720
|
-
let
|
|
721
|
-
return Ne().forEach((
|
|
722
|
-
if (
|
|
723
|
-
const
|
|
724
|
-
|
|
720
|
+
let l = {};
|
|
721
|
+
return Ne().forEach((u) => {
|
|
722
|
+
if (u.key.startsWith("filter[")) {
|
|
723
|
+
const w = u.key.replace("filter[", "").replace("]", ""), S = u.value;
|
|
724
|
+
l[`filter[${w}]`] = S.join(",");
|
|
725
725
|
}
|
|
726
|
-
}),
|
|
726
|
+
}), l;
|
|
727
727
|
} else
|
|
728
728
|
return {};
|
|
729
|
-
},
|
|
730
|
-
k.value?.changePage(
|
|
731
|
-
}, D = (
|
|
732
|
-
r.value =
|
|
733
|
-
}, j = ({ data:
|
|
734
|
-
R.value =
|
|
729
|
+
}, m = Re(), p = y(!0), R = y(null), A = y("<p>Showing {from} to {to} of {total}</p>"), r = y(null), k = ge("dsgTable"), s = y({ perPage: 20, change: i }), g = y(20), d = y(b()), C = v, I = (l) => {
|
|
730
|
+
k.value?.changePage(l);
|
|
731
|
+
}, D = (l) => {
|
|
732
|
+
r.value = l;
|
|
733
|
+
}, j = ({ data: l }) => {
|
|
734
|
+
R.value = l;
|
|
735
735
|
}, K = () => {
|
|
736
736
|
p.value === !1 && k.value?.reload();
|
|
737
|
-
}, Q = (
|
|
737
|
+
}, Q = (l) => {
|
|
738
738
|
k.value?.setData(
|
|
739
|
-
k.value?.tableData.map((
|
|
739
|
+
k.value?.tableData.map((u) => u.id === l.id ? l : u)
|
|
740
740
|
);
|
|
741
|
-
},
|
|
742
|
-
d.value =
|
|
743
|
-
}, ee = (
|
|
744
|
-
d.value["filter[term]"] =
|
|
745
|
-
}, ae = (
|
|
746
|
-
d.value = { "filter[term]": d.value["filter[term]"], ...
|
|
741
|
+
}, z = (l) => {
|
|
742
|
+
d.value = l;
|
|
743
|
+
}, ee = (l) => {
|
|
744
|
+
d.value["filter[term]"] = l, C("dsg-table:term-changed", l);
|
|
745
|
+
}, ae = (l, u, w) => {
|
|
746
|
+
d.value = { "filter[term]": d.value["filter[term]"], ...l }, C("dsg-table:filter-updated", d.value, u, w);
|
|
747
747
|
};
|
|
748
748
|
return $({
|
|
749
749
|
reloadTable: K,
|
|
750
750
|
updateRowTable: Q,
|
|
751
751
|
termChanged: ee,
|
|
752
|
-
setFilters:
|
|
753
|
-
}), (
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
752
|
+
setFilters: z
|
|
753
|
+
}), (l, u) => (a(), n("div", Lt, [
|
|
754
|
+
h("div", Et, [
|
|
755
|
+
T(l.$slots, "dsg-table--pre-header", {}, () => [
|
|
756
|
+
h("div", Rt, [
|
|
757
|
+
T(l.$slots, "dsg-table--page-title", {
|
|
758
758
|
data: R.value,
|
|
759
|
-
title:
|
|
759
|
+
title: l.title
|
|
760
760
|
}, () => [
|
|
761
|
-
|
|
761
|
+
l.title.length > 0 ? (a(), n("h1", {
|
|
762
762
|
key: 0,
|
|
763
763
|
class: "dsg-table--title",
|
|
764
|
-
textContent: _(
|
|
765
|
-
}, null, 8, Ht)) :
|
|
764
|
+
textContent: _(l.title)
|
|
765
|
+
}, null, 8, Ht)) : P("", !0)
|
|
766
766
|
])
|
|
767
767
|
]),
|
|
768
|
-
|
|
769
|
-
|
|
768
|
+
h("div", It, [
|
|
769
|
+
T(l.$slots, "dsg-table--page-actions", { data: R.value })
|
|
770
770
|
])
|
|
771
771
|
])
|
|
772
772
|
]),
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
F(
|
|
773
|
+
l.displayPaginationInfo ? (a(), n("div", zt, [
|
|
774
|
+
h("div", Vt, [
|
|
775
|
+
T(l.$slots, "dsg-table--search-header", { data: R.value }, () => [
|
|
776
|
+
F(me, {
|
|
777
777
|
name: "term",
|
|
778
|
-
"onDsgTable:termChanged":
|
|
778
|
+
"onDsgTable:termChanged": u[0] || (u[0] = (w) => ee(w))
|
|
779
779
|
}),
|
|
780
780
|
F(be, {
|
|
781
|
-
entity:
|
|
782
|
-
"filter-endpoint":
|
|
783
|
-
"search-endpoint":
|
|
784
|
-
filters:
|
|
785
|
-
"onDsgTable:filterUpdated":
|
|
781
|
+
entity: l.filterEntity,
|
|
782
|
+
"filter-endpoint": l.filterEndpoint,
|
|
783
|
+
"search-endpoint": l.filterSearchEndpoint,
|
|
784
|
+
filters: l.filters,
|
|
785
|
+
"onDsgTable:filterUpdated": u[1] || (u[1] = (w, S, H) => ae(w, S, H))
|
|
786
786
|
}, null, 8, ["entity", "filter-endpoint", "search-endpoint", "filters"]),
|
|
787
|
-
|
|
787
|
+
T(l.$slots, "dsg-table--search-actions", { data: R.value })
|
|
788
788
|
])
|
|
789
789
|
]),
|
|
790
|
-
|
|
791
|
-
])) :
|
|
790
|
+
T(l.$slots, "dsg-table--search-navigation")
|
|
791
|
+
])) : P("", !0),
|
|
792
792
|
F(Bt, {
|
|
793
793
|
ref: "dsgTable",
|
|
794
|
-
"api-url":
|
|
794
|
+
"api-url": l.getUrl,
|
|
795
795
|
"filter-params": d.value,
|
|
796
|
-
"onUpdate:filterParams":
|
|
796
|
+
"onUpdate:filterParams": u[6] || (u[6] = (w) => d.value = w),
|
|
797
797
|
"per-page": g.value,
|
|
798
|
-
"onUpdate:perPage":
|
|
799
|
-
fields:
|
|
800
|
-
"load-on-start":
|
|
798
|
+
"onUpdate:perPage": u[7] || (u[7] = (w) => g.value = w),
|
|
799
|
+
fields: l.fields,
|
|
800
|
+
"load-on-start": l.loadOnStart,
|
|
801
801
|
"pagination-path": "meta",
|
|
802
|
-
selectable:
|
|
803
|
-
"track-by":
|
|
804
|
-
"table-layout":
|
|
802
|
+
selectable: l.selectable,
|
|
803
|
+
"track-by": l.trackBy,
|
|
804
|
+
"table-layout": l.tableLayout,
|
|
805
805
|
css: { tableWrapper: "border-b" },
|
|
806
|
-
"onDsgTable:loading":
|
|
807
|
-
"onDsgTable:loaded":
|
|
806
|
+
"onDsgTable:loading": u[8] || (u[8] = (w) => p.value = !0),
|
|
807
|
+
"onDsgTable:loaded": u[9] || (u[9] = (w) => p.value = !1),
|
|
808
808
|
"onDsgTable:paginationData": D,
|
|
809
809
|
"onDsgTable:loadSuccess": j,
|
|
810
|
-
"onDsgTable:rowsSelected":
|
|
810
|
+
"onDsgTable:rowsSelected": u[10] || (u[10] = (w) => C("dsg-table:rows-selected", w))
|
|
811
811
|
}, He({
|
|
812
|
-
"dsg-field--actions": Z((
|
|
813
|
-
|
|
814
|
-
(a(), N(
|
|
815
|
-
key:
|
|
816
|
-
data:
|
|
817
|
-
"onDsgTable:actionEdit":
|
|
818
|
-
"onDsgTable:actionView":
|
|
819
|
-
"onDsgTable:actionDelete":
|
|
820
|
-
"onDsgTable:linkClicked":
|
|
812
|
+
"dsg-field--actions": Z((w) => [
|
|
813
|
+
T(l.$slots, "dsg-table-actions", { data: w }, () => [
|
|
814
|
+
(a(), N(he, {
|
|
815
|
+
key: w.rowIndex,
|
|
816
|
+
data: w,
|
|
817
|
+
"onDsgTable:actionEdit": u[2] || (u[2] = (S, H) => C("dsg-table:action-edit", S, H)),
|
|
818
|
+
"onDsgTable:actionView": u[3] || (u[3] = (S, H) => C("dsg-table:action-view", S, H)),
|
|
819
|
+
"onDsgTable:actionDelete": u[4] || (u[4] = (S, H) => C("dsg-table:action-delete", S, H)),
|
|
820
|
+
"onDsgTable:linkClicked": u[5] || (u[5] = (S, H, G) => C("dsg-table:link-clicked", S, H, G))
|
|
821
821
|
}, null, 8, ["data"]))
|
|
822
822
|
])
|
|
823
823
|
]),
|
|
824
824
|
_: 2
|
|
825
825
|
}, [
|
|
826
|
-
q(U(
|
|
826
|
+
q(U(m), (w, S) => ({
|
|
827
827
|
name: S,
|
|
828
|
-
fn: Z(({ rowData:
|
|
829
|
-
String(S) !== "dsg-field--actions" ?
|
|
828
|
+
fn: Z(({ rowData: H, rowField: G, rowIndex: le }) => [
|
|
829
|
+
String(S) !== "dsg-field--actions" ? T(l.$slots, S, Ie(ze({ key: 0 }, { rowData: H, rowField: G, rowIndex: le }))) : P("", !0)
|
|
830
830
|
])
|
|
831
831
|
}))
|
|
832
832
|
]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "selectable", "track-by", "table-layout"]),
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
833
|
+
h("div", At, [
|
|
834
|
+
h("div", Ot, [
|
|
835
|
+
T(l.$slots, "dsg-table--footer-left", {
|
|
836
836
|
data: r.value,
|
|
837
|
-
perPage:
|
|
837
|
+
perPage: s.value
|
|
838
838
|
}, () => [
|
|
839
839
|
F(pe, {
|
|
840
840
|
"no-data-template": "",
|
|
841
841
|
ref: "paginationInfoStart",
|
|
842
842
|
pagination: r.value,
|
|
843
|
-
"onUpdate:pagination":
|
|
843
|
+
"onUpdate:pagination": u[11] || (u[11] = (w) => r.value = w),
|
|
844
844
|
"info-template": A.value
|
|
845
845
|
}, null, 8, ["pagination", "info-template"]),
|
|
846
|
-
|
|
846
|
+
T(l.$slots, "dsg-table--footer-left-extras", {
|
|
847
847
|
data: r.value,
|
|
848
|
-
perPage:
|
|
848
|
+
perPage: s.value
|
|
849
849
|
})
|
|
850
850
|
])
|
|
851
851
|
]),
|
|
852
|
-
|
|
853
|
-
|
|
852
|
+
h("div", Ut, [
|
|
853
|
+
T(l.$slots, "dsg-table--footer-center", {
|
|
854
854
|
data: r.value,
|
|
855
|
-
perPage:
|
|
855
|
+
perPage: s.value
|
|
856
856
|
}, () => [
|
|
857
|
-
|
|
857
|
+
T(l.$slots, "dsg-table--footer-center-extras", {
|
|
858
858
|
data: r.value,
|
|
859
|
-
perPage:
|
|
859
|
+
perPage: s.value
|
|
860
860
|
})
|
|
861
861
|
])
|
|
862
862
|
]),
|
|
863
|
-
|
|
864
|
-
|
|
863
|
+
h("div", qt, [
|
|
864
|
+
T(l.$slots, "dsg-table--footer-right", {
|
|
865
865
|
data: r.value,
|
|
866
|
-
perPage:
|
|
866
|
+
perPage: s.value
|
|
867
867
|
}, () => [
|
|
868
868
|
p.value === !1 ? (a(), N(fe, {
|
|
869
869
|
key: 0,
|
|
870
870
|
ref: "pagination",
|
|
871
871
|
pagination: r.value,
|
|
872
|
-
"onUpdate:pagination":
|
|
873
|
-
"onDsgTable:changePage":
|
|
874
|
-
}, null, 8, ["pagination"])) :
|
|
875
|
-
|
|
872
|
+
"onUpdate:pagination": u[12] || (u[12] = (w) => r.value = w),
|
|
873
|
+
"onDsgTable:changePage": I
|
|
874
|
+
}, null, 8, ["pagination"])) : P("", !0),
|
|
875
|
+
T(l.$slots, "dsg-table--footer-right-extras", {
|
|
876
876
|
data: r.value,
|
|
877
|
-
perPage:
|
|
877
|
+
perPage: s.value
|
|
878
878
|
})
|
|
879
879
|
])
|
|
880
880
|
])
|
|
@@ -889,7 +889,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
889
889
|
},
|
|
890
890
|
setup(t) {
|
|
891
891
|
return ($, v) => (a(), n("div", Wt, [
|
|
892
|
-
oe(
|
|
892
|
+
oe(h("select", {
|
|
893
893
|
"onUpdate:modelValue": v[0] || (v[0] = (i) => $.perPage.perPage = i),
|
|
894
894
|
class: "dsg-table--per-page-select",
|
|
895
895
|
onChange: v[1] || (v[1] = (i) => $.perPage.change($.perPage.perPage))
|
|
@@ -904,7 +904,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
904
904
|
])
|
|
905
905
|
]));
|
|
906
906
|
}
|
|
907
|
-
}), Qt = Nt, Yt =
|
|
907
|
+
}), Qt = Nt, Yt = he, xt = Kt, Gt = be, Jt = fe, Xt = pe, Zt = me, _t = ye, sa = {
|
|
908
908
|
DsgTable: Qt,
|
|
909
909
|
DsgTableActions: Yt,
|
|
910
910
|
DsgTablePerPage: xt,
|
package/dist/table.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export declare const DsgTable: {
|
|
|
14
14
|
"onDsg-table:action-view"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
15
15
|
"onDsg-table:action-delete"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
16
16
|
"onDsg-table:link-clicked"?: ((ev: Event, actionId: string | number, rowData: Record<string, any>) => any) | undefined;
|
|
17
|
+
"onDsg-table:term-changed"?: ((term: string | null) => any) | undefined;
|
|
18
|
+
"onDsg-table:filter-updated"?: ((params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any) | undefined;
|
|
17
19
|
"onDsg-table:rows-selected"?: ((rows: any) => any) | undefined;
|
|
18
20
|
}>, {
|
|
19
21
|
reloadTable: () => void;
|
|
@@ -25,6 +27,8 @@ export declare const DsgTable: {
|
|
|
25
27
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|
|
26
28
|
"dsg-table:action-delete": (ev: Event, rowData: Record<string, any>) => any;
|
|
27
29
|
"dsg-table:link-clicked": (ev: Event, actionId: string | number, rowData: Record<string, any>) => any;
|
|
30
|
+
"dsg-table:term-changed": (term: string | null) => any;
|
|
31
|
+
"dsg-table:filter-updated": (params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any;
|
|
28
32
|
"dsg-table:rows-selected": (rows: any) => any;
|
|
29
33
|
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
30
34
|
dsgTable: ({
|
|
@@ -237,6 +241,8 @@ export declare const DsgTable: {
|
|
|
237
241
|
"onDsg-table:action-view"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
238
242
|
"onDsg-table:action-delete"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
239
243
|
"onDsg-table:link-clicked"?: ((ev: Event, actionId: string | number, rowData: Record<string, any>) => any) | undefined;
|
|
244
|
+
"onDsg-table:term-changed"?: ((term: string | null) => any) | undefined;
|
|
245
|
+
"onDsg-table:filter-updated"?: ((params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any) | undefined;
|
|
240
246
|
"onDsg-table:rows-selected"?: ((rows: any) => any) | undefined;
|
|
241
247
|
}>, {
|
|
242
248
|
reloadTable: () => void;
|
|
@@ -252,6 +258,8 @@ export declare const DsgTable: {
|
|
|
252
258
|
"onDsg-table:action-view"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
253
259
|
"onDsg-table:action-delete"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
254
260
|
"onDsg-table:link-clicked"?: ((ev: Event, actionId: string | number, rowData: Record<string, any>) => any) | undefined;
|
|
261
|
+
"onDsg-table:term-changed"?: ((term: string | null) => any) | undefined;
|
|
262
|
+
"onDsg-table:filter-updated"?: ((params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any) | undefined;
|
|
255
263
|
"onDsg-table:rows-selected"?: ((rows: any) => any) | undefined;
|
|
256
264
|
}>, {
|
|
257
265
|
reloadTable: () => void;
|
|
@@ -263,6 +271,8 @@ export declare const DsgTable: {
|
|
|
263
271
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|
|
264
272
|
"dsg-table:action-delete": (ev: Event, rowData: Record<string, any>) => any;
|
|
265
273
|
"dsg-table:link-clicked": (ev: Event, actionId: string | number, rowData: Record<string, any>) => any;
|
|
274
|
+
"dsg-table:term-changed": (term: string | null) => any;
|
|
275
|
+
"dsg-table:filter-updated": (params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any;
|
|
266
276
|
"dsg-table:rows-selected": (rows: any) => any;
|
|
267
277
|
}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
268
278
|
$slots: Partial<Record<string, (_: {
|
|
@@ -1461,6 +1471,8 @@ declare const _default: {
|
|
|
1461
1471
|
"onDsg-table:action-view"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
1462
1472
|
"onDsg-table:action-delete"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
1463
1473
|
"onDsg-table:link-clicked"?: ((ev: Event, actionId: string | number, rowData: Record<string, any>) => any) | undefined;
|
|
1474
|
+
"onDsg-table:term-changed"?: ((term: string | null) => any) | undefined;
|
|
1475
|
+
"onDsg-table:filter-updated"?: ((params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any) | undefined;
|
|
1464
1476
|
"onDsg-table:rows-selected"?: ((rows: any) => any) | undefined;
|
|
1465
1477
|
}>, {
|
|
1466
1478
|
reloadTable: () => void;
|
|
@@ -1472,6 +1484,8 @@ declare const _default: {
|
|
|
1472
1484
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|
|
1473
1485
|
"dsg-table:action-delete": (ev: Event, rowData: Record<string, any>) => any;
|
|
1474
1486
|
"dsg-table:link-clicked": (ev: Event, actionId: string | number, rowData: Record<string, any>) => any;
|
|
1487
|
+
"dsg-table:term-changed": (term: string | null) => any;
|
|
1488
|
+
"dsg-table:filter-updated": (params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any;
|
|
1475
1489
|
"dsg-table:rows-selected": (rows: any) => any;
|
|
1476
1490
|
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
1477
1491
|
dsgTable: ({
|
|
@@ -1684,6 +1698,8 @@ declare const _default: {
|
|
|
1684
1698
|
"onDsg-table:action-view"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
1685
1699
|
"onDsg-table:action-delete"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
1686
1700
|
"onDsg-table:link-clicked"?: ((ev: Event, actionId: string | number, rowData: Record<string, any>) => any) | undefined;
|
|
1701
|
+
"onDsg-table:term-changed"?: ((term: string | null) => any) | undefined;
|
|
1702
|
+
"onDsg-table:filter-updated"?: ((params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any) | undefined;
|
|
1687
1703
|
"onDsg-table:rows-selected"?: ((rows: any) => any) | undefined;
|
|
1688
1704
|
}>, {
|
|
1689
1705
|
reloadTable: () => void;
|
|
@@ -1699,6 +1715,8 @@ declare const _default: {
|
|
|
1699
1715
|
"onDsg-table:action-view"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
1700
1716
|
"onDsg-table:action-delete"?: ((ev: Event, rowData: Record<string, any>) => any) | undefined;
|
|
1701
1717
|
"onDsg-table:link-clicked"?: ((ev: Event, actionId: string | number, rowData: Record<string, any>) => any) | undefined;
|
|
1718
|
+
"onDsg-table:term-changed"?: ((term: string | null) => any) | undefined;
|
|
1719
|
+
"onDsg-table:filter-updated"?: ((params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any) | undefined;
|
|
1702
1720
|
"onDsg-table:rows-selected"?: ((rows: any) => any) | undefined;
|
|
1703
1721
|
}>, {
|
|
1704
1722
|
reloadTable: () => void;
|
|
@@ -1710,6 +1728,8 @@ declare const _default: {
|
|
|
1710
1728
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|
|
1711
1729
|
"dsg-table:action-delete": (ev: Event, rowData: Record<string, any>) => any;
|
|
1712
1730
|
"dsg-table:link-clicked": (ev: Event, actionId: string | number, rowData: Record<string, any>) => any;
|
|
1731
|
+
"dsg-table:term-changed": (term: string | null) => any;
|
|
1732
|
+
"dsg-table:filter-updated": (params: any, payload: any, activeFacet: import('./main').DsgSearchFacet | null | undefined) => any;
|
|
1713
1733
|
"dsg-table:rows-selected": (rows: any) => any;
|
|
1714
1734
|
}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
1715
1735
|
$slots: Partial<Record<string, (_: {
|