@kong-ui-public/table-data-grid 0.3.5 → 0.3.7-pr.3602.40ad43658.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/table-data-grid",
3
- "version": "0.3.5",
3
+ "version": "0.3.7-pr.3602.40ad43658.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.61.6",
24
+ "@kong/kongponents": "9.62.0",
25
25
  "vue": "^3.5.35",
26
26
  "@kong-ui-public/i18n": "^2.5.0"
27
27
  },
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- .table-data-grid-cell-renderer,.table-data-grid-cell-tooltip,.table-data-grid-cell-content{display:block;min-width:0;width:100%}.table-data-grid-cell-content{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kong-ui-public-table-data-grid[data-v-b8bd22c9]{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-b8bd22c9]{--ag-background-color: var(--kui-color-background, #ffffff);--ag-border-color: var(--kui-color-border, #e0e4ea);--ag-foreground-color: var(--kui-color-text, #000933);--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-header-text-color: var(--kui-color-text-neutral, #6c7489);--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;min-width:0}.ag-cell-wrapper,.ag-cell-value{min-width:0;width:100%}
@@ -1,363 +0,0 @@
1
- import { defineComponent as A, shallowRef as N, ref as R, computed as k, onMounted as W, watch as O, onUnmounted as V, nextTick as $, resolveComponent as T, openBlock as w, createElementBlock as G, createVNode as I, withCtx as j, createElementVNode as q, toDisplayString as H, readonly as _, renderSlot as x, unref as S, createBlock as P } from "vue";
2
- import { AgGridVue as Q } from "ag-grid-vue3";
3
- import { ModuleRegistry as J, AllCommunityModule as X, InfiniteRowModelModule as Y, themeQuartz as Z } from "ag-grid-community";
4
- import { createI18n as ee, i18nTComponent as te } from "@kong-ui-public/i18n";
5
- const ae = { class: "table-data-grid-cell-renderer" }, oe = /* @__PURE__ */ A({
6
- name: "TableDataGridCellRenderer",
7
- __name: "TableDataGridCellRenderer",
8
- props: {
9
- params: {}
10
- },
11
- setup(e, { expose: i }) {
12
- const a = N(e.params), t = R(null), r = R(!1), h = k(() => a.value.valueFormatted ?? String(a.value.value ?? ""));
13
- let f, u, m = !1;
14
- const C = () => {
15
- const d = t.value;
16
- r.value = !!d && d.scrollWidth > d.clientWidth;
17
- }, p = () => {
18
- m || (u !== void 0 && cancelAnimationFrame(u), u = requestAnimationFrame(() => {
19
- u = void 0, C();
20
- }));
21
- }, g = (d) => {
22
- if (f?.disconnect(), d) {
23
- f?.observe(d);
24
- const y = d.closest(".ag-cell");
25
- y && f?.observe(y);
26
- }
27
- p();
28
- };
29
- return W(() => {
30
- f = new ResizeObserver(p), g(t.value);
31
- }), O(t, g, { flush: "post" }), V(() => {
32
- m = !0, f?.disconnect(), u !== void 0 && cancelAnimationFrame(u);
33
- }), i({
34
- refresh(d) {
35
- return a.value = d, $(p), !0;
36
- }
37
- }), (d, y) => {
38
- const E = T("KTooltip");
39
- return w(), G("span", ae, [
40
- I(E, {
41
- class: "table-data-grid-cell-tooltip",
42
- disabled: !r.value,
43
- "kpop-attributes": { popoverDelay: 400 },
44
- "max-width": "300",
45
- placement: "bottom-start",
46
- target: "body",
47
- text: h.value
48
- }, {
49
- default: j(() => [
50
- q("span", {
51
- ref_key: "contentElement",
52
- ref: t,
53
- class: "table-data-grid-cell-content"
54
- }, H(h.value), 513)
55
- ]),
56
- _: 1
57
- }, 8, ["disabled", "text"])
58
- ]);
59
- };
60
- }
61
- });
62
- var F = /* @__PURE__ */ ((e) => (e.PENDING = "PENDING", e.LOADING = "LOADING", e.SUCCESS = "SUCCESS", e.ERROR = "ERROR", e))(F || {});
63
- const re = (e) => !!e?.length;
64
- function ne(e, i, a, t = re) {
65
- const r = k(() => t(e.value)), h = k(() => {
66
- const u = e.value !== void 0, m = i.value !== void 0 && i.value !== null;
67
- return a.value ? "LOADING" : r.value ? "SUCCESS" : m ? "ERROR" : u ? "SUCCESS" : "PENDING";
68
- });
69
- return {
70
- fetchState: F,
71
- hasData: r,
72
- state: h
73
- };
74
- }
75
- const se = ({
76
- emitState: e,
77
- fetchLifecycleState: i,
78
- hasData: a
79
- }) => {
80
- O(
81
- () => ({
82
- hasData: a.value,
83
- state: i.value
84
- }),
85
- ({ hasData: t, state: r }) => {
86
- if (r !== F.PENDING) {
87
- if (r === F.LOADING) {
88
- e({
89
- hasData: t,
90
- state: "loading"
91
- });
92
- return;
93
- }
94
- if (r === F.ERROR) {
95
- e({
96
- hasData: t,
97
- state: "error"
98
- });
99
- return;
100
- }
101
- e({
102
- hasData: t,
103
- state: "success"
104
- });
105
- }
106
- }
107
- );
108
- }, le = ({ startRow: e, endRow: i }) => {
109
- const a = i - e;
110
- return {
111
- blockIndex: a > 0 ? Math.floor(e / a) : 0,
112
- pageSize: a
113
- };
114
- }, ie = ({
115
- startRow: e,
116
- rowsLength: i,
117
- pageSize: a,
118
- total: t,
119
- hasMore: r
120
- }) => {
121
- if (typeof t == "number")
122
- return t;
123
- if (r !== !0 && (r === !1 || i < a))
124
- return e + i;
125
- }, ce = ({
126
- fetcher: e,
127
- resetKey: i
128
- }) => {
129
- const a = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), r = R(0), h = N(), f = N(), u = N(), m = R(0), C = R(!1), p = (o) => o === r.value, g = () => {
130
- C.value = m.value > 0;
131
- }, d = () => {
132
- u.value = void 0, m.value += 1, g();
133
- }, y = () => {
134
- m.value = Math.max(0, m.value - 1), g();
135
- }, E = (o) => {
136
- const n = t.get(o);
137
- if (n)
138
- return n;
139
- let s;
140
- const v = {
141
- promise: new Promise((l) => {
142
- s = l;
143
- }),
144
- resolve: (l) => s(l)
145
- };
146
- return t.set(o, v), v;
147
- }, b = (o, n) => {
148
- n.resolve(!1), t.get(o) === n && t.delete(o);
149
- }, c = async ({
150
- blockIndex: o,
151
- currentBlockCompletion: n,
152
- datasourceId: s
153
- }) => {
154
- if (o === 0)
155
- return "ready";
156
- const v = t.get(o - 1);
157
- if (!v)
158
- return b(o, n), "failed";
159
- const l = await v.promise;
160
- return p(s) ? l ? "ready" : (b(o, n), "failed") : (b(o, n), "stale");
161
- }, M = ({
162
- blockIndex: o,
163
- currentBlockCompletion: n,
164
- getRowsParams: s,
165
- pageSize: v,
166
- result: l
167
- }) => {
168
- l.cursor !== void 0 && a.set(o, l.cursor), s.successCallback(l.data, ie({
169
- startRow: s.startRow,
170
- rowsLength: l.data.length,
171
- pageSize: v,
172
- total: l.total,
173
- hasMore: l.hasMore
174
- })), s.startRow === 0 && (f.value = l.data), n.resolve(!0);
175
- }, D = ({
176
- blockIndex: o,
177
- currentBlockCompletion: n,
178
- fetchError: s,
179
- getRowsParams: v
180
- }) => {
181
- u.value = s, v.failCallback(), b(o, n);
182
- }, K = () => {
183
- const o = r.value + 1;
184
- return r.value = o, a.clear(), t.clear(), f.value = void 0, u.value = void 0, m.value = 0, g(), {
185
- async getRows(n) {
186
- const {
187
- blockIndex: s,
188
- pageSize: v
189
- } = le({
190
- startRow: n.startRow,
191
- endRow: n.endRow
192
- }), l = E(s), z = await c({
193
- blockIndex: s,
194
- currentBlockCompletion: l,
195
- datasourceId: o
196
- });
197
- if (z !== "ready") {
198
- z === "failed" && n.failCallback();
199
- return;
200
- }
201
- d();
202
- try {
203
- const B = s > 0 ? a.get(s - 1) : void 0, U = await e({
204
- mode: "infinite",
205
- pageSize: v,
206
- cursor: B
207
- });
208
- if (!p(o)) {
209
- b(s, l);
210
- return;
211
- }
212
- M({
213
- blockIndex: s,
214
- currentBlockCompletion: l,
215
- getRowsParams: n,
216
- pageSize: v,
217
- result: U
218
- });
219
- } catch (B) {
220
- if (!p(o)) {
221
- b(s, l);
222
- return;
223
- }
224
- D({
225
- blockIndex: s,
226
- currentBlockCompletion: l,
227
- fetchError: B,
228
- getRowsParams: n
229
- });
230
- } finally {
231
- p(o) && y();
232
- }
233
- }
234
- };
235
- }, L = () => {
236
- h.value = K();
237
- };
238
- return O(
239
- () => i?.value,
240
- () => {
241
- L();
242
- },
243
- { immediate: !0 }
244
- ), {
245
- datasource: _(h),
246
- data: _(f),
247
- error: _(u),
248
- isFetching: _(C)
249
- };
250
- }, ue = { title: "No Data", message: "There is no data to display." }, de = { title: "An error occurred", message: "Data cannot be displayed due to an error." }, fe = {
251
- emptyState: ue,
252
- errorState: de
253
- };
254
- function me() {
255
- const e = ee("en-us", fe);
256
- return {
257
- i18n: e,
258
- i18nT: te(e)
259
- // Translation component <i18n-t>
260
- };
261
- }
262
- const ve = {
263
- class: "kong-ui-public-table-data-grid",
264
- "data-testid": "table-data-grid"
265
- }, pe = {
266
- key: 0,
267
- class: "table-error-state",
268
- "data-testid": "table-error-state"
269
- }, he = {
270
- key: 1,
271
- class: "table-empty-state",
272
- "data-testid": "table-empty-state"
273
- }, ge = /* @__PURE__ */ A({
274
- __name: "TableDataGrid",
275
- props: {
276
- headers: {},
277
- fetcher: { type: Function },
278
- error: { type: Boolean, default: !1 },
279
- pageSize: { default: 25 },
280
- refreshKey: { type: [String, Number, Boolean] }
281
- },
282
- emits: ["grid:ready", "state"],
283
- setup(e, { emit: i }) {
284
- J.registerModules([X, Y]);
285
- const a = i, { i18n: { t } } = me(), r = {
286
- cellRenderer: oe,
287
- resizable: !1,
288
- sortable: !1,
289
- suppressMovable: !0
290
- }, h = k(() => e.headers.map((c) => ({
291
- colId: c.key,
292
- // Headers without explicit width constraints should fill available space.
293
- flex: !c.width && !c.maxWidth ? 1 : void 0,
294
- headerName: c.label,
295
- maxWidth: c.maxWidth,
296
- minWidth: c.minWidth,
297
- valueGetter: (D) => D.data?.[c.key],
298
- width: c.width
299
- }))), f = k(() => [e.fetcher, e.pageSize, e.refreshKey]), {
300
- data: u,
301
- datasource: m,
302
- error: C,
303
- isFetching: p
304
- } = ce({
305
- fetcher: e.fetcher,
306
- resetKey: f
307
- }), {
308
- fetchState: g,
309
- hasData: d,
310
- state: y
311
- } = ne(u, C, p), E = k(() => y.value === g.SUCCESS && !d.value);
312
- se({
313
- emitState: (c) => a("state", c),
314
- fetchLifecycleState: y,
315
- hasData: d
316
- });
317
- const b = (c) => {
318
- a("grid:ready", c.api);
319
- };
320
- return (c, M) => {
321
- const D = T("KEmptyState");
322
- return w(), G("div", ve, [
323
- e.error ? (w(), G("div", pe, [
324
- x(c.$slots, "error-state", {}, () => [
325
- I(D, {
326
- "icon-variant": "error",
327
- message: S(t)("errorState.message"),
328
- title: S(t)("errorState.title")
329
- }, null, 8, ["message", "title"])
330
- ], !0)
331
- ])) : E.value ? (w(), G("div", he, [
332
- x(c.$slots, "empty-state", {}, () => [
333
- I(D, {
334
- message: S(t)("emptyState.message"),
335
- title: S(t)("emptyState.title")
336
- }, null, 8, ["message", "title"])
337
- ], !0)
338
- ])) : (w(), P(S(Q), {
339
- key: 2,
340
- "cache-block-size": e.pageSize,
341
- class: "table-data-grid-grid",
342
- "column-defs": h.value,
343
- datasource: S(m),
344
- "default-col-def": r,
345
- "infinite-initial-row-count": 1,
346
- loading: S(p),
347
- "row-model-type": "infinite",
348
- "suppress-cell-focus": !0,
349
- theme: S(Z),
350
- onGridReady: b
351
- }, null, 8, ["cache-block-size", "column-defs", "datasource", "loading", "theme"]))
352
- ]);
353
- };
354
- }
355
- }), ye = (e, i) => {
356
- const a = e.__vccOpts || e;
357
- for (const [t, r] of i)
358
- a[t] = r;
359
- return a;
360
- }, ke = /* @__PURE__ */ ye(ge, [["__scopeId", "data-v-b8bd22c9"]]);
361
- export {
362
- ke as TableDataGrid
363
- };
@@ -1 +0,0 @@
1
- (function(y,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):(y=typeof globalThis<"u"?globalThis:y||self,e(y["kong-ui-public-table-data-grid"]={},y.Vue,y.AgGridVue,y.agGridCommunity,y["kong-ui-public-i18n"]))})(this,(function(y,e,G,R,N){"use strict";const M={class:"table-data-grid-cell-renderer"},O=e.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(t,{expose:c}){const o=e.shallowRef(t.params),a=e.ref(null),n=e.ref(!1),b=e.computed(()=>o.value.valueFormatted??String(o.value.value??""));let m,u,p=!1;const D=()=>{const f=a.value;n.value=!!f&&f.scrollWidth>f.clientWidth},g=()=>{p||(u!==void 0&&cancelAnimationFrame(u),u=requestAnimationFrame(()=>{u=void 0,D()}))},S=f=>{if(m?.disconnect(),f){m?.observe(f);const k=f.closest(".ag-cell");k&&m?.observe(k)}g()};return e.onMounted(()=>{m=new ResizeObserver(g),S(a.value)}),e.watch(a,S,{flush:"post"}),e.onUnmounted(()=>{p=!0,m?.disconnect(),u!==void 0&&cancelAnimationFrame(u)}),c({refresh(f){return o.value=f,e.nextTick(g),!0}}),(f,k)=>{const E=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("span",M,[e.createVNode(E,{class:"table-data-grid-cell-tooltip",disabled:!n.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:"body",text:b.value},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"contentElement",ref:a,class:"table-data-grid-cell-content"},e.toDisplayString(b.value),513)]),_:1},8,["disabled","text"])])}}});var w=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))(w||{});const I=t=>!!t?.length;function T(t,c,o,a=I){const n=e.computed(()=>a(t.value)),b=e.computed(()=>{const u=t.value!==void 0,p=c.value!==void 0&&c.value!==null;return o.value?"LOADING":n.value?"SUCCESS":p?"ERROR":u?"SUCCESS":"PENDING"});return{fetchState:w,hasData:n,state:b}}const x=({emitState:t,fetchLifecycleState:c,hasData:o})=>{e.watch(()=>({hasData:o.value,state:c.value}),({hasData:a,state:n})=>{if(n!==w.PENDING){if(n===w.LOADING){t({hasData:a,state:"loading"});return}if(n===w.ERROR){t({hasData:a,state:"error"});return}t({hasData:a,state:"success"})}})},z=({startRow:t,endRow:c})=>{const o=c-t;return{blockIndex:o>0?Math.floor(t/o):0,pageSize:o}},A=({startRow:t,rowsLength:c,pageSize:o,total:a,hasMore:n})=>{if(typeof a=="number")return a;if(n!==!0&&(n===!1||c<o))return t+c},V=({fetcher:t,resetKey:c})=>{const o=new Map,a=new Map,n=e.ref(0),b=e.shallowRef(),m=e.shallowRef(),u=e.shallowRef(),p=e.ref(0),D=e.ref(!1),g=r=>r===n.value,S=()=>{D.value=p.value>0},f=()=>{u.value=void 0,p.value+=1,S()},k=()=>{p.value=Math.max(0,p.value-1),S()},E=r=>{const s=a.get(r);if(s)return s;let l;const h={promise:new Promise(i=>{l=i}),resolve:i=>l(i)};return a.set(r,h),h},v=(r,s)=>{s.resolve(!1),a.get(r)===s&&a.delete(r)},d=async({blockIndex:r,currentBlockCompletion:s,datasourceId:l})=>{if(r===0)return"ready";const h=a.get(r-1);if(!h)return v(r,s),"failed";const i=await h.promise;return g(l)?i?"ready":(v(r,s),"failed"):(v(r,s),"stale")},_=({blockIndex:r,currentBlockCompletion:s,getRowsParams:l,pageSize:h,result:i})=>{i.cursor!==void 0&&o.set(r,i.cursor),l.successCallback(i.data,A({startRow:l.startRow,rowsLength:i.data.length,pageSize:h,total:i.total,hasMore:i.hasMore})),l.startRow===0&&(m.value=i.data),s.resolve(!0)},C=({blockIndex:r,currentBlockCompletion:s,fetchError:l,getRowsParams:h})=>{u.value=l,h.failCallback(),v(r,s)},j=()=>{const r=n.value+1;return n.value=r,o.clear(),a.clear(),m.value=void 0,u.value=void 0,p.value=0,S(),{async getRows(s){const{blockIndex:l,pageSize:h}=z({startRow:s.startRow,endRow:s.endRow}),i=E(l),F=await d({blockIndex:l,currentBlockCompletion:i,datasourceId:r});if(F!=="ready"){F==="failed"&&s.failCallback();return}f();try{const B=l>0?o.get(l-1):void 0,H=await t({mode:"infinite",pageSize:h,cursor:B});if(!g(r)){v(l,i);return}_({blockIndex:l,currentBlockCompletion:i,getRowsParams:s,pageSize:h,result:H})}catch(B){if(!g(r)){v(l,i);return}C({blockIndex:l,currentBlockCompletion:i,fetchError:B,getRowsParams:s})}finally{g(r)&&k()}}}},P=()=>{b.value=j()};return e.watch(()=>c?.value,()=>{P()},{immediate:!0}),{datasource:e.readonly(b),data:e.readonly(m),error:e.readonly(u),isFetching:e.readonly(D)}},K={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 L(){const t=N.createI18n("en-us",K);return{i18n:t,i18nT:N.i18nTComponent(t)}}const U={class:"kong-ui-public-table-data-grid","data-testid":"table-data-grid"},W={key:0,class:"table-error-state","data-testid":"table-error-state"},q={key:1,class:"table-empty-state","data-testid":"table-empty-state"},$=((t,c)=>{const o=t.__vccOpts||t;for(const[a,n]of c)o[a]=n;return o})(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:c}){R.ModuleRegistry.registerModules([R.AllCommunityModule,R.InfiniteRowModelModule]);const o=c,{i18n:{t:a}}=L(),n={cellRenderer:O,resizable:!1,sortable:!1,suppressMovable:!0},b=e.computed(()=>t.headers.map(d=>({colId:d.key,flex:!d.width&&!d.maxWidth?1:void 0,headerName:d.label,maxWidth:d.maxWidth,minWidth:d.minWidth,valueGetter:C=>C.data?.[d.key],width:d.width}))),m=e.computed(()=>[t.fetcher,t.pageSize,t.refreshKey]),{data:u,datasource:p,error:D,isFetching:g}=V({fetcher:t.fetcher,resetKey:m}),{fetchState:S,hasData:f,state:k}=T(u,D,g),E=e.computed(()=>k.value===S.SUCCESS&&!f.value);x({emitState:d=>o("state",d),fetchLifecycleState:k,hasData:f});const v=d=>{o("grid:ready",d.api)};return(d,_)=>{const C=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",U,[t.error?(e.openBlock(),e.createElementBlock("div",W,[e.renderSlot(d.$slots,"error-state",{},()=>[e.createVNode(C,{"icon-variant":"error",message:e.unref(a)("errorState.message"),title:e.unref(a)("errorState.title")},null,8,["message","title"])],!0)])):E.value?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(d.$slots,"empty-state",{},()=>[e.createVNode(C,{message:e.unref(a)("emptyState.message"),title:e.unref(a)("emptyState.title")},null,8,["message","title"])],!0)])):(e.openBlock(),e.createBlock(e.unref(G.AgGridVue),{key:2,"cache-block-size":t.pageSize,class:"table-data-grid-grid","column-defs":b.value,datasource:e.unref(p),"default-col-def":n,"infinite-initial-row-count":1,loading:e.unref(g),"row-model-type":"infinite","suppress-cell-focus":!0,theme:e.unref(R.themeQuartz),onGridReady:v},null,8,["cache-block-size","column-defs","datasource","loading","theme"]))])}}}),[["__scopeId","data-v-b8bd22c9"]]);y.TableDataGrid=$,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
@@ -1,36 +0,0 @@
1
- import type { TableDataGridFetcher, TableDataGridHeader, TableDataGridStatePayload } from '../types';
2
- import type { GridReadyEvent } from 'ag-grid-community';
3
- declare const __VLS_export: <Row extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: import("vue").PublicProps & __VLS_PrettifyLocal<{
5
- headers: Array<TableDataGridHeader<Row>>;
6
- fetcher: TableDataGridFetcher<Row>;
7
- error?: boolean;
8
- pageSize?: number;
9
- refreshKey?: string | number | boolean;
10
- } & {
11
- onState?: ((payload: TableDataGridStatePayload) => any) | undefined;
12
- "onGrid:ready"?: ((api: import("ag-grid-community").GridApi<Row>) => any) | undefined;
13
- }> & (typeof globalThis extends {
14
- __VLS_PROPS_FALLBACK: infer P;
15
- } ? P : {});
16
- expose: (exposed: {}) => void;
17
- attrs: any;
18
- slots: {
19
- 'empty-state': () => unknown;
20
- 'error-state': () => unknown;
21
- };
22
- emit: {
23
- (e: "grid:ready", api: GridReadyEvent<Row>["api"]): void;
24
- (e: "state", payload: TableDataGridStatePayload): void;
25
- };
26
- }>) => import("vue").VNode & {
27
- __ctx?: Awaited<typeof __VLS_setup>;
28
- };
29
- declare const _default: typeof __VLS_export;
30
- export default _default;
31
- type __VLS_PrettifyLocal<T> = (T extends any ? {
32
- [K in keyof T]: T[K];
33
- } : {
34
- [K in keyof T as K]: T[K];
35
- }) & {};
36
- //# sourceMappingURL=TableDataGrid.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableDataGrid.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGrid.vue"],"names":[],"mappings":"AAyMA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAU,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAe/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;WAyNO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;iBArN7C,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;iBAC/B,oBAAoB,CAAC,GAAG,CAAC;gBAC1B,OAAO;mBACJ,MAAM;qBACJ,MAAM,GAAG,MAAM,GAAG,OAAO;;;;KAiNmD,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;;uBAvMM,MAAM,OAAO;uBACb,MAAM,OAAO;;;YAKxB,YAAY,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI;YACpD,OAAO,WAAW,yBAAyB,GAAG,IAAI;;EAoMpD,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"}
@@ -1,11 +0,0 @@
1
- import type { ICellRendererParams } from 'ag-grid-community';
2
- type CellRendererParams = ICellRendererParams<Record<string, unknown>>;
3
- type __VLS_Props = {
4
- params: CellRendererParams;
5
- };
6
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
7
- refresh(nextParams: CellRendererParams): boolean;
8
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
- declare const _default: typeof __VLS_export;
10
- export default _default;
11
- //# sourceMappingURL=TableDataGridCellRenderer.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableDataGridCellRenderer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGridCellRenderer.vue"],"names":[],"mappings":"AAiIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAG5D,KAAK,kBAAkB,GAAG,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAMtE,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,kBAAkB,CAAA;CAC3B,CAAC;AA6IF,QAAA,MAAM,YAAY;wBAtEI,kBAAkB;oPAyEtC,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,11 +0,0 @@
1
- import type { TableDataGridStatePayload } from '../types';
2
- import type { Ref } from 'vue';
3
- import { fetchState } from './useFetchState';
4
- type UseEmitStateOptions = {
5
- emitState: (payload: TableDataGridStatePayload) => void;
6
- fetchLifecycleState: Readonly<Ref<fetchState>>;
7
- hasData: Readonly<Ref<boolean>>;
8
- };
9
- export declare const useEmitState: ({ emitState, fetchLifecycleState, hasData, }: UseEmitStateOptions) => void;
10
- export {};
11
- //# sourceMappingURL=useEmitState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEmitState.d.ts","sourceRoot":"","sources":["../../../src/composables/useEmitState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAA;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,KAAK,mBAAmB,GAAG;IACzB,SAAS,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,IAAI,CAAA;IACvD,mBAAmB,EAAE,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAA;IAC9C,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,8CAI1B,mBAAmB,SAmCrB,CAAA"}
@@ -1,48 +0,0 @@
1
- import type { TableDataGridFetcher, TableDataGridRow } from '../types';
2
- import type { IGetRowsParams } from 'ag-grid-community';
3
- import type { Ref } from 'vue';
4
- interface UseFetchInfiniteOptions<Row extends object = TableDataGridRow> {
5
- /**
6
- * Public row fetcher supplied by the host. The composable keeps AG Grid row
7
- * ranges internal and calls this with the cursor-first TableDataGrid contract.
8
- */
9
- fetcher: TableDataGridFetcher<Row>;
10
- /**
11
- * Reactive invalidation input from the component layer. Any change rebuilds
12
- * the datasource and clears cursor/block state back to block 0.
13
- */
14
- resetKey?: Readonly<Ref<unknown>>;
15
- }
16
- /**
17
- * Owns AG Grid infinite datasource creation and cursor-backed fetch
18
- * orchestration for TableDataGrid.
19
- *
20
- * Callers provide the public fetcher and an optional reset key, then observe
21
- * readonly fetch state and pass the returned datasource to AG Grid. Cursor maps,
22
- * block completion gates, pending counts, and stale datasource guards stay
23
- * private to this composable so component code cannot mutate fetch lifecycle
24
- * state directly.
25
- *
26
- * @param fetcher Host-supplied fetcher that uses TableDataGrid's cursor-first
27
- * infinite mode contract.
28
- * @param resetKey Optional reactive invalidation key that rebuilds the
29
- * datasource and restarts the cursor chain.
30
- * @returns Readonly datasource, first-block data, error, and fetching state
31
- * refs for the active AG Grid infinite datasource.
32
- */
33
- export declare const useFetchInfinite: <Row extends object = TableDataGridRow>({ fetcher, resetKey, }: UseFetchInfiniteOptions<Row>) => {
34
- datasource: Readonly<Ref<{
35
- readonly rowCount?: number | undefined;
36
- readonly getRows: (params: IGetRowsParams) => void;
37
- readonly destroy?: (() => void) | undefined;
38
- } | undefined, {
39
- readonly rowCount?: number | undefined;
40
- readonly getRows: (params: IGetRowsParams) => void;
41
- readonly destroy?: (() => void) | undefined;
42
- } | undefined>>;
43
- data: Readonly<Ref<readonly import("vue").DeepReadonly<Row>[] | undefined, readonly import("vue").DeepReadonly<Row>[] | undefined>>;
44
- error: Readonly<Ref<Readonly<unknown>, Readonly<unknown>>>;
45
- isFetching: Readonly<Ref<boolean, boolean>>;
46
- };
47
- export {};
48
- //# sourceMappingURL=useFetchInfinite.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFetchInfinite.d.ts","sourceRoot":"","sources":["../../../src/composables/useFetchInfinite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,gBAAgB,EACjB,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,GAAG,SAAS,MAAM,GAAG,gBAAgB;IACrE;;;OAGG;IACH,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAA;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;CAClC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,wBAGrE,uBAAuB,CAAC,GAAG,CAAC;;;;;;;;;;;;;CA4T9B,CAAA"}
@@ -1,30 +0,0 @@
1
- import type { Ref } from 'vue';
2
- export declare enum fetchState {
3
- PENDING = "PENDING",
4
- LOADING = "LOADING",
5
- SUCCESS = "SUCCESS",
6
- ERROR = "ERROR"
7
- }
8
- type UseFetchStateResult = {
9
- fetchState: typeof fetchState;
10
- hasData: Readonly<Ref<boolean>>;
11
- state: Readonly<Ref<fetchState>>;
12
- };
13
- type FetchStateData<Row> = readonly Row[] | undefined;
14
- /**
15
- * Derives TableDataGrid fetch state from fetch lifecycle refs.
16
- *
17
- * `data`, `error`, and `isFetching` are owned by the fetch orchestration
18
- * composable. This helper only reads those refs and exposes a readonly derived
19
- * state without owning mutation or request lifecycle behavior.
20
- *
21
- * @param data Current rows from the active fetch chain, or `undefined` before
22
- * the first fetch result resolves.
23
- * @param error Current fetch error, if one exists.
24
- * @param isFetching Whether at least one fetch request is currently pending.
25
- * @param hasDataCallback Optional row detector for callers that need a custom
26
- * definition of meaningful data.
27
- */
28
- export default function useFetchState<Row>(data: Readonly<Ref<FetchStateData<Row>>>, error: Readonly<Ref<unknown>>, isFetching: Readonly<Ref<boolean>>, hasDataCallback?: (data: FetchStateData<Row>) => boolean): UseFetchStateResult;
29
- export {};
30
- //# sourceMappingURL=useFetchState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFetchState.d.ts","sourceRoot":"","sources":["../../../src/composables/useFetchState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG9B,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,OAAO,UAAU,CAAA;IAC7B,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/B,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAA;CACjC,CAAA;AAED,KAAK,cAAc,CAAC,GAAG,IAAI,SAAS,GAAG,EAAE,GAAG,SAAS,CAAA;AAMrD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,GAAG,EACvC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EACxC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAC7B,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAClC,eAAe,GAAE,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC,KAAK,OAAwB,GACvE,mBAAmB,CAgCrB"}
@@ -1,9 +0,0 @@
1
- import { createI18n, i18nTComponent } from '@kong-ui-public/i18n';
2
- import english from '../locales/en.json';
3
- interface UseI18nReturn {
4
- i18n: ReturnType<typeof createI18n<typeof english>>;
5
- i18nT: ReturnType<typeof i18nTComponent<typeof english>>;
6
- }
7
- export default function useI18n(): UseI18nReturn;
8
- export {};
9
- //# sourceMappingURL=useI18n.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../../src/composables/useI18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,OAAO,MAAM,oBAAoB,CAAA;AAExC,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;IACnD,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;CACzD;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,IAAI,aAAa,CAO/C"}
@@ -1,4 +0,0 @@
1
- import TableDataGrid from './components/TableDataGrid.vue';
2
- export { TableDataGrid };
3
- export * from './types';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,gCAAgC,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,CAAA;AAExB,cAAc,SAAS,CAAA"}
@@ -1,29 +0,0 @@
1
- import type { GridApi } from 'ag-grid-community';
2
- export type TableDataGridMode = 'infinite';
3
- export type TableDataGridRow = Record<string, unknown>;
4
- export type TableDataGridState = 'loading' | 'success' | 'error';
5
- export type TableDataGridStatePayload = {
6
- state: TableDataGridState;
7
- hasData: boolean;
8
- };
9
- export type TableDataGridHeader<Row extends object = TableDataGridRow> = {
10
- key: Extract<keyof Row, string>;
11
- label: string;
12
- width?: number;
13
- minWidth?: number;
14
- maxWidth?: number;
15
- };
16
- export interface TableDataGridInfiniteFetcherParams {
17
- mode: 'infinite';
18
- pageSize: number;
19
- cursor?: unknown;
20
- }
21
- export type TableDataGridFetcherResult<Row extends object = TableDataGridRow> = {
22
- data: Row[];
23
- cursor?: unknown;
24
- total?: number;
25
- hasMore?: boolean;
26
- };
27
- export type TableDataGridFetcher<Row extends object = TableDataGridRow> = (params: TableDataGridInfiniteFetcherParams) => Promise<TableDataGridFetcherResult<Row>>;
28
- export type TableDataGridReadyPayload<Row extends object = TableDataGridRow> = GridApi<Row>;
29
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAA;AAC1C,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACtD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAEhE,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,kBAAkB,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI;IACvE,GAAG,EAAE,OAAO,CAAC,MAAM,GAAG,EAAE,MAAM,CAAC,CAAA;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,MAAM,0BAA0B,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI;IAC9E,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,oBAAoB,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI,CACxE,MAAM,EAAE,kCAAkC,KACvC,OAAO,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC,CAAA;AAE7C,MAAM,MAAM,yBAAyB,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA"}
@@ -1,42 +0,0 @@
1
- interface GridRowRange {
2
- startRow: number;
3
- endRow: number;
4
- }
5
- interface CursorBlock {
6
- blockIndex: number;
7
- pageSize: number;
8
- }
9
- /**
10
- * Resolves AG Grid's zero-based, half-open row range into a cursor block.
11
- *
12
- * AG Grid passes `startRow` as inclusive and `endRow` as exclusive. It does not
13
- * pass a block index directly, so derive it from the range before calling
14
- * TableDataGrid's cursor-based fetcher.
15
- *
16
- * @param startRow AG Grid's inclusive row start for the requested block.
17
- * @param endRow AG Grid's exclusive row end for the requested block.
18
- * @returns Cursor block index and page size derived from AG Grid's row range.
19
- */
20
- export declare const getCursorBlock: ({ startRow, endRow }: GridRowRange) => CursorBlock;
21
- /**
22
- * Translates TableDataGrid fetch metadata into AG Grid's `lastRow` signal.
23
- *
24
- * An undefined value tells AG Grid to keep requesting more blocks. A number
25
- * tells AG Grid the absolute row index where the dataset ends.
26
- *
27
- * @param startRow AG Grid's inclusive row start for the fetched block.
28
- * @param rowsLength Number of rows returned by the TableDataGrid fetcher.
29
- * @param pageSize Requested block size derived from AG Grid's row range.
30
- * @param total Optional known total row count from the backend.
31
- * @param hasMore Optional backend signal for whether another block exists.
32
- * @returns AG Grid `lastRow` value, or undefined when more blocks may exist.
33
- */
34
- export declare const resolveInfiniteLastRow: ({ startRow, rowsLength, pageSize, total, hasMore, }: {
35
- startRow: number;
36
- rowsLength: number;
37
- pageSize: number;
38
- total?: number;
39
- hasMore?: boolean;
40
- }) => number | undefined;
41
- export {};
42
- //# sourceMappingURL=fetchers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchers.d.ts","sourceRoot":"","sources":["../../../src/utils/fetchers.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,sBAAsB,YAAY,KAAG,WAOnE,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,GAAI,qDAMpC;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,KAAG,MAAM,GAAG,SAcZ,CAAA"}