@dcodegroup-au/dsg-vue 0.1.6 → 0.1.7
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.
|
@@ -199,6 +199,7 @@ declare function __VLS_template(): {
|
|
|
199
199
|
reload: () => void;
|
|
200
200
|
getData: () => any[] | null;
|
|
201
201
|
setData: (rows: any[] | null) => void;
|
|
202
|
+
setLoading: (loadingState: boolean) => void;
|
|
202
203
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
203
204
|
"update:filterParams": (value: any) => any;
|
|
204
205
|
"update:perPage": (value: any) => any;
|
|
@@ -247,11 +248,12 @@ declare function __VLS_template(): {
|
|
|
247
248
|
"onDsg-table:row-dblclick"?: ((ev: Event, rowIndex: number, rowData: Record<string, any>) => any) | undefined;
|
|
248
249
|
"onUpdate:filterParams"?: ((value: any) => any) | undefined;
|
|
249
250
|
"onUpdate:perPage"?: ((value: any) => any) | undefined;
|
|
250
|
-
}>, "changePage" | "reload" | "getData" | "setData"> & import('vue').ShallowUnwrapRef<{
|
|
251
|
+
}>, "changePage" | "reload" | "getData" | "setData" | "setLoading"> & import('vue').ShallowUnwrapRef<{
|
|
251
252
|
changePage: (page: "next" | "prev" | number) => void;
|
|
252
253
|
reload: () => void;
|
|
253
254
|
getData: () => any[] | null;
|
|
254
255
|
setData: (rows: any[] | null) => void;
|
|
256
|
+
setLoading: (loadingState: boolean) => void;
|
|
255
257
|
}> & {} & import('vue').ComponentCustomProperties & {} & {
|
|
256
258
|
$slots: Partial<Record<string, (_: {
|
|
257
259
|
rowData: any;
|
|
@@ -330,6 +332,7 @@ declare const __VLS_component: import('vue').DefineComponent<DsgTableProps, {
|
|
|
330
332
|
deleteRowTable: (rowData: any) => void;
|
|
331
333
|
termChanged: (term: string | null) => void;
|
|
332
334
|
setFilters: (filters: any) => void;
|
|
335
|
+
setLoading: (loadingState: boolean) => void;
|
|
333
336
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
334
337
|
"dsg-table:action-edit": (ev: Event, rowData: Record<string, any>) => any;
|
|
335
338
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|
|
@@ -453,6 +456,7 @@ declare const __VLS_component: import('vue').DefineComponent<DsgTableProps, {
|
|
|
453
456
|
reload: () => void;
|
|
454
457
|
getData: () => any[] | null;
|
|
455
458
|
setData: (rows: any[] | null) => void;
|
|
459
|
+
setLoading: (loadingState: boolean) => void;
|
|
456
460
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
457
461
|
"update:filterParams": (value: any) => any;
|
|
458
462
|
"update:perPage": (value: any) => any;
|
|
@@ -501,11 +505,12 @@ declare const __VLS_component: import('vue').DefineComponent<DsgTableProps, {
|
|
|
501
505
|
"onDsg-table:row-dblclick"?: ((ev: Event, rowIndex: number, rowData: Record<string, any>) => any) | undefined;
|
|
502
506
|
"onUpdate:filterParams"?: ((value: any) => any) | undefined;
|
|
503
507
|
"onUpdate:perPage"?: ((value: any) => any) | undefined;
|
|
504
|
-
}>, "changePage" | "reload" | "getData" | "setData"> & import('vue').ShallowUnwrapRef<{
|
|
508
|
+
}>, "changePage" | "reload" | "getData" | "setData" | "setLoading"> & import('vue').ShallowUnwrapRef<{
|
|
505
509
|
changePage: (page: "next" | "prev" | number) => void;
|
|
506
510
|
reload: () => void;
|
|
507
511
|
getData: () => any[] | null;
|
|
508
512
|
setData: (rows: any[] | null) => void;
|
|
513
|
+
setLoading: (loadingState: boolean) => void;
|
|
509
514
|
}> & {} & import('vue').ComponentCustomProperties & {} & {
|
|
510
515
|
$slots: Partial<Record<string, (_: {
|
|
511
516
|
rowData: any;
|
|
@@ -118,6 +118,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
|
|
|
118
118
|
reload: () => void;
|
|
119
119
|
getData: () => any[] | null;
|
|
120
120
|
setData: (rows: any[] | null) => void;
|
|
121
|
+
setLoading: (loadingState: boolean) => void;
|
|
121
122
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
122
123
|
"update:filterParams": (value: any) => any;
|
|
123
124
|
"update:perPage": (value: any) => any;
|
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"),P=require("./DsgTablePerPage.vue_vue_type_style_index_0_lang-DEG12JOR.cjs"),W=require("./dsg-vue.helpers-string.cjs"),q=require("./dsg-vue.helpers-object.cjs"),fe={class:"dsg-table--pagination"},be=["disabled"],ve=["disabled"],pe=["onClick","innerHTML"],ke=["onClick","innerHTML"],he=["disabled"],ye=["disabled"],G=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:y,emit:m}){const i=e.useModel(a,"pagination"),b=e.computed(()=>i.value===null?0:i.value?.last_page-a.firstPage+1),c=e.computed(()=>i.value===null?0:i.value?.last_page),p=e.computed(()=>i.value===null?!1:i.value?.current_page===a.firstPage),k=e.computed(()=>i.value===null?!1:i.value?.current_page===c.value),T=e.computed(()=>b.value<a.onEachSide*2+4),$=e.computed(()=>a.onEachSide*2+1),v=e.computed(()=>!i.value||i.value?.current_page<=a.onEachSide?1:i.value?.current_page>=b.value-a.onEachSide?b.value-a.onEachSide*2:i.value?.current_page-a.onEachSide),f=m,o=g=>{f("dsg-table:change-page",g)},r=g=>g===i.value?.current_page;return y({loadPage:o}),(g,E)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",fe,[g.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:E[0]||(E[0]=B=>o(g.firstPage)),class:e.normalizeClass([[p.value?"disabled":""],"dsg-table--pagination-link"]),disabled:p.value,title:"First","aria-label":"First"},[e.createVNode(P._sfc_main,{icon:g.firstIcon,size:"sm"},null,8,["icon"])],10,be)):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:E[1]||(E[1]=B=>o("prev")),class:e.normalizeClass([[p.value?"disabled":""],"dsg-table--pagination-link"]),disabled:p.value,title:"Previous","aria-label":"Previous"},[e.createVNode(P._sfc_main,{icon:g.prevIcon,size:"sm"},null,8,["icon"])],10,ve),T.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(b.value,(B,w)=>(e.openBlock(),e.createElementBlock("a",{key:w,onClick:N=>o(w+g.firstPage),class:e.normalizeClass([[r(w+g.firstPage)?"active":""],"dsg-table--pagination-link"]),innerHTML:B},null,10,pe))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList($.value,(B,w)=>(e.openBlock(),e.createElementBlock("a",{key:w,onClick:N=>o(v.value+w+g.firstPage-1),class:e.normalizeClass([[r(v.value+w+g.firstPage-1)?"active":""],"dsg-table--pagination-link"]),innerHTML:v.value+B-1},null,10,ke))),128)),e.createElementVNode("a",{onClick:E[2]||(E[2]=B=>o("next")),class:e.normalizeClass([[k.value?"disabled":""],"dsg-table--pagination-link"]),disabled:k.value,title:"Next","aria-label":"Next"},[e.createVNode(P._sfc_main,{icon:g.nextIcon,size:"sm"},null,8,["icon"])],10,he),g.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:3,onClick:E[3]||(E[3]=B=>o(c.value)),class:e.normalizeClass([[k.value?"disabled":""],"dsg-table--pagination-link"]),disabled:k.value,title:"Last","aria-label":"Last"},[e.createVNode(P._sfc_main,{icon:g.lastIcon,size:"sm"},null,8,["icon"])],10,ye)):e.createCommentVNode("",!0)],512)),[[e.vShow,i.value&&c.value>g.firstPage]])}}),Be=["innerHTML"],J=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 y=e.useModel(a,"pagination"),m=e.computed(()=>y.value==null||y.value.total==0?a.noDataTemplate:a.infoTemplate.replace("{from}",(y.value?.from||0).toString()).replace("{to}",(y.value?.to||0).toString()).replace("{total}",(y.value?.total||0).toString()));return(i,b)=>(e.openBlock(),e.createElementBlock("div",{class:"dsg-table--pagination-info",innerHTML:m.value},null,8,Be))}}),we={class:"dsg-table--actions",ref:"dsgTableActions"},Ce={class:"dsg-table--action-trigger"},Pe={key:0,class:"dsg-table--actions-menu-wrapper"},Ee=["href","target","onClick"],De=["textContent"],Se={key:0},$e={key:1},Ve=["href","target","onClick"],Te={class:"flex-1"},X=e.defineComponent({__name:"DsgTableActions",props:{placement:{default:"auto"}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:action-archive","dsg-table:link-clicked"],setup(a,{emit:y}){const m=e.ref(!1);e.useTemplateRef("dsgTableActions");const i=e.useAttrs(),b=e.ref(i.data.rowData?.actions??null),c=e.ref(i.data.rowData?.links??null),p=e.ref(i.data.rowData??null),k=f=>{switch(f){case"edit":return"edit-05";case"view":return"eye";case"delete":return"trash-01";case"archive":return"eye-off";default:return"dots-horizontal"}},T=(f,o,r)=>{switch(o){case"edit":v("dsg-table:action-edit",r,p.value);break;case"view":v("dsg-table:action-view",r,p.value);break;case"delete":v("dsg-table:action-delete",r,p.value);break;case"archive":v("dsg-table:action-archive",r,p.value);break}},$=(f,o)=>{const r=f.actionId||f.label.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-");v("dsg-table:link-clicked",o,r,p.value)},v=y;return(f,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",we,[e.createVNode(e.unref(P.kt),{triggers:[],placement:f.placement,"handle-resize":!0,strategy:"absolute",shown:m.value,class:"dsg-table--actions__popper",onHide:o[1]||(o[1]=r=>m.value=!1),ref:"floatingVueFilterDropdown"},{popper:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("div",Pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(r,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[["edit","view","delete","archive"].includes(String(g))?(e.openBlock(),e.createElementBlock("a",{key:g,href:b.value?.link,target:b.value?.target||"_self",onClick:E=>T(r,String(g),E)},[e.createElementVNode("div",{class:e.normalizeClass(["dsg-table--actions-menu-item",String(g)])},[e.createVNode(P._sfc_main,{icon:k(String(g)),size:"sm"},null,8,["icon"]),e.createElementVNode("span",{class:"flex-1",textContent:e.toDisplayString(e.unref(W.ucfirst)(String(g)))},null,8,De)],2)],8,Ee)):e.createCommentVNode("",!0)],64))),256)),b.value&&c.value?(e.openBlock(),e.createElementBlock("hr",Se)):e.createCommentVNode("",!0),c.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(c.value,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.label},[r.hasOwnProperty("component")?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.component),{key:0,quote:e.unref(i).data.data.rowData,"row-data":e.unref(i).data.data.rowData},null,8,["quote","row-data"])):r.hasOwnProperty("type")&&r.type=="break"?(e.openBlock(),e.createElementBlock("hr",$e)):(e.openBlock(),e.createElementBlock("a",{key:2,href:r.link,target:r.target||"_self",class:e.normalizeClass(["dsg-table--actions-menu-item",r.class]),onClick:g=>$(r,g)},[r.icon?(e.openBlock(),e.createBlock(P._sfc_main,{key:0,icon:r.icon,size:"sm"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",Te,e.toDisplayString(r.label),1)],10,Ve))],64))),128)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("div",Ce,[e.createElementVNode("button",{type:"button",class:"dsg-table--actions-button","aria-expanded":"false","aria-haspopup":"true",onClick:o[0]||(o[0]=r=>m.value=!m.value)},[e.renderSlot(f.$slots,"dsg-table-action-button-content",{},()=>[e.createVNode(P._sfc_main,{icon:"dots-vertical",size:"sm"})])])])]),_:3},8,["placement","shown"])])),[[e.unref(P.vOnClickOutside),()=>m.value=!1]])}}),Ne={class:"dsg-table--search"},Z=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:y}){const m=e.ref(""),i=y,b=P.useDebounceFn(c=>{m.value=c,i("dsg-table:term-changed",m.value)},300);return(c,p)=>(e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(P._sfc_main$4,{value:m.value,"onUpdate:value":p[0]||(p[0]=k=>m.value=k),name:c.name,id:c.id||c.name,placeholder:c.placeholder,disabled:c.disabled,required:c.required,readonly:c.readonly,hidden:c.hidden,"has-clear-button":!0,autocomplete:"off",size:"sm",icon:"search-sm","icon-clickable":!0,onIconClicked:p[1]||(p[1]=k=>e.unref(b)(k)),onEnterPressed:p[2]||(p[2]=k=>e.unref(b)(k)),onOnClear:p[3]||(p[3]=()=>e.unref(b)(""))},null,8,["value","name","id","placeholder","disabled","required","readonly","hidden"])]))}}),Fe={class:"dsg-table--header-row"},Me={key:0,class:"dsg-table--th dsg-table--th-checkbox",scope:"col"},Le={key:1,class:"dsg-table--th dsg-table--th-expand-detail",scope:"col"},ze=["title","id","onClick"],Re={key:0,class:"dsg-table--th-sort-icon"},He=["innerHTML"],Ae=["innerHTML"],x=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:y}){const m=e.useModel(a,"sortField"),i=e.useModel(a,"selectedRows"),b=e.useModel(a,"hasSelected"),c=e.ref("17px"),p=v=>{b.value&&i.value.length>0&&i.value.length!==a.tableDataLength?(b.value=!0,k("dsg-table:on-select-all")):!b.value&&i.value.length===0?(b.value=!1,k("dsg-table:on-select-all")):k("dsg-table:on-deselect-all")},k=y,T=(v,f)=>[v,v+"-"+W.toSnakeCase(String(f?.name)),f.titleClass||"",{sortable:f.sortable},{"sort-active":m.value?.name===f.name}],$=v=>{v.sortable&&(m.value={name:String(v?.name),field:String(v?.sortField),direction:m.value?.name===v.name&&m.value?.direction==="asc"?"desc":"asc"},k("dsg-table:sort-field",v))};return(v,f)=>(e.openBlock(),e.createElementBlock("tr",Fe,[v.hasSelectAll?(e.openBlock(),e.createElementBlock("th",Me,[e.createVNode(P._sfc_main$2,{modelValue:b.value,"onUpdate:modelValue":[f[0]||(f[0]=o=>b.value=o),p],indeterminate:i.value.length>0&&i.value.length!==v.tableDataLength},null,8,["modelValue","indeterminate"])])):e.createCommentVNode("",!0),v.showExpandDetail?(e.openBlock(),e.createElementBlock("th",Le)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.fields,(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o?.visible?(e.openBlock(),e.createElementBlock("th",{key:r,class:e.normalizeClass(T("dsg-table--th",o)),style:e.normalizeStyle([{width:o.width||void 0},o.style]),title:o.title+(o.sortable?" Sort":""),id:"_"+o.name,onClick:g=>$(o),scope:"col"},[o.sortable?(e.openBlock(),e.createElementBlock("div",Re,[o.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:"dsg-table--th-title",innerHTML:o.title},null,8,He)):e.createCommentVNode("",!0),o.sortable&&m.value?.name!==o.name?(e.openBlock(),e.createBlock(P._sfc_main,{key:1,icon:"chevron-selector-vertical",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),o.sortable&&m.value?.name===o.name&&m.value?.direction==="asc"?(e.openBlock(),e.createBlock(P._sfc_main,{key:2,icon:"chevron-down",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),o.sortable&&m.value?.name===o.name&&m.value?.direction==="desc"?(e.openBlock(),e.createBlock(P._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(W.ucwords)(String(o?.title))},null,8,Ae))],14,ze)):e.createCommentVNode("",!0)],64))),256)),v.scrollVisible?(e.openBlock(),e.createElementBlock("th",{key:2,style:e.normalizeStyle({width:c.value}),class:"dsg-table--th-col-gutter"},null,4)):e.createCommentVNode("",!0)]))}}),Ie={class:"dsg-table--wrapper"},Oe=["span"],Ue={key:0,class:"dsg-table--loading"},qe=["colspan"],We=["colspan"],je=["onClick","onDblclick","onMouseover"],Ke={key:0,class:"dsg-table--tbody-cell dsg-table--tbody-cell-checkbox"},Qe=["onClick","onDblclick","onContextmenu"],Ye=["innerHTML"],Ge=["onClick"],Je=["colspan"],Xe={key:2},Ze=["colspan"],xe={class:"dsg-table--footer"},_e=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","dsg-table:row-clicked","dsg-table:row-hover","dsg-table:row-dblclick"],["update:filterParams","update:perPage"]),setup(a,{expose:y,emit:m}){const i=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})),b=e.ref(i(a.fields)),c=e.ref(a.data),p=e.ref(null),k=e.ref(a.initialPage),T=e.ref("17px"),$=e.ref(!1),v=e.ref({}),f=e.ref(0),o=e.ref(!0),r=e.ref(null),g=e.ref(null),E=e.useModel(a,"filterParams"),B=e.useModel(a,"perPage"),w=e.ref([]),N=e.ref(!1),F=e.computed(()=>a.tableHeight!=null),M=e.computed(()=>b.value.filter(t=>t.visible).length);e.watch(()=>w.value.length,t=>{N.value=a.selectable&&t>0},{immediate:!0}),e.watch(()=>a.fields,t=>{b.value=i(t)},{immediate:!0}),e.watch(()=>E.value,()=>{L()},{deep:!0}),e.watch(()=>B.value,()=>{L()});const V=m,R=(t,n)=>t.formatter&&typeof t.formatter=="function"?t.formatter(t,n):q.data_get(n,String(t?.name),""),H=t=>"dsg-field--"+t.name?.toLowerCase().replaceAll(/[_ ]/g,"-"),A=t=>{if(a.selectable){if(t.selected)w.value.push(t);else{const n=w.value.findIndex(d=>d[a.trackBy]===t[a.trackBy]);n!==-1&&w.value.splice(n,1)}V("dsg-table:rows-selected",w.value)}},z=()=>{a.selectable&&(c.value?.forEach(t=>{t.selected=!0}),w.value=c.value?.filter(t=>t.selected)??[],V("dsg-table:rows-selected",w.value))},I=()=>{a.selectable&&(c.value?.forEach(t=>{t.selected=!1}),w.value=[],V("dsg-table:rows-selected",w.value))},l=t=>{c.value=Array.isArray(t)?t:[],a.selectable&&c.value.forEach(n=>{n.selected=n.selected??!1})},s=()=>c.value??[],u=t=>{t==="prev"?k.value>a.firstPage&&k.value--:t==="next"?k.value<(p.value?.last_page??0)&&k.value++:t!=k.value&&t>=a.firstPage&&t<=(p.value?.last_page??0)&&(k.value=t),L()},h=()=>({[a.queryParams?.sort]:r.value?(r.value?.direction==="desc"?"-":"")+r.value?.field:void 0,[a.queryParams?.order]:r.value?.direction,[a.queryParams?.page]:k.value,[a.queryParams?.perPage]:B.value}),C=()=>{g.value&&(g.value.abort(),g.value=null)},O=async(t,n)=>{C();const d=new AbortController;if(n.signal=d.signal,g.value=d,a.httpMethod.toLowerCase()==="get")return await P.axios.get(t,n);{const S=n.params;return delete n.params,await P.axios.post(t,S,n)}},j=t=>{V("dsg-table:load-success",t);const n=a.transform?a.transform(t.data):t.data;c.value=q.data_get(n,a.dataPath,null),a.selectable&&c.value?.forEach(d=>{d.selected=d.selected??!1}),p.value=q.data_get(n,a.paginationPath,null)??null,f.value=c.value?.length?c.value[0].order:f,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),k.value>(p.value?.to||0)&&(k.value=a.initialPage),V("dsg-table:loaded"),o.value=!1},K=t=>{console.error("load-error",t),V("dsg-table:load-error",t),V("dsg-table:loaded"),o.value=!1},L=(t=j,n=K,d={})=>{const S=t||j,D=n||K;if(a.apiMode)return o.value=!0,V("dsg-table:loading",o.value),a.httpOptions.params={...h(),...E.value},O(a.apiUrl,a.httpOptions).then(S).catch(U=>D(U))},re=(t,n,d)=>{V("dsg-table:row-clicked",t,n,d)},ie=(t,n,d)=>{V("dsg-table:row-dblclick",t,n,d)},de=(t,n,d)=>{},ce=(t,n,d,S)=>{},ue=(t,n,d,S)=>{},ge=(t,n,d,S)=>{},me=(t,n,d)=>{};e.onMounted(()=>{a.apiMode===!0&&L()});const Q=()=>{a.apiMode&&(w.value=[],C(),L())};return y({changePage:u,reload:Q,getData:s,setData:l}),(t,n)=>(e.openBlock(),e.createElementBlock("div",Ie,[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":"",v.value.table,"table-"+t.tableLayout])},[e.createElementVNode("colgroup",{span:M.value},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(d,S)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[d?.visible?(e.openBlock(),e.createElementBlock("col",{key:S,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&&$.value?(e.openBlock(),e.createElementBlock("col",{key:0,style:e.normalizeStyle({width:T.value}),class:"dsg-table--col-gutter"},null,4)):e.createCommentVNode("",!0)],8,Oe),e.createElementVNode("thead",{class:e.normalizeClass([[v.value.thead,{sticky:F.value,"top-0":F.value}],"dsg-table--head"])},[e.renderSlot(t.$slots,"tableHeader",{fields:b.value},()=>[e.createVNode(x,{fields:b.value,"has-select-all":t.selectable,"selected-rows":w.value,"onUpdate:selectedRows":n[0]||(n[0]=d=>w.value=d),"has-selected":N.value,"onUpdate:hasSelected":n[1]||(n[1]=d=>N.value=d),"scroll-visible":$.value,"show-expand-detail":t.hasDetailRow&&t.showExpandDetail,"table-data-length":c.value?.length,"sort-field":r.value,"onUpdate:sortField":n[2]||(n[2]=d=>r.value=d),"onDsgTable:sortField":n[3]||(n[3]=d=>Q()),"onDsgTable:onSelectAll":z,"onDsgTable:onDeselectAll":I},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",v.value.tbody])},[o.value?(e.openBlock(),e.createElementBlock("tr",Ue,[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(P._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,We)],8,qe)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(c.value,(d,S)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:S},[e.createElementVNode("tr",{class:e.normalizeClass(["dsg-table--tbody-row",{odd:S%2===0,even:S%2!==0,"row-selected":d.selected}]),onClick:D=>re(D,S,d),onDblclick:D=>ie(D,S,d),onMouseover:D=>de()},[t.selectable?(e.openBlock(),e.createElementBlock("td",Ke,[e.createVNode(P._sfc_main$2,{modelValue:d.selected,"onUpdate:modelValue":[D=>d.selected=D,D=>A(d)]},null,8,["modelValue","onUpdate:modelValue"])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(D,U)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:U},[D.visible?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["dsg-table--tbody-cell",D.dataClass]),style:e.normalizeStyle({width:D.width||void 0}),onClick:Y=>ce(),onDblclick:Y=>ue(),onContextmenu:Y=>ge()},[e.renderSlot(t.$slots,H(D),{rowData:d,rowIndex:S,rowField:D},()=>[e.createElementVNode("span",{innerHTML:R(D,d)},null,8,Ye)])],46,Qe)):e.createCommentVNode("",!0)],64))),128))],42,je),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:D=>me()},[e.createElementVNode("td",{colspan:M.value},[e.renderSlot(t.$slots,"dsg-table-detail-row",{rowData:d,rowIndex:S,options:t.detailRowOptions})],8,Je)],8,Ge)]),_:2},1032,["name"])):e.createCommentVNode("",!0)],64))),128)),!o.value&&!c.value?.length&&t.noDataTemplate.length?(e.openBlock(),e.createElementBlock("tr",Xe,[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,Ze)])):e.createCommentVNode("",!0)],2),e.createElementVNode("tfoot",xe,[e.renderSlot(t.$slots,"dsg-table-footer",{fields:b.value,data:c.value})])],2)],6)]))}}),et={class:"dsg-table"},tt={key:0,class:"dsg-table--pre-header"},at={class:"dsg-table--pre-header-left"},lt=["textContent"],ot={class:"dsg-table--pre-header-right"},nt={key:1,class:"dsg-table--search-header",ref:"dsgTableSearchHeaderEl"},st={class:"dsg-table--search-top"},rt={key:2,class:"dsg-table--footer",ref:"dsgTableFooterEl"},it={class:"dsg-table--footer-left"},dt={class:"dsg-table--footer-center"},ct={class:"dsg-table--footer-right"},ut=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:()=>{}},initialFilters:{default:()=>({})},filterEntity:{default:""},filterEndpoint:{default:""},filterSearchEndpoint:{default:""},tableLayout:{default:"fixed"},data:{default:null},hasHeader:{type:Boolean,default:!0},hasFooter:{type:Boolean,default:!0},css:{default:()=>({tableWrapper:"border-b"})}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:action-archive","dsg-table:link-clicked","dsg-table:rows-selected","dsg-table:row-clicked","dsg-table:row-hover","dsg-table:row-dblclick","dsg-table:filter-updated","dsg-table:term-changed","dsg-table:data-loaded"],setup(a,{expose:y,emit:m}){const i=l=>{g.value=l},b=e.ref(!!(a.filterEntity||a.filterEndpoint)),c=()=>{if(b.value){let l={};return P.getQueryStrings().forEach(s=>{if(s.key.startsWith("filter[")){const u=s.key.replace("filter[","").replace("]",""),h=s.value;l[`filter[${u}]`]=h.join(",")}}),l}else return{}},p=e.computed(()=>({...a.css,tableWrapper:"border-b "+(a.css?.tableWrapper||"")})),k=e.useSlots(),T=e.ref(!0),$=e.ref(null),v=e.ref("<p>Showing {from} to {to} of {total}</p>"),f=e.ref(null),o=e.useTemplateRef("dsgTable"),r=e.ref({perPage:20,change:i}),g=e.ref(20),E=e.ref({...c(),...a.initialFilters}),B=m,w=l=>{o.value?.changePage(l)},N=l=>{f.value=l},F=({data:l})=>{$.value=l,B("dsg-table:data-loaded",l)},M=()=>{T.value===!1&&o.value?.reload()},V=l=>{const s=o.value?.getData?.()??[];o.value?.setData(s.map(u=>u.id===l.id?l:u))},R=l=>{const s=o.value?.getData?.()??[];o.value?.setData([...s,l])},H=l=>{const s=o.value?.getData?.()??[];o.value?.setData(s.filter(u=>u.id!==l.id))},A=l=>{E.value=l},z=l=>{E.value["filter[term]"]=l,B("dsg-table:term-changed",l)},I=(l,s,u)=>{E.value={"filter[term]":E.value["filter[term]"],...l},B("dsg-table:filter-updated",E.value,s,u)};return y({reloadTable:M,updateRowTable:V,addRowTable:R,deleteRowTable:H,termChanged:z,setFilters:A}),(l,s)=>(e.openBlock(),e.createElementBlock("div",et,[l.hasHeader?(e.openBlock(),e.createElementBlock("div",tt,[e.renderSlot(l.$slots,"dsg-table--pre-header",{},()=>[e.createElementVNode("div",at,[e.renderSlot(l.$slots,"dsg-table--page-title",{data:$.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,lt)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ot,[e.renderSlot(l.$slots,"dsg-table--page-actions",{data:$.value})])])])):e.createCommentVNode("",!0),l.displayPaginationInfo?(e.openBlock(),e.createElementBlock("div",nt,[e.createElementVNode("div",st,[e.renderSlot(l.$slots,"dsg-table--search-header",{data:$.value},()=>[e.createVNode(Z,{name:"term","onDsgTable:termChanged":s[0]||(s[0]=u=>z(u))}),e.createVNode(P._sfc_main$7,{entity:l.filterEntity,"filter-endpoint":l.filterEndpoint,"search-endpoint":l.filterSearchEndpoint,filters:l.filters,"onDsgTable:filterUpdated":s[1]||(s[1]=(u,h,C)=>I(u,h,C))},null,8,["entity","filter-endpoint","search-endpoint","filters"]),e.renderSlot(l.$slots,"dsg-table--search-actions",{data:$.value})])]),e.renderSlot(l.$slots,"dsg-table--search-navigation")],512)):e.createCommentVNode("",!0),e.createVNode(_e,{ref:"dsgTable","api-url":l.getUrl,"filter-params":E.value,"onUpdate:filterParams":s[7]||(s[7]=u=>E.value=u),"per-page":g.value,"onUpdate:perPage":s[8]||(s[8]=u=>g.value=u),fields:l.fields,"load-on-start":l.loadOnStart,"pagination-path":"meta",selectable:l.selectable,"track-by":l.trackBy,"table-layout":l.tableLayout,css:p.value,data:l.data,"onDsgTable:loading":s[9]||(s[9]=u=>T.value=!0),"onDsgTable:loaded":s[10]||(s[10]=u=>T.value=!1),"onDsgTable:paginationData":N,"onDsgTable:loadSuccess":F,"onDsgTable:rowsSelected":s[11]||(s[11]=u=>B("dsg-table:rows-selected",u)),"onDsgTable:rowClicked":s[12]||(s[12]=(u,h,C)=>B("dsg-table:row-clicked",u,h,C)),"onDsgTable:rowHover":s[13]||(s[13]=(u,h,C)=>B("dsg-table:row-hover",u,h,C)),"onDsgTable:rowDblclick":s[14]||(s[14]=(u,h,C)=>B("dsg-table:row-dblclick",u,h,C))},e.createSlots({"dsg-field--actions":e.withCtx(u=>[e.renderSlot(l.$slots,"dsg-table-actions",{data:u},()=>[(e.openBlock(),e.createBlock(X,{key:u.rowIndex,data:u,"onDsgTable:actionEdit":s[2]||(s[2]=(h,C)=>B("dsg-table:action-edit",h,C)),"onDsgTable:actionView":s[3]||(s[3]=(h,C)=>B("dsg-table:action-view",h,C)),"onDsgTable:actionDelete":s[4]||(s[4]=(h,C)=>B("dsg-table:action-delete",h,C)),"onDsgTable:actionArchive":s[5]||(s[5]=(h,C)=>B("dsg-table:action-archive",h,C)),"onDsgTable:linkClicked":s[6]||(s[6]=(h,C,O)=>B("dsg-table:link-clicked",h,C,O))},null,8,["data"]))])]),_:2},[e.renderList(e.unref(k),(u,h)=>({name:h,fn:e.withCtx(C=>[String(h)!=="dsg-field--actions"?e.renderSlot(l.$slots,h,e.normalizeProps(e.mergeProps({key:0},C))):e.createCommentVNode("",!0)])}))]),1032,["api-url","filter-params","per-page","fields","load-on-start","selectable","track-by","table-layout","css","data"]),l.hasFooter?(e.openBlock(),e.createElementBlock("div",rt,[e.createElementVNode("div",it,[e.renderSlot(l.$slots,"dsg-table--footer-left",{data:f.value,perPage:r.value},()=>[e.createVNode(J,{ref:"paginationInfoStart",pagination:f.value,"onUpdate:pagination":s[15]||(s[15]=u=>f.value=u),"info-template":v.value},null,8,["pagination","info-template"]),e.renderSlot(l.$slots,"dsg-table--footer-left-extras",{data:f.value,perPage:r.value})])]),e.createElementVNode("div",dt,[e.renderSlot(l.$slots,"dsg-table--footer-center",{data:f.value,perPage:r.value},()=>[e.renderSlot(l.$slots,"dsg-table--footer-center-extras",{data:f.value,perPage:r.value})])]),e.createElementVNode("div",ct,[e.renderSlot(l.$slots,"dsg-table--footer-right",{data:f.value,perPage:r.value},()=>[T.value===!1?(e.openBlock(),e.createBlock(G,{key:0,ref:"pagination",pagination:f.value,"onUpdate:pagination":s[16]||(s[16]=u=>f.value=u),"onDsgTable:changePage":w},null,8,["pagination"])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"dsg-table--footer-right-extras",{data:f.value,perPage:r.value})])])],512)):e.createCommentVNode("",!0)]))}}),gt={class:"dsg-table--per-page"},mt=["value","textContent"],ft=e.defineComponent({__name:"DsgTablePerPage",props:{perPageOptions:{default:()=>[10,20,30,50,100]},perPage:{}},setup(a){return(y,m)=>(e.openBlock(),e.createElementBlock("div",gt,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":m[0]||(m[0]=i=>y.perPage.perPage=i),class:"dsg-table--per-page-select",onChange:m[1]||(m[1]=i=>y.perPage.change(y.perPage.perPage))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.perPageOptions,i=>(e.openBlock(),e.createElementBlock("option",{key:i,value:i,textContent:e.toDisplayString(i)},null,8,mt))),128))],544),[[e.vModelSelect,y.perPage.perPage]])]))}}),_=ut,ee=X,te=ft,ae=P._sfc_main$7,le=G,oe=J,ne=Z,se=x,bt={DsgTable:_,DsgTableActions:ee,DsgTablePerPage:te,DsgTableFilter:ae,DsgTablePagination:le,DsgTablePaginationInfo:oe,DsgTableSearch:ne,DsgTableRowHeader:se};exports.DsgTable=_;exports.DsgTableActions=ee;exports.DsgTableFilter=ae;exports.DsgTablePagination=le;exports.DsgTablePaginationInfo=oe;exports.DsgTablePerPage=te;exports.DsgTableRowHeader=se;exports.DsgTableSearch=ne;exports.default=bt;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),C=require("./DsgTablePerPage.vue_vue_type_style_index_0_lang-DEG12JOR.cjs"),j=require("./dsg-vue.helpers-string.cjs"),W=require("./dsg-vue.helpers-object.cjs"),be={class:"dsg-table--pagination"},fe=["disabled"],ve=["disabled"],pe=["onClick","innerHTML"],ke=["onClick","innerHTML"],he=["disabled"],ye=["disabled"],G=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:y,emit:m}){const i=e.useModel(a,"pagination"),f=e.computed(()=>i.value===null?0:i.value?.last_page-a.firstPage+1),c=e.computed(()=>i.value===null?0:i.value?.last_page),p=e.computed(()=>i.value===null?!1:i.value?.current_page===a.firstPage),k=e.computed(()=>i.value===null?!1:i.value?.current_page===c.value),T=e.computed(()=>f.value<a.onEachSide*2+4),$=e.computed(()=>a.onEachSide*2+1),v=e.computed(()=>!i.value||i.value?.current_page<=a.onEachSide?1:i.value?.current_page>=f.value-a.onEachSide?f.value-a.onEachSide*2:i.value?.current_page-a.onEachSide),b=m,o=g=>{b("dsg-table:change-page",g)},r=g=>g===i.value?.current_page;return y({loadPage:o}),(g,P)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",be,[g.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:P[0]||(P[0]=B=>o(g.firstPage)),class:e.normalizeClass([[p.value?"disabled":""],"dsg-table--pagination-link"]),disabled:p.value,title:"First","aria-label":"First"},[e.createVNode(C._sfc_main,{icon:g.firstIcon,size:"sm"},null,8,["icon"])],10,fe)):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:P[1]||(P[1]=B=>o("prev")),class:e.normalizeClass([[p.value?"disabled":""],"dsg-table--pagination-link"]),disabled:p.value,title:"Previous","aria-label":"Previous"},[e.createVNode(C._sfc_main,{icon:g.prevIcon,size:"sm"},null,8,["icon"])],10,ve),T.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(f.value,(B,w)=>(e.openBlock(),e.createElementBlock("a",{key:w,onClick:N=>o(w+g.firstPage),class:e.normalizeClass([[r(w+g.firstPage)?"active":""],"dsg-table--pagination-link"]),innerHTML:B},null,10,pe))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList($.value,(B,w)=>(e.openBlock(),e.createElementBlock("a",{key:w,onClick:N=>o(v.value+w+g.firstPage-1),class:e.normalizeClass([[r(v.value+w+g.firstPage-1)?"active":""],"dsg-table--pagination-link"]),innerHTML:v.value+B-1},null,10,ke))),128)),e.createElementVNode("a",{onClick:P[2]||(P[2]=B=>o("next")),class:e.normalizeClass([[k.value?"disabled":""],"dsg-table--pagination-link"]),disabled:k.value,title:"Next","aria-label":"Next"},[e.createVNode(C._sfc_main,{icon:g.nextIcon,size:"sm"},null,8,["icon"])],10,he),g.showFirstLast?(e.openBlock(),e.createElementBlock("a",{key:3,onClick:P[3]||(P[3]=B=>o(c.value)),class:e.normalizeClass([[k.value?"disabled":""],"dsg-table--pagination-link"]),disabled:k.value,title:"Last","aria-label":"Last"},[e.createVNode(C._sfc_main,{icon:g.lastIcon,size:"sm"},null,8,["icon"])],10,ye)):e.createCommentVNode("",!0)],512)),[[e.vShow,i.value&&c.value>g.firstPage]])}}),Be=["innerHTML"],J=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 y=e.useModel(a,"pagination"),m=e.computed(()=>y.value==null||y.value.total==0?a.noDataTemplate:a.infoTemplate.replace("{from}",(y.value?.from||0).toString()).replace("{to}",(y.value?.to||0).toString()).replace("{total}",(y.value?.total||0).toString()));return(i,f)=>(e.openBlock(),e.createElementBlock("div",{class:"dsg-table--pagination-info",innerHTML:m.value},null,8,Be))}}),we={class:"dsg-table--actions",ref:"dsgTableActions"},Ce={class:"dsg-table--action-trigger"},Pe={key:0,class:"dsg-table--actions-menu-wrapper"},Ee=["href","target","onClick"],De=["textContent"],Se={key:0},$e={key:1},Ve=["href","target","onClick"],Te={class:"flex-1"},X=e.defineComponent({__name:"DsgTableActions",props:{placement:{default:"auto"}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:action-archive","dsg-table:link-clicked"],setup(a,{emit:y}){const m=e.ref(!1);e.useTemplateRef("dsgTableActions");const i=e.useAttrs(),f=e.ref(i.data.rowData?.actions??null),c=e.ref(i.data.rowData?.links??null),p=e.ref(i.data.rowData??null),k=b=>{switch(b){case"edit":return"edit-05";case"view":return"eye";case"delete":return"trash-01";case"archive":return"eye-off";default:return"dots-horizontal"}},T=(b,o,r)=>{switch(o){case"edit":v("dsg-table:action-edit",r,p.value);break;case"view":v("dsg-table:action-view",r,p.value);break;case"delete":v("dsg-table:action-delete",r,p.value);break;case"archive":v("dsg-table:action-archive",r,p.value);break}},$=(b,o)=>{const r=b.actionId||b.label.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-");v("dsg-table:link-clicked",o,r,p.value)},v=y;return(b,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",we,[e.createVNode(e.unref(C.kt),{triggers:[],placement:b.placement,"handle-resize":!0,strategy:"absolute",shown:m.value,class:"dsg-table--actions__popper",onHide:o[1]||(o[1]=r=>m.value=!1),ref:"floatingVueFilterDropdown"},{popper:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("div",Pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(r,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[["edit","view","delete","archive"].includes(String(g))?(e.openBlock(),e.createElementBlock("a",{key:g,href:f.value?.link,target:f.value?.target||"_self",onClick:P=>T(r,String(g),P)},[e.createElementVNode("div",{class:e.normalizeClass(["dsg-table--actions-menu-item",String(g)])},[e.createVNode(C._sfc_main,{icon:k(String(g)),size:"sm"},null,8,["icon"]),e.createElementVNode("span",{class:"flex-1",textContent:e.toDisplayString(e.unref(j.ucfirst)(String(g)))},null,8,De)],2)],8,Ee)):e.createCommentVNode("",!0)],64))),256)),f.value&&c.value?(e.openBlock(),e.createElementBlock("hr",Se)):e.createCommentVNode("",!0),c.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(c.value,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.label},[r.hasOwnProperty("component")?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.component),{key:0,quote:e.unref(i).data.data.rowData,"row-data":e.unref(i).data.data.rowData},null,8,["quote","row-data"])):r.hasOwnProperty("type")&&r.type=="break"?(e.openBlock(),e.createElementBlock("hr",$e)):(e.openBlock(),e.createElementBlock("a",{key:2,href:r.link,target:r.target||"_self",class:e.normalizeClass(["dsg-table--actions-menu-item",r.class]),onClick:g=>$(r,g)},[r.icon?(e.openBlock(),e.createBlock(C._sfc_main,{key:0,icon:r.icon,size:"sm"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",Te,e.toDisplayString(r.label),1)],10,Ve))],64))),128)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("div",Ce,[e.createElementVNode("button",{type:"button",class:"dsg-table--actions-button","aria-expanded":"false","aria-haspopup":"true",onClick:o[0]||(o[0]=r=>m.value=!m.value)},[e.renderSlot(b.$slots,"dsg-table-action-button-content",{},()=>[e.createVNode(C._sfc_main,{icon:"dots-vertical",size:"sm"})])])])]),_:3},8,["placement","shown"])])),[[e.unref(C.vOnClickOutside),()=>m.value=!1]])}}),Ne={class:"dsg-table--search"},Z=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:y}){const m=e.ref(""),i=y,f=C.useDebounceFn(c=>{m.value=c,i("dsg-table:term-changed",m.value)},300);return(c,p)=>(e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(C._sfc_main$4,{value:m.value,"onUpdate:value":p[0]||(p[0]=k=>m.value=k),name:c.name,id:c.id||c.name,placeholder:c.placeholder,disabled:c.disabled,required:c.required,readonly:c.readonly,hidden:c.hidden,"has-clear-button":!0,autocomplete:"off",size:"sm",icon:"search-sm","icon-clickable":!0,onIconClicked:p[1]||(p[1]=k=>e.unref(f)(k)),onEnterPressed:p[2]||(p[2]=k=>e.unref(f)(k)),onOnClear:p[3]||(p[3]=()=>e.unref(f)(""))},null,8,["value","name","id","placeholder","disabled","required","readonly","hidden"])]))}}),Fe={class:"dsg-table--header-row"},Me={key:0,class:"dsg-table--th dsg-table--th-checkbox",scope:"col"},Le={key:1,class:"dsg-table--th dsg-table--th-expand-detail",scope:"col"},ze=["title","id","onClick"],Re={key:0,class:"dsg-table--th-sort-icon"},He=["innerHTML"],Ae=["innerHTML"],x=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:y}){const m=e.useModel(a,"sortField"),i=e.useModel(a,"selectedRows"),f=e.useModel(a,"hasSelected"),c=e.ref("17px"),p=v=>{f.value&&i.value.length>0&&i.value.length!==a.tableDataLength?(f.value=!0,k("dsg-table:on-select-all")):!f.value&&i.value.length===0?(f.value=!1,k("dsg-table:on-select-all")):k("dsg-table:on-deselect-all")},k=y,T=(v,b)=>[v,v+"-"+j.toSnakeCase(String(b?.name)),b.titleClass||"",{sortable:b.sortable},{"sort-active":m.value?.name===b.name}],$=v=>{v.sortable&&(m.value={name:String(v?.name),field:String(v?.sortField),direction:m.value?.name===v.name&&m.value?.direction==="asc"?"desc":"asc"},k("dsg-table:sort-field",v))};return(v,b)=>(e.openBlock(),e.createElementBlock("tr",Fe,[v.hasSelectAll?(e.openBlock(),e.createElementBlock("th",Me,[e.createVNode(C._sfc_main$2,{modelValue:f.value,"onUpdate:modelValue":[b[0]||(b[0]=o=>f.value=o),p],indeterminate:i.value.length>0&&i.value.length!==v.tableDataLength},null,8,["modelValue","indeterminate"])])):e.createCommentVNode("",!0),v.showExpandDetail?(e.openBlock(),e.createElementBlock("th",Le)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.fields,(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o?.visible?(e.openBlock(),e.createElementBlock("th",{key:r,class:e.normalizeClass(T("dsg-table--th",o)),style:e.normalizeStyle([{width:o.width||void 0},o.style]),title:o.title+(o.sortable?" Sort":""),id:"_"+o.name,onClick:g=>$(o),scope:"col"},[o.sortable?(e.openBlock(),e.createElementBlock("div",Re,[o.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:"dsg-table--th-title",innerHTML:o.title},null,8,He)):e.createCommentVNode("",!0),o.sortable&&m.value?.name!==o.name?(e.openBlock(),e.createBlock(C._sfc_main,{key:1,icon:"chevron-selector-vertical",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),o.sortable&&m.value?.name===o.name&&m.value?.direction==="asc"?(e.openBlock(),e.createBlock(C._sfc_main,{key:2,icon:"chevron-down",class:"inline-flex",size:"xs"})):e.createCommentVNode("",!0),o.sortable&&m.value?.name===o.name&&m.value?.direction==="desc"?(e.openBlock(),e.createBlock(C._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(j.ucwords)(String(o?.title))},null,8,Ae))],14,ze)):e.createCommentVNode("",!0)],64))),256)),v.scrollVisible?(e.openBlock(),e.createElementBlock("th",{key:2,style:e.normalizeStyle({width:c.value}),class:"dsg-table--th-col-gutter"},null,4)):e.createCommentVNode("",!0)]))}}),Ie={class:"dsg-table--wrapper"},Oe=["span"],Ue={key:0,class:"dsg-table--loading"},qe=["colspan"],We=["colspan"],je=["onClick","onDblclick","onMouseover"],Ke={key:0,class:"dsg-table--tbody-cell dsg-table--tbody-cell-checkbox"},Qe=["onClick","onDblclick","onContextmenu"],Ye=["innerHTML"],Ge=["onClick"],Je=["colspan"],Xe={key:2},Ze=["colspan"],xe={class:"dsg-table--footer"},_e=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","dsg-table:row-clicked","dsg-table:row-hover","dsg-table:row-dblclick"],["update:filterParams","update:perPage"]),setup(a,{expose:y,emit:m}){const i=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(i(a.fields)),c=e.ref(a.data),p=e.ref(null),k=e.ref(a.initialPage),T=e.ref("17px"),$=e.ref(!1),v=e.ref({}),b=e.ref(0),o=e.ref(!0),r=e.ref(null),g=e.ref(null),P=e.useModel(a,"filterParams"),B=e.useModel(a,"perPage"),w=e.ref([]),N=e.ref(!1),F=e.computed(()=>a.tableHeight!=null),M=e.computed(()=>f.value.filter(t=>t.visible).length);e.watch(()=>w.value.length,t=>{N.value=a.selectable&&t>0},{immediate:!0}),e.watch(()=>a.fields,t=>{f.value=i(t)},{immediate:!0}),e.watch(()=>P.value,()=>{L()},{deep:!0}),e.watch(()=>B.value,()=>{L()});const V=m,H=(t,n)=>t.formatter&&typeof t.formatter=="function"?t.formatter(t,n):W.data_get(n,String(t?.name),""),A=t=>"dsg-field--"+t.name?.toLowerCase().replaceAll(/[_ ]/g,"-"),I=t=>{if(a.selectable){if(t.selected)w.value.push(t);else{const n=w.value.findIndex(d=>d[a.trackBy]===t[a.trackBy]);n!==-1&&w.value.splice(n,1)}V("dsg-table:rows-selected",w.value)}},O=()=>{a.selectable&&(c.value?.forEach(t=>{t.selected=!0}),w.value=c.value?.filter(t=>t.selected)??[],V("dsg-table:rows-selected",w.value))},z=()=>{a.selectable&&(c.value?.forEach(t=>{t.selected=!1}),w.value=[],V("dsg-table:rows-selected",w.value))},U=t=>{c.value=Array.isArray(t)?t:[],a.selectable&&c.value.forEach(n=>{n.selected=n.selected??!1})},l=()=>c.value??[],s=t=>{t==="prev"?k.value>a.firstPage&&k.value--:t==="next"?k.value<(p.value?.last_page??0)&&k.value++:t!=k.value&&t>=a.firstPage&&t<=(p.value?.last_page??0)&&(k.value=t),L()},u=()=>({[a.queryParams?.sort]:r.value?(r.value?.direction==="desc"?"-":"")+r.value?.field:void 0,[a.queryParams?.order]:r.value?.direction,[a.queryParams?.page]:k.value,[a.queryParams?.perPage]:B.value}),h=()=>{g.value&&(g.value.abort(),g.value=null)},E=async(t,n)=>{h();const d=new AbortController;if(n.signal=d.signal,g.value=d,a.httpMethod.toLowerCase()==="get")return await C.axios.get(t,n);{const S=n.params;return delete n.params,await C.axios.post(t,S,n)}},R=t=>{V("dsg-table:load-success",t);const n=a.transform?a.transform(t.data):t.data;c.value=W.data_get(n,a.dataPath,null),a.selectable&&c.value?.forEach(d=>{d.selected=d.selected??!1}),p.value=W.data_get(n,a.paginationPath,null)??null,b.value=c.value?.length?c.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),k.value>(p.value?.to||0)&&(k.value=a.initialPage),V("dsg-table:loaded"),o.value=!1},K=t=>{console.error("load-error",t),V("dsg-table:load-error",t),V("dsg-table:loaded"),o.value=!1},L=(t=R,n=K,d={})=>{const S=t||R,D=n||K;if(a.apiMode)return o.value=!0,V("dsg-table:loading",o.value),a.httpOptions.params={...u(),...P.value},E(a.apiUrl,a.httpOptions).then(S).catch(q=>D(q))},re=(t,n,d)=>{V("dsg-table:row-clicked",t,n,d)},ie=(t,n,d)=>{V("dsg-table:row-dblclick",t,n,d)},de=(t,n,d)=>{},ce=(t,n,d,S)=>{},ue=(t,n,d,S)=>{},ge=(t,n,d,S)=>{},me=(t,n,d)=>{};e.onMounted(()=>{a.apiMode===!0&&L()});const Q=()=>{a.apiMode&&(w.value=[],h(),L())};return y({changePage:s,reload:Q,getData:l,setData:U,setLoading:t=>{o.value=t,V("dsg-table:loading",o.value)}}),(t,n)=>(e.openBlock(),e.createElementBlock("div",Ie,[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":"",v.value.table,"table-"+t.tableLayout])},[e.createElementVNode("colgroup",{span:M.value},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(d,S)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[d?.visible?(e.openBlock(),e.createElementBlock("col",{key:S,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&&$.value?(e.openBlock(),e.createElementBlock("col",{key:0,style:e.normalizeStyle({width:T.value}),class:"dsg-table--col-gutter"},null,4)):e.createCommentVNode("",!0)],8,Oe),e.createElementVNode("thead",{class:e.normalizeClass([[v.value.thead,{sticky:F.value,"top-0":F.value}],"dsg-table--head"])},[e.renderSlot(t.$slots,"tableHeader",{fields:f.value},()=>[e.createVNode(x,{fields:f.value,"has-select-all":t.selectable,"selected-rows":w.value,"onUpdate:selectedRows":n[0]||(n[0]=d=>w.value=d),"has-selected":N.value,"onUpdate:hasSelected":n[1]||(n[1]=d=>N.value=d),"scroll-visible":$.value,"show-expand-detail":t.hasDetailRow&&t.showExpandDetail,"table-data-length":c.value?.length,"sort-field":r.value,"onUpdate:sortField":n[2]||(n[2]=d=>r.value=d),"onDsgTable:sortField":n[3]||(n[3]=d=>Q()),"onDsgTable:onSelectAll":O,"onDsgTable:onDeselectAll":z},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",v.value.tbody])},[o.value?(e.openBlock(),e.createElementBlock("tr",Ue,[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(C._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,We)],8,qe)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(c.value,(d,S)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:S},[e.createElementVNode("tr",{class:e.normalizeClass(["dsg-table--tbody-row",{odd:S%2===0,even:S%2!==0,"row-selected":d.selected}]),onClick:D=>re(D,S,d),onDblclick:D=>ie(D,S,d),onMouseover:D=>de()},[t.selectable?(e.openBlock(),e.createElementBlock("td",Ke,[e.createVNode(C._sfc_main$2,{modelValue:d.selected,"onUpdate:modelValue":[D=>d.selected=D,D=>I(d)]},null,8,["modelValue","onUpdate:modelValue"])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(D,q)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:q},[D.visible?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["dsg-table--tbody-cell",D.dataClass]),style:e.normalizeStyle({width:D.width||void 0}),onClick:Y=>ce(),onDblclick:Y=>ue(),onContextmenu:Y=>ge()},[e.renderSlot(t.$slots,A(D),{rowData:d,rowIndex:S,rowField:D},()=>[e.createElementVNode("span",{innerHTML:H(D,d)},null,8,Ye)])],46,Qe)):e.createCommentVNode("",!0)],64))),128))],42,je),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:D=>me()},[e.createElementVNode("td",{colspan:M.value},[e.renderSlot(t.$slots,"dsg-table-detail-row",{rowData:d,rowIndex:S,options:t.detailRowOptions})],8,Je)],8,Ge)]),_:2},1032,["name"])):e.createCommentVNode("",!0)],64))),128)),!o.value&&!c.value?.length&&t.noDataTemplate.length?(e.openBlock(),e.createElementBlock("tr",Xe,[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,Ze)])):e.createCommentVNode("",!0)],2),e.createElementVNode("tfoot",xe,[e.renderSlot(t.$slots,"dsg-table-footer",{fields:f.value,data:c.value})])],2)],6)]))}}),et={class:"dsg-table"},tt={key:0,class:"dsg-table--pre-header"},at={class:"dsg-table--pre-header-left"},lt=["textContent"],ot={class:"dsg-table--pre-header-right"},nt={key:1,class:"dsg-table--search-header",ref:"dsgTableSearchHeaderEl"},st={class:"dsg-table--search-top"},rt={key:2,class:"dsg-table--footer",ref:"dsgTableFooterEl"},it={class:"dsg-table--footer-left"},dt={class:"dsg-table--footer-center"},ct={class:"dsg-table--footer-right"},ut=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:()=>{}},initialFilters:{default:()=>({})},filterEntity:{default:""},filterEndpoint:{default:""},filterSearchEndpoint:{default:""},tableLayout:{default:"fixed"},data:{default:null},hasHeader:{type:Boolean,default:!0},hasFooter:{type:Boolean,default:!0},css:{default:()=>({tableWrapper:"border-b"})}},emits:["dsg-table:action-edit","dsg-table:action-view","dsg-table:action-delete","dsg-table:action-archive","dsg-table:link-clicked","dsg-table:rows-selected","dsg-table:row-clicked","dsg-table:row-hover","dsg-table:row-dblclick","dsg-table:filter-updated","dsg-table:term-changed","dsg-table:data-loaded"],setup(a,{expose:y,emit:m}){const i=l=>{g.value=l},f=e.ref(!!(a.filterEntity||a.filterEndpoint)),c=()=>{if(f.value){let l={};return C.getQueryStrings().forEach(s=>{if(s.key.startsWith("filter[")){const u=s.key.replace("filter[","").replace("]",""),h=s.value;l[`filter[${u}]`]=h.join(",")}}),l}else return{}},p=e.computed(()=>({...a.css,tableWrapper:"border-b "+(a.css?.tableWrapper||"")})),k=e.useSlots(),T=e.ref(!0),$=e.ref(null),v=e.ref("<p>Showing {from} to {to} of {total}</p>"),b=e.ref(null),o=e.useTemplateRef("dsgTable"),r=e.ref({perPage:20,change:i}),g=e.ref(20),P=e.ref({...c(),...a.initialFilters}),B=m,w=l=>{o.value?.changePage(l)},N=l=>{b.value=l},F=({data:l})=>{$.value=l,B("dsg-table:data-loaded",l)},M=()=>{T.value===!1&&o.value?.reload()},V=l=>{o.value?.setLoading(l)},H=l=>{const s=o.value?.getData?.()??[];o.value?.setData(s.map(u=>u.id===l.id?l:u))},A=l=>{const s=o.value?.getData?.()??[];o.value?.setData([...s,l])},I=l=>{const s=o.value?.getData?.()??[];o.value?.setData(s.filter(u=>u.id!==l.id))},O=l=>{P.value=l},z=l=>{P.value["filter[term]"]=l,B("dsg-table:term-changed",l)},U=(l,s,u)=>{P.value={"filter[term]":P.value["filter[term]"],...l},B("dsg-table:filter-updated",P.value,s,u)};return y({reloadTable:M,updateRowTable:H,addRowTable:A,deleteRowTable:I,termChanged:z,setFilters:O,setLoading:V}),(l,s)=>(e.openBlock(),e.createElementBlock("div",et,[l.hasHeader?(e.openBlock(),e.createElementBlock("div",tt,[e.renderSlot(l.$slots,"dsg-table--pre-header",{},()=>[e.createElementVNode("div",at,[e.renderSlot(l.$slots,"dsg-table--page-title",{data:$.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,lt)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ot,[e.renderSlot(l.$slots,"dsg-table--page-actions",{data:$.value})])])])):e.createCommentVNode("",!0),l.displayPaginationInfo?(e.openBlock(),e.createElementBlock("div",nt,[e.createElementVNode("div",st,[e.renderSlot(l.$slots,"dsg-table--search-header",{data:$.value},()=>[e.createVNode(Z,{name:"term","onDsgTable:termChanged":s[0]||(s[0]=u=>z(u))}),e.createVNode(C._sfc_main$7,{entity:l.filterEntity,"filter-endpoint":l.filterEndpoint,"search-endpoint":l.filterSearchEndpoint,filters:l.filters,"onDsgTable:filterUpdated":s[1]||(s[1]=(u,h,E)=>U(u,h,E))},null,8,["entity","filter-endpoint","search-endpoint","filters"]),e.renderSlot(l.$slots,"dsg-table--search-actions",{data:$.value})])]),e.renderSlot(l.$slots,"dsg-table--search-navigation")],512)):e.createCommentVNode("",!0),e.createVNode(_e,{ref:"dsgTable","api-url":l.getUrl,"filter-params":P.value,"onUpdate:filterParams":s[7]||(s[7]=u=>P.value=u),"per-page":g.value,"onUpdate:perPage":s[8]||(s[8]=u=>g.value=u),fields:l.fields,"load-on-start":l.loadOnStart,"pagination-path":"meta",selectable:l.selectable,"track-by":l.trackBy,"table-layout":l.tableLayout,css:p.value,data:l.data,"onDsgTable:loading":s[9]||(s[9]=u=>T.value=!0),"onDsgTable:loaded":s[10]||(s[10]=u=>T.value=!1),"onDsgTable:paginationData":N,"onDsgTable:loadSuccess":F,"onDsgTable:rowsSelected":s[11]||(s[11]=u=>B("dsg-table:rows-selected",u)),"onDsgTable:rowClicked":s[12]||(s[12]=(u,h,E)=>B("dsg-table:row-clicked",u,h,E)),"onDsgTable:rowHover":s[13]||(s[13]=(u,h,E)=>B("dsg-table:row-hover",u,h,E)),"onDsgTable:rowDblclick":s[14]||(s[14]=(u,h,E)=>B("dsg-table:row-dblclick",u,h,E))},e.createSlots({"dsg-field--actions":e.withCtx(u=>[e.renderSlot(l.$slots,"dsg-table-actions",{data:u},()=>[(e.openBlock(),e.createBlock(X,{key:u.rowIndex,data:u,"onDsgTable:actionEdit":s[2]||(s[2]=(h,E)=>B("dsg-table:action-edit",h,E)),"onDsgTable:actionView":s[3]||(s[3]=(h,E)=>B("dsg-table:action-view",h,E)),"onDsgTable:actionDelete":s[4]||(s[4]=(h,E)=>B("dsg-table:action-delete",h,E)),"onDsgTable:actionArchive":s[5]||(s[5]=(h,E)=>B("dsg-table:action-archive",h,E)),"onDsgTable:linkClicked":s[6]||(s[6]=(h,E,R)=>B("dsg-table:link-clicked",h,E,R))},null,8,["data"]))])]),_:2},[e.renderList(e.unref(k),(u,h)=>({name:h,fn:e.withCtx(E=>[String(h)!=="dsg-field--actions"?e.renderSlot(l.$slots,h,e.normalizeProps(e.mergeProps({key:0},E))):e.createCommentVNode("",!0)])}))]),1032,["api-url","filter-params","per-page","fields","load-on-start","selectable","track-by","table-layout","css","data"]),l.hasFooter?(e.openBlock(),e.createElementBlock("div",rt,[e.createElementVNode("div",it,[e.renderSlot(l.$slots,"dsg-table--footer-left",{data:b.value,perPage:r.value},()=>[e.createVNode(J,{ref:"paginationInfoStart",pagination:b.value,"onUpdate:pagination":s[15]||(s[15]=u=>b.value=u),"info-template":v.value},null,8,["pagination","info-template"]),e.renderSlot(l.$slots,"dsg-table--footer-left-extras",{data:b.value,perPage:r.value})])]),e.createElementVNode("div",dt,[e.renderSlot(l.$slots,"dsg-table--footer-center",{data:b.value,perPage:r.value},()=>[e.renderSlot(l.$slots,"dsg-table--footer-center-extras",{data:b.value,perPage:r.value})])]),e.createElementVNode("div",ct,[e.renderSlot(l.$slots,"dsg-table--footer-right",{data:b.value,perPage:r.value},()=>[T.value===!1?(e.openBlock(),e.createBlock(G,{key:0,ref:"pagination",pagination:b.value,"onUpdate:pagination":s[16]||(s[16]=u=>b.value=u),"onDsgTable:changePage":w},null,8,["pagination"])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"dsg-table--footer-right-extras",{data:b.value,perPage:r.value})])])],512)):e.createCommentVNode("",!0)]))}}),gt={class:"dsg-table--per-page"},mt=["value","textContent"],bt=e.defineComponent({__name:"DsgTablePerPage",props:{perPageOptions:{default:()=>[10,20,30,50,100]},perPage:{}},setup(a){return(y,m)=>(e.openBlock(),e.createElementBlock("div",gt,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":m[0]||(m[0]=i=>y.perPage.perPage=i),class:"dsg-table--per-page-select",onChange:m[1]||(m[1]=i=>y.perPage.change(y.perPage.perPage))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.perPageOptions,i=>(e.openBlock(),e.createElementBlock("option",{key:i,value:i,textContent:e.toDisplayString(i)},null,8,mt))),128))],544),[[e.vModelSelect,y.perPage.perPage]])]))}}),_=ut,ee=X,te=bt,ae=C._sfc_main$7,le=G,oe=J,ne=Z,se=x,ft={DsgTable:_,DsgTableActions:ee,DsgTablePerPage:te,DsgTableFilter:ae,DsgTablePagination:le,DsgTablePaginationInfo:oe,DsgTableSearch:ne,DsgTableRowHeader:se};exports.DsgTable=_;exports.DsgTableActions=ee;exports.DsgTableFilter=ae;exports.DsgTablePagination=le;exports.DsgTablePaginationInfo=oe;exports.DsgTablePerPage=te;exports.DsgTableRowHeader=se;exports.DsgTableSearch=ne;exports.default=ft;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as W, mergeModels as G, useModel as Y, computed as V, withDirectives as
|
|
1
|
+
import { defineComponent as W, mergeModels as G, useModel as Y, computed as V, withDirectives as de, createElementBlock as o, openBlock as l, createCommentVNode as P, createElementVNode as k, normalizeClass as E, createVNode as R, Fragment as H, renderList as q, vShow as Le, ref as w, useTemplateRef as be, useAttrs as Be, unref as U, withCtx as Z, renderSlot as L, toDisplayString as x, createBlock as N, resolveDynamicComponent as Me, normalizeStyle as J, watch as te, onMounted as Ee, Transition as Re, createTextVNode as He, useSlots as Ae, createSlots as Ie, normalizeProps as ze, mergeProps as Ve, vModelSelect as Oe } from "vue";
|
|
2
2
|
import { _ as O, k as Ue, v as qe, f as Ne, u as We, c as fe, e as ve, i as pe, j as je } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-Dj3jH6bn.js";
|
|
3
3
|
import { ucfirst as Ke, ucwords as Qe, toSnakeCase as Ye } from "./dsg-vue.helpers-string.esm.js";
|
|
4
|
-
import { data_get as
|
|
4
|
+
import { data_get as re } from "./dsg-vue.helpers-object.esm.js";
|
|
5
5
|
const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disabled"], Ze = ["onClick", "innerHTML"], xe = ["onClick", "innerHTML"], _e = ["disabled"], et = ["disabled"], he = /* @__PURE__ */ W({
|
|
6
6
|
__name: "DsgTablePagination",
|
|
7
7
|
props: /* @__PURE__ */ G({
|
|
@@ -23,10 +23,10 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
23
23
|
}, r = (v) => v === d.value?.current_page;
|
|
24
24
|
return $({
|
|
25
25
|
loadPage: s
|
|
26
|
-
}), (v,
|
|
26
|
+
}), (v, S) => de((l(), o("div", Ge, [
|
|
27
27
|
v.showFirstLast ? (l(), o("a", {
|
|
28
28
|
key: 0,
|
|
29
|
-
onClick:
|
|
29
|
+
onClick: S[0] || (S[0] = (C) => s(v.firstPage)),
|
|
30
30
|
class: E([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
31
31
|
disabled: m.value,
|
|
32
32
|
title: "First",
|
|
@@ -38,7 +38,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
38
38
|
}, null, 8, ["icon"])
|
|
39
39
|
], 10, Je)) : P("", !0),
|
|
40
40
|
k("a", {
|
|
41
|
-
onClick:
|
|
41
|
+
onClick: S[1] || (S[1] = (C) => s("prev")),
|
|
42
42
|
class: E([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
43
43
|
disabled: m.value,
|
|
44
44
|
title: "Previous",
|
|
@@ -61,7 +61,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
61
61
|
innerHTML: h.value + C - 1
|
|
62
62
|
}, null, 10, xe))), 128)),
|
|
63
63
|
k("a", {
|
|
64
|
-
onClick:
|
|
64
|
+
onClick: S[2] || (S[2] = (C) => s("next")),
|
|
65
65
|
class: E([[y.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
66
66
|
disabled: y.value,
|
|
67
67
|
title: "Next",
|
|
@@ -74,7 +74,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
74
74
|
], 10, _e),
|
|
75
75
|
v.showFirstLast ? (l(), o("a", {
|
|
76
76
|
key: 3,
|
|
77
|
-
onClick:
|
|
77
|
+
onClick: S[3] || (S[3] = (C) => s(c.value)),
|
|
78
78
|
class: E([[y.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
79
79
|
disabled: y.value,
|
|
80
80
|
title: "Last",
|
|
@@ -86,7 +86,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
86
86
|
}, null, 8, ["icon"])
|
|
87
87
|
], 10, et)) : P("", !0)
|
|
88
88
|
], 512)), [
|
|
89
|
-
[
|
|
89
|
+
[Le, d.value && c.value > v.firstPage]
|
|
90
90
|
]);
|
|
91
91
|
}
|
|
92
92
|
}), tt = ["innerHTML"], me = /* @__PURE__ */ W({
|
|
@@ -121,7 +121,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
121
121
|
setup(t, { emit: $ }) {
|
|
122
122
|
const b = w(!1);
|
|
123
123
|
be("dsgTableActions");
|
|
124
|
-
const d =
|
|
124
|
+
const d = Be(), p = w(d.data.rowData?.actions ?? null), c = w(d.data.rowData?.links ?? null), m = w(d.data.rowData ?? null), y = (f) => {
|
|
125
125
|
switch (f) {
|
|
126
126
|
case "edit":
|
|
127
127
|
return "edit-05";
|
|
@@ -153,7 +153,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
153
153
|
const r = f.actionId || f.label.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
|
|
154
154
|
h("dsg-table:link-clicked", s, r, m.value);
|
|
155
155
|
}, h = $;
|
|
156
|
-
return (f, s) =>
|
|
156
|
+
return (f, s) => de((l(), o("div", at, [
|
|
157
157
|
R(U(Ue), {
|
|
158
158
|
triggers: [],
|
|
159
159
|
placement: f.placement,
|
|
@@ -171,7 +171,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
171
171
|
key: v,
|
|
172
172
|
href: p.value?.link,
|
|
173
173
|
target: p.value?.target || "_self",
|
|
174
|
-
onClick: (
|
|
174
|
+
onClick: (S) => z(r, String(v), S)
|
|
175
175
|
}, [
|
|
176
176
|
k("div", {
|
|
177
177
|
class: E(["dsg-table--actions-menu-item", String(v)])
|
|
@@ -191,7 +191,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
191
191
|
c.value ? (l(!0), o(H, { key: 1 }, q(c.value, (r) => (l(), o(H, {
|
|
192
192
|
key: r.label
|
|
193
193
|
}, [
|
|
194
|
-
r.hasOwnProperty("component") ? (l(), N(
|
|
194
|
+
r.hasOwnProperty("component") ? (l(), N(Me(r.component), {
|
|
195
195
|
key: 0,
|
|
196
196
|
quote: U(d).data.data.rowData,
|
|
197
197
|
"row-data": U(d).data.data.rowData
|
|
@@ -221,7 +221,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
221
221
|
"aria-haspopup": "true",
|
|
222
222
|
onClick: s[0] || (s[0] = (r) => b.value = !b.value)
|
|
223
223
|
}, [
|
|
224
|
-
|
|
224
|
+
L(f.$slots, "dsg-table-action-button-content", {}, () => [
|
|
225
225
|
R(O, {
|
|
226
226
|
icon: "dots-vertical",
|
|
227
227
|
size: "sm"
|
|
@@ -386,7 +386,7 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
386
386
|
}, Pt = ["colspan"], Dt = ["colspan"], $t = ["onClick", "onDblclick", "onMouseover"], Ct = {
|
|
387
387
|
key: 0,
|
|
388
388
|
class: "dsg-table--tbody-cell dsg-table--tbody-cell-checkbox"
|
|
389
|
-
}, Tt = ["onClick", "onDblclick", "onContextmenu"], St = ["innerHTML"], Ft = ["onClick"],
|
|
389
|
+
}, Tt = ["onClick", "onDblclick", "onContextmenu"], St = ["innerHTML"], Ft = ["onClick"], Lt = ["colspan"], Bt = { key: 2 }, Mt = ["colspan"], Et = { class: "dsg-table--footer" }, Rt = /* @__PURE__ */ W({
|
|
390
390
|
__name: "DsgTableComponent",
|
|
391
391
|
props: /* @__PURE__ */ G({
|
|
392
392
|
fields: { default: () => [] },
|
|
@@ -458,32 +458,32 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
458
458
|
sortable: n.sortField,
|
|
459
459
|
formatter: n.formatter || null,
|
|
460
460
|
$_index: u
|
|
461
|
-
})), p = w(d(t.fields)), c = w(t.data), m = w(null), y = w(t.initialPage), z = w("17px"), A = w(!1), h = w({}), f = w(0), s = w(!0), r = w(null), v = w(null),
|
|
462
|
-
|
|
461
|
+
})), p = w(d(t.fields)), c = w(t.data), m = w(null), y = w(t.initialPage), z = w("17px"), A = w(!1), h = w({}), f = w(0), s = w(!0), r = w(null), v = w(null), S = Y(t, "filterParams"), C = Y(t, "perPage"), T = w([]), j = w(!1), K = V(() => t.tableHeight != null), Q = V(() => p.value.filter((e) => e.visible).length);
|
|
462
|
+
te(
|
|
463
463
|
() => T.value.length,
|
|
464
464
|
(e) => {
|
|
465
465
|
j.value = t.selectable && e > 0;
|
|
466
466
|
},
|
|
467
467
|
{ immediate: !0 }
|
|
468
|
-
),
|
|
468
|
+
), te(
|
|
469
469
|
() => t.fields,
|
|
470
470
|
(e) => {
|
|
471
471
|
p.value = d(e);
|
|
472
472
|
},
|
|
473
473
|
{ immediate: !0 }
|
|
474
|
-
),
|
|
475
|
-
() =>
|
|
474
|
+
), te(
|
|
475
|
+
() => S.value,
|
|
476
476
|
() => {
|
|
477
477
|
X();
|
|
478
478
|
},
|
|
479
479
|
{ deep: !0 }
|
|
480
|
-
),
|
|
480
|
+
), te(
|
|
481
481
|
() => C.value,
|
|
482
482
|
() => {
|
|
483
483
|
X();
|
|
484
484
|
}
|
|
485
485
|
);
|
|
486
|
-
const I = b,
|
|
486
|
+
const I = b, ae = (e, n) => e.formatter && typeof e.formatter == "function" ? e.formatter(e, n) : re(n, String(e?.name), ""), le = (e) => "dsg-field--" + e.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), se = (e) => {
|
|
487
487
|
if (t.selectable) {
|
|
488
488
|
if (e.selected)
|
|
489
489
|
T.value.push(e);
|
|
@@ -493,75 +493,78 @@ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disable
|
|
|
493
493
|
}
|
|
494
494
|
I("dsg-table:rows-selected", T.value);
|
|
495
495
|
}
|
|
496
|
-
},
|
|
496
|
+
}, ne = () => {
|
|
497
497
|
t.selectable && (c.value?.forEach((e) => {
|
|
498
498
|
e.selected = !0;
|
|
499
499
|
}), T.value = c.value?.filter((e) => e.selected) ?? [], I("dsg-table:rows-selected", T.value));
|
|
500
|
-
},
|
|
500
|
+
}, _ = () => {
|
|
501
501
|
t.selectable && (c.value?.forEach((e) => {
|
|
502
502
|
e.selected = !1;
|
|
503
503
|
}), T.value = [], I("dsg-table:rows-selected", T.value));
|
|
504
|
-
},
|
|
504
|
+
}, oe = (e) => {
|
|
505
505
|
c.value = Array.isArray(e) ? e : [], t.selectable && c.value.forEach((n) => {
|
|
506
506
|
n.selected = n.selected ?? !1;
|
|
507
507
|
});
|
|
508
|
-
},
|
|
508
|
+
}, a = () => c.value ?? [], i = (e) => {
|
|
509
509
|
e === "prev" ? y.value > t.firstPage && y.value-- : e === "next" ? y.value < (m.value?.last_page ?? 0) && y.value++ : e != y.value && e >= t.firstPage && e <= (m.value?.last_page ?? 0) && (y.value = e), X();
|
|
510
|
-
},
|
|
510
|
+
}, g = () => ({
|
|
511
511
|
[t.queryParams?.sort]: r.value ? (r.value?.direction === "desc" ? "-" : "") + r.value?.field : void 0,
|
|
512
512
|
[t.queryParams?.order]: r.value?.direction,
|
|
513
513
|
[t.queryParams?.page]: y.value,
|
|
514
514
|
[t.queryParams?.perPage]: C.value
|
|
515
|
-
}),
|
|
515
|
+
}), D = () => {
|
|
516
516
|
v.value && (v.value.abort(), v.value = null);
|
|
517
|
-
},
|
|
518
|
-
|
|
517
|
+
}, F = async (e, n) => {
|
|
518
|
+
D();
|
|
519
519
|
const u = new AbortController();
|
|
520
520
|
if (n.signal = u.signal, v.value = u, t.httpMethod.toLowerCase() === "get")
|
|
521
521
|
return await ve.get(e, n);
|
|
522
522
|
{
|
|
523
|
-
const
|
|
524
|
-
return delete n.params, await ve.post(e,
|
|
523
|
+
const M = n.params;
|
|
524
|
+
return delete n.params, await ve.post(e, M, n);
|
|
525
525
|
}
|
|
526
|
-
},
|
|
526
|
+
}, ee = (e) => {
|
|
527
527
|
I("dsg-table:load-success", e);
|
|
528
528
|
const n = t.transform ? t.transform(e.data) : e.data;
|
|
529
|
-
c.value =
|
|
529
|
+
c.value = re(n, t.dataPath, null), t.selectable && c.value?.forEach((u) => {
|
|
530
530
|
u.selected = u.selected ?? !1;
|
|
531
|
-
}), m.value =
|
|
531
|
+
}), m.value = re(n, t.paginationPath, null) ?? null, f.value = c.value?.length ? c.value[0].order : f, m.value === null && console.warn(
|
|
532
532
|
'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.
|
|
533
533
|
You can explicitly suppress this warning by setting pagination-path="".`
|
|
534
534
|
), I("dsg-table:pagination-data", m.value), y.value > (m.value?.to || 0) && (y.value = t.initialPage), I("dsg-table:loaded"), s.value = !1;
|
|
535
535
|
}, ue = (e) => {
|
|
536
536
|
console.error("load-error", e), I("dsg-table:load-error", e), I("dsg-table:loaded"), s.value = !1;
|
|
537
|
-
}, X = (e =
|
|
538
|
-
const
|
|
537
|
+
}, X = (e = ee, n = ue, u = {}) => {
|
|
538
|
+
const M = e || ee, B = n || ue;
|
|
539
539
|
if (t.apiMode)
|
|
540
540
|
return s.value = !0, I("dsg-table:loading", s.value), t.httpOptions.params = {
|
|
541
|
-
...
|
|
542
|
-
...
|
|
543
|
-
},
|
|
541
|
+
...g(),
|
|
542
|
+
...S.value
|
|
543
|
+
}, F(t.apiUrl, t.httpOptions).then(M).catch((ie) => B(ie));
|
|
544
544
|
}, Pe = (e, n, u) => {
|
|
545
545
|
I("dsg-table:row-clicked", e, n, u);
|
|
546
546
|
}, De = (e, n, u) => {
|
|
547
547
|
I("dsg-table:row-dblclick", e, n, u);
|
|
548
548
|
}, $e = (e, n, u) => {
|
|
549
|
-
}, Ce = (e, n, u,
|
|
550
|
-
}, Te = (e, n, u,
|
|
551
|
-
}, Se = (e, n, u,
|
|
549
|
+
}, Ce = (e, n, u, M) => {
|
|
550
|
+
}, Te = (e, n, u, M) => {
|
|
551
|
+
}, Se = (e, n, u, M) => {
|
|
552
552
|
}, Fe = (e, n, u) => {
|
|
553
553
|
};
|
|
554
554
|
Ee(() => {
|
|
555
555
|
t.apiMode === !0 && X();
|
|
556
556
|
});
|
|
557
557
|
const ce = () => {
|
|
558
|
-
t.apiMode && (T.value = [],
|
|
558
|
+
t.apiMode && (T.value = [], D(), X());
|
|
559
559
|
};
|
|
560
560
|
return $({
|
|
561
|
-
changePage:
|
|
561
|
+
changePage: i,
|
|
562
562
|
reload: ce,
|
|
563
|
-
getData:
|
|
564
|
-
setData:
|
|
563
|
+
getData: a,
|
|
564
|
+
setData: oe,
|
|
565
|
+
setLoading: (e) => {
|
|
566
|
+
s.value = e, I("dsg-table:loading", s.value);
|
|
567
|
+
}
|
|
565
568
|
}), (e, n) => (l(), o("div", yt, [
|
|
566
569
|
k("div", {
|
|
567
570
|
ref: "dsgTableBodyWrapper",
|
|
@@ -572,9 +575,9 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
572
575
|
class: E(["dsg-table-main", K.value ? "fixed-header" : "", h.value.table, "table-" + e.tableLayout])
|
|
573
576
|
}, [
|
|
574
577
|
k("colgroup", { span: Q.value }, [
|
|
575
|
-
(l(!0), o(H, null, q(p.value, (u,
|
|
578
|
+
(l(!0), o(H, null, q(p.value, (u, M) => (l(), o(H, null, [
|
|
576
579
|
u?.visible ? (l(), o("col", {
|
|
577
|
-
key:
|
|
580
|
+
key: M,
|
|
578
581
|
style: J({ width: u.width || void 0 }),
|
|
579
582
|
class: E("dsg-table--col-" + u.name + " " + u.titleClass)
|
|
580
583
|
}, null, 6)) : P("", !0)
|
|
@@ -588,7 +591,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
588
591
|
k("thead", {
|
|
589
592
|
class: E([[h.value.thead, { sticky: K.value, "top-0": K.value }], "dsg-table--head"])
|
|
590
593
|
}, [
|
|
591
|
-
|
|
594
|
+
L(e.$slots, "tableHeader", { fields: p.value }, () => [
|
|
592
595
|
R(we, {
|
|
593
596
|
fields: p.value,
|
|
594
597
|
"has-select-all": e.selectable,
|
|
@@ -602,8 +605,8 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
602
605
|
"sort-field": r.value,
|
|
603
606
|
"onUpdate:sortField": n[2] || (n[2] = (u) => r.value = u),
|
|
604
607
|
"onDsgTable:sortField": n[3] || (n[3] = (u) => ce()),
|
|
605
|
-
"onDsgTable:onSelectAll":
|
|
606
|
-
"onDsgTable:onDeselectAll":
|
|
608
|
+
"onDsgTable:onSelectAll": ne,
|
|
609
|
+
"onDsgTable:onDeselectAll": _
|
|
607
610
|
}, null, 8, ["fields", "has-select-all", "selected-rows", "has-selected", "scroll-visible", "show-expand-detail", "table-data-length", "sort-field"])
|
|
608
611
|
])
|
|
609
612
|
], 2),
|
|
@@ -618,7 +621,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
618
621
|
class: "flex items-center space-x-3 h-12 w-full justify-center",
|
|
619
622
|
colspan: Q.value
|
|
620
623
|
}, [
|
|
621
|
-
|
|
624
|
+
L(e.$slots, "dsg-table-loading", {}, () => [
|
|
622
625
|
R(O, {
|
|
623
626
|
icon: "loading-02",
|
|
624
627
|
class: "animate-spin"
|
|
@@ -627,35 +630,35 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
627
630
|
])
|
|
628
631
|
], 8, Dt)
|
|
629
632
|
], 8, Pt)
|
|
630
|
-
])) : (l(!0), o(H, { key: 1 }, q(c.value, (u,
|
|
633
|
+
])) : (l(!0), o(H, { key: 1 }, q(c.value, (u, M) => (l(), o(H, { key: M }, [
|
|
631
634
|
k("tr", {
|
|
632
|
-
class: E(["dsg-table--tbody-row", { odd:
|
|
633
|
-
onClick: (
|
|
634
|
-
onDblclick: (
|
|
635
|
-
onMouseover: (
|
|
635
|
+
class: E(["dsg-table--tbody-row", { odd: M % 2 === 0, even: M % 2 !== 0, "row-selected": u.selected }]),
|
|
636
|
+
onClick: (B) => Pe(B, M, u),
|
|
637
|
+
onDblclick: (B) => De(B, M, u),
|
|
638
|
+
onMouseover: (B) => $e()
|
|
636
639
|
}, [
|
|
637
640
|
e.selectable ? (l(), o("td", Ct, [
|
|
638
641
|
R(fe, {
|
|
639
642
|
modelValue: u.selected,
|
|
640
|
-
"onUpdate:modelValue": [(
|
|
643
|
+
"onUpdate:modelValue": [(B) => u.selected = B, (B) => se(u)]
|
|
641
644
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
642
645
|
])) : P("", !0),
|
|
643
|
-
(l(!0), o(H, null, q(p.value, (
|
|
644
|
-
|
|
646
|
+
(l(!0), o(H, null, q(p.value, (B, ie) => (l(), o(H, { key: ie }, [
|
|
647
|
+
B.visible ? (l(), o("td", {
|
|
645
648
|
key: 0,
|
|
646
|
-
class: E(["dsg-table--tbody-cell",
|
|
647
|
-
style: J({ width:
|
|
649
|
+
class: E(["dsg-table--tbody-cell", B.dataClass]),
|
|
650
|
+
style: J({ width: B.width || void 0 }),
|
|
648
651
|
onClick: (ge) => Ce(),
|
|
649
652
|
onDblclick: (ge) => Te(),
|
|
650
653
|
onContextmenu: (ge) => Se()
|
|
651
654
|
}, [
|
|
652
|
-
|
|
655
|
+
L(e.$slots, le(B), {
|
|
653
656
|
rowData: u,
|
|
654
|
-
rowIndex:
|
|
655
|
-
rowField:
|
|
657
|
+
rowIndex: M,
|
|
658
|
+
rowField: B
|
|
656
659
|
}, () => [
|
|
657
660
|
k("span", {
|
|
658
|
-
innerHTML:
|
|
661
|
+
innerHTML: ae(B, u)
|
|
659
662
|
}, null, 8, St)
|
|
660
663
|
])
|
|
661
664
|
], 46, Tt)) : P("", !0)
|
|
@@ -668,33 +671,33 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
668
671
|
default: Z(() => [
|
|
669
672
|
k("tr", {
|
|
670
673
|
class: "dsg-table--tbody-detail-row",
|
|
671
|
-
onClick: (
|
|
674
|
+
onClick: (B) => Fe()
|
|
672
675
|
}, [
|
|
673
676
|
k("td", { colspan: Q.value }, [
|
|
674
|
-
|
|
677
|
+
L(e.$slots, "dsg-table-detail-row", {
|
|
675
678
|
rowData: u,
|
|
676
|
-
rowIndex:
|
|
679
|
+
rowIndex: M,
|
|
677
680
|
options: e.detailRowOptions
|
|
678
681
|
})
|
|
679
|
-
], 8,
|
|
682
|
+
], 8, Lt)
|
|
680
683
|
], 8, Ft)
|
|
681
684
|
]),
|
|
682
685
|
_: 2
|
|
683
686
|
}, 1032, ["name"])) : P("", !0)
|
|
684
687
|
], 64))), 128)),
|
|
685
|
-
!s.value && !c.value?.length && e.noDataTemplate.length ? (l(), o("tr",
|
|
688
|
+
!s.value && !c.value?.length && e.noDataTemplate.length ? (l(), o("tr", Bt, [
|
|
686
689
|
k("td", {
|
|
687
690
|
colspan: Q.value,
|
|
688
691
|
class: "dsg-table--empty-result"
|
|
689
692
|
}, [
|
|
690
|
-
|
|
693
|
+
L(e.$slots, "dsg-table-empty-result", {}, () => [
|
|
691
694
|
He(x(e.noDataTemplate), 1)
|
|
692
695
|
])
|
|
693
|
-
], 8,
|
|
696
|
+
], 8, Mt)
|
|
694
697
|
])) : P("", !0)
|
|
695
698
|
], 2),
|
|
696
699
|
k("tfoot", Et, [
|
|
697
|
-
|
|
700
|
+
L(e.$slots, "dsg-table-footer", {
|
|
698
701
|
fields: p.value,
|
|
699
702
|
data: c.value
|
|
700
703
|
})
|
|
@@ -755,7 +758,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
755
758
|
}, m = V(() => ({
|
|
756
759
|
...t.css,
|
|
757
760
|
tableWrapper: "border-b " + (t.css?.tableWrapper || "")
|
|
758
|
-
})), y = Ae(), z = w(!0), A = w(null), h = w("<p>Showing {from} to {to} of {total}</p>"), f = w(null), s = be("dsgTable"), r = w({ perPage: 20, change: d }), v = w(20),
|
|
761
|
+
})), y = Ae(), z = w(!0), A = w(null), h = w("<p>Showing {from} to {to} of {total}</p>"), f = w(null), s = be("dsgTable"), r = w({ perPage: 20, change: d }), v = w(20), S = w({ ...c(), ...t.initialFilters }), C = b, T = (a) => {
|
|
759
762
|
s.value?.changePage(a);
|
|
760
763
|
}, j = (a) => {
|
|
761
764
|
f.value = a;
|
|
@@ -764,33 +767,36 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
764
767
|
}, Q = () => {
|
|
765
768
|
z.value === !1 && s.value?.reload();
|
|
766
769
|
}, I = (a) => {
|
|
770
|
+
s.value?.setLoading(a);
|
|
771
|
+
}, ae = (a) => {
|
|
767
772
|
const i = s.value?.getData?.() ?? [];
|
|
768
773
|
s.value?.setData(i.map((g) => g.id === a.id ? a : g));
|
|
769
|
-
},
|
|
774
|
+
}, le = (a) => {
|
|
770
775
|
const i = s.value?.getData?.() ?? [];
|
|
771
776
|
s.value?.setData([...i, a]);
|
|
772
|
-
},
|
|
777
|
+
}, se = (a) => {
|
|
773
778
|
const i = s.value?.getData?.() ?? [];
|
|
774
779
|
s.value?.setData(i.filter((g) => g.id !== a.id));
|
|
775
|
-
},
|
|
776
|
-
|
|
780
|
+
}, ne = (a) => {
|
|
781
|
+
S.value = a;
|
|
777
782
|
}, _ = (a) => {
|
|
778
|
-
|
|
779
|
-
},
|
|
780
|
-
|
|
783
|
+
S.value["filter[term]"] = a, C("dsg-table:term-changed", a);
|
|
784
|
+
}, oe = (a, i, g) => {
|
|
785
|
+
S.value = { "filter[term]": S.value["filter[term]"], ...a }, C("dsg-table:filter-updated", S.value, i, g);
|
|
781
786
|
};
|
|
782
787
|
return $({
|
|
783
788
|
reloadTable: Q,
|
|
784
|
-
updateRowTable:
|
|
785
|
-
addRowTable:
|
|
786
|
-
deleteRowTable:
|
|
789
|
+
updateRowTable: ae,
|
|
790
|
+
addRowTable: le,
|
|
791
|
+
deleteRowTable: se,
|
|
787
792
|
termChanged: _,
|
|
788
|
-
setFilters:
|
|
793
|
+
setFilters: ne,
|
|
794
|
+
setLoading: I
|
|
789
795
|
}), (a, i) => (l(), o("div", Ht, [
|
|
790
796
|
a.hasHeader ? (l(), o("div", At, [
|
|
791
|
-
|
|
797
|
+
L(a.$slots, "dsg-table--pre-header", {}, () => [
|
|
792
798
|
k("div", It, [
|
|
793
|
-
|
|
799
|
+
L(a.$slots, "dsg-table--page-title", {
|
|
794
800
|
data: A.value,
|
|
795
801
|
title: a.title
|
|
796
802
|
}, () => [
|
|
@@ -802,13 +808,13 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
802
808
|
])
|
|
803
809
|
]),
|
|
804
810
|
k("div", Vt, [
|
|
805
|
-
|
|
811
|
+
L(a.$slots, "dsg-table--page-actions", { data: A.value })
|
|
806
812
|
])
|
|
807
813
|
])
|
|
808
814
|
])) : P("", !0),
|
|
809
815
|
a.displayPaginationInfo ? (l(), o("div", Ot, [
|
|
810
816
|
k("div", Ut, [
|
|
811
|
-
|
|
817
|
+
L(a.$slots, "dsg-table--search-header", { data: A.value }, () => [
|
|
812
818
|
R(ke, {
|
|
813
819
|
name: "term",
|
|
814
820
|
"onDsgTable:termChanged": i[0] || (i[0] = (g) => _(g))
|
|
@@ -818,18 +824,18 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
818
824
|
"filter-endpoint": a.filterEndpoint,
|
|
819
825
|
"search-endpoint": a.filterSearchEndpoint,
|
|
820
826
|
filters: a.filters,
|
|
821
|
-
"onDsgTable:filterUpdated": i[1] || (i[1] = (g, D,
|
|
827
|
+
"onDsgTable:filterUpdated": i[1] || (i[1] = (g, D, F) => oe(g, D, F))
|
|
822
828
|
}, null, 8, ["entity", "filter-endpoint", "search-endpoint", "filters"]),
|
|
823
|
-
|
|
829
|
+
L(a.$slots, "dsg-table--search-actions", { data: A.value })
|
|
824
830
|
])
|
|
825
831
|
]),
|
|
826
|
-
|
|
832
|
+
L(a.$slots, "dsg-table--search-navigation")
|
|
827
833
|
], 512)) : P("", !0),
|
|
828
834
|
R(Rt, {
|
|
829
835
|
ref: "dsgTable",
|
|
830
836
|
"api-url": a.getUrl,
|
|
831
|
-
"filter-params":
|
|
832
|
-
"onUpdate:filterParams": i[7] || (i[7] = (g) =>
|
|
837
|
+
"filter-params": S.value,
|
|
838
|
+
"onUpdate:filterParams": i[7] || (i[7] = (g) => S.value = g),
|
|
833
839
|
"per-page": v.value,
|
|
834
840
|
"onUpdate:perPage": i[8] || (i[8] = (g) => v.value = g),
|
|
835
841
|
fields: a.fields,
|
|
@@ -845,20 +851,20 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
845
851
|
"onDsgTable:paginationData": j,
|
|
846
852
|
"onDsgTable:loadSuccess": K,
|
|
847
853
|
"onDsgTable:rowsSelected": i[11] || (i[11] = (g) => C("dsg-table:rows-selected", g)),
|
|
848
|
-
"onDsgTable:rowClicked": i[12] || (i[12] = (g, D,
|
|
849
|
-
"onDsgTable:rowHover": i[13] || (i[13] = (g, D,
|
|
850
|
-
"onDsgTable:rowDblclick": i[14] || (i[14] = (g, D,
|
|
854
|
+
"onDsgTable:rowClicked": i[12] || (i[12] = (g, D, F) => C("dsg-table:row-clicked", g, D, F)),
|
|
855
|
+
"onDsgTable:rowHover": i[13] || (i[13] = (g, D, F) => C("dsg-table:row-hover", g, D, F)),
|
|
856
|
+
"onDsgTable:rowDblclick": i[14] || (i[14] = (g, D, F) => C("dsg-table:row-dblclick", g, D, F))
|
|
851
857
|
}, Ie({
|
|
852
858
|
"dsg-field--actions": Z((g) => [
|
|
853
|
-
|
|
859
|
+
L(a.$slots, "dsg-table-actions", { data: g }, () => [
|
|
854
860
|
(l(), N(ye, {
|
|
855
861
|
key: g.rowIndex,
|
|
856
862
|
data: g,
|
|
857
|
-
"onDsgTable:actionEdit": i[2] || (i[2] = (D,
|
|
858
|
-
"onDsgTable:actionView": i[3] || (i[3] = (D,
|
|
859
|
-
"onDsgTable:actionDelete": i[4] || (i[4] = (D,
|
|
860
|
-
"onDsgTable:actionArchive": i[5] || (i[5] = (D,
|
|
861
|
-
"onDsgTable:linkClicked": i[6] || (i[6] = (D,
|
|
863
|
+
"onDsgTable:actionEdit": i[2] || (i[2] = (D, F) => C("dsg-table:action-edit", D, F)),
|
|
864
|
+
"onDsgTable:actionView": i[3] || (i[3] = (D, F) => C("dsg-table:action-view", D, F)),
|
|
865
|
+
"onDsgTable:actionDelete": i[4] || (i[4] = (D, F) => C("dsg-table:action-delete", D, F)),
|
|
866
|
+
"onDsgTable:actionArchive": i[5] || (i[5] = (D, F) => C("dsg-table:action-archive", D, F)),
|
|
867
|
+
"onDsgTable:linkClicked": i[6] || (i[6] = (D, F, ee) => C("dsg-table:link-clicked", D, F, ee))
|
|
862
868
|
}, null, 8, ["data"]))
|
|
863
869
|
])
|
|
864
870
|
]),
|
|
@@ -866,14 +872,14 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
866
872
|
}, [
|
|
867
873
|
q(U(y), (g, D) => ({
|
|
868
874
|
name: D,
|
|
869
|
-
fn: Z((
|
|
870
|
-
String(D) !== "dsg-field--actions" ?
|
|
875
|
+
fn: Z((F) => [
|
|
876
|
+
String(D) !== "dsg-field--actions" ? L(a.$slots, D, ze(Ve({ key: 0 }, F))) : P("", !0)
|
|
871
877
|
])
|
|
872
878
|
}))
|
|
873
879
|
]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "selectable", "track-by", "table-layout", "css", "data"]),
|
|
874
880
|
a.hasFooter ? (l(), o("div", qt, [
|
|
875
881
|
k("div", Nt, [
|
|
876
|
-
|
|
882
|
+
L(a.$slots, "dsg-table--footer-left", {
|
|
877
883
|
data: f.value,
|
|
878
884
|
perPage: r.value
|
|
879
885
|
}, () => [
|
|
@@ -883,25 +889,25 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
883
889
|
"onUpdate:pagination": i[15] || (i[15] = (g) => f.value = g),
|
|
884
890
|
"info-template": h.value
|
|
885
891
|
}, null, 8, ["pagination", "info-template"]),
|
|
886
|
-
|
|
892
|
+
L(a.$slots, "dsg-table--footer-left-extras", {
|
|
887
893
|
data: f.value,
|
|
888
894
|
perPage: r.value
|
|
889
895
|
})
|
|
890
896
|
])
|
|
891
897
|
]),
|
|
892
898
|
k("div", Wt, [
|
|
893
|
-
|
|
899
|
+
L(a.$slots, "dsg-table--footer-center", {
|
|
894
900
|
data: f.value,
|
|
895
901
|
perPage: r.value
|
|
896
902
|
}, () => [
|
|
897
|
-
|
|
903
|
+
L(a.$slots, "dsg-table--footer-center-extras", {
|
|
898
904
|
data: f.value,
|
|
899
905
|
perPage: r.value
|
|
900
906
|
})
|
|
901
907
|
])
|
|
902
908
|
]),
|
|
903
909
|
k("div", jt, [
|
|
904
|
-
|
|
910
|
+
L(a.$slots, "dsg-table--footer-right", {
|
|
905
911
|
data: f.value,
|
|
906
912
|
perPage: r.value
|
|
907
913
|
}, () => [
|
|
@@ -912,7 +918,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
912
918
|
"onUpdate:pagination": i[16] || (i[16] = (g) => f.value = g),
|
|
913
919
|
"onDsgTable:changePage": T
|
|
914
920
|
}, null, 8, ["pagination"])) : P("", !0),
|
|
915
|
-
|
|
921
|
+
L(a.$slots, "dsg-table--footer-right-extras", {
|
|
916
922
|
data: f.value,
|
|
917
923
|
perPage: r.value
|
|
918
924
|
})
|
|
@@ -929,7 +935,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
929
935
|
},
|
|
930
936
|
setup(t) {
|
|
931
937
|
return ($, b) => (l(), o("div", Qt, [
|
|
932
|
-
|
|
938
|
+
de(k("select", {
|
|
933
939
|
"onUpdate:modelValue": b[0] || (b[0] = (d) => $.perPage.perPage = d),
|
|
934
940
|
class: "dsg-table--per-page-select",
|
|
935
941
|
onChange: b[1] || (b[1] = (d) => $.perPage.change($.perPage.perPage))
|
|
@@ -944,7 +950,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
944
950
|
])
|
|
945
951
|
]));
|
|
946
952
|
}
|
|
947
|
-
}), Jt = Kt, Xt = ye, Zt = Gt, xt = pe, _t = he, ea = me, ta = ke, aa = we,
|
|
953
|
+
}), Jt = Kt, Xt = ye, Zt = Gt, xt = pe, _t = he, ea = me, ta = ke, aa = we, ra = {
|
|
948
954
|
DsgTable: Jt,
|
|
949
955
|
DsgTableActions: Xt,
|
|
950
956
|
DsgTablePerPage: Zt,
|
|
@@ -963,5 +969,5 @@ export {
|
|
|
963
969
|
Zt as DsgTablePerPage,
|
|
964
970
|
aa as DsgTableRowHeader,
|
|
965
971
|
ta as DsgTableSearch,
|
|
966
|
-
|
|
972
|
+
ra as default
|
|
967
973
|
};
|
package/dist/table.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare const DsgTable: {
|
|
|
29
29
|
deleteRowTable: (rowData: any) => void;
|
|
30
30
|
termChanged: (term: string | null) => void;
|
|
31
31
|
setFilters: (filters: any) => void;
|
|
32
|
+
setLoading: (loadingState: boolean) => void;
|
|
32
33
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
33
34
|
"dsg-table:action-edit": (ev: Event, rowData: Record<string, any>) => any;
|
|
34
35
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|
|
@@ -139,6 +140,7 @@ export declare const DsgTable: {
|
|
|
139
140
|
reload: () => void;
|
|
140
141
|
getData: () => any[] | null;
|
|
141
142
|
setData: (rows: any[] | null) => void;
|
|
143
|
+
setLoading: (loadingState: boolean) => void;
|
|
142
144
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
143
145
|
"update:filterParams": (value: any) => any;
|
|
144
146
|
"update:perPage": (value: any) => any;
|
|
@@ -187,11 +189,12 @@ export declare const DsgTable: {
|
|
|
187
189
|
"onDsg-table:row-dblclick"?: ((ev: Event, rowIndex: number, rowData: Record<string, any>) => any) | undefined;
|
|
188
190
|
"onUpdate:filterParams"?: ((value: any) => any) | undefined;
|
|
189
191
|
"onUpdate:perPage"?: ((value: any) => any) | undefined;
|
|
190
|
-
}>, "changePage" | "reload" | "getData" | "setData"> & import('vue').ShallowUnwrapRef<{
|
|
192
|
+
}>, "changePage" | "reload" | "getData" | "setData" | "setLoading"> & import('vue').ShallowUnwrapRef<{
|
|
191
193
|
changePage: (page: "next" | "prev" | number) => void;
|
|
192
194
|
reload: () => void;
|
|
193
195
|
getData: () => any[] | null;
|
|
194
196
|
setData: (rows: any[] | null) => void;
|
|
197
|
+
setLoading: (loadingState: boolean) => void;
|
|
195
198
|
}> & {} & import('vue').ComponentCustomProperties & {} & {
|
|
196
199
|
$slots: Partial<Record<string, (_: {
|
|
197
200
|
rowData: any;
|
|
@@ -286,6 +289,7 @@ export declare const DsgTable: {
|
|
|
286
289
|
deleteRowTable: (rowData: any) => void;
|
|
287
290
|
termChanged: (term: string | null) => void;
|
|
288
291
|
setFilters: (filters: any) => void;
|
|
292
|
+
setLoading: (loadingState: boolean) => void;
|
|
289
293
|
}, {}, {}, {}, {}>;
|
|
290
294
|
__isFragment?: never;
|
|
291
295
|
__isTeleport?: never;
|
|
@@ -310,6 +314,7 @@ export declare const DsgTable: {
|
|
|
310
314
|
deleteRowTable: (rowData: any) => void;
|
|
311
315
|
termChanged: (term: string | null) => void;
|
|
312
316
|
setFilters: (filters: any) => void;
|
|
317
|
+
setLoading: (loadingState: boolean) => void;
|
|
313
318
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
314
319
|
"dsg-table:action-edit": (ev: Event, rowData: Record<string, any>) => any;
|
|
315
320
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|
|
@@ -1540,6 +1545,7 @@ declare const _default: {
|
|
|
1540
1545
|
deleteRowTable: (rowData: any) => void;
|
|
1541
1546
|
termChanged: (term: string | null) => void;
|
|
1542
1547
|
setFilters: (filters: any) => void;
|
|
1548
|
+
setLoading: (loadingState: boolean) => void;
|
|
1543
1549
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
1544
1550
|
"dsg-table:action-edit": (ev: Event, rowData: Record<string, any>) => any;
|
|
1545
1551
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|
|
@@ -1650,6 +1656,7 @@ declare const _default: {
|
|
|
1650
1656
|
reload: () => void;
|
|
1651
1657
|
getData: () => any[] | null;
|
|
1652
1658
|
setData: (rows: any[] | null) => void;
|
|
1659
|
+
setLoading: (loadingState: boolean) => void;
|
|
1653
1660
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
1654
1661
|
"update:filterParams": (value: any) => any;
|
|
1655
1662
|
"update:perPage": (value: any) => any;
|
|
@@ -1698,11 +1705,12 @@ declare const _default: {
|
|
|
1698
1705
|
"onDsg-table:row-dblclick"?: ((ev: Event, rowIndex: number, rowData: Record<string, any>) => any) | undefined;
|
|
1699
1706
|
"onUpdate:filterParams"?: ((value: any) => any) | undefined;
|
|
1700
1707
|
"onUpdate:perPage"?: ((value: any) => any) | undefined;
|
|
1701
|
-
}>, "changePage" | "reload" | "getData" | "setData"> & import('vue').ShallowUnwrapRef<{
|
|
1708
|
+
}>, "changePage" | "reload" | "getData" | "setData" | "setLoading"> & import('vue').ShallowUnwrapRef<{
|
|
1702
1709
|
changePage: (page: "next" | "prev" | number) => void;
|
|
1703
1710
|
reload: () => void;
|
|
1704
1711
|
getData: () => any[] | null;
|
|
1705
1712
|
setData: (rows: any[] | null) => void;
|
|
1713
|
+
setLoading: (loadingState: boolean) => void;
|
|
1706
1714
|
}> & {} & import('vue').ComponentCustomProperties & {} & {
|
|
1707
1715
|
$slots: Partial<Record<string, (_: {
|
|
1708
1716
|
rowData: any;
|
|
@@ -1797,6 +1805,7 @@ declare const _default: {
|
|
|
1797
1805
|
deleteRowTable: (rowData: any) => void;
|
|
1798
1806
|
termChanged: (term: string | null) => void;
|
|
1799
1807
|
setFilters: (filters: any) => void;
|
|
1808
|
+
setLoading: (loadingState: boolean) => void;
|
|
1800
1809
|
}, {}, {}, {}, {}>;
|
|
1801
1810
|
__isFragment?: never;
|
|
1802
1811
|
__isTeleport?: never;
|
|
@@ -1821,6 +1830,7 @@ declare const _default: {
|
|
|
1821
1830
|
deleteRowTable: (rowData: any) => void;
|
|
1822
1831
|
termChanged: (term: string | null) => void;
|
|
1823
1832
|
setFilters: (filters: any) => void;
|
|
1833
|
+
setLoading: (loadingState: boolean) => void;
|
|
1824
1834
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
1825
1835
|
"dsg-table:action-edit": (ev: Event, rowData: Record<string, any>) => any;
|
|
1826
1836
|
"dsg-table:action-view": (ev: Event, rowData: Record<string, any>) => any;
|