@kong-ui-public/table-data-grid 0.7.1 → 0.7.2-pr.3884.49ec4889a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("ag-grid-vue3"),require("ag-grid-community"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","ag-grid-vue3","ag-grid-community","@kong-ui-public/i18n"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E["kong-ui-public-table-data-grid"]={},E.Vue,E.AgGridVue,E.agGridCommunity,E["kong-ui-public-i18n"]))})(this,(function(E,e,J,I,G){"use strict";var F=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))(F||{});const X=t=>!!t?.length;function Y(t,a,o,l=X){const r=e.computed(()=>l(t.value)),n=e.computed(()=>{const v=t.value!==void 0,s=a.value!==void 0&&a.value!==null;return o.value?"LOADING":r.value?"SUCCESS":s?"ERROR":v?"SUCCESS":"PENDING"});return{fetchState:F,hasData:r,state:n}}const Z=({emitState:t,fetchLifecycleState:a,hasData:o})=>{e.watch(()=>({hasData:o.value,state:a.value}),({hasData:l,state:r})=>{if(r!==F.PENDING){if(r===F.LOADING){t({hasData:l,state:"loading"});return}if(r===F.ERROR){t({hasData:l,state:"error"});return}t({hasData:l,state:"success"})}})},ee=({startRow:t,endRow:a})=>{const o=a-t;return{blockIndex:o>0?Math.floor(t/o):0,pageSize:o}},te=({startRow:t,rowsLength:a,pageSize:o,total:l,hasMore:r})=>{if(typeof l=="number")return l;if(r!==!0&&(r===!1||a<o))return t+a},oe=({fetcher:t,resetKey:a,sort:o})=>{const l=new Map,r=new Map,n=e.ref(0),u=e.shallowRef(),v=e.shallowRef(),s=e.shallowRef(),m=e.ref(0),h=e.ref(!1);let y,R;const k=g=>g===n.value&&y===t.value&&R===a?.value,N=()=>{h.value=m.value>0},c=()=>{s.value=void 0,m.value+=1,N()},f=()=>{m.value=Math.max(0,m.value-1),N()},S=g=>{const d=r.get(g);if(d)return d;let i;const p={promise:new Promise(C=>{i=C}),resolve:C=>i(C)};return r.set(g,p),p},w=(g,d)=>{d.resolve(!1),r.get(g)===d&&r.delete(g)},x=async({blockIndex:g,currentBlockCompletion:d,datasourceId:i})=>{if(g===0)return"ready";const p=r.get(g-1);if(!p)return w(g,d),"failed";const C=await p.promise;return k(i)?C?"ready":(w(g,d),"failed"):(w(g,d),"stale")},B=({blockIndex:g,currentBlockCompletion:d,getRowsParams:i,pageSize:p,result:C})=>{C.cursor!==void 0&&l.set(g,C.cursor),i.successCallback(C.data,te({startRow:i.startRow,rowsLength:C.data.length,pageSize:p,total:C.total,hasMore:C.hasMore})),i.startRow===0&&(v.value=C.data),d.resolve(!0)},T=({blockIndex:g,currentBlockCompletion:d,fetchError:i,getRowsParams:p})=>{s.value=i,p.failCallback(),w(g,d)},O=()=>{const g=t.value;if(!g)throw new Error("TableDataGrid requires a fetcher in infinite mode");y=g,R=a?.value;const d=n.value+1;return n.value=d,l.clear(),r.clear(),v.value=void 0,s.value=void 0,m.value=0,N(),{async getRows(i){if(!k(d)){i.failCallback();return}const{blockIndex:p,pageSize:C}=ee({startRow:i.startRow,endRow:i.endRow}),D=S(p);if(await x({blockIndex:p,currentBlockCompletion:D,datasourceId:d})!=="ready"||!k(d)){i.failCallback(),w(p,D);return}c();try{const K=p>0?l.get(p-1):void 0,V=await g({mode:"infinite",pageSize:C,cursor:K,sort:o?.value});if(!k(d)){i.failCallback(),w(p,D);return}B({blockIndex:p,currentBlockCompletion:D,getRowsParams:i,pageSize:C,result:V})}catch(K){if(!k(d)){i.failCallback(),w(p,D);return}T({blockIndex:p,currentBlockCompletion:D,fetchError:K,getRowsParams:i})}finally{k(d)&&f()}}}},z=()=>{u.value=O()};return e.watch([t,()=>a?.value],()=>{z()},{immediate:!0}),{datasource:e.readonly(u),data:e.shallowReadonly(v),error:e.readonly(s),isFetching:e.readonly(h)}},ae={emptyState:{title:"No Data",message:"There is no data to display."},errorState:{title:"An error occurred",message:"Data cannot be displayed due to an error."}};function A(){const t=G.createI18n("en-us",ae);return{i18n:t,i18nT:G.i18nTComponent(t)}}const{i18n:le}=A(),$=(t,a)=>{const o=Reflect.get(a,t.key);return t.valueFormatter?t.valueFormatter(o,a):String(o??"")},_=t=>typeof t!="number"?null:Number.isFinite(t)?t:null,ne=(t,a)=>t.reduce((o,l)=>{const r=_(Reflect.get(l,a.key));return r===null?o:{sum:o.sum+r,max:Math.max(o.max,r)}},{sum:0,max:0}),re=(t,a)=>{const o=(a??[]).filter(n=>Number.isFinite(n.value)&&t>=n.value);if(!o.length)return;const l=Math.max(...o.map(n=>n.value));return o.filter(n=>n.value===l).some(n=>n.type==="error")?"error":"warning"},se=(t,a,o)=>{if(t===null)return 0;const l=o==="relative"?a.sum:a.max;return l>0?Math.min(Math.max(t/l,0),1):0},ie=t=>{const a=o=>le.formatNumber(o,{maximumFractionDigits:2});return t>0&&t<.01?`< ${a(.01)} %`:`${a(t)} %`},L=({value:t,stats:a,header:o})=>{if(t===null||a.sum<=0)return;const l=t/a.sum*100;return o.percentageFormatter?.(l)??ie(l)},P=(t,a)=>a!==void 0&&a.length>(t?.length??-1)?a:t,ce=({rows:t,header:a,stats:o})=>t.reduce((l,r)=>({value:P(l.value,$(a,r))??"",relative:a.showPercentage?P(l.relative,L({value:_(Reflect.get(r,a.key)),stats:o,header:a})):void 0}),{value:""}),ue=["data-threshold"],de={class:"table-data-grid-cell-label-track"},me={class:"table-data-grid-cell-label"},fe={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},pe={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},ge=["data-text"],Ce=["data-text"],he=["data-threshold"],ve=e.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(t,{expose:a}){const o=e.shallowRef(t.params),l=e.ref(null),r=e.ref(!1),n=e.computed(()=>o.value.headerDef??{key:"",label:""}),u=e.computed(()=>o.value.context?.presentation),v=e.computed(()=>o.value.context?.cells?.tooltipTarget?.value??"body"),s=e.computed(()=>o.value.valueFormatted??String(o.value.value??"")),m=e.computed(()=>o.value.value),h=e.computed(()=>_(m.value)),y=e.computed(()=>u.value?.stats[n.value.key]),R=e.computed(()=>n.value.showPercentage&&y.value?L({value:h.value,stats:y.value,header:n.value}):void 0),k=e.computed(()=>!!n.value.bar&&!!y.value&&(h.value!==null||m.value===null||m.value===void 0)),N=e.computed(()=>k.value&&y.value?se(h.value,y.value,n.value.bar)*100:0),c=e.computed(()=>k.value?u.value?.labelSizers[n.value.key]:void 0),f=e.computed(()=>n.value.thresholds?.length&&h.value!==null?re(h.value,n.value.thresholds):void 0),S=e.computed(()=>({column:n.value,refreshCell:()=>{const i=o.value.node;i&&o.value.api.refreshCells({force:!0,rowNodes:[i]})},row:o.value.data??{},rowIndex:o.value.node?.rowIndex??0,rowValue:o.value.value,selected:o.value.node?.isSelected()??!1})),w=(i,{slots:p})=>{const C=o.value.colDef?.colId,D=o.value.context?.cells?.slots;return!C||C==="cell-icon"||!D?.[C]?p.default?.():e.h("span",{class:"table-data-grid-cell-slot-content"},e.renderSlot(D,C,S.value,()=>p.default?.()??[]))},x=()=>{const i=o.value.context?.cells?.slots;return i?.["cell-icon"]?e.renderSlot(i,"cell-icon",S.value):null};let B,T,O=!1;const z=()=>{const i=l.value;r.value=!!i&&i.scrollWidth>i.clientWidth},g=()=>{O||(T!==void 0&&cancelAnimationFrame(T),T=requestAnimationFrame(()=>{T=void 0,z()}))},d=i=>{if(B?.disconnect(),i){B?.observe(i);const p=i.closest(".ag-cell");p&&B?.observe(p)}g()};return e.onMounted(()=>{B=new ResizeObserver(g),d(l.value)}),e.watch(l,d),e.onUnmounted(()=>{O=!0,B?.disconnect(),T!==void 0&&cancelAnimationFrame(T)}),a({refresh(i){return o.value=i,e.nextTick(g),!0}}),(i,p)=>{const C=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":k.value,"table-data-grid-cell-renderer--percentage":!!R.value,[`table-data-grid-cell-renderer--text-${f.value}`]:!k.value&&!!f.value}]),"data-threshold":f.value},[e.createElementVNode("span",de,[e.createElementVNode("span",me,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x))),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w),null,{default:e.withCtx(()=>[e.createVNode(C,{class:"table-data-grid-cell-tooltip",disabled:!r.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:v.value,text:s.value},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"contentElement",ref:l,class:"table-data-grid-cell-content"},e.toDisplayString(s.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),R.value?(e.openBlock(),e.createElementBlock("span",fe,"("+e.toDisplayString(R.value)+")",1)):e.createCommentVNode("",!0)]),c.value?(e.openBlock(),e.createElementBlock("span",pe,[e.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":c.value.value},null,8,ge),c.value.relative?(e.openBlock(),e.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${c.value.relative})`},null,8,Ce)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),k.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":f.value},[e.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:e.normalizeStyle({width:`${N.value}%`})},null,4)],8,he)):e.createCommentVNode("",!0)],10,ue)}}}),be=({headers:t,slots:a,initialSort:o,mode:l,rows:r,tooltipTarget:n})=>{const u=l??"infinite",v=new Set,s=c=>!!(c.showPercentage||c.bar||c.thresholds?.length),m=()=>{t.value.forEach(c=>{if(!s(c))return;let f;if(u==="infinite"&&(c.showPercentage||c.bar)?f="percentage and bar presentation is only supported in unpaginated mode":u==="unpaginated"&&r?.value?.some(w=>{const x=Reflect.get(w,c.key);return x!=null&&_(x)===null})&&(f="contains non-finite or nonnumeric values; numeric presentation skips those values"),!f)return;const S=`${c.key}:${f}`;v.has(S)||(v.add(S),console.warn(`[TableDataGrid] Column "${c.key}" ${f}.`))})};e.watch([t,()=>r?.value],m,{immediate:!0});const h=e.computed(()=>{if(u!=="unpaginated")return{};const c=r?.value??[];return Object.fromEntries(t.value.filter(f=>f.showPercentage||f.bar).map(f=>[f.key,ne(c,f)]))}),y=e.computed(()=>{if(u!=="unpaginated")return{};const c=r?.value??[];return Object.fromEntries(t.value.filter(f=>f.bar).map(f=>[f.key,ce({rows:c,header:f,stats:h.value[f.key]})]))}),R=e.computed(()=>({cells:{slots:a,tooltipTarget:n},presentation:{stats:h.value,labelSizers:y.value}})),k=c=>{const f=o?.sortColumnKey===c.key;return{colId:c.key,flex:!c.width&&!c.maxWidth?1:void 0,headerName:c.label,maxWidth:c.maxWidth,minWidth:c.minWidth,sortable:c.sortable??!1,unSortIcon:c.showSortIcon,...f?{initialSort:o?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:S=>S.data?.[c.key],valueFormatter:S=>S.data?$(c,S.data):String(S.value??""),width:c.width,cellRenderer:ve,cellRendererParams:{headerDef:c}}};return{columnDefs:e.computed(()=>t.value.map(k)),gridContext:R}},M=({config:t,headers:a,pageSize:o})=>{const l=new Set(a.filter(n=>n.sortable).map(n=>n.key)),r=t?.sortColumnKey&&l.has(t.sortColumnKey)?t.sortColumnKey:void 0;return{sortColumnKey:r,sortColumnOrder:r?t?.sortColumnOrder:void 0,pageSize:t?.pageSize??o,...t?.fitToContent!==void 0?{fitToContent:t.fitToContent}:{}}},U=(t,a)=>t.sortColumnKey===a.sortColumnKey&&t.sortColumnOrder===a.sortColumnOrder&&t.pageSize===a.pageSize&&t.fitToContent===a.fitToContent,ye=({headers:t,pageSize:a,tableConfig:o,emitTableConfigUpdate:l,onExternalConfigChange:r})=>{const n=e.computed(()=>o.value?M({config:o.value,headers:t.value,pageSize:a.value}):void 0),u=e.ref(n.value??M({config:void 0,headers:t.value,pageSize:a.value}));e.watch(n,h=>{h&&!U(h,u.value)&&(u.value=h,r?.(h))});const v=h=>{const y=M({config:{...u.value,...h},headers:t.value,pageSize:a.value});U(y,u.value)||(u.value=y,l(y))},s=e.computed(()=>({sortColumnKey:u.value.sortColumnKey,sortColumnOrder:u.value.sortColumnOrder})),m=e.computed(()=>o.value?.pageSize??a.value);return{activeTableConfig:e.readonly(u),activeSort:s,activePageSize:m,patchTableConfig:v}},ke=({cellClick:t,headers:a,rowClick:o})=>{const l=e.computed(()=>new Set(a.value.filter(s=>s.disableRowClick).map(s=>s.key))),r=s=>{const m=s.event?.target;return m instanceof Element?m.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},n=s=>{const m=r(s);return!!(m&&l.value.has(m))};return{onCellClick:s=>{const m=s.colDef.colId;!s.data||!m||t({columnKey:m,row:s.data,value:s.value})},onRowClick:s=>{s.data&&!n(s)&&o(s.data,s)}}},Se=({activeSort:t,emitSort:a,patchTableConfig:o})=>{const l=(n,u)=>{n.applyColumnState({state:u.sortColumnKey?[{colId:u.sortColumnKey,sort:u.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:n=>{const u=n.api.getColumnState().filter(m=>m.sort).sort((m,h)=>(m.sortIndex??0)-(h.sortIndex??0)),v=u[u.length-1],s=v?{sortColumnKey:v.colId,sortColumnOrder:v.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};s.sortColumnKey===t.value.sortColumnKey&&s.sortColumnOrder===t.value.sortColumnOrder||(a(s),o(s),u.length>1&&l(n.api,s))},applySortToGrid:l}},we={key:0,class:"table-error-state","data-testid":"table-error-state"},Re={key:1,class:"table-empty-state","data-testid":"table-empty-state"},De=((t,a)=>{const o=t.__vccOpts||t;for(const[l,r]of a)o[l]=r;return o})(e.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(t,{emit:a}){I.ModuleRegistry.registerModules([I.AllCommunityModule,I.ClientSideRowModelModule,I.InfiniteRowModelModule]);const o=t.mode??"infinite",l=a,{i18n:r}=A(),{t:n}=r,u=e.useSlots(),v=e.shallowRef(),s=e.useTemplateRef("rootElement"),m=e.shallowRef("body"),h=()=>{const b=document.fullscreenElement;m.value=b instanceof HTMLElement&&b.contains(s.value??null)?b:"body"};e.onMounted(()=>{h(),document.addEventListener("fullscreenchange",h)}),e.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",h)});const{activeTableConfig:y,activeSort:R,activePageSize:k,patchTableConfig:N}=ye({headers:e.toRef(()=>t.headers),pageSize:e.toRef(()=>t.pageSize),tableConfig:e.toRef(()=>t.tableConfig),emitTableConfigUpdate:b=>l("update:tableConfig",b),onExternalConfigChange:b=>{v.value&&f(v.value,b)}}),{onSortChanged:c,applySortToGrid:f}=Se({activeSort:R,emitSort:b=>l("sort",b),patchTableConfig:N}),S=e.computed(()=>o==="unpaginated"&&!!y.value.fitToContent),w=I.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:x,onRowClick:B}=ke({cellClick:b=>l("cell:click",b),headers:e.toRef(()=>t.headers),rowClick:(b,H)=>l("row:click",b,H)}),T={resizable:!1,sortable:!1,suppressMovable:!0},O=e.computed(()=>y.value.sortColumnKey),z=e.computed(()=>y.value.sortColumnOrder),g=e.computed(()=>[k.value,t.refreshKey,O.value,z.value]),d=o==="infinite"?oe({fetcher:e.toRef(()=>t.fetcher),resetKey:g,sort:R}):void 0,i=d?.datasource,p=e.computed(()=>d?d.data.value:t.rows),C=e.computed(()=>d?.isFetching.value??!1),D=e.computed(()=>t.rows?Array.from(t.rows):void 0),{columnDefs:W,gridContext:K}=be({headers:e.toRef(()=>t.headers),mode:o,rows:D,slots:u,tooltipTarget:m,initialSort:R.value}),{fetchState:V,hasData:q,state:j}=Y(p,e.toRef(()=>d?.error.value),C),Ee=e.computed(()=>j.value===V.SUCCESS&&!q.value);d&&Z({emitState:b=>l("state",b),fetchLifecycleState:j,hasData:q});const Te=b=>{v.value=b.api,l("grid:ready",b.api)};return(b,H)=>{const Q=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",{ref_key:"rootElement",ref:s,class:e.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":S.value}]),"data-testid":"table-data-grid"},[t.error?(e.openBlock(),e.createElementBlock("div",we,[e.renderSlot(b.$slots,"error-state",{},()=>[e.createVNode(Q,{"icon-variant":"error",message:e.unref(n)("errorState.message"),title:e.unref(n)("errorState.title")},null,8,["message","title"])],!0)])):Ee.value?(e.openBlock(),e.createElementBlock("div",Re,[e.renderSlot(b.$slots,"empty-state",{},()=>[e.createVNode(Q,{message:e.unref(n)("emptyState.message"),title:e.unref(n)("emptyState.title")},null,8,["message","title"])],!0)])):(e.openBlock(),e.createBlock(e.unref(J.AgGridVue),{key:2,"cache-block-size":e.unref(o)==="infinite"?e.unref(k):void 0,class:"table-data-grid-grid","column-defs":e.unref(W),context:e.unref(K),datasource:e.unref(o)==="infinite"?e.unref(i):void 0,"default-col-def":T,"dom-layout":S.value?"autoHeight":"normal","infinite-initial-row-count":e.unref(o)==="infinite"?1:void 0,loading:C.value,"row-data":e.unref(o)==="unpaginated"?D.value:void 0,"row-model-type":e.unref(o)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:e.unref(w),onCellClicked:e.unref(x),onGridReady:Te,onRowClicked:e.unref(B),onSortChanged:e.unref(c)},null,8,["cache-block-size","column-defs","context","datasource","dom-layout","infinite-initial-row-count","loading","row-data","row-model-type","theme","onCellClicked","onRowClicked","onSortChanged"]))],2)}}}),[["__scopeId","data-v-85f88484"]]);E.TableDataGrid=De,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("ag-grid-vue3"),require("ag-grid-community"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","ag-grid-vue3","ag-grid-community","@kong-ui-public/i18n"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x["kong-ui-public-table-data-grid"]={},x.Vue,x.AgGridVue,x.agGridCommunity,x["kong-ui-public-i18n"]))})(this,(function(x,e,Y,L,W){"use strict";var $=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))($||{});const Z=t=>!!t?.length;function ee(t,a,o,l=Z){const n=e.computed(()=>l(t.value)),r=e.computed(()=>{const h=t.value!==void 0,s=a.value!==void 0&&a.value!==null;return o.value?"LOADING":n.value?"SUCCESS":s?"ERROR":h?"SUCCESS":"PENDING"});return{fetchState:$,hasData:n,state:r}}const te=({emitState:t,fetchLifecycleState:a,hasData:o})=>{e.watch(()=>({hasData:o.value,state:a.value}),({hasData:l,state:n})=>{if(n!==$.PENDING){if(n===$.LOADING){t({hasData:l,state:"loading"});return}if(n===$.ERROR){t({hasData:l,state:"error"});return}t({hasData:l,state:"success"})}})},oe=({startRow:t,endRow:a})=>{const o=a-t;return{blockIndex:o>0?Math.floor(t/o):0,pageSize:o}},ae=({startRow:t,rowsLength:a,pageSize:o,total:l,hasMore:n})=>{if(typeof l=="number")return l;if(n!==!0&&(n===!1||a<o))return t+a},le=({fetcher:t,resetKey:a,sort:o})=>{const l=new Map,n=new Map,r=e.ref(0),u=e.ref(0),h=e.shallowRef(),s=e.shallowRef(),p=e.shallowRef(),C=e.ref(0),k=e.ref(!1);let w,R,F=o?.value?.sortColumnKey,i=o?.value?.sortColumnOrder;const f=d=>d===r.value&&w===t.value&&R===a?.value,b=(d,m)=>f(d)&&m===u.value&&F===o?.value?.sortColumnKey&&i===o?.value?.sortColumnOrder,z=d=>{if(!o)return!0;const m=o.value;return!m?.sortColumnKey||!m.sortColumnOrder?d.length===0:d.length===1&&d[0].colId===m.sortColumnKey&&d[0].sort===m.sortColumnOrder},E=()=>{k.value=C.value>0},B=()=>{u.value+=1,F=o?.value?.sortColumnKey,i=o?.value?.sortColumnOrder;for(const d of n.values())d.resolve(!1);l.clear(),n.clear(),s.value=void 0,p.value=void 0,C.value=0,E()},O=()=>{p.value=void 0,C.value+=1,E()},_=()=>{C.value=Math.max(0,C.value-1),E()},K=d=>{const m=n.get(d);if(m)return m;let v;const S={promise:new Promise(g=>{v=g}),resolve:g=>v(g)};return n.set(d,S),S},D=(d,m)=>{m.resolve(!1),n.get(d)===m&&n.delete(d)},V=async({blockIndex:d,currentBlockCompletion:m,datasourceId:v,requestGeneration:S})=>{if(d===0)return"ready";const g=n.get(d-1);if(!g)return D(d,m),"failed";const A=await g.promise;return b(v,S)?A?"ready":(D(d,m),"failed"):(D(d,m),"stale")},y=({blockIndex:d,currentBlockCompletion:m,getRowsParams:v,pageSize:S,result:g})=>{g.cursor!==void 0&&l.set(d,g.cursor),v.successCallback(g.data,ae({startRow:v.startRow,rowsLength:g.data.length,pageSize:S,total:g.total,hasMore:g.hasMore})),v.startRow===0&&(s.value=g.data),m.resolve(!0)},T=({blockIndex:d,currentBlockCompletion:m,fetchError:v,getRowsParams:S})=>{p.value=v,S.failCallback(),D(d,m)},N=()=>{const d=t.value;if(!d)throw new Error("TableDataGrid requires a fetcher in infinite mode");w=d,R=a?.value;const m=r.value+1;return r.value=m,B(),{async getRows(v){if(!f(m)||!z(v.sortModel)){v.failCallback();return}const S=u.value,{blockIndex:g,pageSize:A}=oe({startRow:v.startRow,endRow:v.endRow}),c=K(g);if(await V({blockIndex:g,currentBlockCompletion:c,datasourceId:m,requestGeneration:S})!=="ready"||!b(m,S)){v.failCallback(),D(g,c);return}O();try{const I=g>0?l.get(g-1):void 0,U=await d({mode:"infinite",pageSize:A,cursor:I,sort:o?.value});if(!b(m,S)){v.failCallback(),D(g,c);return}y({blockIndex:g,currentBlockCompletion:c,getRowsParams:v,pageSize:A,result:U})}catch(I){if(!b(m,S)){v.failCallback(),D(g,c);return}T({blockIndex:g,currentBlockCompletion:c,fetchError:I,getRowsParams:v})}finally{b(m,S)&&_()}}}},M=()=>{h.value=N()};return e.watch([t,()=>a?.value],()=>{M()},{immediate:!0}),e.watch([()=>o?.value?.sortColumnKey,()=>o?.value?.sortColumnOrder],()=>B()),{datasource:e.readonly(h),data:e.shallowReadonly(s),error:e.readonly(p),isFetching:e.readonly(k)}},ne={emptyState:{title:"No Data",message:"There is no data to display."},errorState:{title:"An error occurred",message:"Data cannot be displayed due to an error."}};function j(){const t=W.createI18n("en-us",ne);return{i18n:t,i18nT:W.i18nTComponent(t)}}const{i18n:re}=j(),H=(t,a)=>{const o=Reflect.get(a,t.key);return t.valueFormatter?t.valueFormatter(o,a):String(o??"")},q=t=>typeof t!="number"?null:Number.isFinite(t)?t:null,se=(t,a)=>t.reduce((o,l)=>{const n=q(Reflect.get(l,a.key));return n===null?o:{sum:o.sum+n,max:Math.max(o.max,n)}},{sum:0,max:0}),ie=(t,a)=>{const o=(a??[]).filter(r=>Number.isFinite(r.value)&&t>=r.value);if(!o.length)return;const l=Math.max(...o.map(r=>r.value));return o.filter(r=>r.value===l).some(r=>r.type==="error")?"error":"warning"},ce=(t,a,o)=>{if(t===null)return 0;const l=o==="relative"?a.sum:a.max;return l>0?Math.min(Math.max(t/l,0),1):0},ue=t=>{const a=o=>re.formatNumber(o,{maximumFractionDigits:2});return t>0&&t<.01?`< ${a(.01)} %`:`${a(t)} %`},Q=({value:t,stats:a,header:o})=>{if(t===null||a.sum<=0)return;const l=t/a.sum*100;return o.percentageFormatter?.(l)??ue(l)},J=(t,a)=>a!==void 0&&a.length>(t?.length??-1)?a:t,de=({rows:t,header:a,stats:o})=>t.reduce((l,n)=>({value:J(l.value,H(a,n))??"",relative:a.showPercentage?J(l.relative,Q({value:q(Reflect.get(n,a.key)),stats:o,header:a})):void 0}),{value:""}),me=["data-threshold"],fe={class:"table-data-grid-cell-label-track"},pe={class:"table-data-grid-cell-label"},Ce={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},ge={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},he=["data-text"],ve=["data-text"],ye=["data-threshold"],be=e.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(t,{expose:a}){const o=e.shallowRef(t.params),l=e.ref(null),n=e.ref(!1),r=e.computed(()=>o.value.headerDef??{key:"",label:""}),u=e.computed(()=>o.value.context?.presentation),h=e.computed(()=>o.value.context?.cells?.tooltipTarget?.value??"body"),s=e.computed(()=>o.value.valueFormatted??String(o.value.value??"")),p=e.computed(()=>o.value.value),C=e.computed(()=>q(p.value)),k=e.computed(()=>u.value?.stats[r.value.key]),w=e.computed(()=>r.value.showPercentage&&k.value?Q({value:C.value,stats:k.value,header:r.value}):void 0),R=e.computed(()=>!!r.value.bar&&!!k.value&&(C.value!==null||p.value===null||p.value===void 0)),F=e.computed(()=>R.value&&k.value?ce(C.value,k.value,r.value.bar)*100:0),i=e.computed(()=>R.value?u.value?.labelSizers[r.value.key]:void 0),f=e.computed(()=>r.value.thresholds?.length&&C.value!==null?ie(C.value,r.value.thresholds):void 0),b=e.computed(()=>({column:r.value,refreshCell:()=>{const y=o.value.node;y&&o.value.api.refreshCells({force:!0,rowNodes:[y]})},row:o.value.data??{},rowIndex:o.value.node?.rowIndex??0,rowValue:o.value.value,selected:o.value.node?.isSelected()??!1})),z=(y,{slots:T})=>{const N=o.value.colDef?.colId,M=o.value.context?.cells?.slots;return!N||N==="cell-icon"||!M?.[N]?T.default?.():e.h("span",{class:"table-data-grid-cell-slot-content"},e.renderSlot(M,N,b.value,()=>T.default?.()??[]))},E=()=>{const y=o.value.context?.cells?.slots;return y?.["cell-icon"]?e.renderSlot(y,"cell-icon",b.value):null};let B,O,_=!1;const K=()=>{const y=l.value;n.value=!!y&&y.scrollWidth>y.clientWidth},D=()=>{_||(O!==void 0&&cancelAnimationFrame(O),O=requestAnimationFrame(()=>{O=void 0,K()}))},V=y=>{if(B?.disconnect(),y){B?.observe(y);const T=y.closest(".ag-cell");T&&B?.observe(T)}D()};return e.onMounted(()=>{B=new ResizeObserver(D),V(l.value)}),e.watch(l,V),e.onUnmounted(()=>{_=!0,B?.disconnect(),O!==void 0&&cancelAnimationFrame(O)}),a({refresh(y){return o.value=y,e.nextTick(D),!0}}),(y,T)=>{const N=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":R.value,"table-data-grid-cell-renderer--percentage":!!w.value,[`table-data-grid-cell-renderer--text-${f.value}`]:!R.value&&!!f.value}]),"data-threshold":f.value},[e.createElementVNode("span",fe,[e.createElementVNode("span",pe,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(E))),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(z),null,{default:e.withCtx(()=>[e.createVNode(N,{class:"table-data-grid-cell-tooltip",disabled:!n.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:h.value,text:s.value},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"contentElement",ref:l,class:"table-data-grid-cell-content"},e.toDisplayString(s.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),w.value?(e.openBlock(),e.createElementBlock("span",Ce,"("+e.toDisplayString(w.value)+")",1)):e.createCommentVNode("",!0)]),i.value?(e.openBlock(),e.createElementBlock("span",ge,[e.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":i.value.value},null,8,he),i.value.relative?(e.openBlock(),e.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${i.value.relative})`},null,8,ve)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),R.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":f.value},[e.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:e.normalizeStyle({width:`${F.value}%`})},null,4)],8,ye)):e.createCommentVNode("",!0)],10,me)}}}),ke=({headers:t,slots:a,initialSort:o,mode:l,rows:n,tooltipTarget:r})=>{const u=l??"infinite",h=new Set,s=i=>!!(i.showPercentage||i.bar||i.thresholds?.length),p=()=>{t.value.forEach(i=>{if(!s(i))return;let f;if(u==="infinite"&&(i.showPercentage||i.bar)?f="percentage and bar presentation is only supported in unpaginated mode":u==="unpaginated"&&n?.value?.some(z=>{const E=Reflect.get(z,i.key);return E!=null&&q(E)===null})&&(f="contains non-finite or nonnumeric values; numeric presentation skips those values"),!f)return;const b=`${i.key}:${f}`;h.has(b)||(h.add(b),console.warn(`[TableDataGrid] Column "${i.key}" ${f}.`))})};e.watch([t,()=>n?.value],p,{immediate:!0});const C=e.computed(()=>{if(u!=="unpaginated")return{};const i=n?.value??[];return Object.fromEntries(t.value.filter(f=>f.showPercentage||f.bar).map(f=>[f.key,se(i,f)]))}),k=e.computed(()=>{if(u!=="unpaginated")return{};const i=n?.value??[];return Object.fromEntries(t.value.filter(f=>f.bar).map(f=>[f.key,de({rows:i,header:f,stats:C.value[f.key]})]))}),w=e.computed(()=>({cells:{slots:a,tooltipTarget:r},presentation:{stats:C.value,labelSizers:k.value}})),R=i=>{const f=o?.sortColumnKey===i.key;return{colId:i.key,flex:!i.width&&!i.maxWidth?1:void 0,headerName:i.label,maxWidth:i.maxWidth,minWidth:i.minWidth,sortable:i.sortable??!1,unSortIcon:i.showSortIcon,...f?{initialSort:o?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:b=>b.data?.[i.key],valueFormatter:b=>b.data?H(i,b.data):String(b.value??""),width:i.width,cellRenderer:be,cellRendererParams:{headerDef:i}}};return{columnDefs:e.computed(()=>t.value.map(R)),gridContext:w}},P=({config:t,headers:a,pageSize:o})=>{const l=new Set(a.filter(r=>r.sortable).map(r=>r.key)),n=t?.sortColumnKey&&l.has(t.sortColumnKey)?t.sortColumnKey:void 0;return{sortColumnKey:n,sortColumnOrder:n?t?.sortColumnOrder:void 0,pageSize:t?.pageSize??o,...t?.fitToContent!==void 0?{fitToContent:t.fitToContent}:{}}},X=(t,a)=>t.sortColumnKey===a.sortColumnKey&&t.sortColumnOrder===a.sortColumnOrder&&t.pageSize===a.pageSize&&t.fitToContent===a.fitToContent,Se=({headers:t,pageSize:a,tableConfig:o,emitTableConfigUpdate:l,onExternalConfigChange:n})=>{const r=e.computed(()=>o.value?P({config:o.value,headers:t.value,pageSize:a.value}):void 0),u=e.ref(r.value??P({config:void 0,headers:t.value,pageSize:a.value}));e.watch(r,C=>{C&&!X(C,u.value)&&(u.value=C,n?.(C))});const h=C=>{const k=P({config:{...u.value,...C},headers:t.value,pageSize:a.value});X(k,u.value)||(u.value=k,l(k))};e.watch(t,()=>{o.value||h({})},{deep:!0});const s=e.computed(()=>({sortColumnKey:u.value.sortColumnKey,sortColumnOrder:u.value.sortColumnOrder})),p=e.computed(()=>o.value?.pageSize??a.value);return{activeTableConfig:e.readonly(u),activeSort:s,activePageSize:p,patchTableConfig:h}},we=({cellClick:t,headers:a,rowClick:o})=>{const l=e.computed(()=>new Set(a.value.filter(s=>s.disableRowClick).map(s=>s.key))),n=s=>{const p=s.event?.target;return p instanceof Element?p.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},r=s=>{const p=n(s);return!!(p&&l.value.has(p))};return{onCellClick:s=>{const p=s.colDef.colId;!s.data||!p||t({columnKey:p,row:s.data,value:s.value})},onRowClick:s=>{s.data&&!r(s)&&o(s.data,s)}}},Re=({activeSort:t,emitSort:a,patchTableConfig:o})=>{const l=(r,u)=>{r.applyColumnState({state:u.sortColumnKey?[{colId:u.sortColumnKey,sort:u.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:r=>{const u=r.api.getColumnState().filter(p=>p.sort).sort((p,C)=>(p.sortIndex??0)-(C.sortIndex??0)),h=u[u.length-1],s=h?{sortColumnKey:h.colId,sortColumnOrder:h.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};s.sortColumnKey===t.value.sortColumnKey&&s.sortColumnOrder===t.value.sortColumnOrder||(a(s),o(s),u.length>1&&l(r.api,s))},applySortToGrid:l}},De={key:0,class:"table-error-state","data-testid":"table-error-state"},Ee={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Te=((t,a)=>{const o=t.__vccOpts||t;for(const[l,n]of a)o[l]=n;return o})(e.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(t,{emit:a}){L.ModuleRegistry.registerModules([L.AllCommunityModule,L.ClientSideRowModelModule,L.InfiniteRowModelModule]);const o=t.mode??"infinite",l=a,{i18n:n}=j(),{t:r}=n,u=e.useSlots(),h=e.shallowRef(),s=e.useTemplateRef("rootElement"),p=e.shallowRef("body"),C=()=>{const c=document.fullscreenElement;p.value=c instanceof HTMLElement&&c.contains(s.value??null)?c:"body"};e.onMounted(()=>{C(),document.addEventListener("fullscreenchange",C)}),e.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",C)});const{activeTableConfig:k,activeSort:w,activePageSize:R,patchTableConfig:F}=Se({headers:e.toRef(()=>t.headers),pageSize:e.toRef(()=>t.pageSize),tableConfig:e.toRef(()=>t.tableConfig),emitTableConfigUpdate:c=>l("update:tableConfig",c),onExternalConfigChange:c=>{h.value&&f(h.value,c)}}),{onSortChanged:i,applySortToGrid:f}=Re({activeSort:w,emitSort:c=>l("sort",c),patchTableConfig:F}),b=e.computed(()=>o==="unpaginated"&&!!k.value.fitToContent),z=L.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:E,onRowClick:B}=we({cellClick:c=>l("cell:click",c),headers:e.toRef(()=>t.headers),rowClick:(c,G)=>l("row:click",c,G)}),O={resizable:!1,sortable:!1,suppressMovable:!0},_=e.computed(()=>[R.value,t.refreshKey]),K=o==="infinite"?le({fetcher:e.toRef(()=>t.fetcher),resetKey:_,sort:w}):void 0,D=K?.datasource,V=e.computed(()=>K?K.data.value:t.rows),y=e.computed(()=>K?.isFetching.value??!1),T=e.computed(()=>t.rows?Array.from(t.rows):void 0),{columnDefs:N,gridContext:M}=ke({headers:e.toRef(()=>t.headers),mode:o,rows:T,slots:u,tooltipTarget:p,initialSort:w.value}),{fetchState:d,hasData:m,state:v}=ee(V,e.toRef(()=>K?.error.value),y),S=e.computed(()=>v.value===d.SUCCESS&&!m.value);K&&te({emitState:c=>l("state",c),fetchLifecycleState:v,hasData:m});const g=()=>{const c=h.value;if(!c||c.isDestroyed())return;const G=w.value,I=c.getColumnState().find(U=>U.sort);I?.colId===G.sortColumnKey&&(I?.sort??void 0)===G.sortColumnOrder||f(c,G)};e.watch([h,w],g);const A=c=>{h.value=c.api,l("grid:ready",c.api)};return(c,G)=>{const I=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",{ref_key:"rootElement",ref:s,class:e.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":b.value}]),"data-testid":"table-data-grid"},[t.error?(e.openBlock(),e.createElementBlock("div",De,[e.renderSlot(c.$slots,"error-state",{},()=>[e.createVNode(I,{"icon-variant":"error",message:e.unref(r)("errorState.message"),title:e.unref(r)("errorState.title")},null,8,["message","title"])],!0)])):S.value?(e.openBlock(),e.createElementBlock("div",Ee,[e.renderSlot(c.$slots,"empty-state",{},()=>[e.createVNode(I,{message:e.unref(r)("emptyState.message"),title:e.unref(r)("emptyState.title")},null,8,["message","title"])],!0)])):(e.openBlock(),e.createBlock(e.unref(Y.AgGridVue),{key:2,"cache-block-size":e.unref(o)==="infinite"?e.unref(R):void 0,class:"table-data-grid-grid","column-defs":e.unref(N),context:e.unref(M),datasource:e.unref(o)==="infinite"?e.unref(D):void 0,"default-col-def":O,"dom-layout":b.value?"autoHeight":"normal","infinite-initial-row-count":e.unref(o)==="infinite"?1:void 0,loading:y.value,"row-data":e.unref(o)==="unpaginated"?T.value:void 0,"row-model-type":e.unref(o)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:e.unref(z),onCellClicked:e.unref(E),onGridReady:A,onNewColumnsLoaded:g,onRowClicked:e.unref(B),onSortChanged:e.unref(i)},null,8,["cache-block-size","column-defs","context","datasource","dom-layout","infinite-initial-row-count","loading","row-data","row-model-type","theme","onCellClicked","onRowClicked","onSortChanged"]))],2)}}}),[["__scopeId","data-v-55b96d28"]]);x.TableDataGrid=Te,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}));
@@ -1 +1 @@
1
- {"version":3,"file":"TableDataGrid.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGrid.vue"],"names":[],"mappings":"AA6SA,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAEV,OAAO,EACP,cAAc,EACd,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAmB1B,QAAA,MAAM,YAAY,GAAK,GAAG,SAAS,MAAM,EACxC,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,gBAAgB,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAClE;WA4UO,OAAO,KAAK,EAAE,WA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,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;CAAI,CAAC;wBACpE,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,CAAC,GAAG,EAAE,CAAC"}
@@ -23,14 +23,15 @@ interface UseFetchInfiniteOptions<Row extends object = TableDataGridRow> {
23
23
  *
24
24
  * Callers provide the public fetcher and an optional reset key, then observe
25
25
  * readonly fetch state and pass the returned datasource to AG Grid. Cursor maps,
26
- * block completion gates, pending counts, and stale datasource guards stay
26
+ * block completion gates, pending counts, and stale request guards stay
27
27
  * private to this composable so component code cannot mutate fetch lifecycle
28
28
  * state directly.
29
29
  *
30
30
  * @param fetcher Host-supplied fetcher that uses TableDataGrid's cursor-first
31
31
  * infinite mode contract.
32
32
  * @param resetKey Optional reactive invalidation key that rebuilds the
33
- * datasource and restarts the cursor chain.
33
+ * datasource and restarts the cursor chain. Sort changes reset the chain
34
+ * without replacing the datasource.
34
35
  * @returns Readonly datasource, first-block data, error, and fetching state
35
36
  * refs for the active AG Grid infinite datasource.
36
37
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchInfinite.d.ts","sourceRoot":"","sources":["../../../src/composables/useFetchInfinite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAW9B,UAAU,uBAAuB,CAAC,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,MAAM,GAAG,gBAAgB,EAAE,8BAIrE,uBAAuB,CAAC,GAAG,CAAC;;;;;;;;;;;;;CAiY9B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableDataGridConfig.d.ts","sourceRoot":"","sources":["../../../src/composables/useTableDataGridConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC7G,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAI9B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,qGAM3E;IACD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/B,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3D,qBAAqB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAC5D,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;CAC/D;;;;;;;;;;;;;;8BAsBkC,OAAO,CAAC,mBAAmB,CAAC;CA8B9D,CAAA"}
1
+ {"version":3,"file":"useTableDataGridConfig.d.ts","sourceRoot":"","sources":["../../../src/composables/useTableDataGridConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC7G,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAI9B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,qGAM3E;IACD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/B,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3D,qBAAqB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAC5D,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;CAC/D;;;;;;;;;;;;;;8BAsBkC,OAAO,CAAC,mBAAmB,CAAC;CAqC9D,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/table-data-grid",
3
- "version": "0.7.1",
3
+ "version": "0.7.2-pr.3884.49ec4889a.0",
4
4
  "type": "module",
5
5
  "main": "./dist/table-data-grid.umd.js",
6
6
  "module": "./dist/table-data-grid.es.js",