@kong-ui-public/table-data-grid 0.5.2 → 0.5.3-pr.3819.04ffe7eda.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.
Files changed (32) hide show
  1. package/package.json +1 -1
  2. package/dist/style.css +0 -1
  3. package/dist/table-data-grid.es.js +0 -517
  4. package/dist/table-data-grid.umd.js +0 -1
  5. package/dist/types/components/TableDataGrid.vue.d.ts +0 -46
  6. package/dist/types/components/TableDataGrid.vue.d.ts.map +0 -1
  7. package/dist/types/components/TableDataGridCellRenderer.vue.d.ts +0 -22
  8. package/dist/types/components/TableDataGridCellRenderer.vue.d.ts.map +0 -1
  9. package/dist/types/composables/useEmitState.d.ts +0 -11
  10. package/dist/types/composables/useEmitState.d.ts.map +0 -1
  11. package/dist/types/composables/useFetchInfinite.d.ts +0 -52
  12. package/dist/types/composables/useFetchInfinite.d.ts.map +0 -1
  13. package/dist/types/composables/useFetchState.d.ts +0 -30
  14. package/dist/types/composables/useFetchState.d.ts.map +0 -1
  15. package/dist/types/composables/useI18n.d.ts +0 -9
  16. package/dist/types/composables/useI18n.d.ts.map +0 -1
  17. package/dist/types/composables/useTableDataGridColumnDefs.d.ts +0 -22
  18. package/dist/types/composables/useTableDataGridColumnDefs.d.ts.map +0 -1
  19. package/dist/types/composables/useTableDataGridConfig.d.ts +0 -34
  20. package/dist/types/composables/useTableDataGridConfig.d.ts.map +0 -1
  21. package/dist/types/composables/useTableDataGridInteractions.d.ts +0 -17
  22. package/dist/types/composables/useTableDataGridInteractions.d.ts.map +0 -1
  23. package/dist/types/composables/useTableDataGridSort.d.ts +0 -20
  24. package/dist/types/composables/useTableDataGridSort.d.ts.map +0 -1
  25. package/dist/types/index.d.ts +0 -4
  26. package/dist/types/index.d.ts.map +0 -1
  27. package/dist/types/types/index.d.ts +0 -67
  28. package/dist/types/types/index.d.ts.map +0 -1
  29. package/dist/types/utils/fetchers.d.ts +0 -42
  30. package/dist/types/utils/fetchers.d.ts.map +0 -1
  31. package/dist/types/utils/tableConfig.d.ts +0 -25
  32. package/dist/types/utils/tableConfig.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/table-data-grid",
3
- "version": "0.5.2",
3
+ "version": "0.5.3-pr.3819.04ffe7eda.0",
4
4
  "type": "module",
5
5
  "main": "./dist/table-data-grid.umd.js",
