@kong-ui-public/table-data-grid 0.5.3-pr.3854.e369e8f09.0 → 0.5.3

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/README.md CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  Reusable Vue wrapper around AG Grid for Kong table data grids.
4
4
 
5
- This package supports AG Grid infinite row loading with a cursor-first fetcher
6
- contract and complete-result loading through its client-side row model. It also
7
- provides basic column definitions, single-column sorting, empty/error
5
+ This package currently supports AG Grid infinite row loading with a cursor-first
6
+ fetcher contract, basic column definitions, single-column sorting, empty/error
8
7
  presentation states, and state lifecycle emits.
9
8
 
10
9
  ## Peer Dependencies
@@ -114,11 +113,10 @@ const handleState = (payload: TableDataGridStatePayload) => {
114
113
  | Prop | Type | Required | Default | Notes |
115
114
  | --- | --- | --- | --- | --- |
116
115
  | `headers` | `Array<TableDataGridHeader<Row>>` | Yes | - | Basic column definitions mapped to AG Grid columns. |
117
- | `fetcher` | `TableDataGridFetcher<Row> \| TableDataGridUnpaginatedFetcher<Row>` | Yes | - | Async row loader for the selected mode. |
118
- | `mode` | `'infinite' \| 'unpaginated'` | No | `'infinite'` | Selects the fetcher contract and AG Grid row model. |
116
+ | `fetcher` | `TableDataGridFetcher<Row>` | Yes | - | Async row loader called by the AG Grid infinite datasource. |
119
117
  | `error` | `boolean` | No | `false` | Host-controlled visible error state. Internal fetch failures emit state but do not render error UI unless this prop is true. |
120
118
  | `pageSize` | `number` | No | `25` | AG Grid cache block size and fetcher request size. `tableConfig.pageSize` wins when present. |
121
- | `refreshKey` | `string \| number \| boolean` | No | - | Parent invalidation signal that reloads the current result. |
119
+ | `refreshKey` | `string \| number \| boolean` | No | - | Parent invalidation signal that rebuilds the datasource from the beginning. |
122
120
  | `tableConfig` | `TableDataGridConfig` | No | - | Host-controlled current sort and page size. Restores a previously-chosen sort on mount, or moves it after mount, without a click. Uncontrolled (internal state) when omitted. |
123
121
 
124
122
  ## Fetcher Contract
@@ -163,36 +161,11 @@ the public fetcher contract.
163
161
  is omitted, `hasMore: false` or a response shorter than `pageSize` marks the last
164
162
  loaded row as the end of the dataset.
165
163
 
166
- For a complete result that must be loaded once and rendered without pagination,
167
- set `mode="unpaginated"`. The fetcher receives no page size, cursor, sort, or
168
- other pagination values, and its complete result is passed to AG Grid's internal
169
- client-side row model. Changing `refreshKey` or the fetcher starts one new
170
- request; scrolling through the result does not call the fetcher again.
171
-
172
- ```vue
173
- <TableDataGrid
174
- mode="unpaginated"
175
- :fetcher="fetchTopRows"
176
- :headers="headers"
177
- :refresh-key="refreshKey"
178
- />
179
-
180
- <script setup lang="ts">
181
- import type { TableDataGridUnpaginatedFetcher } from '@kong-ui-public/table-data-grid'
182
-
183
- const fetchTopRows: TableDataGridUnpaginatedFetcher<Row> = async () => ({
184
- data: await loadAllRows(),
185
- })
186
- </script>
187
- ```
188
-
189
164
  ## Refresh Behavior
190
165
 
191
166
  `refreshKey` is a parent-owned invalidation signal. Changing it rebuilds the
192
167
  infinite datasource, clears stored cursors, and starts again from the first
193
- block with `cursor: undefined`. In `unpaginated` mode it starts one new
194
- complete-result request instead and keeps the previous rows visible while that
195
- request is pending.
168
+ block with `cursor: undefined`.
196
169
 
197
170
  This reset is required for cursor APIs because cursor values are only valid
198
171
  relative to the response and query chain that produced them. Reusing a later
@@ -302,7 +275,7 @@ Columns without a matching slot render their raw `rowValue`.
302
275
  | `row` | `Row` | The full row record backing this cell. |
303
276
  | `rowValue` | `unknown` | `row[header.key]`. |
304
277
  | `column` | `TableDataGridHeader<Row>` | The header definition for this column. |
305
- | `rowIndex` | `number` | The row's index in the currently loaded result. |
278
+ | `rowIndex` | `number` | The row's index in the currently loaded block. |
306
279
  | `selected` | `boolean` | Whether the row is currently selected. |
307
280
  | `refreshCell` | `() => void` | Forces AG Grid to re-render this cell. |
308
281
 
@@ -311,7 +284,7 @@ Columns without a matching slot render their raw `rowValue`.
311
284
  | Event | Payload | When it fires |
312
285
  | --- | --- | --- |
313
286
  | `grid:ready` | `GridApi<Row>` | AG Grid is ready. |
314
- | `state` | `{ state: 'loading' \| 'success' \| 'error', hasData: boolean }` | Internal fetch lifecycle changes after fetching starts. |
287
+ | `state` | `{ state: 'loading' \| 'success' \| 'error', hasData: boolean }` | Internal fetch lifecycle changes after the datasource starts requesting rows. |
315
288
  | `row:click` | `(row: TableDataGridRowClickPayload<Row>, event: RowClickedEvent<Row>)` | A row is clicked, unless the click landed in a `disableRowClick` column. |
316
289
  | `cell:click` | `TableDataGridCellClickPayload<Row>` | Any cell is clicked, including cells in `disableRowClick` columns. |
317
290
  | `sort` | `TableDataGridSort` | The current single-column sort changes. Fires before `update:tableConfig`. |
@@ -321,7 +294,7 @@ Columns without a matching slot render their raw `rowValue`.
321
294
 
322
295
  | Slot | Purpose |
323
296
  | --- | --- |
324
- | `empty-state` | Replaces the default empty state after a successful empty result. |
297
+ | `empty-state` | Replaces the default empty state after a successful empty first block. |
325
298
  | `error-state` | Replaces the default visible error state when `error` is true. |
326
299
  | `[columnKey]` | Renders custom cell content for the column matching `header.key`. See [Custom Cell Content](#custom-cell-content). |
327
300
 
@@ -335,13 +308,9 @@ Columns without a matching slot render their raw `rowValue`.
335
308
  - `TableDataGridCellClickPayload`
336
309
  - `TableDataGridCellSlotProps`
337
310
  - `TableDataGridHeader`
338
- - `TableDataGridProps`
339
311
  - `TableDataGridInfiniteFetcherParams`
340
- - `TableDataGridUnpaginatedFetcherParams`
341
312
  - `TableDataGridFetcherResult`
342
313
  - `TableDataGridFetcher`
343
- - `TableDataGridUnpaginatedFetcherResult`
344
- - `TableDataGridUnpaginatedFetcher`
345
314
  - `TableDataGridReadyPayload`
346
315
  - `TableDataGridSortDirection`
347
316
  - `TableDataGridSort`
package/dist/style.css CHANGED
@@ -1 +1 @@
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-0ff95391]{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-0ff95391]{--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
+ .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,41 +1,40 @@
1
- import { computed as y, watch as G, ref as I, shallowRef as E, readonly as R, getCurrentScope as oe, onScopeDispose as ae, defineComponent as Q, onMounted as ne, onUnmounted as le, nextTick as re, resolveComponent as J, openBlock as K, createBlock as X, resolveDynamicComponent as se, createElementBlock as F, createVNode as L, withCtx as ie, createElementVNode as ce, toDisplayString as ue, toRef as T, useSlots as de, renderSlot as j, unref as p } from "vue";
2
- import { AgGridVue as fe } from "ag-grid-vue3";
3
- import { ModuleRegistry as ve, AllCommunityModule as me, ClientSideRowModelModule as Ce, InfiniteRowModelModule as pe, themeQuartz as ge } from "ag-grid-community";
4
- import { createI18n as he, i18nTComponent as ye } from "@kong-ui-public/i18n";
5
- var x = /* @__PURE__ */ ((e) => (e.PENDING = "PENDING", e.LOADING = "LOADING", e.SUCCESS = "SUCCESS", e.ERROR = "ERROR", e))(x || {});
6
- const Se = (e) => !!e?.length;
7
- function be(e, i, t, a = Se, l = !1) {
8
- const s = y(() => a(e.value)), o = y(() => {
9
- const n = e.value !== void 0, r = i.value !== void 0 && i.value !== null;
10
- return t.value ? "LOADING" : r && l ? "ERROR" : s.value ? "SUCCESS" : r ? "ERROR" : n ? "SUCCESS" : "PENDING";
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
11
  });
12
12
  return {
13
- fetchState: x,
14
- hasData: s,
15
- state: o
13
+ fetchState: T,
14
+ hasData: n,
15
+ state: i
16
16
  };
17
17
  }
18
- const ke = ({
18
+ const ue = ({
19
19
  emitState: e,
20
- emitInitialState: i = !1,
21
- fetchLifecycleState: t,
22
- hasData: a
20
+ fetchLifecycleState: r,
21
+ hasData: t
23
22
  }) => {
24
- G(
23
+ B(
25
24
  () => ({
26
- hasData: a.value,
27
- state: t.value
25
+ hasData: t.value,
26
+ state: r.value
28
27
  }),
29
- ({ hasData: l, state: s }) => {
30
- if (s !== x.PENDING) {
31
- if (s === x.LOADING) {
28
+ ({ hasData: l, state: n }) => {
29
+ if (n !== T.PENDING) {
30
+ if (n === T.LOADING) {
32
31
  e({
33
32
  hasData: l,
34
33
  state: "loading"
35
34
  });
36
35
  return;
37
36
  }
38
- if (s === x.ERROR) {
37
+ if (n === T.ERROR) {
39
38
  e({
40
39
  hasData: l,
41
40
  state: "error"
@@ -47,218 +46,167 @@ const ke = ({
47
46
  state: "success"
48
47
  });
49
48
  }
50
- },
51
- { immediate: i }
49
+ }
52
50
  );
53
- }, we = ({ startRow: e, endRow: i }) => {
54
- const t = i - e;
51
+ }, de = ({ startRow: e, endRow: r }) => {
52
+ const t = r - e;
55
53
  return {
56
54
  blockIndex: t > 0 ? Math.floor(e / t) : 0,
57
55
  pageSize: t
58
56
  };
59
- }, De = ({
57
+ }, me = ({
60
58
  startRow: e,
61
- rowsLength: i,
59
+ rowsLength: r,
62
60
  pageSize: t,
63
- total: a,
64
- hasMore: l
61
+ total: l,
62
+ hasMore: n
65
63
  }) => {
66
- if (typeof a == "number")
67
- return a;
68
- if (l !== !0 && (l === !1 || i < t))
69
- return e + i;
70
- }, Re = ({
64
+ if (typeof l == "number")
65
+ return l;
66
+ if (n !== !0 && (n === !1 || r < t))
67
+ return e + r;
68
+ }, fe = ({
71
69
  fetcher: e,
72
- resetKey: i,
70
+ resetKey: r,
73
71
  sort: t
74
72
  }) => {
75
- const a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), s = I(0), o = E(), m = E(), n = E(), r = I(0), u = I(!1), g = (c) => c === s.value, b = () => {
76
- u.value = r.value > 0;
77
- }, w = () => {
78
- n.value = void 0, r.value += 1, b();
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;
79
75
  }, D = () => {
80
- r.value = Math.max(0, r.value - 1), b();
76
+ a.value = void 0, s.value += 1, k();
77
+ }, w = () => {
78
+ s.value = Math.max(0, s.value - 1), k();
81
79
  }, C = (c) => {
82
- const d = l.get(c);
83
- if (d)
84
- return d;
85
- let v;
86
- const S = {
87
- promise: new Promise((f) => {
88
- v = f;
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;
89
87
  }),
90
- resolve: (f) => v(f)
88
+ resolve: (m) => d(m)
91
89
  };
92
- return l.set(c, S), S;
93
- }, k = (c, d) => {
94
- d.resolve(!1), l.get(c) === d && l.delete(c);
95
- }, O = async ({
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 ({
96
94
  blockIndex: c,
97
- currentBlockCompletion: d,
98
- datasourceId: v
95
+ currentBlockCompletion: u,
96
+ datasourceId: d
99
97
  }) => {
100
98
  if (c === 0)
101
99
  return "ready";
102
- const S = l.get(c - 1);
103
- if (!S)
104
- return k(c, d), "failed";
105
- const f = await S.promise;
106
- return g(v) ? f ? "ready" : (k(c, d), "failed") : (k(c, d), "stale");
107
- }, z = ({
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 = ({
108
106
  blockIndex: c,
109
- currentBlockCompletion: d,
110
- getRowsParams: v,
111
- pageSize: S,
112
- result: f
107
+ currentBlockCompletion: u,
108
+ getRowsParams: d,
109
+ pageSize: h,
110
+ result: m
113
111
  }) => {
114
- f.cursor !== void 0 && a.set(c, f.cursor), v.successCallback(f.data, De({
115
- startRow: v.startRow,
116
- rowsLength: f.data.length,
117
- pageSize: S,
118
- total: f.total,
119
- hasMore: f.hasMore
120
- })), v.startRow === 0 && (m.value = f.data), d.resolve(!0);
121
- }, M = ({
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
+ }, _ = ({
122
120
  blockIndex: c,
123
- currentBlockCompletion: d,
124
- fetchError: v,
125
- getRowsParams: S
121
+ currentBlockCompletion: u,
122
+ fetchError: d,
123
+ getRowsParams: h
126
124
  }) => {
127
- n.value = v, S.failCallback(), k(c, d);
128
- }, N = () => {
129
- const c = s.value + 1;
130
- return s.value = c, a.clear(), l.clear(), m.value = void 0, n.value = void 0, r.value = 0, b(), {
131
- async getRows(d) {
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) {
132
130
  const {
133
- blockIndex: v,
134
- pageSize: S
135
- } = we({
136
- startRow: d.startRow,
137
- endRow: d.endRow
138
- }), f = C(v);
139
- if (await O({
140
- blockIndex: v,
141
- currentBlockCompletion: f,
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,
142
140
  datasourceId: c
143
141
  }) !== "ready") {
144
- d.failCallback();
142
+ u.failCallback();
145
143
  return;
146
144
  }
147
- g(c) && w();
145
+ g(c) && D();
148
146
  try {
149
- const _ = v > 0 ? a.get(v - 1) : void 0, A = await e({
147
+ const R = d > 0 ? l.get(d - 1) : void 0, z = await e({
150
148
  mode: "infinite",
151
- pageSize: S,
152
- cursor: _,
149
+ pageSize: h,
150
+ cursor: R,
153
151
  // Always read the latest sort, not a stale one.
154
152
  sort: t?.value
155
153
  });
156
154
  if (!g(c)) {
157
- d.failCallback(), k(v, f);
155
+ u.failCallback(), b(d, m);
158
156
  return;
159
157
  }
160
- z({
161
- blockIndex: v,
162
- currentBlockCompletion: f,
163
- getRowsParams: d,
164
- pageSize: S,
165
- result: A
158
+ M({
159
+ blockIndex: d,
160
+ currentBlockCompletion: m,
161
+ getRowsParams: u,
162
+ pageSize: h,
163
+ result: z
166
164
  });
167
- } catch (_) {
165
+ } catch (R) {
168
166
  if (!g(c)) {
169
- d.failCallback(), k(v, f);
167
+ u.failCallback(), b(d, m);
170
168
  return;
171
169
  }
172
- M({
173
- blockIndex: v,
174
- currentBlockCompletion: f,
175
- fetchError: _,
176
- getRowsParams: d
170
+ _({
171
+ blockIndex: d,
172
+ currentBlockCompletion: m,
173
+ fetchError: R,
174
+ getRowsParams: u
177
175
  });
178
176
  } finally {
179
- g(c) && D();
177
+ g(c) && w();
180
178
  }
181
179
  }
182
180
  };
183
- }, B = () => {
184
- o.value = N();
181
+ }, F = () => {
182
+ o.value = A();
185
183
  };
186
- return G(
187
- () => i?.value,
184
+ return B(
185
+ () => r?.value,
188
186
  () => {
189
- B();
187
+ F();
190
188
  },
191
189
  { immediate: !0 }
192
190
  ), {
193
- datasource: R(o),
194
- data: R(m),
195
- error: R(n),
196
- isFetching: R(u)
197
- };
198
- }, Ie = ({
199
- fetcher: e,
200
- resetKey: i
201
- }) => {
202
- const t = E(), a = E(), l = I(!1);
203
- let s = 0, o = !1, m = !1, n = !1;
204
- const r = async () => {
205
- if (m)
206
- return;
207
- const g = ++s;
208
- l.value = !0, a.value = void 0;
209
- try {
210
- const b = await e.value({ mode: "unpaginated" });
211
- if (g !== s)
212
- return;
213
- t.value = b.data;
214
- } catch (b) {
215
- g === s && (a.value = b);
216
- } finally {
217
- g === s && (l.value = !1);
218
- }
219
- }, u = () => {
220
- s += 1, l.value = !0, a.value = void 0, !o && (o = !0, queueMicrotask(() => {
221
- o = !1, r();
222
- }));
191
+ datasource: x(o),
192
+ data: x(f),
193
+ error: x(a),
194
+ isFetching: x(v)
223
195
  };
224
- return G(
225
- [
226
- () => i?.value,
227
- e
228
- ],
229
- () => {
230
- if (!n) {
231
- n = !0, r();
232
- return;
233
- }
234
- u();
235
- },
236
- { flush: "sync", immediate: !0 }
237
- ), oe() && ae(() => {
238
- m = !0, s += 1;
239
- }), {
240
- data: R(t),
241
- // The client-side row model has no AG Grid datasource. Keeping this
242
- // explicit lets the component bind one common fetch-result shape without
243
- // creating the infinite cursor machinery for this mode.
244
- datasource: void 0,
245
- error: R(a),
246
- isFetching: R(l)
247
- };
248
- }, Ee = {
196
+ }, ve = {
249
197
  key: 1,
250
198
  class: "table-data-grid-cell-renderer"
251
- }, _e = /* @__PURE__ */ Q({
199
+ }, Ce = /* @__PURE__ */ $({
252
200
  name: "TableDataGridCellRenderer",
253
201
  __name: "TableDataGridCellRenderer",
254
202
  props: {
255
203
  params: {}
256
204
  },
257
- setup(e, { expose: i }) {
258
- const t = E(e.params), a = I(null), l = I(!1), s = y(() => t.value.valueFormatted ?? String(t.value.value ?? "")), o = y(() => {
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(() => {
259
207
  const C = t.value.colDef?.colId;
260
208
  return C ? t.value.context?.cells?.slots?.[C] : void 0;
261
- }), m = y(() => ({
209
+ }), f = S(() => ({
262
210
  column: t.value.headerDef,
263
211
  refreshCell: () => {
264
212
  const C = t.value.node;
@@ -268,64 +216,64 @@ const ke = ({
268
216
  rowIndex: t.value.node?.rowIndex ?? 0,
269
217
  rowValue: t.value.value,
270
218
  selected: t.value.node?.isSelected() ?? !1
271
- })), n = () => o.value?.(m.value);
272
- let r, u, g = !1;
273
- const b = () => {
274
- const C = a.value;
275
- l.value = !!C && C.scrollWidth > C.clientWidth;
276
- }, w = () => {
277
- g || (u !== void 0 && cancelAnimationFrame(u), u = requestAnimationFrame(() => {
278
- u = void 0, b();
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();
279
227
  }));
280
- }, D = (C) => {
281
- if (r?.disconnect(), C) {
282
- r?.observe(C);
283
- const k = C.closest(".ag-cell");
284
- k && r?.observe(k);
228
+ }, w = (C) => {
229
+ if (s?.disconnect(), C) {
230
+ s?.observe(C);
231
+ const b = C.closest(".ag-cell");
232
+ b && s?.observe(b);
285
233
  }
286
- w();
234
+ D();
287
235
  };
288
- return ne(() => {
289
- r = new ResizeObserver(w), D(a.value);
290
- }), G(a, D, { flush: "post" }), le(() => {
291
- g = !0, r?.disconnect(), u !== void 0 && cancelAnimationFrame(u);
292
- }), i({
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({
293
241
  refresh(C) {
294
- return t.value = C, re(w), !0;
242
+ return t.value = C, Q(D), !0;
295
243
  }
296
- }), (C, k) => {
297
- const O = J("KTooltip");
298
- return o.value ? (K(), X(se(n), { key: 0 })) : (K(), F("span", Ee, [
299
- L(O, {
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, {
300
248
  class: "table-data-grid-cell-tooltip",
301
- disabled: !l.value,
249
+ disabled: !n.value,
302
250
  "kpop-attributes": { popoverDelay: 400 },
303
251
  "max-width": "300",
304
252
  placement: "bottom-start",
305
253
  target: "body",
306
- text: s.value
254
+ text: i.value
307
255
  }, {
308
- default: ie(() => [
309
- ce("span", {
256
+ default: X(() => [
257
+ Y("span", {
310
258
  ref_key: "contentElement",
311
- ref: a,
259
+ ref: l,
312
260
  class: "table-data-grid-cell-content"
313
- }, ue(s.value), 513)
261
+ }, Z(i.value), 513)
314
262
  ]),
315
263
  _: 1
316
264
  }, 8, ["disabled", "text"])
317
265
  ]));
318
266
  };
319
267
  }
320
- }), Ke = ({
268
+ }), pe = ({
321
269
  headers: e,
322
- slots: i,
270
+ slots: r,
323
271
  initialSort: t
324
272
  }) => {
325
- const a = y(() => ({
326
- cells: { slots: i }
327
- })), l = (o) => {
328
- const m = t?.sortColumnKey === o.key;
273
+ const l = S(() => ({
274
+ cells: { slots: r }
275
+ })), n = (o) => {
276
+ const f = t?.sortColumnKey === o.key;
329
277
  return {
330
278
  colId: o.key,
331
279
  // Columns with no explicit width constraint share remaining space equally.
@@ -335,240 +283,235 @@ const ke = ({
335
283
  minWidth: o.minWidth,
336
284
  sortable: o.sortable ?? !1,
337
285
  unSortIcon: o.showSortIcon,
338
- ...m ? { initialSort: t?.sortColumnOrder, initialSortIndex: 0 } : {},
339
- valueGetter: (n) => n.data?.[o.key],
286
+ ...f ? { initialSort: t?.sortColumnOrder, initialSortIndex: 0 } : {},
287
+ valueGetter: (a) => a.data?.[o.key],
340
288
  width: o.width,
341
- cellRenderer: _e,
289
+ cellRenderer: Ce,
342
290
  // custom params passed to the cell renderer.
343
291
  cellRendererParams: { headerDef: o }
344
292
  };
345
293
  };
346
294
  return {
347
- columnDefs: y(() => e.value.map(l)),
348
- gridContext: a
295
+ columnDefs: S(() => e.value.map(n)),
296
+ gridContext: l
349
297
  };
350
298
  }, U = ({
351
299
  config: e,
352
- headers: i,
300
+ headers: r,
353
301
  pageSize: t
354
302
  }) => {
355
- const a = new Set(i.filter((s) => s.sortable).map((s) => s.key)), l = e?.sortColumnKey && a.has(e.sortColumnKey) ? e.sortColumnKey : void 0;
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;
356
304
  return {
357
- sortColumnKey: l,
358
- sortColumnOrder: l ? e?.sortColumnOrder : void 0,
305
+ sortColumnKey: n,
306
+ sortColumnOrder: n ? e?.sortColumnOrder : void 0,
359
307
  pageSize: e?.pageSize ?? t
360
308
  };
361
- }, H = (e, i) => e.sortColumnKey === i.sortColumnKey && e.sortColumnOrder === i.sortColumnOrder && e.pageSize === i.pageSize, Oe = ({
309
+ }, W = (e, r) => e.sortColumnKey === r.sortColumnKey && e.sortColumnOrder === r.sortColumnOrder && e.pageSize === r.pageSize, ge = ({
362
310
  headers: e,
363
- pageSize: i,
311
+ pageSize: r,
364
312
  tableConfig: t,
365
- emitTableConfigUpdate: a,
366
- onExternalConfigChange: l
313
+ emitTableConfigUpdate: l,
314
+ onExternalConfigChange: n
367
315
  }) => {
368
- const s = y(() => t.value ? U({ config: t.value, headers: e.value, pageSize: i.value }) : void 0), o = I(
369
- s.value ?? U({ config: void 0, headers: e.value, pageSize: i.value })
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 })
370
318
  );
371
- G(s, (u) => {
372
- u && !H(u, o.value) && (o.value = u, l?.(u));
319
+ B(i, (v) => {
320
+ v && !W(v, o.value) && (o.value = v, n?.(v));
373
321
  });
374
- const m = (u) => {
322
+ const f = (v) => {
375
323
  const g = U({
376
- config: { ...o.value, ...u },
324
+ config: { ...o.value, ...v },
377
325
  headers: e.value,
378
- pageSize: i.value
326
+ pageSize: r.value
379
327
  });
380
- H(g, o.value) || (o.value = g, a(g));
381
- }, n = y(() => ({
328
+ W(g, o.value) || (o.value = g, l(g));
329
+ }, a = S(() => ({
382
330
  sortColumnKey: o.value.sortColumnKey,
383
331
  sortColumnOrder: o.value.sortColumnOrder
384
- })), r = y(() => t.value?.pageSize ?? i.value);
332
+ })), s = S(() => t.value?.pageSize ?? r.value);
385
333
  return {
386
- activeTableConfig: R(o),
387
- activeSort: n,
388
- activePageSize: r,
389
- patchTableConfig: m
334
+ activeTableConfig: x(o),
335
+ activeSort: a,
336
+ activePageSize: s,
337
+ patchTableConfig: f
390
338
  };
391
- }, xe = ({
339
+ }, he = ({
392
340
  cellClick: e,
393
- headers: i,
341
+ headers: r,
394
342
  rowClick: t
395
343
  }) => {
396
- const a = y(() => new Set(
397
- i.value.filter((n) => n.disableRowClick).map((n) => n.key)
398
- )), l = (n) => {
399
- const r = n.event?.target;
400
- return r instanceof Element ? r.closest(".ag-cell")?.getAttribute("col-id") ?? void 0 : void 0;
401
- }, s = (n) => {
402
- const r = l(n);
403
- return !!(r && a.value.has(r));
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));
404
352
  };
405
353
  return {
406
- onCellClick: (n) => {
407
- const r = n.colDef.colId;
408
- !n.data || !r || e({
409
- columnKey: r,
410
- row: n.data,
411
- value: n.value
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
412
360
  });
413
361
  },
414
- onRowClick: (n) => {
415
- n.data && !s(n) && t(n.data, n);
362
+ onRowClick: (a) => {
363
+ a.data && !i(a) && t(a.data, a);
416
364
  }
417
365
  };
418
- }, Ge = ({
366
+ }, ye = ({
419
367
  activeSort: e,
420
- emitSort: i,
368
+ emitSort: r,
421
369
  patchTableConfig: t
422
370
  }) => {
423
- const a = (s, o) => {
424
- s.applyColumnState({
371
+ const l = (i, o) => {
372
+ i.applyColumnState({
425
373
  state: o.sortColumnKey ? [{ colId: o.sortColumnKey, sort: o.sortColumnOrder ?? null, sortIndex: 0 }] : [],
426
374
  defaultState: { sort: null, sortIndex: null }
427
375
  });
428
376
  };
429
- return { onSortChanged: (s) => {
430
- const o = s.api.getColumnState().filter((r) => r.sort).sort((r, u) => (r.sortIndex ?? 0) - (u.sortIndex ?? 0)), m = o[o.length - 1], n = m ? { sortColumnKey: m.colId, sortColumnOrder: m.sort } : { sortColumnKey: void 0, sortColumnOrder: void 0 };
431
- n.sortColumnKey === e.value.sortColumnKey && n.sortColumnOrder === e.value.sortColumnOrder || (i(n), t(n), o.length > 1 && a(s.api, n));
432
- }, applySortToGrid: a };
433
- }, Te = { title: "No Data", message: "There is no data to display." }, Fe = { title: "An error occurred", message: "Data cannot be displayed due to an error." }, ze = {
434
- emptyState: Te,
435
- errorState: Fe
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
436
384
  };
437
- function Me() {
438
- const e = he("en-us", ze);
385
+ function De() {
386
+ const e = ne("en-us", ke);
439
387
  return {
440
388
  i18n: e,
441
- i18nT: ye(e)
389
+ i18nT: se(e)
442
390
  // Translation component <i18n-t>
443
391
  };
444
392
  }
445
- const Ne = {
393
+ const we = {
446
394
  class: "kong-ui-public-table-data-grid",
447
395
  "data-testid": "table-data-grid"
448
- }, Be = {
396
+ }, Re = {
449
397
  key: 0,
450
398
  class: "table-error-state",
451
399
  "data-testid": "table-error-state"
452
- }, Ae = {
400
+ }, Ie = {
453
401
  key: 1,
454
402
  class: "table-empty-state",
455
403
  "data-testid": "table-empty-state"
456
- }, Ue = /* @__PURE__ */ Q({
404
+ }, Ee = /* @__PURE__ */ $({
457
405
  __name: "TableDataGrid",
458
406
  props: {
459
407
  headers: {},
460
- error: { type: Boolean },
461
- pageSize: {},
462
- refreshKey: { type: [String, Number, Boolean] },
463
- tableConfig: {},
464
408
  fetcher: { type: Function },
465
- mode: {}
409
+ error: { type: Boolean, default: !1 },
410
+ pageSize: { default: 25 },
411
+ refreshKey: { type: [String, Number, Boolean] },
412
+ tableConfig: {}
466
413
  },
467
414
  emits: ["grid:ready", "state", "row:click", "cell:click", "sort", "update:tableConfig"],
468
- setup(e, { emit: i }) {
469
- ve.registerModules([me, Ce, pe]);
470
- const t = e, a = t.mode ?? "infinite", l = T(t, "headers"), s = y(() => t.error ?? !1), o = y(() => t.pageSize ?? 25), m = T(t, "refreshKey"), n = T(t, "tableConfig"), r = i, { i18n: { t: u } } = Me(), g = de(), b = E(), { activeTableConfig: w, activeSort: D, activePageSize: C, patchTableConfig: k } = Oe({
471
- headers: l,
472
- pageSize: o,
473
- tableConfig: n,
474
- emitTableConfigUpdate: (h) => r("update:tableConfig", h),
475
- onExternalConfigChange: (h) => {
476
- b.value && z(b.value, h);
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);
477
424
  }
478
- }), { onSortChanged: O, applySortToGrid: z } = Ge({
479
- activeSort: D,
480
- emitSort: (h) => r("sort", h),
481
- patchTableConfig: k
482
- }), { columnDefs: M, gridContext: N } = Ke({
483
- headers: l,
484
- slots: g,
485
- initialSort: D.value
486
- }), { onCellClick: B, onRowClick: c } = xe({
487
- cellClick: (h) => r("cell:click", h),
488
- headers: l,
489
- rowClick: (h, $) => r("row:click", h, $)
490
- }), d = {
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 = {
491
438
  resizable: !1,
492
439
  sortable: !1,
493
440
  suppressMovable: !0
494
- }, v = y(() => a === "unpaginated" ? [t.fetcher, m.value] : [
495
- t.fetcher,
496
- C.value,
497
- m.value,
498
- w.value.sortColumnKey,
499
- w.value.sortColumnOrder
500
- ]), S = t.mode === "unpaginated" ? Ie({
501
- fetcher: T(() => t.fetcher),
502
- resetKey: v
503
- }) : Re({
504
- fetcher: t.fetcher,
505
- resetKey: v,
506
- sort: D
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
507
456
  }), {
508
- data: f,
509
- error: V,
510
- isFetching: _
511
- } = S, { datasource: A } = S, Y = y(() => f.value ? Array.from(f.value) : void 0), {
512
- fetchState: Z,
513
- hasData: W,
514
- state: q
515
- } = be(f, V, _, void 0, a === "unpaginated"), ee = y(() => q.value === Z.SUCCESS && !W.value);
516
- ke({
517
- emitState: (h) => r("state", h),
518
- emitInitialState: a === "unpaginated",
519
- fetchLifecycleState: q,
520
- hasData: W
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
521
465
  });
522
- const te = (h) => {
523
- b.value = h.api, r("grid:ready", h.api);
466
+ const m = (p) => {
467
+ i.value = p.api, t("grid:ready", p.api);
524
468
  };
525
- return (h, $) => {
526
- const P = J("KEmptyState");
527
- return K(), F("div", Ne, [
528
- s.value ? (K(), F("div", Be, [
529
- j(h.$slots, "error-state", {}, () => [
530
- L(P, {
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, {
531
475
  "icon-variant": "error",
532
- message: p(u)("errorState.message"),
533
- title: p(u)("errorState.title")
476
+ message: y(l)("errorState.message"),
477
+ title: y(l)("errorState.title")
534
478
  }, null, 8, ["message", "title"])
535
479
  ], !0)
536
- ])) : ee.value ? (K(), F("div", Ae, [
537
- j(h.$slots, "empty-state", {}, () => [
538
- L(P, {
539
- message: p(u)("emptyState.message"),
540
- title: p(u)("emptyState.title")
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")
541
485
  }, null, 8, ["message", "title"])
542
486
  ], !0)
543
- ])) : (K(), X(p(fe), {
544
- key: p(a),
545
- "cache-block-size": p(a) === "infinite" ? p(C) : void 0,
487
+ ])) : (I(), P(y(te), {
488
+ key: 2,
489
+ "cache-block-size": y(a),
546
490
  class: "table-data-grid-grid",
547
- "column-defs": p(M),
548
- context: p(N),
549
- datasource: p(a) === "infinite" ? p(A) : void 0,
550
- "default-col-def": d,
551
- "infinite-initial-row-count": p(a) === "infinite" ? 1 : void 0,
552
- loading: p(_),
553
- "row-data": p(a) === "unpaginated" ? Y.value : void 0,
554
- "row-model-type": p(a) === "unpaginated" ? "clientSide" : "infinite",
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",
555
498
  "suppress-cell-focus": !0,
556
499
  "suppress-multi-sort": !0,
557
- theme: p(ge),
558
- onCellClicked: p(B),
559
- onGridReady: te,
560
- onRowClicked: p(c),
561
- onSortChanged: p(O)
562
- }, null, 8, ["cache-block-size", "column-defs", "context", "datasource", "infinite-initial-row-count", "loading", "row-data", "row-model-type", "theme", "onCellClicked", "onRowClicked", "onSortChanged"]))
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"]))
563
506
  ]);
564
507
  };
565
508
  }
566
- }), Le = (e, i) => {
509
+ }), Ke = (e, r) => {
567
510
  const t = e.__vccOpts || e;
568
- for (const [a, l] of i)
569
- t[a] = l;
511
+ for (const [l, n] of r)
512
+ t[l] = n;
570
513
  return t;
571
- }, Pe = /* @__PURE__ */ Le(Ue, [["__scopeId", "data-v-0ff95391"]]);
514
+ }, Fe = /* @__PURE__ */ Ke(Ee, [["__scopeId", "data-v-d8328fe5"]]);
572
515
  export {
573
- Pe as TableDataGrid
516
+ Fe as TableDataGrid
574
517
  };
@@ -1 +1 @@
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,U,E,G){"use strict";var _=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))(_||{});const L=t=>!!t?.length;function W(t,c,o,n=L,l=!1){const i=e.computed(()=>n(t.value)),a=e.computed(()=>{const r=t.value!==void 0,s=c.value!==void 0&&c.value!==null;return o.value?"LOADING":s&&l?"ERROR":i.value?"SUCCESS":s?"ERROR":r?"SUCCESS":"PENDING"});return{fetchState:_,hasData:i,state:a}}const $=({emitState:t,emitInitialState:c=!1,fetchLifecycleState:o,hasData:n})=>{e.watch(()=>({hasData:n.value,state:o.value}),({hasData:l,state:i})=>{if(i!==_.PENDING){if(i===_.LOADING){t({hasData:l,state:"loading"});return}if(i===_.ERROR){t({hasData:l,state:"error"});return}t({hasData:l,state:"success"})}},{immediate:c})},j=({startRow:t,endRow:c})=>{const o=c-t;return{blockIndex:o>0?Math.floor(t/o):0,pageSize:o}},P=({startRow:t,rowsLength:c,pageSize:o,total:n,hasMore:l})=>{if(typeof n=="number")return n;if(l!==!0&&(l===!1||c<o))return t+c},H=({fetcher:t,resetKey:c,sort:o})=>{const n=new Map,l=new Map,i=e.ref(0),a=e.shallowRef(),C=e.shallowRef(),r=e.shallowRef(),s=e.ref(0),u=e.ref(!1),g=d=>d===i.value,v=()=>{u.value=s.value>0},w=()=>{r.value=void 0,s.value+=1,v()},R=()=>{s.value=Math.max(0,s.value-1),v()},h=d=>{const f=l.get(d);if(f)return f;let p;const S={promise:new Promise(m=>{p=m}),resolve:m=>p(m)};return l.set(d,S),S},k=(d,f)=>{f.resolve(!1),l.get(d)===f&&l.delete(d)},I=async({blockIndex:d,currentBlockCompletion:f,datasourceId:p})=>{if(d===0)return"ready";const S=l.get(d-1);if(!S)return k(d,f),"failed";const m=await S.promise;return g(p)?m?"ready":(k(d,f),"failed"):(k(d,f),"stale")},O=({blockIndex:d,currentBlockCompletion:f,getRowsParams:p,pageSize:S,result:m})=>{m.cursor!==void 0&&n.set(d,m.cursor),p.successCallback(m.data,P({startRow:p.startRow,rowsLength:m.data.length,pageSize:S,total:m.total,hasMore:m.hasMore})),p.startRow===0&&(C.value=m.data),f.resolve(!0)},x=({blockIndex:d,currentBlockCompletion:f,fetchError:p,getRowsParams:S})=>{r.value=p,S.failCallback(),k(d,f)},T=()=>{const d=i.value+1;return i.value=d,n.clear(),l.clear(),C.value=void 0,r.value=void 0,s.value=0,v(),{async getRows(f){const{blockIndex:p,pageSize:S}=j({startRow:f.startRow,endRow:f.endRow}),m=h(p);if(await I({blockIndex:p,currentBlockCompletion:m,datasourceId:d})!=="ready"){f.failCallback();return}g(d)&&w();try{const D=p>0?n.get(p-1):void 0,F=await t({mode:"infinite",pageSize:S,cursor:D,sort:o?.value});if(!g(d)){f.failCallback(),k(p,m);return}O({blockIndex:p,currentBlockCompletion:m,getRowsParams:f,pageSize:S,result:F})}catch(D){if(!g(d)){f.failCallback(),k(p,m);return}x({blockIndex:p,currentBlockCompletion:m,fetchError:D,getRowsParams:f})}finally{g(d)&&R()}}}},B=()=>{a.value=T()};return e.watch(()=>c?.value,()=>{B()},{immediate:!0}),{datasource:e.readonly(a),data:e.readonly(C),error:e.readonly(r),isFetching:e.readonly(u)}},Q=({fetcher:t,resetKey:c})=>{const o=e.shallowRef(),n=e.shallowRef(),l=e.ref(!1);let i=0,a=!1,C=!1,r=!1;const s=async()=>{if(C)return;const g=++i;l.value=!0,n.value=void 0;try{const v=await t.value({mode:"unpaginated"});if(g!==i)return;o.value=v.data}catch(v){g===i&&(n.value=v)}finally{g===i&&(l.value=!1)}},u=()=>{i+=1,l.value=!0,n.value=void 0,!a&&(a=!0,queueMicrotask(()=>{a=!1,s()}))};return e.watch([()=>c?.value,t],()=>{if(!r){r=!0,s();return}u()},{flush:"sync",immediate:!0}),e.getCurrentScope()&&e.onScopeDispose(()=>{C=!0,i+=1}),{data:e.readonly(o),datasource:void 0,error:e.readonly(n),isFetching:e.readonly(l)}},J={key:1,class:"table-data-grid-cell-renderer"},X=e.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(t,{expose:c}){const o=e.shallowRef(t.params),n=e.ref(null),l=e.ref(!1),i=e.computed(()=>o.value.valueFormatted??String(o.value.value??"")),a=e.computed(()=>{const h=o.value.colDef?.colId;return h?o.value.context?.cells?.slots?.[h]:void 0}),C=e.computed(()=>({column:o.value.headerDef,refreshCell:()=>{const h=o.value.node;h&&o.value.api.refreshCells({force:!0,rowNodes:[h]})},row:o.value.data??{},rowIndex:o.value.node?.rowIndex??0,rowValue:o.value.value,selected:o.value.node?.isSelected()??!1})),r=()=>a.value?.(C.value);let s,u,g=!1;const v=()=>{const h=n.value;l.value=!!h&&h.scrollWidth>h.clientWidth},w=()=>{g||(u!==void 0&&cancelAnimationFrame(u),u=requestAnimationFrame(()=>{u=void 0,v()}))},R=h=>{if(s?.disconnect(),h){s?.observe(h);const k=h.closest(".ag-cell");k&&s?.observe(k)}w()};return e.onMounted(()=>{s=new ResizeObserver(w),R(n.value)}),e.watch(n,R,{flush:"post"}),e.onUnmounted(()=>{g=!0,s?.disconnect(),u!==void 0&&cancelAnimationFrame(u)}),c({refresh(h){return o.value=h,e.nextTick(w),!0}}),(h,k)=>{const I=e.resolveComponent("KTooltip");return a.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r),{key:0})):(e.openBlock(),e.createElementBlock("span",J,[e.createVNode(I,{class:"table-data-grid-cell-tooltip",disabled:!l.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:n,class:"table-data-grid-cell-content"},e.toDisplayString(i.value),513)]),_:1},8,["disabled","text"])]))}}}),Y=({headers:t,slots:c,initialSort:o})=>{const n=e.computed(()=>({cells:{slots:c}})),l=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:r=>r.data?.[a.key],width:a.width,cellRenderer:X,cellRendererParams:{headerDef:a}}};return{columnDefs:e.computed(()=>t.value.map(l)),gridContext:n}},K=({config:t,headers:c,pageSize:o})=>{const n=new Set(c.filter(i=>i.sortable).map(i=>i.key)),l=t?.sortColumnKey&&n.has(t.sortColumnKey)?t.sortColumnKey:void 0;return{sortColumnKey:l,sortColumnOrder:l?t?.sortColumnOrder:void 0,pageSize:t?.pageSize??o}},N=(t,c)=>t.sortColumnKey===c.sortColumnKey&&t.sortColumnOrder===c.sortColumnOrder&&t.pageSize===c.pageSize,Z=({headers:t,pageSize:c,tableConfig:o,emitTableConfigUpdate:n,onExternalConfigChange:l})=>{const i=e.computed(()=>o.value?K({config:o.value,headers:t.value,pageSize:c.value}):void 0),a=e.ref(i.value??K({config:void 0,headers:t.value,pageSize:c.value}));e.watch(i,u=>{u&&!N(u,a.value)&&(a.value=u,l?.(u))});const C=u=>{const g=K({config:{...a.value,...u},headers:t.value,pageSize:c.value});N(g,a.value)||(a.value=g,n(g))},r=e.computed(()=>({sortColumnKey:a.value.sortColumnKey,sortColumnOrder:a.value.sortColumnOrder})),s=e.computed(()=>o.value?.pageSize??c.value);return{activeTableConfig:e.readonly(a),activeSort:r,activePageSize:s,patchTableConfig:C}},ee=({cellClick:t,headers:c,rowClick:o})=>{const n=e.computed(()=>new Set(c.value.filter(r=>r.disableRowClick).map(r=>r.key))),l=r=>{const s=r.event?.target;return s instanceof Element?s.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},i=r=>{const s=l(r);return!!(s&&n.value.has(s))};return{onCellClick:r=>{const s=r.colDef.colId;!r.data||!s||t({columnKey:s,row:r.data,value:r.value})},onRowClick:r=>{r.data&&!i(r)&&o(r.data,r)}}},te=({activeSort:t,emitSort:c,patchTableConfig:o})=>{const n=(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(s=>s.sort).sort((s,u)=>(s.sortIndex??0)-(u.sortIndex??0)),C=a[a.length-1],r=C?{sortColumnKey:C.colId,sortColumnOrder:C.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};r.sortColumnKey===t.value.sortColumnKey&&r.sortColumnOrder===t.value.sortColumnOrder||(c(r),o(r),a.length>1&&n(i.api,r))},applySortToGrid:n}},oe={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 ae(){const t=G.createI18n("en-us",oe);return{i18n:t,i18nT:G.i18nTComponent(t)}}const ne={class:"kong-ui-public-table-data-grid","data-testid":"table-data-grid"},re={key:0,class:"table-error-state","data-testid":"table-error-state"},le={key:1,class:"table-empty-state","data-testid":"table-empty-state"},se=((t,c)=>{const o=t.__vccOpts||t;for(const[n,l]of c)o[n]=l;return o})(e.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean},pageSize:{},refreshKey:{type:[String,Number,Boolean]},tableConfig:{},fetcher:{type:Function},mode:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(t,{emit:c}){E.ModuleRegistry.registerModules([E.AllCommunityModule,E.ClientSideRowModelModule,E.InfiniteRowModelModule]);const o=t,n=o.mode??"infinite",l=e.toRef(o,"headers"),i=e.computed(()=>o.error??!1),a=e.computed(()=>o.pageSize??25),C=e.toRef(o,"refreshKey"),r=e.toRef(o,"tableConfig"),s=c,{i18n:{t:u}}=ae(),g=e.useSlots(),v=e.shallowRef(),{activeTableConfig:w,activeSort:R,activePageSize:h,patchTableConfig:k}=Z({headers:l,pageSize:a,tableConfig:r,emitTableConfigUpdate:y=>s("update:tableConfig",y),onExternalConfigChange:y=>{v.value&&O(v.value,y)}}),{onSortChanged:I,applySortToGrid:O}=te({activeSort:R,emitSort:y=>s("sort",y),patchTableConfig:k}),{columnDefs:x,gridContext:T}=Y({headers:l,slots:g,initialSort:R.value}),{onCellClick:B,onRowClick:d}=ee({cellClick:y=>s("cell:click",y),headers:l,rowClick:(y,V)=>s("row:click",y,V)}),f={resizable:!1,sortable:!1,suppressMovable:!0},p=e.computed(()=>n==="unpaginated"?[o.fetcher,C.value]:[o.fetcher,h.value,C.value,w.value.sortColumnKey,w.value.sortColumnOrder]),S=o.mode==="unpaginated"?Q({fetcher:e.toRef(()=>o.fetcher),resetKey:p}):H({fetcher:o.fetcher,resetKey:p,sort:R}),{data:m,error:z,isFetching:D}=S,{datasource:F}=S,ie=e.computed(()=>m.value?Array.from(m.value):void 0),{fetchState:ce,hasData:M,state:A}=W(m,z,D,void 0,n==="unpaginated"),de=e.computed(()=>A.value===ce.SUCCESS&&!M.value);$({emitState:y=>s("state",y),emitInitialState:n==="unpaginated",fetchLifecycleState:A,hasData:M});const ue=y=>{v.value=y.api,s("grid:ready",y.api)};return(y,V)=>{const q=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",ne,[i.value?(e.openBlock(),e.createElementBlock("div",re,[e.renderSlot(y.$slots,"error-state",{},()=>[e.createVNode(q,{"icon-variant":"error",message:e.unref(u)("errorState.message"),title:e.unref(u)("errorState.title")},null,8,["message","title"])],!0)])):de.value?(e.openBlock(),e.createElementBlock("div",le,[e.renderSlot(y.$slots,"empty-state",{},()=>[e.createVNode(q,{message:e.unref(u)("emptyState.message"),title:e.unref(u)("emptyState.title")},null,8,["message","title"])],!0)])):(e.openBlock(),e.createBlock(e.unref(U.AgGridVue),{key:e.unref(n),"cache-block-size":e.unref(n)==="infinite"?e.unref(h):void 0,class:"table-data-grid-grid","column-defs":e.unref(x),context:e.unref(T),datasource:e.unref(n)==="infinite"?e.unref(F):void 0,"default-col-def":f,"infinite-initial-row-count":e.unref(n)==="infinite"?1:void 0,loading:e.unref(D),"row-data":e.unref(n)==="unpaginated"?ie.value:void 0,"row-model-type":e.unref(n)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:e.unref(E.themeQuartz),onCellClicked:e.unref(B),onGridReady:ue,onRowClicked:e.unref(d),onSortChanged:e.unref(I)},null,8,["cache-block-size","column-defs","context","datasource","infinite-initial-row-count","loading","row-data","row-model-type","theme","onCellClicked","onRowClicked","onSortChanged"]))])}}}),[["__scopeId","data-v-0ff95391"]]);b.TableDataGrid=se,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
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,7 +1,14 @@
1
- import type { TableDataGridCellClickPayload, TableDataGridCellSlotProps, TableDataGridConfig, TableDataGridProps, TableDataGridSort, TableDataGridStatePayload } from '../types';
1
+ import type { TableDataGridCellClickPayload, TableDataGridCellSlotProps, TableDataGridConfig, TableDataGridFetcher, TableDataGridHeader, TableDataGridSort, TableDataGridStatePayload } from '../types';
2
2
  import type { GridApi, GridReadyEvent, RowClickedEvent } from 'ag-grid-community';
3
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<TableDataGridProps<Row> & {
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
+ } & {
5
12
  onState?: ((payload: TableDataGridStatePayload) => any) | undefined;
6
13
  onSort?: ((payload: TableDataGridSort) => any) | undefined;
7
14
  "onGrid:ready"?: ((api: GridApi<Row>) => any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"TableDataGrid.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGrid.vue"],"names":[],"mappings":"AAsQA,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAEV,OAAO,EACP,cAAc,EACd,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAoB1B,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;WAmSO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;;;;;;;KAAmC,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;;qCAtRoB,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,WA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3
3
  import { fetchState } from './useFetchState';
4
4
  type UseEmitStateOptions = {
5
5
  emitState: (payload: TableDataGridStatePayload) => void;
6
- emitInitialState?: boolean;
7
6
  fetchLifecycleState: Readonly<Ref<fetchState>>;
8
7
  hasData: Readonly<Ref<boolean>>;
9
8
  };
10
- export declare const useEmitState: ({ emitState, emitInitialState, fetchLifecycleState, hasData, }: UseEmitStateOptions) => void;
9
+ export declare const useEmitState: ({ emitState, fetchLifecycleState, hasData, }: UseEmitStateOptions) => void;
11
10
  export {};
12
11
  //# sourceMappingURL=useEmitState.d.ts.map
@@ -1 +1 @@
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,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,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,gEAK1B,mBAAmB,SAoCrB,CAAA"}
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"}
@@ -24,10 +24,7 @@ type FetchStateData<Row> = readonly Row[] | undefined;
24
24
  * @param isFetching Whether at least one fetch request is currently pending.
25
25
  * @param hasDataCallback Optional row detector for callers that need a custom
26
26
  * definition of meaningful data.
27
- * @param errorTakesPrecedence Whether a settled error should remain visible
28
- * when rows from an earlier request are still available. Infinite consumers
29
- * retain their existing data-first behavior by default.
30
27
  */
31
- export default function useFetchState<Row>(data: Readonly<Ref<FetchStateData<Row>>>, error: Readonly<Ref<unknown>>, isFetching: Readonly<Ref<boolean>>, hasDataCallback?: (data: FetchStateData<Row>) => boolean, errorTakesPrecedence?: boolean): UseFetchStateResult;
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;
32
29
  export {};
33
30
  //# sourceMappingURL=useFetchState.d.ts.map
@@ -1 +1 @@
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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,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,5 +1,5 @@
1
1
  import type { GridApi } from 'ag-grid-community';
2
- export type TableDataGridMode = 'infinite' | 'unpaginated';
2
+ export type TableDataGridMode = 'infinite';
3
3
  export type TableDataGridRow = Record<string, unknown>;
4
4
  export type TableDataGridState = 'loading' | 'success' | 'error';
5
5
  export type TableDataGridStatePayload = {
@@ -50,28 +50,12 @@ export type TableDataGridSort = {
50
50
  export type TableDataGridConfig = TableDataGridSort & {
51
51
  pageSize?: number;
52
52
  };
53
- export type TableDataGridProps<Row extends object = TableDataGridRow> = {
54
- headers: Array<TableDataGridHeader<Row>>;
55
- error?: boolean;
56
- pageSize?: number;
57
- refreshKey?: string | number | boolean;
58
- tableConfig?: TableDataGridConfig;
59
- } & ({
60
- fetcher: TableDataGridFetcher<Row>;
61
- mode?: 'infinite';
62
- } | {
63
- fetcher: TableDataGridUnpaginatedFetcher<Row>;
64
- mode: 'unpaginated';
65
- });
66
53
  export interface TableDataGridInfiniteFetcherParams {
67
54
  mode: 'infinite';
68
55
  pageSize: number;
69
56
  cursor?: unknown;
70
57
  sort?: TableDataGridSort;
71
58
  }
72
- export interface TableDataGridUnpaginatedFetcherParams {
73
- mode: 'unpaginated';
74
- }
75
59
  export type TableDataGridFetcherResult<Row extends object = TableDataGridRow> = {
76
60
  data: Row[];
77
61
  cursor?: unknown;
@@ -79,9 +63,5 @@ export type TableDataGridFetcherResult<Row extends object = TableDataGridRow> =
79
63
  hasMore?: boolean;
80
64
  };
81
65
  export type TableDataGridFetcher<Row extends object = TableDataGridRow> = (params: TableDataGridInfiniteFetcherParams) => Promise<TableDataGridFetcherResult<Row>>;
82
- export type TableDataGridUnpaginatedFetcherResult<Row extends object = TableDataGridRow> = {
83
- data: Row[];
84
- };
85
- export type TableDataGridUnpaginatedFetcher<Row extends object = TableDataGridRow> = (params: TableDataGridUnpaginatedFetcherParams) => Promise<TableDataGridUnpaginatedFetcherResult<Row>>;
86
66
  export type TableDataGridReadyPayload<Row extends object = TableDataGridRow> = GridApi<Row>;
87
67
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,GAAG,aAAa,CAAA;AAC1D,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,MAA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AAG,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/table-data-grid",
3
- "version": "0.5.3-pr.3854.e369e8f09.0",
3
+ "version": "0.5.3",
4
4
  "type": "module",
5
5
  "main": "./dist/table-data-grid.umd.js",
6
6
  "module": "./dist/table-data-grid.es.js",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "@kong-ui-public/i18n": "^2.5.1",
25
- "@kong/kongponents": "9.64.15",
25
+ "@kong/kongponents": "9.64.18",
26
26
  "vue": "^3.5.41"
27
27
  },
28
28
  "repository": {
@@ -63,8 +63,7 @@
63
63
  "lint:fix": "eslint --fix",
64
64
  "stylelint": "stylelint --allow-empty-input './src/**/*.{css,scss,sass,less,styl,vue}'",
65
65
  "stylelint:fix": "stylelint --allow-empty-input './src/**/*.{css,scss,sass,less,styl,vue}' --fix",
66
- "typecheck": "vue-tsc -p './tsconfig.build.json' --noEmit && pnpm run typecheck:types",
67
- "typecheck:types": "vue-tsc -p './tsconfig.types.json' --noEmit",
66
+ "typecheck": "vue-tsc -p './tsconfig.build.json' --noEmit",
68
67
  "test:component": "BABEL_ENV=cypress cross-env FORCE_COLOR=1 cypress run --component -b chrome --spec './src/**/*.cy.ts' --project '../../../.'",
69
68
  "test:component:open": "BABEL_ENV=cypress cross-env FORCE_COLOR=1 cypress open --component -b chrome --project '../../../.'",
70
69
  "test:unit": "cross-env FORCE_COLOR=1 vitest run",
@@ -1,23 +0,0 @@
1
- import type { TableDataGridRow, TableDataGridUnpaginatedFetcher } from '../types';
2
- import type { Ref } from 'vue';
3
- interface UseFetchUnpaginatedOptions<Row extends object = TableDataGridRow> {
4
- /** Public fetcher supplied by the host. */
5
- fetcher: Readonly<Ref<TableDataGridUnpaginatedFetcher<Row>>>;
6
- /** Reactive invalidation input for the current query context. */
7
- resetKey?: Readonly<Ref<unknown>>;
8
- }
9
- /**
10
- * Owns the one-request lifecycle for a complete, non-paginated result.
11
- *
12
- * The client-side row model consumes the returned rows directly. A request
13
- * generation keeps responses from an invalidated query from replacing current
14
- * rows, errors, or loading state.
15
- */
16
- export declare const useFetchUnpaginated: <Row extends object = TableDataGridRow>({ fetcher, resetKey, }: UseFetchUnpaginatedOptions<Row>) => {
17
- data: Readonly<Ref<readonly import("vue").DeepReadonly<Row>[] | undefined, readonly import("vue").DeepReadonly<Row>[] | undefined>>;
18
- datasource: undefined;
19
- error: Readonly<Ref<Readonly<unknown>, Readonly<unknown>>>;
20
- isFetching: Readonly<Ref<boolean, boolean>>;
21
- };
22
- export {};
23
- //# sourceMappingURL=useFetchUnpaginated.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFetchUnpaginated.d.ts","sourceRoot":"","sources":["../../../src/composables/useFetchUnpaginated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,+BAA+B,EAChC,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG9B,UAAU,0BAA0B,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB;IACxE,2CAA2C;IAC3C,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,+BAA+B,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC5D,iEAAiE;IACjE,QAAQ,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;CAClC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,wBAGxE,0BAA0B,CAAC,GAAG,CAAC;;;;;CA0FjC,CAAA"}