@kong-ui-public/table-data-grid 0.2.4-pr.3566.eeeb150a0.0 → 0.3.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.
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.kong-ui-public-table-data-grid[data-v-
|
|
1
|
+
.kong-ui-public-table-data-grid[data-v-907dbee2]{border:none;border-radius:4px;border-radius:var(--kui-border-radius-20, 4px);box-sizing:border-box;display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden;width:100%}.table-data-grid-grid[data-v-907dbee2]{--ag-background-color: var(--kui-color-background, #ffffff);--ag-border-color: var(--kui-color-border, #e0e4ea);--ag-header-background-color: var(--kui-color-background, #ffffff);--ag-header-column-border: 1px solid var(--kui-color-border, #e0e4ea);--ag-header-column-border-height: 30%;--ag-header-column-resize-handle-color: transparent;--ag-header-font-weight: var(--kui-font-weight-semibold, 600);--ag-wrapper-border: none;--ag-wrapper-border-radius: 0;flex:1 1 auto;min-height:0;width:100%}.ag-cell{align-items:center;display:flex}
|
|
@@ -299,7 +299,7 @@ const ne = {
|
|
|
299
299
|
for (const [a, i] of c)
|
|
300
300
|
o[a] = i;
|
|
301
301
|
return o;
|
|
302
|
-
}, he = /* @__PURE__ */ ue(ce, [["__scopeId", "data-v-
|
|
302
|
+
}, he = /* @__PURE__ */ ue(ce, [["__scopeId", "data-v-907dbee2"]]);
|
|
303
303
|
export {
|
|
304
304
|
he as TableDataGrid
|
|
305
305
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(f,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):(f=typeof globalThis<"u"?globalThis:f||self,e(f["kong-ui-public-table-data-grid"]={},f.Vue,f.AgGridVue,f.agGridCommunity,f["kong-ui-public-i18n"]))})(this,(function(f,e,M,v,G){"use strict";var D=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))(D||{});const F=t=>!!t?.length;function O(t,
|
|
1
|
+
(function(f,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):(f=typeof globalThis<"u"?globalThis:f||self,e(f["kong-ui-public-table-data-grid"]={},f.Vue,f.AgGridVue,f.agGridCommunity,f["kong-ui-public-i18n"]))})(this,(function(f,e,M,v,G){"use strict";var D=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))(D||{});const F=t=>!!t?.length;function O(t,d,r,o=F){const c=e.computed(()=>o(t.value)),g=e.computed(()=>{const p=t.value!==void 0,m=d.value!==void 0&&d.value!==null;return r.value?"LOADING":c.value?"SUCCESS":m?"ERROR":p?"SUCCESS":"PENDING"});return{fetchState:D,hasData:c,state:g}}const _=({emitState:t,fetchLifecycleState:d,hasData:r})=>{e.watch(()=>({hasData:r.value,state:d.value}),({hasData:o,state:c})=>{if(c!==D.PENDING){if(c===D.LOADING){t({hasData:o,state:"loading"});return}if(c===D.ERROR){t({hasData:o,state:"error"});return}t({hasData:o,state:"success"})}})},z=({startRow:t,endRow:d})=>{const r=d-t;return{blockIndex:r>0?Math.floor(t/r):0,pageSize:r}},T=({startRow:t,rowsLength:d,pageSize:r,total:o,hasMore:c})=>{if(typeof o=="number")return o;if(c!==!0&&(c===!1||d<r))return t+d},A=({fetcher:t,resetKey:d})=>{const r=new Map,o=new Map,c=e.ref(0),g=e.shallowRef(),S=e.shallowRef(),p=e.shallowRef(),m=e.ref(0),C=e.ref(!1),y=a=>a===c.value,b=()=>{C.value=m.value>0},E=()=>{p.value=void 0,m.value+=1,b()},R=()=>{m.value=Math.max(0,m.value-1),b()},w=a=>{const n=o.get(a);if(n)return n;let s;const u={promise:new Promise(i=>{s=i}),resolve:i=>s(i)};return o.set(a,u),u},h=(a,n)=>{n.resolve(!1),o.get(a)===n&&o.delete(a)},l=async({blockIndex:a,currentBlockCompletion:n,datasourceId:s})=>{if(a===0)return"ready";const u=o.get(a-1);if(!u)return h(a,n),"failed";const i=await u.promise;return y(s)?i?"ready":(h(a,n),"failed"):(h(a,n),"stale")},B=({blockIndex:a,currentBlockCompletion:n,getRowsParams:s,pageSize:u,result:i})=>{i.cursor!==void 0&&r.set(a,i.cursor),s.successCallback(i.data,T({startRow:s.startRow,rowsLength:i.data.length,pageSize:u,total:i.total,hasMore:i.hasMore})),s.startRow===0&&(S.value=i.data),n.resolve(!0)},k=({blockIndex:a,currentBlockCompletion:n,fetchError:s,getRowsParams:u})=>{p.value=s,u.failCallback(),h(a,n)},q=()=>{const a=c.value+1;return c.value=a,r.clear(),o.clear(),S.value=void 0,p.value=void 0,m.value=0,b(),{async getRows(n){const{blockIndex:s,pageSize:u}=z({startRow:n.startRow,endRow:n.endRow}),i=w(s),I=await l({blockIndex:s,currentBlockCompletion:i,datasourceId:a});if(I!=="ready"){I==="failed"&&n.failCallback();return}E();try{const N=s>0?r.get(s-1):void 0,$=await t({mode:"infinite",pageSize:u,cursor:N});if(!y(a)){h(s,i);return}B({blockIndex:s,currentBlockCompletion:i,getRowsParams:n,pageSize:u,result:$})}catch(N){if(!y(a)){h(s,i);return}k({blockIndex:s,currentBlockCompletion:i,fetchError:N,getRowsParams:n})}finally{y(a)&&R()}}}},j=()=>{g.value=q()};return e.watch(()=>d?.value,()=>{j()},{immediate:!0}),{datasource:e.readonly(g),data:e.readonly(S),error:e.readonly(p),isFetching:e.readonly(C)}},L={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 V(){const t=G.createI18n("en-us",L);return{i18n:t,i18nT:G.i18nTComponent(t)}}const x={class:"kong-ui-public-table-data-grid","data-testid":"table-data-grid"},K={key:0,class:"table-error-state","data-testid":"table-error-state"},U={key:1,class:"table-empty-state","data-testid":"table-empty-state"},W=((t,d)=>{const r=t.__vccOpts||t;for(const[o,c]of d)r[o]=c;return r})(e.defineComponent({__name:"TableDataGrid",props:{headers:{},fetcher:{type:Function},error:{type:Boolean,default:!1},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]}},emits:["grid:ready","state"],setup(t,{emit:d}){v.ModuleRegistry.registerModules([v.AllCommunityModule,v.InfiniteRowModelModule]);const r=d,{i18n:{t:o}}=V(),c={resizable:!1,sortable:!1,suppressMovable:!0},g=e.computed(()=>t.headers.map(l=>({colId:l.key,flex:!l.width&&!l.maxWidth?1:void 0,headerName:l.label,maxWidth:l.maxWidth,minWidth:l.minWidth,valueGetter:k=>k.data?.[l.key],width:l.width}))),S=e.computed(()=>[t.fetcher,t.pageSize,t.refreshKey]),{data:p,datasource:m,error:C,isFetching:y}=A({fetcher:t.fetcher,resetKey:S}),{fetchState:b,hasData:E,state:R}=O(p,C,y),w=e.computed(()=>R.value===b.SUCCESS&&!E.value);_({emitState:l=>r("state",l),fetchLifecycleState:R,hasData:E});const h=l=>{r("grid:ready",l.api)};return(l,B)=>{const k=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",x,[t.error?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(l.$slots,"error-state",{},()=>[e.createVNode(k,{"icon-variant":"error",message:e.unref(o)("errorState.message"),title:e.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):w.value?(e.openBlock(),e.createElementBlock("div",U,[e.renderSlot(l.$slots,"empty-state",{},()=>[e.createVNode(k,{message:e.unref(o)("emptyState.message"),title:e.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(e.openBlock(),e.createBlock(e.unref(M.AgGridVue),{key:2,"cache-block-size":t.pageSize,class:"table-data-grid-grid","column-defs":g.value,datasource:e.unref(m),"default-col-def":c,"infinite-initial-row-count":1,loading:e.unref(y),"row-model-type":"infinite","suppress-cell-focus":!0,theme:e.unref(v.themeQuartz),onGridReady:h},null,8,["cache-block-size","column-defs","datasource","loading","theme"]))])}}}),[["__scopeId","data-v-907dbee2"]]);f.TableDataGrid=W,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableDataGrid.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGrid.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableDataGrid.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGrid.vue"],"names":[],"mappings":"AA8LA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAU,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAc/D,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;WAoNO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;iBAhN7C,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;iBAC/B,oBAAoB,CAAC,GAAG,CAAC;gBAC1B,OAAO;mBACJ,MAAM;qBACJ,MAAM,GAAG,MAAM,GAAG,OAAO;;;;KA4MmD,CAAC,GAAG,CAAC,OAAO,UAAU,SAAS;QAAE,oBAAoB,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YAC5J,CAAC,OAAO,EAAE,EAAE,KAAK,IAAI;WACtB,GAAG;;uBAlMM,MAAM,OAAO;uBACb,MAAM,OAAO;;;YAKxB,YAAY,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI;YACpD,OAAO,WAAW,yBAAyB,GAAG,IAAI;;EA+LpD,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAI,CAAC;wBACvD,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/table-data-grid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/table-data-grid.umd.js",
|
|
6
6
|
"module": "./dist/table-data-grid.es.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@kong/kongponents": "9.
|
|
24
|
+
"@kong/kongponents": "9.61.1",
|
|
25
25
|
"vue": "^3.5.35",
|
|
26
26
|
"@kong-ui-public/i18n": "^2.5.0"
|
|
27
27
|
},
|