6
6
  "module": "./dist/table-data-grid.es.js",
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-d8328fe5]{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-d8328fe5]{--ag-background-color: var(--kui-color-background, #ffffff);--ag-border-color: var(--kui-color-border, #e0e4ea);--ag-foreground-color: var(--kui-color-text, #0d0e14);--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,517 +0,0 @@
1
- import { computed as S, watch as B, ref as E, shallowRef as G, readonly as x, defineComponent as $, onMounted as j, onUnmounted as H, nextTick as Q, resolveComponent as q, openBlock as I, createBlock as P, resolveDynamicComponent as J, createElementBlock as N, createVNode as L, withCtx as X, createElementVNode as Y, toDisplayString as Z, useSlots as ee, toRef as O, renderSlot as V, unref as y } from "vue";
2
- import { AgGridVue as te } from "ag-grid-vue3";
3
- import { ModuleRegistry as oe, AllCommunityModule as ae, InfiniteRowModelModule as le, themeQuartz as re } from "ag-grid-community";
4
- import { createI18n as ne, i18nTComponent as se } from "@kong-ui-public/i18n";
5
- var T = /* @__PURE__ */ ((e) => (e.PENDING = "PENDING", e.LOADING = "LOADING", e.SUCCESS = "SUCCESS", e.ERROR = "ERROR", e))(T || {});
6
- const ie = (e) => !!e?.length;
7
- function ce(e, r, t, l = ie) {
8
- const n = S(() => l(e.value)), i = S(() => {
9
- const f = e.value !== void 0, a = r.value !== void 0 && r.value !== null;
10
- return t.value ? "LOADING" : n.value ? "SUCCESS" : a ? "ERROR" : f ? "SUCCESS" : "PENDING";
11
- });
12
- return {
13
- fetchState: T,
14
- hasData: n,
15
- state: i
16
- };
17
- }
18
- const ue = ({
19
- emitState: e,
20
- fetchLifecycleState: r,
21
- hasData: t
22
- }) => {
23
- B(
24
- () => ({
25
- hasData: t.value,
26
- state: r.value
27
- }),
28
- ({ hasData: l, state: n }) => {
29
- if (n !== T.PENDING) {
30
- if (n === T.LOADING) {
31
- e({
32
- hasData: l,
33
- state: "loading"
34
- });
35
- return;
36
- }
37
- if (n === T.ERROR) {
38
- e({
39
- hasData: l,
40
- state: "error"
41
- });
42
- return;
43
- }
44
- e({
45
- hasData: l,
46
- state: "success"
47
- });
48
- }
49
- }
50
- );
51
- }, de = ({ startRow: e, endRow: r }) => {
52
- const t = r - e;
53
- return {
54
- blockIndex: t > 0 ? Math.floor(e / t) : 0,
55
- pageSize: t
56
- };
57
- }, me = ({
58
- startRow: e,
59
- rowsLength: r,
60
- pageSize: t,
61
- total: l,
62
- hasMore: n
63
- }) => {
64
- if (typeof l == "number")
65
- return l;
66
- if (n !== !0 && (n === !1 || r < t))
67
- return e + r;
68
- }, fe = ({
69
- fetcher: e,
70
- resetKey: r,
71
- sort: t
72
- }) => {
73
- const l = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = E(0), o = G(), f = G(), a = G(), s = E(0), v = E(!1), g = (c) => c === i.value, k = () => {
74
- v.value = s.value > 0;
75
- }, D = () => {
76
- a.value = void 0, s.value += 1, k();
77
- }, w = () => {
78
- s.value = Math.max(0, s.value - 1), k();
79
- }, C = (c) => {
80
- const u = n.get(c);
81
- if (u)
82
- return u;
83
- let d;
84
- const h = {
85
- promise: new Promise((m) => {
86
- d = m;
87
- }),
88
- resolve: (m) => d(m)
89
- };
90
- return n.set(c, h), h;
91
- }, b = (c, u) => {
92
- u.resolve(!1), n.get(c) === u && n.delete(c);
93
- }, K = async ({
94
- blockIndex: c,
95
- currentBlockCompletion: u,
96
- datasourceId: d
97
- }) => {
98
- if (c === 0)
99
- return "ready";
100
- const h = n.get(c - 1);
101
- if (!h)
102
- return b(c, u), "failed";
103
- const m = await h.promise;
104
- return g(d) ? m ? "ready" : (b(c, u), "failed") : (b(c, u), "stale");
105
- }, M = ({
106
- blockIndex: c,
107
- currentBlockCompletion: u,
108
- getRowsParams: d,
109
- pageSize: h,
110
- result: m
111
- }) => {
112
- m.cursor !== void 0 && l.set(c, m.cursor), d.successCallback(m.data, me({
113
- startRow: d.startRow,
114
- rowsLength: m.data.length,
115
- pageSize: h,
116
- total: m.total,
117
- hasMore: m.hasMore
118
- })), d.startRow === 0 && (f.value = m.data), u.resolve(!0);
119
- }, _ = ({
120
- blockIndex: c,
121
- currentBlockCompletion: u,
122
- fetchError: d,
123
- getRowsParams: h
124
- }) => {
125
- a.value = d, h.failCallback(), b(c, u);
126
- }, A = () => {
127
- const c = i.value + 1;
128
- return i.value = c, l.clear(), n.clear(), f.value = void 0, a.value = void 0, s.value = 0, k(), {
129
- async getRows(u) {
130
- const {
131
- blockIndex: d,
132
- pageSize: h
133
- } = de({
134
- startRow: u.startRow,
135
- endRow: u.endRow
136
- }), m = C(d);
137
- if (await K({
138
- blockIndex: d,
139
- currentBlockCompletion: m,
140
- datasourceId: c
141
- }) !== "ready") {
142
- u.failCallback();
143
- return;
144
- }
145
- g(c) && D();
146
- try {
147
- const R = d > 0 ? l.get(d - 1) : void 0, z = await e({
148
- mode: "infinite",
149
- pageSize: h,
150
- cursor: R,
151
- // Always read the latest sort, not a stale one.
152
- sort: t?.value
153
- });
154
- if (!g(c)) {
155
- u.failCallback(), b(d, m);
156
- return;
157
- }
158
- M({
159
- blockIndex: d,
160
- currentBlockCompletion: m,
161
- getRowsParams: u,
162
- pageSize: h,
163
- result: z
164
- });
165
- } catch (R) {
166
- if (!g(c)) {
167
- u.failCallback(), b(d, m);
168
- return;
169
- }
170
- _({
171
- blockIndex: d,
172
- currentBlockCompletion: m,
173
- fetchError: R,
174
- getRowsParams: u
175
- });
176
- } finally {
177
- g(c) && w();
178
- }
179
- }
180
- };
181
- }, F = () => {
182
- o.value = A();
183
- };
184
- return B(
185
- () => r?.value,
186
- () => {
187
- F();
188
- },
189
- { immediate: !0 }
190
- ), {
191
- datasource: x(o),
192
- data: x(f),
193
- error: x(a),
194
- isFetching: x(v)
195
- };
196
- }, ve = {
197
- key: 1,
198
- class: "table-data-grid-cell-renderer"
199
- }, Ce = /* @__PURE__ */ $({
200
- name: "TableDataGridCellRenderer",
201
- __name: "TableDataGridCellRenderer",
202
- props: {
203
- params: {}
204
- },
205
- setup(e, { expose: r }) {
206
- const t = G(e.params), l = E(null), n = E(!1), i = S(() => t.value.valueFormatted ?? String(t.value.value ?? "")), o = S(() => {
207
- const C = t.value.colDef?.colId;
208
- return C ? t.value.context?.cells?.slots?.[C] : void 0;
209
- }), f = S(() => ({
210
- column: t.value.headerDef,
211
- refreshCell: () => {
212
- const C = t.value.node;
213
- C && t.value.api.refreshCells({ force: !0, rowNodes: [C] });
214
- },
215
- row: t.value.data ?? {},
216
- rowIndex: t.value.node?.rowIndex ?? 0,
217
- rowValue: t.value.value,
218
- selected: t.value.node?.isSelected() ?? !1
219
- })), a = () => o.value?.(f.value);
220
- let s, v, g = !1;
221
- const k = () => {
222
- const C = l.value;
223
- n.value = !!C && C.scrollWidth > C.clientWidth;
224
- }, D = () => {
225
- g || (v !== void 0 && cancelAnimationFrame(v), v = requestAnimationFrame(() => {
226
- v = void 0, k();
227
- }));
228
- }, w = (C) => {
229
- if (s?.disconnect(), C) {
230
- s?.observe(C);
231
- const b = C.closest(".ag-cell");
232
- b && s?.observe(b);
233
- }
234
- D();
235
- };
236
- return j(() => {
237
- s = new ResizeObserver(D), w(l.value);
238
- }), B(l, w, { flush: "post" }), H(() => {
239
- g = !0, s?.disconnect(), v !== void 0 && cancelAnimationFrame(v);
240
- }), r({
241
- refresh(C) {
242
- return t.value = C, Q(D), !0;
243
- }
244
- }), (C, b) => {
245
- const K = q("KTooltip");
246
- return o.value ? (I(), P(J(a), { key: 0 })) : (I(), N("span", ve, [
247
- L(K, {
248
- class: "table-data-grid-cell-tooltip",
249
- disabled: !n.value,
250
- "kpop-attributes": { popoverDelay: 400 },
251
- "max-width": "300",
252
- placement: "bottom-start",
253
- target: "body",
254
- text: i.value
255
- }, {
256
- default: X(() => [
257
- Y("span", {
258
- ref_key: "contentElement",
259
- ref: l,
260
- class: "table-data-grid-cell-content"
261
- }, Z(i.value), 513)
262
- ]),
263
- _: 1
264
- }, 8, ["disabled", "text"])
265
- ]));
266
- };
267
- }
268
- }), pe = ({
269
- headers: e,
270
- slots: r,
271
- initialSort: t
272
- }) => {
273
- const l = S(() => ({
274
- cells: { slots: r }
275
- })), n = (o) => {
276
- const f = t?.sortColumnKey === o.key;
277
- return {
278
- colId: o.key,
279
- // Columns with no explicit width constraint share remaining space equally.
280
- flex: !o.width && !o.maxWidth ? 1 : void 0,
281
- headerName: o.label,
282
- maxWidth: o.maxWidth,
283
- minWidth: o.minWidth,
284
- sortable: o.sortable ?? !1,
285
- unSortIcon: o.showSortIcon,
286
- ...f ? { initialSort: t?.sortColumnOrder, initialSortIndex: 0 } : {},
287
- valueGetter: (a) => a.data?.[o.key],
288
- width: o.width,
289
- cellRenderer: Ce,
290
- // custom params passed to the cell renderer.
291
- cellRendererParams: { headerDef: o }
292
- };
293
- };
294
- return {
295
- columnDefs: S(() => e.value.map(n)),
296
- gridContext: l
297
- };
298
- }, U = ({
299
- config: e,
300
- headers: r,
301
- pageSize: t
302
- }) => {
303
- const l = new Set(r.filter((i) => i.sortable).map((i) => i.key)), n = e?.sortColumnKey && l.has(e.sortColumnKey) ? e.sortColumnKey : void 0;
304
- return {
305
- sortColumnKey: n,
306
- sortColumnOrder: n ? e?.sortColumnOrder : void 0,
307
- pageSize: e?.pageSize ?? t
308
- };
309
- }, W = (e, r) => e.sortColumnKey === r.sortColumnKey && e.sortColumnOrder === r.sortColumnOrder && e.pageSize === r.pageSize, ge = ({
310
- headers: e,
311
- pageSize: r,
312
- tableConfig: t,
313
- emitTableConfigUpdate: l,
314
- onExternalConfigChange: n
315
- }) => {
316
- const i = S(() => t.value ? U({ config: t.value, headers: e.value, pageSize: r.value }) : void 0), o = E(
317
- i.value ?? U({ config: void 0, headers: e.value, pageSize: r.value })
318
- );
319
- B(i, (v) => {
320
- v && !W(v, o.value) && (o.value = v, n?.(v));
321
- });
322
- const f = (v) => {
323
- const g = U({
324
- config: { ...o.value, ...v },
325
- headers: e.value,
326
- pageSize: r.value
327
- });
328
- W(g, o.value) || (o.value = g, l(g));
329
- }, a = S(() => ({
330
- sortColumnKey: o.value.sortColumnKey,
331
- sortColumnOrder: o.value.sortColumnOrder
332
- })), s = S(() => t.value?.pageSize ?? r.value);
333
- return {
334
- activeTableConfig: x(o),
335
- activeSort: a,
336
- activePageSize: s,
337
- patchTableConfig: f
338
- };
339
- }, he = ({
340
- cellClick: e,
341
- headers: r,
342
- rowClick: t
343
- }) => {
344
- const l = S(() => new Set(
345
- r.value.filter((a) => a.disableRowClick).map((a) => a.key)
346
- )), n = (a) => {
347
- const s = a.event?.target;
348
- return s instanceof Element ? s.closest(".ag-cell")?.getAttribute("col-id") ?? void 0 : void 0;
349
- }, i = (a) => {
350
- const s = n(a);
351
- return !!(s && l.value.has(s));
352
- };
353
- return {
354
- onCellClick: (a) => {
355
- const s = a.colDef.colId;
356
- !a.data || !s || e({
357
- columnKey: s,
358
- row: a.data,
359
- value: a.value
360
- });
361
- },
362
- onRowClick: (a) => {
363
- a.data && !i(a) && t(a.data, a);
364
- }
365
- };
366
- }, ye = ({
367
- activeSort: e,
368
- emitSort: r,
369
- patchTableConfig: t
370
- }) => {
371
- const l = (i, o) => {
372
- i.applyColumnState({
373
- state: o.sortColumnKey ? [{ colId: o.sortColumnKey, sort: o.sortColumnOrder ?? null, sortIndex: 0 }] : [],
374
- defaultState: { sort: null, sortIndex: null }
375
- });
376
- };
377
- return { onSortChanged: (i) => {
378
- const o = i.api.getColumnState().filter((s) => s.sort).sort((s, v) => (s.sortIndex ?? 0) - (v.sortIndex ?? 0)), f = o[o.length - 1], a = f ? { sortColumnKey: f.colId, sortColumnOrder: f.sort } : { sortColumnKey: void 0, sortColumnOrder: void 0 };
379
- a.sortColumnKey === e.value.sortColumnKey && a.sortColumnOrder === e.value.sortColumnOrder || (r(a), t(a), o.length > 1 && l(i.api, a));
380
- }, applySortToGrid: l };
381
- }, Se = { title: "No Data", message: "There is no data to display." }, be = { title: "An error occurred", message: "Data cannot be displayed due to an error." }, ke = {
382
- emptyState: Se,
383
- errorState: be
384
- };
385
- function De() {
386
- const e = ne("en-us", ke);
387
- return {
388
- i18n: e,
389
- i18nT: se(e)
390
- // Translation component <i18n-t>
391
- };
392
- }
393
- const we = {
394
- class: "kong-ui-public-table-data-grid",
395
- "data-testid": "table-data-grid"
396
- }, Re = {
397
- key: 0,
398
- class: "table-error-state",
399
- "data-testid": "table-error-state"
400
- }, Ie = {
401
- key: 1,
402
- class: "table-empty-state",
403
- "data-testid": "table-empty-state"
404
- }, Ee = /* @__PURE__ */ $({
405
- __name: "TableDataGrid",
406
- props: {
407
- headers: {},
408
- fetcher: { type: Function },
409
- error: { type: Boolean, default: !1 },
410
- pageSize: { default: 25 },
411
- refreshKey: { type: [String, Number, Boolean] },
412
- tableConfig: {}
413
- },
414
- emits: ["grid:ready", "state", "row:click", "cell:click", "sort", "update:tableConfig"],
415
- setup(e, { emit: r }) {
416
- oe.registerModules([ae, le]);
417
- const t = r, { i18n: { t: l } } = De(), n = ee(), i = G(), { activeTableConfig: o, activeSort: f, activePageSize: a, patchTableConfig: s } = ge({
418
- headers: O(() => e.headers),
419
- pageSize: O(() => e.pageSize),
420
- tableConfig: O(() => e.tableConfig),
421
- emitTableConfigUpdate: (p) => t("update:tableConfig", p),
422
- onExternalConfigChange: (p) => {
423
- i.value && g(i.value, p);
424
- }
425
- }), { onSortChanged: v, applySortToGrid: g } = ye({
426
- activeSort: f,
427
- emitSort: (p) => t("sort", p),
428
- patchTableConfig: s
429
- }), { columnDefs: k, gridContext: D } = pe({
430
- headers: O(() => e.headers),
431
- slots: n,
432
- initialSort: f.value
433
- }), { onCellClick: w, onRowClick: C } = he({
434
- cellClick: (p) => t("cell:click", p),
435
- headers: O(() => e.headers),
436
- rowClick: (p, R) => t("row:click", p, R)
437
- }), b = {
438
- resizable: !1,
439
- sortable: !1,
440
- suppressMovable: !0
441
- }, K = S(() => [
442
- e.fetcher,
443
- a.value,
444
- e.refreshKey,
445
- o.value.sortColumnKey,
446
- o.value.sortColumnOrder
447
- ]), {
448
- data: M,
449
- datasource: _,
450
- error: A,
451
- isFetching: F
452
- } = fe({
453
- fetcher: e.fetcher,
454
- resetKey: K,
455
- sort: f
456
- }), {
457
- fetchState: c,
458
- hasData: u,
459
- state: d
460
- } = ce(M, A, F), h = S(() => d.value === c.SUCCESS && !u.value);
461
- ue({
462
- emitState: (p) => t("state", p),
463
- fetchLifecycleState: d,
464
- hasData: u
465
- });
466
- const m = (p) => {
467
- i.value = p.api, t("grid:ready", p.api);
468
- };
469
- return (p, R) => {
470
- const z = q("KEmptyState");
471
- return I(), N("div", we, [
472
- e.error ? (I(), N("div", Re, [
473
- V(p.$slots, "error-state", {}, () => [
474
- L(z, {
475
- "icon-variant": "error",
476
- message: y(l)("errorState.message"),
477
- title: y(l)("errorState.title")
478
- }, null, 8, ["message", "title"])
479
- ], !0)
480
- ])) : h.value ? (I(), N("div", Ie, [
481
- V(p.$slots, "empty-state", {}, () => [
482
- L(z, {
483
- message: y(l)("emptyState.message"),
484
- title: y(l)("emptyState.title")
485
- }, null, 8, ["message", "title"])
486
- ], !0)
487
- ])) : (I(), P(y(te), {
488
- key: 2,
489
- "cache-block-size": y(a),
490
- class: "table-data-grid-grid",
491
- "column-defs": y(k),
492
- context: y(D),
493
- datasource: y(_),
494
- "default-col-def": b,
495
- "infinite-initial-row-count": 1,
496
- loading: y(F),
497
- "row-model-type": "infinite",
498
- "suppress-cell-focus": !0,
499
- "suppress-multi-sort": !0,
500
- theme: y(re),
501
- onCellClicked: y(w),
502
- onGridReady: m,
503
- onRowClicked: y(C),
504
- onSortChanged: y(v)
505
- }, null, 8, ["cache-block-size", "column-defs", "context", "datasource", "loading", "theme", "onCellClicked", "onRowClicked", "onSortChanged"]))
506
- ]);
507
- };
508
- }
509
- }), Ke = (e, r) => {
510
- const t = e.__vccOpts || e;
511
- for (const [l, n] of r)
512
- t[l] = n;
513
- return t;
514
- }, Fe = /* @__PURE__ */ Ke(Ee, [["__scopeId", "data-v-d8328fe5"]]);
515
- export {
516
- Fe as TableDataGrid
517
- };
@@ -1 +0,0 @@
1
- (function(b,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):(b=typeof globalThis<"u"?globalThis:b||self,e(b["kong-ui-public-table-data-grid"]={},b.Vue,b.AgGridVue,b.agGridCommunity,b["kong-ui-public-i18n"]))})(this,(function(b,e,_,K,F){"use strict";var E=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))(E||{});const M=t=>!!t?.length;function A(t,r,o,l=M){const s=e.computed(()=>l(t.value)),i=e.computed(()=>{const C=t.value!==void 0,n=r.value!==void 0&&r.value!==null;return o.value?"LOADING":s.value?"SUCCESS":n?"ERROR":C?"SUCCESS":"PENDING"});return{fetchState:E,hasData:s,state:i}}const V=({emitState:t,fetchLifecycleState:r,hasData:o})=>{e.watch(()=>({hasData:o.value,state:r.value}),({hasData:l,state:s})=>{if(s!==E.PENDING){if(s===E.LOADING){t({hasData:l,state:"loading"});return}if(s===E.ERROR){t({hasData:l,state:"error"});return}t({hasData:l,state:"success"})}})},U=({startRow:t,endRow:r})=>{const o=r-t;return{blockIndex:o>0?Math.floor(t/o):0,pageSize:o}},L=({startRow:t,rowsLength:r,pageSize:o,total:l,hasMore:s})=>{if(typeof l=="number")return l;if(s!==!0&&(s===!1||r<o))return t+r},W=({fetcher:t,resetKey:r,sort:o})=>{const l=new Map,s=new Map,i=e.ref(0),a=e.shallowRef(),C=e.shallowRef(),n=e.shallowRef(),c=e.ref(0),p=e.ref(!1),y=d=>d===i.value,v=()=>{p.value=c.value>0},w=()=>{n.value=void 0,c.value+=1,v()},D=()=>{c.value=Math.max(0,c.value-1),v()},g=d=>{const u=s.get(d);if(u)return u;let f;const S={promise:new Promise(m=>{f=m}),resolve:m=>f(m)};return s.set(d,S),S},k=(d,u)=>{u.resolve(!1),s.get(d)===u&&s.delete(d)},I=async({blockIndex:d,currentBlockCompletion:u,datasourceId:f})=>{if(d===0)return"ready";const S=s.get(d-1);if(!S)return k(d,u),"failed";const m=await S.promise;return y(f)?m?"ready":(k(d,u),"failed"):(k(d,u),"stale")},B=({blockIndex:d,currentBlockCompletion:u,getRowsParams:f,pageSize:S,result:m})=>{m.cursor!==void 0&&l.set(d,m.cursor),f.successCallback(m.data,L({startRow:f.startRow,rowsLength:m.data.length,pageSize:S,total:m.total,hasMore:m.hasMore})),f.startRow===0&&(C.value=m.data),u.resolve(!0)},G=({blockIndex:d,currentBlockCompletion:u,fetchError:f,getRowsParams:S})=>{n.value=f,S.failCallback(),k(d,u)},N=()=>{const d=i.value+1;return i.value=d,l.clear(),s.clear(),C.value=void 0,n.value=void 0,c.value=0,v(),{async getRows(u){const{blockIndex:f,pageSize:S}=U({startRow:u.startRow,endRow:u.endRow}),m=g(f);if(await I({blockIndex:f,currentBlockCompletion:m,datasourceId:d})!=="ready"){u.failCallback();return}y(d)&&w();try{const R=f>0?l.get(f-1):void 0,x=await t({mode:"infinite",pageSize:S,cursor:R,sort:o?.value});if(!y(d)){u.failCallback(),k(f,m);return}B({blockIndex:f,currentBlockCompletion:m,getRowsParams:u,pageSize:S,result:x})}catch(R){if(!y(d)){u.failCallback(),k(f,m);return}G({blockIndex:f,currentBlockCompletion:m,fetchError:R,getRowsParams:u})}finally{y(d)&&D()}}}},O=()=>{a.value=N()};return e.watch(()=>r?.value,()=>{O()},{immediate:!0}),{datasource:e.readonly(a),data:e.readonly(C),error:e.readonly(n),isFetching:e.readonly(p)}},q={key:1,class:"table-data-grid-cell-renderer"},$=e.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(t,{expose:r}){const o=e.shallowRef(t.params),l=e.ref(null),s=e.ref(!1),i=e.computed(()=>o.value.valueFormatted??String(o.value.value??"")),a=e.computed(()=>{const g=o.value.colDef?.colId;return g?o.value.context?.cells?.slots?.[g]:void 0}),C=e.computed(()=>({column:o.value.headerDef,refreshCell:()=>{const g=o.value.node;g&&o.value.api.refreshCells({force:!0,rowNodes:[g]})},row:o.value.data??{},rowIndex:o.value.node?.rowIndex??0,rowValue:o.value.value,selected:o.value.node?.isSelected()??!1})),n=()=>a.value?.(C.value);let c,p,y=!1;const v=()=>{const g=l.value;s.value=!!g&&g.scrollWidth>g.clientWidth},w=()=>{y||(p!==void 0&&cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=void 0,v()}))},D=g=>{if(c?.disconnect(),g){c?.observe(g);const k=g.closest(".ag-cell");k&&c?.observe(k)}w()};return e.onMounted(()=>{c=new ResizeObserver(w),D(l.value)}),e.watch(l,D,{flush:"post"}),e.onUnmounted(()=>{y=!0,c?.disconnect(),p!==void 0&&cancelAnimationFrame(p)}),r({refresh(g){return o.value=g,e.nextTick(w),!0}}),(g,k)=>{const I=e.resolveComponent("KTooltip");return a.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n),{key:0})):(e.openBlock(),e.createElementBlock("span",q,[e.createVNode(I,{class:"table-data-grid-cell-tooltip",disabled:!s.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:"body",text:i.value},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"contentElement",ref:l,class:"table-data-grid-cell-content"},e.toDisplayString(i.value),513)]),_:1},8,["disabled","text"])]))}}}),j=({headers:t,slots:r,initialSort:o})=>{const l=e.computed(()=>({cells:{slots:r}})),s=a=>{const C=o?.sortColumnKey===a.key;return{colId:a.key,flex:!a.width&&!a.maxWidth?1:void 0,headerName:a.label,maxWidth:a.maxWidth,minWidth:a.minWidth,sortable:a.sortable??!1,unSortIcon:a.showSortIcon,...C?{initialSort:o?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:n=>n.data?.[a.key],width:a.width,cellRenderer:$,cellRendererParams:{headerDef:a}}};return{columnDefs:e.computed(()=>t.value.map(s)),gridContext:l}},T=({config:t,headers:r,pageSize:o})=>{const l=new Set(r.filter(i=>i.sortable).map(i=>i.key)),s=t?.sortColumnKey&&l.has(t.sortColumnKey)?t.sortColumnKey:void 0;return{sortColumnKey:s,sortColumnOrder:s?t?.sortColumnOrder:void 0,pageSize:t?.pageSize??o}},z=(t,r)=>t.sortColumnKey===r.sortColumnKey&&t.sortColumnOrder===r.sortColumnOrder&&t.pageSize===r.pageSize,P=({headers:t,pageSize:r,tableConfig:o,emitTableConfigUpdate:l,onExternalConfigChange:s})=>{const i=e.computed(()=>o.value?T({config:o.value,headers:t.value,pageSize:r.value}):void 0),a=e.ref(i.value??T({config:void 0,headers:t.value,pageSize:r.value}));e.watch(i,p=>{p&&!z(p,a.value)&&(a.value=p,s?.(p))});const C=p=>{const y=T({config:{...a.value,...p},headers:t.value,pageSize:r.value});z(y,a.value)||(a.value=y,l(y))},n=e.computed(()=>({sortColumnKey:a.value.sortColumnKey,sortColumnOrder:a.value.sortColumnOrder})),c=e.computed(()=>o.value?.pageSize??r.value);return{activeTableConfig:e.readonly(a),activeSort:n,activePageSize:c,patchTableConfig:C}},H=({cellClick:t,headers:r,rowClick:o})=>{const l=e.computed(()=>new Set(r.value.filter(n=>n.disableRowClick).map(n=>n.key))),s=n=>{const c=n.event?.target;return c instanceof Element?c.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},i=n=>{const c=s(n);return!!(c&&l.value.has(c))};return{onCellClick:n=>{const c=n.colDef.colId;!n.data||!c||t({columnKey:c,row:n.data,value:n.value})},onRowClick:n=>{n.data&&!i(n)&&o(n.data,n)}}},Q=({activeSort:t,emitSort:r,patchTableConfig:o})=>{const l=(i,a)=>{i.applyColumnState({state:a.sortColumnKey?[{colId:a.sortColumnKey,sort:a.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const a=i.api.getColumnState().filter(c=>c.sort).sort((c,p)=>(c.sortIndex??0)-(p.sortIndex??0)),C=a[a.length-1],n=C?{sortColumnKey:C.colId,sortColumnOrder:C.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};n.sortColumnKey===t.value.sortColumnKey&&n.sortColumnOrder===t.value.sortColumnOrder||(r(n),o(n),a.length>1&&l(i.api,n))},applySortToGrid:l}},J={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 X(){const t=F.createI18n("en-us",J);return{i18n:t,i18nT:F.i18nTComponent(t)}}const Y={class:"kong-ui-public-table-data-grid","data-testid":"table-data-grid"},Z={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,r)=>{const o=t.__vccOpts||t;for(const[l,s]of r)o[l]=s;return o})(e.defineComponent({__name:"TableDataGrid",props:{headers:{},fetcher:{type:Function},error:{type:Boolean,default:!1},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},tableConfig:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(t,{emit:r}){K.ModuleRegistry.registerModules([K.AllCommunityModule,K.InfiniteRowModelModule]);const o=r,{i18n:{t:l}}=X(),s=e.useSlots(),i=e.shallowRef(),{activeTableConfig:a,activeSort:C,activePageSize:n,patchTableConfig:c}=P({headers:e.toRef(()=>t.headers),pageSize:e.toRef(()=>t.pageSize),tableConfig:e.toRef(()=>t.tableConfig),emitTableConfigUpdate:h=>o("update:tableConfig",h),onExternalConfigChange:h=>{i.value&&y(i.value,h)}}),{onSortChanged:p,applySortToGrid:y}=Q({activeSort:C,emitSort:h=>o("sort",h),patchTableConfig:c}),{columnDefs:v,gridContext:w}=j({headers:e.toRef(()=>t.headers),slots:s,initialSort:C.value}),{onCellClick:D,onRowClick:g}=H({cellClick:h=>o("cell:click",h),headers:e.toRef(()=>t.headers),rowClick:(h,R)=>o("row:click",h,R)}),k={resizable:!1,sortable:!1,suppressMovable:!0},I=e.computed(()=>[t.fetcher,n.value,t.refreshKey,a.value.sortColumnKey,a.value.sortColumnOrder]),{data:B,datasource:G,error:N,isFetching:O}=W({fetcher:t.fetcher,resetKey:I,sort:C}),{fetchState:d,hasData:u,state:f}=A(B,N,O),S=e.computed(()=>f.value===d.SUCCESS&&!u.value);V({emitState:h=>o("state",h),fetchLifecycleState:f,hasData:u});const m=h=>{i.value=h.api,o("grid:ready",h.api)};return(h,R)=>{const x=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",Y,[t.error?(e.openBlock(),e.createElementBlock("div",Z,[e.renderSlot(h.$slots,"error-state",{},()=>[e.createVNode(x,{"icon-variant":"error",message:e.unref(l)("errorState.message"),title:e.unref(l)("errorState.title")},null,8,["message","title"])],!0)])):S.value?(e.openBlock(),e.createElementBlock("div",ee,[e.renderSlot(h.$slots,"empty-state",{},()=>[e.createVNode(x,{message:e.unref(l)("emptyState.message"),title:e.unref(l)("emptyState.title")},null,8,["message","title"])],!0)])):(e.openBlock(),e.createBlock(e.unref(_.AgGridVue),{key:2,"cache-block-size":e.unref(n),class:"table-data-grid-grid","column-defs":e.unref(v),context:e.unref(w),datasource:e.unref(G),"default-col-def":k,"infinite-initial-row-count":1,loading:e.unref(O),"row-model-type":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:e.unref(K.themeQuartz),onCellClicked:e.unref(D),onGridReady:m,onRowClicked:e.unref(g),onSortChanged:e.unref(p)},null,8,["cache-block-size","column-defs","context","datasource","loading","theme","onCellClicked","onRowClicked","onSortChanged"]))])}}}),[["__scopeId","data-v-d8328fe5"]]);b.TableDataGrid=te,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
@@ -1,46 +0,0 @@
1
- import type { TableDataGridCellClickPayload, TableDataGridCellSlotProps, TableDataGridConfig, TableDataGridFetcher, TableDataGridHeader, TableDataGridSort, TableDataGridStatePayload } from '../types';
2
- import type { GridApi, GridReadyEvent, RowClickedEvent } 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
- tableConfig?: TableDataGridConfig;
11
- } & {
12
- onState?: ((payload: TableDataGridStatePayload) => any) | undefined;
13
- onSort?: ((payload: TableDataGridSort) => any) | undefined;
14
- "onGrid:ready"?: ((api: GridApi<Row>) => any) | undefined;
15
- "onCell:click"?: ((payload: TableDataGridCellClickPayload<Row>) => any) | undefined;
16
- "onUpdate:tableConfig"?: ((payload: TableDataGridConfig) => any) | undefined;
17
- "onRow:click"?: ((row: Row, event: RowClickedEvent<Row, any>) => any) | undefined;
18
- }> & (typeof globalThis extends {
19
- __VLS_PROPS_FALLBACK: infer P;
20
- } ? P : {});
21
- expose: (exposed: {}) => void;
22
- attrs: any;
23
- slots: {
24
- [columnKey: string]: (props: TableDataGridCellSlotProps<Row>) => unknown;
25
- 'empty-state': () => unknown;
26
- 'error-state': () => unknown;
27
- };
28
- emit: {
29
- (e: "grid:ready", api: GridReadyEvent<Row>["api"]): void;
30
- (e: "state", payload: TableDataGridStatePayload): void;
31
- (e: "row:click", row: Row, event: RowClickedEvent<Row>): void;
32
- (e: "cell:click", payload: TableDataGridCellClickPayload<Row>): void;
33
- (e: "sort", payload: TableDataGridSort): void;
34
- (e: "update:tableConfig", payload: TableDataGridConfig): void;
35
- };
36
- }>) => import("vue").VNode & {
37
- __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
38
- };
39
- declare const _default: typeof __VLS_export;
40
- export default _default;
41
- type __VLS_PrettifyLocal<T> = (T extends any ? {
42
- [K in keyof T]: T[K];
43
- } : {
44
- [K in keyof T as K]: T[K];
45
- }) & {};
46
- //# 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":"AAgQA,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAEV,OAAO,EACP,cAAc,EACd,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAkB1B,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;WA0RO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;iBAtR7C,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;iBAC/B,oBAAoB,CAAC,GAAG,CAAC;gBAC1B,OAAO;mBACJ,MAAM;qBACJ,MAAM,GAAG,MAAM,GAAG,OAAO;sBACxB,mBAAmB;;;;;;;;KAiRwD,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;;qCApQoB,0BAA0B,CAAC,GAAG,CAAC,KAAK,OAAO;uBAFzD,MAAM,OAAO;uBACb,MAAM,OAAO;;;YAMxB,YAAY,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI;YACpD,OAAO,WAAW,yBAAyB,GAAG,IAAI;YAClD,WAAW,OAAO,GAAG,SAAS,eAAe,CAAC,GAAG,CAAC,GAAG,IAAI;YACzD,YAAY,WAAW,6BAA6B,CAAC,GAAG,CAAC,GAAG,IAAI;YAChE,MAAM,WAAW,iBAAiB,GAAG,IAAI;YACzC,oBAAoB,WAAW,mBAAmB,GAAG,IAAI;;EA8P3D,KACQ,OAAO,KAAK,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"}
@@ -1,22 +0,0 @@
1
- import type { TableDataGridHeader } from '../types';
2
- import type { ICellRendererParams } from 'ag-grid-community';
3
- import type { Slots } from 'vue';
4
- type CellRendererParams = ICellRendererParams<Record<string, unknown>> & {
5
- /** Set internally via `cellRendererParams` so the renderer can resolve the
6
- * host slot and build its payload without leaking AG Grid's own `column`. */
7
- headerDef?: TableDataGridHeader;
8
- context?: {
9
- cells?: {
10
- slots?: Slots;
11
- };
12
- };
13
- };
14
- type __VLS_Props = {
15
- params: CellRendererParams;
16
- };
17
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
18
- refresh(nextParams: CellRendererParams): boolean;
19
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
- declare const _default: typeof __VLS_export;
21
- export default _default;
22
- //# 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":"AAyKA,OAAO,KAAK,EAA8B,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAGhC,KAAK,kBAAkB,GAAG,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACvE;iFAC6E;IAC7E,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,KAAK,CAAA;SAAE,CAAA;KAAE,CAAA;CACxC,CAAA;AAMD,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,kBAAkB,CAAA;CAC3B,CAAC;AAsLF,QAAA,MAAM,YAAY;wBArFI,kBAAkB;oPAwFtC,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,52 +0,0 @@
1
- import type { TableDataGridFetcher, TableDataGridRow, TableDataGridSort } 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
- * Current resolved sort, forwarded to the fetcher.
17
- */
18
- sort?: Readonly<Ref<TableDataGridSort | undefined>>;
19
- }
20
- /**
21
- * Owns AG Grid infinite datasource creation and cursor-backed fetch
22
- * orchestration for TableDataGrid.
23
- *
24
- * Callers provide the public fetcher and an optional reset key, then observe
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
27
- * private to this composable so component code cannot mutate fetch lifecycle
28
- * state directly.
29
- *
30
- * @param fetcher Host-supplied fetcher that uses TableDataGrid's cursor-first
31
- * infinite mode contract.
32
- * @param resetKey Optional reactive invalidation key that rebuilds the
33
- * datasource and restarts the cursor chain.
34
- * @returns Readonly datasource, first-block data, error, and fetching state
35
- * refs for the active AG Grid infinite datasource.
36
- */
37
- export declare const useFetchInfinite: <Row extends object = TableDataGridRow>({ fetcher, resetKey, sort, }: UseFetchInfiniteOptions<Row>) => {
38
- datasource: Readonly<Ref<{
39
- readonly rowCount?: number | undefined;
40
- readonly getRows: (params: IGetRowsParams) => void;
41
- readonly destroy?: (() => void) | undefined;
42
- } | undefined, {
43
- readonly rowCount?: number | undefined;
44
- readonly getRows: (params: IGetRowsParams) => void;
45
- readonly destroy?: (() => void) | undefined;
46
- } | undefined>>;
47
- data: Readonly<Ref<readonly import("vue").DeepReadonly<Row>[] | undefined, readonly import("vue").DeepReadonly<Row>[] | undefined>>;
48
- error: Readonly<Ref<Readonly<unknown>, Readonly<unknown>>>;
49
- isFetching: Readonly<Ref<boolean, boolean>>;
50
- };
51
- export {};
52
- //# 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,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,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;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC,CAAA;CACpD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,8BAIrE,uBAAuB,CAAC,GAAG,CAAC;;;;;;;;;;;;;CAsU9B,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,22 +0,0 @@
1
- import type { TableDataGridHeader, TableDataGridRow, TableDataGridSort } from '../types';
2
- import type { ColDef } from 'ag-grid-community';
3
- import type { Ref, Slots } from 'vue';
4
- /**
5
- * Converts `headers` into what AG Grid needs to render the table's columns:
6
- * the column definitions themselves, and the shared grid `context`.
7
- */
8
- export declare const useTableDataGridColumnDefs: <Row extends object = TableDataGridRow>({ headers, slots, initialSort, }: {
9
- headers: Readonly<Ref<Array<TableDataGridHeader<Row>>>>;
10
- slots: Slots;
11
- initialSort?: TableDataGridSort;
12
- }) => {
13
- columnDefs: import("vue").ComputedRef<ColDef<Row, any>[]>;
14
- gridContext: import("vue").ComputedRef<{
15
- cells: {
16
- slots: Readonly<{
17
- [name: string]: import("vue").Slot<any> | undefined;
18
- }>;
19
- };
20
- }>;
21
- };
22
- //# sourceMappingURL=useTableDataGridColumnDefs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTableDataGridColumnDefs.d.ts","sourceRoot":"","sources":["../../../src/composables/useTableDataGridColumnDefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AACxF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAIrC;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,kCAI/E;IACD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,KAAK,EAAE,KAAK,CAAA;IACZ,WAAW,CAAC,EAAE,iBAAiB,CAAA;CAChC;;;;;;;;;CAiCA,CAAA"}
@@ -1,34 +0,0 @@
1
- import type { TableDataGridConfig, TableDataGridHeader, TableDataGridRow, TableDataGridSort } from '../types';
2
- import type { Ref } from 'vue';
3
- /**
4
- * Owns `TableDataGrid`'s current `tableConfig` state, controlled or
5
- * uncontrolled, with `patchTableConfig` as the single write path for
6
- * grid-driven changes.
7
- *
8
- * @param headers Current column headers, used to validate the resolved sort key.
9
- * @param pageSize Reactive component-level page size default.
10
- * @param tableConfig Host-supplied `tableConfig` prop, or `undefined` when uncontrolled.
11
- * @param emitTableConfigUpdate Called with the resolved config whenever `patchTableConfig` changes it.
12
- * @param onExternalConfigChange Called when the host-supplied prop changes the resolved config.
13
- */
14
- export declare const useTableDataGridConfig: <Row extends object = TableDataGridRow>({ headers, pageSize, tableConfig: tableConfigProp, emitTableConfigUpdate, onExternalConfigChange, }: {
15
- headers: Readonly<Ref<Array<TableDataGridHeader<Row>>>>;
16
- pageSize: Readonly<Ref<number>>;
17
- tableConfig: Readonly<Ref<TableDataGridConfig | undefined>>;
18
- emitTableConfigUpdate: (config: TableDataGridConfig) => void;
19
- onExternalConfigChange?: (config: TableDataGridConfig) => void;
20
- }) => {
21
- activeTableConfig: Readonly<Ref<{
22
- readonly sortColumnKey?: string | undefined;
23
- readonly sortColumnOrder?: import("..").TableDataGridSortDirection | undefined;
24
- readonly pageSize?: number | undefined;
25
- }, {
26
- readonly sortColumnKey?: string | undefined;
27
- readonly sortColumnOrder?: import("..").TableDataGridSortDirection | undefined;
28
- readonly pageSize?: number | undefined;
29
- }>>;
30
- activeSort: import("vue").ComputedRef<TableDataGridSort>;
31
- activePageSize: import("vue").ComputedRef<number>;
32
- patchTableConfig: (patch: Partial<TableDataGridConfig>) => void;
33
- };
34
- //# sourceMappingURL=useTableDataGridConfig.d.ts.map
@@ -1 +0,0 @@
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,17 +0,0 @@
1
- import type { TableDataGridCellClickPayload, TableDataGridHeader, TableDataGridRow, TableDataGridRowClickPayload } from '../types';
2
- import type { CellClickedEvent, RowClickedEvent } from 'ag-grid-community';
3
- import type { Ref } from 'vue';
4
- /**
5
- * Converts AG Grid's row and cell click events into `TableDataGrid`'s own
6
- * row/cell interaction handlers, and governs how those interactions behave
7
- * (e.g. suppressing row clicks for columns marked `disableRowClick`).
8
- */
9
- export declare const useTableDataGridInteractions: <Row extends object = TableDataGridRow>({ cellClick, headers, rowClick, }: {
10
- cellClick: (payload: TableDataGridCellClickPayload<Row>) => void;
11
- headers: Readonly<Ref<Array<TableDataGridHeader<Row>>>>;
12
- rowClick: (row: TableDataGridRowClickPayload<Row>, event: RowClickedEvent<Row>) => void;
13
- }) => {
14
- onCellClick: (event: CellClickedEvent<Row>) => void;
15
- onRowClick: (event: RowClickedEvent<Row>) => void;
16
- };
17
- //# sourceMappingURL=useTableDataGridInteractions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTableDataGridInteractions.d.ts","sourceRoot":"","sources":["../../../src/composables/useTableDataGridInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,EAC7B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG9B;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,mCAIjF;IACD,SAAS,EAAE,CAAC,OAAO,EAAE,6BAA6B,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;IAChE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,QAAQ,EAAE,CAAC,GAAG,EAAE,4BAA4B,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;CACxF;yBA0B6B,gBAAgB,CAAC,GAAG,CAAC;wBANtB,eAAe,CAAC,GAAG,CAAC;CAwBhD,CAAA"}
@@ -1,20 +0,0 @@
1
- import type { TableDataGridRow, TableDataGridSort } from '../types';
2
- import type { GridApi, SortChangedEvent } from 'ag-grid-community';
3
- import type { Ref } from 'vue';
4
- /**
5
- * Translates AG Grid's `sortChanged` event into `TableDataGrid`'s `sort`
6
- * shape, and pushes a sort back onto the grid.
7
- *
8
- * @param activeSort Current resolved sort, read from `useTableDataGridConfig`.
9
- * @param emitSort Called with the new sort whenever a grid interaction changes it.
10
- * @param patchTableConfig Writes the new sort into the current `tableConfig`.
11
- */
12
- export declare const useTableDataGridSort: <Row extends object = TableDataGridRow>({ activeSort, emitSort, patchTableConfig, }: {
13
- activeSort: Readonly<Ref<TableDataGridSort>>;
14
- emitSort: (sort: TableDataGridSort) => void;
15
- patchTableConfig: (patch: Partial<TableDataGridSort>) => void;
16
- }) => {
17
- onSortChanged: (event: SortChangedEvent<Row>) => void;
18
- applySortToGrid: (api: GridApi<Row>, sort: TableDataGridSort) => void;
19
- };
20
- //# sourceMappingURL=useTableDataGridSort.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTableDataGridSort.d.ts","sourceRoot":"","sources":["../../../src/composables/useTableDataGridSort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAA8B,MAAM,UAAU,CAAA;AAC/F,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,6CAIzE;IACD,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC5C,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAC3C,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAC9D;2BAU+B,gBAAgB,CAAC,GAAG,CAAC;2BATrB,OAAO,CAAC,GAAG,CAAC,QAAQ,iBAAiB;CAqCpE,CAAA"}
@@ -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,67 +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 TableDataGridRowClickPayload<Row extends object = TableDataGridRow> = Row;
10
- export type TableDataGridCellClickPayload<Row extends object = TableDataGridRow> = {
11
- row: Row;
12
- columnKey: string;
13
- value: unknown;
14
- };
15
- export type TableDataGridCellSlotProps<Row extends object = TableDataGridRow> = {
16
- row: Row;
17
- rowValue: unknown;
18
- column: TableDataGridHeader<Row>;
19
- rowIndex: number;
20
- selected: boolean;
21
- /** Forces AG Grid to re-render this cell. */
22
- refreshCell: () => void;
23
- };
24
- export type TableDataGridHeader<Row extends object = TableDataGridRow> = {
25
- key: Extract<keyof Row, string>;
26
- label: string;
27
- width?: number;
28
- minWidth?: number;
29
- maxWidth?: number;
30
- /**
31
- * Disables the `row:click` emit for clicks landing inside this column's
32
- * cells, e.g. an actions column with its own buttons. AG Grid's own
33
- * selection/click mechanics are unaffected.
34
- */
35
- disableRowClick?: boolean;
36
- /** Enables sorting on this column via AG Grid's built-in header sort control. */
37
- sortable?: boolean;
38
- /**
39
- * Shows the unsorted sort icon on this column's header even when it isn't
40
- * the active sort, instead of only on hover or once sorted. Only relevant
41
- * when `sortable` is true.
42
- */
43
- showSortIcon?: boolean;
44
- };
45
- export type TableDataGridSortDirection = 'asc' | 'desc';
46
- export type TableDataGridSort = {
47
- sortColumnKey?: string;
48
- sortColumnOrder?: TableDataGridSortDirection;
49
- };
50
- export type TableDataGridConfig = TableDataGridSort & {
51
- pageSize?: number;
52
- };
53
- export interface TableDataGridInfiniteFetcherParams {
54
- mode: 'infinite';
55
- pageSize: number;
56
- cursor?: unknown;
57
- sort?: TableDataGridSort;
58
- }
59
- export type TableDataGridFetcherResult<Row extends object = TableDataGridRow> = {
60
- data: Row[];
61
- cursor?: unknown;
62
- total?: number;
63
- hasMore?: boolean;
64
- };
65
- export type TableDataGridFetcher<Row extends object = TableDataGridRow> = (params: TableDataGridInfiniteFetcherParams) => Promise<TableDataGridFetcherResult<Row>>;
66
- export type TableDataGridReadyPayload<Row extends object = TableDataGridRow> = GridApi<Row>;
67
- //# 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,4BAA4B,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI,GAAG,CAAA;AAErF,MAAM,MAAM,6BAA6B,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI;IACjF,GAAG,EAAE,GAAG,CAAA;IACR,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,0BAA0B,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI;IAC9E,GAAG,EAAE,GAAG,CAAA;IACR,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAA;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,6CAA6C;IAC7C,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB,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;IACjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,KAAK,GAAG,MAAM,CAAA;AAEvD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,0BAA0B,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG;IACpD,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;IAChB,IAAI,CAAC,EAAE,iBAAiB,CAAA;CACzB;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"}
@@ -1,25 +0,0 @@
1
- import type { TableDataGridConfig, TableDataGridHeader, TableDataGridRow } from '../types';
2
- /**
3
- * Resolves a host-supplied (or absent) `tableConfig` into a config the
4
- * component can trust: drops a `sortColumnKey` that no longer matches a
5
- * `sortable` header, and falls back `pageSize` to the component default.
6
- *
7
- * @param config Host-supplied table config, or `undefined` when uncontrolled.
8
- * @param headers Current column headers, used to validate the sort key.
9
- * @param pageSize Component-level page size default.
10
- * @returns A fully-resolved `TableDataGridConfig`.
11
- */
12
- export declare const resolveTableConfig: <Row extends object = TableDataGridRow>({ config, headers, pageSize, }: {
13
- config: TableDataGridConfig | undefined;
14
- headers: Array<TableDataGridHeader<Row>>;
15
- pageSize: number;
16
- }) => TableDataGridConfig;
17
- /**
18
- * Structural equality for two resolved `TableDataGridConfig` values.
19
- *
20
- * @param a First config to compare.
21
- * @param b Second config to compare.
22
- * @returns Whether every field matches, including `undefined` values.
23
- */
24
- export declare const tableConfigsEqual: (a: TableDataGridConfig, b: TableDataGridConfig) => boolean;
25
- //# sourceMappingURL=tableConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tableConfig.d.ts","sourceRoot":"","sources":["../../../src/utils/tableConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE1F;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,gCAIvE;IACD,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAA;IACvC,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAA;IACxC,QAAQ,EAAE,MAAM,CAAA;CACjB,KAAG,mBAWH,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,GAAG,mBAAmB,EAAE,GAAG,mBAAmB,KAAG,OAIlF,CAAA"}